Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2009-01-28 21:00:26 +0000
committerStijn Buys <ingar@osirion.org>2009-01-28 21:00:26 +0000
commit739f9dcb70d837697b6905e8256ba579a40d86fe (patch)
tree179b2b138dd731c35e41ddbd9b24cebf18507fe5 /src
parent6151cd514b735129563de7f3ad0fed4fbf09107e (diff)
interface cleanups, send_warn
Diffstat (limited to 'src')
-rw-r--r--src/core/netplayer.cc2
-rw-r--r--src/core/netplayer.h2
-rw-r--r--src/core/player.cc7
-rw-r--r--src/core/player.h17
4 files changed, 25 insertions, 3 deletions
diff --git a/src/core/netplayer.cc b/src/core/netplayer.cc
index 24a597f..0b3455f 100644
--- a/src/core/netplayer.cc
+++ b/src/core/netplayer.cc
@@ -31,7 +31,7 @@ void NetPlayer::sound(const std::string name)
player_client->send_raw(msg);
}
-void NetPlayer::message(Message::Channel channel, const std::string text)
+void NetPlayer::message(const Message::Channel channel, const std::string text)
{
if (!text.size())
return;
diff --git a/src/core/netplayer.h b/src/core/netplayer.h
index bbabea6..5659e2e 100644
--- a/src/core/netplayer.h
+++ b/src/core/netplayer.h
@@ -27,7 +27,7 @@ public:
NetClient *client() { return player_client; }
- virtual void message(Message::Channel const channel, const std::string text);
+ virtual void message(const Message::Channel channel, const std::string text);
virtual void sound(const std::string name);
private:
diff --git a/src/core/player.cc b/src/core/player.cc
index a642371..6385992 100644
--- a/src/core/player.cc
+++ b/src/core/player.cc
@@ -42,6 +42,7 @@ void Player::clear()
player_ping = 0;
player_level = 1;
+ player_warningtime = 0;
}
@@ -64,6 +65,12 @@ void Player::send(const std::string text)
message(core::Message::Info, text);
}
+void Player::send_warning(const std::string text)
+{
+ message(core::Message::Info, text);
+ player_warningtime = application()->time();
+}
+
void Player::sound(const std::string name)
{
application()->notify_sound(name.c_str());
diff --git a/src/core/player.h b/src/core/player.h
index 4620062..35a2f82 100644
--- a/src/core/player.h
+++ b/src/core/player.h
@@ -88,11 +88,24 @@ public:
/*----- messages -------------------------------------------------- */
- void send(const std::string name);
+ /// send a text message
+ void send(const std::string text);
+
+ /**
+ * @brief send a warning message
+ * Send the player a warning message abd set the warning
+ * message timestamp to the current application time
+ * @see last_warning()
+ */
+ void send_warning(const std::string text);
virtual void sound(const std::string name);
virtual void message(core::Message::Channel channel, const std::string text);
+
+ /// time of the last warning message
+ float last_warning() const { return player_warningtime; }
+
/*----- mutators -------------------------------------------------- */
@@ -204,6 +217,8 @@ private:
// bit to indicate zone has changed
bool player_zonechange;
+ float player_warningtime;
+
};
}