diff options
author | Stijn Buys <ingar@osirion.org> | 2008-08-10 18:48:23 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-08-10 18:48:23 +0000 |
commit | 9c56ebfdba5fe33476f8d382da6d72e5b81ab4b8 (patch) | |
tree | 3dfee7a93cd591df8ef3a0aef811067ef6451df7 /src/core | |
parent | ae96accdd3c38d3f96b0725020e7a390c53b86d5 (diff) |
added racetrack to the game module, added Odin's new structures to the assets documentation
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/entity.h | 7 | ||||
-rw-r--r-- | src/core/gameserver.cc | 20 | ||||
-rw-r--r-- | src/core/gameserver.h | 6 | ||||
-rw-r--r-- | src/core/player.cc | 2 |
4 files changed, 22 insertions, 13 deletions
diff --git a/src/core/entity.h b/src/core/entity.h index 2b2ed00..30e3356 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -47,7 +47,7 @@ public: enum Shape {Diamond=0, Sphere=1, Cube=2, Axis=3}; /// EntityDynamic event state classes - enum Event {Normal=0, ImpulseInitiate=2, Impulse=3, JumpInitiate=4, Jump=5}; + enum Event {Normal=0, NoPower=1, ImpulseInitiate=2, Impulse=3, JumpInitiate=4, Jump=5}; /// create a new entity and add it to the registry Entity(unsigned int flags = 0); @@ -137,7 +137,7 @@ public: virtual void receive_server_update(std::istream &is); /// mark the entity as destroyed - void die(); + virtual void die(); /// runs one game frame for the entity /** @@ -276,8 +276,9 @@ public: /// speed of the entity float entity_speed; -protected: unsigned int entity_eventstate; + +protected: float entity_timer; }; diff --git a/src/core/gameserver.cc b/src/core/gameserver.cc index 81df14b..fce758e 100644 --- a/src/core/gameserver.cc +++ b/src/core/gameserver.cc @@ -170,6 +170,8 @@ GameServer::GameServer() : GameInterface() func = Func::add("who", func_who, Func::Shared); func->set_info("get a list of connected players"); + server_players.clear(); + if (!Cvar::sv_dedicated->value()) { player_connect(localplayer()); } @@ -211,7 +213,7 @@ GameServer::~GameServer() server_instance = 0; - players.clear(); + server_players.clear(); } void GameServer::abort() @@ -225,7 +227,7 @@ void GameServer::list_players() stringstream msgstr; int count = 0; - for (std::list<Player *>:: iterator it = players.begin(); it != players.end(); it++) { + for (Players::iterator it = server_players.begin(); it != server_players.end(); it++) { msgstr.str(""); con_print << setw(3) << (*it)->id() << aux::pad_left((*it)->name(), 24) << std::endl; count++; @@ -257,7 +259,7 @@ Player *GameServer::find_player(std::string const search) std::istringstream searchstr(search); int id = 0; if (searchstr >> id) { - for (std::list<Player *>:: iterator it = players.begin(); it != players.end(); it++) { + for (std::list<Player *>:: iterator it = server_players.begin(); it != server_players.end(); it++) { if ((*it)->id() == id) { return (*it); } @@ -267,7 +269,7 @@ Player *GameServer::find_player(std::string const search) if (search.size() <3) return 0; - for (std::list<Player *>:: iterator it = players.begin(); it != players.end(); it++) { + for (std::list<Player *>:: iterator it = server_players.begin(); it != server_players.end(); it++) { if (aux::text_strip_lowercase((*it)->name()).find(lowercase(search)) != std::string::npos) return (*it); } @@ -470,7 +472,7 @@ void GameServer::player_connect(Player *player) server_module->player_connect(player); // manage player list - players.push_back(player); + server_players.push_back(player); } void GameServer::player_disconnect(Player *player) @@ -487,12 +489,12 @@ void GameServer::player_disconnect(Player *player) server_module->player_disconnect(player); // manage player list - std::list<Player *>:: iterator it = players.begin(); - while (((*it)->id() != player->id()) && (it != players.end())) { + std::list<Player *>:: iterator it = server_players.begin(); + while (((*it)->id() != player->id()) && (it != server_players.end())) { it++; } - if (it != players.end()) { - players.erase(it); + if (it != server_players.end()) { + server_players.erase(it); } } diff --git a/src/core/gameserver.h b/src/core/gameserver.h index f05e6c6..98938fa 100644 --- a/src/core/gameserver.h +++ b/src/core/gameserver.h @@ -21,6 +21,8 @@ namespace core class GameServer : public GameInterface { public: + typedef std::list<Player *> Players; + GameServer(); ~GameServer(); @@ -79,7 +81,7 @@ public: /// find the first player who's id or name matches the search string Player *find_player(std::string const search); - std::list<Player *> players; + inline Players & players() { return server_players; } /*----- static ---------------------------------------------------- */ @@ -100,6 +102,8 @@ private: float server_frametime; float server_time; float server_previoustime; + + Players server_players; }; inline GameServer *server() { return GameServer::instance(); } diff --git a/src/core/player.cc b/src/core/player.cc index fafb052..1a610ca 100644 --- a/src/core/player.cc +++ b/src/core/player.cc @@ -15,6 +15,7 @@ namespace core Player::Player() { + player_control = 0; clear(); } @@ -34,6 +35,7 @@ void Player::clear() player_mute = false; clear_assets(); + player_control = 0; } void Player::set_control(EntityControlable *entitycontrolable) |