30-04-2020, Thursday-13:23:02
(Dieser Beitrag wurde zuletzt bearbeitet: 30-04-2020, Thursday-13:23:55 von Andarix.)
(29-04-2020, Wednesday-17:23:43 )Andarix schrieb: ...
Ich verstehe upgrade_link_line() nicht so ganz.
da steht folgendes drin, was aber nicht zu funktionieren scheint
Code:
// plan convoy prototype
local prototyper = prototyper_t(cnv.get_waytype(), link.freight.get_name())
// iterate through schedule to estimate distance
local dist = 0
{
local entries = cnv.get_schedule().entries
local i = 0
while(i < entries.len()) {
local entry = entries[i]
// stations on schedule
if (entry.get_halt(our_player) == null) {
continue
}
// next station on schedule
local nexthalt = null
i++
while(i < entries.len()) {
if (nexthalt = entries[i].get_halt(our_player)) break
i++
}
if (nexthalt == null) {
i = 0
}
local diff = abs(entry.x - entries[i].x) + abs(entry.y - entries[i].y)
if (diff > dist) {
dist = diff
}
}
}
Script-KI für Simutrans r10894+ / Simutrans Nightly Builds