@evilsob: thats pretty much what i wanted him to do, too.

but your currect code has an issue: Since you are usign str_cpy on "placing_filename", i assume you have defined it as a STRING*.
you can not assign a STRING* directly to a char* like you do.
what you can do:
Code:
blocks[positchange.x][positchange.y][positchange.z].filename = _chr(placing_filename)


_chr is a build in macro that gives access to the char array thats stored inside the string.
Doing this is very dangerous!
whenever the STRING* placing_filename is changed (when it's size is changed more precisely), there is a high probability that the char* you've saved in the block is removed and thus points to invalid memory which will make the engine crash whenever you access it.
Additionally, all blocks then share the same char*, and so every block has the exact same value there, makeing it all pointless.

I'd still advise you to use my or Evilsobs solution. There is another solution however, which will be slow but not as slow as the 40 seconds STRING* thing. you'll have to set a fixed number of characters for the chars:

Code:
typedef struct
{ 	
	var locked;					//Switch if a block is placed or not
	var team;					//Wich Team is the block owner (MP)
	var passable;				//Is the block passable or not?
	var explored;				//Is there fog of war or not?
	var typus;					//typus_earth, typus_fire, typus_water
	var obj_rotatealpha;		//Turns the Block to alpha=60 if PAN is 180°?
	var positionx;				//The 3 block positions in this struct array
	var positiony;
	var positionz;
	var obj_pan;				//The object PAN rotation
	char objektname[32];			//The name of the Block
	char filename[32];			//The filename of the Block
	char setupname[32];			//The filename of the PAK file of the Block
	char contentname[32];		//The name of the WRS file the block is located in
	ENTITY* obj;				//The Block object itself
} BLOCK;

I chose 32 as fixed size, the more you chose the more memory you'll need. you can now use the c function strcpy (NOT str_cpy) to put data into those char*. no sys_malloc needed. EDIT: of course you'll need to see to it that placing_filename is never larger than 31 characters. the 32th character is needed for the null-termination of the char* (look it up if you don't know it).
Code:
strcpy(blocks[positchange.x][positchange.y][positchange.z].filename, _chr(placing_filename));



But you'll be using lots of memory. a single element of this struct now has a size of 172 Bytes. With your little level its 50*50*5*172 Bytes = 2150000 Bytes = ~ 2MB. Now multiply that with the level size you are aiming for and you'll be out of ram memory in no time.


Last edited by SchokoKeks; 06/29/12 11:43.