Refactor edentities to not use separate length-trackers

This turns the array 'edentity' into a proper vector, and removes the need to
use a separate length-tracking variable and manually keep track of the actual
amount of edentities in the level by using the long-winded
'EditorData::GetInstance().numedentities'. This manual tracking was more
error-prone and much less maintainable.

editorclass::naddedentity() has been removed due to now functionally being the
same as editorclass::addedentity() (there's no more
'EditorData::GetInstance().numedentities' to not increment) and for also being
unused in the first place.

editorclass::copyedentity() has been removed because it was only used to shift
the rest of the edentities up manually, but now that we let C++ do all the
hard work it's no longer necessary.
This commit is contained in:
Misa
2020-03-01 12:24:43 -08:00
committed by Ethan Lee
parent a4d7fc017c
commit 8d44d9387b
4 changed files with 52 additions and 96 deletions

View File

@@ -1646,7 +1646,7 @@ void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclas
//Entities have to be created HERE, akwardly
int tempcheckpoints=0;
int tempscriptbox=0;
for(int edi=0; edi<EditorData::GetInstance().numedentities; edi++){
for(size_t edi=0; edi<edentity.size(); edi++){
//If entity is in this room, create it
int tsx=(edentity[edi].x-(edentity[edi].x%40))/40;
int tsy=(edentity[edi].y-(edentity[edi].y%30))/30;