From b8ef35535e81b8beca2cf0b8ac3b374efe081105 Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Fri, 13 Nov 2020 01:08:44 +0100 Subject: [PATCH] Attempt(?) to fix the library duplication bug. --- language.version | 2 +- zscript/swwm_handler.zsc | 4 ++-- zscript/swwm_thinkers.zsc | 44 ++++++++++++++++++++++++++------------- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/language.version b/language.version index 19d2caf09..f9524b9a8 100644 --- a/language.version +++ b/language.version @@ -1,2 +1,2 @@ [default] -SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r614 \cu(Thu 12 Nov 19:18:41 CET 2020)"; +SWWM_MODVER="\chSWWM \czGZ\c- \cw0.9.11b-pre r615 \cu(Fri 13 Nov 01:08:44 CET 2020)"; diff --git a/zscript/swwm_handler.zsc b/zscript/swwm_handler.zsc index 65c2f7e67..01a5ecc95 100644 --- a/zscript/swwm_handler.zsc +++ b/zscript/swwm_handler.zsc @@ -857,7 +857,7 @@ Class SWWMHandler : EventHandler l.ChangeStatNum(Thinker.STAT_STATIC); l.myplayer = p; } - // horrendous piece of shit bandaid fix because gzdoom gets on my fucking nerves with its inconsistency bullshit when traveling between levels + // horrendous piece of shit bandaid fix because gzdoom gets on my fucking nerves with its inconsistency bullshit let ti = ThinkerIterator.Create("SWWMLoreLibrary",Thinker.STAT_STATIC); SWWMLoreLibrary l2; bool bmesg = false; @@ -866,7 +866,7 @@ Class SWWMHandler : EventHandler if ( (l2 == l) || (l2.myplayer != p) ) continue; if ( !bmesg ) { - Console.Printf("If this message appears, something broke the mod really badly and should be reported."); + Console.Printf("If these messages appear, something broke and should be reported."); bmesg = true; } // merge excess libraries (if it ever happens) diff --git a/zscript/swwm_thinkers.zsc b/zscript/swwm_thinkers.zsc index e234d57a7..6628174eb 100644 --- a/zscript/swwm_thinkers.zsc +++ b/zscript/swwm_thinkers.zsc @@ -334,7 +334,7 @@ Class SWWMLoreLibrary : Thinker Array ent; int lastaddtic; - bool DirectAdd( String ref ) + static bool PreVerify( String ref ) { // restrictions if ( !(gameinfo.gametype&(GAME_Raven|GAME_Strife)) ) @@ -376,6 +376,33 @@ Class SWWMLoreLibrary : Thinker if ( (c.GetClassName() == ref) && !(gameinfo.gametype&def.avail) ) return true; } + ref = ref.MakeUpper(); + String tag = String.Format("SWWM_LORETAG_%s",ref); + String tab = String.Format("SWWM_LORETAB_%s",ref); + String text = String.Format("SWWM_LORETXT_%s",ref); + // check that it's valid + if ( StringTable.Localize(tag,false) == tag ) return true; + if ( StringTable.Localize(tab,false) == tab ) + { + Console.Printf("Entry \"%s\" defines no tab.",ref); + return true; + } + if ( StringTable.Localize(text,false) == text ) + { + Console.Printf("Entry \"%s\" defines no text.",ref); + return true; + } + return false; + } + + bool DirectAdd( String ref ) + { + if ( PreVerify(ref) ) return true; + return InternalAdd(ref); + } + + private bool InternalAdd( String ref ) + { ref = ref.MakeUpper(); String tag = String.Format("SWWM_LORETAG_%s",ref); String tab = String.Format("SWWM_LORETAB_%s",ref); @@ -437,18 +464,6 @@ Class SWWMLoreLibrary : Thinker else if ( text ~== "SWWM_LORETXT_GODS" ) text = "SWWM_LORETXT_GODS2"; // beyond gods } - // check that it's valid - if ( StringTable.Localize(tag,false) == tag ) return false; - if ( StringTable.Localize(tab,false) == tab ) - { - Console.Printf("Entry \"%s\" defines no tab.",ref); - return false; - } - if ( StringTable.Localize(text,false) == text ) - { - Console.Printf("Entry \"%s\" defines no text.",ref); - return false; - } // check if existing for ( int i=0; i