summaryrefslogtreecommitdiff
path: root/src/network/network_chat_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-12-14 14:57:51 +0000
committerrubidium <rubidium@openttd.org>2010-12-14 14:57:51 +0000
commite68efb9e719a028f14da9965d4e3795252b2cbad (patch)
treec0b28a52236d51805034fab159a15a305402ca06 /src/network/network_chat_gui.cpp
parent4045429df6e39fbd020a5feda379177b2d2bc267 (diff)
downloadopenttd-e68efb9e719a028f14da9965d4e3795252b2cbad.tar.xz
(svn r21512) -Change/Feature: make the delay of the chat messages timing out unrelated to the number of passed game days, i.e. don't stop aging chat messages when the server is paused
Diffstat (limited to 'src/network/network_chat_gui.cpp')
-rw-r--r--src/network/network_chat_gui.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index 1d929bbb6..28a3afc99 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -40,7 +40,7 @@ static const uint NETWORK_CHAT_LINE_SPACING = 3;
struct ChatMessage {
char message[DRAW_STRING_BUFFER];
TextColour colour;
- Date end_date;
+ uint32 remove_time;
};
/* used for chat window */
@@ -68,10 +68,10 @@ static inline uint GetChatMessageCount()
/**
* Add a text message to the 'chat window' to be shown
* @param colour The colour this message is to be shown in
- * @param duration The duration of the chat message in game-days
+ * @param duration The duration of the chat message in seconds
* @param message message itself in printf() style
*/
-void CDECL NetworkAddChatMessage(TextColour colour, uint8 duration, const char *message, ...)
+void CDECL NetworkAddChatMessage(TextColour colour, uint duration, const char *message, ...)
{
char buf[DRAW_STRING_BUFFER];
const char *bufp;
@@ -104,7 +104,7 @@ void CDECL NetworkAddChatMessage(TextColour colour, uint8 duration, const char *
/* The default colour for a message is company colour. Replace this with
* white for any additional lines */
cmsg->colour = (bufp == buf && (colour & IS_PALETTE_COLOUR)) ? colour : TC_WHITE;
- cmsg->end_date = _date + duration;
+ cmsg->remove_time = _realtime_tick + duration * 1000;
bufp += strlen(bufp) + 1; // jump to 'next line' in the formatted string
}
@@ -181,15 +181,15 @@ void NetworkUndrawChatMessage()
}
}
-/** Check if a message is expired every day */
-void NetworkChatMessageDailyLoop()
+/** Check if a message is expired. */
+void NetworkChatMessageLoop()
{
for (uint i = 0; i < MAX_CHAT_MESSAGES; i++) {
ChatMessage *cmsg = &_chatmsg_list[i];
if (cmsg->message[0] == '\0') continue;
/* Message has expired, remove from the list */
- if (cmsg->end_date < _date) {
+ if (cmsg->remove_time < _realtime_tick) {
/* Move the remaining messages over the current message */
if (i != MAX_CHAT_MESSAGES - 1) memmove(cmsg, cmsg + 1, sizeof(*cmsg) * (MAX_CHAT_MESSAGES - i - 1));