mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Remove EditorData and put its attributes on customlevelclass
This object basically had no reason to exist... it was just more verbose to use, which really reminded me of Java. Anyway, this is the last thing named after the editor for no reason when it should be a part of the customlevelclass, so I moved its attributes to customlevelclass.
This commit is contained in:
parent
8bff287907
commit
3c318814a4
3 changed files with 19 additions and 33 deletions
|
@ -285,8 +285,8 @@ void customlevelclass::reset(void)
|
|||
mapwidth=5;
|
||||
mapheight=5;
|
||||
|
||||
EditorData::GetInstance().title="Untitled Level";
|
||||
EditorData::GetInstance().creator="Unknown";
|
||||
title="Untitled Level";
|
||||
creator="Unknown";
|
||||
|
||||
levmusic=0;
|
||||
|
||||
|
@ -992,12 +992,12 @@ bool customlevelclass::load(std::string& _path)
|
|||
|
||||
if(SDL_strcmp(pKey_, "Creator") == 0)
|
||||
{
|
||||
EditorData::GetInstance().creator = pText_;
|
||||
creator = pText_;
|
||||
}
|
||||
|
||||
if(SDL_strcmp(pKey_, "Title") == 0)
|
||||
{
|
||||
EditorData::GetInstance().title = pText_;
|
||||
title = pText_;
|
||||
}
|
||||
|
||||
if(SDL_strcmp(pKey_, "Desc1") == 0)
|
||||
|
@ -1294,13 +1294,13 @@ bool customlevelclass::save(std::string& _path)
|
|||
msg = xml::update_element(data, "MetaData");
|
||||
|
||||
//getUser
|
||||
xml::update_tag(msg, "Creator", EditorData::GetInstance().creator.c_str());
|
||||
xml::update_tag(msg, "Creator", creator.c_str());
|
||||
|
||||
xml::update_tag(msg, "Title", EditorData::GetInstance().title.c_str());
|
||||
xml::update_tag(msg, "Title", title.c_str());
|
||||
|
||||
xml::update_tag(msg, "Created", version);
|
||||
|
||||
xml::update_tag(msg, "Modified", EditorData::GetInstance().modifier.c_str());
|
||||
xml::update_tag(msg, "Modified", modifier.c_str());
|
||||
|
||||
xml::update_tag(msg, "Modifiers", version);
|
||||
|
||||
|
|
|
@ -63,28 +63,14 @@ struct LevelMetaData
|
|||
|
||||
extern std::vector<CustomEntity> customentities;
|
||||
|
||||
class EditorData
|
||||
{
|
||||
public:
|
||||
|
||||
static EditorData& GetInstance(void)
|
||||
{
|
||||
static EditorData instance; // Guaranteed to be destroyed.
|
||||
// Instantiated on first use.
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
std::string title;
|
||||
std::string creator;
|
||||
|
||||
std::string modifier;
|
||||
};
|
||||
|
||||
class customlevelclass
|
||||
{
|
||||
public:
|
||||
customlevelclass(void);
|
||||
|
||||
std::string title;
|
||||
std::string creator;
|
||||
std::string modifier;
|
||||
std::string Desc1;
|
||||
std::string Desc2;
|
||||
std::string Desc3;
|
||||
|
|
|
@ -321,7 +321,7 @@ static void editormenurender(int tr, int tg, int tb)
|
|||
}
|
||||
else
|
||||
{
|
||||
graphics.bigprint( -1, 35, EditorData::GetInstance().title, tr, tg, tb, true);
|
||||
graphics.bigprint( -1, 35, cl.title, tr, tg, tb, true);
|
||||
}
|
||||
if(ed.creatormod)
|
||||
{
|
||||
|
@ -336,7 +336,7 @@ static void editormenurender(int tr, int tg, int tb)
|
|||
}
|
||||
else
|
||||
{
|
||||
graphics.Print( -1, 60, "by " + EditorData::GetInstance().creator, tr, tg, tb, true);
|
||||
graphics.Print( -1, 60, "by " + cl.creator, tr, tg, tb, true);
|
||||
}
|
||||
if(ed.websitemod)
|
||||
{
|
||||
|
@ -1749,12 +1749,12 @@ static void editormenuactionpress(void)
|
|||
case 0:
|
||||
ed.titlemod=true;
|
||||
key.enabletextentry();
|
||||
key.keybuffer=EditorData::GetInstance().title;
|
||||
key.keybuffer=cl.title;
|
||||
break;
|
||||
case 1:
|
||||
ed.creatormod=true;
|
||||
key.enabletextentry();
|
||||
key.keybuffer=EditorData::GetInstance().creator;
|
||||
key.keybuffer=cl.creator;
|
||||
break;
|
||||
case 2:
|
||||
ed.desc1mod=true;
|
||||
|
@ -2369,11 +2369,11 @@ void editorinput(void)
|
|||
{
|
||||
if(ed.titlemod)
|
||||
{
|
||||
EditorData::GetInstance().title=key.keybuffer;
|
||||
cl.title=key.keybuffer;
|
||||
}
|
||||
else if(ed.creatormod)
|
||||
{
|
||||
EditorData::GetInstance().creator=key.keybuffer;
|
||||
cl.creator=key.keybuffer;
|
||||
}
|
||||
else if(ed.websitemod)
|
||||
{
|
||||
|
@ -2400,12 +2400,12 @@ void editorinput(void)
|
|||
game.mapheld=true;
|
||||
if(ed.titlemod)
|
||||
{
|
||||
EditorData::GetInstance().title=key.keybuffer;
|
||||
cl.title=key.keybuffer;
|
||||
ed.titlemod=false;
|
||||
}
|
||||
else if(ed.creatormod)
|
||||
{
|
||||
EditorData::GetInstance().creator=key.keybuffer;
|
||||
cl.creator=key.keybuffer;
|
||||
ed.creatormod=false;
|
||||
}
|
||||
else if(ed.websitemod)
|
||||
|
|
Loading…
Reference in a new issue