Skip to content

Commit

Permalink
Fix PatchText issue by using iterator instead of iterating by index.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmbernard333 committed Dec 5, 2024
1 parent 5407262 commit 0ba5c12
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions common/d_dehacked.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2263,12 +2263,14 @@ static int PatchText(int oldSize)
good = false;

// Search through sprite names
for (int i = 0; i < ::num_spritenum_t_types(); i++)
// for (int i = 0; i < ::num_spritenum_t_types(); i++)
for(auto it = sprnames.begin(); it != sprnames.end(); ++it)
{
if (!strcmp(sprnames[i], oldStr))
const char* sprname = it->second;
if (!strcmp(sprname, oldStr))
{
// sprnames[i] = copystring(newStr);
sprnames.insert(copystring(newStr), (spritenum_t) i);
sprnames.insert(copystring(newStr), it->first);
good = true;
// See above.
}
Expand Down

0 comments on commit 0ba5c12

Please sign in to comment.