I made this little patch so that "get_tile_list" gets an array with "tile_x": CHG-Get-tile-list-in-factory_x.patch
faxtory_x(pos.x, pos.y).get_tile_list()
??
http://dwachs.github.io/simutrans-sqapi-doc/classfactory__x.html#a59a5d79eac6ae4618c34f382c616b4d3 (http://dwachs.github.io/simutrans-sqapi-doc/classfactory__x.html#a59a5d79eac6ae4618c34f382c616b4d3)
Quote from: Andarix on November 28, 2022, 08:53:56 AM??
http://dwachs.github.io/simutrans-sqapi-doc/classfactory__x.html#a59a5d79eac6ae4618c34f382c616b4d3 (http://dwachs.github.io/simutrans-sqapi-doc/classfactory__x.html#a59a5d79eac6ae4618c34f382c616b4d3)
I guess it's a bug in the doc, but what it actually returns is a "coord" array not a "tile_x" array. :o
This patch fixes just that. :P
Test in action:
local fact = factory_x(pos.x, pos.y)
local list = fact.get_tile_list()
foreach(t in list) {
t.mark()
}
Captura desde 2022-11-28 05-06-54.png
Quote from: Yona-TYT on November 28, 2022, 09:02:05 AMI guess it's a bug in the doc, but what it actually returns is a "coord" array not a "tile_x" array. :o
This patch fixes just that. :P
And what's so bad about it if it's coord?
I'm afraid that this patch will demolish the script AI.
It would make more sense to make a function coord_to_tile_x for that.
Quote from: Andarix on November 28, 2022, 12:15:10 PMAnd what's so bad about it if it's coord?
I wanted to be consistent with the other "get_tile_list()" functions, since factory_x is the only class that doesn't return a "tile_x" array.
Maybe making an additional function to make coord list independent is a good idea, something like get_coord_list().
If tile_x would actually be derived from coord3d then changing get_tile_list should not bring any problems.
But tile_x is not derived from coord3d, actually, which is another bug in the docs. Will see, what can be done.
This is now in r10821. If there are any problems with existing scripts due to this change, please report back.
Quote from: Dwachs on November 30, 2022, 07:11:51 PMThis is now in r10821. If there are any problems with existing scripts due to this change, please report back.
You don't know how much I appreciate this!. ;D
With this I am further optimizing the code of the basic class in the tutorial.
A lot of "coord" passed to "tile_x". :P