|
|
|
@ -1,8 +1,15 @@
|
|
|
|
|
#include "loadgmst.hpp"
|
|
|
|
|
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
|
|
#include "defs.hpp"
|
|
|
|
|
|
|
|
|
|
namespace ESM
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/// \todo Review GMST "fixing". Probably remove completely or at least make it optional. Its definitely not
|
|
|
|
|
/// working properly in its current state and I doubt it can be fixed without breaking other stuff.
|
|
|
|
|
|
|
|
|
|
// Some handy macros
|
|
|
|
|
#define cI(s,x) { if(id == (s)) return (i == (x)); }
|
|
|
|
|
#define cF(s,x) { if(id == (s)) return (f == (x)); }
|
|
|
|
@ -169,4 +176,32 @@ void GameSetting::load(ESMReader &esm)
|
|
|
|
|
dirty = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int GameSetting::getInt() const
|
|
|
|
|
{
|
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
case VT_Float: return static_cast<int> (f);
|
|
|
|
|
case VT_Int: return i;
|
|
|
|
|
default: throw std::runtime_error ("GMST " + id + " is not of a numeric type");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int GameSetting::getFloat() const
|
|
|
|
|
{
|
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
case VT_Float: return f;
|
|
|
|
|
case VT_Int: return i;
|
|
|
|
|
default: throw std::runtime_error ("GMST " + id + " is not of a numeric type");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string GameSetting::getString() const
|
|
|
|
|
{
|
|
|
|
|
if (type==VT_String)
|
|
|
|
|
return str;
|
|
|
|
|
|
|
|
|
|
throw std::runtime_error ("GMST " + id + " is not a string");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|