From b8e392eaa5f4591e716843336802b989955845a0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 12 Jun 2016 11:43:40 +0200 Subject: [PATCH] - do not try to load empty BEHAVIOR lumps. These would otherwise print an error message but there's a lot of maps out there which only have an empty entry to mark the map as Hexen format. --- src/p_setup.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/p_setup.cpp b/src/p_setup.cpp index cdb180e60..cec39b93a 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -3329,14 +3329,17 @@ void P_LoadReject (MapData * map, bool junk) // // [RH] P_LoadBehavior // -void P_LoadBehavior (MapData * map) +void P_LoadBehavior(MapData * map) { - map->Seek(ML_BEHAVIOR); - FBehavior::StaticLoadModule (-1, map->file, map->Size(ML_BEHAVIOR)); - if (!FBehavior::StaticCheckAllGood ()) + if (map->Size(ML_BEHAVIOR) > 0) { - Printf ("ACS scripts unloaded.\n"); - FBehavior::StaticUnloadModules (); + map->Seek(ML_BEHAVIOR); + FBehavior::StaticLoadModule(-1, map->file, map->Size(ML_BEHAVIOR)); + } + if (!FBehavior::StaticCheckAllGood()) + { + Printf("ACS scripts unloaded.\n"); + FBehavior::StaticUnloadModules(); } }