Hi, please don't do "#if (__cplusplus <= 199711L)" in the local function code. Since the type is common (a set of strings) make a typedef in the global header instead.
You may see Common/util/string_types.h for the reference.
This is also because you would need to include different header for GCC.
(I wish we could do template typedefs, but that does not work in C++03)
// TODO: REPLACE char** GameState::do_once_tokens with unordered_set* GameState::do_once_tokens
// NOTE: use a pointer to the unordered_set to preserve the size of the GameState struct (VS2008 reports sizeof(unordered_set) at 64)
// TODO: REMOVE int GameState::num_do_once_tokens (now available as GameState::do_once_tokens->size())
return play.do_once_tokens->insert(token).second; // all we need to know is whether insertion took place
}
GameState::num_do_once_tokens would probably be best left as an additional reserved space, since I know how touchy AGS is about struct layouts.
Is there any reason why anyone would object to this? Storing a pointer to the unordered_set isn't necessarily ideal, but it does preserve the existing layout and doesn't incur additional overhead as dereferencing was taking place anyway.
There is no problem in replacing this part of the GameState struct, because it's not referenced in script, nor exported to plugin API. Only upper part of the struct is. See my comments inside the struct like "up to here is referenced in the script "game." object". Therefore you do not need to use the "pointer trick" in this case.
The save game should not store any actual pointers (this was fixed long ago), it saves 0 always. It needs just to save the number of tokens, meaning the format won't change with this modification.
Regarding removing string limits, you may reference changes to the GUI name length:
if (gui_version < kGuiVersion_340)
{
Name.WriteCount(out, GUIMAIN_NAME_LENGTH);
OnClickHandler.WriteCount(out, GUIMAIN_EVENTHANDLER_LENGTH);
}
else
{
StrUtil::WriteString(Name, out);
StrUtil::WriteString(OnClickHandler, out);
}
Checking game data version should work for now. In the future, if the save format is replaced, the individual format number for Game State could be used.