mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 09:54:10 +03:00
Turn obj.collect and obj.customcollect into plain arrays
Since they're always fixed-size, there's no need for them to be vectors. Also added an INBOUNDS_ARR() macro to do bounds checks with plain arrays.
This commit is contained in:
@@ -5369,19 +5369,7 @@ void Game::loadquick()
|
||||
|
||||
LOAD_ARRAY(crewstats)
|
||||
|
||||
if (pKey == "collect")
|
||||
{
|
||||
std::string TextString = (pText);
|
||||
if(TextString.length())
|
||||
{
|
||||
std::vector<std::string> values = split(TextString,',');
|
||||
obj.collect.clear();
|
||||
for(size_t i = 0; i < values.size(); i++)
|
||||
{
|
||||
obj.collect.push_back((bool) atoi(values[i].c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
LOAD_ARRAY_RENAME(collect, obj.collect)
|
||||
|
||||
if (pKey == "finalmode")
|
||||
{
|
||||
@@ -5574,33 +5562,9 @@ void Game::customloadquick(std::string savfile)
|
||||
|
||||
LOAD_ARRAY(crewstats)
|
||||
|
||||
if (pKey == "collect")
|
||||
{
|
||||
std::string TextString = (pText);
|
||||
if(TextString.length())
|
||||
{
|
||||
std::vector<std::string> values = split(TextString,',');
|
||||
obj.collect.clear();
|
||||
for(size_t i = 0; i < values.size(); i++)
|
||||
{
|
||||
obj.collect.push_back((bool) atoi(values[i].c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
LOAD_ARRAY_RENAME(collect, obj.collect)
|
||||
|
||||
if (pKey == "customcollect")
|
||||
{
|
||||
std::string TextString = (pText);
|
||||
if(TextString.length())
|
||||
{
|
||||
std::vector<std::string> values = split(TextString,',');
|
||||
obj.customcollect.clear();
|
||||
for(size_t i = 0; i < values.size(); i++)
|
||||
{
|
||||
obj.customcollect.push_back((bool) atoi(values[i].c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
LOAD_ARRAY_RENAME(customcollect, obj.customcollect)
|
||||
|
||||
if (pKey == "finalmode")
|
||||
{
|
||||
@@ -5965,7 +5929,7 @@ void Game::savetele()
|
||||
msgs->LinkEndChild( msg );
|
||||
|
||||
std::string collect;
|
||||
for(size_t i = 0; i < obj.collect.size(); i++ )
|
||||
for(size_t i = 0; i < SDL_arraysize(obj.collect); i++ )
|
||||
{
|
||||
collect += help.String((int) obj.collect[i]) + ",";
|
||||
}
|
||||
@@ -6161,7 +6125,7 @@ void Game::savequick()
|
||||
msgs->LinkEndChild( msg );
|
||||
|
||||
std::string collect;
|
||||
for(size_t i = 0; i < obj.collect.size(); i++ )
|
||||
for(size_t i = 0; i < SDL_arraysize(obj.collect); i++ )
|
||||
{
|
||||
collect += help.String((int) obj.collect[i]) + ",";
|
||||
}
|
||||
@@ -6359,7 +6323,7 @@ void Game::customsavequick(std::string savfile)
|
||||
msgs->LinkEndChild( msg );
|
||||
|
||||
std::string collect;
|
||||
for(size_t i = 0; i < obj.collect.size(); i++ )
|
||||
for(size_t i = 0; i < SDL_arraysize(obj.collect); i++ )
|
||||
{
|
||||
collect += help.String((int) obj.collect[i]) + ",";
|
||||
}
|
||||
@@ -6368,7 +6332,7 @@ void Game::customsavequick(std::string savfile)
|
||||
msgs->LinkEndChild( msg );
|
||||
|
||||
std::string customcollect;
|
||||
for(size_t i = 0; i < obj.customcollect.size(); i++ )
|
||||
for(size_t i = 0; i < SDL_arraysize(obj.customcollect); i++ )
|
||||
{
|
||||
customcollect += help.String((int) obj.customcollect[i]) + ",";
|
||||
}
|
||||
@@ -6562,19 +6526,7 @@ void Game::loadtele()
|
||||
|
||||
LOAD_ARRAY(crewstats)
|
||||
|
||||
if (pKey == "collect")
|
||||
{
|
||||
std::string TextString = (pText);
|
||||
if(TextString.length())
|
||||
{
|
||||
std::vector<std::string> values = split(TextString,',');
|
||||
obj.collect.clear();
|
||||
for(size_t i = 0; i < values.size(); i++)
|
||||
{
|
||||
obj.collect.push_back((bool) atoi(values[i].c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
LOAD_ARRAY_RENAME(collect, obj.collect)
|
||||
|
||||
if (pKey == "finalmode")
|
||||
{
|
||||
@@ -7562,7 +7514,7 @@ void Game::resetgameclock()
|
||||
int Game::trinkets()
|
||||
{
|
||||
int temp = 0;
|
||||
for (size_t i = 0; i < obj.collect.size(); i++)
|
||||
for (size_t i = 0; i < SDL_arraysize(obj.collect); i++)
|
||||
{
|
||||
if (obj.collect[i])
|
||||
{
|
||||
@@ -7575,7 +7527,7 @@ int Game::trinkets()
|
||||
int Game::crewmates()
|
||||
{
|
||||
int temp = 0;
|
||||
for (size_t i = 0; i < obj.customcollect.size(); i++)
|
||||
for (size_t i = 0; i < SDL_arraysize(obj.customcollect); i++)
|
||||
{
|
||||
if (obj.customcollect[i])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user