From 02435b46a0af7287a542a0887ec7ac7aa828f742 Mon Sep 17 00:00:00 2001 From: Major Cooke Date: Sun, 13 Nov 2016 19:27:59 -0600 Subject: [PATCH 1/3] Fixed: A_SetInventory with an amount of 0 was not truly eliminating the actor. --- src/p_actionfunctions.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index 73cade49a4..b9cfd7fe0e 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -2665,8 +2665,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetInventory) } else if (amount <= 0) { - //Remove it all. - res = (mobj->TakeInventory(itemtype, item->Amount, true, false)); + // Remove it all. + if (item) + { + item->DepleteOrDestroy(); + res = true; + } ACTION_RETURN_BOOL(res); } else if (amount < item->Amount) From 109558d74d116900f3528862d062deefa3cb14d8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 14 Nov 2016 13:12:55 +0100 Subject: [PATCH 2/3] - added unsigned char casts to all isspace calls in zstring.cpp isspace takes a signed integer as parameter which triggers an assert on any non-ASCII character taken from a signed char array. --- src/zstring.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/zstring.cpp b/src/zstring.cpp index b6e5b4b8de..e8e867323d 100644 --- a/src/zstring.cpp +++ b/src/zstring.cpp @@ -632,7 +632,7 @@ void FString::StripLeft () if (max == 0) return; for (i = 0; i < max; ++i) { - if (!isspace(Chars[i])) + if (!isspace((unsigned char)Chars[i])) break; } if (i == 0) @@ -697,7 +697,7 @@ void FString::StripRight () if (max == 0) return; for (i = --max; i-- > 0; ) { - if (!isspace(Chars[i])) + if (!isspace((unsigned char)Chars[i])) break; } if (i == max) @@ -756,12 +756,12 @@ void FString::StripLeftRight () if (max == 0) return; for (i = 0; i < max; ++i) { - if (!isspace(Chars[i])) + if (!isspace((unsigned char)Chars[i])) break; } for (j = max - 1; j >= i; --j) { - if (!isspace(Chars[j])) + if (!isspace((unsigned char)Chars[j])) break; } if (i == 0 && j == max - 1) @@ -1040,7 +1040,7 @@ octdigits = [0-7]; yych = *YYCURSOR; // Skip preceding whitespace - while (yych != '\0' && isspace(yych)) { yych = *++YYCURSOR; } + while (yych != '\0' && isspace((unsigned char)yych)) { yych = *++YYCURSOR; } // Check for sign if (yych == '+' || yych == '-') { yych = *++YYCURSOR; } @@ -1078,7 +1078,7 @@ octdigits = [0-7]; } // The rest should all be whitespace - while (yych != '\0' && isspace(yych)) { yych = *++YYCURSOR; } + while (yych != '\0' && isspace((unsigned char)yych)) { yych = *++YYCURSOR; } return yych == '\0'; } @@ -1098,7 +1098,7 @@ digits = [0-9]; yych = *YYCURSOR; // Skip preceding whitespace - while (yych != '\0' && isspace(yych)) { yych = *++YYCURSOR; } + while (yych != '\0' && isspace((unsigned char)yych)) { yych = *++YYCURSOR; } // Check for sign if (yych == '+' || yych == '-') { yych = *++YYCURSOR; } @@ -1129,7 +1129,7 @@ digits = [0-9]; } // The rest should all be whitespace - while (yych != '\0' && isspace(yych)) { yych = *++YYCURSOR; } + while (yych != '\0' && isspace((unsigned char)yych)) { yych = *++YYCURSOR; } return yych == '\0'; } From 0111ec451a3a3d67055d67c9b3de6fa3d8814f31 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 14 Nov 2016 15:52:49 +0100 Subject: [PATCH 3/3] Revert "Fixed: A_SetInventory with an amount of 0 was not truly eliminating the actor." This reverts commit 02435b46a0af7287a542a0887ec7ac7aa828f742. --- src/p_actionfunctions.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index b9cfd7fe0e..73cade49a4 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -2665,12 +2665,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetInventory) } else if (amount <= 0) { - // Remove it all. - if (item) - { - item->DepleteOrDestroy(); - res = true; - } + //Remove it all. + res = (mobj->TakeInventory(itemtype, item->Amount, true, false)); ACTION_RETURN_BOOL(res); } else if (amount < item->Amount)