1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 13:19:56 +00:00
openmw-tes3mp/apps/openmw/mwworld/globals.hpp
David Cernat 7a6dfc61ec Add OpenMW commits up to 21 May 2021
# Conflicts:
#   CMakeLists.txt
#   apps/openmw/mwscript/interpretercontext.cpp
#   components/CMakeLists.txt
2021-05-21 16:00:09 +02:00

83 lines
1.9 KiB
C++

#ifndef GAME_MWWORLD_GLOBALS_H
#define GAME_MWWORLD_GLOBALS_H
#include <vector>
#include <string>
#include <map>
#include <stdint.h>
#include <components/esm/loadglob.hpp>
namespace ESM
{
class ESMWriter;
class ESMReader;
}
namespace Loading
{
class Listener;
}
namespace MWWorld
{
class ESMStore;
class Globals
{
private:
typedef std::map<std::string, ESM::Global> Collection;
Collection mVariables; // type, value
Collection::const_iterator find (const std::string& name) const;
Collection::iterator find (const std::string& name);
public:
const ESM::Variant& operator[] (const std::string& name) const;
ESM::Variant& operator[] (const std::string& name);
char getType (const std::string& name) const;
///< If there is no global variable with this name, ' ' is returned.
void fill (const MWWorld::ESMStore& store);
///< Replace variables with variables from \a store with default values.
int countSavedGameRecords() const;
void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
bool readRecord (ESM::ESMReader& reader, uint32_t type);
///< Records for variables that do not exist are dropped silently.
///
/// \return Known type?
/*
Start of tes3mp addition
Make it possible to add a global record from elsewhere
*/
void addRecord(const ESM::Global global);
/*
End of tes3mp addition
*/
/*
Start of tes3mp addition
Make it possible to check whether a global exists
*/
bool hasRecord(const std::string& name);
/*
End of tes3mp addition
*/
};
}
#endif