1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-26 15:39:51 +00:00
OpenMW/apps/openmw/mwworld/globals.hpp

61 lines
1.3 KiB
C++
Raw Normal View History

#ifndef GAME_MWWORLD_GLOBALS_H
#define GAME_MWWORLD_GLOBALS_H
#include <map>
2022-09-22 21:26:05 +03:00
#include <string>
#include <vector>
#include <cstdint>
#include <components/esm3/loadglob.hpp>
namespace ESM
{
class ESMWriter;
class ESMReader;
}
namespace Loading
{
class Listener;
}
namespace MWWorld
{
2012-10-01 19:17:04 +04:00
class ESMStore;
class Globals
{
2022-09-22 21:26:05 +03:00
private:
typedef std::map<std::string, ESM::Global> Collection;
2022-09-22 21:26:05 +03:00
Collection mVariables; // type, value
2022-09-22 21:26:05 +03:00
Collection::const_iterator find(std::string_view name) const;
2022-09-22 21:26:05 +03:00
Collection::iterator find(std::string_view name);
2022-09-22 21:26:05 +03:00
public:
const ESM::Variant& operator[](std::string_view name) const;
2022-09-22 21:26:05 +03:00
ESM::Variant& operator[](std::string_view name);
2022-09-22 21:26:05 +03:00
char getType(std::string_view name) const;
///< If there is no global variable with this name, ' ' is returned.
2022-09-22 21:26:05 +03:00
void fill(const MWWorld::ESMStore& store);
///< Replace variables with variables from \a store with default values.
2022-09-22 21:26:05 +03:00
int countSavedGameRecords() const;
2022-09-22 21:26:05 +03:00
void write(ESM::ESMWriter& writer, Loading::Listener& progress) const;
2022-09-22 21:26:05 +03:00
bool readRecord(ESM::ESMReader& reader, uint32_t type);
///< Records for variables that do not exist are dropped silently.
///
/// \return Known type?
};
}
#endif