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.
“What are you doing?” Joffrey interrupted him.
“… can’t a man give a few last words for his son to carry?”
“…Who told you your son was making it out of this field alive?”
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.