mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03:00
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:
@@ -48,7 +48,7 @@ struct LevelMetaData
|
||||
};
|
||||
|
||||
|
||||
extern edentities edentity[3000];
|
||||
extern std::vector<edentities> edentity;
|
||||
extern scriptclass script;
|
||||
|
||||
class EditorData
|
||||
@@ -63,7 +63,6 @@ class EditorData
|
||||
}
|
||||
|
||||
|
||||
int numedentities;
|
||||
std::string title;
|
||||
std::string creator;
|
||||
|
||||
@@ -74,8 +73,7 @@ class EditorData
|
||||
private:
|
||||
|
||||
|
||||
EditorData():
|
||||
numedentities(0)
|
||||
EditorData()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -242,10 +240,6 @@ class editorclass{
|
||||
|
||||
void addedentity(int xp, int yp, int tp, int p1=0, int p2=0, int p3=0, int p4=0, int p5=320, int p6=240);
|
||||
|
||||
void naddedentity(int xp, int yp, int tp, int p1=0, int p2=0, int p3=0, int p4=0, int p5=320, int p6=240);
|
||||
|
||||
void copyedentity(int a, int b);
|
||||
|
||||
void removeedentity(int t);
|
||||
|
||||
int edentat(int xp, int yp);
|
||||
@@ -266,4 +260,4 @@ void editorinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||
|
||||
#endif /* EDITOR_H */
|
||||
|
||||
#endif /* NO_CUSTOM_LEVELS */
|
||||
#endif /* NO_CUSTOM_LEVELS */
|
||||
|
||||
Reference in New Issue
Block a user