| 99 | } |
| 100 | |
| 101 | void 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 | |
| 137 | const char* SimDataBlock::getSubstitution(StringTableEntry slot, S32 idx) |
| 138 | { |
no test coverage detected