No problem. I was just giving Esper a chance of avoiding un-familiar stuff
if he felt he wasnt ready for it, being new to structs as he is.

For you, Pappenheimer, I wouldnt call it advanced most likely, just unfamiliar.
So here goes.

mainpan is our example panel name. Created with a global declaration or pan_create().
mainpan.bmap is a pointer to the BMAP it uses as a background.
To access the contents of a pointer, its best to use the "->" separator instead of just "."
So therefore, using
mainpan->bmap will allow us to get to the properties of the BMAP.
Now most engine structured-objects are part of a linked-list system. The "link" property
is a pointer to a C_LINK structure that holds these lists together.

mainpan->bmap->link gives us access to the properties of the C_Link object.
mainpan->bmap->link.name gives us a char pointer to the engine-recognised name of the BMAP.

So we now have a char* to the name of the BMAP the panel is using.
Now, IF the panels BMAP was set from a pre-defined BMAP, like this...
Code:
BMAP* pic = "image.jpg";
PANEL* mainpan = {   bmap = pic;  }

then the char string will be "pic", cause thats the engine-recognised name it was given in the BMAP* pic = ... line.

But, if the panel BMAP was directly given a filename like so...
Code:
PANEL* mainpan = {   bmap = "image.jpg";  }

THEN the char string will be "image_jpg", because thats the engine-generated temporary BMAP name.
The generated name is basically the filename with the "." replaced by a "_"

That is how I am retrieving the filenames, by accessing the bmap.link name char string and
building a STRING from it with STRING* file_name = str_create(mainpan->bmap->link.name);
Then I convert this name from a temp-name back to the real filename by (crudely)replacing the "_" that is
four bytes from the end with a new "." (ascii-code 46) using the line (file_name.chars)[str_len(file_name)-4] = 46;

Any other questions on anything Ive covered here, just ask...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial