mirror of https://github.com/OpenTTD/OpenTTD
(svn r14311) [0.6] -Backport from trunk:
- Fix: Aircraft frozen above oil rig when the next order is invalid [FS#2244] (r14309) - Fix: Pay extra when tram/road bits need to be build for a roadstop [FS#2268] (r14308) - Fix: [YAPF] Only reserve road slots for multistop when they are really reachable [FS#2294] (r14305) - Fix: One could be trying to get the station name of a station that is outside of the pool (r14297) - Fix: Default for sound effects and music volume should be in the valid range for that setting [FS#2286] (r14289) - Fix: Make small UFO aware of articulated RVs so they crash the complete vehicle instead of a small part of it (r14270)release/0.6
parent
290b0c1099
commit
bbaaaaa506
|
@ -6,7 +6,7 @@ if [ "$#" != "0" ]; then
|
||||||
Usage: ./findversion.sh
|
Usage: ./findversion.sh
|
||||||
Finds the current revision and if the code is modified.
|
Finds the current revision and if the code is modified.
|
||||||
|
|
||||||
Output: <REV>\t<REV_NR>\t<MODIFIED>
|
Output: <REV>\t<REV_NR>\t<MODIFIED>\t<CLEAN_REV>
|
||||||
REV
|
REV
|
||||||
a string describing what version of the code the current checkout is
|
a string describing what version of the code the current checkout is
|
||||||
based on. The exact format of this string depends on the version
|
based on. The exact format of this string depends on the version
|
||||||
|
@ -40,6 +40,9 @@ MODIFIED
|
||||||
A value of 1 means that the modified status is unknown, because this
|
A value of 1 means that the modified status is unknown, because this
|
||||||
is not an svn/git/hg checkout for example.
|
is not an svn/git/hg checkout for example.
|
||||||
|
|
||||||
|
CLEAN_REV
|
||||||
|
the same as REV but without branch name
|
||||||
|
|
||||||
By setting the AWK environment variable, a caller can determine which
|
By setting the AWK environment variable, a caller can determine which
|
||||||
version of "awk" is used. If nothing is set, this script defaults to
|
version of "awk" is used. If nothing is set, this script defaults to
|
||||||
"awk".
|
"awk".
|
||||||
|
@ -62,16 +65,21 @@ SRC_DIR=src
|
||||||
MODIFIED="0"
|
MODIFIED="0"
|
||||||
if [ -d "$ROOT_DIR/.svn" ]; then
|
if [ -d "$ROOT_DIR/.svn" ]; then
|
||||||
# We are an svn checkout
|
# We are an svn checkout
|
||||||
if svnversion "$SRC_DIR" | grep 'M' > /dev/null; then
|
if [ -n "`svnversion \"$SRC_DIR\" | grep 'M'`" ]; then
|
||||||
MODIFIED="2"
|
MODIFIED="2"
|
||||||
fi
|
fi
|
||||||
# Find the revision like: rXXXXM-branch
|
# Find the revision like: rXXXXM-branch
|
||||||
BRANCH=`LC_ALL=C svn info "$SRC_DIR" | "$AWK" '/^URL:.*branches/ { split($2, a, "/"); for(i in a) if (a[i]=="branches") { print a[i+1]; break } }'`
|
BRANCH=`LC_ALL=C svn info "$SRC_DIR" | "$AWK" '/^URL:.*branches/ { split($2, a, "/"); for(i in a) if (a[i]=="branches") { print a[i+1]; break } }'`
|
||||||
|
TAG=`LC_ALL=C svn info "$SRC_DIR" | "$AWK" '/^URL:.*tags/ { split($2, a, "/"); for(i in a) if (a[i]=="tags") { print a[i+1]; break } }'`
|
||||||
REV_NR=`LC_ALL=C svn info "$SRC_DIR" | "$AWK" '/^Last Changed Rev:/ { print $4 }'`
|
REV_NR=`LC_ALL=C svn info "$SRC_DIR" | "$AWK" '/^Last Changed Rev:/ { print $4 }'`
|
||||||
REV="r$REV_NR"
|
if [ -n "$TAG" ]; then
|
||||||
|
REV=$TAG
|
||||||
|
else
|
||||||
|
REV="r$REV_NR"
|
||||||
|
fi
|
||||||
elif [ -d "$ROOT_DIR/.git" ]; then
|
elif [ -d "$ROOT_DIR/.git" ]; then
|
||||||
# We are a git checkout
|
# We are a git checkout
|
||||||
if git diff-index HEAD "$SRC_DIR" | read dummy; then
|
if [ -n "`git diff-index HEAD \"$SRC_DIR\"`" ]; then
|
||||||
MODIFIED="2"
|
MODIFIED="2"
|
||||||
fi
|
fi
|
||||||
HASH=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null | cut -c1-8`
|
HASH=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null | cut -c1-8`
|
||||||
|
@ -80,7 +88,7 @@ elif [ -d "$ROOT_DIR/.git" ]; then
|
||||||
REV_NR=`LC_ALL=C git log --pretty=format:%s "$SRC_DIR" | grep "^(svn r[0-9]*)" | head -n 1 | sed "s/.*(svn r\([0-9]*\)).*/\1/"`
|
REV_NR=`LC_ALL=C git log --pretty=format:%s "$SRC_DIR" | grep "^(svn r[0-9]*)" | head -n 1 | sed "s/.*(svn r\([0-9]*\)).*/\1/"`
|
||||||
elif [ -d "$ROOT_DIR/.hg" ]; then
|
elif [ -d "$ROOT_DIR/.hg" ]; then
|
||||||
# We are a hg checkout
|
# We are a hg checkout
|
||||||
if hg status "$SRC_DIR" | grep -v '^?' | read dummy; then
|
if [ -n "`hg status \"$SRC_DIR\" | grep -v '^?'`" ]; then
|
||||||
MODIFIED="2"
|
MODIFIED="2"
|
||||||
fi
|
fi
|
||||||
HASH=`LC_ALL=C hg tip 2>/dev/null | head -n 1 | cut -d: -f3 | cut -c1-8`
|
HASH=`LC_ALL=C hg tip 2>/dev/null | head -n 1 | cut -d: -f3 | cut -c1-8`
|
||||||
|
@ -99,8 +107,10 @@ if [ "$MODIFIED" -eq "2" ]; then
|
||||||
REV="${REV}M"
|
REV="${REV}M"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CLEAN_REV=${REV}
|
||||||
|
|
||||||
if [ -n "$BRANCH" ]; then
|
if [ -n "$BRANCH" ]; then
|
||||||
REV="${REV}-$BRANCH"
|
REV="${REV}-$BRANCH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$REV $REV_NR $MODIFIED"
|
echo "$REV $REV_NR $MODIFIED $CLEAN_REV"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Source: PACKAGE
|
Source: openttd
|
||||||
Section: contrib/games
|
Section: contrib/games
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: Matthijs Kooijman <matthijs@stdin.nl>
|
Maintainer: Matthijs Kooijman <matthijs@stdin.nl>
|
||||||
|
@ -9,7 +9,7 @@ Vcs-Browser: http://svn.debian.org/wsvn/collab-maint/deb-maint/openttd/trunk/
|
||||||
Vcs-Svn: svn://svn.debian.org/svn/collab-maint/deb-maint/openttd/trunk
|
Vcs-Svn: svn://svn.debian.org/svn/collab-maint/deb-maint/openttd/trunk
|
||||||
Homepage: http://www.openttd.org/
|
Homepage: http://www.openttd.org/
|
||||||
|
|
||||||
Package: PACKAGE
|
Package: openttd
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||||
Suggests: timidity, freepats
|
Suggests: timidity, freepats
|
|
@ -6,22 +6,7 @@
|
||||||
# Uncomment this to turn on verbose mode.
|
# Uncomment this to turn on verbose mode.
|
||||||
#export DH_VERBOSE=1
|
#export DH_VERBOSE=1
|
||||||
|
|
||||||
DEFAULT_PACKAGE := openttd
|
configure: configure-stamp
|
||||||
# Find the package name from the topmost changelog entry.
|
|
||||||
# Is this the best way to do this?
|
|
||||||
PACKAGE = $(shell cat debian/changelog | head -1 | cut -f1 -d' ')
|
|
||||||
|
|
||||||
debian/control:
|
|
||||||
# Generate control file
|
|
||||||
sed 's/PACKAGE/$(PACKAGE)/' debian/control.in > debian/control
|
|
||||||
|
|
||||||
# TODO: How to do this using makefile conditionals?
|
|
||||||
if [ "$(PACKAGE)" != "$(DEFAULT_PACKAGE)" ]; then \
|
|
||||||
echo "Provides: $(DEFAULT_PACKAGE)" >> debian/control ; \
|
|
||||||
echo "Conflicts: $(DEFAULT_PACKAGE)" >> debian/control ; \
|
|
||||||
fi;
|
|
||||||
|
|
||||||
configure: debian/control configure-stamp
|
|
||||||
configure-stamp:
|
configure-stamp:
|
||||||
dh_testdir
|
dh_testdir
|
||||||
# Add here commands to configure the package.
|
# Add here commands to configure the package.
|
||||||
|
@ -29,20 +14,20 @@ configure-stamp:
|
||||||
touch configure-stamp
|
touch configure-stamp
|
||||||
|
|
||||||
|
|
||||||
build: debian/control configure build-stamp
|
build: configure build-stamp
|
||||||
build-stamp:
|
build-stamp:
|
||||||
dh_testdir
|
dh_testdir
|
||||||
|
|
||||||
# Add here commands to compile the package.
|
# Add here commands to compile the package.
|
||||||
|
|
||||||
./configure --prefix-dir=/usr --binary-dir=games --data-dir=share/games/openttd --icon-dir=share/pixmaps --personal-dir=.openttd --install-dir=debian/$(PACKAGE)
|
./configure --prefix-dir=/usr --binary-dir=games --data-dir=share/games/openttd --icon-dir=share/pixmaps --personal-dir=.openttd --install-dir=debian/openttd
|
||||||
$(MAKE)
|
$(MAKE)
|
||||||
|
|
||||||
#/usr/bin/docbook-to-man debian/openttd.sgml > openttd.1
|
#/usr/bin/docbook-to-man debian/openttd.sgml > openttd.1
|
||||||
|
|
||||||
touch build-stamp
|
touch build-stamp
|
||||||
|
|
||||||
clean: debian/control
|
clean:
|
||||||
dh_testdir
|
dh_testdir
|
||||||
dh_testroot
|
dh_testroot
|
||||||
rm -f build-stamp configure-stamp
|
rm -f build-stamp configure-stamp
|
||||||
|
@ -54,10 +39,8 @@ clean: debian/control
|
||||||
[ ! -f Makefile ] || $(MAKE) distclean
|
[ ! -f Makefile ] || $(MAKE) distclean
|
||||||
|
|
||||||
dh_clean
|
dh_clean
|
||||||
# Clean up generated control file
|
|
||||||
-rm debian/control
|
|
||||||
|
|
||||||
install: debian/control build
|
install: build
|
||||||
dh_testdir
|
dh_testdir
|
||||||
dh_testroot
|
dh_testroot
|
||||||
dh_clean -k
|
dh_clean -k
|
||||||
|
@ -71,7 +54,7 @@ binary-indep: build install
|
||||||
# We have nothing to do by default.
|
# We have nothing to do by default.
|
||||||
|
|
||||||
# Build architecture-dependent files here.
|
# Build architecture-dependent files here.
|
||||||
binary-arch: debian/control build install
|
binary-arch: build install
|
||||||
dh_testdir
|
dh_testdir
|
||||||
dh_testroot
|
dh_testroot
|
||||||
dh_installchangelogs changelog.txt
|
dh_installchangelogs changelog.txt
|
||||||
|
|
|
@ -1692,21 +1692,23 @@ static void AircraftEventHandler_AtTerminal(Vehicle *v, const AirportFTAClass *a
|
||||||
/* airport-road is free. We either have to go to another airport, or to the hangar
|
/* airport-road is free. We either have to go to another airport, or to the hangar
|
||||||
* ---> start moving */
|
* ---> start moving */
|
||||||
|
|
||||||
|
bool go_to_hangar = false;
|
||||||
switch (v->current_order.type) {
|
switch (v->current_order.type) {
|
||||||
case OT_GOTO_STATION: // ready to fly to another airport
|
case OT_GOTO_STATION: // ready to fly to another airport
|
||||||
/* airplane goto state takeoff, helicopter to helitakeoff */
|
|
||||||
v->u.air.state = (v->subtype == AIR_HELICOPTER) ? HELITAKEOFF : TAKEOFF;
|
|
||||||
break;
|
break;
|
||||||
case OT_GOTO_DEPOT: // visit hangar for serivicing, sale, etc.
|
case OT_GOTO_DEPOT: // visit hangar for serivicing, sale, etc.
|
||||||
if (v->current_order.dest == v->u.air.targetairport) {
|
go_to_hangar = v->current_order.dest == v->u.air.targetairport;
|
||||||
v->u.air.state = HANGAR;
|
|
||||||
} else {
|
|
||||||
v->u.air.state = (v->subtype == AIR_HELICOPTER) ? HELITAKEOFF : TAKEOFF;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default: // orders have been deleted (no orders), goto depot and don't bother us
|
default: // orders have been deleted (no orders), goto depot and don't bother us
|
||||||
v->current_order.Free();
|
v->current_order.Free();
|
||||||
v->u.air.state = HANGAR;
|
go_to_hangar = GetStation(v->u.air.targetairport)->Airport()->nof_depots != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (go_to_hangar) {
|
||||||
|
v->u.air.state = HANGAR;
|
||||||
|
} else {
|
||||||
|
/* airplane goto state takeoff, helicopter to helitakeoff */
|
||||||
|
v->u.air.state = (v->subtype == AIR_HELICOPTER) ? HELITAKEOFF : TAKEOFF;
|
||||||
}
|
}
|
||||||
AirportMove(v, apc);
|
AirportMove(v, apc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include "vehicle_func.h"
|
#include "vehicle_func.h"
|
||||||
#include "vehicle_base.h"
|
#include "vehicle_base.h"
|
||||||
#include "sound_func.h"
|
#include "sound_func.h"
|
||||||
|
#include "roadveh.h"
|
||||||
|
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
#include "table/sprites.h"
|
#include "table/sprites.h"
|
||||||
|
@ -329,7 +330,7 @@ static void DisasterTick_Ufo(Vehicle *v)
|
||||||
v->current_order.dest = 1;
|
v->current_order.dest = 1;
|
||||||
|
|
||||||
FOR_ALL_VEHICLES(u) {
|
FOR_ALL_VEHICLES(u) {
|
||||||
if (u->type == VEH_ROAD && IsHumanPlayer(u->owner)) {
|
if (u->type == VEH_ROAD && IsRoadVehFront(u) && IsHumanPlayer(u->owner)) {
|
||||||
v->dest_tile = u->index;
|
v->dest_tile = u->index;
|
||||||
v->age = 0;
|
v->age = 0;
|
||||||
return;
|
return;
|
||||||
|
@ -340,7 +341,7 @@ static void DisasterTick_Ufo(Vehicle *v)
|
||||||
} else {
|
} else {
|
||||||
/* Target a vehicle */
|
/* Target a vehicle */
|
||||||
u = GetVehicle(v->dest_tile);
|
u = GetVehicle(v->dest_tile);
|
||||||
if (u->type != VEH_ROAD) {
|
if (u->type != VEH_ROAD || !IsRoadVehFront(u)) {
|
||||||
DeleteDisasterVeh(v);
|
DeleteDisasterVeh(v);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -363,12 +364,16 @@ static void DisasterTick_Ufo(Vehicle *v)
|
||||||
v->age++;
|
v->age++;
|
||||||
if (u->u.road.crashed_ctr == 0) {
|
if (u->u.road.crashed_ctr == 0) {
|
||||||
u->u.road.crashed_ctr++;
|
u->u.road.crashed_ctr++;
|
||||||
u->vehstatus |= VS_CRASHED;
|
|
||||||
|
|
||||||
AddNewsItem(STR_B001_ROAD_VEHICLE_DESTROYED,
|
AddNewsItem(STR_B001_ROAD_VEHICLE_DESTROYED,
|
||||||
NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
|
NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
|
||||||
u->index,
|
u->index,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
for (Vehicle *w = u; w != NULL; w = w->Next()) {
|
||||||
|
w->vehstatus |= VS_CRASHED;
|
||||||
|
MarkSingleVehicleDirty(w);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1258,8 +1258,8 @@ static int32 ConvertLandscape(const char *value)
|
||||||
|
|
||||||
static const SettingDesc _music_settings[] = {
|
static const SettingDesc _music_settings[] = {
|
||||||
SDT_VAR(MusicFileSettings, playlist, SLE_UINT8, S, 0, 0, 0, 5, 1, STR_NULL, NULL),
|
SDT_VAR(MusicFileSettings, playlist, SLE_UINT8, S, 0, 0, 0, 5, 1, STR_NULL, NULL),
|
||||||
SDT_VAR(MusicFileSettings, music_vol, SLE_UINT8, S, 0, 128, 0, 100, 1, STR_NULL, NULL),
|
SDT_VAR(MusicFileSettings, music_vol, SLE_UINT8, S, 0, 127, 0, 127, 1, STR_NULL, NULL),
|
||||||
SDT_VAR(MusicFileSettings, effect_vol, SLE_UINT8, S, 0, 128, 0, 100, 1, STR_NULL, NULL),
|
SDT_VAR(MusicFileSettings, effect_vol, SLE_UINT8, S, 0, 127, 0, 127, 1, STR_NULL, NULL),
|
||||||
SDT_LIST(MusicFileSettings, custom_1, SLE_UINT8, S, 0, NULL, STR_NULL, NULL),
|
SDT_LIST(MusicFileSettings, custom_1, SLE_UINT8, S, 0, NULL, STR_NULL, NULL),
|
||||||
SDT_LIST(MusicFileSettings, custom_2, SLE_UINT8, S, 0, NULL, STR_NULL, NULL),
|
SDT_LIST(MusicFileSettings, custom_2, SLE_UINT8, S, 0, NULL, STR_NULL, NULL),
|
||||||
SDT_BOOL(MusicFileSettings, playing, S, 0, true, STR_NULL, NULL),
|
SDT_BOOL(MusicFileSettings, playing, S, 0, true, STR_NULL, NULL),
|
||||||
|
|
|
@ -1323,7 +1323,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
bool type = HasBit(p2, 0);
|
bool type = HasBit(p2, 0);
|
||||||
bool is_drive_through = HasBit(p2, 1);
|
bool is_drive_through = HasBit(p2, 1);
|
||||||
bool build_over_road = is_drive_through && IsNormalRoadTile(tile);
|
bool build_over_road = is_drive_through && IsNormalRoadTile(tile);
|
||||||
bool town_owned_road = build_over_road && IsTileOwner(tile, OWNER_TOWN);
|
bool town_owned_road = false;
|
||||||
RoadTypes rts = (RoadTypes)GB(p2, 2, 3);
|
RoadTypes rts = (RoadTypes)GB(p2, 2, 3);
|
||||||
|
|
||||||
if (!AreValidRoadTypes(rts) || !HasRoadTypesAvail(_current_player, rts)) return CMD_ERROR;
|
if (!AreValidRoadTypes(rts) || !HasRoadTypesAvail(_current_player, rts)) return CMD_ERROR;
|
||||||
|
@ -1342,22 +1342,27 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
|
|
||||||
CommandCost cost;
|
CommandCost cost;
|
||||||
|
|
||||||
|
RoadTypes cur_rts = IsNormalRoadTile(tile) ? GetRoadTypes(tile) : ROADTYPES_NONE;
|
||||||
|
uint num_roadbits = 0;
|
||||||
/* Not allowed to build over this road */
|
/* Not allowed to build over this road */
|
||||||
if (build_over_road) {
|
if (build_over_road) {
|
||||||
if (IsTileOwner(tile, OWNER_TOWN) && !_patches.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD);
|
|
||||||
|
|
||||||
RoadTypes cur_rts = GetRoadTypes(tile);
|
|
||||||
|
|
||||||
/* there is a road, check if we can build road+tram stop over it */
|
/* there is a road, check if we can build road+tram stop over it */
|
||||||
if (HasBit(cur_rts, ROADTYPE_ROAD)) {
|
if (HasBit(cur_rts, ROADTYPE_ROAD)) {
|
||||||
Owner road_owner = GetRoadOwner(tile, ROADTYPE_ROAD);
|
Owner road_owner = GetRoadOwner(tile, ROADTYPE_ROAD);
|
||||||
if (road_owner != OWNER_TOWN && road_owner != OWNER_NONE && !CheckOwnership(road_owner)) return CMD_ERROR;
|
if (road_owner == OWNER_TOWN) {
|
||||||
|
town_owned_road = true;
|
||||||
|
if (!_patches.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD);
|
||||||
|
} else {
|
||||||
|
if (road_owner != OWNER_NONE && !CheckOwnership(road_owner)) return CMD_ERROR;
|
||||||
|
}
|
||||||
|
num_roadbits += CountBits(GetRoadBits(tile, ROADTYPE_ROAD));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* there is a tram, check if we can build road+tram stop over it */
|
/* there is a tram, check if we can build road+tram stop over it */
|
||||||
if (HasBit(cur_rts, ROADTYPE_TRAM)) {
|
if (HasBit(cur_rts, ROADTYPE_TRAM)) {
|
||||||
Owner tram_owner = GetRoadOwner(tile, ROADTYPE_TRAM);
|
Owner tram_owner = GetRoadOwner(tile, ROADTYPE_TRAM);
|
||||||
if (tram_owner != OWNER_NONE && !CheckOwnership(tram_owner)) return CMD_ERROR;
|
if (tram_owner != OWNER_NONE && !CheckOwnership(tram_owner)) return CMD_ERROR;
|
||||||
|
num_roadbits += CountBits(GetRoadBits(tile, ROADTYPE_TRAM));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't allow building the roadstop when vehicles are already driving on it */
|
/* Don't allow building the roadstop when vehicles are already driving on it */
|
||||||
|
@ -1368,6 +1373,8 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
}
|
}
|
||||||
cost = CheckFlatLandBelow(tile, 1, 1, flags, is_drive_through ? 5 << p1 : 1 << p1, NULL, !build_over_road);
|
cost = CheckFlatLandBelow(tile, 1, 1, flags, is_drive_through ? 5 << p1 : 1 << p1, NULL, !build_over_road);
|
||||||
if (CmdFailed(cost)) return cost;
|
if (CmdFailed(cost)) return cost;
|
||||||
|
uint roadbits_to_build = CountBits(rts) * 2 - num_roadbits;
|
||||||
|
cost.AddCost(_price.build_road * roadbits_to_build);
|
||||||
|
|
||||||
Station *st = NULL;
|
Station *st = NULL;
|
||||||
|
|
||||||
|
|
|
@ -846,11 +846,18 @@ static char* FormatString(char* buff, const char* str, const int64* argv, uint c
|
||||||
}
|
}
|
||||||
|
|
||||||
case SCC_STATION_NAME: { // {STATION}
|
case SCC_STATION_NAME: { // {STATION}
|
||||||
const Station* st = GetStation(GetInt32(&argv));
|
StationID sid = GetInt32(&argv);
|
||||||
|
|
||||||
if (!st->IsValid()) { // station doesn't exist anymore
|
if (!IsValidStationID(sid)) {
|
||||||
|
/* The station doesn't exist anymore. The only place where we might
|
||||||
|
* be "drawing" an invalid station is in the case of cargo that is
|
||||||
|
* in transit. */
|
||||||
buff = GetStringWithArgs(buff, STR_UNKNOWN_DESTINATION, NULL, last);
|
buff = GetStringWithArgs(buff, STR_UNKNOWN_DESTINATION, NULL, last);
|
||||||
} else if (st->name != NULL) {
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Station *st = GetStation(sid);
|
||||||
|
if (st->name != NULL) {
|
||||||
buff = strecpy(buff, st->name, last);
|
buff = strecpy(buff, st->name, last);
|
||||||
} else {
|
} else {
|
||||||
int64 temp[3];
|
int64 temp[3];
|
||||||
|
|
|
@ -321,14 +321,15 @@ public:
|
||||||
TrackdirBits dst_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(dst_tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes));
|
TrackdirBits dst_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(dst_tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes));
|
||||||
Yapf().SetDestination(dst_tile, dst_td_bits);
|
Yapf().SetDestination(dst_tile, dst_td_bits);
|
||||||
|
|
||||||
// find the best path
|
|
||||||
Yapf().FindPath(v);
|
|
||||||
|
|
||||||
// if path not found - return distance = UINT_MAX
|
// if path not found - return distance = UINT_MAX
|
||||||
uint dist = UINT_MAX;
|
uint dist = UINT_MAX;
|
||||||
|
|
||||||
|
// find the best path
|
||||||
|
if (!Yapf().FindPath(v)) return dist;
|
||||||
|
|
||||||
Node *pNode = Yapf().GetBestNode();
|
Node *pNode = Yapf().GetBestNode();
|
||||||
if (pNode != NULL) {
|
if (pNode != NULL) {
|
||||||
// path was found or at least suggested
|
// path was found
|
||||||
// get the path cost estimate
|
// get the path cost estimate
|
||||||
dist = pNode->GetCostEstimate();
|
dist = pNode->GetCostEstimate();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue