mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-22 22:40:12 +00:00
Bugfixing
git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@109 ea6a568a-9f4f-0410-981a-c910a81bb256
This commit is contained in:
parent
21c2bb116e
commit
e991753f1d
5 changed files with 25 additions and 9 deletions
|
@ -943,6 +943,8 @@ class FunctionCallExpr : Expression
|
||||||
|
|
||||||
bool isVararg;
|
bool isVararg;
|
||||||
|
|
||||||
|
bool fResolved; // True if fname is already resolved
|
||||||
|
|
||||||
// Read a function parameter list (a,b,v1=c,v2=d,...). The function
|
// Read a function parameter list (a,b,v1=c,v2=d,...). The function
|
||||||
// expects that you have already removed the initial left paren '('
|
// expects that you have already removed the initial left paren '('
|
||||||
// token.
|
// token.
|
||||||
|
@ -1044,6 +1046,7 @@ class FunctionCallExpr : Expression
|
||||||
getParamsConsole(toks, params, named);
|
getParamsConsole(toks, params, named);
|
||||||
else
|
else
|
||||||
getParams(toks, params, named);
|
getParams(toks, params, named);
|
||||||
|
fResolved = console;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Might be used for D-like implicit function calling, eg. someFunc;
|
/* Might be used for D-like implicit function calling, eg. someFunc;
|
||||||
|
@ -1068,7 +1071,9 @@ class FunctionCallExpr : Expression
|
||||||
void resolve(Scope sc)
|
void resolve(Scope sc)
|
||||||
{
|
{
|
||||||
// Resolve the function lookup first
|
// Resolve the function lookup first
|
||||||
|
if(!fResolved)
|
||||||
fname.resolve(sc);
|
fname.resolve(sc);
|
||||||
|
assert(fname.type !is null);
|
||||||
|
|
||||||
// Is the 'function' really a type name?
|
// Is the 'function' really a type name?
|
||||||
if(fname.type.isMeta)
|
if(fname.type.isMeta)
|
||||||
|
@ -1154,8 +1159,15 @@ class FunctionCallExpr : Expression
|
||||||
// Non-vararg case. Non-vararg functions must cover at least all
|
// Non-vararg case. Non-vararg functions must cover at least all
|
||||||
// the non-optional function parameters.
|
// the non-optional function parameters.
|
||||||
|
|
||||||
// Make the coverage list of all the parameters.
|
|
||||||
int parNum = fd.params.length;
|
int parNum = fd.params.length;
|
||||||
|
|
||||||
|
// Sanity check on the parameter number
|
||||||
|
if(params.length > parNum)
|
||||||
|
fail(format("Too many parameters to function %s(): expected %s, got %s",
|
||||||
|
name, parNum, params.length), fname.loc);
|
||||||
|
|
||||||
|
// Make the coverage list of all the parameters.
|
||||||
coverage = new Expression[parNum];
|
coverage = new Expression[parNum];
|
||||||
|
|
||||||
// Mark all the parameters which are present
|
// Mark all the parameters which are present
|
||||||
|
|
|
@ -377,7 +377,11 @@ abstract class Scope
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add an import to this scope
|
// Add an import to this scope
|
||||||
void registerImport(ImportHolder s) { importList ~= s; }
|
void registerImport(ImportHolder s)
|
||||||
|
{
|
||||||
|
//writefln("Registering import %s in scope %s", s, this);
|
||||||
|
importList ~= s;
|
||||||
|
}
|
||||||
|
|
||||||
// More user-friendly version for API-defined
|
// More user-friendly version for API-defined
|
||||||
// imports. Eg. global.registerImport(myclass) -> makes myclass
|
// imports. Eg. global.registerImport(myclass) -> makes myclass
|
||||||
|
|
|
@ -749,7 +749,7 @@ class MemberExpr : Expression
|
||||||
fail(name.str ~ " is not a member of " ~ ownerType.toString,
|
fail(name.str ~ " is not a member of " ~ ownerType.toString,
|
||||||
loc);
|
loc);
|
||||||
else
|
else
|
||||||
fail("Undefined identifier "~name.str, name.loc);
|
fail("Unknown identifier "~name.str, name.loc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ class Console
|
||||||
obj = Function.getIntMO();
|
obj = Function.getIntMO();
|
||||||
|
|
||||||
// Next set up the function and the scope
|
// Next set up the function and the scope
|
||||||
fn.name.str = "console";
|
fn.name.str = "__console";
|
||||||
fn.owner = obj.cls;
|
fn.owner = obj.cls;
|
||||||
sc = new FuncScope(obj.cls.sc, &fn);
|
sc = new FuncScope(obj.cls.sc, &fn);
|
||||||
|
|
||||||
|
|
|
@ -36,14 +36,14 @@ toggle()
|
||||||
{
|
{
|
||||||
if(isBattle)
|
if(isBattle)
|
||||||
{
|
{
|
||||||
print("Switching to normal music");
|
io.print("Switching to normal music");
|
||||||
battle.pause();
|
battle.pause();
|
||||||
jukebox.resume();
|
jukebox.resume();
|
||||||
isBattle = false;
|
isBattle = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print("Switching to battle music");
|
io.print("Switching to battle music");
|
||||||
jukebox.pause();
|
jukebox.pause();
|
||||||
battle.resume();
|
battle.resume();
|
||||||
isBattle = true;
|
isBattle = true;
|
||||||
|
@ -56,14 +56,14 @@ toggleMute()
|
||||||
{
|
{
|
||||||
jukebox.updateVolume(0);
|
jukebox.updateVolume(0);
|
||||||
battle.updateVolume(0);
|
battle.updateVolume(0);
|
||||||
print("Muted");
|
io.print("Muted");
|
||||||
isMuted = true;
|
isMuted = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
updateVolume();
|
updateVolume();
|
||||||
isMuted = false;
|
isMuted = false;
|
||||||
print("Mute off");
|
io.print("Mute off");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue