From b408e9fe49d78332d4fbc7e30bb70d7ff7e4225e Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Sun, 19 Dec 2004 09:52:59 +0000 Subject: [PATCH] abort weapon fire if unable to create object --- ChangeLog | 2 ++ main/laser.c | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b991e311..a0669ac4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * include/u_mem.h: prototype for strdup with MPW + * main/laser.c: abort weapon fire if unable to create object + 2004-12-17 Chris Taylor * main/state.c: open autosave file for writing, not reading diff --git a/main/laser.c b/main/laser.c index 9172525e..b2878b17 100644 --- a/main/laser.c +++ b/main/laser.c @@ -1,4 +1,4 @@ -/* $Id: laser.c,v 1.12 2004-08-28 23:17:45 schaffner Exp $ */ +/* $Id: laser.c,v 1.13 2004-12-19 09:52:59 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -23,7 +23,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #endif #ifdef RCS -char laser_rcsid[] = "$Id: laser.c,v 1.12 2004-08-28 23:17:45 schaffner Exp $"; +char laser_rcsid[] = "$Id: laser.c,v 1.13 2004-12-19 09:52:59 btb Exp $"; #endif #include @@ -278,7 +278,9 @@ int create_weapon_object(int weapon_type,int segnum,vms_vector *position) Assert(rtype != -1); objnum = obj_create( OBJ_WEAPON, weapon_type, segnum, position, NULL, laser_radius, CT_WEAPON, MT_PHYSICS, rtype ); - + if (objnum == -1) + return -1; + obj = &Objects[objnum]; if (Weapon_info[weapon_type].render_type == WEAPON_RENDER_POLYMODEL) { -- 2.39.2