mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 10:09:43 +01:00
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:
parent
a8cedd2f91
commit
9a8dc4b6ff
2 changed files with 15 additions and 6 deletions
|
@ -855,13 +855,11 @@ void mapclass::gotoroom(int rx, int ry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int theplayer = obj.getplayer();
|
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||||
for (int i = 0; i < (int) obj.entities.size(); i++)
|
|
||||||
{
|
{
|
||||||
if (i != theplayer)
|
if (obj.entities[i].rule != 0)
|
||||||
{
|
{
|
||||||
removeentity_iter(i);
|
removeentity_iter(i);
|
||||||
theplayer--; //just in case indice of player is not 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3628,8 +3628,19 @@ void scriptclass::hardreset()
|
||||||
obj.customcollect.resize(100);
|
obj.customcollect.resize(100);
|
||||||
i = 100; //previously a for-loop iterating over collect/customcollect set this to 100
|
i = 100; //previously a for-loop iterating over collect/customcollect set this to 100
|
||||||
|
|
||||||
if (obj.getplayer() > -1){
|
int theplayer = obj.getplayer();
|
||||||
obj.entities[obj.getplayer()].tile = 0;
|
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
|
//Script Stuff
|
||||||
|
|
Loading…
Reference in a new issue