mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Actually finally fix createentity default args
Third time's the charm. The fundamental problem with the previous attempts was that they ended up saying arguments existed due to stale `words` anyway. So to actually know if an argument exists or not, we need to assign to `argexists` _as_ we parse the line. And make sure to take care of that last argument too. Also I thoroughly tested this this time around. I'm done pulling my hair out over this.
This commit is contained in:
parent
01ae5c6c70
commit
749a885d9a
1 changed files with 10 additions and 9 deletions
|
@ -46,12 +46,15 @@ void scriptclass::tokenize( const std::string& t )
|
|||
std::string tempword;
|
||||
char currentletter;
|
||||
|
||||
SDL_zeroa(argexists);
|
||||
|
||||
for (size_t i = 0; i < t.length(); i++)
|
||||
{
|
||||
currentletter = t[i];
|
||||
if (currentletter == '(' || currentletter == ')' || currentletter == ',')
|
||||
{
|
||||
words[j] = tempword;
|
||||
argexists[j] = words[j] != "";
|
||||
for (size_t ii = 0; ii < words[j].length(); ii++)
|
||||
{
|
||||
words[j][ii] = SDL_tolower(words[j][ii]);
|
||||
|
@ -73,16 +76,14 @@ void scriptclass::tokenize( const std::string& t )
|
|||
}
|
||||
}
|
||||
|
||||
if (tempword != "" && j < (int) SDL_arraysize(words))
|
||||
if (j < (int) SDL_arraysize(words))
|
||||
{
|
||||
words[j] = tempword;
|
||||
}
|
||||
|
||||
SDL_zeroa(argexists);
|
||||
|
||||
for (size_t ii = 0; ii < NUM_SCRIPT_ARGS; ++ii)
|
||||
{
|
||||
argexists[ii] = words[ii] != "";
|
||||
const bool lastargexists = tempword != "";
|
||||
if (lastargexists)
|
||||
{
|
||||
words[j] = tempword;
|
||||
}
|
||||
argexists[j] = lastargexists;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue