mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- fixed some places where FStrings were incorrectly used.
- replace all implicit conversions from FString to const char * in the header files (so that it can be test compiled with the implicit type conversion turned off without throwing thousands of identical errors.)
This commit is contained in:
parent
c8d25378d5
commit
8da6483223
10 changed files with 19 additions and 19 deletions
|
@ -69,7 +69,7 @@ public:
|
|||
|
||||
const char *GetBind(unsigned int index) const
|
||||
{
|
||||
if (index < NUM_KEYS) return Binds[index];
|
||||
if (index < NUM_KEYS) return Binds[index].GetChars();
|
||||
else return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1203,11 +1203,11 @@ static int DumpHash (FConsoleCommand **table, bool aliases, const char *pattern=
|
|||
|
||||
void FConsoleAlias::PrintAlias ()
|
||||
{
|
||||
if (m_Command[0])
|
||||
if (m_Command[0].IsNotEmpty())
|
||||
{
|
||||
Printf (TEXTCOLOR_YELLOW "%s : %s\n", m_Name, m_Command[0].GetChars());
|
||||
}
|
||||
if (m_Command[1])
|
||||
if (m_Command[1].IsNotEmpty())
|
||||
{
|
||||
Printf (TEXTCOLOR_ORANGE "%s : %s\n", m_Name, m_Command[1].GetChars());
|
||||
}
|
||||
|
|
|
@ -925,7 +925,7 @@ void WriteUserInfo(FArchive &arc, userinfo_t &info)
|
|||
|
||||
case NAME_PlayerClass:
|
||||
i = info.GetPlayerClassNum();
|
||||
arc.WriteString(i == -1 ? "Random" : PlayerClasses[i].Type->DisplayName);
|
||||
arc.WriteString(i == -1 ? "Random" : PlayerClasses[i].Type->DisplayName.GetChars());
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -1411,7 +1411,7 @@ void DBaseStatusBar::DrawLog ()
|
|||
{
|
||||
int hudwidth, hudheight;
|
||||
|
||||
if (CPlayer->LogText && *CPlayer->LogText)
|
||||
if (CPlayer->LogText.IsNotEmpty())
|
||||
{
|
||||
// This uses the same scaling as regular HUD messages
|
||||
switch (con_scaletext)
|
||||
|
|
|
@ -504,7 +504,7 @@ public:
|
|||
|
||||
int Draw(FOptionMenuDescriptor *desc, int y, int indent, bool selected)
|
||||
{
|
||||
const char *txt = mCurrent? (const char*)mAltText : mLabel;
|
||||
const char *txt = mCurrent? mAltText.GetChars() : mLabel;
|
||||
if (*txt == '$') txt = GStrings(txt + 1);
|
||||
int w = SmallFont->StringWidth(txt) * CleanXfac_1;
|
||||
int x = (screen->GetWidth() - w) / 2;
|
||||
|
|
|
@ -1189,7 +1189,7 @@ const char *APlayerPawn::GetSoundClass() const
|
|||
|
||||
// [GRB]
|
||||
PClassPlayerPawn *pclass = GetClass();
|
||||
return pclass->SoundClass.IsNotEmpty() ? pclass->SoundClass : "player";
|
||||
return pclass->SoundClass.IsNotEmpty() ? pclass->SoundClass.GetChars() : "player";
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -151,8 +151,8 @@ struct FUDMFKey
|
|||
FUDMFKey& operator =(const FString &val)
|
||||
{
|
||||
Type = UDMF_String;
|
||||
IntVal = strtol(val, NULL, 0);
|
||||
FloatVal = strtod(val, NULL);
|
||||
IntVal = strtol(val.GetChars(), NULL, 0);
|
||||
FloatVal = strtod(val.GetChars(), NULL);
|
||||
StringVal = val;
|
||||
return *this;
|
||||
}
|
||||
|
|
|
@ -415,7 +415,7 @@ void S_Start ()
|
|||
// Parse the global SNDINFO
|
||||
S_ParseSndInfo(true);
|
||||
|
||||
if (*LocalSndInfo)
|
||||
if (LocalSndInfo.IsNotEmpty())
|
||||
{
|
||||
// Now parse the local SNDINFO
|
||||
int j = Wads.CheckNumForFullName(LocalSndInfo, true);
|
||||
|
@ -432,7 +432,7 @@ void S_Start ()
|
|||
|
||||
if (parse_ss)
|
||||
{
|
||||
S_ParseSndSeq(*LocalSndSeq? Wads.CheckNumForFullName(LocalSndSeq, true) : -1);
|
||||
S_ParseSndSeq(LocalSndSeq.IsNotEmpty()? Wads.CheckNumForFullName(LocalSndSeq, true) : -1);
|
||||
}
|
||||
|
||||
LastLocalSndInfo = LocalSndInfo;
|
||||
|
@ -2553,7 +2553,7 @@ int S_GetMusic (char **name)
|
|||
{
|
||||
int order;
|
||||
|
||||
if (mus_playing.name)
|
||||
if (mus_playing.name.IsNotEmpty())
|
||||
{
|
||||
*name = copystring (mus_playing.name);
|
||||
order = mus_playing.baseorder;
|
||||
|
|
|
@ -102,7 +102,7 @@ public:
|
|||
}
|
||||
FSoundID(const FString &name)
|
||||
{
|
||||
ID = S_FindSound(name);
|
||||
ID = S_FindSound(name.GetChars());
|
||||
}
|
||||
FSoundID(const FSoundID &other)
|
||||
{
|
||||
|
@ -120,7 +120,7 @@ public:
|
|||
}
|
||||
FSoundID &operator=(const FString &name)
|
||||
{
|
||||
ID = S_FindSound(name);
|
||||
ID = S_FindSound(name.GetChars());
|
||||
return *this;
|
||||
}
|
||||
operator int() const
|
||||
|
|
|
@ -343,16 +343,16 @@ namespace StringFormat
|
|||
|
||||
// FName inline implementations that take FString parameters
|
||||
|
||||
inline FName::FName(const FString &text) { Index = NameData.FindName (text, text.Len(), false); }
|
||||
inline FName::FName(const FString &text, bool noCreate) { Index = NameData.FindName (text, text.Len(), noCreate); }
|
||||
inline FName &FName::operator = (const FString &text) { Index = NameData.FindName (text, text.Len(), false); return *this; }
|
||||
inline FName &FNameNoInit::operator = (const FString &text) { Index = NameData.FindName (text, text.Len(), false); return *this; }
|
||||
inline FName::FName(const FString &text) { Index = NameData.FindName (text.GetChars(), text.Len(), false); }
|
||||
inline FName::FName(const FString &text, bool noCreate) { Index = NameData.FindName (text.GetChars(), text.Len(), noCreate); }
|
||||
inline FName &FName::operator = (const FString &text) { Index = NameData.FindName (text.GetChars(), text.Len(), false); return *this; }
|
||||
inline FName &FNameNoInit::operator = (const FString &text) { Index = NameData.FindName (text.GetChars(), text.Len(), false); return *this; }
|
||||
|
||||
// Hash FStrings on their contents. (used by TMap)
|
||||
extern unsigned int SuperFastHash (const char *data, size_t len);
|
||||
template<> struct THashTraits<FString>
|
||||
{
|
||||
hash_t Hash(const FString &key) { return (hash_t)SuperFastHash(key, key.Len()); }
|
||||
hash_t Hash(const FString &key) { return (hash_t)SuperFastHash(key.GetChars(), key.Len()); }
|
||||
// Compares two keys, returning zero if they are the same.
|
||||
int Compare(const FString &left, const FString &right) { return left.Compare(right); }
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue