Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2014-12-07 23:27:31 +0000
committerStijn Buys <ingar@osirion.org>2014-12-07 23:27:31 +0000
commit493e4317e19725e2de2d51753e5c1906bf9c64ba (patch)
treec46831d6d661a79b5da6580d4472d39a615fedea /src/core/gameserver.cc
parent941c64546ca22b87a9153d36e9e3fe59c18abafe (diff)
Implemented messageboxes and the ability for the game module to send them to remote clients,
send a messagebox if the player's ship is destroyed, this fixes having to press the respawn button twice. added messageboxes on network connection failures.
Diffstat (limited to 'src/core/gameserver.cc')
-rw-r--r--src/core/gameserver.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core/gameserver.cc b/src/core/gameserver.cc
index 544f660..37c486c 100644
--- a/src/core/gameserver.cc
+++ b/src/core/gameserver.cc
@@ -472,6 +472,25 @@ void GameServer::broadcast_sound(const std::string name, Player *ignore_player)
}
}
+// server sends a messagebox to a single player
+void GameServer::messagebox(Player *player, const std::string & text, const std::string &label1, const std::string command1, const std::string &label2, const std::string command2)
+{
+ if (!text.size()) {
+ return;
+ }
+
+ NetClient *client = player->client();
+
+ if (client) {
+ // this player is a network client, send message over network
+ server_network->send_messagebox(client, text, label1, command1, label2, command2);
+
+ } else if (player == localplayer()) {
+ // local player, send message to the local application
+ application()->notify_messagebox(text, label1, command1, label2, command2);
+ }
+}
+
// execute a command for a remote player
void GameServer::exec(Player *player, std::string const & cmdline)
{