checking panel pointer bmap

Posted By: Reconnoiter

checking panel pointer bmap - 12/28/12 12:57

Hi guys,

How can I check what the bmap is of a panel?

I have a pointer called Pointer_ItemInSlot1:

Code:
PANEL* Pointer_ItemInSlot1;



and I want to check the bmap is of the panel the pointer addresses.

Thanks for taking the time.
Posted By: rayp

Re: checking panel pointer bmap - 12/28/12 13:17

Code:
BMAP* this_bmap = "bla.bmp";
if (Pointer_ItemInSlot1.bmap == this_bmap)

Is that what youre looking 4 ? Sry if i missunderstood your question.
Posted By: Reconnoiter

Re: checking panel pointer bmap - 12/28/12 19:55

Yes that is what I meant laugh

I have a bug though. The if code doesn't seem to work here in my code. Here's the relevant code:

Code:
BMAP* interfacedummy_png = "InterfaceDummy.png";

...
PANEL* Pointer_ItemInSlot1 = interfacedummy_png;

...

function buy_stinger()
{
	if (goldplayer >= 40) { //ignore this
	if (Pointer_ItemInSlot1.bmap == interfacedummy_png) { //the slot = empty		
	Pointer_ItemInSlot1.bmap = IconItemStinger_bmp;
	Pointer_ItemInSlot1.skill_x = 1; //ignore this
	goldplayer -= 40;} //ignore this
...



The 'goldplayer' is not the problem, i know this 100% sure. The problem is that it ignores the "if (Pointer_ItemInSlot1.bmap == interfacedummy_png)" but I don't know why.
Posted By: Uhrwerk

Re: checking panel pointer bmap - 12/29/12 09:29

Assigning a pointer to a bitmap to pointer to a panel is not a good idea...
Posted By: Reconnoiter

Re: checking panel pointer bmap - 12/29/12 12:31

And what about reading a bmap from a button? E.g. is this possible:

Code:
pointer_panel.bmap = ?panel_inventory_button6.bmap?;

Posted By: muffel

Re: checking panel pointer bmap - 12/29/12 13:27

Perhaps the problem is in this line:

PANEL* Pointer_ItemInSlot1 = interfacedummy_png;

You are initializing the panel wrong. It should look like this:

PANEL* Pointer_ItemInSlot1 = {bmap=interfacedummy_png;}

And I dont think its possible to read the bmap of button.

muffel
Posted By: Uhrwerk

Re: checking panel pointer bmap - 12/29/12 13:44

Originally Posted By: Reconnoiter
And what about reading a bmap from a button?

Not possible afaik. But you can go exactly the way rayp suggested. You just have to ensure you initialize your panel correctly. Either with a static definition or with pan_create.
Code:
PANEL* Pointer_ItemInSlot1 = 
{
    bmap="InterfaceDummy.png";
}

Posted By: Reconnoiter

Re: checking panel pointer bmap - 12/30/12 12:34

Thanks guys it works now. @Uhrwerk, I first did the whole thing with pan_create but only noticed later on that that conflicts with game_save and game_load (I should have better read the manual :\), but the static definition works great ofcourse.
© 2024 lite-C Forums