mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
Merge branch 'local_crache' into 'master'
Cache failed compilation when getting locals Closes #6123 See merge request OpenMW/openmw!988
This commit is contained in:
commit
d8bed73ada
3 changed files with 101 additions and 108 deletions
|
@ -14,6 +14,7 @@
|
|||
Bug #6101: Disarming trapped unlocked owned objects isn't considered a crime
|
||||
Bug #6107: Fatigue is incorrectly recalculated when fortify effect is applied or removed
|
||||
Bug #6115: Showmap overzealous matching
|
||||
Bug #6123: NPC with broken script freezes the game on hello
|
||||
Bug #6129: Player avatar not displayed correctly for large window sizes when GUI scaling active
|
||||
Bug #6131: Item selection in the avatar window not working correctly for large window sizes
|
||||
Bug #6133: Cannot reliably sneak or steal in the sight of the NPCs siding with player
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include <components/esm/locals.hpp>
|
||||
#include <components/debug/debuglog.hpp>
|
||||
#include <components/compiler/locals.hpp>
|
||||
#include <components/compiler/exception.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/scriptmanager.hpp"
|
||||
|
@ -64,8 +63,6 @@ namespace MWScript
|
|||
}
|
||||
|
||||
bool Locals::hasVar(const std::string &script, const std::string &var)
|
||||
{
|
||||
try
|
||||
{
|
||||
ensure (script);
|
||||
|
||||
|
@ -74,11 +71,6 @@ namespace MWScript
|
|||
int index = locals.getIndex(var);
|
||||
return (index != -1);
|
||||
}
|
||||
catch (const Compiler::SourceException&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int Locals::getIntVar(const std::string &script, const std::string &var)
|
||||
{
|
||||
|
@ -162,8 +154,6 @@ namespace MWScript
|
|||
if (!mInitialised)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
const Compiler::Locals& declarations =
|
||||
MWBase::Environment::get().getScriptManager()->getLocals(script);
|
||||
|
||||
|
@ -194,10 +184,6 @@ namespace MWScript
|
|||
locals.mVariables.emplace_back (names[i2], value);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const Compiler::SourceException&)
|
||||
{
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -206,8 +192,6 @@ namespace MWScript
|
|||
{
|
||||
ensure (script);
|
||||
|
||||
try
|
||||
{
|
||||
const Compiler::Locals& declarations =
|
||||
MWBase::Environment::get().getScriptManager()->getLocals(script);
|
||||
|
||||
|
@ -270,8 +254,4 @@ namespace MWScript
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (const Compiler::SourceException&)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,14 +170,14 @@ namespace MWScript
|
|||
std::string name2 = Misc::StringUtils::lowerCase (name);
|
||||
|
||||
{
|
||||
ScriptCollection::iterator iter = mScripts.find (name2);
|
||||
auto iter = mScripts.find (name2);
|
||||
|
||||
if (iter!=mScripts.end())
|
||||
return iter->second.mLocals;
|
||||
}
|
||||
|
||||
{
|
||||
std::map<std::string, Compiler::Locals>::iterator iter = mOtherLocals.find (name2);
|
||||
auto iter = mOtherLocals.find (name2);
|
||||
|
||||
if (iter!=mOtherLocals.end())
|
||||
return iter->second;
|
||||
|
@ -192,10 +192,22 @@ namespace MWScript
|
|||
std::istringstream stream (script->mScriptText);
|
||||
Compiler::QuickFileParser parser (mErrorHandler, mCompilerContext, locals);
|
||||
Compiler::Scanner scanner (mErrorHandler, stream, mCompilerContext.getExtensions());
|
||||
try
|
||||
{
|
||||
scanner.scan (parser);
|
||||
}
|
||||
catch (const Compiler::SourceException&)
|
||||
{
|
||||
// error has already been reported via error handler
|
||||
locals.clear();
|
||||
}
|
||||
catch (const std::exception& error)
|
||||
{
|
||||
Log(Debug::Error) << "Error: An exception has been thrown: " << error.what();
|
||||
locals.clear();
|
||||
}
|
||||
|
||||
std::map<std::string, Compiler::Locals>::iterator iter =
|
||||
mOtherLocals.emplace(name2, locals).first;
|
||||
auto iter = mOtherLocals.emplace(name2, locals).first;
|
||||
|
||||
return iter->second;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue