mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 10:09:43 +01:00
Turn obj.flags into an array instead of a vector
Since it's always fixed-size, there's no reason for it to be a vector.
This commit is contained in:
parent
1258eb7bf4
commit
62203efb2c
4 changed files with 14 additions and 52 deletions
|
@ -69,15 +69,14 @@ void entityclass::init()
|
||||||
|
|
||||||
SDL_memset(customcrewmoods, true, sizeof(customcrewmoods));
|
SDL_memset(customcrewmoods, true, sizeof(customcrewmoods));
|
||||||
|
|
||||||
flags.resize(100);
|
resetallflags();
|
||||||
collect.resize(100);
|
collect.resize(100);
|
||||||
customcollect.resize(100);
|
customcollect.resize(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void entityclass::resetallflags()
|
void entityclass::resetallflags()
|
||||||
{
|
{
|
||||||
flags.clear();
|
SDL_memset(flags, false, sizeof(flags));
|
||||||
flags.resize(100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int entityclass::swncolour( int t )
|
int entityclass::swncolour( int t )
|
||||||
|
|
|
@ -182,7 +182,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
std::vector<blockclass> blocks;
|
std::vector<blockclass> blocks;
|
||||||
std::vector<bool> flags;
|
bool flags[100];
|
||||||
std::vector<bool> collect;
|
std::vector<bool> collect;
|
||||||
std::vector<bool> customcollect;
|
std::vector<bool> customcollect;
|
||||||
|
|
||||||
|
|
|
@ -5365,19 +5365,7 @@ void Game::loadquick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pKey == "flags")
|
LOAD_ARRAY_RENAME(flags, obj.flags)
|
||||||
{
|
|
||||||
std::string TextString = (pText);
|
|
||||||
if(TextString.length())
|
|
||||||
{
|
|
||||||
std::vector<std::string> values = split(TextString,',');
|
|
||||||
obj.flags.clear();
|
|
||||||
for(size_t i = 0; i < values.size(); i++)
|
|
||||||
{
|
|
||||||
obj.flags.push_back((bool) atoi(values[i].c_str()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LOAD_ARRAY(crewstats)
|
LOAD_ARRAY(crewstats)
|
||||||
|
|
||||||
|
@ -5580,19 +5568,7 @@ void Game::customloadquick(std::string savfile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pKey == "flags")
|
LOAD_ARRAY_RENAME(flags, obj.flags)
|
||||||
{
|
|
||||||
std::string TextString = (pText);
|
|
||||||
if(TextString.length())
|
|
||||||
{
|
|
||||||
std::vector<std::string> values = split(TextString,',');
|
|
||||||
obj.flags.clear();
|
|
||||||
for(size_t i = 0; i < values.size(); i++)
|
|
||||||
{
|
|
||||||
obj.flags.push_back((bool) atoi(values[i].c_str()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LOAD_ARRAY_RENAME(moods, obj.customcrewmoods)
|
LOAD_ARRAY_RENAME(moods, obj.customcrewmoods)
|
||||||
|
|
||||||
|
@ -5971,7 +5947,7 @@ void Game::savetele()
|
||||||
msgs->LinkEndChild( msg );
|
msgs->LinkEndChild( msg );
|
||||||
|
|
||||||
std::string flags;
|
std::string flags;
|
||||||
for(size_t i = 0; i < obj.flags.size(); i++ )
|
for(size_t i = 0; i < SDL_arraysize(obj.flags); i++ )
|
||||||
{
|
{
|
||||||
flags += help.String((int) obj.flags[i]) + ",";
|
flags += help.String((int) obj.flags[i]) + ",";
|
||||||
}
|
}
|
||||||
|
@ -6167,7 +6143,7 @@ void Game::savequick()
|
||||||
msgs->LinkEndChild( msg );
|
msgs->LinkEndChild( msg );
|
||||||
|
|
||||||
std::string flags;
|
std::string flags;
|
||||||
for(size_t i = 0; i < obj.flags.size(); i++ )
|
for(size_t i = 0; i < SDL_arraysize(obj.flags); i++ )
|
||||||
{
|
{
|
||||||
flags += help.String((int) obj.flags[i]) + ",";
|
flags += help.String((int) obj.flags[i]) + ",";
|
||||||
}
|
}
|
||||||
|
@ -6356,7 +6332,7 @@ void Game::customsavequick(std::string savfile)
|
||||||
msgs->LinkEndChild( msg );
|
msgs->LinkEndChild( msg );
|
||||||
|
|
||||||
std::string flags;
|
std::string flags;
|
||||||
for(size_t i = 0; i < obj.flags.size(); i++ )
|
for(size_t i = 0; i < SDL_arraysize(obj.flags); i++ )
|
||||||
{
|
{
|
||||||
flags += help.String((int) obj.flags[i]) + ",";
|
flags += help.String((int) obj.flags[i]) + ",";
|
||||||
}
|
}
|
||||||
|
@ -6582,19 +6558,7 @@ void Game::loadtele()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pKey == "flags")
|
LOAD_ARRAY_RENAME(flags, obj.flags)
|
||||||
{
|
|
||||||
std::string TextString = (pText);
|
|
||||||
if(TextString.length())
|
|
||||||
{
|
|
||||||
std::vector<std::string> values = split(TextString,',');
|
|
||||||
obj.flags.clear();
|
|
||||||
for(size_t i = 0; i < values.size(); i++)
|
|
||||||
{
|
|
||||||
obj.flags.push_back((bool) atoi(values[i].c_str()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LOAD_ARRAY(crewstats)
|
LOAD_ARRAY(crewstats)
|
||||||
|
|
||||||
|
|
|
@ -183,8 +183,8 @@ void scriptclass::run()
|
||||||
}
|
}
|
||||||
else if (words[0] == "customifflag")
|
else if (words[0] == "customifflag")
|
||||||
{
|
{
|
||||||
int flag = ss_toi(words[1]);
|
size_t flag = ss_toi(words[1]);
|
||||||
if (flag >= 0 && flag < (int) obj.flags.size() && obj.flags[flag])
|
if (flag < SDL_arraysize(obj.flags) && obj.flags[flag])
|
||||||
{
|
{
|
||||||
load("custom_"+words[2]);
|
load("custom_"+words[2]);
|
||||||
position--;
|
position--;
|
||||||
|
@ -1357,8 +1357,8 @@ void scriptclass::run()
|
||||||
}
|
}
|
||||||
else if (words[0] == "ifflag")
|
else if (words[0] == "ifflag")
|
||||||
{
|
{
|
||||||
int flag = ss_toi(words[1]);
|
size_t flag = ss_toi(words[1]);
|
||||||
if (flag >= 0 && flag < (int) obj.flags.size() && obj.flags[flag])
|
if (flag < SDL_arraysize(obj.flags) && obj.flags[flag])
|
||||||
{
|
{
|
||||||
load(words[2]);
|
load(words[2]);
|
||||||
position--;
|
position--;
|
||||||
|
@ -3701,8 +3701,7 @@ void scriptclass::hardreset()
|
||||||
obj.trophytype = 0;
|
obj.trophytype = 0;
|
||||||
obj.altstates = 0;
|
obj.altstates = 0;
|
||||||
|
|
||||||
obj.flags.clear();
|
obj.resetallflags();
|
||||||
obj.flags.resize(100);
|
|
||||||
|
|
||||||
for (i = 0; i < (int) SDL_arraysize(obj.customcrewmoods); i++){
|
for (i = 0; i < (int) SDL_arraysize(obj.customcrewmoods); i++){
|
||||||
obj.customcrewmoods[i]=true;
|
obj.customcrewmoods[i]=true;
|
||||||
|
|
Loading…
Reference in a new issue