Hello everyone,

I currently have a minor problem, but I can't find any solution for it, maybe it is some kind of Beginners-Problem.

Let's assume I want a game with 100 items in it, I want to code in a non-copy-paste way. I made an Array for Itemnames and one for BMAP's. So now I can use the Index of my array as an "ID-code". Item[1] has Picture[1], that sounds logical to me.

So, my Arrays are global, I want to access them easily, I created a function to write some data into my index-numbers, also not a problem (and when I test them via printf(xxx); then I get the correct information aswell (Name, path to the picture).

Okay, here is the problem:
I am calling another function (it comes last), which should use a panel to display the BMAP. Unfortunately it does not work.

It all looks like this:
Quote:

STRING* item_name[100];
BMAP* item_bmap[100];

function make_items()
{
item_name[1] = "Potion";
item_bmap[1] = "items/drink/potion.tga";
}

function display_item()
{
PANEL* test = {layer = 4; flags = VISIBLE; pos_x = 200; pos_y = 200; bmap = item_bmap[1];}
}


The error is, that the program doesnt know what this Bitmap is, so I thought I need to declare some other (empty) Bitmap first to avoid errors, and then just before I want to display it, I change the bitmap-path, so I get the BMAP I want.
Here is what I came up with:

Quote:

STRING* item_name[100];
BMAP* item_bmap[100];
BMAP* placeholder = "items/empty.tga";

function make_items()
{
item_name[1] = "Potion";
item_bmap[1] = "items/drink/potion.tga";
}

function display_item()
{
placeholder = item_bmap[1];
printf("placeholder ");
PANEL* test = {layer = 4; flags = VISIBLE; pos_x = 200; pos_y = 200; bmap = placeholder;}
}


To sum it up: The placeholder gets overwritten and for debugging-purposes I do a "printf()".
The message I get on my screen is absolutely right: Its the path to the .tga that I want to have BUT
my panel still gets the "placeholder-Bitmap".

So I think, my question is: How do I correctly change the bitmap of my panel dynamically, or is there a better solution for my problem?

Thanks for all help in advance laugh