Skip to content

Commit

Permalink
Global before/after scope fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
wghost committed Dec 17, 2014
1 parent 4eda72c commit 3c469d3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ModScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,11 +659,11 @@ size_t ModScript::GetDiff(size_t DataSize)

bool ModScript::CheckMoveResize(size_t DataSize, bool FitScope)
{
size_t ScopeSize = ScriptState.MaxOffset - ScriptState.Offset - ScriptState.RelOffset + 1;
if (ScriptState.Scope == UPKScope::Object)
{
bool NeedMoveResize = false;
size_t ObjSize = ScriptState.Package.GetExportEntry(ScriptState.ObjIdx).SerialSize;
size_t ScopeSize = ScriptState.MaxOffset - ScriptState.Offset - ScriptState.RelOffset + 1;
if (FitScope && ScopeSize != DataSize)
{
if (ScriptState.Behavior != "KEEP")
Expand All @@ -673,7 +673,7 @@ bool ModScript::CheckMoveResize(size_t DataSize, bool FitScope)
}
else
{
*ErrorMessages << "Data chunk too large for current scope!\n";
*ErrorMessages << "Data chunk does not fit current scope!\n";
return SetBad();
}
}
Expand All @@ -691,6 +691,11 @@ bool ModScript::CheckMoveResize(size_t DataSize, bool FitScope)
return DoResize(ObjSize);
}
}
else if (FitScope && ScopeSize != DataSize)
{
*ErrorMessages << "Data chunk does not fit current scope!\n";
return SetBad();
}
if (!IsInsideScope(DataSize))
{
*ErrorMessages << "Data chunk too large for current scope!\n";
Expand Down

0 comments on commit 3c469d3

Please sign in to comment.