- consolidated the 'music' parsing in Defs (pending a refactor of the MAPINFO system.)

- removed the remaining parts of the game Defs parser because we do not want anything EDuke in here.
This commit is contained in:
Christoph Oelckers 2020-06-24 00:40:22 +02:00
parent 4b743b4063
commit e146e73345
14 changed files with 207 additions and 629 deletions

View file

@ -953,12 +953,22 @@ bool FScanner::ScanValue(bool allowfloat)
return false;
}
}
if (TokenType != TK_IntConst && (TokenType != TK_FloatConst || !allowfloat))
{
if (TokenType == TK_FloatConst && !allowfloat)
return false;
if (TokenType != TK_IntConst && TokenType != TK_FloatConst)
{
auto d = constants.CheckKey(String);
if (!d) return false;
if (!allowfloat && int64_t(*d) != *d) return false;
BigNumber = *d;
Number = *d;
Float = *d;
}
if (neg)
{
BigNumber = -BigNumber;
Number = -Number;
Float = -Float;
}

View file

@ -2,6 +2,7 @@
#define __SC_MAN_H__
#include "zstring.h"
#include "tarray.h"
#include "name.h"
#include "basics.h"
@ -97,6 +98,11 @@ public:
bool GetFloat();
void MustGetFloat();
bool CheckFloat();
double *LookupConstant(FName name)
{
return constants.CheckKey(name);
}
// Token based variant
bool CheckValue(bool allowfloat);
@ -137,6 +143,8 @@ protected:
// Strings longer than this minus one will be dynamically allocated.
static const int MAX_STRING_SIZE = 128;
TMap<FName, double> constants;
bool ScriptOpen;
FString ScriptBuffer;
const char *ScriptPtr;