about summary refs log tree commit diff
path: root/src/game/client/gc_hooks.cpp
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2008-03-22 11:55:56 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2008-03-22 11:55:56 +0000
commit3dd090c705678277cc0f88d9b5dce663ae67e80c (patch)
treef107d4a5364401ce1eed6ffa35f562d2e050e2e8 /src/game/client/gc_hooks.cpp
parent7797a651676ec47ab79222210f50c5aa4da80d7f (diff)
downloadzcatch-3dd090c705678277cc0f88d9b5dce663ae67e80c.tar.gz
zcatch-3dd090c705678277cc0f88d9b5dce663ae67e80c.zip
made better broadcast and motd
Diffstat (limited to 'src/game/client/gc_hooks.cpp')
-rw-r--r--src/game/client/gc_hooks.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/game/client/gc_hooks.cpp b/src/game/client/gc_hooks.cpp
index 54b8715d..287d8d21 100644
--- a/src/game/client/gc_hooks.cpp
+++ b/src/game/client/gc_hooks.cpp
@@ -528,7 +528,7 @@ extern "C" void modc_message(int msgtype)
 	{
 		NETMSG_SV_BROADCAST *msg = (NETMSG_SV_BROADCAST *)rawmsg;
 		str_copy(broadcast_text, msg->message, sizeof(broadcast_text));
-		broadcast_time = time_get();
+		broadcast_time = time_get()+time_freq()*10;
 	}
 	else if(msgtype == NETMSGTYPE_SV_MOTD)
 	{
@@ -548,8 +548,23 @@ extern "C" void modc_message(int msgtype)
 				}
 			}
 		}
-			
+
 		dbg_msg("game", "MOTD: %s", server_motd);
+		
+		// take the first line as a center text
+		int len = 0;
+		for(int i = 0; server_motd[i]; i++)
+		{
+			if(server_motd[i] == '\n')
+			{
+				len = i;
+				break;
+			}
+		}
+	
+		len = min(len, (int)sizeof(broadcast_text));
+		str_copy(broadcast_text, msg->message, len);
+		broadcast_time = time_get()+time_freq()*10;
 	}
 	else if(msgtype == NETMSGTYPE_SV_SETINFO)
 	{