1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-29 09:29:10 +00:00

Compare commits

...

8 Commits

Author SHA1 Message Date
rubidium
ab2da92d76 (svn r18618) [0.7] -Update: documentation for 0.7.5 2009-12-23 19:56:03 +00:00
rubidium
ab03517694 (svn r18500) [0.7] -Backport from trunk:
- Fix: Read after free in case no network connection could be made with the content server (r18493)
- Fix: [NoAI] AIOrder::SkipToOrder did not properly resolve ORDER_CURRENT (r18471)
[0.7] -Prepare for 0.7.5-RC1
2009-12-14 20:50:32 +00:00
rubidium
0df9eddc9c (svn r18478) [0.7] -Backport from trunk:
- Fix: When moving a wagon and only the last part of a dual headed engine you could split the dual headed engine over two vehicles (r18462)
- Fix: [Windows] Forgot to load the symbol from SDL.dll (r18439)
- Fix: Do not run the 'jam protection' for vehicles in a depot [FS#3360] (r18428)
- Fix: [Windows] the help window would be too large in some cases [FS#3327] (r18424)
- Fix: Under some circumstances a pointer could be left untouched and then freed. Make sure this does not happen by ensuring it starts out as NULL instead of 'garbage' [FS#3298] (r18418)
2009-12-13 00:33:00 +00:00
rubidium
ff67ed58da (svn r18477) [0.7] -Backport from trunk:
- Fix: On slopes the original and better road layouts did not check their minimum distance requirements [FS#3332] (r18415)
- Fix: Aqueducts were not influenced by the "long bridges" setting [FS#3338] (r18407)
- Fix: Drive through road stops did not get flooded (r18401)
- Fix: [YAPP] Trains on bridges were not found, when searching for the origin of a reservation [FS#3345] (r18392)
2009-12-13 00:24:53 +00:00
rubidium
fd89332101 (svn r18476) [0.7] -Backport from trunk:
- Fix: (Invalid) GRFs could trigger invalid reads (r18391)
- Fix: One could not share orders between buses carrying different cargos (r18380)
- Fix: Off-by-one in the preconfigured music lists [FS#3339] (r18369)
- Change [FS#3349]: Recolour the bubble generator just like any other industry (r18409)
- Add: Some missing latin-ish characters from the OpenGFX set (r18431)
2009-12-13 00:13:06 +00:00
frosch
8808835412 (svn r18475) [0.7] -Fix (r18300)[FS#3344]: Initialisation of cargo payment works different in 0.7 than trunk r18207. 2009-12-12 23:56:41 +00:00
rubidium
b6834cf135 (svn r18354) [0.7] -Backport from trunk:
- Fix: Endianness issue with saving the zoom level [FS#3333] (r18351)
[0.7] -Prepare for 0.7.4
2009-11-30 23:59:42 +00:00
rubidium
a1fb44c417 (svn r18300) [0.7] -Backport from trunk:
- Update: readme / AI changelog (r18299, r18298)
- Fix: [NewGRF] When starting a new game the values of action D variable 13 were incorrect [FS#3324] (r18207)
- Add: Experimental option to try to statically link to libicu (r18147)
- Change: One more developer added to the history of OpenTTD (r18111)
2009-11-26 16:53:41 +00:00
40 changed files with 242 additions and 80 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -24,7 +24,7 @@ TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8
TRGC.GRF = ed446637e034104c5559b32c18afe78d
TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
TRGT.GRF = e30e8a398ae86c03dc534a8ac7dfb3b6
OPENTTDD.GRF = c886c7d5b38a93f2cb1cdc0d33472eb8
OPENTTDD.GRF = 2e1f3667175e8eeb013ea35881ecffb7
[origin]
default = You can find it on your Transport Tycoon Deluxe CD-ROM.

View File

@@ -24,7 +24,7 @@ TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8
TRGC.GRF = ed446637e034104c5559b32c18afe78d
TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
TRGT.GRF = fcde1d7e8a74197d72a62695884b909e
OPENTTDD.GRF = c886c7d5b38a93f2cb1cdc0d33472eb8
OPENTTDD.GRF = 2e1f3667175e8eeb013ea35881ecffb7
[origin]
default = You can find it on your Transport Tycoon Deluxe CD-ROM.

View File

@@ -24,7 +24,7 @@ TRGIR.GRF = 0c2484ff6be49fc63a83be6ab5c38f32
TRGCR.GRF = 3668f410c761a050b5e7095a2b14879b
TRGHR.GRF = 06bf2b7a31766f048baac2ebe43457b1
TRGTR.GRF = de53650517fe661ceaa3138c6edb0eb8
OPENTTDW.GRF = b6689105405fa3ea34cb8a5543633d29
OPENTTDW.GRF = a73ff4dce8936fadc02dea183afad638
[origin]
default = You can find it on your Transport Tycoon Deluxe CD-ROM.

View File

@@ -1,3 +1,35 @@
0.7.5 (2009-12-23)
------------------------------------------------------------------------
(None)
0.7.5-RC1 (2009-12-14)
------------------------------------------------------------------------
- Add: Some missing latin-ish characters from the OpenGFX set (r18431)
- Change: Recolour the bubble generator just like any other industry [FS#3349] (r18409)
- Fix: Read after free in case no network connection could be made with the content server (r18493)
- Fix: [NewGRF] Initialisation of cargo payment was broken for NewGRF cargos [FS#3344] (r18475)
- Fix: [NoAI] AIOrder::SkipToOrder did not properly resolve ORDER_CURRENT (r18471)
- Fix: When moving a wagon and only the last part of a dual headed engine you could split the dual headed engine over two vehicles. This could be used to crash servers [CVE-2009-4007] (r18462)
- Fix: [Windows] Forgot to load the symbol from SDL.dll (r18439)
- Fix: Do not run the 'jam protection' for vehicles in a depot [FS#3360] (r18428)
- Fix: [Windows] the help window would be too large in some cases [FS#3327] (r18424)
- Fix: Under some circumstances a pointer could be left untouched and then freed. Make sure this does not happen by ensuring it starts out as NULL instead of 'garbage' [FS#3298] (r18418)
- Fix: On slopes the original and better road layouts did not check their minimum distance requirements [FS#3332] (r18415)
- Fix: Aqueducts were not influenced by the 'long bridges' setting [FS#3338] (r18407)
- Fix: Drive through road stops did not get flooded (r18401)
- Fix: [YAPP] Trains on bridges were not found, when searching for the origin of a reservation [FS#3345] (r18392)
- Fix: (Invalid) GRFs could trigger invalid reads (r18391)
- Fix: One could not share orders between buses carrying different cargos (r18380)
- Fix: Off-by-one in the preconfigured music lists [FS#3339] (r18369)
0.7.4 (2009-12-01)
------------------------------------------------------------------------
- Fix: Endianness issue with saving the zoom level [FS#3333] (r18351)
- Fix: [NewGRF] When starting a new game the values of action D variable 13 were incorrect [FS#3324] (r18207)
0.7.4-RC1 (2009-11-15)
------------------------------------------------------------------------
- Change: Prefer extmidi over allegro midi and allegro over null driver [FS#3272] (r17875)
@@ -620,7 +652,7 @@
- Fix: In some cases the sprite cache could be filled with unremovable items [FS#2153] (r13869)
- Fix: Return of wrong parent scope of (NewGRF) industry variables (r13868)
- Fix: Loading of TTD(Patch) savegames from the command line did not work (r13859)
- Fix: Buffer overflow for too long filename supplied as '-g' parameter (r13858)
- Fix: Buffer overflow for too long filename supplied as '-g' parameter [CVE-2008-3577] (r13858)
- Fix: Cargo type lookup was incorrect for NewGRF version 7 files without a translation table [FS#2157] (r13855)
- Fix: GetTownByTile() is only valid for houses and roads (r13851)
- Fix: Power, running cost and capacity of multiheaded engines were (too often) doubled in newspaper resp. offer window (r13844)
@@ -641,13 +673,13 @@
- Fix: Possible desync on the autorenew settings 20+ game years (i.e. 4.5+ hours) after a company was started (r13718)
- Fix: Any player could construct new companies [FS#2144] (r13716)
- Fix: Remove the unique_id from the message that a client has joined as it is only exposes the unique_id more than needed (r13714)
- Fix: Possible crash on creating a network packet (r13713)
- Fix: Possible crash on creating a network packet [CVE-2008-3547] (r13713)
- Fix: Enforce the length restrictions of company and president name in the commands too (r13712)
0.6.2-RC1 (2008-07-16)
------------------------------------------------------------------------
- Fix: Possible buffer overflow in string truncation code (r13700)
- Fix: Possible buffer overflow in string truncation code [CVE-2008-3576] (r13700)
- Fix: Handle SETX(Y) properly when truncating a string instead of ignoring it and returning a too long string (r13699)
- Fix: In some cases the (sound) mixer could overflow causing artefacts in the sound [FS#2120] (r13695)
- Fix: Do not rely on .tar files always ending with a block of zeros (r13693)
@@ -1706,7 +1738,7 @@
- Fix: Danish town names were saved/loaded as Swiss
- Fix: Removing roads on crossings was done without a check for ownership
- Fix: [Autoreplace] Fix drawing of train list for outdated engines
- Fix: Malicious clients/servers could crash the game
- Fix: Malicious clients/servers could crash the game [CVE-2006-1999, CVE-2006-1998]
- Fix: [Autoreplace] allow replacement of wagons even when the engine fails to be replaced
- Fix: Certain operations involving trains inside a depot could cause a crash
- Fix: [Autoreplace] cost for refitting a new vehicle is added to the cost animation (player always paid for it, it just was not shown)
@@ -1856,7 +1888,7 @@
- Fix: On OS/2 show the trailing \ if the current directory is a root directory (r2860)
- Fix: Return a proper version number, when testing the TTDPatch version in the SkipIf action (r2862)
- Fix: Change the way NewGRFs are loaded, this saves quite some sprite slots - about 2000 for DBSetXL for example (r2868)
- Fix: Several format string vulnerabilities and buffer overflows in the network code (r2899)
- Fix: Several format string vulnerabilities and buffer overflows in the network code [CVE-2005-2764, CVE-2005-2763] (r2899)
- Fix: fixed issue where autorenewed vehicles did not get all stats updated (r2912)
- Fix: Exit the child of the extmidi backend with _exit() instead of exit(), because we do not want any atexit handlers - especially flushing output streams - to run, if exec() fails (r2938)
- Fix: Server crash with 'say'-command (r2950)

View File

@@ -71,6 +71,7 @@ set_default() {
with_freetype="1"
with_fontconfig="1"
with_icu="1"
static_icu="0"
with_psp_config="1"
with_threads="1"
with_distcc="1"
@@ -137,6 +138,7 @@ set_default() {
with_freetype
with_fontconfig
with_icu
static_icu
with_psp_config
with_threads
with_distcc
@@ -334,6 +336,10 @@ detect_params() {
--with-libicu) with_icu="2";;
--without-libicu) with_icu="0";;
--with-libicu=*) with_icu="$optarg";;
--static-icu) static_icu="1";;
--static-icu=*) static_icu="$optarg";;
--static-libicu) static_icu="1";;
--static-libicu=*) static_icu="$optarg";;
--with-psp-config) with_psp_config="2";;
--without-psp-config) with_psp_config="0";;
@@ -1302,7 +1308,11 @@ make_cflags_and_ldflags() {
CFLAGS="$CFLAGS `$icu_config --cppflags | tr '\n\r' ' '`"
# Some icu-configs have the 'feature' of not adding a space where others do add the space
LIBS="$LIBS `$icu_config --ldflags-searchpath` `$icu_config --ldflags-libsonly | tr '\n\r' ' '`"
if [ "$static_icu" != "0" ]; then
LIBS="$LIBS `$icu_config --ldflags-searchpath` `$icu_config --ldflags-libsonly | tr '\n\r' ' ' | sed s/licu/lsicu/g`"
else
LIBS="$LIBS `$icu_config --ldflags-searchpath` `$icu_config --ldflags-libsonly | tr '\n\r' ' '`"
fi
fi
@@ -2845,6 +2855,8 @@ showhelp() {
echo " --with-fontconfig[=pkg-config fontconfig]"
echo " enables fontconfig support"
echo " --with-icu[=icu-config] enables icu (used for right-to-left support)"
echo " --static-icu try to link statically (libsicu instead of"
echo " libicu; can fail as the new name is guessed)"
echo " --with-iconv[=iconv-path] enables iconv support"
echo " --with-psp-config[=psp-config] enables psp-config support (PSP ONLY)"
echo " --with-makedepend[=makedepend] enables makedepend support"

View File

@@ -1,6 +1,6 @@
OpenTTD's known bugs
Last updated: 2009-11-15
Release version: 0.7.4-RC1
Last updated: 2009-12-23
Release version: 0.7.5
------------------------------------------------------------------------
@@ -62,6 +62,17 @@ reasons why we think that fixing them is infeasible. We might make some
minor improvements that reduce the scope of these bugs, but we will not
be able to completely fix them.
No suitable AI can be found
If you have no AIs and an AI is started the so-called 'dummy' AI will
be loaded. This AI does nothing but writing a message on the AI debug
window and showing a red warning. There are basically two solutions
for this problem: you must change the settings so no AI is started,
this is done in the difficulty settings window. The other solution is
acquiring (downloading) some AI. The easiest way to do this is via
the "Check Online Content" button in the main (intro) menu or via
"AI Settings" -> "Select AI" -> "Check Online Content" which is also
accessed via the main menu.
Clipping problems [FS#119]
In some cases sprites are not drawn as one would expect. Examples of
this are aircraft that might be hidden below the runway or trees that

View File

@@ -1,3 +1,21 @@
openttd (0.7.5) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Wed, 23 Dec 2009 20:52:34 +0100
openttd (0.7.5~RC1) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Mon, 14 Dec 2009 19:28:37 +0100
openttd (0.7.4) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Tue, 01 Dec 2009 01:23:45 +0100
openttd (0.7.4~RC1) unstable; urgency=low
* New upstream release.

View File

@@ -13,7 +13,7 @@
#-------------------------------------------------------------------------------
Name: openttd
Version: 0.7.4
Version: 0.7.5
Release: 1%{?dist}
Group: Amusements/Games

View File

@@ -1,7 +1,7 @@
!define APPNAME "OpenTTD" ; Define application name
!define APPVERSION "0.7.4-RC1" ; Define application version
!define APPVERSIONINTERNAL "0.7.4.0" ; Define application version in X.X.X.X
!define INSTALLERVERSION 69 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
!define APPVERSION "0.7.5" ; Define application version
!define APPVERSIONINTERNAL "0.7.5.0" ; Define application version in X.X.X.X
!define INSTALLERVERSION 72 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
!include ${VERSION_INCLUDE}
!define APPURLLINK "http://www.openttd.org"

View File

@@ -1,6 +1,6 @@
OpenTTD README
Last updated: 2009-11-15
Release version: 0.7.4-RC1
Last updated: 2009-12-23
Release version: 0.7.5
------------------------------------------------------------------------
@@ -175,6 +175,15 @@ If you want savegames and screenshots in the directory where the OpenTTD binary
resides, simply have your config file in that location. But if you remove this
config file, savegames will still be in this directory (see notes in section 4.2)
OpenTTD comes without AIs, so if you want to play with AIs you have to download
them. The easiest way is via the "Check Online Content" button in the main menu.
You can select some AIs that you think are compatible with your playing style.
Another way is manually downloading the AIs from the forum although then you
need to make sure that you install all the required AI libraries too; they get
automatically selected (and downloaded) if you get the AIs via the "Check
Online Content". If you do not have an AI but have configured OpenTTD to start
an AI a message will be shown that the 'dummy' AI has been started.
4.1) (Required) 3rd party files:
---- ---------------------------
@@ -489,6 +498,7 @@ put them in the data/ folder and you're set to go.
X.X) Credits:
---- --------
The OpenTTD team (in alphabetical order):
Albert Hofkamp (Alberth) - GUI expert
Jean-Francois Claeys (Belugas) - GUI, newindustries and more
Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles
Matthijs Kooijman (blathijs) - Pathfinder-guru, pool rework

View File

@@ -162,6 +162,12 @@ bool AIFileInfo::CheckMethod(const char *name) const
return 0;
}
AIInfo::AIInfo() :
min_loadable_version(0),
use_as_random(false)
{
}
AIInfo::~AIInfo()
{
/* Free all allocated strings */

View File

@@ -41,7 +41,7 @@ public:
friend class AIInfo;
friend class AILibrary;
AIFileInfo() : SQ_instance(NULL), main_script(NULL), author(NULL), name(NULL), short_name(NULL), description(NULL), date(NULL), instance_name(NULL), url(NULL) {};
AIFileInfo() : SQ_instance(NULL), main_script(NULL), author(NULL), name(NULL), short_name(NULL), description(NULL), date(NULL), instance_name(NULL), version(0), url(NULL) {};
~AIFileInfo();
/**
@@ -123,6 +123,7 @@ class AIInfo : public AIFileInfo {
public:
static const char *GetClassName() { return "AIInfo"; }
AIInfo();
~AIInfo();
/**

View File

@@ -14,6 +14,14 @@
* functions may still be available if you return an older API version
* in GetAPIVersion() in info.nut.
*
* \b 0.7.5
*
* No changes
*
* \b 0.7.4
*
* No changes
*
* \b 0.7.3
*
* API additions:
@@ -29,7 +37,7 @@
* \li AIs are now killed when they execute a DoCommand or Sleep at a time
* they are not allowed to do so.
* \li When the API requests a string as parameter you can give every squirrel
* type and it'll be converted to a string
* type and it will be converted to a string
* \li AIs can create subclasses of API classes and use API constants as part
* of their own constants
*

View File

@@ -393,6 +393,8 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
/* static */ bool AIOrder::SkipToOrder(VehicleID vehicle_id, OrderPosition next_order)
{
next_order = AIOrder::ResolveOrderPosition(vehicle_id, next_order);
EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, next_order));
return AIObject::DoCommand(0, vehicle_id, next_order, CMD_SKIP_TO_ORDER);

View File

@@ -188,11 +188,7 @@
/* static */ bool AIVehicle::SkipToVehicleOrder(VehicleID vehicle_id, AIOrder::OrderPosition order_position)
{
order_position = AIOrder::ResolveOrderPosition(vehicle_id, order_position);
EnforcePrecondition(false, AIOrder::IsValidVehicleOrder(vehicle_id, order_position));
return AIObject::DoCommand(0, vehicle_id, order_position, CMD_SKIP_TO_ORDER);
return AIOrder::SkipToOrder(vehicle_id, order_position);
}
/* static */ bool AIVehicle::ReverseVehicle(VehicleID vehicle_id)

View File

@@ -4,6 +4,7 @@
#include "stdafx.h"
#include "openttd.h"
#include "functions.h"
#include "landscape.h"
#include "company_func.h"
#include "variables.h"
@@ -277,18 +278,22 @@ void GenerateWorld(GenerateWorldMode mode, uint size_x, uint size_y, bool reset_
/* Set the date before loading sprites as some newgrfs check it */
SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
InitializeGame(_gw.size_x, _gw.size_y, false, reset_settings);
PrepareGenerateWorldProgress();
/* Load the right landscape stuff */
GfxLoadSprites();
LoadStringWidthTable();
InitializeGame(_gw.size_x, _gw.size_y, false, reset_settings);
PrepareGenerateWorldProgress();
/* Initialise cargo payment */
InitializeLandscapeVariables(false);
/* Re-init the windowing system */
ResetWindowSystem();
/* Create toolbars */
SetupColoursAndInitialWindow();
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0);
if (_gw.thread != NULL) {
_gw.thread->Join();

View File

@@ -64,7 +64,7 @@ static ReusableBuffer<uint8> _cursor_backup;
*/
static Rect _invalid_rect;
static const byte *_colour_remap_ptr;
static byte _string_colourremap[3];
static byte _string_colourremap[3]; ///< Recoloursprite for stringdrawing. The grf loader ensures, that ST_FONT sprites only use colours 0 to 2.
enum {
DIRTY_BLOCK_HEIGHT = 8,

View File

@@ -59,8 +59,6 @@ void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settin
AllocateMap(size_x, size_y);
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0);
_pause_game = 0;
_fast_forward = 0;
_tick_counter = 0;

View File

@@ -310,6 +310,7 @@ struct AboutWindow : public Window {
"Original graphics by Simon Foster",
"",
"The OpenTTD team (in alphabetical order):",
" Albert Hofkamp (Alberth) - GUI expert",
" Jean-Francois Claeys (Belugas) - GUI, newindustries and more",
" Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles",
" Matthijs Kooijman (blathijs) - Pathfinder-guru, pool rework",

View File

@@ -29,15 +29,15 @@ static byte _playlist_all[] = {
};
static byte _playlist_old_style[] = {
1, 8, 2, 9, 14, 15, 19, 13, 0
2, 9, 3, 10, 15, 16, 20, 14, 0
};
static byte _playlist_new_style[] = {
6, 11, 10, 17, 21, 18, 5, 0
7, 12, 11, 18, 22, 19, 6, 0
};
static byte _playlist_ezy_street[] = {
12, 7, 16, 3, 20, 4, 0
13, 8, 17, 4, 21, 5, 0
};
static byte * const _playlists[] = {

View File

@@ -711,6 +711,7 @@ public:
if (!success) {
ShowErrorMessage(INVALID_STRING_ID, STR_CONTENT_ERROR_COULD_NOT_CONNECT, 0, 0);
delete this;
return;
}
this->SetDirty();

View File

@@ -1094,9 +1094,8 @@ CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
return CMD_ERROR;
/* Trucks can't share orders with busses (and visa versa) */
if (src->type == VEH_ROAD) {
if (src->cargo_type != dst->cargo_type && (IsCargoInClass(src->cargo_type, CC_PASSENGERS) || IsCargoInClass(dst->cargo_type, CC_PASSENGERS)))
return CMD_ERROR;
if (src->type == VEH_ROAD && IsCargoInClass(src->cargo_type, CC_PASSENGERS) != IsCargoInClass(dst->cargo_type, CC_PASSENGERS)) {
return CMD_ERROR;
}
/* Is the vehicle already in the shared list? */

View File

@@ -57,6 +57,17 @@ BEGIN
END
101 DIALOG DISCARDABLE 0, 0, 600, 400
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "OpenTTD command line help"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "&OK",12,274,378,50,14,BS_CENTER
EDITTEXT 11,7,6,583,365,ES_MULTILINE | ES_READONLY | WS_VSCROLL | WS_HSCROLL
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//

View File

@@ -233,7 +233,9 @@ static Vehicle *FindTrainOnTrackEnum(Vehicle *v, void *data)
{
FindTrainOnTrackInfo *info = (FindTrainOnTrackInfo *)data;
if (v->type == VEH_TRAIN && !(v->vehstatus & VS_CRASHED) && HasBit((TrackBits)v->u.rail.track, TrackdirToTrack(info->res.trackdir))) {
if (v->type != VEH_TRAIN || (v->vehstatus & VS_CRASHED)) return NULL;
if (v->u.rail.track == TRACK_BIT_WORMHOLE || HasBit((TrackBits)v->u.rail.track, TrackdirToTrack(info->res.trackdir))) {
v = v->First();
/* ALWAYS return the lowest ID (anti-desync!) */

View File

@@ -736,7 +736,7 @@ static Vehicle *EnumCheckRoadVehClose(Vehicle *v, void *data)
return NULL;
}
static Vehicle *RoadVehFindCloseTo(Vehicle *v, int x, int y, Direction dir)
static Vehicle *RoadVehFindCloseTo(Vehicle *v, int x, int y, Direction dir, bool update_blocked_ctr = true)
{
RoadVehFindData rvf;
Vehicle *front = v->First();
@@ -765,7 +765,7 @@ static Vehicle *RoadVehFindCloseTo(Vehicle *v, int x, int y, Direction dir)
return NULL;
}
if (++front->u.road.blocked_ctr > 1480) return NULL;
if (update_blocked_ctr && ++front->u.road.blocked_ctr > 1480) return NULL;
return rvf.best;
}
@@ -1227,7 +1227,7 @@ static bool RoadVehLeaveDepot(Vehicle *v, bool first)
int y = TileY(v->tile) * TILE_SIZE + (rdp[RVC_DEPOT_START_FRAME].y & 0xF);
if (first) {
if (RoadVehFindCloseTo(v, x, y, v->direction) != NULL) return true;
if (RoadVehFindCloseTo(v, x, y, v->direction, false) != NULL) return true;
VehicleServiceInDepot(v);

View File

@@ -23,6 +23,7 @@ extern TileIndex _cur_tileloop_tile;
/* Keep track of current game position */
int _saved_scrollpos_x;
int _saved_scrollpos_y;
ZoomLevelByte _saved_scrollpos_zoom;
void SaveViewportBeforeSaveGame()
{
@@ -45,7 +46,7 @@ void ResetViewportAfterLoadGame()
w->viewport->dest_scrollpos_y = _saved_scrollpos_y;
ViewPort *vp = w->viewport;
vp->zoom = min(_saved_scrollpos_zoom, ZOOM_LVL_MAX);
vp->zoom = (ZoomLevel)min(_saved_scrollpos_zoom, ZOOM_LVL_MAX);
vp->virtual_width = ScaleByZoom(vp->width, vp->zoom);
vp->virtual_height = ScaleByZoom(vp->height, vp->zoom);

View File

@@ -36,6 +36,7 @@ void CopyTempEngineData();
extern int32 _saved_scrollpos_x;
extern int32 _saved_scrollpos_y;
extern ZoomLevelByte _saved_scrollpos_zoom;
extern SavegameType _savegame_type;
extern uint32 _ttdp_version;

View File

@@ -61,6 +61,7 @@ static const char sdl_files[] =
M("SDL_SetColorKey")
M("SDL_WM_SetIcon")
M("SDL_MapRGB")
M("SDL_VideoModeOK")
M("")
;
#undef M

View File

@@ -121,7 +121,11 @@ bool SpriteLoaderGrf::LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot,
}
for (int x = 0; x < length; x++) {
data->m = ((sprite_type == ST_NORMAL && _palette_remap_grf[file_slot]) ? _palette_remap[*dest] : *dest);
switch (sprite_type) {
case ST_NORMAL: data->m = _palette_remap_grf[file_slot] ? _palette_remap[*dest] : *dest; break;
case ST_FONT: data->m = min(*dest, 2u); break;
default: data->m = *dest; break;
}
dest++;
data++;
}
@@ -142,7 +146,11 @@ bool SpriteLoaderGrf::LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot,
dest = dest_orig;
for (int i = 0; i < sprite->width * sprite->height; i++) {
sprite->data[i].m = ((sprite_type == ST_NORMAL && _palette_remap_grf[file_slot]) ? _palette_remap[dest[i]] : dest[i]);
switch (sprite_type) {
case ST_NORMAL: sprite->data[i].m = _palette_remap_grf[file_slot] ? _palette_remap[dest[i]] : dest[i]; break;
case ST_FONT: sprite->data[i].m = min(dest[i], 2u); break;
default: sprite->data[i].m = dest[i]; break;
}
}
}

View File

@@ -3154,6 +3154,9 @@ static void ChangeTileOwner_Station(TileIndex tile, Owner old_owner, Owner new_o
*/
static bool CanRemoveRoadWithStop(TileIndex tile, DoCommandFlag flags)
{
/* Yeah... water can always remove stops, right? */
if (_current_company == OWNER_WATER) return true;
Owner road_owner = _current_company;
Owner tram_owner = _current_company;

View File

@@ -684,17 +684,17 @@ static const DrawBuildingsTileStruct _industry_draw_tile_data[NEW_INDUSTRYTILEOF
M( 0x1244, PAL_NONE, 0x1282 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 16, 16, 50, 0),
M( 0x1244, PAL_NONE, 0x1285 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 16, 16, 50, 0),
M( 0x1243, PAL_NONE, 0x0, PAL_NONE, 0, 0, 16, 16, 50, 0),
M( 0x1243, PAL_NONE, 0x1287, PALETTE_TO_RED, 0, 0, 16, 16, 50, 0),
M( 0x1243, PAL_NONE, 0x1287, PALETTE_TO_RED, 0, 0, 16, 16, 50, 0),
M( 0x1243, PAL_NONE, 0x1287, PALETTE_TO_RED, 0, 0, 16, 16, 50, 0),
M( 0x1243, PAL_NONE, 0x1287 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 16, 16, 50, 0),
M( 0x1243, PAL_NONE, 0x1287 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 16, 16, 50, 0),
M( 0x1243, PAL_NONE, 0x1287 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 16, 16, 50, 0),
M( 0x1244, PAL_NONE, 0x0, PAL_NONE, 0, 0, 16, 16, 50, 0),
M( 0x1244, PAL_NONE, 0x1288, PALETTE_TO_RED, 0, 0, 16, 16, 50, 0),
M( 0x1244, PAL_NONE, 0x1288, PALETTE_TO_RED, 0, 0, 16, 16, 50, 0),
M( 0x1244, PAL_NONE, 0x1288, PALETTE_TO_RED, 0, 0, 16, 16, 50, 0),
M( 0x1244, PAL_NONE, 0x1288 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 16, 16, 50, 0),
M( 0x1244, PAL_NONE, 0x1288 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 16, 16, 50, 0),
M( 0x1244, PAL_NONE, 0x1288 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 16, 16, 50, 0),
M( 0x1243, PAL_NONE, 0x0, PAL_NONE, 0, 0, 16, 16, 50, 0),
M( 0x1243, PAL_NONE, 0x1289, PALETTE_TO_RED, 0, 0, 16, 16, 50, 3),
M( 0x1243, PAL_NONE, 0x1289, PALETTE_TO_RED, 0, 0, 16, 16, 50, 3),
M( 0x1243, PAL_NONE, 0x1289, PALETTE_TO_RED, 0, 0, 16, 16, 50, 3),
M( 0x1243, PAL_NONE, 0x1289 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 16, 16, 50, 3),
M( 0x1243, PAL_NONE, 0x1289 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 16, 16, 50, 3),
M( 0x1243, PAL_NONE, 0x1289 | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 16, 16, 50, 3),
M( 0x1244, PAL_NONE, 0x0, PAL_NONE, 0, 0, 16, 16, 50, 0),
M( 0x1244, PAL_NONE, 0x0, PAL_NONE, 0, 0, 16, 16, 50, 0),
M( 0x1244, PAL_NONE, 0x0, PAL_NONE, 0, 0, 16, 16, 50, 0),

View File

@@ -760,19 +760,8 @@ static bool IsRoadAllowedHere(Town *t, TileIndex tile, DiagDirection dir)
}
cur_slope = _settings_game.construction.build_on_slopes ? GetFoundationSlope(tile, NULL) : GetTileSlope(tile, NULL);
if (cur_slope == SLOPE_FLAT) {
no_slope:
/* Tile has no slope */
switch (t->layout) {
default: NOT_REACHED();
case TL_ORIGINAL: // Disallow the road if any neighboring tile has a road (distance: 1)
return !IsNeighborRoadTile(tile, dir, 1);
case TL_BETTER_ROADS: // Disallow the road if any neighboring tile has a road (distance: 1 and 2).
return !IsNeighborRoadTile(tile, dir, 2);
}
}
bool ret = !IsNeighborRoadTile(tile, dir, t->layout == TL_ORIGINAL ? 1 : 2);
if (cur_slope == SLOPE_FLAT) return ret;
/* If the tile is not a slope in the right direction, then
* maybe terraform some. */
@@ -787,12 +776,12 @@ no_slope:
}
if (CmdFailed(res) && Chance16(1, 3)) {
/* We can consider building on the slope, though. */
goto no_slope;
return ret;
}
}
return false;
}
return true;
return ret;
}
}

View File

@@ -965,10 +965,6 @@ static void AddWagonToConsist(Vehicle *v, Vehicle *dest)
*/
static void NormaliseTrainConsist(Vehicle *v)
{
if (IsFreeWagon(v)) return;
assert(IsFrontEngine(v));
for (; v != NULL; v = GetNextVehicle(v)) {
if (!IsMultiheaded(v) || !IsTrainEngine(v)) continue;

View File

@@ -248,6 +248,8 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u
if (transport_type != TRANSPORT_WATER) {
/* set and test bridge length, availability */
if (!CheckBridge_Stuff(bridge_type, bridge_len, flags)) return_cmd_error(STR_5015_CAN_T_BUILD_BRIDGE_HERE);
} else {
if (bridge_len > (_settings_game.construction.longbridges ? 100U : 16U)) return_cmd_error(STR_5015_CAN_T_BUILD_BRIDGE_HERE);
}
/* retrieve landscape height and ensure it's on land */

View File

@@ -45,7 +45,6 @@
PlaceProc *_place_proc;
Point _tile_fract_coords;
ZoomLevel _saved_scrollpos_zoom;
struct StringSpriteToDraw {
StringID string;

View File

@@ -937,23 +937,72 @@ void CreateConsole()
#endif
}
/** Temporary pointer to get the help message to the window */
static const char *_help_msg;
/** Callback function to handle the window */
static INT_PTR CALLBACK HelpDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG: {
char help_msg[8192];
const char *p = _help_msg;
char *q = help_msg;
while (q != lastof(help_msg) && *p != '\0') {
if (*p == '\n') {
*q++ = '\r';
if (q == lastof(help_msg)) {
q[-1] = '\0';
break;
}
}
*q++ = *p++;
}
*q = '\0';
#if defined(UNICODE)
/* We need to put the text in a seperate buffer because the default
* buffer in MB_TO_WIDE might not be large enough (512 chars) */
wchar_t help_msgW[8192];
#endif
SetDlgItemText(wnd, 11, MB_TO_WIDE_BUFFER(help_msg, help_msgW, lengthof(help_msgW)));
SendDlgItemMessage(wnd, 11, WM_SETFONT, (WPARAM)GetStockObject(ANSI_FIXED_FONT), FALSE);
} return TRUE;
case WM_COMMAND:
if (wParam == 12) ExitProcess(0);
return TRUE;
case WM_CLOSE:
ExitProcess(0);
}
return FALSE;
}
void ShowInfo(const char *str)
{
if (_has_console) {
fprintf(stderr, "%s\n", str);
} else {
bool old;
#if defined(UNICODE)
/* We need to put the text in a seperate buffer because the default
* buffer in MB_TO_WIDE might not be large enough (512 chars) */
wchar_t help_msgW[8192];
#endif
ReleaseCapture();
_left_button_clicked = _left_button_down = false;
old = MyShowCursor(true);
if (MessageBox(GetActiveWindow(), MB_TO_WIDE_BUFFER(str, help_msgW, lengthof(help_msgW)), _T("OpenTTD"), MB_ICONINFORMATION | MB_OKCANCEL) == IDCANCEL) {
CreateConsole();
if (strlen(str) > 2048) {
/* The minimum length of the help message is 2048. Other messages sent via
* ShowInfo are much shorter, or so long they need this way of displaying
* them anyway. */
_help_msg = str;
DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(101), NULL, HelpDialogFunc);
} else {
#if defined(UNICODE)
/* We need to put the text in a seperate buffer because the default
* buffer in MB_TO_WIDE might not be large enough (512 chars) */
wchar_t help_msgW[8192];
#endif
if (MessageBox(GetActiveWindow(), MB_TO_WIDE_BUFFER(str, help_msgW, lengthof(help_msgW)), _T("OpenTTD"), MB_ICONINFORMATION | MB_OKCANCEL) == IDCANCEL) {
CreateConsole();
}
}
MyShowCursor(old);
}

View File

@@ -7,8 +7,6 @@
#include "zoom_type.h"
extern ZoomLevel _saved_scrollpos_zoom;
/**
* Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL)
* When shifting right, value is rounded up

View File

@@ -37,4 +37,6 @@ enum ZoomLevel {
};
DECLARE_POSTFIX_INCREMENT(ZoomLevel)
typedef SimpleTinyEnumT<ZoomLevel, byte> ZoomLevelByte;
#endif /* ZOOM_TYPE_H */