@@ -128,8 +128,8 @@ void nobHarborBuilding::DestroyBuilding()
128128
129129 soldier.CancelSeaAttack ();
130130 RTTR_Assert (!soldier.GetAttackedGoal ());
131- RTTR_Assert (soldier.HasNoHome ());
132- RTTR_Assert (soldier.HasNoGoal ());
131+ RTTR_Assert (! soldier.GetHomeBld ());
132+ RTTR_Assert (! soldier.GetGoal ());
133133 soldier.StartWandering ();
134134 soldier.StartWalking (RANDOM_ENUM (Direction));
135135 }
@@ -515,8 +515,7 @@ void nobHarborBuilding::ShipArrived(noShip& ship)
515515 {
516516 if (it->dest == ship_dest)
517517 {
518- inventory.visual .Remove (it->attacker ->GetJobType ());
519- RemoveArmoredFigurFromVisualInventory (*it->attacker );
518+ RemoveFromVisualInventory (*it->attacker );
520519 attackers.push_back (std::move (it->attacker ));
521520 it = soldiers_for_ships.erase (it);
522521 } else
@@ -589,15 +588,7 @@ void nobHarborBuilding::ShipArrived(noShip& ship)
589588 if (it->dest == dest)
590589 {
591590 it->fig ->StartShipJourney ();
592- if (it->fig ->GetJobType () != Job::BoatCarrier)
593- {
594- inventory.visual .Remove (it->fig ->GetJobType ());
595- RemoveArmoredFigurFromVisualInventory (*it->fig );
596- } else
597- {
598- inventory.visual .Remove (Job::Helper);
599- inventory.visual .Remove (GoodType::Boat);
600- }
591+ RemoveFromVisualInventory (*it->fig );
601592 figures.push_back (std::move (it->fig ));
602593 it = figures_for_ships.erase (it);
603594 } else
@@ -867,16 +858,7 @@ std::vector<nobHarborBuilding::ShipConnection> nobHarborBuilding::GetShipConnect
867858void nobHarborBuilding::AddFigureForShip (std::unique_ptr<noFigure> fig, MapPoint dest)
868859{
869860 RTTR_Assert (!world->HasFigureAt (fig->GetPos (), *fig)); // Figure is in the harbor, so it cannot be outside
870- // Anzahl visuell erhöhen
871- if (fig->GetJobType () != Job::BoatCarrier)
872- {
873- inventory.visual .Add (fig->GetJobType ());
874- AddArmoredFigurToVisualInventory (*fig);
875- } else
876- {
877- inventory.visual .Add (Job::Helper);
878- inventory.visual .Add (GoodType::Boat);
879- }
861+ AddToVisualInventory (*fig);
880862 figures_for_ships.emplace_back (FigureForShip{std::move (fig), dest});
881863 OrderShip ();
882864}
@@ -1027,15 +1009,7 @@ bool nobHarborBuilding::UseFigureAtOnce(std::unique_ptr<noFigure>& fig, noRoadNo
10271009 {
10281010 // Reduce figure count because figures don't go through the house leaving process
10291011 // And therefore the visual count reducement
1030- if (fig->GetJobType () != Job::BoatCarrier)
1031- {
1032- inventory.visual .Remove (fig->GetJobType ());
1033- RemoveArmoredFigurFromVisualInventory (*fig);
1034- } else
1035- {
1036- inventory.visual .Remove (Job::Helper);
1037- inventory.visual .Remove (GoodType::Boat);
1038- }
1012+ RemoveFromVisualInventory (*fig);
10391013 // Dann fügen wir die mal bei uns hinzu
10401014 AddFigureForShip (std::move (fig), next_harbor);
10411015 return true ;
@@ -1058,7 +1032,7 @@ void nobHarborBuilding::ReceiveGoodsFromShip(std::list<std::unique_ptr<noFigure>
10581032 {
10591033 figure->SetGoalTonullptr ();
10601034 AddFigure (std::move (figure), true );
1061- } else if (figure->HasNoGoal ())
1035+ } else if (! figure->GetGoal ())
10621036 {
10631037 AddDependentFigure (*figure); // No goal? We take it
10641038 AddFigure (std::move (figure), true );
@@ -1069,16 +1043,7 @@ void nobHarborBuilding::ReceiveGoodsFromShip(std::list<std::unique_ptr<noFigure>
10691043
10701044 if (nextDir == RoadPathDirection::SouthEast)
10711045 {
1072- // Increase visual count
1073- if (figure->GetJobType () == Job::BoatCarrier)
1074- {
1075- inventory.visual .Add (Job::Helper);
1076- inventory.visual .Add (GoodType::Boat);
1077- } else
1078- {
1079- inventory.visual .Add (figure->GetJobType ());
1080- AddArmoredFigurToVisualInventory (*figure);
1081- }
1046+ AddToVisualInventory (*figure);
10821047 AddLeavingFigure (std::move (figure));
10831048 } else if (nextDir == RoadPathDirection::Ship)
10841049 {
@@ -1247,8 +1212,8 @@ void nobHarborBuilding::AddSeaAttacker(std::unique_ptr<nofAttacker> attacker)
12471212 // notify target about noShow, notify home that soldier wont return, add to inventory
12481213 attacker->SeaAttackFailedBeforeLaunch (); // set state, remove target & home
12491214 RTTR_Assert (!attacker->GetAttackedGoal ());
1250- RTTR_Assert (attacker->HasNoHome ());
1251- RTTR_Assert (attacker->HasNoGoal ());
1215+ RTTR_Assert (! attacker->GetHomeBld ());
1216+ RTTR_Assert (! attacker->GetGoal ());
12521217 AddFigure (std::move (attacker), true );
12531218 return ;
12541219 }
@@ -1267,7 +1232,7 @@ void nobHarborBuilding::CancelSeaAttacker(nofAttacker* attacker)
12671232 helpers::find_if (soldiers_for_ships, [attacker](const auto & it) { return it.attacker .get () == attacker; });
12681233
12691234 RTTR_Assert (it != soldiers_for_ships.end ());
1270- if (attacker->HasNoGoal ())
1235+ if (! attacker->GetGoal ())
12711236 {
12721237 // No goal? We take it
12731238 AddDependentFigure (*attacker);
@@ -1339,6 +1304,7 @@ std::unique_ptr<nofDefender> nobHarborBuilding::ProvideDefender(nofAttacker& att
13391304 std::unique_ptr<nofAttacker> defender_attacker = std::move (soldiers_for_ships.begin ()->attacker );
13401305 soldiers_for_ships.pop_front ();
13411306 defender = std::make_unique<nofDefender>(pos, player, *this , defender_attacker->GetRank (), attacker);
1307+ defender->SetArmor (defender_attacker->HasArmor ());
13421308 defender_attacker->CancelSeaAttack ();
13431309 defender_attacker->Destroy ();
13441310 }
0 commit comments