1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-05 15:55:45 +00:00
OpenMW/apps/openmw/mwworld/globals.hpp
scrawl 27a05027f4 Fixes #1172: Added basic loading/saving progress bar
The progress is not particularly accurate. It simply uses the current / total number of records written/read as indication. Cell records are currently the largest by far, but there is a good chance that could be optimized using a change tracking system.
2014-04-28 11:29:57 +02:00

65 lines
1.4 KiB
C++

#ifndef GAME_MWWORLD_GLOBALS_H
#define GAME_MWWORLD_GLOBALS_H
#include <vector>
#include <string>
#include <map>
#include <stdint.h>
#include <components/interpreter/types.hpp>
#include <components/esm/variant.hpp>
namespace ESM
{
class ESMWriter;
class ESMReader;
}
namespace Loading
{
class Listener;
}
namespace MWWorld
{
class ESMStore;
class Globals
{
private:
typedef std::map<std::string, ESM::Variant> 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, int32_t type);
///< Records for variables that do not exist are dropped silently.
///
/// \return Known type?
};
}
#endif