From b78c1d6fd85b4961ebf5663a31204fc804d7e6fd Mon Sep 17 00:00:00 2001 From: Andrettin Date: Mon, 22 Aug 2016 08:00:08 +0200 Subject: [PATCH] Fixed issue which caused split-off factions to appear as neutral --- src/map/script_map.cpp | 11 ----------- src/stratagus/player.cpp | 12 ++++++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/map/script_map.cpp b/src/map/script_map.cpp index 76e863ebb..5852672b4 100644 --- a/src/map/script_map.cpp +++ b/src/map/script_map.cpp @@ -37,9 +37,6 @@ #include "map.h" -//Wyrmgus start -#include "commands.h" -//Wyrmgus end #include "iolib.h" #include "script.h" #include "tileset.h" @@ -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 diff --git a/src/stratagus/player.cpp b/src/stratagus/player.cpp index ae40ddc8e..d3d50e34a 100644 --- a/src/stratagus/player.cpp +++ b/src/stratagus/player.cpp @@ -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]; } } @@ -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;