mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* Make GetStandingLayer recognize items & fix bug affecting the z-coordinates returned. * Oblige oppressive line length requirements * Don't need this workaround anymore * Add includeitems parameter to GetStandingLayers. * Add GetStandingCoordinates EScript function. * Remove semicolon from documentation. * Fix line length nags. * Add "x", "y" members to documentation. * Reformat code. * Update corechanges. * Fix line break in core changes. * Remove dummy parameter by removing broken reinterpret_cast. * Update GetStandingLayers documentation. * Remove x,y parameter overload of get_walkheights. * mf_GetStandingLayers: use Pos2d instead of x, y params. * Remove x,y param overloads of readdynamics. Rename flagless version to read_walkable_dynamics. * mf_GetStandingCoordinates: Refactor to use Core::Pos2d, Core::Range2d and Realms::Realm. * Clarify GetStandingCoordinates documentation. * Use correct error message in documentation. * Fix function signature in uo.em * Add test script for GetStandingCoordinates. Adds a simple test script for GetStandingCoordinates which compares the function's return value to known good data from the test map. * Update changelog * Fix test * Add a commented out block into test script to generate expected data * Fix clearance check. Walls and other tall shapes were not getting detected correctly.
70 lines
2.7 KiB
Text
70 lines
2.7 KiB
Text
use uo;
|
|
use os;
|
|
|
|
include "testutil";
|
|
|
|
program getstanding()
|
|
return 1;
|
|
endprogram
|
|
|
|
var expected_data := array{
|
|
struct{ "x" := 28, "y" := 82, "z" := -2 },
|
|
struct{ "x" := 29, "y" := 82, "z" := 0 },
|
|
struct{ "x" := 30, "y" := 82, "z" := 0 },
|
|
struct{ "x" := 28, "y" := 83, "z" := -2 },
|
|
struct{ "x" := 29, "y" := 83, "z" := 0 },
|
|
struct{ "x" := 30, "y" := 83, "z" := 0 },
|
|
struct{ "x" := 28, "y" := 84, "z" := -2 },
|
|
struct{ "x" := 29, "y" := 84, "z" := 0 },
|
|
struct{ "x" := 30, "y" := 84, "z" := 0 },
|
|
struct{ "x" := 28, "y" := 85, "z" := -2 },
|
|
struct{ "x" := 29, "y" := 85, "z" := 0 },
|
|
struct{ "x" := 30, "y" := 85, "z" := 0 },
|
|
struct{ "x" := 28, "y" := 86, "z" := -2 },
|
|
struct{ "x" := 29, "y" := 86, "z" := 0 },
|
|
struct{ "x" := 30, "y" := 86, "z" := 0 },
|
|
struct{ "x" := 28, "y" := 87, "z" := -2 },
|
|
struct{ "x" := 29, "y" := 87, "z" := 0 },
|
|
struct{ "x" := 30, "y" := 87, "z" := 0 },
|
|
struct{ "x" := 28, "y" := 88, "z" := -2 },
|
|
struct{ "x" := 29, "y" := 88, "z" := 0 },
|
|
struct{ "x" := 30, "y" := 88, "z" := 0 },
|
|
struct{ "x" := 28, "y" := 89, "z" := -2 },
|
|
struct{ "x" := 29, "y" := 89, "z" := 0 },
|
|
struct{ "x" := 30, "y" := 89, "z" := 0 },
|
|
struct{ "x" := 28, "y" := 90, "z" := -2 },
|
|
struct{ "x" := 29, "y" := 90, "z" := 0 },
|
|
struct{ "x" := 30, "y" := 90, "z" := 0 },
|
|
struct{ "x" := 28, "y" := 91, "z" := -2 },
|
|
struct{ "x" := 29, "y" := 91, "z" := 0 },
|
|
struct{ "x" := 30, "y" := 91, "z" := 0 },
|
|
struct{ "x" := 28, "y" := 92, "z" := -2 },
|
|
struct{ "x" := 29, "y" := 92, "z" := 0 },
|
|
struct{ "x" := 30, "y" := 92, "z" := 0 }
|
|
};
|
|
|
|
exported function getstanding()
|
|
var coords := GetStandingCoordinates(25, 87, 5);
|
|
|
|
// Uncomment this block to generate a preformatted list of the function's return values, for updating expected_data above
|
|
|
|
// foreach coord in (coords)
|
|
// var multi := coords.multi ? $", \"multi\" := {coord.multi}" : "";
|
|
// var comma := _coord_iter == coords.size() ? "" : ",";
|
|
// print($" struct\{ \"x\" := {coord.x}, \"y\" := {coord.y}, \"z\" := {coord.z}{multi} \}{comma}");
|
|
// endforeach
|
|
|
|
var i;
|
|
for (i := 1; i <= coords.size(); i++)
|
|
var coord := coords[i];
|
|
var expected := expected_data[i];
|
|
if (coord.x != expected.x || coord.y != expected.y || coord.z != expected.z)
|
|
return ret_error($"Invalid data returned at index {i}. Expected {expected}; got {coord}");
|
|
endif
|
|
endfor
|
|
|
|
if (coords.size() != expected_data.size())
|
|
return ret_error($"Invalid number of coordinates returned. Expected {expected_data.size()}; got {coords.size()}");
|
|
endif
|
|
return 1;
|
|
endfunction
|