Skip to content

Commit d43ab3d

Browse files
authored
Remove conversion operators from string classes (#790)
1 parent 0275053 commit d43ab3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+157
-159
lines changed

src/game/client/draw/drawable.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,7 +1694,7 @@ void Drawable::Xfer_Snapshot(Xfer *xfer)
16941694
for (int j = 0; j < count; j++) {
16951695
Utf8String str;
16961696
xfer->xferAsciiString(&str);
1697-
DrawableIconType index = Drawable_Icon_Name_To_Index(str);
1697+
DrawableIconType index = Drawable_Icon_Name_To_Index(str.Str());
16981698
unsigned int timing;
16991699
xfer->xferUnsignedInt(&timing);
17001700
Get_Icon_Info()->timings[index] = timing;
@@ -1906,7 +1906,7 @@ void Drawable::Xfer_Drawable_Modules(Xfer *xfer)
19061906
} else {
19071907
for (int k = 0; k < module_count; k++) {
19081908
xfer->xferAsciiString(&str);
1909-
NameKeyType key = g_theNameKeyGenerator->Name_To_Key(str);
1909+
NameKeyType key = g_theNameKeyGenerator->Name_To_Key(str.Str());
19101910
Module *module = nullptr;
19111911

19121912
for (Module **j = m_modules[i]; j && *j; j++) {

src/game/client/draw/w3ddebrisdraw.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ void W3DDebrisDraw::Set_Model_Name(Utf8String name, unsigned int color, ShadowTy
185185
}
186186

187187
m_renderObject =
188-
W3DDisplay::s_assetManager->Create_Render_Obj(name, Get_Drawable()->Get_Scale(), col, nullptr, nullptr);
188+
W3DDisplay::s_assetManager->Create_Render_Obj(name.Str(), Get_Drawable()->Get_Scale(), col, nullptr, nullptr);
189189
captainslog_dbgassert(m_renderObject, "Debris model %s not found!", name.Str());
190190

191191
if (m_renderObject != nullptr) {
@@ -222,16 +222,16 @@ void W3DDebrisDraw::Set_Anim_Names(Utf8String initial, Utf8String flying, Utf8St
222222
if (initial.Is_Empty()) {
223223
m_anims[INITIAL] = nullptr;
224224
} else {
225-
m_anims[INITIAL] = W3DDisplay::s_assetManager->Get_HAnim(initial);
225+
m_anims[INITIAL] = W3DDisplay::s_assetManager->Get_HAnim(initial.Str());
226226
}
227227

228228
if (flying.Is_Empty()) {
229229
m_anims[FLYING] = nullptr;
230230
} else {
231-
m_anims[FLYING] = W3DDisplay::s_assetManager->Get_HAnim(flying);
231+
m_anims[FLYING] = W3DDisplay::s_assetManager->Get_HAnim(flying.Str());
232232
}
233233

234-
if (strcasecmp(final, "STOP") == 0) {
234+
if (strcasecmp(final.Str(), "STOP") == 0) {
235235
m_finalStop = true;
236236
final = flying;
237237
} else {
@@ -241,7 +241,7 @@ void W3DDebrisDraw::Set_Anim_Names(Utf8String initial, Utf8String flying, Utf8St
241241
if (final.Is_Empty()) {
242242
m_anims[FINAL] = nullptr;
243243
} else {
244-
m_anims[FINAL] = W3DDisplay::s_assetManager->Get_HAnim(final);
244+
m_anims[FINAL] = W3DDisplay::s_assetManager->Get_HAnim(final.Str());
245245
}
246246

247247
m_state = INITIAL;

src/game/client/draw/w3ddefaultdraw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ W3DDefaultDraw::W3DDefaultDraw(Thing *thing, ModuleData const *module_data) :
2727

2828
if (!tmplate->Get_LTA_Name().Is_Empty()) {
2929
m_renderObject = W3DDisplay::s_assetManager->Create_Render_Obj(
30-
tmplate->Get_LTA_Name(), drawable->Get_Scale(), 0, nullptr, nullptr);
30+
tmplate->Get_LTA_Name().Str(), drawable->Get_Scale(), 0, nullptr, nullptr);
3131
Shadow::ShadowTypeInfo info;
3232
info.m_type = SHADOW_VOLUME;
3333
info.m_sizeX = 0;

src/game/client/draw/w3ddependencymodeldraw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void W3DDependencyModelDraw::Adjust_Transform_Mtx(Matrix3D &transform) const
8383
Matrix3D m;
8484

8585
if (contained_drawable->Get_Current_Worldspace_Client_Bone_Positions(
86-
data->m_attachToDrawableBoneInContainer, m)) {
86+
data->m_attachToDrawableBoneInContainer.Str(), m)) {
8787
transform = m;
8888
} else {
8989
transform = *contained_drawable->Get_Transform_Matrix();

src/game/client/draw/w3dlaserdraw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ W3DLaserDraw::W3DLaserDraw(Thing *thing, ModuleData const *module_data) :
8484
m_setLaserPosition(true)
8585
{
8686
const W3DLaserDrawModuleData *data = Get_W3D_Laser_Draw_Module_Data();
87-
m_texture = W3DAssetManager::Get_Instance()->Get_Texture(data->m_textureName);
87+
m_texture = W3DAssetManager::Get_Instance()->Get_Texture(data->m_textureName.Str());
8888

8989
if (m_texture) {
9090
if (!m_texture->Is_Initialized()) {

src/game/client/draw/w3dmodeldraw.cpp

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ unsigned int s_theObjectIDToDebug;
6060

6161
HAnimClass *W3DAnimationInfo::Get_Anim_Handle() const
6262
{
63-
HAnimClass *anim = W3DDisplay::s_assetManager->Get_HAnim(m_name);
63+
HAnimClass *anim = W3DDisplay::s_assetManager->Get_HAnim(m_name.Str());
6464

6565
if (anim != nullptr) {
6666
if (m_framesPerSecond < 0.0f) {
@@ -155,7 +155,7 @@ bool Find_Single_Bone(RenderObjClass *r, Utf8String const &bone, Matrix3D &trans
155155
return false;
156156
}
157157

158-
index = r->Get_Bone_Index(bone);
158+
index = r->Get_Bone_Index(bone.Str());
159159

160160
if (index == 0) {
161161
return false;
@@ -171,7 +171,7 @@ bool Find_Single_Sub_Obj(RenderObjClass *r, Utf8String const &sub_obj_name, Matr
171171
return false;
172172
}
173173

174-
RenderObjClass *subobj = r->Get_Sub_Object_By_Name(sub_obj_name, nullptr);
174+
RenderObjClass *subobj = r->Get_Sub_Object_By_Name(sub_obj_name.Str(), nullptr);
175175

176176
if (subobj == nullptr) {
177177
return false;
@@ -209,7 +209,7 @@ bool Do_Single_Bone_Name(RenderObjClass *robj, Utf8String const &bone, std::map<
209209
Set_FP_Mode();
210210

211211
if (Find_Single_Bone(robj, bone_lower, info.transform, info.index)) {
212-
map[g_theNameKeyGenerator->Name_To_Key(bone_lower)] = info;
212+
map[g_theNameKeyGenerator->Name_To_Key(bone_lower.Str())] = info;
213213
bone_found = true;
214214
}
215215

@@ -220,13 +220,13 @@ bool Do_Single_Bone_Name(RenderObjClass *robj, Utf8String const &bone, std::map<
220220
break;
221221
}
222222

223-
map[g_theNameKeyGenerator->Name_To_Key(bone_id)] = info;
223+
map[g_theNameKeyGenerator->Name_To_Key(bone_id.Str())] = info;
224224
bone_found = true;
225225
}
226226

227227
if (!bone_found) {
228228
if (Find_Single_Sub_Obj(robj, bone_lower, info.transform, info.index)) {
229-
map[g_theNameKeyGenerator->Name_To_Key(bone_lower)] = info;
229+
map[g_theNameKeyGenerator->Name_To_Key(bone_lower.Str())] = info;
230230
sub_obj_found = true;
231231
}
232232

@@ -237,7 +237,7 @@ bool Do_Single_Bone_Name(RenderObjClass *robj, Utf8String const &bone, std::map<
237237
break;
238238
}
239239

240-
map[g_theNameKeyGenerator->Name_To_Key(bone_id)] = info;
240+
map[g_theNameKeyGenerator->Name_To_Key(bone_id.Str())] = info;
241241
sub_obj_found = true;
242242
}
243243
}
@@ -263,7 +263,7 @@ void ModelConditionInfo::Validate_Cached_Bones(RenderObjClass *robj, float scale
263263
bool ref = false;
264264

265265
if (robj == nullptr && !m_modelName.Is_Empty()) {
266-
robj = W3DDisplay::s_assetManager->Create_Render_Obj(m_modelName, scale, 0, nullptr, nullptr);
266+
robj = W3DDisplay::s_assetManager->Create_Render_Obj(m_modelName.Str(), scale, 0, nullptr, nullptr);
267267

268268
if (robj != nullptr) {
269269
ref = true;
@@ -426,12 +426,12 @@ void ModelConditionInfo::Validate_Weapon_Barrel_Info() const
426426

427427
if (!weaponrecoilbonename.Is_Empty()) {
428428
Find_Pristine_Bone(
429-
g_theNameKeyGenerator->Name_To_Key(weaponrecoilbonename), &info.m_weaponRecoilBone);
429+
g_theNameKeyGenerator->Name_To_Key(weaponrecoilbonename.Str()), &info.m_weaponRecoilBone);
430430
}
431431

432432
if (!weaponmuzzleflashbonename.Is_Empty()) {
433-
Find_Pristine_Bone(
434-
g_theNameKeyGenerator->Name_To_Key(weaponmuzzleflashbonename), &info.m_weaponMuzzleFlashBone);
433+
Find_Pristine_Bone(g_theNameKeyGenerator->Name_To_Key(weaponmuzzleflashbonename.Str()),
434+
&info.m_weaponMuzzleFlashBone);
435435
}
436436

437437
#ifdef GAME_DEBUG_STRUCTS
@@ -445,7 +445,7 @@ void ModelConditionInfo::Validate_Weapon_Barrel_Info() const
445445
if (weaponlaunchbonename.Is_Empty()) {
446446
m = nullptr;
447447
} else {
448-
m = Find_Pristine_Bone(g_theNameKeyGenerator->Name_To_Key(weaponlaunchbonename), nullptr);
448+
m = Find_Pristine_Bone(g_theNameKeyGenerator->Name_To_Key(weaponlaunchbonename.Str()), nullptr);
449449
}
450450

451451
if (m != nullptr) {
@@ -456,7 +456,7 @@ void ModelConditionInfo::Validate_Weapon_Barrel_Info() const
456456

457457
if (!weaponfirefxbonename.Is_Empty()) {
458458
Find_Pristine_Bone(
459-
g_theNameKeyGenerator->Name_To_Key(weaponfirefxbonename), &info.m_weaponFireFXBone);
459+
g_theNameKeyGenerator->Name_To_Key(weaponfirefxbonename.Str()), &info.m_weaponFireFXBone);
460460
}
461461

462462
if (info.m_weaponFireFXBone || info.m_weaponRecoilBone || info.m_weaponMuzzleFlashBone || m != nullptr) {
@@ -703,7 +703,7 @@ Vector3 *W3DModelDrawModuleData::Get_Attach_To_Drawable_Bone_Offset(Drawable con
703703
if (!m_attachToDrawableBoneOffsetSet) {
704704
Matrix3D m;
705705

706-
if (drawable->Get_Pristine_Bone_Positions(m_attachToBoneInAnotherModule, 0, nullptr, &m, 1) == 1) {
706+
if (drawable->Get_Pristine_Bone_Positions(m_attachToBoneInAnotherModule.Str(), 0, nullptr, &m, 1) == 1) {
707707
m_attachToDrawableBoneOffset = m.Get_Translation();
708708
} else {
709709
m_attachToDrawableBoneOffset.X = 0.0f;
@@ -825,7 +825,7 @@ void Parse_Bone_Name_Key(INI *ini, void *instance, void *store, void const *user
825825
if (str.Is_Empty() || str.Is_None()) {
826826
*static_cast<NameKeyType *>(store) = NAMEKEY_INVALID;
827827
} else {
828-
*static_cast<NameKeyType *>(store) = g_theNameKeyGenerator->Name_To_Key(str);
828+
*static_cast<NameKeyType *>(store) = g_theNameKeyGenerator->Name_To_Key(str.Str());
829829
}
830830
}
831831

@@ -842,7 +842,7 @@ void Parse_Show_Hide_Sub_Object(INI *ini, void *instance, void *store, void cons
842842
bool found = false;
843843

844844
for (auto &i : *v) {
845-
if (!strcasecmp(i.sub_obj_name, str)) {
845+
if (!strcasecmp(i.sub_obj_name.Str(), str.Str())) {
846846
i.hide = (uintptr_t)user_data != 0;
847847
found = true;
848848
}
@@ -920,7 +920,7 @@ void Parse_Lowercase_Name_Key(INI *ini, void *formal, void *store, void const *u
920920
{
921921
Utf8String str(ini->Get_Next_Token());
922922
str.To_Lower();
923-
*static_cast<NameKeyType *>(store) = g_theNameKeyGenerator->Name_To_Key(str);
923+
*static_cast<NameKeyType *>(store) = g_theNameKeyGenerator->Name_To_Key(str.Str());
924924
}
925925

926926
void Parse_Particle_Sys_Bone(INI *ini, void *instance, void *store, void const *user_data)
@@ -1043,8 +1043,8 @@ void W3DModelDrawModuleData::Parse_Condition_State(INI *ini, void *instance, voi
10431043
str.To_Lower();
10441044
Utf8String str2(ini->Get_Next_Token());
10451045
str2.To_Lower();
1046-
NameKeyType key = g_theNameKeyGenerator->Name_To_Key(str);
1047-
NameKeyType key2 = g_theNameKeyGenerator->Name_To_Key(str2);
1046+
NameKeyType key = g_theNameKeyGenerator->Name_To_Key(str.Str());
1047+
NameKeyType key2 = g_theNameKeyGenerator->Name_To_Key(str2.Str());
10481048
captainslog_relassert(
10491049
key != key2, CODE_06, "*** ASSET ERROR: You may not declare a transition between two identical states");
10501050

@@ -1307,7 +1307,7 @@ void W3DModelDraw::Allocate_Shadows()
13071307
if (m_shadow == nullptr && m_renderObject != nullptr && g_theW3DShadowManager != nullptr
13081308
&& info.m_thing->Get_Shadow_Type() != SHADOW_NONE) {
13091309

1310-
strcpy(info.m_shadowName, info.m_thing->Get_Shadow_Texture_Name());
1310+
strcpy(info.m_shadowName, info.m_thing->Get_Shadow_Texture_Name().Str());
13111311
captainslog_dbgassert(info.m_shadowName[0], "this should be validated in ThingTemplate now");
13121312

13131313
info.m_allowUpdates = false;
@@ -1641,7 +1641,7 @@ void W3DModelDraw::Do_Hide_Show_Sub_Objs(std::vector<ModelConditionInfo::HideSho
16411641
if (!vec->empty()) {
16421642
for (auto &info : *vec) {
16431643
int index;
1644-
RenderObjClass *robj = m_renderObject->Get_Sub_Object_By_Name(info.sub_obj_name, &index);
1644+
RenderObjClass *robj = m_renderObject->Get_Sub_Object_By_Name(info.sub_obj_name.Str(), &index);
16451645

16461646
if (robj != nullptr) {
16471647
robj->Set_Hidden(info.hide);
@@ -1818,7 +1818,7 @@ void W3DModelDraw::Recalc_Bones_For_Client_Particle_Systems()
18181818
int index;
18191819

18201820
if (m_renderObject != nullptr) {
1821-
index = m_renderObject->Get_Bone_Index(bone.bone_name);
1821+
index = m_renderObject->Get_Bone_Index(bone.bone_name.Str());
18221822
} else {
18231823
index = 0;
18241824
}
@@ -1911,7 +1911,7 @@ void W3DModelDraw::Set_Terrain_Decal(TerrainDecalType decal)
19111911
info.m_type = SHADOW_ALPHA_DECAL;
19121912

19131913
if (decal == TERRAIN_DECAL_9) {
1914-
strcpy(info.m_shadowName, tmplate->Get_Shadow_Texture_Name());
1914+
strcpy(info.m_shadowName, tmplate->Get_Shadow_Texture_Name().Str());
19151915
} else {
19161916
strcpy(info.m_shadowName, s_terrainDecalTextureName[decal]);
19171917
}
@@ -2146,7 +2146,7 @@ void W3DModelDraw::Set_Model_State(ModelConditionInfo const *new_state)
21462146
m_renderObject = nullptr;
21472147
} else {
21482148
m_renderObject = W3DDisplay::s_assetManager->Create_Render_Obj(
2149-
new_state->m_modelName, drawable->Get_Scale(), m_hexColor, nullptr, nullptr);
2149+
new_state->m_modelName.Str(), drawable->Get_Scale(), m_hexColor, nullptr, nullptr);
21502150

21512151
// Thyme specific: Original assert has been demoted to log message because it is a data issue.
21522152
if (m_renderObject == nullptr) {
@@ -2173,7 +2173,7 @@ void W3DModelDraw::Set_Model_State(ModelConditionInfo const *new_state)
21732173
if (g_theTerrainTracksRenderObjClassSystem != nullptr) {
21742174
if (!Get_W3D_Model_Draw_Module_Data()->m_trackFile.Is_Empty()) {
21752175
m_trackRenderObject = g_theTerrainTracksRenderObjClassSystem->Bind_Track(
2176-
m_renderObject, 10.0f, Get_W3D_Model_Draw_Module_Data()->m_trackFile);
2176+
m_renderObject, 10.0f, Get_W3D_Model_Draw_Module_Data()->m_trackFile.Str());
21772177

21782178
if (drawable != nullptr) {
21792179
if (m_trackRenderObject != nullptr) {
@@ -2186,7 +2186,7 @@ void W3DModelDraw::Set_Model_State(ModelConditionInfo const *new_state)
21862186
}
21872187

21882188
if (m_renderObject != nullptr && g_theW3DShadowManager != nullptr && info.m_thing->Get_Shadow_Type()) {
2189-
strcpy(info.m_shadowName, info.m_thing->Get_Shadow_Texture_Name());
2189+
strcpy(info.m_shadowName, info.m_thing->Get_Shadow_Texture_Name().Str());
21902190
captainslog_dbgassert(info.m_shadowName[0], "this should be validated in ThingTemplate now");
21912191
info.m_allowUpdates = false;
21922192
info.m_allowWorldAlign = true;
@@ -2513,7 +2513,7 @@ bool W3DModelDraw::Client_Only_Get_Render_Obj_Bone_Transform(Utf8String const &b
25132513
return false;
25142514
}
25152515

2516-
int index = m_renderObject->Get_Bone_Index(bone);
2516+
int index = m_renderObject->Get_Bone_Index(bone.Str());
25172517

25182518
if (index == 0) {
25192519
transform->Make_Identity();
@@ -2857,7 +2857,7 @@ void W3DModelDraw::Update_Sub_Objects()
28572857
if (m_renderObject != nullptr && !m_subObjects.empty()) {
28582858
for (auto &info : m_subObjects) {
28592859
int index;
2860-
RenderObjClass *robj = m_renderObject->Get_Sub_Object_By_Name(info.sub_obj_name, &index);
2860+
RenderObjClass *robj = m_renderObject->Get_Sub_Object_By_Name(info.sub_obj_name.Str(), &index);
28612861

28622862
if (robj) {
28632863
robj->Set_Hidden(info.hide);
@@ -3011,7 +3011,7 @@ void W3DModelDraw::Show_Sub_Object(Utf8String const &sub_obj_name, bool visible)
30113011
bool found = false;
30123012

30133013
for (auto &info : m_subObjects) {
3014-
if (!strcasecmp(sub_obj_name, info.sub_obj_name)) {
3014+
if (!strcasecmp(sub_obj_name.Str(), info.sub_obj_name.Str())) {
30153015
info.hide = visible == 0;
30163016
found = true;
30173017
}

src/game/client/draw/w3dprojectilestreamdraw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void W3DProjectileStreamDrawModuleData::Build_Field_Parse(MultiIniFieldParse &p)
4646
W3DProjectileStreamDraw::W3DProjectileStreamDraw(Thing *thing, ModuleData const *module_data) :
4747
DrawModule(thing, module_data)
4848
{
49-
m_texture = W3DAssetManager::Get_Instance()->Get_Texture(Get_W3D_Projectile_Stream_Draw_Module_Data()->m_texture);
49+
m_texture = W3DAssetManager::Get_Instance()->Get_Texture(Get_W3D_Projectile_Stream_Draw_Module_Data()->m_texture.Str());
5050

5151
for (int i = 0; i < MAX_SEGMENT_COUNT; i++) {
5252
m_allLines[i] = nullptr;

src/game/client/draw/w3dsupplydraw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void W3DSupplyDraw::Update_Draw_Module_Supply_Status(int max, int current)
4040
const Utf8String &prefix = Get_W3D_Supply_Draw_Module_Data()->m_supplyBonePrefix;
4141

4242
if (m_totalSupplyBoneCount == -1) {
43-
m_totalSupplyBoneCount = Get_Drawable()->Get_Pristine_Bone_Positions(prefix, 1, nullptr, nullptr, INT_MAX);
43+
m_totalSupplyBoneCount = Get_Drawable()->Get_Pristine_Bone_Positions(prefix.Str(), 1, nullptr, nullptr, INT_MAX);
4444
m_currentSupplyBoneCount = m_totalSupplyBoneCount;
4545
}
4646

0 commit comments

Comments
 (0)