- removed all Doom specific dependencies from cmdlib.cpp/h.
This meant moving CleanseString and ParseHex elsewhere and removing the I_Error call from ScanDirectory.
This commit is contained in:
parent
38fec546a7
commit
3cfda930ea
10 changed files with 100 additions and 106 deletions
|
|
@ -1259,4 +1259,37 @@ void FScriptPosition::Message (int severity, const char *message, ...) const
|
|||
color, type, FileName.GetChars(), ScriptLine, color, composed.GetChars());
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// ParseHex
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
int ParseHex(const char* hex, FScriptPosition* sc)
|
||||
{
|
||||
const char* str;
|
||||
int num;
|
||||
|
||||
num = 0;
|
||||
str = hex;
|
||||
|
||||
while (*str)
|
||||
{
|
||||
num <<= 4;
|
||||
if (*str >= '0' && *str <= '9')
|
||||
num += *str - '0';
|
||||
else if (*str >= 'a' && *str <= 'f')
|
||||
num += 10 + *str - 'a';
|
||||
else if (*str >= 'A' && *str <= 'F')
|
||||
num += 10 + *str - 'A';
|
||||
else {
|
||||
sc->Message(MSG_WARNING, "Bad hex number: %s", hex);
|
||||
return 0;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue