Crash on comment "//"

Game Editor comments and discussion.

Crash on comment "//"

Postby EvanAgain » Fri Jan 25, 2013 4:25 am

So Game Editor crashes everytime I try to comment out this VERY long line of code.


Code: Select all
int i = 0;
Actor* myActor = 0;
actor_to_screen(&xmouse, &ymouse);

myActor = CreateActor("Draggable", "simplegear", "(none)", "(none)", xmouse, ymouse, false);

i = rand(3);
myActor->animpos = i;

myActor->ItemBaseType = i;

//Add Random Mods
myActor->ItemMod1 = rand(4);
myActor->ItemMod2 = rand(4);
myActor->ItemMod3 = rand(4);
myActor->ItemMod4 = rand(4);


/* Adding "//" in front of the line below causes GE to Crash */
strcpy(myActor->ItemName, ItemModList[myActor->ItemMod1].prefix + " " + ItemModList[myActor->ItemMod2].prefix + " " + BaseTypes[myActor->ItemBaseType] + " " + ItemModList[myActor->ItemMod3].suffix + " " + ItemModList[myActor->ItemMod4].suffix);




EvanAgain
 
Posts: 51
Joined: Thu Jan 10, 2013 5:40 pm
Score: 4 Give a positive score

Re: Crash on comment "//"

Postby skydereign » Fri Jan 25, 2013 4:32 am

This has been reported and fixed, but you'll have to wait for the next release of gE.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Crash on comment "//"

Postby EvanAgain » Fri Jan 25, 2013 4:44 am

ok, I am also getting an in-game crash when trying to use that line of code... I am thinking it may be an out of range error, because I am using random numbers, but it really shouldn't have this problem.. I am not sure whats going on.
EvanAgain
 
Posts: 51
Joined: Thu Jan 10, 2013 5:40 pm
Score: 4 Give a positive score

Re: Crash on comment "//"

Postby skydereign » Fri Jan 25, 2013 4:53 am

You are trying to add strings to concatenate them. You can't do that in C. You must be getting a suspicious pointer conversion warning for that as well. It wouldn't be a range error, if those variables you set are ints, because they will be cast down to 0-3, not 0-4. Also, out of bounds errors are better reported by gE.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Crash on comment "//"

Postby EvanAgain » Fri Jan 25, 2013 4:57 am

No warnings, just a complete crash. How do I go about putting strings together?


Googled it: strcat
EvanAgain
 
Posts: 51
Joined: Thu Jan 10, 2013 5:40 pm
Score: 4 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest