@@ -202,15 +202,15 @@ void nofAttacker::Walked()
202202 {
203203 RTTR_Assert (dynamic_cast <nobMilitary*>(attacked_goal));
204204 // We will now have this building as the new home, so inform old home, hunting soldier and ship
205- if (building )
206- building ->SoldierLost (this );
205+ if (homeBld )
206+ homeBld ->SoldierLost (this );
207207 CancelAtHuntingDefender ();
208208 if (ship_obj_id)
209209 CancelAtShip ();
210210 // Store the goal in a temporary as attacked_goal will be reset
211211 auto * goal = static_cast <nobMilitary*>(attacked_goal);
212212 goal->Capture (player);
213- building = attacked_goal;
213+ homeBld = attacked_goal;
214214 attacked_goal->AddActiveSoldier (world->RemoveFigure (pos, *this ));
215215 RemoveFromAttackedGoal ();
216216 // This might call other capturers
@@ -292,7 +292,7 @@ void nofAttacker::HomeDestroyed()
292292 if (ship_obj_id)
293293 CancelAtShip ();
294294
295- building = nullptr ;
295+ homeBld = nullptr ;
296296 state = SoldierState::FigureWork;
297297 StartWandering ();
298298 Wander ();
@@ -302,15 +302,15 @@ void nofAttacker::HomeDestroyed()
302302 } else
303303 {
304304 // If we were going back home, reset that goal
305- if (goal_ == building )
305+ if (goal_ == homeBld )
306306 goal_ = nullptr ;
307- building = nullptr ;
307+ homeBld = nullptr ;
308308 }
309309}
310310
311311void nofAttacker::HomeDestroyedAtBegin ()
312312{
313- building = nullptr ;
313+ homeBld = nullptr ;
314314
315315 // We are lost now and hence not targetable
316316 InformTargetsAboutCancelling ();
@@ -327,7 +327,7 @@ void nofAttacker::WonFighting()
327327 IncreaseRank ();
328328 // If our home was destroyed then we are lost
329329 // unless we are currently fighting at the flag so that building can become our new home
330- if (!building && state != SoldierState::AttackingFightingVsDefender)
330+ if (!homeBld && state != SoldierState::AttackingFightingVsDefender)
331331 {
332332 // Lost -> Tell all dependents
333333 InformTargetsAboutCancelling ();
@@ -397,7 +397,7 @@ void nofAttacker::ReturnHomeMissionAttacking()
397397void nofAttacker::MissAttackingWalk ()
398398{
399399 // If our home is destroyed we are lost
400- if (!building )
400+ if (!homeBld )
401401 {
402402 InformTargetsAboutCancelling ();
403403 if (ship_obj_id)
@@ -581,7 +581,7 @@ void nofAttacker::AttackedGoalDestroyed()
581581 auto * harbor = world->GetSpecObj <nobHarborBuilding>(harborPos);
582582 RTTR_Assert (harbor);
583583 // go home
584- goal_ = building ;
584+ goal_ = homeBld ;
585585 state = SoldierState::FigureWork;
586586 fs = FigureState::GotToGoal;
587587 harbor->CancelSeaAttacker (this );
@@ -655,12 +655,12 @@ void nofAttacker::CapturingWalking()
655655 if (pos == attacked_goal->GetPos ())
656656 {
657657 // We switch buildings
658- if (building )
659- building ->SoldierLost (this );
658+ if (homeBld )
659+ homeBld ->SoldierLost (this );
660660 CancelAtHuntingDefender ();
661661 if (ship_obj_id)
662662 CancelAtShip ();
663- building = attacked_goal;
663+ homeBld = attacked_goal;
664664 attacked_goal->AddActiveSoldier (world->RemoveFigure (pos, *this ));
665665
666666 // No longer attacking
@@ -687,7 +687,7 @@ void nofAttacker::CapturingWalking()
687687 StartWalking (Direction::NorthWest);
688688 RTTR_Assert (attacked_goal->GetPlayer () == player); // Assumed by the call below
689689 static_cast <nobMilitary*>(attacked_goal)->NeedOccupyingTroops ();
690- } else if (!building )
690+ } else if (!homeBld )
691691 {
692692 // If our home is destroyed we are lost and don't walk to the target (our new home if we were at least at the
693693 // flag already) Notify it, if it still exists (could be destroyed in the meantime too)
@@ -845,7 +845,7 @@ void nofAttacker::StartReturnViaShip(noShip& ship)
845845 InformTargetsAboutCancelling ();
846846 }
847847
848- goal_ = building ;
848+ goal_ = homeBld ;
849849 state = SoldierState::FigureWork;
850850 fs = FigureState::GotToGoal;
851851 on_ship = true ;
@@ -883,7 +883,7 @@ void nofAttacker::CancelAtHuntingDefender()
883883
884884void nofAttacker::HandleState_SeaAttack_ReturnToShip ()
885885{
886- if (!building )
886+ if (!homeBld )
887887 {
888888 // Home destroyed -> start wandering
889889 state = SoldierState::FigureWork;
@@ -921,7 +921,7 @@ void nofAttacker::HandleState_SeaAttack_ReturnToShip()
921921 Wander ();
922922
923923 // Notify home and ship
924- building ->SoldierLost (this );
924+ homeBld ->SoldierLost (this );
925925 CancelAtShip ();
926926 }
927927 }
0 commit comments