summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorAlexander Baldeck <alexander@archlinux.org>2004-09-27 23:51:29 +0000
committerAlexander Baldeck <alexander@archlinux.org>2004-09-27 23:51:29 +0000
commit3c10e107946c25d497cd4e471b20e0e19facd23b (patch)
treef133df07528b66ad8caa7bcd80377cbba699cfe8 /src/game.cpp
parentaf4096ec7148eea52352a4711f8586e6b52fe32f (diff)
downloadmana-3c10e107946c25d497cd4e471b20e0e19facd23b.tar.gz
mana-3c10e107946c25d497cd4e471b20e0e19facd23b.tar.bz2
mana-3c10e107946c25d497cd4e471b20e0e19facd23b.tar.xz
mana-3c10e107946c25d497cd4e471b20e0e19facd23b.zip
fix for mapserver segfault (broken pipe for all on screen users)
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/game.cpp b/src/game.cpp
index a8b01862..e3c60d35 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -99,6 +99,8 @@ void game() {
do_parse();
status("FLUSH");
flush();
+ if(fps>30)
+ rest(15);
}
exit_graphic();
@@ -345,22 +347,25 @@ void do_parse() {
break;
case 0x008e:
case 0x009a:
- temp = (char *)malloc(RFIFOW(2)-4);
- memset(temp, '\0', RFIFOW(2)-4);
- memcpy(temp, RFIFOP(4), RFIFOW(2)-4);
- if(player_node->speech!=NULL) {
- free(player_node->speech);
- player_node->speech = NULL;
- //node->speech_time = 0;
+ if(RFIFOW(2)>4) {
+ if(player_node->speech!=NULL) {
+ free(player_node->speech);
+ player_node->speech = NULL;
+ }
+
+ player_node->speech = (char *)malloc(RFIFOW(2)-4);
+ memset(player_node->speech, '\0', RFIFOW(2)-4);
+ memcpy(player_node->speech, RFIFOP(4), RFIFOW(2)-5);
+
+ player_node->speech_time = SPEECH_TIME;
+ player_node->speech_color = makecol(255, 255, 255);
+
+ if(id==0x008e)
+ chatlog.chat_log(player_node->speech, BY_PLAYER, gui_font);
+ else
+ chatlog.chat_log(player_node->speech, BY_GM, gui_font);
}
- player_node->speech = temp;
- player_node->speech_time = SPEECH_TIME;
- player_node->speech_color = makecol(255, 255, 255);
- if(id==0x008e)
- chatlog.chat_log(player_node->speech, BY_PLAYER, gui_font);
- else
- chatlog.chat_log(player_node->speech, BY_GM, gui_font);
- break;
+ break;
// Success to walk request
case 0x0087:
if(walk_status==1)