Skip to content

Commit b76a8b2

Browse files
author
Karl-Robert Ernst
committed
remove compatiblity-hack for script.txt because all lobbies are using MyPlayerName and IsHost now
1 parent 7b6e57e commit b76a8b2

File tree

1 file changed

+2
-42
lines changed

1 file changed

+2
-42
lines changed

rts/Game/GameSetup.cpp

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -48,53 +48,13 @@ void LocalSetup::Init(const std::string& setup)
4848
file.GetDef(autohostport, "0", "GAME\\AutohostPort");
4949

5050
file.GetDef(myPlayerName, "", "GAME\\MyPlayerName");
51-
file.GetDef(myPlayerNum, "0", "GAME\\MyPlayerNum");
52-
if (myPlayerName.empty())
53-
{
54-
char section[50];
55-
sprintf(section, "GAME\\PLAYER%i", myPlayerNum);
56-
string s(section);
57-
58-
if (!file.SectionExist(s))
59-
throw content_error("myPlayer not found");
60-
61-
std::map<std::string, std::string> setup = file.GetAllValues(s);
62-
std::map<std::string, std::string>::iterator it = setup.find("name");
63-
if (it != setup.end())
64-
myPlayerName = it->second;
65-
else
66-
throw content_error("Player doesn't have a name");
67-
}
68-
6951
int tmp_isHost = 0;
7052
if (file.GetValue(tmp_isHost, "GAME\\IsHost"))
7153
isHost = static_cast<bool>(tmp_isHost);
7254
else
7355
{
74-
for (int a = 0; a < MAX_PLAYERS; ++a) {
75-
// search for the first player not from the demo, if it is ourself, we are the host
76-
char section[50];
77-
sprintf(section, "GAME\\PLAYER%i", a);
78-
string s(section);
79-
80-
if (!file.SectionExist(s)) {
81-
continue;
82-
}
83-
bool fromdemo = false;
84-
std::string name;
85-
std::map<std::string, std::string> setup = file.GetAllValues(s);
86-
std::map<std::string, std::string>::iterator it;
87-
if ((it = setup.find("name")) != setup.end())
88-
name = it->second;
89-
if ((it = setup.find("isfromdemo")) != setup.end())
90-
fromdemo = static_cast<bool>(atoi(it->second.c_str()));
91-
92-
if (!fromdemo)
93-
{
94-
isHost = (myPlayerName == name);
95-
break;
96-
}
97-
}
56+
isHost = false;
57+
logOutput.Print("Warning: The script.txt is missing the IsHost-entry. Assuming this is a client.");
9858
}
9959
}
10060

0 commit comments

Comments
 (0)