Skip to content

Commit

Permalink
the remaining GetChars additions.
Browse files Browse the repository at this point in the history
The offending operator const char * no longer exists.
  • Loading branch information
coelckers committed Oct 7, 2023
1 parent 7a5a285 commit 6055ff0
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 55 deletions.
6 changes: 3 additions & 3 deletions src/common/audio/sound/s_reverbedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ void ExportEnvironments(const char *filename, uint32_t count, const ReverbContai
{
FString dest = M_GetDocumentsPath() + filename;

FileWriter *f = FileWriter::Open(dest);
FileWriter *f = FileWriter::Open(dest.GetChars());

if (f != nullptr)
{
Expand Down Expand Up @@ -509,13 +509,13 @@ CCMD(createenvironment)
{
if (S_FindEnvironment(reverbedit_name))
{
M_StartMessage(FStringf("An environment with the name '%s' already exists", *reverbedit_name), 1);
M_StartMessage(FStringf("An environment with the name '%s' already exists", *reverbedit_name).GetChars(), 1);
return;
}
int id = (reverbedit_id1 << 8) + reverbedit_id2;
if (S_FindEnvironment(id))
{
M_StartMessage(FStringf("An environment with the ID (%d, %d) already exists", *reverbedit_id1, *reverbedit_id2), 1);
M_StartMessage(FStringf("An environment with the ID (%d, %d) already exists", *reverbedit_id1, *reverbedit_id2).GetChars(), 1);
return;
}

Expand Down
20 changes: 10 additions & 10 deletions src/common/textures/texturemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ FTextureID FTextureManager::CheckForTexture (const char *name, ETextureType uset
auto tex = Textures[i].Texture;


if (stricmp (tex->GetName(), name) == 0 )
if (tex->GetName().CompareNoCase(name) == 0 )
{
// If we look for short names, we must ignore any long name texture.
if ((flags & TEXMAN_ShortNameOnly) && tex->isFullNameTexture())
Expand Down Expand Up @@ -306,7 +306,7 @@ int FTextureManager::ListTextures (const char *name, TArray<FTextureID> &list, b
{
auto tex = Textures[i].Texture;

if (stricmp (tex->GetName(), name) == 0)
if (tex->GetName().CompareNoCase(name) == 0)
{
auto texUseType = tex->GetUseType();
// NULL textures must be ignored.
Expand Down Expand Up @@ -422,7 +422,7 @@ FTextureID FTextureManager::AddGameTexture (FGameTexture *texture, bool addtohas
// Textures without name can't be looked for
if (addtohash && texture->GetName().IsNotEmpty())
{
bucket = int(MakeKey (texture->GetName()) % HASH_SIZE);
bucket = int(MakeKey (texture->GetName().GetChars()) % HASH_SIZE);
hash = HashFirst[bucket];
}
else
Expand Down Expand Up @@ -460,7 +460,7 @@ FTextureID FTextureManager::CreateTexture (int lumpnum, ETextureType usetype)
auto fn = fileSystem.GetFileFullName(lumpnum);
str = ExtractFileBase(fn);
}
auto out = MakeGameTexture(CreateTextureFromLump(lumpnum, usetype == ETextureType::Flat), str, usetype);
auto out = MakeGameTexture(CreateTextureFromLump(lumpnum, usetype == ETextureType::Flat), str.GetChars(), usetype);

if (out != NULL)
{
Expand Down Expand Up @@ -514,7 +514,7 @@ void FTextureManager::ReplaceTexture (FTextureID texid, FGameTexture *newtexture

auto oldtexture = Textures[index].Texture;

newtexture->SetName(oldtexture->GetName());
newtexture->SetName(oldtexture->GetName().GetChars());
newtexture->SetUseType(oldtexture->GetUseType());
Textures[index].Texture = newtexture;
newtexture->SetID(oldtexture->GetID());
Expand Down Expand Up @@ -793,15 +793,15 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build

if (lumpnum>=0)
{
auto newtex = MakeGameTexture(CreateTextureFromLump(lumpnum), src, ETextureType::Override);
auto newtex = MakeGameTexture(CreateTextureFromLump(lumpnum), src.GetChars(), ETextureType::Override);

if (newtex != NULL)
{
// Replace the entire texture and adjust the scaling and offset factors.
newtex->SetWorldPanning(true);
newtex->SetDisplaySize((float)width, (float)height);

FTextureID oldtex = TexMan.CheckForTexture(src, ETextureType::MiscPatch);
FTextureID oldtex = TexMan.CheckForTexture(src.GetChars(), ETextureType::MiscPatch);
if (oldtex.isValid())
{
ReplaceTexture(oldtex, newtex, true);
Expand Down Expand Up @@ -1127,8 +1127,8 @@ void FTextureManager::AddLocalizedVariants()
}
if (tokens.Size() >= 2)
{
FString base = ExtractFileBase(tokens[0]);
FTextureID origTex = CheckForTexture(base, ETextureType::MiscPatch);
FString base = ExtractFileBase(tokens[0].GetChars());
FTextureID origTex = CheckForTexture(base.GetChars(), ETextureType::MiscPatch);
if (origTex.isValid())
{
FTextureID tex = CheckForTexture(entry.name, ETextureType::MiscPatch);
Expand Down Expand Up @@ -1367,7 +1367,7 @@ FTextureID FTextureManager::GetFrontSkyLayer(FTextureID texid)
// But do not link the new texture into the hash chain!
auto itex = new FImageTexture(image);
itex->SetNoRemap0();
auto FrontSkyLayer = MakeGameTexture(itex, tex->GetName(), ETextureType::Wall);
auto FrontSkyLayer = MakeGameTexture(itex, tex->GetName().GetChars(), ETextureType::Wall);
FrontSkyLayer->SetUseType(tex->GetUseType());
texid = TexMan.AddGameTexture(FrontSkyLayer, false);
Textures[texidx].FrontSkyLayer = texid.GetIndex();
Expand Down
4 changes: 2 additions & 2 deletions src/common/utility/s_playlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ bool FPlayList::ChangeList (const char *path)
// For a .PLS file, skip anything that doesn't start with File[0-9]+=
if (pls)
{
if (strncmp(song, "File", 4) != 0)
if (strncmp(song.GetChars(), "File", 4) != 0)
{
continue;
}
Expand Down Expand Up @@ -205,5 +205,5 @@ const char *FPlayList::GetSong (int position) const
if ((unsigned)position >= Songs.Size())
return NULL;

return Songs[position];
return Songs[position].GetChars();
}
2 changes: 0 additions & 2 deletions src/common/utility/zstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ class FString
explicit operator bool() = delete; // this is needed to render the operator const char * ineffective when used in boolean constructs.
bool operator !() = delete;

operator const char *() const { return Chars; }

const char *GetChars() const { return Chars; }

const char &operator[] (int index) const { return Chars[index]; }
Expand Down
2 changes: 1 addition & 1 deletion src/gamedata/teaminfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ bool FTeam::IsValidTeam (unsigned int uiTeam)

const char *FTeam::GetName () const
{
return m_Name;
return m_Name.GetChars();
}

//==========================================================================
Expand Down
8 changes: 4 additions & 4 deletions src/playsim/p_acs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8784,29 +8784,29 @@ int DLevelScript::RunScript()
{
default: // normal
alpha = (optstart < sp) ? ACSToFloat(Stack[optstart]) : 1.f;
msg = Create<DHUDMessage> (activefont, work, x, y, hudwidth, hudheight, color, holdTime);
msg = Create<DHUDMessage> (activefont, work.GetChars(), x, y, hudwidth, hudheight, color, holdTime);
break;
case 1: // fade out
{
float fadeTime = (optstart < sp) ? ACSToFloat(Stack[optstart]) : 0.5f;
alpha = (optstart < sp-1) ? ACSToFloat(Stack[optstart+1]) : 1.f;
msg = Create<DHUDMessageFadeOut> (activefont, work, x, y, hudwidth, hudheight, color, holdTime, fadeTime);
msg = Create<DHUDMessageFadeOut> (activefont, work.GetChars(), x, y, hudwidth, hudheight, color, holdTime, fadeTime);
}
break;
case 2: // type on, then fade out
{
float typeTime = (optstart < sp) ? ACSToFloat(Stack[optstart]) : 0.05f;
float fadeTime = (optstart < sp-1) ? ACSToFloat(Stack[optstart+1]) : 0.5f;
alpha = (optstart < sp-2) ? ACSToFloat(Stack[optstart+2]) : 1.f;
msg = Create<DHUDMessageTypeOnFadeOut> (activefont, work, x, y, hudwidth, hudheight, color, typeTime, holdTime, fadeTime);
msg = Create<DHUDMessageTypeOnFadeOut> (activefont, work.GetChars(), x, y, hudwidth, hudheight, color, typeTime, holdTime, fadeTime);
}
break;
case 3: // fade in, then fade out
{
float inTime = (optstart < sp) ? ACSToFloat(Stack[optstart]) : 0.5f;
float outTime = (optstart < sp-1) ? ACSToFloat(Stack[optstart+1]) : 0.5f;
alpha = (optstart < sp-2) ? ACSToFloat(Stack[optstart + 2]) : 1.f;
msg = Create<DHUDMessageFadeInOut> (activefont, work, x, y, hudwidth, hudheight, color, holdTime, inTime, outTime);
msg = Create<DHUDMessageFadeInOut> (activefont, work.GetChars(), x, y, hudwidth, hudheight, color, holdTime, inTime, outTime);
}
break;
}
Expand Down
16 changes: 8 additions & 8 deletions src/scripting/decorate/thingdef_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ static void ParseActorFlag (FScanner &sc, Baggage &bag, int mod)
sc.MustGetString ();
part2 = sc.String;
}
HandleActorFlag(sc, bag, part1, part2, mod);
HandleActorFlag(sc, bag, part1.GetChars(), part2, mod);
}

//==========================================================================
Expand Down Expand Up @@ -722,12 +722,12 @@ static bool ParsePropertyParams(FScanner &sc, FPropertyInfo *prop, AActor *defau

case 'S':
sc.MustGetString();
conv.s = strings[strings.Reserve(1)] = sc.String;
conv.s = (strings[strings.Reserve(1)] = sc.String).GetChars();
break;

case 'T':
sc.MustGetString();
conv.s = strings[strings.Reserve(1)] = strbin1(sc.String);
conv.s = (strings[strings.Reserve(1)] = strbin1(sc.String)).GetChars();
break;

case 'C':
Expand All @@ -747,7 +747,7 @@ static bool ParsePropertyParams(FScanner &sc, FPropertyInfo *prop, AActor *defau
else
{
sc.MustGetString ();
conv.s = strings[strings.Reserve(1)] = sc.String;
conv.s = (strings[strings.Reserve(1)] = sc.String).GetChars();
pref.i = 1;
}
break;
Expand Down Expand Up @@ -775,7 +775,7 @@ static bool ParsePropertyParams(FScanner &sc, FPropertyInfo *prop, AActor *defau
do
{
sc.MustGetString ();
conv.s = strings[strings.Reserve(1)] = sc.String;
conv.s = (strings[strings.Reserve(1)] = sc.String).GetChars();
params.Push(conv);
params[0].i++;
}
Expand Down Expand Up @@ -961,7 +961,7 @@ static void ParseActorProperty(FScanner &sc, Baggage &bag)
sc.UnGet ();
}

FPropertyInfo *prop = FindProperty(propname);
FPropertyInfo *prop = FindProperty(propname.GetChars());

if (prop != NULL)
{
Expand All @@ -976,9 +976,9 @@ static void ParseActorProperty(FScanner &sc, Baggage &bag)
FScriptPosition::ErrorCounter++;
}
}
else if (MatchString(propname, statenames) != -1)
else if (MatchString(propname.GetChars(), statenames) != -1)
{
bag.statedef.SetStateLabel(propname, CheckState (sc, bag.Info));
bag.statedef.SetStateLabel(propname.GetChars(), CheckState (sc, bag.Info));
}
else
{
Expand Down
8 changes: 4 additions & 4 deletions src/scripting/decorate/thingdef_states.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void ParseStates(FScanner &sc, PClassActor * actor, AActor * defaults, Baggage &
statestring += '+';
statestring += sc.String;
}
if (!bag.statedef.SetGotoLabel(statestring))
if (!bag.statedef.SetGotoLabel(statestring.GetChars()))
{
sc.ScriptError("GOTO before first state");
}
Expand Down Expand Up @@ -207,7 +207,7 @@ void ParseStates(FScanner &sc, PClassActor * actor, AActor * defaults, Baggage &
{
do
{
bag.statedef.AddStateLabel(statestring);
bag.statedef.AddStateLabel(statestring.GetChars());
statestring = ParseStateString(sc);
if (!statestring.CompareNoCase("GOTO"))
{
Expand All @@ -230,7 +230,7 @@ void ParseStates(FScanner &sc, PClassActor * actor, AActor * defaults, Baggage &
}

scp = sc;
state.sprite = GetSpriteIndex(statestring);
state.sprite = GetSpriteIndex(statestring.GetChars());
state.Misc1 = state.Misc2 = 0;
sc.MustGetString();
statestring = sc.String;
Expand Down Expand Up @@ -334,7 +334,7 @@ void ParseStates(FScanner &sc, PClassActor * actor, AActor * defaults, Baggage &
auto funcsym = CreateAnonymousFunction(actor->VMType, nullptr, state.UseFlags);
state.ActionFunc = FunctionBuildList.AddFunction(bag.Namespace, bag.Version, funcsym, ScriptCode, FStringf("%s.StateFunction.%d", actor->TypeName.GetChars(), bag.statedef.GetStateCount()), true, bag.statedef.GetStateCount(), int(statestring.Len()), sc.LumpNum);
}
int count = bag.statedef.AddStates(&state, statestring, scp);
int count = bag.statedef.AddStates(&state, statestring.GetChars(), scp);
if (count < 0)
{
sc.ScriptError("Invalid frame character string '%s'", statestring.GetChars());
Expand Down
12 changes: 6 additions & 6 deletions src/scripting/thingdef_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,18 @@ bool ModActorFlag(AActor *actor, const FString &flagname, bool set, bool printer
if (actor != NULL)
{
auto Level = actor->Level;
const char *dot = strchr(flagname, '.');
const char *dot = strchr(flagname.GetChars(), '.');
FFlagDef *fd;
PClassActor *cls = actor->GetClass();

if (dot != NULL)
{
FString part1(flagname.GetChars(), dot - flagname);
fd = FindFlag(cls, part1, dot + 1);
FString part1(flagname.GetChars(), dot - flagname.GetChars());
fd = FindFlag(cls, part1.GetChars(), dot + 1);
}
else
{
fd = FindFlag(cls, flagname, NULL);
fd = FindFlag(cls, flagname.GetChars(), NULL);
}

if (fd != NULL)
Expand Down Expand Up @@ -245,7 +245,7 @@ INTBOOL CheckActorFlag(AActor *owner, const char *flagname, bool printerror)
if (dot != NULL)
{
FString part1(flagname, dot-flagname);
fd = FindFlag (cls, part1, dot+1);
fd = FindFlag (cls, part1.GetChars(), dot+1);
}
else
{
Expand Down Expand Up @@ -1377,7 +1377,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(powerup, type, S, PowerupGiver)
{
FString st;
st.Format("%s%s", strnicmp(str, "power", 5) ? "Power" : "", str);
cls = FindClassTentative(st, pow);
cls = FindClassTentative(st.GetChars(), pow);
}
else
{
Expand Down
Loading

0 comments on commit 6055ff0

Please sign in to comment.