Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/19/24 18:45
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, kzhao, 7th_zorro), 714 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Sys_crash revival! #373602
06/11/11 12:27
06/11/11 12:27
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
L
Liamissimo Offline OP
Serious User
Liamissimo  Offline OP
Serious User
L

Joined: Jul 2009
Posts: 1,198
Berlin, Germany
Hey Guys,

currently doing some procedural level generation, this is my code. If I am reaching the middle of my blocks, the last one should be deleted and a new one is generated before the first one. Everytime when I am trying to remove the last block it crashes (sys_crash in block_guard). Usual stuff, thats why I took a break from Lite-C. I tried wait, I tried exporting it to a new function and ending this with proc_kill. Also by removing the "hinten" Pointer and so on, so there were no invalid pointer. Ideas are appreciated...

Code:
#define vor skill1
#define hinter skill2
#define mitte skill3
ENTITY* runner;
ENTITY* vorne = NULL;
ENTITY* hinten = NULL;
function block_guard()
{
	set(my,LIGHT);
	my.vor = 0;
	my.hinter = 0; 
	while(me)
	{	
		c_trace(my.x,vector(my.x,my.y,my.z+100), IGNORE_ME);
		if(you){
			if(you == runner){
				my.green =255;my.blue=255;my.red=255;
				if(my.mitte == 1){
					ent_remove(hinten);
					return;
				}
			}
		}
		c_trace(my.x,vector(my.x+8,my.y,my.z),IGNORE_ME);
		if(you){my.vor = 1;
		}
		c_trace(my.x,vector(my.x-8,my.y,my.z),IGNORE_ME);
		if(you){my.hinter=1;
		}
		if(my.vor == 1 && my.hinter == 1){my.green = 255; my.red = 0; my.blue = 0;
		}
		if(my.vor == 0 && my.hinter == 1){my.blue = 255; my.red = 0; my.green = 0; vorne = me;
		}
		if(my.vor == 1 && my.hinter == 0){my.red = 255; my.green = 0; my.blue = 0; hinten = me;
		}
		if(my.hinter==1&&my.vor==1){
			c_trace(my.x,vector(my.x-8,my.y,my.z),IGNORE_ME);
			if(you.hinter == 1){
				c_trace(my.x,vector(my.x+8,my.y,my.z),IGNORE_ME);
				if(you.vor == 1){
					reset(my,LIGHT);
					my.mitte = 1;
				}
			}
		}
		wait(1);
	}
}



Last edited by TheLiam; 06/11/11 12:29.

"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen."
-JCL, 2011
Re: Sys_crash revival! [Re: Liamissimo] #373611
06/11/11 13:04
06/11/11 13:04
Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
Roel Offline
Senior Member
Roel  Offline
Senior Member

Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
I might be wrong, but I expect some empty pointers:

at the end there is:
Code:
if(my.hinter==1&&my.vor==1){
c_trace(my.x,vector(my.x-8,my.y,my.z),IGNORE_ME);
if(you.hinter == 1){
...



c_trace sets the you pointer
so if you is set to NULL,
the following "if(you..." might crash.



Last edited by Roel; 06/11/11 13:06.

Check out the throwing game here: The throwing game
Re: Sys_crash revival! [Re: Roel] #373614
06/11/11 13:14
06/11/11 13:14
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
L
Liamissimo Offline OP
Serious User
Liamissimo  Offline OP
Serious User
L

Joined: Jul 2009
Posts: 1,198
Berlin, Germany
Thanks but this isn't the problem, I surrounded it now with if(you) to prevent this case but the problem is the ent_remove...


"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen."
-JCL, 2011
Re: Sys_crash revival! [Re: Liamissimo] #373617
06/11/11 13:37
06/11/11 13:37
Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
Roel Offline
Senior Member
Roel  Offline
Senior Member

Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
maybe after ent_remove the entity pointer isn't set to null, and it leads to a place in the memory that isn't valid anymore.
have you tried:

Code:
ent_remove(ent);
ent = NULL;



it would be cool if the engine was some more detailed at what goes wrong. crazy


Check out the throwing game here: The throwing game
Re: Sys_crash revival! [Re: Roel] #373644
06/11/11 16:26
06/11/11 16:26
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
L
Liamissimo Offline OP
Serious User
Liamissimo  Offline OP
Serious User
L

Joined: Jul 2009
Posts: 1,198
Berlin, Germany
Strange workaround did it.

~Closed


"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen."
-JCL, 2011

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1