0 registered members (),
1,485
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Crash while counting
#282099
07/30/09 11:42
07/30/09 11:42
|
Joined: Jul 2008
Posts: 170 Germany, near Mainz
Nicotin
OP
Member
|
OP
Member
Joined: Jul 2008
Posts: 170
Germany, near Mainz
|
Hello, I have an odd problem. While starting my level the programm sometimes crashes and sometimes not. This is the part that seem to cause the crash:
while(count < street_count)//warte bis alle registriert sind
{
count = 0;
for(i=0;i<street_count;i++)
{
if(streets[i]!=NULL)
{
diag("\n");diag("Check8.");diag(str_for_num(NULL,i));
count++;
}
}
wait(1);
}
Streets[] is an ENTITY* array of 1000 and streetcount is 406 the end of my diag file is ... Check8.373 Check8.374 Check8.375 Check8.376 Check8.377 Check8.378 Check8.379 Check8.380 Check8.381 Check8.382 Check8.383 Check8.384 Check8.385 Check8.386 Check8.387 Check8.388 Check8.389 Check8.390 Check8.391 Check8.392 Check8.393 Check8.394 Check8.395 Check8.396 Check8.397 Check8.398 Check8.399 Check8.400 Check8.401 Check8.402 Check8.403 Check8.404
everytime it crashes, it crashes at this point. But like I sayed, this happens just sometimes
|
|
|
Re: Crash while counting
[Re: Nicotin]
#282111
07/30/09 12:21
07/30/09 12:21
|
Joined: Dec 2002
Posts: 616 Austria
Stromausfall
User
|
User
Joined: Dec 2002
Posts: 616
Austria
|
Hello, I have an odd problem. While starting my level the programm sometimes crashes and sometimes not. This is the part that seem to cause the crash:
while(count < street_count)//warte bis alle registriert sind
{
count = 0;
for(i=0;i<street_count;i++)
{
if(streets[i]!=NULL)
{
diag("\n");diag("Check8.");diag(str_for_num(NULL,i));
count++;
}
}
wait(1);
}
I don't understand, for what you need the while loop, as there should be no difference between the first and the second iteration of it. I think that
for(i=0;i<street_count;i++)
{
if(streets[i]!=NULL)
{
diag("\n");diag("Check8.");diag(str_for_num(NULL,i));
}
}
should work just the same. Regarding your problem, did you try the following :
for(i=0;i<street_count;i++)
{
if(streets[i]!=NULL)
{
diag("\n");diag("Check8.");diag(str_for_num(NULL,i));
}
wait(1);
}
Because maybe the problem is that you try to do too much in a frame/cycle. Could you also post the text of the error message ?
|
|
|
Re: Crash while counting
[Re: Stromausfall]
#282112
07/30/09 12:30
07/30/09 12:30
|
Joined: Jul 2008
Posts: 170 Germany, near Mainz
Nicotin
OP
Member
|
OP
Member
Joined: Jul 2008
Posts: 170
Germany, near Mainz
|
The sense in the double loop is that I have models with actions. Firat they get counted "street_count" so I have 406 models total. Now I let them register in the ENTITY* streets[1000] array. The double loop now "waits" untill all models are registerd. So it checks all the streets in the for statement. This as long as all streets are registerd.
But there is no error message and the acklog.txt ends with the snipped I posted before. So no error, nothing.
Anyway, looks like this was the solution. I added the wait(1); in the for loop and now it seems to work. So thank you very much!
|
|
|
Re: Crash while counting
[Re: Stromausfall]
#282134
07/30/09 13:44
07/30/09 13:44
|
Joined: Jul 2008
Posts: 170 Germany, near Mainz
Nicotin
OP
Member
|
OP
Member
Joined: Jul 2008
Posts: 170
Germany, near Mainz
|
Yeah, I'll keep my eyes open. But I only can imagine that the problem is in there. Hrm but there were so many bugy that I couldn't even imagine, that wouldn't supprise me now^^
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|