1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 21:49:56 +00:00
openmw-tes3mp/apps/openmw/mwworld/globals.hpp
2012-11-05 17:18:01 +04:00

59 lines
1.7 KiB
C++

#ifndef GAME_MWWORLD_GLOBALS_H
#define GAME_MWWORLD_GLOBALS_H
#include <string>
#include <map>
#include <components/interpreter/types.hpp>
namespace MWWorld
{
class ESMStore;
class Globals
{
public:
union Data
{
Interpreter::Type_Float mFloat;
Interpreter::Type_Float mLong; // Why Morrowind, why? :(
Interpreter::Type_Float mShort;
};
typedef std::map<std::string, std::pair<char, Data> > Collection;
private:
Collection mVariables; // type, value
Collection::const_iterator find (const std::string& name) const;
Collection::iterator find (const std::string& name);
public:
Globals (const MWWorld::ESMStore& store);
const Data& operator[] (const std::string& name) const;
Data& operator[] (const std::string& name);
void setInt (const std::string& name, int value);
///< Set value independently from real type.
void setFloat (const std::string& name, float value);
///< Set value independently from real type.
int getInt (const std::string& name) const;
///< Get value independently from real type.
float getFloat (const std::string& name) const;
///< Get value independently from real type.
char getType (const std::string& name) const;
///< If there is no global variable with this name, ' ' is returned.
};
}
#endif