Only remove duplicate player entities in scriptclass::hardreset()

Looks like duplicate player entities persisting across rooms is a
semi-useful feature used by some levels. Still, though, it's a bit of a
nuisance to have duplicate player entities persisting across game
sessions. And levels can't rely on this persistence anyway, anyone could
just close the game and re-open it to get rid of the duplicate entities
regardless.
This commit is contained in:
Misa
2020-06-15 16:19:25 -07:00
committed by Ethan Lee
parent a8cedd2f91
commit 9a8dc4b6ff
2 changed files with 15 additions and 6 deletions

View File

@@ -855,13 +855,11 @@ void mapclass::gotoroom(int rx, int ry)
}
}
int theplayer = obj.getplayer();
for (int i = 0; i < (int) obj.entities.size(); i++)
for (size_t i = 0; i < obj.entities.size(); i++)
{
if (i != theplayer)
if (obj.entities[i].rule != 0)
{
removeentity_iter(i);
theplayer--; //just in case indice of player is not 0
}
}