Changeset - r18271:48f58f5efce8
[Not reviewed]
master
0 2 0
yexo - 13 years ago 2011-11-04 23:14:23
yexo@openttd.org
(svn r23117) -Fix: [NoAI] calling require() to include a file gave you 100.000 opcodes for free
2 files changed with 10 insertions and 6 deletions:
0 comments (0 inline, 0 general)
bin/ai/regression/regression.txt
Show inline comments
 
@@ -8602,27 +8602,27 @@ ERROR: IsEnd() is invalid as Begin() is 
 
  BuildVehicle():       16
 
  IsValidVehicle(16):   true
 
  IsInDepot(16):        true
 
  IsStoppedInDepot(16): true
 
  BuildRailDepot():     true
 
  BuildVehicle():       17
 
  BuildVehicle():       18
 
  BuildVehicle():       19
 
  MoveWagonChain():     true
 
  GetNumWagons():       3
 
  GetLength():          24
 
  GetWagonEngineType(): 9
 
  GetWagonAge():        0
 
  GetWagonAge():        1
 
  GetWagonEngineType(): 27
 
  GetWagonAge():        0
 
  GetWagonAge():        1
 
  GetWagonEngineType(): 27
 
  GetWagonAge():        0
 
  GetWagonEngineType(): 65535
 
  GetWagonAge():        -1
 
  --Errors--
 
    RefitVehicle():        false
 
    GetLastErrorString():  ERR_VEHICLE_NOT_IN_DEPOT
 
    SellVehicle():         false
 
    GetLastErrorString():  ERR_VEHICLE_NOT_IN_DEPOT
 
    SendVehicleToDepot():  false
 
    GetLastErrorString():  ERR_UNKNOWN
 

	
 
@@ -8638,39 +8638,39 @@ ERROR: IsEnd() is invalid as Begin() is 
 
    14 => 219
 
    16 => 204
 
    13 => 153
 
    12 => 153
 
    17 => 9
 
  UnitNumber ListDump:
 
    13 => 2
 
    17 => 1
 
    16 => 1
 
    14 => 1
 
    12 => 1
 
  Age ListDump:
 
    17 => 1
 
    16 => 1
 
    14 => 1
 
    13 => 1
 
    12 => 1
 
    17 => 0
 
    16 => 0
 
  MaxAge ListDump:
 
    16 => 10980
 
    14 => 10980
 
    17 => 7320
 
    13 => 5490
 
    12 => 5490
 
  AgeLeft ListDump:
 
    16 => 10980
 
    16 => 10979
 
    14 => 10979
 
    17 => 7320
 
    17 => 7319
 
    13 => 5489
 
    12 => 5489
 
  CurrentSpeed ListDump:
 
    12 => 21
 
    17 => 0
 
    16 => 0
 
    14 => 0
 
    13 => 0
 
  RunningCost ListDump:
 
    14 => 2756
 
    17 => 2296
 
    16 => 2296
src/script/squirrel.cpp
Show inline comments
 
@@ -472,33 +472,37 @@ static SQInteger _io_file_read(SQUserPoi
 
		}
 
		FioFCloseFile(file);
 
		return SQ_ERROR;
 
	}
 
	return sq_throwerror(vm, _SC("cannot open the file"));
 
}
 

	
 
/* static */ bool Squirrel::LoadScript(HSQUIRRELVM vm, const char *script, bool in_root)
 
{
 
	/* Make sure we are always in the root-table */
 
	if (in_root) sq_pushroottable(vm);
 

	
 
	SQInteger ops_left = vm->_ops_till_suspend;
 
	/* Load and run the script */
 
	if (SQ_SUCCEEDED(LoadFile(vm, script, SQTrue))) {
 
		sq_push(vm, -2);
 
		if (SQ_SUCCEEDED(sq_call(vm, 1, SQFalse, SQTrue, 100000))) {
 
			sq_pop(vm, 1);
 
			/* After compiling the file we want to reset the amount of opcodes. */
 
			vm->_ops_till_suspend = ops_left;
 
			return true;
 
		}
 
	}
 

	
 
	vm->_ops_till_suspend = ops_left;
 
	DEBUG(misc, 0, "[squirrel] Failed to compile '%s'", script);
 
	return false;
 
}
 

	
 
bool Squirrel::LoadScript(const char *script)
 
{
 
	return LoadScript(this->vm, script);
 
}
 

	
 
Squirrel::~Squirrel()
 
{
 
	/* Clean up the stuff */
0 comments (0 inline, 0 general)