|
Sys_crash revival!
#373602
06/11/11 12:27
06/11/11 12:27
|
Joined: Jul 2009
Posts: 1,198 Berlin, Germany
Liamissimo
OP
Serious User
|
OP
Serious User
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...
#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
Senior Member
|
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:
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.
|
|
|
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
Liamissimo
OP
Serious User
|
OP
Serious User
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
Senior Member
|
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:
ent_remove(ent);
ent = NULL;
it would be cool if the engine was some more detailed at what goes wrong.
|
|
|
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
Liamissimo
OP
Serious User
|
OP
Serious User
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
|
|
|
|