From e51b5e01d1f4153596f3ceffb3a955fe5eb7cb05 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 6 Sep 2009 21:37:38 +0000 Subject: [PATCH] - fixed: Trying to pick up an object of the Ammo base class caused a crash. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@447 b0f79afe-0144-0410-b225-9a4edf0717df --- docs/rh-log.txt | 1 + src/g_shared/a_pickups.cpp | 4 ++-- src/p_mobj.cpp | 3 ++- src/svnrevision.h | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index ab69effb..0ef17a33 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ September 6, 2009 (Changes by Graf Zahl) +- fixed: Trying to pick up an object of the Ammo base class caused a crash. - changed line_t's sidenum into sidedef pointers. - changed side_t's linenum into a linedef pointer. - Added PinkSilver's SetActorVelocity code submission (with optimizations.) diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index 523aaca2..2753a750 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -55,7 +55,7 @@ const PClass *AAmmo::GetParentAmmo () const { const PClass *type = GetClass (); - while (type->ParentClass != RUNTIME_CLASS(AAmmo)) + while (type->ParentClass != RUNTIME_CLASS(AAmmo) && type->ParentClass != NULL) { type = type->ParentClass; } @@ -128,7 +128,7 @@ AInventory *AAmmo::CreateCopy (AActor *other) amount = FixedMul(amount, G_SkillProperty(SKILLP_AmmoFactor)); } - if (GetClass()->ParentClass != RUNTIME_CLASS(AAmmo)) + if (GetClass()->ParentClass != RUNTIME_CLASS(AAmmo) && GetClass() != RUNTIME_CLASS(AAmmo)) { const PClass *type = GetParentAmmo(); assert (type->ActorInfo != NULL); diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 84a61fde..3d6e80ac 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -5135,13 +5135,14 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, MissileActor->velx = FixedMul (vx, speed); MissileActor->vely = FixedMul (vy, speed); - if (th->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)) + if (MissileActor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)) { MissileActor->velz = 0; } else { MissileActor->velz = FixedMul (vz, speed); + } if (MissileActor->flags4 & MF4_SPECTRAL) MissileActor->health = -1; diff --git a/src/svnrevision.h b/src/svnrevision.h index 2a2aa12d..2edd0bda 100644 --- a/src/svnrevision.h +++ b/src/svnrevision.h @@ -3,5 +3,5 @@ // This file was automatically generated by the // updaterevision tool. Do not edit by hand. -#define ZD_SVN_REVISION_STRING "1801" -#define ZD_SVN_REVISION_NUMBER 1801 +#define ZD_SVN_REVISION_STRING "1804" +#define ZD_SVN_REVISION_NUMBER 1804