Asserts for some hard-to-detect bugs.

This commit is contained in:
Mari the Deer 2022-04-17 13:27:37 +02:00
commit 60457f779e
6 changed files with 33 additions and 10 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r34 \cu(Sun 17 Apr 02:23:29 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.3pre r34 \cu(2022-04-17 02:23:29)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r35 \cu(Sun 17 Apr 13:27:37 CEST 2022)\c-";
SWWM_SHORTVER="\cw1.3pre r35 \cu(2022-04-17 13:27:37)\c-";

View file

@ -1,5 +1,5 @@
// Custom intermission screens
Class SWWMStatScreenData : Thinker
Class SWWMStatScreenData : SWWMStaticThinker
{
// to prevent repetition
Array<int> lasttip, lastart;

View file

@ -407,6 +407,9 @@ Class Demolitionist : PlayerPawn
}
oldsinglefirst = swwm_singlefirst; // super already sets up the slots, so save the cvar value now
mystats = SWWMStats.Find(player);
// sanity checks
if ( !EventHandler.Find("SWWMHandler") || !StaticEventHandler.Find("SWWMStaticHandler") )
ThrowAbortException("Panic! SWWM event handlers not detected!");
}
void A_Dash()
{

View file

@ -1,7 +1,7 @@
// Static handler responsible for some special stuff
// save version holder
Class SWWMSaveVerData : Thinker
Class SWWMSaveVerData : SWWMStaticThinker
{
String ver;
}
@ -22,6 +22,8 @@ Class SWWMStaticHandler : StaticEventHandler
bool titlefirst;
// warnings
bool mpwarned;
// checks
ThinkerIterator sti;
override void NewGame()
{
@ -47,6 +49,17 @@ Class SWWMStaticHandler : StaticEventHandler
Console.Printf("\cgWARNING:\c- Multiplayer is no longer officially supported, desyncs and other issues may potentially happen. You are on your own.");
S_StartSound("compat/warn",CHAN_YOUDONEFUCKEDUP,CHANF_UI|CHANF_NOPAUSE|CHANF_OVERLAP,1,ATTN_NONE);
}
// sanity check
Array<Thinker> stinkers;
if ( !sti ) sti = ThinkerIterator.Create("SWWMStaticThinker");
else sti.Reinit();
Thinker t;
while ( t = sti.Next() ) stinkers.Push(t);
if ( stinkers.Size() > 0 )
{
for ( int i=0; i<stinkers.Size(); i++ ) Console.Printf("%s is not STAT_STATIC!",stinkers[i].GetClassName());
ThrowAbortException("Panic! %d static thinker%s been tampered with!",stinkers.Size(),(stinkers.Size()==1)?" has":"s have");
}
}
override void WorldLoaded( WorldEvent e )

View file

@ -300,7 +300,7 @@ Class LIEntry
Color mapcolor;
}
Class SWWMCachedLockInfo : Thinker
Class SWWMCachedLockInfo : SWWMStaticThinker
{
Array<LIEntry> ent;

View file

@ -1,8 +1,15 @@
// player-specific thinkers
Class SWWMStaticThinker : Thinker abstract
{
// shell class to iterate easier on sanity checks
// all subclasses should be guaranteed to have a statnum of STAT_STATIC
// if they don't, something is very wrong
}
// "Full History" contains all messages since session start, nothing is flushed
// this can be accessed from a section of the knowledge base
Class SWWMFullHistory : Thinker
Class SWWMFullHistory : SWWMStaticThinker
{
String lastmap;
Array<MsgLine> msg;
@ -40,7 +47,7 @@ Class SWWMFullHistory : Thinker
}
// Dedicated mission log (for custom maps)
Class SWWMMissionLog : Thinker
Class SWWMMissionLog : SWWMStaticThinker
{
Array<String> entries;
bool clockset;
@ -107,7 +114,7 @@ Class LevelStat
int time, par, suck;
}
Class SWWMStats : Thinker
Class SWWMStats : SWWMStaticThinker
{
PlayerInfo myplayer;
int lastspawn, dashcount, boostcount, stompcount, airtime, kills,
@ -290,7 +297,7 @@ Class SWWMStats : Thinker
}
// Scoring
Class SWWMCredits : Thinker
Class SWWMCredits : SWWMStaticThinker
{
PlayerInfo myplayer;
int credits;
@ -368,7 +375,7 @@ Class SWWMLore
bool read;
}
Class SWWMLoreLibrary : Thinker
Class SWWMLoreLibrary : SWWMStaticThinker
{
PlayerInfo myplayer;
Array<SWWMLore> ent;