crazy mess droidType
Posted: 13 Feb 2018, 19:30
When i need to compare if truck construction or cyborg construction, i'm facing a problem where going something crazy, where i can enum only cyborg construction but not trucks, because enumDroid by type DROID_CONSTRUCT return both types.
Then i look into source and found this crazy whacky code:
In game cyborg and truck construction is separate, and this really different units, but in function enumDroid cyborg eq to all constructions whhooaa??
Then i can just call enumDroid(me, 10) and get only cyborgs constructions, but cant get ONLY trucks, if i call enumDroid(me, DROID_CONSTRUCT) i get both types..
Same thing with just compare if(droid.droidType == ???) what i need to pass there to check, if this truck or cyborg ??
Something like if(droid.body == "Body1REC") then it may be starting construction truck... but.. but.. ohh.. this is crazy.
I think we need to separate DROID_CONSTRUCT and DROID_CYBORG_CONSTRUCT.
I don't understand why was there a need to do SO??
Then i look into source and found this crazy whacky code:
Code: Select all
switch (droidType) // hide some engine craziness
{
case DROID_CONSTRUCT:
droidType2 = DROID_CYBORG_CONSTRUCT; break;
case DROID_WEAPON:
droidType2 = DROID_CYBORG_SUPER; break;
case DROID_REPAIR:
droidType2 = DROID_CYBORG_REPAIR; break;
case DROID_CYBORG:
droidType2 = DROID_CYBORG_SUPER; break;
default:
droidType2 = droidType;
break;
}
Then i can just call enumDroid(me, 10) and get only cyborgs constructions, but cant get ONLY trucks, if i call enumDroid(me, DROID_CONSTRUCT) i get both types..
Same thing with just compare if(droid.droidType == ???) what i need to pass there to check, if this truck or cyborg ??
Something like if(droid.body == "Body1REC") then it may be starting construction truck... but.. but.. ohh.. this is crazy.
I think we need to separate DROID_CONSTRUCT and DROID_CYBORG_CONSTRUCT.
I don't understand why was there a need to do SO??