- deprecated the global 'level' variable.

This will currently output 9 warnings for the UDMF property getters. To silence these a bit more work is needed.
This commit is contained in:
Christoph Oelckers 2019-01-27 14:33:02 +01:00
parent e9954ee018
commit 84baa5bb4d
3 changed files with 17 additions and 2 deletions

View file

@ -6132,10 +6132,22 @@ FxExpression *FxIdentifier::Resolve(FCompileContext& ctx)
{
if (sym->mVersion <= ctx.Version)
{
ScriptPosition.Message(MSG_WARNING, "Accessing deprecated global variable %s - deprecated since %d.%d.%d", sym->SymbolName.GetChars(), vsym->mVersion.major, vsym->mVersion.minor, vsym->mVersion.revision);
if (!(ctx.Function->Variants[0].Flags & VARF_Deprecated) && Wads.GetLumpFile(ctx.Lump) == 0)
{
ScriptPosition.Message(MSG_WARNING, "Accessing deprecated global variable %s - deprecated since %d.%d.%d", sym->SymbolName.GetChars(), vsym->mVersion.major, vsym->mVersion.minor, vsym->mVersion.revision);
}
else
{
// Allow use of deprecated symbols in deprecated functions of the internal code. This is meant to allow deprecated code to remain as it was,
// even if it depends on some deprecated symbol.
// The main motivation here is to keep the deprecated static functions accessing the global level variable as they were.
// Print these only if debug output is active and at the highest verbosity level.
ScriptPosition.Message(MSG_DEBUGMSG, TEXTCOLOR_BLUE "Accessing deprecated global variable %s - deprecated since %d.%d.%d", sym->SymbolName.GetChars(), vsym->mVersion.major, vsym->mVersion.minor, vsym->mVersion.revision);
}
}
}
newex = new FxGlobalVariable(static_cast<PField *>(sym), ScriptPosition);
goto foundit;
}

View file

@ -1681,6 +1681,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(APlayerPawn, GetPrintableDisplayName, GetPrintable
DEFINE_FIELD(DThinker, Level)
DEFINE_FIELD(AActor, snext)
DEFINE_FIELD(AActor, player)
DEFINE_FIELD_NAMED(AActor, __Pos, pos)

View file

@ -7,7 +7,7 @@ struct _ native // These are the global variables, the struct is only here to av
native readonly Array<@Team> Teams;
native int validcount;
native readonly bool multiplayer;
native play @LevelLocals level;
deprecated("3.8") native play @LevelLocals level;
native @KeyBindings Bindings;
native @KeyBindings AutomapBindings;
native play @DehInfo deh;
@ -462,6 +462,8 @@ class Thinker : Object native play
const TICRATE = 35;
native LevelLocals Level;
virtual native void Tick();
virtual native void PostBeginPlay();
native void ChangeStatNum(int stat);