made it so if client_type=ai is in preferences file, ...
...the player will join networked games as an AI
This commit is contained in:
parent
3267f1a79a
commit
e77e738b0c
4 changed files with 12 additions and 1 deletions
|
@ -344,7 +344,7 @@ void play_multiplayer_client(display& disp, game_data& units_data, config& cfg,
|
|||
side != sides_list.end(); ++side) {
|
||||
string_map& values = (*side)->values;
|
||||
if(team_num-1 == side - sides_list.begin())
|
||||
values["controller"] = "human";
|
||||
values["controller"] = preferences::client_type();
|
||||
else
|
||||
values["controller"] = "network";
|
||||
}
|
||||
|
|
|
@ -313,6 +313,14 @@ bool show_ai_moves()
|
|||
return prefs["show_ai_moves"] != "no";
|
||||
}
|
||||
|
||||
std::string client_type()
|
||||
{
|
||||
if(prefs["client_type"] == "ai")
|
||||
return "ai";
|
||||
else
|
||||
return "human";
|
||||
}
|
||||
|
||||
void show_preferences_dialog(display& disp)
|
||||
{
|
||||
const events::resize_lock prevent_resizing;
|
||||
|
|
|
@ -74,6 +74,8 @@ namespace preferences {
|
|||
|
||||
bool show_ai_moves();
|
||||
|
||||
std::string client_type();
|
||||
|
||||
void show_preferences_dialog(display& disp);
|
||||
void show_video_mode_dialog(display& disp);
|
||||
}
|
||||
|
|
|
@ -341,5 +341,6 @@ int main()
|
|||
run_server();
|
||||
} catch(network::error& e) {
|
||||
std::cerr << "error starting server: " << e.message << "\n";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue