diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index 5e98c386..07474d47 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -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 } } diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index 0a6bd660..92b63539 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -3628,8 +3628,19 @@ void scriptclass::hardreset() obj.customcollect.resize(100); i = 100; //previously a for-loop iterating over collect/customcollect set this to 100 - if (obj.getplayer() > -1){ - obj.entities[obj.getplayer()].tile = 0; + int theplayer = obj.getplayer(); + if (theplayer > -1){ + obj.entities[theplayer].tile = 0; + } + + // Remove duplicate player entities + for (int i = 0; i < (int) obj.entities.size(); i++) + { + if (i != theplayer) + { + removeentity_iter(i); + theplayer--; // just in case indice of player is not 0 + } } //Script Stuff