Skip to content

Commit a3d378e

Browse files
committed
Code review: Optimize code
1 parent cf8ea9a commit a3d378e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

libs/s25main/network/GameClient.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,16 +1563,17 @@ bool GameClient::StartReplay(const boost::filesystem::path& path)
15631563

15641564
if(!mapinfo.savegame && replayinfo->replay.GetMinorVersion() < 2)
15651565
{
1566+
auto newDistributions = default_settings.distribution;
1567+
unsigned idx = 0;
1568+
for(const DistributionMapping& mapping : distributionMap)
1569+
{
1570+
if(leatheraddon::isLeatherAddonBuildingType(std::get<1>(mapping)))
1571+
newDistributions[idx] = 0;
1572+
idx++;
1573+
}
1574+
15661575
for(unsigned i = 0; i < game->world_.GetNumPlayers(); i++)
15671576
{
1568-
auto newDistributions = default_settings.distribution;
1569-
unsigned idx = 0;
1570-
for(const DistributionMapping& mapping : distributionMap)
1571-
{
1572-
if(leatheraddon::isLeatherAddonBuildingType(std::get<1>(mapping)))
1573-
newDistributions[idx] = 0;
1574-
idx++;
1575-
}
15761577
game->world_.GetPlayer(i).ChangeDistribution(newDistributions);
15771578
}
15781579
}

0 commit comments

Comments
 (0)