Anonymous Inline Valuator Function Crash
Posted: 13 Jun 2008 18:16
Hi guys. Another crash report for you.
If I use an anonymous inline function to describe a valuator the game crashes. The code I used is as follows..
The attached screenshot (1680x1050) shows the crash. The text in the box is here...
All functions in Squirrel are higher order so this should work. For instance, the following works perfectly...
But even if it was unsupported I would expect to get an error rather than have the game crash.
Do you need any more info to look into this? How do I get a crash report? Plus if you want me to log this on Flyspray just say so.
Thanks guys
If I use an anonymous inline function to describe a valuator the game crashes. The code I used is as follows..
Code: Select all
...
// Get a list of tiles to search in
local searchRadius = 10;
local tileList = AITileList();
tileList.AddRectangle(townTile - AIMap.GetTileIndex(searchRadius, searchRadius)
, townTile + AIMap.GetTileIndex(searchRadius, searchRadius));
// Rank those tiles by their suitability for a station
local radius = AIStation.GetCoverageRadius(AIStation.STATION_BUS_STOP);
tileList.Valuate(function (_tile, _town, _cargo, _radius) {
local sl = AITile.GetSlope(_tile);
local level = (sl == AITile.SLOPE_FLAT || sl == AITile.SLOPE_NWS
|| sl == AITile.SLOPE_WSE || sl == AITile.SLOPE_SEN || sl == AITile.SLOPE_ENW);
local acceptable = AITile.IsBuildable(_tile) && !AIRoad.IsRoadTile(_tile)
&& (AIRoad.GetNeighbourRoadCount(_tile) > 0)
&& AITown.IsWithinTownInfluence(_town, _tile) && level;
local acceptance = AITile.GetCargoAcceptance(_tile, _cargo, 1, 1, _radius);
return (acceptable) ? acceptance : 0;
}, town, paxCargo, radius);
tileList.RemoveBelowValue(8);
...
Code: Select all
Problem signature:
Problem Event Name: APPCRASH
Application Name: openttd.exe
Application Version: 0.7.0.13487
Application Timestamp: 48514871
Fault Module Name: StackHash_f3b5
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 00000000
Exception Code: c0000005
Exception Offset: 1bab0cab
OS Version: 6.0.6001.2.1.0.768.3
Locale ID: 2057
Additional Information 1: f3b5
Additional Information 2: 67157acfc10691bf1c01accd62406c5a
Additional Information 3: b4f4
Additional Information 4: 686b80d14c6be7494511e7ba36846343
Read our privacy statement:
http://go.microsoft.com/fwlink/?linkid=50163&clcid=0x0409
Code: Select all
local arr = [7,4,9,2,3];
arr.sort(function (a, b) {
return (a > b) ? -1 : ((a < b) ? 1 : 0);
});
Do you need any more info to look into this? How do I get a crash report? Plus if you want me to log this on Flyspray just say so.
Thanks guys
