From 9726c06b6acbbd5621eaabd926a17393005ef8b7 Mon Sep 17 00:00:00 2001 From: zicodxx Date: Tue, 12 Jul 2011 15:34:42 +0200 Subject: [PATCH] Fixed uninitialized bytes in multi_do_create_robot_powerups() and two set but unused variables --- CHANGELOG.txt | 1 + main/multibot.c | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index aa93ed000..c2de13e4e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ D2X-Rebirth Changelog 20110712 -------- main/wall.c: Readded automatic wall-flag setting for opened doors as PLP cannot protect us from negative side-effects due to how gullible multi_do_door_open() works +main/multibot.c: Fixed uninitialized bytes in multi_do_create_robot_powerups() and two set but unused variables 20110710 -------- diff --git a/main/multibot.c b/main/multibot.c index 67858545b..11a40fe12 100644 --- a/main/multibot.c +++ b/main/multibot.c @@ -765,11 +765,11 @@ multi_do_robot_fire(char *buf) int loc = 1; int botnum; short remote_botnum; - int pnum, gun_num; + int gun_num; vms_vector fire, gun_point; robot_info *robptr; - pnum = buf[loc]; loc += 1; + loc += 1; // pnum remote_botnum = GET_INTEL_SHORT(buf + loc); botnum = objnum_remote_to_local(remote_botnum, (sbyte)buf[loc+2]); loc += 3; gun_num = (sbyte)buf[loc]; loc += 1; @@ -882,11 +882,10 @@ multi_do_robot_explode(char *buf) short remote_botnum; int loc = 1; short killer, remote_killer; - int pnum; int rval; char thief; - pnum = buf[loc]; loc += 1; + loc += 1; // pnum remote_killer = GET_INTEL_SHORT(buf + loc); killer = objnum_remote_to_local(remote_killer, (sbyte)buf[loc+2]); loc += 3; remote_botnum = GET_INTEL_SHORT(buf + loc); @@ -1072,10 +1071,13 @@ multi_do_create_robot_powerups(char *buf) object del_obj; int pnum, egg_objnum, i; - pnum = buf[loc]; loc += 1; - del_obj.contains_count = buf[loc]; loc += 1; - del_obj.contains_type = buf[loc]; loc += 1; - del_obj.contains_id = buf[loc]; loc += 1; + memset( &del_obj, 0, sizeof(object) ); + del_obj.type = OBJ_ROBOT; + + pnum = buf[loc]; loc += 1; + del_obj.contains_count = buf[loc]; loc += 1; + del_obj.contains_type = buf[loc]; loc += 1; + del_obj.contains_id = buf[loc]; loc += 1; del_obj.segnum = GET_INTEL_SHORT(buf + loc); loc += 2; memcpy(&del_obj.pos, buf+loc, sizeof(vms_vector)); loc += 12;