mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-19 17:19:51 +00:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fa474b02f3 | |||
| 515849e764 | |||
| ed4a9edba5 | |||
| b83f6733ca | |||
| b0e8d229ee | |||
| fe8bb8da91 | |||
| a221bece84 | |||
| cd32a5f18c | |||
| a6c7987a43 | |||
| 10b6fc898b | |||
| e3a245369e | |||
| 71347cae43 | |||
| 5edc24e66a | |||
| 7fff0a71f2 | |||
| 79a7bf75a0 | |||
| 526b2ae81b | |||
| aa6a621f0a | |||
| 141da0127f | |||
| 95adb04eae | |||
| 516a01c761 | |||
| c40f10d6d4 |
@@ -268,14 +268,7 @@ ENDIAN_CHECK=endian_check$(EXE)
|
||||
STRGEN=strgen/strgen$(EXE)
|
||||
OSXAPP="OpenTTD.app"
|
||||
|
||||
ifdef RELEASE
|
||||
REV:=$(RELEASE)
|
||||
else
|
||||
ifeq ($(shell if test -d .svn; then echo 1; fi), 1)
|
||||
REV_MODIFIED := $(shell svnversion . | sed -n 's/.*\(M\).*/\1/p' )
|
||||
REV := $(shell LC_ALL=C svn info | awk '/^URL:.*branch/ { BRANCH="-"a[split($$2, a, "/")] } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }')
|
||||
endif
|
||||
endif
|
||||
REV := 0.5.3-RC2
|
||||
|
||||
# define flag to use for -lrt (some OSes overwrites this later for compatibility)
|
||||
ifndef LRT
|
||||
@@ -843,8 +836,12 @@ ifdef WIN32
|
||||
SRCS += sound/win32_s.c
|
||||
SRCS += video/win32_v.c
|
||||
else
|
||||
SRCS += unix.c
|
||||
SRCS += music/extmidi.c
|
||||
ifdef OS2
|
||||
SRCS += os2.c
|
||||
else
|
||||
SRCS += unix.c
|
||||
SRCS += music/extmidi.c
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef OSX
|
||||
|
||||
+1
-1
@@ -180,7 +180,7 @@ static const AirportMovingData _airport_moving_data_international[51] = {
|
||||
{ 193, 104, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 32 Fly to landing position in air
|
||||
{ 105, 104, AMED_NOSPDCLAMP | AMED_LAND, 0 }, // 33 Going down for land
|
||||
{ 3, 104, AMED_NOSPDCLAMP | AMED_BRAKE, 0 }, // 34 Just landed, brake until end of runway
|
||||
{ 12, 104, 0, 0 }, // 35 Just landed, turn around and taxi 1 square
|
||||
{ 12, 104, AMED_SLOWTURN, 0 }, // 35 Just landed, turn around and taxi 1 square
|
||||
{ 7, 84, 0, 0 }, // 36 Taxi from runway to crossing
|
||||
{ -31, 209, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 37 Fly around waiting for a landing spot (north-east)
|
||||
{ 1, 6, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 38 Fly around waiting for a landing spot (north-west)
|
||||
|
||||
+3
-1
@@ -31,6 +31,7 @@ CommandCallback CcPlaySound10;
|
||||
CommandCallback CcPlaceSign;
|
||||
CommandCallback CcTerraform;
|
||||
CommandCallback CcBuildTown;
|
||||
CommandCallback CcGiveMoney;
|
||||
|
||||
/* rail_gui.c */
|
||||
CommandCallback CcPlaySound1E;
|
||||
@@ -85,7 +86,8 @@ CommandCallback *_callback_table[] = {
|
||||
/* 0x17 */ CcCloneShip,
|
||||
/* 0x18 */ CcCloneTrain,
|
||||
/* 0x19 */ CcAI,
|
||||
/* 0x1A */ CcCloneVehicle
|
||||
/* 0x1A */ CcCloneVehicle,
|
||||
/* 0x1B */ CcGiveMoney,
|
||||
};
|
||||
|
||||
const int _callback_table_count = lengthof(_callback_table);
|
||||
|
||||
@@ -1,3 +1,55 @@
|
||||
0.5.3-RC2 (2007-07-07)
|
||||
------------------------------------------------------------------------
|
||||
- Fix: Visual glitches when a window is resized in the WE_CREATE callback (r10465)
|
||||
- Fix: [Windows] _wnd.has_focus was not properly set after using ALT-TAB [FS#962] (r10399)
|
||||
|
||||
|
||||
0.5.3-RC1 (2007-06-28)
|
||||
------------------------------------------------------------------------
|
||||
- Feature: Make the client list window (for network games) stickyable (r10293)
|
||||
- Feature: console command to get the current game date (r10137)
|
||||
- Fix: Waypoints could be renamed when you are not the owner (r10368)
|
||||
- Fix: Smooth economy did not close primary industries and it allowed increasing of production of industries that should not have rising productions (r10348, r10347, r10290)
|
||||
- Fix: Acceleration for trains on slopes is not calculated properly [FS#786] (r10344, r10317)
|
||||
- Fix: The 'old' pathfinders (OPF and NPF) for road vehicles could not find a path when in a tunnel [FS#290] (r10345)
|
||||
- Fix: Only add the autoreplace menu when autoreplace actually knows about the group [FS#880] (r10337)
|
||||
- Fix: Signal state sometimes not properly set when the signal "pathfinder" reached the end of a line [FS#910] (r10336)
|
||||
- Fix: News messages were shown over the endgame/highscore windows [FS#943] (r10333)
|
||||
- Fix: Rail could be destroyed when building tunnels (r10306)
|
||||
- Fix: Flush the output of the dedicated server console (r10295)
|
||||
- Fix: The "pause" key did not work in the scenario editor (r10294)
|
||||
- Fix: Age non-front engines too (so when you move engines around in the depot they do not get age 0 when they are much older [FS#202] (r10288)
|
||||
- Fix: Do not make everyone spectator if 1 joining client failed to create new company (r10284)
|
||||
- Fix: Remove invalid characters (for the file system) from savegame names [FS#916, FS#850] (r10272, r10116)
|
||||
- Fix: Some old savegames could have the wrong bits unset (r10268, r10147)
|
||||
- Fix: Do not look in every direction for tunnels when building one, one direction is enough (r10258)
|
||||
- Fix: [Windows] Do not mess desktop when using ALT-TAB [FS#876] (r10251, r10186)
|
||||
- Fix: Take the age of the front vehicle for station rating (r10246)
|
||||
- Fix: Terraforming wipes out canals. Now you always have to remove the canal before terraforming, instead of "just" removing the canal [FS#594] (r10240)
|
||||
- Fix: Only 2 trains could crash at one time as collision checking stopped on the first hit. This could technically cause desyncs in network games as the collision hash order is not guaranteed [FS#892] (r10222)
|
||||
- Fix: Land under foundations was terraform when it shouldn't be terraformed [FS#882, FS#890] (r10219)
|
||||
- Fix: Do not make a 270 degree turn on the international airport when a 90 degree turn is enough (r10187)
|
||||
- Fix: Crash when trying to get the aircraft movement state of an aircraft going to a just deleted airport [FS#874] (r10165)
|
||||
- Fix: Airports did not flood when there are aircraft on the airport [FS#601] (r10155)
|
||||
- Fix: Some vehicles were not drawn when having a high resolution and a high zoom-out level [FS#870] (r10154)
|
||||
- Fix: Vehicles disappear when crossing certain tiles [FS#869] (r10153)
|
||||
- Fix: Train disconnects in some old TTD savegames [FS#862] (10151)
|
||||
- Fix: OpenTTD assumes that the resolution is at least 1 by 1, so force the resolution to be always at least 1 by 1 (r10139)
|
||||
- Fix: When you got a sufficiently small resolution, there is a possibility for a division by zero when a sound is played (r10138)
|
||||
- Fix: When removing a dock, a ship will always try to reach the old location of the dock even when it cannot anymore because it the old location of the dock is now land instead of water [FS#810] (r10131)
|
||||
- Fix: SetCurrentGrfLangID returned the wrong language ids for most languages (r10130)
|
||||
- Fix: Some NewGRFs use the same (unused in the "current" climate) sprite IDs. Normally this gives some artefacts, but when one NewGRF expects it to be a sprite and another NewGRF overwrites it with a non-sprite nasty things happen (drawing a non-sprite crashes OTTD) [FS#838] (r10109)
|
||||
- Fix: Multiple subsequent "give money" actions could result in duplicate messages that money has been transfered when it only happened once, or tell you paid money when you did not [FS#834, FS#839] (r10087, r10085)
|
||||
- Fix: "Deactivate Electrified Railways" did not work [FS#836] (10083)
|
||||
- Fix: Memory leaks in the networking code [FS#846, FS#844] (r10082, r10075)
|
||||
- Fix: Coverage area highlight was still show when it was turned off for docks [FS#835] (r10068)
|
||||
- Fix: Do not use override engine type for articulated wagon parts (r10048)
|
||||
- Fix: Sprite resulting from '?' substitution was reloaded into the cache entry for SPR_IMG_QUERY instead of the original sprite cache entry. This resulted in unaccounted missing sprite cache memory, and was exacerbated because the original missing sprite was not cached, so it did it again and again and again. Slowdowns and boom (r10038)
|
||||
- Fix: One could build on (some) slopes when building on slopes was disabled [FS#823] (r10030)
|
||||
- Fix: When deleting the first engine of a train with multiple engines, only reopen the train window if the player had the original train window open. This fixes 'random' windows opening for multiple players of the same company (r10028)
|
||||
- Fix: When selling trains, if there were no wagons between multiheaded engines the rear part could be checked despite having already been deleted (10023)
|
||||
|
||||
|
||||
0.5.2 (2007-05-29)
|
||||
------------------------------------------------------------------------
|
||||
- Feature: Add threading support for MorphOS (r9759)
|
||||
|
||||
+9
-1
@@ -17,6 +17,7 @@
|
||||
#include "unmovable_map.h"
|
||||
#include "genworld.h"
|
||||
#include "industry.h"
|
||||
#include "water_map.h"
|
||||
|
||||
typedef struct TerraformerHeightMod {
|
||||
TileIndex tile;
|
||||
@@ -111,7 +112,7 @@ static int TerraformProc(TerraformerState *ts, TileIndex tile, int mode)
|
||||
// basement and then you raise/lower the other corner.
|
||||
tileh = GetTileSlope(tile, &z);
|
||||
if (tileh == unsafe_slope[mode] ||
|
||||
tileh == ComplementSlope(unsafe_slope[mode])) {
|
||||
tileh == (SLOPE_STEEP | ComplementSlope(unsafe_slope[mode]))) {
|
||||
_terraform_err_tile = tile;
|
||||
_error_message = STR_1008_MUST_REMOVE_RAILROAD_TRACK;
|
||||
return -1;
|
||||
@@ -136,6 +137,13 @@ static int TerraformProc(TerraformerState *ts, TileIndex tile, int mode)
|
||||
}
|
||||
}
|
||||
|
||||
/* Canals can't be terraformed */
|
||||
if (IsClearWaterTile(tile) && IsCanal(tile)) {
|
||||
_terraform_err_tile = tile;
|
||||
_error_message = STR_MUST_DEMOLISH_CANAL_FIRST;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = DoCommand(tile, 0,0, ts->flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
|
||||
|
||||
if (CmdFailed(ret)) {
|
||||
|
||||
@@ -385,7 +385,8 @@ void IConsolePrint(uint16 color_code, const char *string)
|
||||
str_validate(str);
|
||||
|
||||
if (_network_dedicated) {
|
||||
printf("%s\n", str);
|
||||
fprintf(stdout, "%s\n", str);
|
||||
fflush(stdout);
|
||||
IConsoleWriteToLogFile(str);
|
||||
free(str); // free duplicated string since it's not used anymore
|
||||
return;
|
||||
|
||||
@@ -928,6 +928,20 @@ DEF_CONSOLE_CMD(ConGetSeed)
|
||||
return true;
|
||||
}
|
||||
|
||||
DEF_CONSOLE_CMD(ConGetDate)
|
||||
{
|
||||
YearMonthDay ymd;
|
||||
if (argc == 0) {
|
||||
IConsoleHelp("Returns the current date (day-month-year) of the game. Usage: 'getdate'");
|
||||
return true;
|
||||
}
|
||||
|
||||
ConvertDateToYMD(_date, &ymd);
|
||||
IConsolePrintF(_icolour_def, "Date: %d-%d-%d", ymd.day, ymd.month + 1, ymd.year);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
DEF_CONSOLE_CMD(ConAlias)
|
||||
{
|
||||
IConsoleAlias *alias;
|
||||
@@ -1484,6 +1498,7 @@ void IConsoleStdLibRegister(void)
|
||||
IConsoleCmdRegister("newgame", ConNewGame);
|
||||
IConsoleCmdRegister("restart", ConRestart);
|
||||
IConsoleCmdRegister("getseed", ConGetSeed);
|
||||
IConsoleCmdRegister("getdate", ConGetDate);
|
||||
IConsoleCmdRegister("quit", ConExit);
|
||||
IConsoleCmdRegister("resetengines", ConResetEngines);
|
||||
IConsoleCmdRegister("return", ConReturn);
|
||||
|
||||
+6
-4
@@ -236,14 +236,16 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
|
||||
case WE_CREATE: LowerWindowWidget(w, _station_show_coverage + 3); break;
|
||||
|
||||
case WE_PAINT: {
|
||||
int rad;
|
||||
int rad = (_patches.modified_catchment) ? CA_DOCK : 4;
|
||||
|
||||
if (WP(w,def_d).close) return;
|
||||
DrawWindowWidgets(w);
|
||||
|
||||
rad = (_patches.modified_catchment) ? CA_DOCK : 4;
|
||||
|
||||
if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
||||
if (_station_show_coverage) {
|
||||
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
||||
} else {
|
||||
SetTileSelectSize(1, 1);
|
||||
}
|
||||
|
||||
DrawStationCoverageAreaText(4, 50, (uint)-1, rad);
|
||||
break;
|
||||
|
||||
+12
-1
@@ -50,6 +50,9 @@ To enable music, start OpenTTD with the command line:
|
||||
If I hear enough responses that both music and sound work together (it might
|
||||
just be my system), I'll have the defaults changed.
|
||||
|
||||
Please note also that the GCC version does not currently support the MCI MIDI
|
||||
system.
|
||||
|
||||
A NOTE ABOUT DEDICATED MULTIPLAYER SERVERS
|
||||
------------------------------------------
|
||||
|
||||
@@ -74,9 +77,17 @@ may help to set one up (although some of the links from that page are broken):
|
||||
|
||||
http://www.mozilla.org/ports/os2/gccsetup.html
|
||||
|
||||
Alternatively, Paul Smedley's ready-to-go GCC build environment has been known to
|
||||
successfully build the game:
|
||||
|
||||
http://www.smedley.info/os2ports/index.php?page=build-environment
|
||||
|
||||
To build, you should, if your environment is set up well enough, be able to just
|
||||
type `./configure' (or `sh configure' if you're using the OS/2 shell) and `make'.
|
||||
|
||||
You may have to manually specify `--os OS2' on the configure command line, as
|
||||
configure cannot currently detect OS/2 manually.
|
||||
|
||||
A note on Open Watcom
|
||||
---------------------
|
||||
|
||||
@@ -122,4 +133,4 @@ issues, see the Contacting section of readme.txt.
|
||||
|
||||
Thanks to Paul Smedley for his help with getting OpenTTD to compile under GCC on OS/2.
|
||||
|
||||
- Owen Rudge, 8th January 2007
|
||||
- Owen Rudge, 24th June 2007
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.Dd May 29, 2007
|
||||
.Dd Jul 07, 2007
|
||||
.Dt OPENTTD 6
|
||||
.Sh NAME
|
||||
.Nm openttd
|
||||
|
||||
@@ -58,7 +58,7 @@ static const DriverDesc _music_driver_descs[] = {
|
||||
M("qt", "QuickTime MIDI Driver", &_qtime_music_driver),
|
||||
#endif
|
||||
#ifdef UNIX
|
||||
#if !defined(__MORPHOS__) && !defined(__AMIGA__)
|
||||
#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(__OS2__)
|
||||
M("extmidi", "External MIDI Driver", &_extmidi_music_driver),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1468,7 +1468,7 @@ int LoadUnloadVehicle(Vehicle *v, bool just_arrived)
|
||||
|
||||
// if last speed is 0, we treat that as if no vehicle has ever visited the station.
|
||||
ge->last_speed = min(t, 255);
|
||||
ge->last_age = _cur_year - v->build_year;
|
||||
ge->last_age = _cur_year - u->build_year;
|
||||
|
||||
// If there's goods waiting at the station, and the vehicle
|
||||
// has capacity for it, load it on the vehicle.
|
||||
|
||||
@@ -422,6 +422,7 @@ int32 SettingsDisableElrail(int32 p1)
|
||||
if (rv_info->engclass == 2 && e->railtype == old_railtype) {
|
||||
/* change it to the proper one */
|
||||
e->railtype = new_railtype;
|
||||
_engine_info[e_id].railtype = new_railtype;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -149,3 +149,20 @@ void FioOpenFile(int slot, const char *filename)
|
||||
_fio.handles[slot] = f;
|
||||
FioSeekToFile(slot << 24);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitizes a filename, i.e. removes all illegal characters from it.
|
||||
* @param filename the "\0" terminated filename
|
||||
*/
|
||||
void SanitizeFilename(char *filename)
|
||||
{
|
||||
for (; *filename != '\0'; filename++) {
|
||||
switch (*filename) {
|
||||
/* The following characters are not allowed in filenames
|
||||
* on at least one of the supported operating systems: */
|
||||
case ':': case '\\': case '*': case '?': case '/': case '<': case '>': case '|': case '"':
|
||||
*filename = '_';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,5 +15,6 @@ void FioOpenFile(int slot, const char *filename);
|
||||
void FioReadBlock(void *ptr, uint size);
|
||||
void FioSkipBytes(int n);
|
||||
bool FioCheckFileExists(const char *filename);
|
||||
void SanitizeFilename(char *filename);
|
||||
|
||||
#endif /* FILEIO_H */
|
||||
|
||||
@@ -206,7 +206,7 @@ static const SpriteID trg1idx[] = {
|
||||
/* Medium font */
|
||||
2, 92, // ' ' till 'z'
|
||||
SKIP, 36,
|
||||
160, 160, // Move ¾ to the correct position
|
||||
160, 160, // Move Ÿ to the correct position
|
||||
98, 98, // Up arrow
|
||||
131, 133,
|
||||
SKIP, 1, // skip currency sign
|
||||
@@ -231,7 +231,7 @@ static const SpriteID trg1idx[] = {
|
||||
/* Small font */
|
||||
226, 316, // ' ' till 'z'
|
||||
SKIP, 36,
|
||||
384, 384, // Move ¾ to the correct position
|
||||
384, 384, // Move Ÿ to the correct position
|
||||
322, 322, // Up arrow
|
||||
355, 357,
|
||||
SKIP, 1, // skip currency sign
|
||||
@@ -253,7 +253,7 @@ static const SpriteID trg1idx[] = {
|
||||
/* Big font */
|
||||
450, 540, // ' ' till 'z'
|
||||
SKIP, 36,
|
||||
608, 608, // Move ¾ to the correct position
|
||||
608, 608, // Move Ÿ to the correct position
|
||||
SKIP, 1,
|
||||
579, 581,
|
||||
SKIP, 1,
|
||||
@@ -292,47 +292,47 @@ static const SpriteID _openttd_grf_indexes[] = {
|
||||
582, 582, // euro symbol large size
|
||||
358, 358, // euro symbol tiny
|
||||
SPR_CURSOR_CANAL, SPR_IMG_FASTFORWARD, // more icons
|
||||
648, 648, // nordic char: æ
|
||||
616, 616, // nordic char: Æ
|
||||
666, 666, // nordic char: ø
|
||||
634, 634, // nordic char: Ø
|
||||
648, 648, // nordic char: æ
|
||||
616, 616, // nordic char: Æ
|
||||
666, 666, // nordic char: ø
|
||||
634, 634, // nordic char: Ø
|
||||
SPR_PIN_UP, SPR_CURSOR_CLONE_TRAIN, // more icons
|
||||
382, 383, // ¼ ½ tiny
|
||||
158, 159, // ¼ ½ medium
|
||||
606, 607, // ¼ ½ large
|
||||
360, 360, // ¦ tiny
|
||||
362, 362, // ¨ tiny
|
||||
136, 136, // ¦ medium
|
||||
138, 138, // ¨ medium
|
||||
584, 584, // ¦ large
|
||||
586, 586, // ¨ large
|
||||
626, 626, // Ð large
|
||||
658, 658, // ð large
|
||||
374, 374, // ´ tiny
|
||||
378, 378, // ¸ tiny
|
||||
150, 150, // ´ medium
|
||||
154, 154, // ¸ medium
|
||||
598, 598, // ´ large
|
||||
602, 602, // ¸ large
|
||||
640, 640, // Þ large
|
||||
672, 672, // þ large
|
||||
380, 380, // º tiny
|
||||
156, 156, // º medium
|
||||
604, 604, // º large
|
||||
382, 383, // Œ œ tiny
|
||||
158, 159, // Œ œ medium
|
||||
606, 607, // Œ œ large
|
||||
360, 360, // Š tiny
|
||||
362, 362, // š tiny
|
||||
136, 136, // Š medium
|
||||
138, 138, // š medium
|
||||
584, 584, // Š large
|
||||
586, 586, // š large
|
||||
626, 626, // Ð large
|
||||
658, 658, // ð large
|
||||
374, 374, // Ž tiny
|
||||
378, 378, // ž tiny
|
||||
150, 150, // Ž medium
|
||||
154, 154, // ž medium
|
||||
598, 598, // Ž large
|
||||
602, 602, // ž large
|
||||
640, 640, // Þ large
|
||||
672, 672, // þ large
|
||||
380, 380, // º tiny
|
||||
156, 156, // º medium
|
||||
604, 604, // º large
|
||||
317, 320, // { | } ~ tiny
|
||||
93, 96, // { | } ~ medium
|
||||
541, 544, // { | } ~ large
|
||||
SPR_HOUSE_ICON, SPR_HOUSE_ICON,
|
||||
585, 585, // § large
|
||||
587, 587, // © large
|
||||
592, 592, // ® large
|
||||
594, 597, // ° ± ² ³ large
|
||||
633, 633, // × large
|
||||
665, 665, // ÷ large
|
||||
585, 585, // § large
|
||||
587, 587, // © large
|
||||
592, 592, // ® large
|
||||
594, 597, // ° ± ² ³ large
|
||||
633, 633, // × large
|
||||
665, 665, // ÷ large
|
||||
SPR_SELL_TRAIN, SPR_SHARED_ORDERS_ICON,
|
||||
377, 377, // · small
|
||||
153, 153, // · medium
|
||||
601, 601, // · large
|
||||
377, 377, // · small
|
||||
153, 153, // · medium
|
||||
601, 601, // · large
|
||||
END
|
||||
};
|
||||
|
||||
|
||||
+11
-8
@@ -1615,13 +1615,16 @@ static void ExtChangeIndustryProduction(Industry *i)
|
||||
int mag;
|
||||
|
||||
new = old = i->production_rate[j];
|
||||
if (CHANCE16I(20, 1024, r))
|
||||
new -= ((RandomRange(50) + 10) * old) >> 8;
|
||||
if (CHANCE16I(20 + (i->pct_transported[j] * 20 >> 8), 1024, r >> 16))
|
||||
new += ((RandomRange(50) + 10) * old) >> 8;
|
||||
if (CHANCE16I(20, 1024, r)) new -= max(((RandomRange(50) + 10) * old) >> 8, 1U);
|
||||
/* Chance of increasing becomes better when more is transported */
|
||||
if (CHANCE16I(20 + (i->pct_transported[j] * 20 >> 8), 1024, r >> 16) &&
|
||||
(i->type != IT_OIL_WELL || _opt.landscape != LT_NORMAL)) {
|
||||
new += max(((RandomRange(50) + 10) * old) >> 8, 1U);
|
||||
}
|
||||
|
||||
new = clamp(new, 0, 255);
|
||||
if (new == old) {
|
||||
new = clamp(new, 1, 255);
|
||||
/* Do not stop closing the industry when it has the lowest possible production rate */
|
||||
if (new == old && old > 1) {
|
||||
closeit = false;
|
||||
continue;
|
||||
}
|
||||
@@ -1629,8 +1632,8 @@ static void ExtChangeIndustryProduction(Industry *i)
|
||||
percent = new * 100 / old - 100;
|
||||
i->production_rate[j] = new;
|
||||
|
||||
if (new >= indspec->production_rate[j] / 4)
|
||||
closeit = false;
|
||||
/* Close the industry when it has the lowest possible production rate */
|
||||
if (new > 1) closeit = false;
|
||||
|
||||
mag = abs(percent);
|
||||
if (mag >= 10) {
|
||||
|
||||
@@ -66,7 +66,9 @@ static void SelectGameWndProc(Window *w, WindowEvent *e)
|
||||
case WE_CLICK:
|
||||
/* Do not create a network server when you (just) have closed one of the game
|
||||
* creation/load windows for the network server. */
|
||||
#ifdef ENABLE_NETWORK
|
||||
if (2 <= e->we.click.widget && e->we.click.widget <= 6) _is_network_server = false;
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
switch (e->we.click.widget) {
|
||||
case 2: ShowGenerateLandscape(); break;
|
||||
|
||||
+6
-54
@@ -4,44 +4,35 @@ All bugs listed below are marked as known. Please do not submit any bugs
|
||||
that are the same as these. If you do, don't act surprised, because
|
||||
we WILL flame you!!
|
||||
|
||||
There is an experimental AI included in the game which you can enable
|
||||
from the "Configure Patches" window. All bugs related to this AI should
|
||||
go to: http://www.tt-forums.net/viewtopic.php?t=9576
|
||||
|
||||
Of course if you have more knowledge about any of these bugs, have more
|
||||
specifics, we welcome you to report them. React to the given bug indicated
|
||||
by the number below on http://sourceforge.net/tracker/?group_id=103924&atid=636365
|
||||
or http://bugs.openttd.org.
|
||||
by the number below on http://bugs.openttd.org.
|
||||
If the bug report is closed, it has been fixed, which then can be verified
|
||||
in the latest SVN version.
|
||||
|
||||
Bugs for 0.5.2
|
||||
Bugs for 0.5.3
|
||||
------------------------------------------------------------------------
|
||||
URL: http://bugs.openttd.org
|
||||
|
||||
-735 Plural rule not expanded correctly when non-numeric placeholder uses
|
||||
-944 Incorrect el-rail catenary pole/wire offsets
|
||||
-917 Load scenario with no towns failed without proper warning
|
||||
-873 Assertion window fails to open on OSX
|
||||
-820 Pillar drawing order glich, with newbridges
|
||||
-716 Train Crash in Depot
|
||||
-674 Map signs allow less nonenglish characters than english ones
|
||||
-669 Docks/Airports/RV Stations can be built without available vehicles
|
||||
-646 AI builds useless stations
|
||||
-601 Airports can't get flooded when they have planes in them
|
||||
-599 Reloaded game lost company passwords
|
||||
-594 Terraforming wipes out canals
|
||||
-591 Autorenew fails under certain conditions
|
||||
-559 Front-/Rear-facing engines don't line up with each other
|
||||
-553 Autorenew doesn't warn when replacement isn't available
|
||||
-546 Overflows due to inflation
|
||||
-540 Planes vanished when offered exclusive
|
||||
-539 Trains can cash the same cargo multiple times
|
||||
-524 OSX sometimes (not always) fails to find free disk space
|
||||
-522 Overflow on vehicle costs
|
||||
-508 Destroying trees and replanting => raised rating
|
||||
-502 OSX can incorrectly print "dbg: [sl] Cannot open savegame 'data/opntitle.dat' for saving/loading."
|
||||
-501 Mouse pointer gets hidden, when draging out of window and back again. Only affects Wacom etc.
|
||||
-494 Get free money abusing a stock bug
|
||||
-474 Overtaking car doesn't hit the against-riding car.
|
||||
-458 Crash when changing Resolution on Mac OS X (x86)
|
||||
-442 Alt-tab behaviour flawed whilst full screen (win32)
|
||||
-435 Assertion window doesn't show when in fullscreen on Mac OS X
|
||||
-423 Improved loading causes high CPU use with long trains
|
||||
-410 Openttd in dedicated mode don't run without data files
|
||||
@@ -51,49 +42,10 @@ URL: http://bugs.openttd.org
|
||||
-354 Maglev Trains faster than All Planes
|
||||
-339 Crash in Quicktime when exiting game
|
||||
-299 Disable 90 deg turns patch - AI builds 90 deg turns
|
||||
-290 NPF - no path to depot from tunnel
|
||||
-282 AI Players do not clear loans as soon as they could
|
||||
-274 Autoclean ignores any share holdings
|
||||
-265 Subsidy awarded detection bug
|
||||
-259 AIs start unnamed companies that do nothing
|
||||
-216 AI build train vans one van less
|
||||
-202 2 Locomotives in 1 Train - Selling one results in Age of the other one Being 0
|
||||
-193 Inconsistent directory usage on Mac OS X
|
||||
-165 Vehicle length not taken into account
|
||||
-153 Language crash with app renaming OSX
|
||||
-119 Clipping problems with vehicles on slopes
|
||||
- 89 Able to build railways/stations before engines become available
|
||||
- 65 Short wagons bug
|
||||
- 51 Windows doesn't support CUSTOM_LANG_DIR
|
||||
- 47 Low rating calculation and cargo loading priority
|
||||
|
||||
------------------------------------------------------------------------
|
||||
URL: http://sourceforge.net/tracker/?atid=636365&group_id=103924&func=browse
|
||||
|
||||
-1573339 0.4.8.dmg Crash with intel 64bit
|
||||
-1460218 0.4.7 normal industry bug (non_smooth)
|
||||
-1459262 Towns building too many roads way too long now
|
||||
-1458995 Another bug with smooth_economy
|
||||
-1393415 NPF & one-way sigs
|
||||
-1212267 Station visited twice when servicing
|
||||
-1208170 Duplicate station names can be created
|
||||
-1116638 "More, but smaller changes" deficiency
|
||||
-1106356 Re-offered prototypes
|
||||
|
||||
------------------------------------------------------------------------
|
||||
URL: http://sourceforge.net/tracker/?atid=669662&group_id=103924&func=browse
|
||||
|
||||
-1461629 [r4180]Subsidy calculated wrong
|
||||
-1412031 Fast forward scrolling is also fast forward :)
|
||||
-1382782 Loan interest calculated 'wrong'
|
||||
-1201284 Permanent hilight in a depot
|
||||
-1185852 Scrollbars get arbitrarily small
|
||||
-1160732 Little bug with transparency
|
||||
-1108046 Game freezes
|
||||
-1102174 Bug if 3 people buy 25% shares in one company
|
||||
-1084620 Minor bug considering buses/trucks
|
||||
-1034310 Color mauve in diagrams
|
||||
-1030661 It's possible to build a tunnel under oil wells
|
||||
- 987883 Aircraft landing/taking off
|
||||
- 987880 Company league table updating
|
||||
- 985924 Aircraft taxi speed
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "water_map.h"
|
||||
#include "tgp.h"
|
||||
#include "genworld.h"
|
||||
#include "heightmap.h"
|
||||
|
||||
extern const TileTypeProcs
|
||||
_tile_type_clear_procs,
|
||||
|
||||
@@ -1801,6 +1801,7 @@ STR_3804_WATER :Water
|
||||
STR_3805_COAST_OR_RIVERBANK :Coast or riverbank
|
||||
STR_3806_SHIP_DEPOT :Ship depot
|
||||
STR_3807_CAN_T_BUILD_ON_WATER :{WHITE}...Can't build on water
|
||||
STR_MUST_DEMOLISH_CANAL_FIRST :{WHITE}Must demolish canal first
|
||||
|
||||
##id 0x4000
|
||||
STR_4000_SAVE_GAME :{WHITE}Save Game
|
||||
|
||||
+18
-14
@@ -53,6 +53,20 @@ static int _scengen_town_size = 2; // depress medium-sized towns per default
|
||||
extern void GenerateIndustries(void);
|
||||
extern bool GenerateTowns(void);
|
||||
|
||||
void CcGiveMoney(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||
{
|
||||
#ifdef ENABLE_NETWORK
|
||||
char msg[20];
|
||||
if (!success) return;
|
||||
/* Inform the player of this action */
|
||||
snprintf(msg, sizeof(msg), "%d", p1);
|
||||
if (!_network_server) {
|
||||
SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, p2, msg);
|
||||
} else {
|
||||
NetworkServer_HandleChat(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, p2, msg, NETWORK_SERVER_INDEX);
|
||||
}
|
||||
#endif /* ENABLE_NETWORK */
|
||||
}
|
||||
|
||||
void HandleOnEditText(WindowEvent *e)
|
||||
{
|
||||
@@ -75,21 +89,11 @@ void HandleOnEditText(WindowEvent *e)
|
||||
case 3: { /* Give money, you can only give money in excess of loan */
|
||||
const Player *p = GetPlayer(_current_player);
|
||||
int32 money = min(p->money64 - p->current_loan, atoi(e->we.edittext.str) / _currency->rate);
|
||||
char msg[20];
|
||||
|
||||
money = clamp(money, 0, 20000000); // Clamp between 20 million and 0
|
||||
|
||||
// Give 'id' the money, and substract it from ourself
|
||||
if (!DoCommandP(0, money, id, NULL, CMD_GIVE_MONEY | CMD_MSG(STR_INSUFFICIENT_FUNDS))) break;
|
||||
|
||||
// Inform the player of this action
|
||||
snprintf(msg, sizeof(msg), "%d", money);
|
||||
|
||||
if (!_network_server) {
|
||||
SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, id, msg);
|
||||
} else {
|
||||
NetworkServer_HandleChat(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, id, msg, NETWORK_SERVER_INDEX);
|
||||
}
|
||||
DoCommandP(0, money, id, CcGiveMoney, CMD_GIVE_MONEY | CMD_MSG(STR_INSUFFICIENT_FUNDS));
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLE_NETWORK */
|
||||
@@ -1801,7 +1805,7 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e)
|
||||
case WKC_F7: ShowPlayerStations(_local_player); break;
|
||||
case WKC_F8: ShowPlayerFinances(_local_player); break;
|
||||
case WKC_F9: ShowPlayerCompany(_local_player); break;
|
||||
case WKC_F10:ShowOperatingProfitGraph(); break;
|
||||
case WKC_F10: ShowOperatingProfitGraph(); break;
|
||||
case WKC_F11: ShowCompanyLeagueTable(); break;
|
||||
case WKC_F12: ShowBuildIndustryWindow(); break;
|
||||
case WKC_SHIFT | WKC_F1: ShowVehicleListWindow(_local_player, INVALID_STATION, VEH_Train); break;
|
||||
@@ -1813,7 +1817,7 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e)
|
||||
case WKC_SHIFT | WKC_F7: ShowBuildRailToolbar(_last_built_railtype, -1); break;
|
||||
case WKC_SHIFT | WKC_F8: ShowBuildRoadToolbar(); break;
|
||||
case WKC_SHIFT | WKC_F9: ShowBuildDocksToolbar(); break;
|
||||
case WKC_SHIFT | WKC_F10:ShowBuildAirToolbar(); break;
|
||||
case WKC_SHIFT | WKC_F10: ShowBuildAirToolbar(); break;
|
||||
case WKC_SHIFT | WKC_F11: ShowBuildTreesToolbar(); break;
|
||||
case WKC_SHIFT | WKC_F12: ShowMusicWindow(); break;
|
||||
case WKC_CTRL | 'S': MenuClickSmallScreenshot(); break;
|
||||
@@ -2008,7 +2012,7 @@ static void ScenEditToolbarWndProc(Window *w, WindowEvent *e)
|
||||
|
||||
case WE_KEYPRESS:
|
||||
switch (e->we.keypress.keycode) {
|
||||
case WKC_F1: ToolbarPauseClick(w); break;
|
||||
case WKC_F1: case WKC_PAUSE: ToolbarPauseClick(w); break;
|
||||
case WKC_F2: ShowGameOptions(); break;
|
||||
case WKC_F3: MenuClickSaveLoad(0); break;
|
||||
case WKC_F4: ToolbarScenGenLand(w); break;
|
||||
|
||||
+4
-2
@@ -30,6 +30,7 @@
|
||||
#include "tgp.h"
|
||||
#include "settings.h"
|
||||
#include "date.h"
|
||||
#include "fileio.h"
|
||||
|
||||
#include "fios.h"
|
||||
/* Variables to display file lists */
|
||||
@@ -212,16 +213,16 @@ static const char *credits[] = {
|
||||
" Loïc Guilloux (glx) - In training, not yet specialized",
|
||||
" Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;)",
|
||||
" Attila Bán (MiHaMiX) - WebTranslator, Nightlies, Wiki and bugtracker host",
|
||||
" Owen Rudge (orudge) - Forum host, OS/2 port",
|
||||
" Peter Nelson (peter1138) - Spiritual descendant from newgrf gods",
|
||||
" Remko Bijker (Rubidium) - THE desync hunter",
|
||||
" Christoph Mallon (Tron) - Programmer, code correctness police",
|
||||
" Patric Stout (TrueLight) - Coder, network guru, SVN- and website host",
|
||||
" Patric Stout (TrueLight) - Coder, network guru, SVN-, MS- and website host",
|
||||
"",
|
||||
"Retired Developers:",
|
||||
" Ludvig Strigeus (ludde) - OpenTTD author, main coder (0.1 - 0.3.3)",
|
||||
" Serge Paquet (vurlix) - Assistant project manager, coder (0.1 - 0.3.3)",
|
||||
" Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3.0 - 0.3.6)",
|
||||
" Owen Rudge (orudge) - Forum- and masterserver host, OS/2 port (0.1 - 0.4.8)",
|
||||
"",
|
||||
"Special thanks go out to:",
|
||||
" Josef Drexler - For his great work on TTDPatch",
|
||||
@@ -1337,6 +1338,7 @@ static void GenerateFileName(void)
|
||||
SetDParam(1, p->name_2);
|
||||
SetDParam(2, _date);
|
||||
GetString(_edit_str_buf, STR_4004, lastof(_edit_str_buf));
|
||||
SanitizeFilename(_edit_str_buf);
|
||||
}
|
||||
|
||||
extern void StartupEngines(void);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
extern const char _openttd_revision[];
|
||||
#elif defined(WITH_REV_HACK)
|
||||
#define WITH_REV
|
||||
const char _openttd_revision[] = WITH_REV_HACK;
|
||||
const char _openttd_revision[] = "0.5.3-RC2";
|
||||
#else
|
||||
const char _openttd_revision[] = NOREV_STRING;
|
||||
#endif
|
||||
|
||||
+33
-35
@@ -429,34 +429,24 @@ void NetworkAddCommandQueue(NetworkClientState *cs, CommandPacket *cp)
|
||||
// Prepare a DoCommand to be send over the network
|
||||
void NetworkSend_Command(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback)
|
||||
{
|
||||
CommandPacket *c = malloc(sizeof(CommandPacket));
|
||||
byte temp_callback;
|
||||
CommandPacket c;
|
||||
|
||||
c->player = _local_player;
|
||||
c->next = NULL;
|
||||
c->tile = tile;
|
||||
c->p1 = p1;
|
||||
c->p2 = p2;
|
||||
c->cmd = cmd;
|
||||
c->callback = 0;
|
||||
c.player = _local_player;
|
||||
c.next = NULL;
|
||||
c.tile = tile;
|
||||
c.p1 = p1;
|
||||
c.p2 = p2;
|
||||
c.cmd = cmd;
|
||||
c.callback = 0;
|
||||
|
||||
temp_callback = 0;
|
||||
|
||||
while (temp_callback < _callback_table_count && _callback_table[temp_callback] != callback)
|
||||
temp_callback++;
|
||||
if (temp_callback == _callback_table_count) {
|
||||
while (c.callback < _callback_table_count && _callback_table[c.callback] != callback)
|
||||
c.callback++;
|
||||
if (c.callback == _callback_table_count) {
|
||||
DEBUG(net, 0) ("[NET] Unknown callback. (Pointer: %p) No callback sent.", callback);
|
||||
temp_callback = 0; /* _callback_table[0] == NULL */
|
||||
c.callback = 0; /* _callback_table[0] == NULL */
|
||||
}
|
||||
|
||||
if (_network_server) {
|
||||
// We are the server, so set the command to be executed next possible frame
|
||||
c->frame = _frame_counter_max + 1;
|
||||
} else {
|
||||
c->frame = 0; // The client can't tell which frame, so just make it 0
|
||||
}
|
||||
|
||||
ttd_strlcpy(c->text, (_cmd_text != NULL) ? _cmd_text : "", lengthof(c->text));
|
||||
ttd_strlcpy(c.text, (_cmd_text != NULL) ? _cmd_text : "", lengthof(c.text));
|
||||
|
||||
if (_network_server) {
|
||||
// If we are the server, we queue the command in our 'special' queue.
|
||||
@@ -464,30 +454,38 @@ void NetworkSend_Command(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, Comma
|
||||
// client on the server can do everything 1 tick faster than others.
|
||||
// So to keep the game fair, we delay the command with 1 tick
|
||||
// which gives about the same speed as most clients.
|
||||
NetworkClientState *cs;
|
||||
|
||||
// And we queue it for delivery to the clients
|
||||
FOR_ALL_CLIENTS(cs) {
|
||||
if (cs->status > STATUS_AUTH) NetworkAddCommandQueue(cs, c);
|
||||
}
|
||||
|
||||
// Only the server gets the callback, because clients should not get them
|
||||
c->callback = temp_callback;
|
||||
|
||||
// We are the server, so set the command to be executed next possible frame
|
||||
|
||||
NetworkClientState *cs;
|
||||
CommandPacket *new_cp = malloc(sizeof(CommandPacket));
|
||||
|
||||
c.frame = _frame_counter_max + 1;
|
||||
*new_cp = c;
|
||||
|
||||
if (_local_command_queue == NULL) {
|
||||
_local_command_queue = c;
|
||||
_local_command_queue = new_cp;
|
||||
} else {
|
||||
// Find last packet
|
||||
CommandPacket *cp = _local_command_queue;
|
||||
while (cp->next != NULL) cp = cp->next;
|
||||
cp->next = c;
|
||||
cp->next = new_cp;
|
||||
}
|
||||
|
||||
c.callback = 0;
|
||||
|
||||
// And we queue it for delivery to the clients
|
||||
FOR_ALL_CLIENTS(cs) {
|
||||
if (cs->status > STATUS_AUTH) NetworkAddCommandQueue(cs, &c);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Clients send their command to the server and forget all about the packet
|
||||
c->callback = temp_callback;
|
||||
SEND_COMMAND(PACKET_CLIENT_COMMAND)(c);
|
||||
c.frame = 0;
|
||||
SEND_COMMAND(PACKET_CLIENT_COMMAND)(&c);
|
||||
}
|
||||
|
||||
// Execute a DoCommand we received from the network
|
||||
|
||||
+4
-3
@@ -1033,7 +1033,8 @@ enum {
|
||||
|
||||
static const Widget _client_list_widgets[] = {
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 249, 0, 13, STR_NETWORK_CLIENT_LIST, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 237, 0, 13, STR_NETWORK_CLIENT_LIST, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_STICKYBOX, RESIZE_NONE, 14, 238, 249, 0, 13, STR_NULL, STR_STICKY_BUTTON},
|
||||
|
||||
{ WWT_PANEL, RESIZE_NONE, 14, 0, 249, 14, 14 + CLNWND_ROWSIZE + 1, 0x0, STR_NULL},
|
||||
{ WIDGETS_END},
|
||||
@@ -1047,7 +1048,7 @@ static const Widget _client_list_popup_widgets[] = {
|
||||
static WindowDesc _client_list_desc = {
|
||||
WDP_AUTO, WDP_AUTO, 250, 1,
|
||||
WC_CLIENT_LIST,0,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
|
||||
_client_list_widgets,
|
||||
ClientListWndProc
|
||||
};
|
||||
@@ -1143,7 +1144,7 @@ static bool CheckClientListHeight(Window *w)
|
||||
if (w->height != CLNWND_OFFSET + num + 1) {
|
||||
// XXX - magic unfortunately; (num + 2) has to be one bigger than heigh (num + 1)
|
||||
SetWindowDirty(w);
|
||||
w->widget[2].bottom = w->widget[2].top + num + 2;
|
||||
w->widget[3].bottom = w->widget[3].top + num + 2;
|
||||
w->height = CLNWND_OFFSET + num + 1;
|
||||
SetWindowDirty(w);
|
||||
return false;
|
||||
|
||||
+10
-3
@@ -835,8 +835,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND)
|
||||
NetworkClientState *new_cs;
|
||||
const NetworkClientInfo *ci;
|
||||
byte callback;
|
||||
|
||||
CommandPacket *cp = malloc(sizeof(CommandPacket));
|
||||
CommandPacket *cp;
|
||||
|
||||
// The client was never joined.. so this is impossible, right?
|
||||
// Ignore the packet, give the client a warning, and close his connection
|
||||
@@ -845,6 +844,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND)
|
||||
return;
|
||||
}
|
||||
|
||||
cp = malloc(sizeof(CommandPacket));
|
||||
cp->player = NetworkRecv_uint8(cs, p);
|
||||
cp->cmd = NetworkRecv_uint32(cs, p);
|
||||
cp->p1 = NetworkRecv_uint32(cs, p);
|
||||
@@ -854,7 +854,10 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND)
|
||||
|
||||
callback = NetworkRecv_uint8(cs, p);
|
||||
|
||||
if (cs->has_quit) return;
|
||||
if (cs->has_quit) {
|
||||
free(cp);
|
||||
return;
|
||||
}
|
||||
|
||||
ci = DEREF_CLIENT_INFO(cs);
|
||||
|
||||
@@ -862,11 +865,13 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND)
|
||||
if (!IsValidCommand(cp->cmd)) {
|
||||
IConsolePrintF(_icolour_err, "WARNING: invalid command from client %d (IP: %s).", ci->client_index, GetPlayerIP(ci));
|
||||
SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_NOT_EXPECTED);
|
||||
free(cp);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CheckCommandFlags(cp, ci)) {
|
||||
SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_KICKED);
|
||||
free(cp);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -878,6 +883,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND)
|
||||
IConsolePrintF(_icolour_err, "WARNING: player %d (IP: %s) tried to execute a command as player %d, kicking...",
|
||||
ci->client_playas + 1, GetPlayerIP(ci), cp->player + 1);
|
||||
SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_PLAYER_MISMATCH);
|
||||
free(cp);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -889,6 +895,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND)
|
||||
if (cp->cmd == CMD_PLAYER_CTRL) {
|
||||
if (cp->p1 != 0) {
|
||||
SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_CHEATER);
|
||||
free(cp);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1626,6 +1626,7 @@ static const SpriteGroup* CreateGroupFromGroupID(byte feature, byte setid, byte
|
||||
|
||||
if (feature != _cur_grffile->spriteset_feature) {
|
||||
grfmsg(GMS_WARN, "NewSpriteGroup(0x%02X:0x%02X): Sprite set feature 0x%02X does not match action feature 0x%02X, skipping.",
|
||||
setid, type,
|
||||
_cur_grffile->spriteset_feature, feature);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -290,6 +290,8 @@ static byte MapAircraftMovementState(const Vehicle *v)
|
||||
const Station *st = GetStation(v->u.air.targetairport);
|
||||
byte amdflag = GetAirportMovingData(st->airport_type, v->u.air.pos)->flag;
|
||||
|
||||
if (st->airport_tile == 0) return AMS_TTDP_FLIGHT_TO_TOWER;
|
||||
|
||||
switch (v->u.air.state) {
|
||||
case HANGAR:
|
||||
/* The international airport is a special case as helicopters can land in
|
||||
|
||||
+1
-1
@@ -404,7 +404,7 @@ void SetCurrentGrfLangID(const char *iso_name)
|
||||
for (i=0; i < lengthof(iso_codes); i++) {
|
||||
if (strncmp(iso_codes[i].code, iso_name, strlen(iso_codes[i].code)) == 0) {
|
||||
/* We found a match, so let's use it. */
|
||||
ret = i;
|
||||
ret = iso_codes[i].grfLangID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+16
@@ -19,6 +19,7 @@
|
||||
#include "network.h"
|
||||
#include "ai/ai.h"
|
||||
#include "date.h"
|
||||
#include "bridge_map.h"
|
||||
|
||||
enum {
|
||||
HEADER_SIZE = 49,
|
||||
@@ -356,6 +357,21 @@ static void FixOldVehicles(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsBridgeTile(v->tile) && IsBridgeRamp(v->tile) &&
|
||||
(v->z_pos & (TILE_HEIGHT - 1)) == (TILE_HEIGHT - 1)) {
|
||||
/* Under some circumstances the trains going up a ramp can be one
|
||||
* pixel too low when they enter the bridge. This causes the train
|
||||
* to "disappear" under the bridge, which causes the train to
|
||||
* break into two pieces and crash slightly later.
|
||||
*
|
||||
* This "hack" will make the trains on those positions on the
|
||||
* ramps run one pixel higher. This offset will be automatically
|
||||
* "fixed" when it enters the bridge middle parts or when it
|
||||
* drives down the ramp of the bridge.
|
||||
*/
|
||||
v->z_pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -419,6 +419,11 @@ int ttd_main(int argc, char *argv[])
|
||||
if (startyear != INVALID_YEAR) _patches_newgame.starting_year = startyear;
|
||||
if (generation_seed != GENERATE_NEW_SEED) _patches_newgame.generation_seed = generation_seed;
|
||||
|
||||
/* The width and height must be at least 1 pixel, this
|
||||
* way all internal drawing routines work correctly. */
|
||||
if (_cur_resolution[0] == 0) _cur_resolution[0] = 1;
|
||||
if (_cur_resolution[1] == 0) _cur_resolution[1] = 1;
|
||||
|
||||
if (_dedicated_forks && !dedicated) _dedicated_forks = false;
|
||||
|
||||
// enumerate language files
|
||||
@@ -1611,6 +1616,13 @@ bool AfterLoadGame(void)
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
Vehicle *v;
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
if (v->type == VEH_Road && v->u.road.state >= 250) SETBIT(v->u.road.state, 2);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForProcessor="1"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK;WITH_REV_HACK"
|
||||
StringPooling="TRUE"
|
||||
ExceptionHandling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
@@ -101,7 +101,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK;WITH_REV_HACK"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="2"
|
||||
|
||||
+4
-4
@@ -58,7 +58,7 @@
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK;WITH_REV_HACK"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
@@ -170,7 +170,7 @@
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_EXCEPTION_TRACKER;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK;WITH_REV_HACK"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
@@ -276,7 +276,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK;WITH_REV_HACK"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
@@ -375,7 +375,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_PNG;WITH_FREETYPE;ENABLE_NETWORK;WITH_REV_HACK"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
openttd (0.5.3~rc2-1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
||||
-- Matthijs Kooijman <m.kooijman@student.utwente.nl> Sat, 7 Jul 2007 20:05:00 +0100
|
||||
|
||||
openttd (0.5.3~rc1-1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
||||
-- Matthijs Kooijman <m.kooijman@student.utwente.nl> Thu, 28 Jun 2007 18:00:00 +0100
|
||||
|
||||
openttd (0.5.2-1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
!define APPNAME "OpenTTD" ; Define application name
|
||||
!define APPVERSION "0.5.2" ; Define application version
|
||||
!define INSTALLERVERSION 34 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
|
||||
!define APPVERSION "0.5.3" ; Define application version
|
||||
!define INSTALLERVERSION 36 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
|
||||
|
||||
!define APPURLLINK "http://www.openttd.org"
|
||||
!define APPNAMEANDVERSION "${APPNAME} ${APPVERSION}"
|
||||
|
||||
@@ -134,7 +134,7 @@ static void ChangeWorkingDirectory(char *exe)
|
||||
}
|
||||
}
|
||||
|
||||
void ShowInfo(const unsigned char *str)
|
||||
void ShowInfo(const char *str)
|
||||
{
|
||||
HAB hab;
|
||||
HMQ hmq;
|
||||
|
||||
+3
-3
@@ -65,8 +65,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 0,5,2,0
|
||||
PRODUCTVERSION 0,5,2,0
|
||||
FILEVERSION 0,5,3,0
|
||||
PRODUCTVERSION 0,5,3,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -84,7 +84,7 @@ BEGIN
|
||||
VALUE "Comments", "This program is licensed under the GNU General Public License.\0"
|
||||
VALUE "CompanyName", "OpenTTD Development Team\0"
|
||||
VALUE "FileDescription", "OpenTTD\0"
|
||||
VALUE "FileVersion", "0.5.2\0"
|
||||
VALUE "FileVersion", "0.5.3-RC2\0"
|
||||
VALUE "InternalName", "openttd\0"
|
||||
VALUE "LegalCopyright", "Copyright © OpenTTD Developers 2002-2007. All Rights Reserved.\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
|
||||
+43
-24
@@ -251,31 +251,13 @@ const byte _ffb_64[128] = {
|
||||
48, 56, 56, 58, 56, 60, 60, 62,
|
||||
};
|
||||
|
||||
static void TPFMode1(TrackPathFinder* tpf, TileIndex tile, DiagDirection direction)
|
||||
static void TPFMode1(TrackPathFinder* tpf, TileIndex tile, DiagDirection direction);
|
||||
|
||||
/** Most code of the "Normal" case of TPF Mode 1; for signals special tricks
|
||||
* have to be done, but those happen in TPFMode1; this is just to prevent
|
||||
* gotos ;). */
|
||||
static inline void TPFMode1_NormalCase(TrackPathFinder* tpf, TileIndex tile, TileIndex tile_org, DiagDirection direction)
|
||||
{
|
||||
uint bits;
|
||||
int i;
|
||||
RememberData rd;
|
||||
TileIndex tile_org = tile;
|
||||
|
||||
// check if the old tile can be left at that direction
|
||||
if (tpf->tracktype == TRANSPORT_ROAD) {
|
||||
// road stops and depots now have a track (r4419)
|
||||
// don't enter road stop from the back
|
||||
if (IsRoadStopTile(tile) && GetRoadStopDir(tile) != direction) return;
|
||||
// don't enter road depot from the back
|
||||
if (IsTileDepotType(tile, TRANSPORT_ROAD) && GetRoadDepotDirection(tile) != direction) return;
|
||||
}
|
||||
|
||||
if (IsTunnelTile(tile)) {
|
||||
if (GetTunnelDirection(tile) != direction ||
|
||||
GetTunnelTransportType(tile) != tpf->tracktype) {
|
||||
return;
|
||||
}
|
||||
tile = SkipToEndOfTunnel(tpf, tile, direction);
|
||||
}
|
||||
tile += TileOffsByDiagDir(direction);
|
||||
|
||||
/* Check in case of rail if the owner is the same */
|
||||
if (tpf->tracktype == TRANSPORT_RAIL) {
|
||||
// don't enter train depot from the back
|
||||
@@ -302,11 +284,46 @@ static void TPFMode1(TrackPathFinder* tpf, TileIndex tile, DiagDirection directi
|
||||
/* Check if the new tile is a tunnel or bridge head and that the direction
|
||||
* and transport type match */
|
||||
if (IsTileType(tile, MP_TUNNELBRIDGE) && IsTunnel(tile)) {
|
||||
if (GetTunnelTransportType(tile) != tpf->tracktype) {
|
||||
return;
|
||||
}
|
||||
/* Only skip through the tunnel if heading inwards. We can
|
||||
* be headed outwards if our starting position was in a
|
||||
* tunnel and we're pathfinding backwards */
|
||||
if (GetTunnelDirection(tile) == direction) {
|
||||
tile = SkipToEndOfTunnel(tpf, tile, direction);
|
||||
} else if (GetTunnelDirection(tile) != ReverseDiagDir(direction)) {
|
||||
/* We don't support moving through the sides of a tunnel
|
||||
* entrance :-) */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void TPFMode1(TrackPathFinder* tpf, TileIndex tile, DiagDirection direction)
|
||||
{
|
||||
uint bits;
|
||||
int i;
|
||||
RememberData rd;
|
||||
TileIndex tile_org = tile;
|
||||
|
||||
// check if the old tile can be left at that direction
|
||||
if (tpf->tracktype == TRANSPORT_ROAD) {
|
||||
// road stops and depots now have a track (r4419)
|
||||
// don't enter road stop from the back
|
||||
if (IsRoadStopTile(tile) && GetRoadStopDir(tile) != direction) return;
|
||||
// don't enter road depot from the back
|
||||
if (IsTileDepotType(tile, TRANSPORT_ROAD) && GetRoadDepotDirection(tile) != direction) return;
|
||||
}
|
||||
|
||||
if (IsTunnelTile(tile)) {
|
||||
if (GetTunnelDirection(tile) != direction ||
|
||||
GetTunnelTransportType(tile) != tpf->tracktype) {
|
||||
return;
|
||||
}
|
||||
tile = SkipToEndOfTunnel(tpf, tile, direction);
|
||||
}
|
||||
tile += TileOffsByDiagDir(direction);
|
||||
|
||||
tpf->rd.cur_length++;
|
||||
|
||||
@@ -336,6 +353,8 @@ static void TPFMode1(TrackPathFinder* tpf, TileIndex tile, DiagDirection directi
|
||||
}
|
||||
}
|
||||
|
||||
TPFMode1_NormalCase(tpf, tile, tile_org, direction);
|
||||
|
||||
/* the next is only used when signals are checked.
|
||||
* seems to go in 2 directions simultaneously */
|
||||
|
||||
|
||||
@@ -838,7 +838,9 @@ int32 CmdPlayerCtrl(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
* _local_player/_network_playas: what they play as
|
||||
* cid = requested company/player of joining client */
|
||||
Player *p;
|
||||
#ifdef ENABLE_NETWORK
|
||||
uint16 cid = p2; // ClientID
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
/* This command is only executed in a multiplayer game */
|
||||
if (!_networking) return CMD_ERROR;
|
||||
@@ -861,12 +863,10 @@ int32 CmdPlayerCtrl(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
NetworkClientInfo *ci = &_network_client_info[cid];
|
||||
ci->client_playas = PLAYER_SPECTATOR;
|
||||
NetworkUpdateClientInfo(ci->client_index);
|
||||
} else
|
||||
#endif /* ENABLE_NETWORK */
|
||||
{
|
||||
} else if (_local_player == PLAYER_SPECTATOR) {
|
||||
_network_playas = PLAYER_SPECTATOR;
|
||||
SetLocalPlayer(PLAYER_SPECTATOR);
|
||||
}
|
||||
#endif /* ENABLE_NETWORK */
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+5
-8
@@ -201,20 +201,17 @@ static uint32 CheckRailSlope(Slope tileh, TrackBits rail_bits, TrackBits existin
|
||||
}
|
||||
|
||||
// no special foundation
|
||||
if ((~_valid_tileh_slopes[0][tileh] & rail_bits) == 0)
|
||||
if ((~_valid_tileh_slopes[0][tileh] & rail_bits) == 0) {
|
||||
return 0;
|
||||
} else if (!_patches.build_on_slopes || _is_old_ai_player) {
|
||||
return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
|
||||
}
|
||||
|
||||
if ((~_valid_tileh_slopes[1][tileh] & rail_bits) == 0 || ( // whole tile is leveled up
|
||||
(rail_bits == TRACK_BIT_X || rail_bits == TRACK_BIT_Y) &&
|
||||
(tileh == SLOPE_W || tileh == SLOPE_S || tileh == SLOPE_E || tileh == SLOPE_N)
|
||||
)) { // partly up
|
||||
if (existing != 0) {
|
||||
return 0;
|
||||
} else if (!_patches.build_on_slopes || _is_old_ai_player) {
|
||||
return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
|
||||
} else {
|
||||
return _price.terraform;
|
||||
}
|
||||
return (existing != 0) ? 0 : _price.terraform;
|
||||
}
|
||||
}
|
||||
return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
OpenTTD README
|
||||
Last updated: 2007-05-29
|
||||
Release version: 0.5.2
|
||||
Last updated: 2007-07-07
|
||||
Release version: 0.5.3-RC2
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -332,7 +332,7 @@ static const Depot* FindClosestRoadDepot(const Vehicle* v)
|
||||
/* See where we are now */
|
||||
Trackdir trackdir = GetVehicleTrackdir(v);
|
||||
|
||||
ftd = NPFRouteToDepotBreadthFirst(v->tile, trackdir, TRANSPORT_ROAD, v->owner, INVALID_RAILTYPE);
|
||||
ftd = NPFRouteToDepotBreadthFirstTwoWay(v->tile, trackdir, v->tile, ReverseTrackdir(trackdir), TRANSPORT_ROAD, v->owner, INVALID_RAILTYPE, 0);
|
||||
if (ftd.best_bird_dist == 0) {
|
||||
return GetDepotByTile(ftd.node.tile); /* Target found */
|
||||
} else {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "screenshot.h"
|
||||
#include "variables.h"
|
||||
#include "date.h"
|
||||
#include "fileio.h"
|
||||
|
||||
char _screenshot_format_name[8];
|
||||
uint _num_screenshot_formats;
|
||||
@@ -507,6 +508,7 @@ static char *MakeScreenshotName(const char *ext)
|
||||
GetString(_screenshot_name, STR_4004, lastof(_screenshot_name));
|
||||
}
|
||||
|
||||
SanitizeFilename(_screenshot_name);
|
||||
base = strchr(_screenshot_name, 0);
|
||||
base[0] = '.'; strcpy(base + 1, ext);
|
||||
|
||||
|
||||
+4
-1
@@ -239,7 +239,8 @@ static void ProcessShipOrder(Vehicle *v)
|
||||
|
||||
if (order->type == v->current_order.type &&
|
||||
order->flags == v->current_order.flags &&
|
||||
order->dest == v->current_order.dest)
|
||||
order->dest == v->current_order.dest &&
|
||||
(order->type != OT_GOTO_STATION || GetStation(order->dest)->dock_tile != 0))
|
||||
return;
|
||||
|
||||
v->current_order = *order;
|
||||
@@ -253,6 +254,8 @@ static void ProcessShipOrder(Vehicle *v)
|
||||
st = GetStation(order->dest);
|
||||
if (st->dock_tile != 0) {
|
||||
v->dest_tile = TILE_ADD(st->dock_tile, ToTileIndexDiff(GetDockOffset(st->dock_tile)));
|
||||
} else {
|
||||
v->cur_order_index++;
|
||||
}
|
||||
} else if (order->type == OT_GOTO_DEPOT) {
|
||||
v->dest_tile = GetDepot(order->dest)->xy;
|
||||
|
||||
@@ -208,7 +208,7 @@ static void SndPlayScreenCoordFx(SoundFx sound, int x, int y)
|
||||
|
||||
StartSound(
|
||||
sound,
|
||||
left / (vp->virtual_width / ((PANNING_LEVELS << 1) + 1)) - PANNING_LEVELS,
|
||||
left / max(1, vp->virtual_width / ((PANNING_LEVELS << 1) + 1)) - PANNING_LEVELS,
|
||||
(GetSound(sound)->volume * msf.effect_vol * _vol_factor_by_zoom[vp->zoom]) >> 15
|
||||
);
|
||||
return;
|
||||
|
||||
+23
-6
@@ -84,10 +84,11 @@ bool SpriteExists(SpriteID id)
|
||||
|
||||
static void* AllocSprite(size_t);
|
||||
|
||||
static void* ReadSprite(SpriteID id)
|
||||
static void* ReadSprite(SpriteID id, bool real_sprite)
|
||||
{
|
||||
uint num;
|
||||
byte type;
|
||||
uint32 filepos = _sprite_file_pos[id];
|
||||
|
||||
DEBUG(spritecache, 9) ("load sprite %d", id);
|
||||
|
||||
@@ -95,15 +96,25 @@ static void* ReadSprite(SpriteID id)
|
||||
DEBUG(spritecache, 1) ("Tried to load non-existing sprite #%d. Probable cause: Wrong/missing NewGRFs", id);
|
||||
|
||||
/* SPR_IMG_QUERY is a BIG FAT RED ? */
|
||||
id = SPR_IMG_QUERY;
|
||||
filepos = _sprite_file_pos[SPR_IMG_QUERY];
|
||||
}
|
||||
|
||||
FioSeekToFile(_sprite_file_pos[id]);
|
||||
FioSeekToFile(filepos);
|
||||
|
||||
num = FioReadWord();
|
||||
type = FioReadByte();
|
||||
if (type == 0xFF) {
|
||||
byte* dest = AllocSprite(num);
|
||||
byte* dest;
|
||||
|
||||
if (real_sprite) {
|
||||
static byte warning_level = 0;
|
||||
DEBUG(misc, warning_level) ("Tried to load non sprite #%d as a real sprite. Probable cause: NewGRF interference", id);
|
||||
warning_level = 6;
|
||||
if (id == SPR_IMG_QUERY) error("Uhm, would you be so kind not to load a NewGRF that makes the 'query' sprite a non- sprite?");
|
||||
return (void*)GetSprite(SPR_IMG_QUERY);
|
||||
}
|
||||
|
||||
dest = AllocSprite(num);
|
||||
|
||||
_sprite_ptr[id] = dest;
|
||||
FioReadBlock(dest, num);
|
||||
@@ -115,6 +126,12 @@ static void* ReadSprite(SpriteID id)
|
||||
Sprite* sprite;
|
||||
byte* dest;
|
||||
|
||||
if (!real_sprite) {
|
||||
static byte warning_level = 0;
|
||||
DEBUG(misc, warning_level) ("Tried to load real sprite #%d as a non sprite. Probable cause: NewGRF interference", id);
|
||||
warning_level = 6;
|
||||
}
|
||||
|
||||
num = (type & 0x02) ? width * height : num - 8;
|
||||
sprite = AllocSprite(sizeof(*sprite) + num);
|
||||
_sprite_ptr[id] = sprite;
|
||||
@@ -423,7 +440,7 @@ static uint RotateSprite(uint s)
|
||||
}
|
||||
#endif
|
||||
|
||||
const void *GetRawSprite(SpriteID sprite)
|
||||
const void *GetRawSprite(SpriteID sprite, bool real_sprite)
|
||||
{
|
||||
void* p;
|
||||
|
||||
@@ -443,7 +460,7 @@ const void *GetRawSprite(SpriteID sprite)
|
||||
|
||||
p = _sprite_ptr[sprite];
|
||||
// Load the sprite, if it is not loaded, yet
|
||||
if (p == NULL) p = ReadSprite(sprite);
|
||||
if (p == NULL) p = ReadSprite(sprite, real_sprite);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -12,17 +12,17 @@ typedef struct Sprite {
|
||||
byte data[VARARRAY_SIZE];
|
||||
} Sprite;
|
||||
|
||||
const void *GetRawSprite(SpriteID sprite);
|
||||
const void *GetRawSprite(SpriteID sprite, bool real_sprite);
|
||||
bool SpriteExists(SpriteID sprite);
|
||||
|
||||
static inline const Sprite *GetSprite(SpriteID sprite)
|
||||
{
|
||||
return GetRawSprite(sprite);
|
||||
return GetRawSprite(sprite, true);
|
||||
}
|
||||
|
||||
static inline const byte *GetNonSprite(SpriteID sprite)
|
||||
{
|
||||
return GetRawSprite(sprite);
|
||||
return GetRawSprite(sprite, false);
|
||||
}
|
||||
|
||||
void GfxInitSpriteMem(void);
|
||||
|
||||
+1
-1
@@ -469,7 +469,7 @@ static const CmdStruct _cmd_structs[] = {
|
||||
|
||||
// These are special versions of {STRING1}
|
||||
// The first string includes the second string.
|
||||
{"COMPANY", EmitSingleChar, SCC_STRING1, 1, 0},
|
||||
{"COMPANY", EmitSingleChar, SCC_STRING1, 2, 0},
|
||||
{"PLAYERNAME", EmitSingleChar, SCC_STRING1, 1, 0},
|
||||
{"VEHICLE", EmitSingleChar, SCC_STRING1, 1, 0},
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
* All sprites which are described here are referenced only one to a handful of times
|
||||
* throughout the code. When introducing new sprite enums, use meaningful names.
|
||||
* Don't be lazy and typing, and only use abbrevations when their meaning is clear or
|
||||
* the length of the enum would get out of hand. In that case EXPLAIN THE ABBREVATION
|
||||
* the length of the enum would get out of hand. In that case EXPLAINÂ THE ABBREVATION
|
||||
* IN THIS FILE, and perhaps add some comments in the code where it is used.
|
||||
* Now, don't whine about this being too much typing work if the enums are like
|
||||
* 30 characters in length. If your editor doen't help you simplifying your work,
|
||||
|
||||
+82
-58
@@ -1325,6 +1325,7 @@ int32 CmdStartStopTrain(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
*/
|
||||
int32 CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
{
|
||||
Window *w = NULL;
|
||||
Vehicle *v, *tmp, *first;
|
||||
Vehicle *new_f = NULL;
|
||||
int32 cost = 0;
|
||||
@@ -1349,7 +1350,8 @@ int32 CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
if (v == first && IsFrontEngine(first)) {
|
||||
DeleteWindowById(WC_VEHICLE_VIEW, first->index);
|
||||
w = FindWindowById(WC_VEHICLE_VIEW, first->index);
|
||||
if (w != NULL) DeleteWindow(w);
|
||||
}
|
||||
if (IsLocalPlayer() && (p1 == 1 || !(RailVehInfo(v->engine_type)->flags & RVI_WAGON))) {
|
||||
InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train);
|
||||
@@ -1416,7 +1418,8 @@ int32 CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
first->prev_shared = NULL;
|
||||
first->next_shared = NULL;
|
||||
|
||||
if (IsLocalPlayer()) ShowTrainViewWindow(new_f);
|
||||
/* If we deleted a window then open a new one for the 'new' train */
|
||||
if (IsLocalPlayer() && w != NULL) ShowTrainViewWindow(new_f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1469,6 +1472,15 @@ int32 CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
|
||||
if (rear != NULL) {
|
||||
cost -= rear->value;
|
||||
|
||||
/* If this is a multiheaded vehicle with nothing
|
||||
* between the parts, tmp will be pointing to the
|
||||
* rear part, which is unlinked from the train and
|
||||
* deleted here. However, because tmp has already
|
||||
* been set it needs to be updated now so that the
|
||||
* loop never sees the rear part. */
|
||||
if (tmp == rear) tmp = GetNextVehicle(tmp);
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
first = UnlinkWagon(rear, first);
|
||||
DeleteDepotHighlightOfVehicle(rear);
|
||||
@@ -2736,26 +2748,32 @@ static void TrainEnterStation(Vehicle *v, StationID station)
|
||||
|
||||
static byte AfterSetTrainPos(Vehicle *v, bool new_tile)
|
||||
{
|
||||
byte new_z, old_z;
|
||||
byte old_z = v->z_pos;
|
||||
|
||||
// need this hint so it returns the right z coordinate on bridges.
|
||||
_get_z_hint = v->z_pos;
|
||||
new_z = GetSlopeZ(v->x_pos, v->y_pos);
|
||||
/* need this hint so it returns the right z coordinate on bridges. */
|
||||
_get_z_hint = old_z;
|
||||
v->z_pos = GetSlopeZ(v->x_pos, v->y_pos);
|
||||
_get_z_hint = 0;
|
||||
|
||||
old_z = v->z_pos;
|
||||
v->z_pos = new_z;
|
||||
|
||||
if (new_tile) {
|
||||
CLRBIT(v->u.rail.flags, VRF_GOINGUP);
|
||||
CLRBIT(v->u.rail.flags, VRF_GOINGDOWN);
|
||||
|
||||
if (new_z != old_z) {
|
||||
TileIndex tile = TileVirtXY(v->x_pos, v->y_pos);
|
||||
if (v->u.rail.track == TRACK_BIT_X || v->u.rail.track == TRACK_BIT_Y) {
|
||||
/* Any track that isn't TRACK_BIT_X or TRACK_BIT_Y cannot be sloped.
|
||||
* To check whether the current tile is sloped, and in which
|
||||
* direction it is sloped, we get the 'z' at the center of
|
||||
* the tile (middle_z) and the edge of the tile (old_z),
|
||||
* which we then can compare. */
|
||||
static const int HALF_TILE_SIZE = TILE_SIZE / 2;
|
||||
static const int INV_TILE_SIZE_MASK = ~(TILE_SIZE - 1);
|
||||
|
||||
// XXX workaround, whole UP/DOWN detection needs overhaul
|
||||
if (!IsTunnelTile(tile)) {
|
||||
SETBIT(v->u.rail.flags, (new_z > old_z) ? VRF_GOINGUP : VRF_GOINGDOWN);
|
||||
byte middle_z = GetSlopeZ((v->x_pos & INV_TILE_SIZE_MASK) | HALF_TILE_SIZE, (v->y_pos & INV_TILE_SIZE_MASK) | HALF_TILE_SIZE);
|
||||
|
||||
/* For some reason tunnel tiles are always given as sloped :(
|
||||
* But they are not sloped... */
|
||||
if (middle_z != v->z_pos && !IsTunnelTile(TileVirtXY(v->x_pos, v->y_pos))) {
|
||||
SETBIT(v->u.rail.flags, (middle_z > old_z) ? VRF_GOINGUP : VRF_GOINGDOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2903,28 +2921,6 @@ static void TrainMovedChangeSignals(TileIndex tile, DiagDirection dir)
|
||||
}
|
||||
|
||||
|
||||
typedef struct TrainCollideChecker {
|
||||
const Vehicle *v;
|
||||
const Vehicle *v_skip;
|
||||
} TrainCollideChecker;
|
||||
|
||||
static void *FindTrainCollideEnum(Vehicle *v, void *data)
|
||||
{
|
||||
const TrainCollideChecker* tcc = data;
|
||||
|
||||
if (v != tcc->v &&
|
||||
v != tcc->v_skip &&
|
||||
v->type == VEH_Train &&
|
||||
v->u.rail.track != 0x80 &&
|
||||
myabs(v->z_pos - tcc->v->z_pos) <= 6 &&
|
||||
myabs(v->x_pos - tcc->v->x_pos) < 6 &&
|
||||
myabs(v->y_pos - tcc->v->y_pos) < 6) {
|
||||
return v;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void SetVehicleCrashed(Vehicle *v)
|
||||
{
|
||||
Vehicle *u;
|
||||
@@ -2950,6 +2946,47 @@ static uint CountPassengersInTrain(const Vehicle* v)
|
||||
return num;
|
||||
}
|
||||
|
||||
typedef struct TrainCollideChecker {
|
||||
Vehicle *v;
|
||||
const Vehicle *v_skip;
|
||||
uint num;
|
||||
} TrainCollideChecker;
|
||||
|
||||
static void *FindTrainCollideEnum(Vehicle *v, void *data)
|
||||
{
|
||||
TrainCollideChecker* tcc = (TrainCollideChecker*)data;
|
||||
|
||||
if (v != tcc->v &&
|
||||
v != tcc->v_skip &&
|
||||
v->type == VEH_Train &&
|
||||
v->u.rail.track != 0x80 &&
|
||||
myabs(v->z_pos - tcc->v->z_pos) < 6 &&
|
||||
myabs(v->x_pos - tcc->v->x_pos) < 6 &&
|
||||
myabs(v->y_pos - tcc->v->y_pos) < 6 ) {
|
||||
|
||||
Vehicle *coll = GetFirstVehicleInChain(v);
|
||||
|
||||
/* it can't collide with its own wagons */
|
||||
if (tcc->v == coll ||
|
||||
(tcc->v->u.rail.track == 0x40 && (tcc->v->direction & 2) != (v->direction & 2)))
|
||||
return NULL;
|
||||
|
||||
/* two drivers + passengers killed in train tcc->v (if it was not crashed already) */
|
||||
if (!(tcc->v->vehstatus & VS_CRASHED)) {
|
||||
tcc->num += 2 + CountPassengersInTrain(tcc->v);
|
||||
SetVehicleCrashed(tcc->v);
|
||||
}
|
||||
|
||||
if (!(coll->vehstatus & VS_CRASHED)) {
|
||||
/* two drivers + passengers killed in train coll (if it was not crashed already) */
|
||||
tcc->num += 2 + CountPassengersInTrain(coll);
|
||||
SetVehicleCrashed(coll);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks whether the specified train has a collision with another vehicle. If
|
||||
* so, destroys this vehicle, and the other vehicle if its subtype has TS_Front.
|
||||
@@ -2959,9 +2996,6 @@ static uint CountPassengersInTrain(const Vehicle* v)
|
||||
static void CheckTrainCollision(Vehicle *v)
|
||||
{
|
||||
TrainCollideChecker tcc;
|
||||
Vehicle *coll;
|
||||
Vehicle *realcoll;
|
||||
uint num;
|
||||
|
||||
/* can't collide in depot */
|
||||
if (v->u.rail.track == 0x80) return;
|
||||
@@ -2970,28 +3004,15 @@ static void CheckTrainCollision(Vehicle *v)
|
||||
|
||||
tcc.v = v;
|
||||
tcc.v_skip = v->next;
|
||||
tcc.num = 0;
|
||||
|
||||
/* find colliding vehicle */
|
||||
realcoll = VehicleFromPos(TileVirtXY(v->x_pos, v->y_pos), &tcc, FindTrainCollideEnum);
|
||||
if (realcoll == NULL) return;
|
||||
/* find colliding vehicles */
|
||||
VehicleFromPos(v->tile, &tcc, FindTrainCollideEnum);
|
||||
|
||||
coll = GetFirstVehicleInChain(realcoll);
|
||||
/* any dead -> no crash */
|
||||
if (tcc.num == 0) return;
|
||||
|
||||
/* it can't collide with its own wagons */
|
||||
if (v == coll ||
|
||||
(v->u.rail.track & 0x40 && (v->direction & 2) != (realcoll->direction & 2)))
|
||||
return;
|
||||
|
||||
//two drivers + passangers killed in train v
|
||||
num = 2 + CountPassengersInTrain(v);
|
||||
if (!(coll->vehstatus & VS_CRASHED))
|
||||
//two drivers + passangers killed in train coll (if it was not crashed already)
|
||||
num += 2 + CountPassengersInTrain(coll);
|
||||
|
||||
SetVehicleCrashed(v);
|
||||
if (IsFrontEngine(coll)) SetVehicleCrashed(coll);
|
||||
|
||||
SetDParam(0, num);
|
||||
SetDParam(0, tcc.num);
|
||||
AddNewsItem(STR_8868_TRAIN_CRASH_DIE_IN_FIREBALL,
|
||||
NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
|
||||
v->index,
|
||||
@@ -3660,6 +3681,9 @@ void OnNewDay_Train(Vehicle *v)
|
||||
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
|
||||
InvalidateWindowClasses(WC_TRAINS_LIST);
|
||||
}
|
||||
} else if (IsTrainEngine(v)) {
|
||||
/* Also age engines that aren't front engines */
|
||||
AgeVehicle(v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ TileIndex GetOtherTunnelEnd(TileIndex tile)
|
||||
}
|
||||
|
||||
|
||||
static bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir)
|
||||
bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir)
|
||||
{
|
||||
TileIndexDiff delta = TileOffsByDiagDir(dir);
|
||||
uint height;
|
||||
|
||||
@@ -38,6 +38,7 @@ static inline TransportType GetTunnelTransportType(TileIndex t)
|
||||
|
||||
TileIndex GetOtherTunnelEnd(TileIndex);
|
||||
bool IsTunnelInWay(TileIndex, uint z);
|
||||
bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir);
|
||||
|
||||
|
||||
static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d)
|
||||
|
||||
+17
-1
@@ -452,6 +452,7 @@ int32 CmdBuildTunnel(TileIndex start_tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
uint end_z;
|
||||
int32 cost;
|
||||
int32 ret;
|
||||
DiagDirection tunnel_in_way_dir;
|
||||
|
||||
_build_tunnel_endtile = 0;
|
||||
|
||||
@@ -476,6 +477,12 @@ int32 CmdBuildTunnel(TileIndex start_tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
* position, because of increased-cost-by-length: 'cost += cost >> 3' */
|
||||
cost = 0;
|
||||
delta = TileOffsByDiagDir(direction);
|
||||
if (OtherAxis(DiagDirToAxis(direction)) == AXIS_X) {
|
||||
tunnel_in_way_dir = (TileX(start_tile) < (MapMaxX() / 2)) ? DIAGDIR_SW : DIAGDIR_NE;
|
||||
} else {
|
||||
tunnel_in_way_dir = (TileY(start_tile) < (MapMaxX() / 2)) ? DIAGDIR_SE : DIAGDIR_NW;
|
||||
}
|
||||
|
||||
end_tile = start_tile;
|
||||
for (;;) {
|
||||
end_tile += delta;
|
||||
@@ -483,7 +490,7 @@ int32 CmdBuildTunnel(TileIndex start_tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
|
||||
if (start_z == end_z) break;
|
||||
|
||||
if (!_cheats.crossing_tunnels.value && IsTunnelInWay(end_tile, start_z)) {
|
||||
if (!_cheats.crossing_tunnels.value && IsTunnelInWayDir(end_tile, start_z, tunnel_in_way_dir)) {
|
||||
return_cmd_error(STR_5003_ANOTHER_TUNNEL_IN_THE_WAY);
|
||||
}
|
||||
|
||||
@@ -500,6 +507,15 @@ int32 CmdBuildTunnel(TileIndex start_tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
|
||||
// slope of end tile must be complementary to the slope of the start tile
|
||||
if (end_tileh != ComplementSlope(start_tileh)) {
|
||||
/* Some (rail) track bits might be terraformed into the correct direction,
|
||||
* but that would still leave tracks on foundation. Therefor excavation will
|
||||
* always fail for rail tiles. On the other hand, for road tiles it might
|
||||
* succeed when there is only one road bit on the tile, but then that road
|
||||
* bit is removed leaving a clear tile.
|
||||
* This therefor preserves the behaviour that half road tiles are always removable.
|
||||
*/
|
||||
if (IsTileType(end_tile, MP_RAILWAY)) return_cmd_error(STR_1008_MUST_REMOVE_RAILROAD_TRACK);
|
||||
|
||||
ret = DoCommand(end_tile, end_tileh & start_tileh, 0, flags, CMD_TERRAFORM_LAND);
|
||||
if (CmdFailed(ret)) return_cmd_error(STR_5005_UNABLE_TO_EXCAVATE_LAND);
|
||||
} else {
|
||||
|
||||
@@ -88,6 +88,12 @@ bool FiosIsValidFile(const char *path, const struct dirent *ent, struct stat *sb
|
||||
/* On MorphOS or AmigaOS paths look like: "Volume:directory/subdirectory" */
|
||||
if (FiosIsRoot(path)) {
|
||||
snprintf(filename, lengthof(filename), "%s:%s", path, ent->d_name);
|
||||
} else if (path[strlen(path) - 1] == PATHSEPCHAR) { // PATHSEP is only one byte
|
||||
/* Paths with double PATHSEP like "directory//foobar.ext" won't work under MorphOS/AmigaOS
|
||||
* (the extra slash is interpreted like ".." under UNIXes). UNIXes simply interpret double
|
||||
* slash as single slash, so the adding of the PATHSEP further below could actually be
|
||||
* removed. */
|
||||
snprintf(filename, lengthof(filename), "%s%s", path, ent->d_name);
|
||||
} else // XXX - only next line!
|
||||
#endif
|
||||
snprintf(filename, lengthof(filename), "%s" PATHSEP "%s", path, ent->d_name);
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "newgrf_engine.h"
|
||||
#include "newgrf_sound.h"
|
||||
|
||||
#define INVALID_COORD (-0x8000)
|
||||
#define INVALID_COORD (0x7fffffff)
|
||||
#define GEN_HASH(x, y) ((GB((y), 6, 6) << 6) + GB((x), 7, 6))
|
||||
|
||||
/*
|
||||
@@ -823,17 +823,29 @@ void ViewportAddVehicles(DrawPixelInfo *dpi)
|
||||
const int b = dpi->top + dpi->height;
|
||||
|
||||
// The hash area to scan
|
||||
const int xl = GB(l - 70, 7, 6);
|
||||
const int xu = GB(r, 7, 6);
|
||||
const int yl = GB(t - 70, 6, 6) << 6;
|
||||
const int yu = GB(b, 6, 6) << 6;
|
||||
int xl, xu, yl, yu, x, y;
|
||||
|
||||
int x;
|
||||
int y;
|
||||
if (dpi->width + 70 < (1 << (7 + 6))) {
|
||||
xl = GB(l - 70, 7, 6);
|
||||
xu = GB(r, 7, 6);
|
||||
} else {
|
||||
/* scan whole hash row */
|
||||
xl = 0;
|
||||
xu = 0x3F;
|
||||
}
|
||||
|
||||
if (dpi->height + 70 < (1 << (6 + 6))) {
|
||||
yl = GB(t - 70, 6, 6) << 6;
|
||||
yu = GB(b, 6, 6) << 6;
|
||||
} else {
|
||||
/* scan whole column */
|
||||
yl = 0;
|
||||
yu = 0x3F << 6;
|
||||
}
|
||||
|
||||
for (y = yl;; y = (y + (1 << 6)) & (0x3F << 6)) {
|
||||
for (x = xl;; x = (x + 1) & 0x3F) {
|
||||
VehicleID veh = _vehicle_position_hash[(x + y) & 0xFFFF];
|
||||
VehicleID veh = _vehicle_position_hash[x + y]; // already masked & 0xFFF
|
||||
|
||||
while (veh != INVALID_VEHICLE) {
|
||||
const Vehicle* v = GetVehicle(veh);
|
||||
@@ -2924,7 +2936,7 @@ PalSpriteID GetVehiclePalette(const Vehicle *v)
|
||||
{
|
||||
if (v->type == VEH_Train) {
|
||||
return GetEngineColourMap(
|
||||
(v->u.rail.first_engine != INVALID_ENGINE && (IsArticulatedPart(v) || UsesWagonOverride(v))) ?
|
||||
(v->u.rail.first_engine != INVALID_ENGINE && (UsesWagonOverride(v) || (IsArticulatedPart(v) && (RailVehInfo(v->engine_type)->flags & RVI_WAGON) != 0))) ?
|
||||
v->u.rail.first_engine : v->engine_type,
|
||||
v->owner,
|
||||
v->u.rail.first_engine,
|
||||
|
||||
+1
-1
@@ -1769,7 +1769,7 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
|
||||
|
||||
/* XXX - Substite string since the dropdown cannot handle dynamic strings */
|
||||
action_str[2] = depot_name[vl->vehicle_type - VEH_Train];
|
||||
ShowDropDownMenu(w, action_str, 0, VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN, 0, 0);
|
||||
ShowDropDownMenu(w, action_str, 0, VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN, 0, (w->window_number & VLW_MASK) == VLW_STANDARD ? 0 : 1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+102
-78
@@ -209,6 +209,82 @@ static void CALLBACK TrackMouseTimerProc(HWND hwnd, UINT msg, UINT event, DWORD
|
||||
}
|
||||
}
|
||||
|
||||
static void MakeWindow(bool full_screen)
|
||||
{
|
||||
_fullscreen = full_screen;
|
||||
|
||||
_wnd.double_size = _double_size && !full_screen;
|
||||
|
||||
// recreate window?
|
||||
if ((full_screen || _wnd.fullscreen) && _wnd.main_wnd) {
|
||||
DestroyWindow(_wnd.main_wnd);
|
||||
_wnd.main_wnd = 0;
|
||||
}
|
||||
|
||||
if (full_screen) {
|
||||
DEVMODE settings;
|
||||
|
||||
memset(&settings, 0, sizeof(settings));
|
||||
settings.dmSize = sizeof(settings);
|
||||
settings.dmFields =
|
||||
(_fullscreen_bpp != 0 ? DM_BITSPERPEL : 0) |
|
||||
DM_PELSWIDTH |
|
||||
DM_PELSHEIGHT |
|
||||
(_display_hz != 0 ? DM_DISPLAYFREQUENCY : 0);
|
||||
settings.dmBitsPerPel = _fullscreen_bpp;
|
||||
settings.dmPelsWidth = _wnd.width_org;
|
||||
settings.dmPelsHeight = _wnd.height_org;
|
||||
settings.dmDisplayFrequency = _display_hz;
|
||||
|
||||
if (ChangeDisplaySettings(&settings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) {
|
||||
MakeWindow(false);
|
||||
return;
|
||||
}
|
||||
} else if (_wnd.fullscreen) {
|
||||
// restore display?
|
||||
ChangeDisplaySettings(NULL, 0);
|
||||
}
|
||||
|
||||
{
|
||||
RECT r;
|
||||
DWORD style, showstyle;
|
||||
int x, y, w, h;
|
||||
|
||||
showstyle = SW_SHOWNORMAL;
|
||||
_wnd.fullscreen = full_screen;
|
||||
if (_wnd.fullscreen) {
|
||||
style = WS_POPUP;
|
||||
SetRect(&r, 0, 0, _wnd.width_org, _wnd.height_org);
|
||||
} else {
|
||||
style = WS_OVERLAPPEDWINDOW;
|
||||
/* On window creation, check if we were in maximize mode before */
|
||||
if (_window_maximize) showstyle = SW_SHOWMAXIMIZED;
|
||||
SetRect(&r, 0, 0, _wnd.width, _wnd.height);
|
||||
}
|
||||
|
||||
AdjustWindowRect(&r, style, FALSE);
|
||||
w = r.right - r.left;
|
||||
h = r.bottom - r.top;
|
||||
x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2;
|
||||
y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2;
|
||||
|
||||
if (_wnd.main_wnd) {
|
||||
ShowWindow(_wnd.main_wnd, SW_SHOWNORMAL); // remove maximize-flag
|
||||
SetWindowPos(_wnd.main_wnd, 0, x, y, w, h, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER);
|
||||
} else {
|
||||
extern const char _openttd_revision[];
|
||||
TCHAR Windowtitle[50];
|
||||
|
||||
_sntprintf(Windowtitle, sizeof(Windowtitle), _T("OpenTTD %s"), MB_TO_WIDE(_openttd_revision));
|
||||
|
||||
_wnd.main_wnd = CreateWindow(_T("OTTD"), Windowtitle, style, x, y, w, h, 0, 0, GetModuleHandle(NULL), 0);
|
||||
if (_wnd.main_wnd == NULL) error("CreateWindow failed");
|
||||
ShowWindow(_wnd.main_wnd, showstyle);
|
||||
}
|
||||
}
|
||||
GameSizeChanged(); // invalidate all windows, force redraw
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static uint32 keycode = 0;
|
||||
@@ -533,10 +609,34 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||
return 0;
|
||||
}
|
||||
|
||||
case WM_ACTIVATEAPP:
|
||||
_wnd.has_focus = (bool)wParam;
|
||||
case WM_SETFOCUS:
|
||||
_wnd.has_focus = true;
|
||||
break;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
_wnd.has_focus = false;
|
||||
break;
|
||||
|
||||
#if !defined(WINCE)
|
||||
case WM_ACTIVATE: {
|
||||
bool active = (LOWORD(wParam) != WA_INACTIVE);
|
||||
bool minimized = (HIWORD(wParam) != 0);
|
||||
if (_wnd.fullscreen) {
|
||||
if (active && minimized) {
|
||||
/* Restore the game window */
|
||||
ShowWindow(hwnd, SW_RESTORE);
|
||||
MakeWindow(true);
|
||||
} else if (!active && !minimized) {
|
||||
/* Minimise the window and restore desktop */
|
||||
ShowWindow(hwnd, SW_MINIMIZE);
|
||||
ChangeDisplaySettings(NULL, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
@@ -564,82 +664,6 @@ static void RegisterWndClass(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void MakeWindow(bool full_screen)
|
||||
{
|
||||
_fullscreen = full_screen;
|
||||
|
||||
_wnd.double_size = _double_size && !full_screen;
|
||||
|
||||
// recreate window?
|
||||
if ((full_screen || _wnd.fullscreen) && _wnd.main_wnd) {
|
||||
DestroyWindow(_wnd.main_wnd);
|
||||
_wnd.main_wnd = 0;
|
||||
}
|
||||
|
||||
if (full_screen) {
|
||||
DEVMODE settings;
|
||||
|
||||
memset(&settings, 0, sizeof(settings));
|
||||
settings.dmSize = sizeof(settings);
|
||||
settings.dmFields =
|
||||
(_fullscreen_bpp != 0 ? DM_BITSPERPEL : 0) |
|
||||
DM_PELSWIDTH |
|
||||
DM_PELSHEIGHT |
|
||||
(_display_hz != 0 ? DM_DISPLAYFREQUENCY : 0);
|
||||
settings.dmBitsPerPel = _fullscreen_bpp;
|
||||
settings.dmPelsWidth = _wnd.width_org;
|
||||
settings.dmPelsHeight = _wnd.height_org;
|
||||
settings.dmDisplayFrequency = _display_hz;
|
||||
|
||||
if (ChangeDisplaySettings(&settings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) {
|
||||
MakeWindow(false);
|
||||
return;
|
||||
}
|
||||
} else if (_wnd.fullscreen) {
|
||||
// restore display?
|
||||
ChangeDisplaySettings(NULL, 0);
|
||||
}
|
||||
|
||||
{
|
||||
RECT r;
|
||||
DWORD style, showstyle;
|
||||
int x, y, w, h;
|
||||
|
||||
showstyle = SW_SHOWNORMAL;
|
||||
_wnd.fullscreen = full_screen;
|
||||
if (_wnd.fullscreen) {
|
||||
style = WS_POPUP;
|
||||
SetRect(&r, 0, 0, _wnd.width_org, _wnd.height_org);
|
||||
} else {
|
||||
style = WS_OVERLAPPEDWINDOW;
|
||||
/* On window creation, check if we were in maximize mode before */
|
||||
if (_window_maximize) showstyle = SW_SHOWMAXIMIZED;
|
||||
SetRect(&r, 0, 0, _wnd.width, _wnd.height);
|
||||
}
|
||||
|
||||
AdjustWindowRect(&r, style, FALSE);
|
||||
w = r.right - r.left;
|
||||
h = r.bottom - r.top;
|
||||
x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2;
|
||||
y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2;
|
||||
|
||||
if (_wnd.main_wnd) {
|
||||
ShowWindow(_wnd.main_wnd, SW_SHOWNORMAL); // remove maximize-flag
|
||||
SetWindowPos(_wnd.main_wnd, 0, x, y, w, h, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER);
|
||||
} else {
|
||||
extern const char _openttd_revision[];
|
||||
TCHAR Windowtitle[50];
|
||||
|
||||
_sntprintf(Windowtitle, sizeof(Windowtitle), _T("OpenTTD %s"), MB_TO_WIDE(_openttd_revision));
|
||||
|
||||
_wnd.main_wnd = CreateWindow(_T("OTTD"), Windowtitle, style, x, y, w, h, 0, 0, GetModuleHandle(NULL), 0);
|
||||
if (_wnd.main_wnd == NULL) error("CreateWindow failed");
|
||||
ShowWindow(_wnd.main_wnd, showstyle);
|
||||
}
|
||||
}
|
||||
GameSizeChanged(); // invalidate all windows, force redraw
|
||||
}
|
||||
|
||||
static bool AllocateDibSection(int w, int h)
|
||||
{
|
||||
BITMAPINFO *bi;
|
||||
|
||||
+40
@@ -21,6 +21,7 @@
|
||||
#include "water_map.h"
|
||||
#include "newgrf.h"
|
||||
#include "bridge.h"
|
||||
#include "airport.h"
|
||||
|
||||
const SpriteID _water_shore_sprites[15] = {
|
||||
0,
|
||||
@@ -620,6 +621,26 @@ static Vehicle *FindFloodableVehicleOnTile(TileIndex tile)
|
||||
byte z;
|
||||
Vehicle *v;
|
||||
|
||||
if (IsTileType(tile, MP_STATION) && IsAirport(tile)) {
|
||||
uint x, y;
|
||||
const Station *st = GetStationByTile(tile);
|
||||
const AirportFTAClass *airport = GetAirport(st->airport_type);
|
||||
for (x = 0; x < airport->size_x; x++) {
|
||||
for (y = 0; y < airport->size_y; y++) {
|
||||
uint z = 1;
|
||||
tile = TILE_ADDXY(st->airport_tile, x, y);
|
||||
if (st->airport_type == AT_OILRIG) z += 54;
|
||||
if (st->airport_type == AT_HELIPORT) z += 60;
|
||||
|
||||
v = FindVehicleOnTileZ(tile, z);
|
||||
if (v != NULL && (v->vehstatus & VS_CRASHED) == 0) return v;
|
||||
}
|
||||
}
|
||||
|
||||
/* No vehicle could be flooded on this airport anymore */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!IsBridgeTile(tile) || !IsBridgeRamp(tile)) return FindVehicleOnTileZ(tile, 0);
|
||||
|
||||
end = GetOtherBridgeEnd(tile);
|
||||
@@ -668,6 +689,25 @@ static void FloodVehicle(Vehicle *v)
|
||||
v = u;
|
||||
v->u.rail.crash_anim_pos = 4000; // max 4440, disappear pretty fast
|
||||
RebuildVehicleLists();
|
||||
} else if (v->type == VEH_Aircraft) {
|
||||
const Station *st;
|
||||
const AirportFTAClass *airport;
|
||||
uint z = 1;
|
||||
|
||||
/* Crashing aircraft are always at z_pos == 1, never on z_pos == 0,
|
||||
* because that's always the shadow. Except for the heliport, because
|
||||
* that station has a big z_offset for the aircraft. */
|
||||
if (!IsTileType(v->tile, MP_STATION) || !IsAirport(v->tile) || GetTileMaxZ(v->tile) != 0) return;
|
||||
st = GetStationByTile(v->tile);
|
||||
airport = GetAirport(st->airport_type);
|
||||
|
||||
if (st->airport_type == AT_OILRIG) z += 54;
|
||||
if (st->airport_type == AT_HELIPORT) z += 60;
|
||||
|
||||
if (v->z_pos != z) return;
|
||||
|
||||
pass = 2; // driver
|
||||
if (v->cargo_type == CT_PASSENGERS) pass += v->cargo_count;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,11 @@ static inline bool IsCoast(TileIndex t)
|
||||
return GetWaterTileType(t) == WATER_COAST;
|
||||
}
|
||||
|
||||
static inline bool IsCanal(TileIndex t)
|
||||
{
|
||||
return GetWaterTileType(t) == WATER_CLEAR && GetTileOwner(t) != OWNER_WATER;
|
||||
}
|
||||
|
||||
static inline bool IsClearWaterTile(TileIndex t)
|
||||
{
|
||||
return IsTileType(t, MP_WATER) && IsWater(t) && GetTileSlope(t, NULL) == SLOPE_FLAT;
|
||||
|
||||
+3
-2
@@ -316,13 +316,15 @@ int32 CmdRenameWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
|
||||
if (!IsValidWaypointID(p1)) return CMD_ERROR;
|
||||
|
||||
wp = GetWaypoint(p1);
|
||||
if (!CheckTileOwnership(wp->xy)) return CMD_ERROR;
|
||||
|
||||
if (_cmd_text[0] != '\0') {
|
||||
StringID str = AllocateNameUnique(_cmd_text, 0);
|
||||
|
||||
if (str == 0) return CMD_ERROR;
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
wp = GetWaypoint(p1);
|
||||
if (wp->string != STR_NULL) DeleteName(wp->string);
|
||||
|
||||
wp->string = str;
|
||||
@@ -335,7 +337,6 @@ int32 CmdRenameWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
}
|
||||
} else {
|
||||
if (flags & DC_EXEC) {
|
||||
wp = GetWaypoint(p1);
|
||||
if (wp->string != STR_NULL) DeleteName(wp->string);
|
||||
|
||||
MakeDefaultWaypointName(wp);
|
||||
|
||||
@@ -596,7 +596,7 @@ static Window *LocalAllocateWindow(
|
||||
* XXX - Yes, ugly, probably needs something like w->always_on_top flag
|
||||
* to implement correctly, but even then you need some kind of distinction
|
||||
* between on-top of chat/news and status windows, because these conflict */
|
||||
if (wz != _z_windows && w->window_class != WC_SEND_NETWORK_MSG) {
|
||||
if (wz != _z_windows && w->window_class != WC_SEND_NETWORK_MSG && w->window_class != WC_HIGHSCORE && w->window_class != WC_ENDSCREEN) {
|
||||
if (FindWindowById(WC_MAIN_TOOLBAR, 0) != NULL) wz--;
|
||||
if (FindWindowById(WC_STATUS_BAR, 0) != NULL) wz--;
|
||||
if (FindWindowById(WC_NEWS_WINDOW, 0) != NULL) wz--;
|
||||
@@ -610,8 +610,8 @@ static Window *LocalAllocateWindow(
|
||||
_last_z_window++;
|
||||
}
|
||||
|
||||
SetWindowDirty(w);
|
||||
CallWindowEventNP(w, WE_CREATE);
|
||||
SetWindowDirty(w);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user