MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / addSubstitution

Method addSubstitution

Engine/source/console/simDatablock.cpp:101–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101void SimDataBlock::addSubstitution(StringTableEntry slot, S32 idx, const char* subst)
102{
103 AssertFatal(subst != 0 && subst[0] == '$' && subst[1] == '$', "Bad substition statement string added");
104
105 subst += 2;
106 while (dIsspace(*subst))
107 subst++;
108
109 bool empty_subs = (*subst == '\0');
110
111 for (S32 i = 0; i < substitutions.size(); i++)
112 {
113 if (substitutions[i] && substitutions[i]->mSlot == slot && substitutions[i]->mIdx == idx)
114 {
115 if (empty_subs)
116 {
117 delete substitutions[i];
118 substitutions[i] = 0;
119 onRemoveSubstitution(slot, idx);
120 }
121 else
122 {
123 substitutions[i]->replaceValue(subst);
124 onAddSubstitution(slot, idx, subst);
125 }
126 return;
127 }
128 }
129
130 if (!empty_subs)
131 {
132 substitutions.push_back(new SubstitutionStatement(slot, idx, subst));
133 onAddSubstitution(slot, idx, subst);
134 }
135}
136
137const char* SimDataBlock::getSubstitution(StringTableEntry slot, S32 idx)
138{

Callers 2

setDataMethod · 0.80
setDataFieldMethod · 0.80

Calls 4

dIsspaceFunction · 0.85
replaceValueMethod · 0.80
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected