Skip to content

Commit

Permalink
define idle controller
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Feb 21, 2014
1 parent 25c1a9b commit 04a4ec3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/team.cpp
Expand Up @@ -227,6 +227,7 @@ char const *team::team_info::controller_string() const
case HUMAN_AI: return "human_ai";
case NETWORK: return "network";
case NETWORK_AI: return "network_ai";
case IDLE: return "idle";
case EMPTY: return "null";
default: assert(false); return NULL;
}
Expand Down Expand Up @@ -498,6 +499,8 @@ void team::change_controller(const std::string& controller)
cid = team::NETWORK_AI;
else if (controller == "null")
cid = team::EMPTY;
else if (controller == "idle")
cid = team::IDLE;
else
cid = team::AI;

Expand Down
4 changes: 3 additions & 1 deletion src/team.hpp
Expand Up @@ -32,7 +32,7 @@ namespace wb {
class team : public savegame::savegame_config
{
public:
enum CONTROLLER { HUMAN, HUMAN_AI, AI, NETWORK, NETWORK_AI, EMPTY };
enum CONTROLLER { HUMAN, HUMAN_AI, AI, NETWORK, NETWORK_AI, IDLE, EMPTY };

private:
class shroud_map {
Expand Down Expand Up @@ -210,6 +210,7 @@ class team : public savegame::savegame_config
bool is_network_human() const { return info_.controller == NETWORK; }
bool is_network_ai() const { return info_.controller == NETWORK_AI; }
bool is_ai() const { return info_.controller == AI || is_human_ai(); }
bool is_idle() const { return info_.controller == IDLE; }
bool is_empty() const { return info_.controller == EMPTY; }

bool is_local() const { return is_human() || is_ai(); }
Expand All @@ -220,6 +221,7 @@ class team : public savegame::savegame_config
void make_network() { info_.controller = NETWORK; }
void make_network_ai() { info_.controller = NETWORK_AI; }
void make_ai() { info_.controller = AI; }
void make_idle() { info_.controller = IDLE; }
void change_controller(const std::string& controller);
void change_controller(CONTROLLER controller) { info_.controller = controller; }

Expand Down

0 comments on commit 04a4ec3

Please sign in to comment.