@@ -507,7 +507,7 @@ void Building::saveCrossRef(GAGCore::OutputStream *stream)
507507 stream->writeSint32 (maxUnitInside, " maxUnitInside" );
508508 // TODO: std::list::size() is O(n). We should investigate
509509 // if our intense use of this has an impact on overall performance.
510- // steph and nuage suggested to store and update size in a variable
510+ // Stephane and nuage suggested to store and update size in a variable
511511 // what is faster but also more error prone.
512512 stream->writeUint32 (unitsWorking.size (), " nbWorking" );
513513 fprintf (logFile, " nbWorking=%zd\n " , unitsWorking.size ());
@@ -2058,7 +2058,7 @@ void Building::turretStep(Uint32 stepCounter)
20582058 resources[STONE]--;
20592059 bullets += type->multiplierStoneToBullets ;
20602060
2061- // we need to be stone-feeded
2061+ // we need to be stone-fed
20622062 updateCallLists ();
20632063 }
20642064
@@ -2085,16 +2085,16 @@ void Building::turretStep(Uint32 stepCounter)
20852085 assert (map);
20862086
20872087 // the type of target we have found
2088- enum TargetType
2088+ enum class TargetType
20892089 {
2090- TARGETTYPE_NONE ,
2091- TARGETTYPE_BUILDING ,
2092- TARGETTYPE_WORKER ,
2093- TARGETTYPE_WARRIOR ,
2094- TARGETTYPE_EXPLORER ,
2090+ NONE ,
2091+ BUILDING ,
2092+ WORKER ,
2093+ WARRIOR ,
2094+ EXPLORER ,
20952095 };
20962096 // The type of the best target we have found up to now
2097- TargetType targetFound = TARGETTYPE_NONE ;
2097+ TargetType targetFound = TargetType::NONE ;
20982098 // The score of the best target we have found up to now
20992099 int bestScore = INT_MIN;
21002100 // The number of ticks before the unit may move away
@@ -2192,10 +2192,10 @@ void Building::turretStep(Uint32 stepCounter)
21922192 bestTicks = targetTicks;
21932193 bestTargetX = targetX;
21942194 bestTargetY = targetY;
2195- targetFound = TARGETTYPE_WARRIOR ;
2195+ targetFound = TargetType::WARRIOR ;
21962196 }
21972197 }
2198- else if ((targetFound != TARGETTYPE_WARRIOR ) && (testUnit->typeNum == WORKER))
2198+ else if ((targetFound != TargetType::WARRIOR ) && (testUnit->typeNum == WORKER))
21992199 {
22002200 // adjust score for range
22012201 int targetScore = - testUnit->hp ;
@@ -2206,7 +2206,7 @@ void Building::turretStep(Uint32 stepCounter)
22062206 bestTicks = targetTicks;
22072207 bestTargetX = targetX;
22082208 bestTargetY = targetY;
2209- targetFound = TARGETTYPE_WORKER ;
2209+ targetFound = TargetType::WORKER ;
22102210 }
22112211 }
22122212 }
@@ -2238,14 +2238,14 @@ void Building::turretStep(Uint32 stepCounter)
22382238 bestTicks = targetTicks;
22392239 bestTargetX = targetX;
22402240 bestTargetY = targetY;
2241- targetFound = TARGETTYPE_EXPLORER ;
2241+ targetFound = TargetType::EXPLORER ;
22422242 }
22432243 }
22442244 }
22452245 }
22462246
22472247 // shoot building only if no unit is found
2248- if (targetFound == TARGETTYPE_NONE )
2248+ if (targetFound == TargetType::NONE )
22492249 {
22502250 Uint16 targetGBID = map->getBuilding (targetX, targetY);
22512251 if (targetGBID != NOGBID)
@@ -2263,18 +2263,18 @@ void Building::turretStep(Uint32 stepCounter)
22632263 bestTicks = 256 ;
22642264 bestTargetX = targetX;
22652265 bestTargetY = targetY;
2266- targetFound = TARGETTYPE_BUILDING ;
2266+ targetFound = TargetType::BUILDING ;
22672267 }
22682268 }
22692269 }
22702270 }
22712271 }
22722272 }
2273- if (targetFound == TARGETTYPE_EXPLORER )
2273+ if (targetFound == TargetType::EXPLORER )
22742274 break ;// specifying explorers as high priority
22752275 }
22762276
2277- if (targetFound != TARGETTYPE_NONE )
2277+ if (targetFound != TargetType::NONE )
22782278 {
22792279 shootingStep = 0 ;
22802280
0 commit comments