Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/gameinterface.cc14
-rw-r--r--src/core/gameinterface.h3
2 files changed, 17 insertions, 0 deletions
diff --git a/src/core/gameinterface.cc b/src/core/gameinterface.cc
index 898d97f..e7d7a31 100644
--- a/src/core/gameinterface.cc
+++ b/src/core/gameinterface.cc
@@ -178,6 +178,20 @@ void GameInterface::abort() {
game_running = false;
}
+Player *GameInterface::find_player(const int playerid)
+{
+ if (playerid == 0) {
+ return 0;
+ }
+
+ for (std::list<Player *>:: iterator it = game_players.begin(); it != game_players.end(); it++) {
+ if ((*it)->id() == playerid) {
+ return (*it);
+ }
+ }
+ return 0;
+}
+
Player *GameInterface::find_player(const std::string &search)
{
using aux::lowercase;
diff --git a/src/core/gameinterface.h b/src/core/gameinterface.h
index d99903f..f118ad3 100644
--- a/src/core/gameinterface.h
+++ b/src/core/gameinterface.h
@@ -49,6 +49,9 @@ public:
/// find the first player who's id or name matches the search string
Player *find_player(const std::string &search);
+
+ /// find a player id
+ Player *find_player(const int playerid);
/// show a list of connected players
void list_players();