Attempt(?) to fix the library duplication bug.
This commit is contained in:
parent
ca4d765aa5
commit
b8ef35535e
3 changed files with 33 additions and 17 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ Class SWWMLoreLibrary : Thinker
|
|||
Array<SWWMLore> 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<ent.Size(); i++ )
|
||||
{
|
||||
|
|
@ -489,6 +504,7 @@ Class SWWMLoreLibrary : Thinker
|
|||
|
||||
static void Add( PlayerInfo p, String ref )
|
||||
{
|
||||
if ( PreVerify(ref) ) return;
|
||||
SWWMLoreLibrary ll = Find(p);
|
||||
if ( !ll )
|
||||
{
|
||||
|
|
@ -496,7 +512,7 @@ Class SWWMLoreLibrary : Thinker
|
|||
ll.ChangeStatNum(STAT_STATIC);
|
||||
ll.myplayer = p;
|
||||
}
|
||||
ll.DirectAdd(ref);
|
||||
ll.InternalAdd(ref);
|
||||
}
|
||||
|
||||
void MarkRead( int idx )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue