Code:
city_t tmpCity;
int_t tmpPlayer;
int_t tmpWonder;
void_f VeteranEffect (location_t tmpLoc, int_t tmpPlayer)
{
int_t i;
unit_t tmpUnit;
int_t tmpNum;
int_t numUnits;
int_t tmpPlayer2;
player[0] = tmpPlayer;
numUnits = player[0].units;
tmpPlayer2 = tmpPlayer;
if (IsPlayerAlive(tmpPlayer2)) {
// Make all Units non veteran, except Special Units
for (i = 0; i < numUnits; i = i + 1) {
GetUnitByIndex(tmpPlayer2, i, tmpUnit);
tmpNum = tmpUnit.type;
if (tmpNum >= 106 && tmpNum <= 112) {
ToggleVeteran(tmpUnit, 1);
} else {
ToggleVeteran(tmpUnit, 0);
}
}
}
// Make all Units veterans who share the location Alexander, Robin Hood and Richard The Lion Heart
tmpNum = GetUnitsAtLocation(tmpLoc);
for (i = 0; i < tmpNum; i = i + 1) {
GetUnitFromCell(tmpLoc, i, tmpUnit);
ToggleVeteran(tmpUnit, 1);
}
}
// Hammurabi
HandleEvent(CreateWonder) 'Hammurabi' post {
tmpWonder = value[0];
if(tmpWonder == WonderDB(WONDER_HANGING_GARDENS)) {
tmpCity = city[0];
tmpPlayer = tmpCity.owner;
CreateUnit(tmpPlayer, UnitDB(UNIT_HAMMURABI), city[0].location, 0);
DisableTrigger('Hammurabi');
}
}

Don't worry, Ben, it looks like you ripped that while loop straight from the Alexander scenario, meaning either I or Tony Evans wrote it. Since Tony is almost as good a programmer as I am, it has to be high quality code and you should be safe either way

Comment