@@ -620,35 +620,35 @@ void GamePlayer::RoadDestroyed()
620620 }
621621}
622622
623- bool GamePlayer::FindCarrierForRoad (RoadSegment* rs) const
623+ bool GamePlayer::FindCarrierForRoad (RoadSegment& rs) const
624624{
625- RTTR_Assert (rs-> GetF1 () != nullptr && rs-> GetF2 () != nullptr );
625+ RTTR_Assert (rs. GetF1 () != nullptr && rs. GetF2 () != nullptr );
626626 std::array<unsigned , 2 > length;
627627 std::array<nobBaseWarehouse*, 2 > best;
628628
629629 // Braucht der ein Boot?
630- if (rs-> GetRoadType () == RoadType::Water)
630+ if (rs. GetRoadType () == RoadType::Water)
631631 {
632632 // dann braucht man Träger UND Boot
633- best[0 ] = FindWarehouse (*rs-> GetF1 (), FW::HasWareAndFigure (GoodType::Boat, Job::Helper, false ), false , false ,
634- length.data (), rs);
633+ best[0 ] = FindWarehouse (*rs. GetF1 (), FW::HasWareAndFigure (GoodType::Boat, Job::Helper, false ), false , false ,
634+ length.data (), & rs);
635635 // 2. Flagge des Weges
636- best[1 ] = FindWarehouse (*rs-> GetF2 (), FW::HasWareAndFigure (GoodType::Boat, Job::Helper, false ), false , false ,
637- &length[1 ], rs);
636+ best[1 ] = FindWarehouse (*rs. GetF2 (), FW::HasWareAndFigure (GoodType::Boat, Job::Helper, false ), false , false ,
637+ &length[1 ], & rs);
638638 } else
639639 {
640640 // 1. Flagge des Weges
641- best[0 ] = FindWarehouse (*rs-> GetF1 (), FW::HasFigure (Job::Helper, false ), false , false , length.data (), rs);
641+ best[0 ] = FindWarehouse (*rs. GetF1 (), FW::HasFigure (Job::Helper, false ), false , false , length.data (), & rs);
642642 // 2. Flagge des Weges
643- best[1 ] = FindWarehouse (*rs-> GetF2 (), FW::HasFigure (Job::Helper, false ), false , false , &length[1 ], rs);
643+ best[1 ] = FindWarehouse (*rs. GetF2 (), FW::HasFigure (Job::Helper, false ), false , false , &length[1 ], & rs);
644644 }
645645
646646 // überhaupt nen Weg gefunden?
647647 // Welche Flagge benutzen?
648648 if (best[0 ] && (!best[1 ] || length[0 ] < length[1 ]))
649- best[0 ]->OrderCarrier (*rs-> GetF1 (), * rs);
649+ best[0 ]->OrderCarrier (*rs. GetF1 (), rs);
650650 else if (best[1 ])
651- best[1 ]->OrderCarrier (*rs-> GetF2 (), * rs);
651+ best[1 ]->OrderCarrier (*rs. GetF2 (), rs);
652652 else
653653 return false ;
654654 return true ;
@@ -719,7 +719,7 @@ void GamePlayer::FindCarrierForAllRoads()
719719 for (RoadSegment* rs : roads)
720720 {
721721 if (!rs->hasCarrier (0 ))
722- FindCarrierForRoad (rs);
722+ FindCarrierForRoad (* rs);
723723 }
724724}
725725
@@ -842,10 +842,10 @@ void GamePlayer::FindWarehouseForAllJobs(const Job job)
842842 }
843843}
844844
845- Ware* GamePlayer::OrderWare (const GoodType ware, noBaseBuilding* goal)
845+ Ware* GamePlayer::OrderWare (const GoodType ware, noBaseBuilding& goal)
846846{
847847 // / Gibt es ein Lagerhaus mit dieser Ware?
848- nobBaseWarehouse* wh = FindWarehouse (* goal, FW::HasMinWares (ware, 1 ), false , true );
848+ nobBaseWarehouse* wh = FindWarehouse (goal, FW::HasMinWares (ware, 1 ), false , true );
849849
850850 if (wh)
851851 {
@@ -856,8 +856,7 @@ Ware* GamePlayer::OrderWare(const GoodType ware, noBaseBuilding* goal)
856856 {
857857 // Wenn Notfallprogramm aktiv nur an Holzfäller und Sägewerke Bretter/Steine liefern
858858 if ((ware != GoodType::Boards && ware != GoodType::Stones)
859- || goal->GetBuildingType () == BuildingType::Woodcutter
860- || goal->GetBuildingType () == BuildingType::Sawmill)
859+ || goal.GetBuildingType () == BuildingType::Woodcutter || goal.GetBuildingType () == BuildingType::Sawmill)
861860 return wh->OrderWare (ware, goal);
862861 else
863862 return nullptr ;
@@ -871,7 +870,7 @@ Ware* GamePlayer::OrderWare(const GoodType ware, noBaseBuilding* goal)
871870 if (curWare->IsLostWare () && curWare->type == ware)
872871 {
873872 // got a lost ware with a road to goal -> find best
874- unsigned curLength = curWare->CheckNewGoalForLostWare (* goal);
873+ unsigned curLength = curWare->CheckNewGoalForLostWare (goal);
875874 if (curLength < bestLength)
876875 {
877876 bestLength = curLength;
@@ -888,27 +887,27 @@ Ware* GamePlayer::OrderWare(const GoodType ware, noBaseBuilding* goal)
888887 return nullptr ;
889888}
890889
891- nofCarrier* GamePlayer::OrderDonkey (RoadSegment* road) const
890+ nofCarrier* GamePlayer::OrderDonkey (RoadSegment& road) const
892891{
893892 std::array<unsigned , 2 > length;
894893 std::array<nobBaseWarehouse*, 2 > best;
895894
896895 // 1. Flagge des Weges
897- best[0 ] = FindWarehouse (*road-> GetF1 (), FW::HasFigure (Job::PackDonkey, false ), false , false , length.data (), road);
896+ best[0 ] = FindWarehouse (*road. GetF1 (), FW::HasFigure (Job::PackDonkey, false ), false , false , length.data (), & road);
898897 // 2. Flagge des Weges
899- best[1 ] = FindWarehouse (*road-> GetF2 (), FW::HasFigure (Job::PackDonkey, false ), false , false , &length[1 ], road);
898+ best[1 ] = FindWarehouse (*road. GetF2 (), FW::HasFigure (Job::PackDonkey, false ), false , false , &length[1 ], & road);
900899
901900 // überhaupt nen Weg gefunden?
902901 // Welche Flagge benutzen?
903902 if (best[0 ] && (!best[1 ] || length[0 ] < length[1 ]))
904- return best[0 ]->OrderDonkey (road, road-> GetF1 ());
903+ return best[0 ]->OrderDonkey (road, * road. GetF1 ());
905904 else if (best[1 ])
906- return best[1 ]->OrderDonkey (road, road-> GetF2 ());
905+ return best[1 ]->OrderDonkey (road, * road. GetF2 ());
907906 else
908907 return nullptr ;
909908}
910909
911- RoadSegment* GamePlayer::FindRoadForDonkey (noRoadNode* start, noRoadNode** goal)
910+ RoadSegment* GamePlayer::FindRoadForDonkey (noRoadNode& start, noRoadNode** goal)
912911{
913912 // Bisher höchste Trägerproduktivität und die entsprechende Straße dazu
914913 unsigned best_productivity = 0 ;
@@ -925,9 +924,9 @@ RoadSegment* GamePlayer::FindRoadForDonkey(noRoadNode* start, noRoadNode** goal)
925924 noRoadNode* current_best_goal = nullptr ;
926925 // Weg zu beiden Flaggen berechnen
927926 unsigned length1, length2;
928- bool isF1Reachable = world.FindHumanPathOnRoads (* start, *roadSeg->GetF1 (), &length1, nullptr , roadSeg)
927+ bool isF1Reachable = world.FindHumanPathOnRoads (start, *roadSeg->GetF1 (), &length1, nullptr , roadSeg)
929928 != RoadPathDirection::None;
930- bool isF2Reachable = world.FindHumanPathOnRoads (* start, *roadSeg->GetF2 (), &length2, nullptr , roadSeg)
929+ bool isF2Reachable = world.FindHumanPathOnRoads (start, *roadSeg->GetF2 (), &length2, nullptr , roadSeg)
931930 != RoadPathDirection::None;
932931
933932 // Wenn man zu einer Flagge nich kommt, die jeweils andere nehmen
@@ -1224,7 +1223,7 @@ bool GamePlayer::IsAttackable(const unsigned char playerId) const
12241223 return GetPactState (PactType::NonAgressionPact, playerId) != PactState::Accepted;
12251224}
12261225
1227- void GamePlayer::OrderTroops (nobMilitary* goal, std::array<unsigned , NUM_SOLDIER_RANKS> counts,
1226+ void GamePlayer::OrderTroops (nobMilitary& goal, std::array<unsigned , NUM_SOLDIER_RANKS> counts,
12281227 unsigned total_max) const
12291228{
12301229 // Solange Lagerhäuser nach Soldaten absuchen, bis entweder keins mehr übrig ist oder alle Soldaten bestellt sind
@@ -1236,7 +1235,7 @@ void GamePlayer::OrderTroops(nobMilitary* goal, std::array<unsigned, NUM_SOLDIER
12361235 for (unsigned i = 0 ; i < NUM_SOLDIER_RANKS; i++)
12371236 desiredRanks[i] = counts[i] > 0 ;
12381237
1239- wh = FindWarehouse (* goal, FW::HasAnyMatchingSoldier (desiredRanks), false , false );
1238+ wh = FindWarehouse (goal, FW::HasAnyMatchingSoldier (desiredRanks), false , false );
12401239 if (wh)
12411240 {
12421241 wh->OrderTroops (goal, counts, total_max);
0 commit comments