the remaining GetChars additions.

The offending operator const char * no longer exists.
This commit is contained in:
Christoph Oelckers 2023-10-07 23:44:01 +02:00
parent 7a5a2858a2
commit 6055ff029d
11 changed files with 53 additions and 55 deletions

View file

@ -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)
{
@ -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;
}

View file

@ -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())
@ -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.
@ -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
@ -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)
{
@ -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());
@ -793,7 +793,7 @@ 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)
{
@ -801,7 +801,7 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build
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);
@ -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);
@ -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();

View file

@ -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;
}
@ -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();
}

View file

@ -163,8 +163,6 @@ public:
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]; }

View file

@ -260,7 +260,7 @@ bool FTeam::IsValidTeam (unsigned int uiTeam)
const char *FTeam::GetName () const
{
return m_Name;
return m_Name.GetChars();
}
//==========================================================================

View file

@ -8784,13 +8784,13 @@ scriptwait:
{
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
@ -8798,7 +8798,7 @@ scriptwait:
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
@ -8806,7 +8806,7 @@ scriptwait:
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;
}

View file

@ -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);
}
//==========================================================================
@ -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':
@ -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;
@ -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++;
}
@ -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)
{
@ -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
{

View file

@ -170,7 +170,7 @@ do_goto:
statestring += '+';
statestring += sc.String;
}
if (!bag.statedef.SetGotoLabel(statestring))
if (!bag.statedef.SetGotoLabel(statestring.GetChars()))
{
sc.ScriptError("GOTO before first state");
}
@ -207,7 +207,7 @@ do_stop:
{
do
{
bag.statedef.AddStateLabel(statestring);
bag.statedef.AddStateLabel(statestring.GetChars());
statestring = ParseStateString(sc);
if (!statestring.CompareNoCase("GOTO"))
{
@ -230,7 +230,7 @@ do_stop:
}
scp = sc;
state.sprite = GetSpriteIndex(statestring);
state.sprite = GetSpriteIndex(statestring.GetChars());
state.Misc1 = state.Misc2 = 0;
sc.MustGetString();
statestring = sc.String;
@ -334,7 +334,7 @@ endofstate:
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());

View file

@ -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)
@ -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
{
@ -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
{

View file

@ -497,7 +497,7 @@ FSoundID S_AddPlayerSound (const char *pclass, int gender, FSoundID refid, int l
fakename += '"';
fakename += sfx->name.GetChars();
id = soundEngine->AddSoundLump (fakename, lumpnum, CurrentPitchMask);
id = soundEngine->AddSoundLump (fakename.GetChars(), lumpnum, CurrentPitchMask);
int classnum = S_AddPlayerClass (pclass);
int soundlist = S_AddPlayerGender (classnum, gender);
@ -791,8 +791,8 @@ static void S_AddSNDINFO (int lump)
int gender;
FSoundID refid, sfxnum;
S_ParsePlayerSoundCommon (sc, pclass, gender, refid);
sfxnum = S_AddPlayerSound (pclass, gender, refid, sc.String);
S_ParsePlayerSoundCommon(sc, pclass, gender, refid);
sfxnum = S_AddPlayerSound(pclass.GetChars(), gender, refid, sc.String);
if (0 == stricmp(sc.String, "dsempty"))
{
soundEngine->GetWritableSfx(sfxnum)->UserData[0] |= SND_PlayerSilent;
@ -813,7 +813,7 @@ static void S_AddSNDINFO (int lump)
{
sc.ScriptError("%s is not a player sound", sc.String);
}
S_DupPlayerSound (pclass, gender, refid, targid);
S_DupPlayerSound (pclass.GetChars(), gender, refid, targid);
}
break;
@ -826,7 +826,7 @@ static void S_AddSNDINFO (int lump)
S_ParsePlayerSoundCommon (sc, pclass, gender, refid);
sfxfrom = S_AddSound (sc.String, -1, &sc);
aliasto = S_LookupPlayerSound (pclass, gender, refid);
aliasto = S_LookupPlayerSound (pclass.GetChars(), gender, refid);
auto sfx = soundEngine->GetWritableSfx(sfxfrom);
sfx->link = aliasto;
sfx->UserData[0] |= SND_PlayerCompat;
@ -841,7 +841,7 @@ static void S_AddSNDINFO (int lump)
S_ParsePlayerSoundCommon (sc, pclass, gender, refid);
soundnum = soundEngine->FindSoundTentative (sc.String);
S_AddPlayerSoundExisting (pclass, gender, refid, soundnum);
S_AddPlayerSoundExisting (pclass.GetChars(), gender, refid, soundnum);
}
break;
@ -1124,7 +1124,7 @@ static void S_AddSNDINFO (int lump)
}
sc.MustGetString ();
S_AddSound (name, sc.String, &sc);
S_AddSound (name.GetChars(), sc.String, &sc);
}
}
}
@ -1226,7 +1226,7 @@ static int S_FindPlayerClass (const char *name)
for (i = 0; i < PlayerClassLookups.Size(); ++i)
{
if (stricmp (name, PlayerClassLookups[i].Name) == 0)
if (stricmp (name, PlayerClassLookups[i].Name.GetChars()) == 0)
{
return (int)i;
}
@ -1240,7 +1240,7 @@ static int S_FindPlayerClass (const char *name)
while (min <= max)
{
int mid = (min + max) / 2;
int lexx = stricmp (PlayerClassLookups[mid].Name, name);
int lexx = stricmp (PlayerClassLookups[mid].Name.GetChars(), name);
if (lexx == 0)
{
return mid;
@ -1295,13 +1295,13 @@ void S_ShrinkPlayerSoundLists ()
qsort (&PlayerClassLookups[0], PlayerClassLookups.Size(),
sizeof(FPlayerClassLookup), SortPlayerClasses);
PlayerClassesIsSorted = true;
DefPlayerClass = S_FindPlayerClass (DefPlayerClassName);
DefPlayerClass = S_FindPlayerClass (DefPlayerClassName.GetChars());
}
static int SortPlayerClasses (const void *a, const void *b)
{
return stricmp (((const FPlayerClassLookup *)a)->Name,
((const FPlayerClassLookup *)b)->Name);
return stricmp (((const FPlayerClassLookup *)a)->Name.GetChars(),
((const FPlayerClassLookup *)b)->Name.GetChars());
}
//==========================================================================

View file

@ -158,7 +158,7 @@ static FString LookupMusic(const char* musicname, int& order)
if (mus_string != nullptr)
{
DEH_Music << "D_" << mus_string;
musicname = DEH_Music;
musicname = DEH_Music.GetChars();
}
}
@ -314,7 +314,7 @@ void S_Start()
if (LocalSndInfo.IsNotEmpty())
{
// Now parse the local SNDINFO
int j = fileSystem.CheckNumForFullName(LocalSndInfo, true);
int j = fileSystem.CheckNumForFullName(LocalSndInfo.GetChars(), true);
if (j >= 0) S_AddLocalSndInfo(j);
}
@ -328,7 +328,7 @@ void S_Start()
if (parse_ss)
{
S_ParseSndSeq(LocalSndSeq.IsNotEmpty() ? fileSystem.CheckNumForFullName(LocalSndSeq, true) : -1);
S_ParseSndSeq(LocalSndSeq.IsNotEmpty() ? fileSystem.CheckNumForFullName(LocalSndSeq.GetChars(), true) : -1);
}
LastLocalSndInfo = LocalSndInfo;