diff options
-rw-r--r-- | osirion.kdevelop.pcs | bin | 675867 -> 762514 bytes | |||
-rw-r--r-- | osirion.kdevses | 13 | ||||
-rw-r--r-- | src/audio/audio.cc | 1 | ||||
-rw-r--r-- | src/audio/sources.h | 2 | ||||
-rw-r--r-- | src/core/gameserver.cc | 25 | ||||
-rw-r--r-- | src/core/gameserver.h | 3 |
6 files changed, 37 insertions, 7 deletions
diff --git a/osirion.kdevelop.pcs b/osirion.kdevelop.pcs Binary files differindex cbac4fc..f47f01a 100644 --- a/osirion.kdevelop.pcs +++ b/osirion.kdevelop.pcs diff --git a/osirion.kdevses b/osirion.kdevses index b1e7ab1..e1979af 100644 --- a/osirion.kdevses +++ b/osirion.kdevses @@ -1,13 +1,16 @@ <?xml version = '1.0' encoding = 'UTF-8'?> <!DOCTYPE KDevPrjSession> <KDevPrjSession> - <DocsAndViews NumberOfDocuments="2" > - <Doc0 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/render/draw.cc" > - <View0 Encoding="" line="144" Type="Source" /> + <DocsAndViews NumberOfDocuments="3" > + <Doc0 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/gameserver.cc" > + <View0 Encoding="" line="191" Type="Source" /> </Doc0> - <Doc1 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/Makefile.am" > - <View0 Encoding="" line="24" Type="Source" /> + <Doc1 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/view.cc" > + <View0 Encoding="" line="150" Type="Source" /> </Doc1> + <Doc2 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/sys/sys.cc" > + <View0 Encoding="" line="0" Type="Source" /> + </Doc2> </DocsAndViews> <pluginList> <kdevdebugger> diff --git a/src/audio/audio.cc b/src/audio/audio.cc index 308667b..842395f 100644 --- a/src/audio/audio.cc +++ b/src/audio/audio.cc @@ -72,6 +72,7 @@ void shutdown() void play(const char *name) { if (Sources::available(0)) { + alSourceRewind(Sources::ui()); Buffers::bind(Sources::ui(), std::string(name)); alSourcePlay(Sources::ui()); } diff --git a/src/audio/sources.h b/src/audio/sources.h index f3d6470..08a2a41 100644 --- a/src/audio/sources.h +++ b/src/audio/sources.h @@ -25,6 +25,8 @@ public: static bool available(size_t index) { return source_available[index]; } + static ALuint source(size_t index) { return sources[index]; } + /// the sources for user interface sounds static inline ALuint ui() { return sources[0]; } diff --git a/src/core/gameserver.cc b/src/core/gameserver.cc index 46cb742..3bcc4fe 100644 --- a/src/core/gameserver.cc +++ b/src/core/gameserver.cc @@ -27,6 +27,11 @@ void func_who(Player *player, std::string const &args) server()->list_players(player); } +void func_time(Player *player, std::string const &args) +{ + server()->showtime(player); +} + GameServer *GameServer::server_instance = 0; GameServer::GameServer() : GameInterface() @@ -69,8 +74,9 @@ GameServer::GameServer() : GameInterface() server_network = 0; } - Func::add("say", (GameFuncPtr) func_say); - Func::add("who", (GameFuncPtr) func_who); + Func::add("say",func_say); + Func::add("time", func_time); + Func::add("who", func_who); if (!Cvar::sv_dedicated->value()) { player_connect(localplayer()); @@ -101,6 +107,7 @@ GameServer::~GameServer() } Func::remove("say"); + Func::remove("time"); Func::remove("who"); server_instance = 0; @@ -179,6 +186,20 @@ void GameServer::say(Player *player, std::string const &message) } } +void GameServer::showtime(Player *player) +{ + int minutes = (int) floorf(server_time / 60.0f); + int seconds = (int) floorf(server_time - (float) minutes* 60.0f); + + int syshours = sys::time() / 3600; + int sysminutes = (sys::time() - syshours * 3600) / 60; + int sysseconds = sys::time() % 60; + + std::stringstream str; + str << "Uptime " << minutes << ":" << seconds << " Local time " << syshours << ":" << sysminutes << ":" << sysseconds; + send(player, str.str()); +} + void GameServer::broadcast(std::string const & message, Player *ignore_player) { // send to application diff --git a/src/core/gameserver.h b/src/core/gameserver.h index 025ea4d..a7ee159 100644 --- a/src/core/gameserver.h +++ b/src/core/gameserver.h @@ -49,6 +49,9 @@ public: /// a player sends a chat message on the public channel void say(Player *player, std::string const &args); + /// a player requests the current time + void showtime(Player *player); + /// broadcast a message to all players void broadcast(std::string const & message, Player *ignore_player = 0); |