X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2FInterpreter.cpp;h=28e9b39335d2f13c13ecc7c0226d1ecf69589c6e;hb=06b6411e5dc8fc6b905530f7adbde8bd0c2bb0ea;hp=1005c64db76e5bbbbe7f3aa800e9868e646a30cd;hpb=44e43987d774b65dffbeae7692606eb2f82de531;p=l2e.git diff --git a/src/loader/Interpreter.cpp b/src/loader/Interpreter.cpp index 1005c64..28e9b39 100644 --- a/src/loader/Interpreter.cpp +++ b/src/loader/Interpreter.cpp @@ -15,6 +15,7 @@ #include "../common/Ikari.h" #include "../common/Item.h" #include "../common/Spell.h" +#include "../common/Stats.h" #include "../common/TargetingMode.h" #include "../graphics/ComplexAnimation.h" #include "../graphics/Font.h" @@ -31,10 +32,10 @@ using battle::Hero; using battle::Monster; using battle::PartyLayout; -using battle::Stats; using common::Ikari; using common::Item; using common::Spell; +using common::Stats; using common::TargetingMode; using graphics::Animation; using graphics::Color; @@ -69,6 +70,15 @@ Interpreter::~Interpreter() { } +const Interpreter::ParsedDefinition &Interpreter::GetDefinition(const string &identifier) const { + try { + return parsedDefinitions.at(identifier); + } catch (...) { + throw std::runtime_error("cannot find definition for " + identifier); + } +} + + void *Interpreter::GetObject(int typeId, const std::string &name) { map::const_iterator i(parsedDefinitions.find(name)); if (i != parsedDefinitions.end()) { @@ -311,7 +321,7 @@ void Interpreter::ReadObject(int typeId, int id, char *object, const PropertyLis } } } else { - Postpone(typeId, id, fd.Offset(), i->second->GetIdentifier(), fd.TypeId()); + Postpone(typeId, id, fd.Offset(), i->second->GetIdentifier(), fd.TypeId(), !fd.IsReferenced()); } } } @@ -333,11 +343,11 @@ bool Interpreter::CanLink(const Value &v) const { return v.IsLiteral() || source.IsDefined(v.GetIdentifier()); } -void Interpreter::Postpone(int type, int id, std::ptrdiff_t offset, const std::string &identifier, int linkedType) { +void Interpreter::Postpone(int type, int id, std::ptrdiff_t offset, const std::string &identifier, int linkedType, bool inlined) { char *str(new char[identifier.size() + 1]); std::memcpy(str, identifier.c_str(), identifier.size()); str[identifier.size()] = '\0'; - postponedDefinitions.push_back(PostponedDefinition(type, id, offset, str, linkedType)); + postponedDefinitions.push_back(PostponedDefinition(type, id, offset, str, linkedType, inlined)); }