1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 10:53:54 +00:00
openmw/apps/opencs/model/world/scriptcontext.hpp
fteppe 20da0892ef openMW_test_suite compiles and runs
Slowly moving through the open-cs errors

Good progress in openCS

Very good progress on openCS

Getting closer with openCS

OpenCS compiles and runs! Didn't have time to test it all though

ix openMW

everything compiles on windows??

Fix gcc

Fix Clang
2022-12-27 19:15:55 +01:00

51 lines
1.5 KiB
C++

#ifndef CSM_WORLD_SCRIPTCONTEXT_H
#define CSM_WORLD_SCRIPTCONTEXT_H
#include <map>
#include <string>
#include <utility>
#include <vector>
#include <components/compiler/context.hpp>
#include <components/compiler/locals.hpp>
namespace CSMWorld
{
class Data;
class ScriptContext : public Compiler::Context
{
const Data& mData;
mutable std::vector<ESM::RefId> mIds;
mutable bool mIdsUpdated;
mutable std::map<std::string, Compiler::Locals> mLocals;
public:
ScriptContext(const Data& data);
bool canDeclareLocals() const override;
///< Is the compiler allowed to declare local variables?
char getGlobalType(const std::string& name) const override;
///< 'l: long, 's': short, 'f': float, ' ': does not exist.
std::pair<char, bool> getMemberType(const std::string& name, const ESM::RefId& id) const override;
///< Return type of member variable \a name in script \a id or in script of reference of
/// \a id
/// \return first: 'l: long, 's': short, 'f': float, ' ': does not exist.
/// second: true: script of reference
bool isId(const ESM::RefId& name) const override;
///< Does \a name match an ID, that can be referenced?
void invalidateIds();
void clear();
///< Remove all cached data.
/// \return Were there any locals that needed clearing?
bool clearLocals(const std::string& script);
};
}
#endif