Skip to content

Instantly share code, notes, and snippets.

@dedmen
Last active October 13, 2016 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dedmen/e381f48d11867c25ed9dac5f0b4e549a to your computer and use it in GitHub Desktop.
Save dedmen/e381f48d11867c25ed9dac5f0b4e549a to your computer and use it in GitHub Desktop.
Armadness
class GameVarSpace
{
VarBankType _vars;
bool _enabledSerialization;
bool VarSet(const char *name, GameValuePar value, bool readOnly=false);
bool VarGet(const char *name, GameValue &ret) const;
};
class GameDataNamespace : public GameData
{
VarBankType _variables;
RString _name;
bool _enabledSerialization;
bool VarSet(const char *name, GameValuePar value, bool readOnly = false);
bool VarGet(const char *name, GameValue &ret) const;
otherStuff;
};
class Location
{
GameVarSpace _variables;
otherStuff;
};
//Can't cast GameDataNamespace and Location to common type to access it. So need different ways to handle it.
//mh... how about
class GameVarSpace
{
VarBankType _vars;
bool _enabledSerialization;
bool VarSet(const char *name, GameValuePar value, bool readOnly=false);
bool VarGet(const char *name, GameValue &ret) const;
};
class GameDataNamespace : public GameData, public GameVarSpace
{
RString _name;
otherStuff;
};
class Location : public GameVarSpace
{
otherStuff;
};
//Can cast Location and GameDataNamespace to common parent GameVarSpace and use that to access vars.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment