Re: Code Snippets[message #345165 is a reply to message #345154]
||Sat, 23 April 2016 17:29 |
||sevenfm wrote on Fri, 22 April 2016 12:53
In Soldier Init List.cpp:
// we simply look for a entry point inside a bigger circle, but not inside the merc deployment zone.
INT32 bettergridno = NOWHERE;
UINT16 counter = 0;
UINT8 ubDirection = DIRECTION_IRRELEVANT;
while ( counter < 100 && (bettergridno == NOWHERE || PythSpacesAway( bettergridno, gMapInformation.sCenterGridNo ) <= gAmbushRadiusModifier * gGameExternalOptions.usAmbushEnemyEncircleRadius1) )
bettergridno = FindRandomGridNoBetweenCircles( gMapInformation.sCenterGridNo, gAmbushRadiusModifier * gGameExternalOptions.usAmbushEnemyEncircleRadius1, gAmbushRadiusModifier * gGameExternalOptions.usAmbushEnemyEncircleRadius2, ubDirection );
if ( bettergridno != NOWHERE )
tempDetailedPlacement.sInsertionGridNo = bettergridno;
// have the soldier look inward. We add + 100 because later on we use this to signify that we want really enforce this direction
tempDetailedPlacement.ubDirection = (UINT8)GetDirectionToGridNoFromGridNo( tempDetailedPlacement.sInsertionGridNo, gMapInformation.sCenterGridNo ) + 100;
The counter variable is added probably to prevent endless loop, but it's never incremented.
Hu. Good spot. Fixed in r8169.
Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.
Then he heard a faint chime as Sovereign subscribed to her ECHO channel.
If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.