From 004cf5748c6a425fea717635c7269608d52c3c61 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 13 Jul 2014 09:43:28 +0200 Subject: [PATCH] - fixed: FraggleScript's SpawnedThings array must always be checked for owned inventory items. The 'mapthingnumexist' function forgot to do that. --- src/fragglescript/t_func.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index 2513a68a8..32d4909d4 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -3530,8 +3530,17 @@ void FParser::SF_MapThingNumExist() } else { + // Inventory items in the player's inventory have to be considered non-present. + if (SpawnedThings[intval]->IsKindOf(RUNTIME_CLASS(AInventory)) && + barrier_cast(SpawnedThings[intval])->Owner != NULL) + { + t_return.value.i = 0; + } + else + { + t_return.value.i = 1; + } t_return.type = svt_int; - t_return.value.i = 1; } } } @@ -3770,11 +3779,14 @@ void FParser::SF_ObjType() mo = Script->trigger; } - for(unsigned int i=0;iGetClass() == ActorTypes[i]) + if (mo != NULL) { - t_return.type = svt_int; - t_return.value.i = i; - return; + for (unsigned int i = 0; i < countof(ActorTypes); i++) if (mo->GetClass() == ActorTypes[i]) + { + t_return.type = svt_int; + t_return.value.i = i; + return; + } } t_return.type = svt_int; t_return.value.i = -1;