1
0
Fork 0

(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
rubidium 2008-09-13 12:57:17 +00:00
parent 290b0c1099
commit bbaaaaa506
10 changed files with 72 additions and 57 deletions

0
config.lib 100644 → 100755
View File

View File

@ -6,7 +6,7 @@ if [ "$#" != "0" ]; then
Usage: ./findversion.sh
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
a string describing what version of the code the current checkout is
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
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
version of "awk" is used. If nothing is set, this script defaults to
"awk".
@ -62,16 +65,21 @@ SRC_DIR=src
MODIFIED="0"
if [ -d "$ROOT_DIR/.svn" ]; then
# We are an svn checkout
if svnversion "$SRC_DIR" | grep 'M' > /dev/null; then
if [ -n "`svnversion \"$SRC_DIR\" | grep 'M'`" ]; then
MODIFIED="2"
fi
# 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 } }'`
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="r$REV_NR"
if [ -n "$TAG" ]; then
REV=$TAG
else
REV="r$REV_NR"
fi
elif [ -d "$ROOT_DIR/.git" ]; then
# 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"
fi
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/"`
elif [ -d "$ROOT_DIR/.hg" ]; then
# 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"
fi
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"
fi
CLEAN_REV=${REV}
if [ -n "$BRANCH" ]; then
REV="${REV}-$BRANCH"
fi
echo "$REV $REV_NR $MODIFIED"
echo "$REV $REV_NR $MODIFIED $CLEAN_REV"

View File

@ -1,4 +1,4 @@
Source: PACKAGE
Source: openttd
Section: contrib/games
Priority: optional
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
Homepage: http://www.openttd.org/
Package: PACKAGE
Package: openttd
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Suggests: timidity, freepats

View File

@ -6,22 +6,7 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
DEFAULT_PACKAGE := openttd
# 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: configure-stamp
configure-stamp:
dh_testdir
# Add here commands to configure the package.
@ -29,20 +14,20 @@ configure-stamp:
touch configure-stamp
build: debian/control configure build-stamp
build: configure build-stamp
build-stamp:
dh_testdir
# 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)
#/usr/bin/docbook-to-man debian/openttd.sgml > openttd.1
touch build-stamp
clean: debian/control
clean:
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp
@ -54,10 +39,8 @@ clean: debian/control
[ ! -f Makefile ] || $(MAKE) distclean
dh_clean
# Clean up generated control file
-rm debian/control
install: debian/control build
install: build
dh_testdir
dh_testroot
dh_clean -k
@ -71,7 +54,7 @@ binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: debian/control build install
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs changelog.txt

View File

@ -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
* ---> start moving */
bool go_to_hangar = false;
switch (v->current_order.type) {
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;
case OT_GOTO_DEPOT: // visit hangar for serivicing, sale, etc.
if (v->current_order.dest == v->u.air.targetairport) {
v->u.air.state = HANGAR;
} else {
v->u.air.state = (v->subtype == AIR_HELICOPTER) ? HELITAKEOFF : TAKEOFF;
}
go_to_hangar = v->current_order.dest == v->u.air.targetairport;
break;
default: // orders have been deleted (no orders), goto depot and don't bother us
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);
}

View File

@ -39,6 +39,7 @@
#include "vehicle_func.h"
#include "vehicle_base.h"
#include "sound_func.h"
#include "roadveh.h"
#include "table/strings.h"
#include "table/sprites.h"
@ -329,7 +330,7 @@ static void DisasterTick_Ufo(Vehicle *v)
v->current_order.dest = 1;
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->age = 0;
return;
@ -340,7 +341,7 @@ static void DisasterTick_Ufo(Vehicle *v)
} else {
/* Target a vehicle */
u = GetVehicle(v->dest_tile);
if (u->type != VEH_ROAD) {
if (u->type != VEH_ROAD || !IsRoadVehFront(u)) {
DeleteDisasterVeh(v);
return;
}
@ -363,12 +364,16 @@ static void DisasterTick_Ufo(Vehicle *v)
v->age++;
if (u->u.road.crashed_ctr == 0) {
u->u.road.crashed_ctr++;
u->vehstatus |= VS_CRASHED;
AddNewsItem(STR_B001_ROAD_VEHICLE_DESTROYED,
NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
u->index,
0);
for (Vehicle *w = u; w != NULL; w = w->Next()) {
w->vehstatus |= VS_CRASHED;
MarkSingleVehicleDirty(w);
}
}
}

View File

@ -1258,8 +1258,8 @@ static int32 ConvertLandscape(const char *value)
static const SettingDesc _music_settings[] = {
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, effect_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, 127, 0, 127, 1, 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_BOOL(MusicFileSettings, playing, S, 0, true, STR_NULL, NULL),

View File

@ -1323,7 +1323,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
bool type = HasBit(p2, 0);
bool is_drive_through = HasBit(p2, 1);
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);
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;
RoadTypes cur_rts = IsNormalRoadTile(tile) ? GetRoadTypes(tile) : ROADTYPES_NONE;
uint num_roadbits = 0;
/* Not allowed to build over this 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 */
if (HasBit(cur_rts, 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 */
if (HasBit(cur_rts, ROADTYPE_TRAM)) {
Owner tram_owner = GetRoadOwner(tile, ROADTYPE_TRAM);
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 */
@ -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);
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;

View File

@ -846,11 +846,18 @@ static char* FormatString(char* buff, const char* str, const int64* argv, uint c
}
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);
} else if (st->name != NULL) {
break;
}
const Station *st = GetStation(sid);
if (st->name != NULL) {
buff = strecpy(buff, st->name, last);
} else {
int64 temp[3];

View File

@ -321,14 +321,15 @@ public:
TrackdirBits dst_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(dst_tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes));
Yapf().SetDestination(dst_tile, dst_td_bits);
// find the best path
Yapf().FindPath(v);
// if path not found - return distance = UINT_MAX
uint dist = UINT_MAX;
// find the best path
if (!Yapf().FindPath(v)) return dist;
Node *pNode = Yapf().GetBestNode();
if (pNode != NULL) {
// path was found or at least suggested
// path was found
// get the path cost estimate
dist = pNode->GetCostEstimate();
}