Skip to content

Commit

Permalink
Fixed issue which caused split-off factions to appear as neutral
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrettin committed Aug 22, 2016
1 parent a00fe84 commit b78c1d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/map/script_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@

#include "map.h"

//Wyrmgus start
#include "commands.h"
//Wyrmgus end
#include "iolib.h"
#include "script.h"
#include "tileset.h"
Expand Down Expand Up @@ -815,14 +812,6 @@ void ApplyMapTemplate(std::string map_template_ident, int template_start_x, int
for (size_t i = 0; i < map_template->GeneratedResources.size(); ++i) {
Map.GenerateResources(map_template->GeneratedResources[i].first, map_template->GeneratedResources[i].second, map_start_pos, map_end - Vec2i(1, 1));
}

// set players to hostile with each other
for (int i = 0; i < PlayerMax - 1; ++i) {
for (int j = i + 1; j < PlayerMax - 1; ++j) {
CommandDiplomacy(i, DiplomacyEnemy, j);
CommandDiplomacy(j, DiplomacyEnemy, i);
}
}
}
//Wyrmgus end

Expand Down
12 changes: 12 additions & 0 deletions src/stratagus/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,12 @@ CPlayer *GetOrAddFactionPlayer(CFaction *faction)
Players[i].AiEnabled = true;
Players[i].AiName = "land-attack";
Players[i].Team = 1;
for (int j = 0; j < NumPlayers; ++j) {
if (Players[j].Type == PlayerComputer || Players[j].Type == PlayerPerson || Players[j].Type == PlayerRescueActive) {
CommandDiplomacy(i, DiplomacyEnemy, j);
CommandDiplomacy(j, DiplomacyEnemy, i);
}
}
return &Players[i];
}
}
Expand Down Expand Up @@ -2437,6 +2443,12 @@ void PlayersEachMinute(int playerIdx)
Players[j].Resources[GoldCost] = 10000; // give the new player enough resources to start up
Players[j].Resources[WoodCost] = 10000;
Players[j].Resources[StoneCost] = 10000;
for (int k = 0; k < NumPlayers; ++k) {
if (Players[k].Type == PlayerComputer || Players[k].Type == PlayerPerson || Players[k].Type == PlayerRescueActive) {
CommandDiplomacy(j, DiplomacyEnemy, k);
CommandDiplomacy(k, DiplomacyEnemy, j);
}
}
AiInit(Players[j]);
new_player_id = j;
break;
Expand Down

0 comments on commit b78c1d6

Please sign in to comment.