mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r27270) [1.5] -Backport from trunk:
- Fix: Duplicate frees due to pool item classes not having copy constructors [FS#6285] (r27243) - Fix: Crash when no AIs were installed due to improper handling of non-ASCII characters by the string pointer lexer [FS#6272] (r27233) - Fix: Compilation on DragonflyBSD [FS#6274] (r27224, r27223) - Fix: Use the current maximum speed as limited by bridges, orders etc. for all vehicle types alike when considering increased smoke emissions of vehicles [FS#6278] (r27222) - Fix: Multi-value keys in the desktop entry shall end with a trailing separator (r27221) - Fix: Draw path reservation on the whole bridge, not only on the bridge heads (r27209) - Fix: Draw correct overlay sprites for path reservations on bridges and tunnels (r27208)
This commit is contained in:
parent
09609e7a88
commit
de3f7697a5
96
config.lib
96
config.lib
|
@ -526,10 +526,10 @@ check_params() {
|
|||
log 1 " PREPROCESSOR is only available for OSX"
|
||||
exit 1
|
||||
fi
|
||||
# OS only allows DETECT, UNIX, OSX, FREEBSD, OPENBSD, MORPHOS, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP
|
||||
if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|PSP)$'`" ]; then
|
||||
# OS only allows DETECT, UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, MORPHOS, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP
|
||||
if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|PSP)$'`" ]; then
|
||||
log 1 "configure: error: invalid option --os=$os"
|
||||
log 1 " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|PSP]"
|
||||
log 1 " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|PSP]"
|
||||
exit 1
|
||||
fi
|
||||
# cpu_type can be either 32 or 64
|
||||
|
@ -1054,7 +1054,7 @@ check_params() {
|
|||
fi
|
||||
|
||||
if [ "$doc_dir" = "1" ]; then
|
||||
if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
|
||||
if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
|
||||
doc_dir="share/doc/openttd"
|
||||
else
|
||||
doc_dir="$data_dir/docs"
|
||||
|
@ -1064,7 +1064,7 @@ check_params() {
|
|||
fi
|
||||
|
||||
if [ "$icon_theme_dir" = "1" ]; then
|
||||
if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
|
||||
if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
|
||||
icon_theme_dir="share/icons/hicolor"
|
||||
else
|
||||
icon_theme_dir=""
|
||||
|
@ -1098,7 +1098,7 @@ check_params() {
|
|||
|
||||
if [ "$man_dir" = "1" ]; then
|
||||
# add manpage on UNIX systems
|
||||
if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OSX" ]; then
|
||||
if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OSX" ]; then
|
||||
man_dir="share/man/man6"
|
||||
else
|
||||
man_dir=""
|
||||
|
@ -1109,7 +1109,7 @@ check_params() {
|
|||
|
||||
if [ "$menu_dir" = "1" ]; then
|
||||
# add a freedesktop menu item only for some UNIX systems
|
||||
if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
|
||||
if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
|
||||
menu_dir="share/applications"
|
||||
else
|
||||
menu_dir=""
|
||||
|
@ -1538,7 +1538,7 @@ make_cflags_and_ldflags() {
|
|||
fi
|
||||
fi
|
||||
|
||||
if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "FREEBSD" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then
|
||||
if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then
|
||||
LIBS="$LIBS -lpthread"
|
||||
fi
|
||||
|
||||
|
@ -1565,10 +1565,6 @@ make_cflags_and_ldflags() {
|
|||
LIBS="$LIBS -pthread"
|
||||
fi
|
||||
|
||||
if [ "$os" = "FREEBSD" ]; then
|
||||
LIBS="$LIBS -lpthread"
|
||||
fi
|
||||
|
||||
if [ "$os" = "OSX" ]; then
|
||||
LDFLAGS="$LDFLAGS -framework Cocoa"
|
||||
|
||||
|
@ -1610,7 +1606,7 @@ make_cflags_and_ldflags() {
|
|||
fi
|
||||
|
||||
# Most targets act like UNIX, just with some additions
|
||||
if [ "$os" = "BEOS" ] || [ "$os" = "HAIKU" ] || [ "$os" = "OSX" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OS2" ]; then
|
||||
if [ "$os" = "BEOS" ] || [ "$os" = "HAIKU" ] || [ "$os" = "OSX" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OS2" ]; then
|
||||
CFLAGS="$CFLAGS -DUNIX"
|
||||
fi
|
||||
# And others like Windows
|
||||
|
@ -2268,52 +2264,54 @@ detect_awk() {
|
|||
|
||||
detect_os() {
|
||||
if [ "$os" = "DETECT" ]; then
|
||||
# Detect UNIX, OSX, FREEBSD, OPENBSD, NETBSD, HPUX, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP
|
||||
# Detect UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, HPUX, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP
|
||||
|
||||
# Try first via dumpmachine, then via uname
|
||||
os=`echo "$host" | tr '[A-Z]' '[a-z]' | $awk '
|
||||
/linux/ { print "UNIX"; exit}
|
||||
/darwin/ { print "OSX"; exit}
|
||||
/freebsd/ { print "FREEBSD"; exit}
|
||||
/openbsd/ { print "OPENBSD"; exit}
|
||||
/netbsd/ { print "NETBSD"; exit}
|
||||
/hp-ux/ { print "HPUX"; exit}
|
||||
/morphos/ { print "MORPHOS"; exit}
|
||||
/beos/ { print "BEOS"; exit}
|
||||
/haiku/ { print "HAIKU"; exit}
|
||||
/sunos/ { print "SUNOS"; exit}
|
||||
/solaris/ { print "SUNOS"; exit}
|
||||
/cygwin/ { print "CYGWIN"; exit}
|
||||
/mingw/ { print "MINGW"; exit}
|
||||
/os2/ { print "OS2"; exit}
|
||||
/dos/ { print "DOS"; exit}
|
||||
/wince/ { print "WINCE"; exit}
|
||||
/psp/ { print "PSP"; exit}
|
||||
/linux/ { print "UNIX"; exit}
|
||||
/darwin/ { print "OSX"; exit}
|
||||
/freebsd/ { print "FREEBSD"; exit}
|
||||
/dragonfly/ { print "DRAGONFLY"; exit}
|
||||
/openbsd/ { print "OPENBSD"; exit}
|
||||
/netbsd/ { print "NETBSD"; exit}
|
||||
/hp-ux/ { print "HPUX"; exit}
|
||||
/morphos/ { print "MORPHOS"; exit}
|
||||
/beos/ { print "BEOS"; exit}
|
||||
/haiku/ { print "HAIKU"; exit}
|
||||
/sunos/ { print "SUNOS"; exit}
|
||||
/solaris/ { print "SUNOS"; exit}
|
||||
/cygwin/ { print "CYGWIN"; exit}
|
||||
/mingw/ { print "MINGW"; exit}
|
||||
/os2/ { print "OS2"; exit}
|
||||
/dos/ { print "DOS"; exit}
|
||||
/wince/ { print "WINCE"; exit}
|
||||
/psp/ { print "PSP"; exit}
|
||||
'`
|
||||
|
||||
if [ -z "$os" ]; then
|
||||
os=`LC_ALL=C uname | tr '[A-Z]' '[a-z]' | $awk '
|
||||
/linux/ { print "UNIX"; exit}
|
||||
/darwin/ { print "OSX"; exit}
|
||||
/freebsd/ { print "FREEBSD"; exit}
|
||||
/openbsd/ { print "OPENBSD"; exit}
|
||||
/netbsd/ { print "NETBSD"; exit}
|
||||
/hp-ux/ { print "HPUX"; exit}
|
||||
/morphos/ { print "MORPHOS"; exit}
|
||||
/beos/ { print "BEOS"; exit}
|
||||
/haiku/ { print "HAIKU"; exit}
|
||||
/sunos/ { print "SUNOS"; exit}
|
||||
/cygwin/ { print "CYGWIN"; exit}
|
||||
/mingw/ { print "MINGW"; exit}
|
||||
/os\/2/ { print "OS2"; exit}
|
||||
/gnu/ { print "UNIX"; exit}
|
||||
/linux/ { print "UNIX"; exit}
|
||||
/darwin/ { print "OSX"; exit}
|
||||
/freebsd/ { print "FREEBSD"; exit}
|
||||
/dragonfly/ { print "DRAGONFLY"; exit}
|
||||
/openbsd/ { print "OPENBSD"; exit}
|
||||
/netbsd/ { print "NETBSD"; exit}
|
||||
/hp-ux/ { print "HPUX"; exit}
|
||||
/morphos/ { print "MORPHOS"; exit}
|
||||
/beos/ { print "BEOS"; exit}
|
||||
/haiku/ { print "HAIKU"; exit}
|
||||
/sunos/ { print "SUNOS"; exit}
|
||||
/cygwin/ { print "CYGWIN"; exit}
|
||||
/mingw/ { print "MINGW"; exit}
|
||||
/os\/2/ { print "OS2"; exit}
|
||||
/gnu/ { print "UNIX"; exit}
|
||||
'`
|
||||
fi
|
||||
|
||||
if [ -z "$os" ]; then
|
||||
log 1 "detecting OS... none detected"
|
||||
log 1 "I couldn't detect your OS. Please use --os=OS to force one"
|
||||
log 1 "Allowed values are: UNIX, OSX, FREEBSD, OPENBSD, NETBSD, MORPHOS, HPUX, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP"
|
||||
log 1 "Allowed values are: UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, MORPHOS, HPUX, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -3592,9 +3590,9 @@ showhelp() {
|
|||
echo " --awk=AWK the awk to use in configure [awk]"
|
||||
echo " --lipo=LIPO the lipo to use (OSX ONLY) [HOST-lipo]"
|
||||
echo " --os=OS the OS we are compiling for [DETECT]"
|
||||
echo " DETECT/UNIX/OSX/FREEBSD/OPENBSD/NETBSD/"
|
||||
echo " MORPHOS/HPUX/BEOS/SUNOS/CYGWIN/MINGW/OS2/"
|
||||
echo " DOS/WINCE/PSP/HAIKU"
|
||||
echo " DETECT/UNIX/OSX/FREEBSD/DRAGONFLY/OPENBSD/"
|
||||
echo " NETBSD/MORPHOS/HPUX/BEOS/SUNOS/CYGWIN/"
|
||||
echo " MINGW/OS2/DOS/WINCE/PSP/HAIKU"
|
||||
echo " --endian=ENDIAN set the endian of the HOST (AUTO/LE/BE)"
|
||||
echo ""
|
||||
echo "Paths:"
|
||||
|
|
|
@ -9,4 +9,4 @@ Exec=!!TTD!!
|
|||
Terminal=false
|
||||
Categories=!!MENU_GROUP!!
|
||||
Comment=A clone of Transport Tycoon Deluxe
|
||||
Keywords=game;simulation;transport;tycoon;deluxe;economics;multiplayer;money;train;ship;bus;truck;aircraft;cargo
|
||||
Keywords=game;simulation;transport;tycoon;deluxe;economics;multiplayer;money;train;ship;bus;truck;aircraft;cargo;
|
||||
|
|
|
@ -1261,10 +1261,28 @@ struct BufState{
|
|||
|
||||
WChar buf_lexfeed(SQUserPointer file)
|
||||
{
|
||||
BufState *buf=(BufState*)file;
|
||||
if(buf->size<(buf->ptr+1))
|
||||
return 0;
|
||||
return buf->buf[buf->ptr++];
|
||||
/* Convert an UTF-8 character into a WChar */
|
||||
BufState *buf = (BufState *)file;
|
||||
const char *p = &buf->buf[buf->ptr];
|
||||
|
||||
if (buf->size < buf->ptr + 1) return 0;
|
||||
|
||||
/* Read the first character, and get the length based on UTF-8 specs. If invalid, bail out. */
|
||||
uint len = Utf8EncodedCharLen(*p);
|
||||
if (len == 0) {
|
||||
buf->ptr++;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Read the remaining bits. */
|
||||
if (buf->size < buf->ptr + len) return 0;
|
||||
buf->ptr += len;
|
||||
|
||||
/* Convert the character, and when definitely invalid, bail out as well. */
|
||||
WChar c;
|
||||
if (Utf8Decode(&c, p) != len) return -1;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
SQRESULT sq_compilebuffer(HSQUIRRELVM v,const SQChar *s,SQInteger size,const SQChar *sourcename,SQBool raiseerror) {
|
||||
|
|
12
src/pbs.cpp
12
src/pbs.cpp
|
@ -85,7 +85,11 @@ bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations)
|
|||
|
||||
if (_settings_client.gui.show_track_reservation) {
|
||||
/* show the reserved rail if needed */
|
||||
MarkTileDirtyByTile(tile);
|
||||
if (IsBridgeTile(tile)) {
|
||||
MarkBridgeDirty(tile);
|
||||
} else {
|
||||
MarkTileDirtyByTile(tile);
|
||||
}
|
||||
}
|
||||
|
||||
switch (GetTileType(tile)) {
|
||||
|
@ -141,7 +145,11 @@ void UnreserveRailTrack(TileIndex tile, Track t)
|
|||
assert((GetTileTrackStatus(tile, TRANSPORT_RAIL, 0) & TrackToTrackBits(t)) != 0);
|
||||
|
||||
if (_settings_client.gui.show_track_reservation) {
|
||||
MarkTileDirtyByTile(tile);
|
||||
if (IsBridgeTile(tile)) {
|
||||
MarkBridgeDirty(tile);
|
||||
} else {
|
||||
MarkTileDirtyByTile(tile);
|
||||
}
|
||||
}
|
||||
|
||||
switch (GetTileType(tile)) {
|
||||
|
|
|
@ -48,21 +48,39 @@ static const SaveLoad _engine_desc[] = {
|
|||
SLE_END()
|
||||
};
|
||||
|
||||
static std::vector<Engine> _temp_engine;
|
||||
static std::vector<Engine*> _temp_engine;
|
||||
|
||||
/**
|
||||
* Allocate an Engine structure, but not using the pools.
|
||||
* The allocated Engine must be freed using FreeEngine;
|
||||
* @return Allocated engine.
|
||||
*/
|
||||
static Engine* CallocEngine()
|
||||
{
|
||||
uint8 *zero = CallocT<uint8>(sizeof(Engine));
|
||||
Engine *engine = new (zero) Engine();
|
||||
return engine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deallocate an Engine constructed by CallocEngine.
|
||||
* @param e Engine to free.
|
||||
*/
|
||||
static void FreeEngine(Engine *e)
|
||||
{
|
||||
if (e != NULL) {
|
||||
e->~Engine();
|
||||
free(e);
|
||||
}
|
||||
}
|
||||
|
||||
Engine *GetTempDataEngine(EngineID index)
|
||||
{
|
||||
if (index < _temp_engine.size()) {
|
||||
return &_temp_engine[index];
|
||||
return _temp_engine[index];
|
||||
} else if (index == _temp_engine.size()) {
|
||||
uint8 zero[sizeof(Engine)];
|
||||
memset(zero, 0, sizeof(zero));
|
||||
Engine *engine = new (zero) Engine();
|
||||
|
||||
/* Adding 'engine' to the vector makes a shallow copy, so we do not want to destruct 'engine' */
|
||||
_temp_engine.push_back(*engine);
|
||||
|
||||
return &_temp_engine[index];
|
||||
_temp_engine.push_back(CallocEngine());
|
||||
return _temp_engine[index];
|
||||
} else {
|
||||
NOT_REACHED();
|
||||
}
|
||||
|
@ -127,6 +145,9 @@ void CopyTempEngineData()
|
|||
}
|
||||
|
||||
/* Get rid of temporary data */
|
||||
for (std::vector<Engine*>::iterator it = _temp_engine.begin(); it != _temp_engine.end(); ++it) {
|
||||
FreeEngine(*it);
|
||||
}
|
||||
_temp_engine.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -2216,8 +2216,12 @@ static void ClearPathReservation(const Train *v, TileIndex tile, Trackdir track_
|
|||
SetTunnelBridgeReservation(end, false);
|
||||
|
||||
if (_settings_client.gui.show_track_reservation) {
|
||||
MarkTileDirtyByTile(tile);
|
||||
MarkTileDirtyByTile(end);
|
||||
if (IsBridge(tile)) {
|
||||
MarkBridgeDirty(tile);
|
||||
} else {
|
||||
MarkTileDirtyByTile(tile);
|
||||
MarkTileDirtyByTile(end);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1210,7 +1210,12 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
|||
|
||||
/* PBS debugging, draw reserved tracks darker */
|
||||
if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && HasTunnelBridgeReservation(ti->tile)) {
|
||||
DrawGroundSprite(DiagDirToAxis(tunnelbridge_direction) == AXIS_X ? rti->base_sprites.single_x : rti->base_sprites.single_y, PALETTE_CRASH);
|
||||
if (rti->UsesOverlay()) {
|
||||
SpriteID overlay = GetCustomRailSprite(rti, ti->tile, RTSG_OVERLAY);
|
||||
DrawGroundSprite(overlay + RTO_X + DiagDirToAxis(tunnelbridge_direction), PALETTE_CRASH);
|
||||
} else {
|
||||
DrawGroundSprite(DiagDirToAxis(tunnelbridge_direction) == AXIS_X ? rti->base_sprites.single_x : rti->base_sprites.single_y, PALETTE_CRASH);
|
||||
}
|
||||
}
|
||||
|
||||
if (HasCatenaryDrawn(GetRailType(ti->tile))) {
|
||||
|
@ -1320,11 +1325,20 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
|||
}
|
||||
|
||||
/* PBS debugging, draw reserved tracks darker */
|
||||
if (_game_mode != GM_MENU &&_settings_client.gui.show_track_reservation && HasTunnelBridgeReservation(ti->tile)) {
|
||||
if (HasBridgeFlatRamp(ti->tileh, DiagDirToAxis(tunnelbridge_direction))) {
|
||||
AddSortableSpriteToDraw(DiagDirToAxis(tunnelbridge_direction) == AXIS_X ? rti->base_sprites.single_x : rti->base_sprites.single_y, PALETTE_CRASH, ti->x, ti->y, 16, 16, 0, ti->z + 8);
|
||||
if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && HasTunnelBridgeReservation(ti->tile)) {
|
||||
if (rti->UsesOverlay()) {
|
||||
SpriteID overlay = GetCustomRailSprite(rti, ti->tile, RTSG_OVERLAY);
|
||||
if (HasBridgeFlatRamp(ti->tileh, DiagDirToAxis(tunnelbridge_direction))) {
|
||||
AddSortableSpriteToDraw(overlay + RTO_X + DiagDirToAxis(tunnelbridge_direction), PALETTE_CRASH, ti->x, ti->y, 16, 16, 0, ti->z + 8);
|
||||
} else {
|
||||
AddSortableSpriteToDraw(overlay + RTO_SLOPE_NE + tunnelbridge_direction, PALETTE_CRASH, ti->x, ti->y, 16, 16, 8, ti->z);
|
||||
}
|
||||
} else {
|
||||
AddSortableSpriteToDraw(rti->base_sprites.single_sloped + tunnelbridge_direction, PALETTE_CRASH, ti->x, ti->y, 16, 16, 8, ti->z);
|
||||
if (HasBridgeFlatRamp(ti->tileh, DiagDirToAxis(tunnelbridge_direction))) {
|
||||
AddSortableSpriteToDraw(DiagDirToAxis(tunnelbridge_direction) == AXIS_X ? rti->base_sprites.single_x : rti->base_sprites.single_y, PALETTE_CRASH, ti->x, ti->y, 16, 16, 0, ti->z + 8);
|
||||
} else {
|
||||
AddSortableSpriteToDraw(rti->base_sprites.single_sloped + tunnelbridge_direction, PALETTE_CRASH, ti->x, ti->y, 16, 16, 8, ti->z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1467,6 +1481,16 @@ void DrawBridgeMiddle(const TileInfo *ti)
|
|||
AddSortableSpriteToDraw(surface + axis, PAL_NONE, x, y, 16, 16, 0, bridge_z, IsTransparencySet(TO_BRIDGES));
|
||||
}
|
||||
}
|
||||
|
||||
if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && !IsInvisibilitySet(TO_BRIDGES) && HasTunnelBridgeReservation(rampnorth)) {
|
||||
if (rti->UsesOverlay()) {
|
||||
SpriteID overlay = GetCustomRailSprite(rti, ti->tile, RTSG_OVERLAY);
|
||||
AddSortableSpriteToDraw(overlay + RTO_X + axis, PALETTE_CRASH, ti->x, ti->y, 16, 16, 0, bridge_z, IsTransparencySet(TO_BRIDGES));
|
||||
} else {
|
||||
AddSortableSpriteToDraw(axis == AXIS_X ? rti->base_sprites.single_x : rti->base_sprites.single_y, PALETTE_CRASH, ti->x, ti->y, 16, 16, 0, bridge_z, IsTransparencySet(TO_BRIDGES));
|
||||
}
|
||||
}
|
||||
|
||||
EndSpriteCombine();
|
||||
|
||||
if (HasCatenaryDrawn(GetRailType(rampsouth))) {
|
||||
|
|
|
@ -2414,7 +2414,9 @@ void Vehicle::ShowVisualEffect() const
|
|||
return;
|
||||
}
|
||||
|
||||
uint max_speed = this->vcache.cached_max_speed;
|
||||
/* Use the speed as limited by underground and orders. */
|
||||
uint max_speed = this->GetCurrentMaxSpeed();
|
||||
|
||||
if (this->type == VEH_TRAIN) {
|
||||
const Train *t = Train::From(this);
|
||||
/* For trains, do not show any smoke when:
|
||||
|
@ -2423,14 +2425,10 @@ void Vehicle::ShowVisualEffect() const
|
|||
*/
|
||||
if (HasBit(t->flags, VRF_REVERSING) ||
|
||||
(IsRailStationTile(t->tile) && t->IsFrontEngine() && t->current_order.ShouldStopAtStation(t, GetStationIndex(t->tile)) &&
|
||||
t->cur_speed >= t->Train::GetCurrentMaxSpeed())) {
|
||||
t->cur_speed >= max_speed)) {
|
||||
return;
|
||||
}
|
||||
|
||||
max_speed = min(max_speed, t->gcache.cached_max_track_speed);
|
||||
max_speed = min(max_speed, this->current_order.GetMaxSpeed());
|
||||
}
|
||||
if (this->type == VEH_ROAD || this->type == VEH_SHIP) max_speed = min(max_speed, this->current_order.GetMaxSpeed() * 2);
|
||||
|
||||
const Vehicle *v = this;
|
||||
|
||||
|
|
Loading…
Reference in New Issue