From 56427d1b1cd9c9cc6333cf57d40824aac02c4ab4 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 13 Jul 2006 02:08:39 +0000 Subject: [PATCH] - Fixed: The game would crash after informing you of a duplicate class registration because PClass::CreateDerivedClass() did not initialize everything before calling InsertIntoHash(). - Fixed: Forcefully removing a weapon from a player's inventory would not reset the player's refire counter. - Fixed: FreeKeySections() was called before M_SaveDefaults() during shutdown, so all custom keys would go to a "(null)" section instead of their intended section. SVN r248 (trunk) --- docs/rh-log.txt | 10 ++++++++++ src/dobjtype.cpp | 7 ++----- src/m_misc.cpp | 3 +++ src/m_options.cpp | 4 ++-- src/p_user.cpp | 3 ++- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index fa4ed9a74..00e20695d 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,13 @@ +July 12, 2006 +- Fixed: The game would crash after informing you of a duplicate class registration + because PClass::CreateDerivedClass() did not initialize everything before calling + InsertIntoHash(). +- Fixed: Forcefully removing a weapon from a player's inventory would not reset + the player's refire counter. +- Fixed: FreeKeySections() was called before M_SaveDefaults() during shutdown, + so all custom keys would go to a "(null)" section instead of their intended + section. + July 11, 2006 - Restored the previous level flag values to avoid needlessly breaking some savegames at this point in time. diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index f4b6b138f..dfc05963a 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -187,7 +187,6 @@ PClass *PClass::CreateDerivedClass (FName name, unsigned int size) type->Pointers = NULL; type->ConstructNative = ConstructNative; type->ClassIndex = m_Types.Push (type); - type->InsertIntoHash(); type->Meta = Meta; type->Defaults = new BYTE[size]; memcpy (type->Defaults, Defaults, Size); @@ -197,6 +196,8 @@ PClass *PClass::CreateDerivedClass (FName name, unsigned int size) } type->FlatPointers = NULL; type->bRuntimeClass = true; + type->ActorInfo = NULL; + type->InsertIntoHash(); // If this class has an actor info, then any classes derived from it // also need an actor info. @@ -212,10 +213,6 @@ PClass *PClass::CreateDerivedClass (FName name, unsigned int size) info->Replacement = NULL; m_RuntimeActors.Push (type); } - else - { - type->ActorInfo = NULL; - } return type; } diff --git a/src/m_misc.cpp b/src/m_misc.cpp index cf0cb519c..2a6e6c9e3 100644 --- a/src/m_misc.cpp +++ b/src/m_misc.cpp @@ -81,6 +81,8 @@ CVAR(Bool, screenshot_quiet, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG); CVAR(String, screenshot_type, "png", CVAR_ARCHIVE|CVAR_GLOBALCONFIG); CVAR(String, screenshot_dir, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG); +extern void FreeKeySections(); + static long ParseCommandLine (const char *args, int *argc, char **argv); // @@ -358,6 +360,7 @@ void M_LoadDefaults () { GameConfig = new FGameConfigFile; GameConfig->DoGlobalSetup (); + atterm (FreeKeySections); atterm (M_SaveDefaults); } diff --git a/src/m_options.cpp b/src/m_options.cpp index 68f1562e1..178c40b49 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -2938,6 +2938,7 @@ void M_SaveCustomKeys (FConfigFile *config, char *section, char *subsection) if (item->type == whitetext) { + assert (item->e.command != NULL); sprintf (subsection, "%s.Bindings", item->e.command); M_DoSaveKeys (config, section, (int)i, false); sprintf (subsection, "%s.DoubleBindings", item->e.command); @@ -2952,7 +2953,7 @@ void M_SaveCustomKeys (FConfigFile *config, char *section, char *subsection) static int AddKeySpot; -static void FreeKeySections() +void FreeKeySections() { const unsigned int numStdControls = countof(ControlsItems); unsigned int i; @@ -3008,7 +3009,6 @@ CCMD (addkeysection) } } - atterm (FreeKeySections); if (i == last) { // Add the new section // Limit the ini name to 32 chars diff --git a/src/p_user.cpp b/src/p_user.cpp index ac3244244..852053a16 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -330,9 +330,10 @@ void APlayerPawn::RemoveInventory (AInventory *item) } if (item == player->ReadyWeapon) { - // If the current weapon is removed, pick a new one. + // If the current weapon is removed, clear the refire counter and pick a new one. pickWeap = true; player->ReadyWeapon = NULL; + player->refire = 0; } } Super::RemoveInventory (item);