--- a/changelog.txt Sat Mar 24 14:56:31 2007 +0000
+++ b/changelog.txt Sat Mar 24 15:19:35 2007 +0000
@@ -1,3 +1,46 @@
+0.5.1-RC2 (2007-03-23)
+------------------------------------------------------------------------
+- Fix: crashes when the chatbox would be drawn outside of the main window [FS#701] (r9420)
+- Fix: reading out of an array caused a segmentation fault [FS#694] (r9394)
+
+
+0.5.1-RC1 (2007-03-20)
+------------------------------------------------------------------------
+- Feature: Translation dependant formatting of dates (r8906)
+- Feature: Kick inactive initial network connections after some time [FS#115] (r9038, r9061)
+- Feature: Add an extra news group for opening and closing of industries (r9097)
+- Codechange: Disable shares by default and increase the default maximum distance from edge for oil refineries (r9339)
+- Codechange: When you started openttd with '-g' you got the same map every run (r9205)
+- Codechange: When all news-setting buttons are 'full', make the for-all button show 'full' too (r9137)
+- Codechange: Disable the ability to make flooding water with the canal build tool. In the scenario editor you can still make both canals and flood water at height level 0 [FS#622, FS#629] (r9105, r9115)
+- Codechange: The station list, sorted by cargo rating, now takes stations into account that have no cargo waiting [FS#595] (r9062)
+- Fix: Close the Shared Order Vehicle List if you remove the shared link with only 2 vehicles (r9338)
+- Fix: A34-1000, Z-Shuttle, and Kelling K1 are now listed as small aircraft (r9298)
+- Fix: Shared orders got messed up when the 'first' trains got removed in the depot [FS#685] (r9277)
+- Fix: Use a less CPU-intensive algorithm to find a random industry for the AI to prevent it slowing down the game [FS#644] (r9251)
+- Fix: When loading games, enroute_from was updated in the wrong place, causing issues with TTD savegames/scenarios (r9147)
+- Fix: "Train is lost" message is generated incorrectly [FS#676] (r9146)
+- Fix: Difficulty level button was not selected when opening the difficulty window (r9117)
+- Fix: The wrong catenary wires were drawn for tunnel entrances [FS#612] (r9077)
+- Fix: The intercontinental airport used 'T-junction' runway sprites when there is no exit in the middle of the runway as in the city airport [FS#529] (r9076)
+- Fix: [win] dedicated console now doesn't need an extra 'enter' to fully quit [FS#459] (r9074)
+- Fix: Take over companies properly in multiplayer games [FS#459] (r9071)
+- Fix: When a bribe failed and you haven't picked up cargo yet, you would never be able to do so for a given station [FS#404] (r9070)
+- Fix: Don't keep on scrolling for non-numeric values in settings, but require reclick [FS#663] (r9064)
+- Fix: The personal (.openttd) directories were hidden in the load/save directory listings [FS#652] (r9043)
+- Fix: Desync caused by buffer overflow [FS#664] (r9027)
+- Fix: When cutting strings into multiple lines also take into consideration whitespace characters of more than 1 byte length. (r9012)
+- Fix: Play the correct engine sound based on the engine type instead of the sprite (r9009)
+- Fix: New locomotive names were not announced in the news, it said "new railway locomotive available - railway locomotive" [FS#581] (r9000, r9001)
+- Fix: [NewGRF] Do not select a disabled platform length/number of track count when going out of drag-drop mode [FS#450] (r8999)
+- Fix: [win] Resolution doubled in cfg file when fullscreen mode used [FS#642] (r8994)
+- Fix: The industry list should also be (re)set when the number of industries is 0 [FS#656] (r8980)
+- Fix: [win] Possible buffer overflow if unicode text is pasted into an input box and needs trimming. (r8975)
+- Fix: [win] Support compilation with the Vista Platform SDK (r8974)
+- Fix: Crash on loading savegames with GRFs that do not have their GRF info/name set (r8955)
+- Fix: [NewGRF] support for vehicle variable 48 was wrong (r8943)
+
+
0.5.0 (2007-02-27)
------------------------------------------------------------------------
- Feature: Add the ability to load newer TTDP games (the tile information for coasts has changed) (r8738)
--- a/docs/openttd.6 Sat Mar 24 14:56:31 2007 +0000
+++ b/docs/openttd.6 Sat Mar 24 15:19:35 2007 +0000
@@ -1,6 +1,6 @@
.\" Hey, EMACS: -*- nroff -*-
.\" Please adjust this date whenever revising the manpage.
-.Dd February 27, 2007
+.Dd March 23, 2007
.Dt OPENTTD 6
.Sh NAME
.Nm openttd
--- a/known-bugs.txt Sat Mar 24 14:56:31 2007 +0000
+++ b/known-bugs.txt Sat Mar 24 15:19:35 2007 +0000
@@ -15,43 +15,39 @@
If the bug report is closed, it has been fixed, which then can be verified
in the latest SVN version.
-Bugs for 0.5.0
+Bugs for 0.5.1
------------------------------------------------------------------------
URL: http://bugs.openttd.org
+-677 Badspacing in news summaries
+-674 Map signs allow less nonenglish characters than english ones
+-672 Non-transparent station names' backgrounds do not resize properly upon language change
+-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
--595 Sort by max cargo rating does not sort correctly
-594 terraforming wipes out canals
-591 Autorenew fails under certain conditions
-583 Fatal fault or crash during startup
--578 No loading at my industrial centre
--574 Open TTD overiding Power Warnings
-571 Problems with vehicle purchase lists with NewGRFs
-559 Front-/Rear-facing engines don't line up with each other
-553 Autorenew doesn't warn when replacement isn't available
-546 [0.5.0 RC3] Inflation overflow
-540 Planes vanished when offered exclusive
-539 Trains can cash the same cargo multiple times
--529 newairport's sprite issue
-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.
--459 Merging is buggy
-458 Crash when changing Resolution on Mac OS X (x86)
--450 GUI selecting disabled numbers (newstations)
-442 Alt-tab behaviour flawed whilst full screen (win32)
--441 Transparent stuff
-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
--404 Cargo never delivered to station after bribe and before first pickup
-365 Blimp Stuck at airport
-362 Changing signal type affects whole square
--357 CPU spikes in game
-355 graphics bugs with trains - water, tunnels
-354 Maglev Trains faster than All Planes
-339 Crash in Quicktime when exiting game
@@ -67,7 +63,6 @@
-165 vehicle length not taken into account
-153 Language crash with app renaming OSX
-119 Clipping problems with vehicles on slopes
--115 inactive logins do not get auto kicked
- 89 Able to build railways/stations before engines become available
- 65 short wagons bug
- 51 Windows doesn't support CUSTOM_LANG_DIR
@@ -87,7 +82,7 @@
-1116638 "More, but smaller changes" deficiency
-1106356 re-offered prototypes
-Minor Bugs for 0.5.0
+Minor Bugs for 0.5.1
------------------------------------------------------------------------
URL: http://sourceforge.net/tracker/?atid=669662&group_id=103924&func=browse
--- a/os/debian/changelog Sat Mar 24 14:56:31 2007 +0000
+++ b/os/debian/changelog Sat Mar 24 15:19:35 2007 +0000
@@ -4,6 +4,18 @@
-- Matthijs Kooijman <m.kooijman@student.utwente.nl> Mon, 26 Feb 2007 21:07:05 +0100
+openttd (0.5.1~rc2-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Matthijs Kooijman <m.kooijman@student.utwente.nl> Fri, 23 Mar 2007 23:45:46 +0100
+
+openttd (0.5.1~rc1-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Matthijs Kooijman <m.kooijman@student.utwente.nl> Wed, 20 Mar 2007 22:03:46 +0100
+
openttd (0.5.0-1) unstable; urgency=low
* New upstream release
--- a/os/win32/installer/install.nsi Sat Mar 24 14:56:31 2007 +0000
+++ b/os/win32/installer/install.nsi Sat Mar 24 15:19:35 2007 +0000
@@ -1,6 +1,6 @@
!define APPNAME "OpenTTD" ; Define application name
-!define APPVERSION "0.5.0" ; Define application version
-!define INSTALLERVERSION 28 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
+!define APPVERSION "0.5.1" ; Define application version
+!define INSTALLERVERSION 30 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
!define APPURLLINK "http://www.openttd.org"
!define APPNAMEANDVERSION "${APPNAME} ${APPVERSION}"
--- a/projects/openttd.vcproj Sat Mar 24 14:56:31 2007 +0000
+++ b/projects/openttd.vcproj Sat Mar 24 15:19:35 2007 +0000
@@ -1131,6 +1131,9 @@
RelativePath=".\..\src\newgrf.cpp">
</File>
<File
+ RelativePath=".\..\src\newgrf_cargo.cpp">
+ </File>
+ <File
RelativePath=".\..\src\newgrf_config.cpp">
</File>
<File
--- a/projects/openttd_vs80.vcproj Sat Mar 24 14:56:31 2007 +0000
+++ b/projects/openttd_vs80.vcproj Sat Mar 24 15:19:35 2007 +0000
@@ -1724,6 +1724,10 @@
>
</File>
<File
+ RelativePath=".\..\src\newgrf_cargo.cpp"
+ >
+ </File>
+ <File
RelativePath=".\..\src\newgrf_config.cpp"
>
</File>
--- a/readme.txt Sat Mar 24 14:56:31 2007 +0000
+++ b/readme.txt Sat Mar 24 15:19:35 2007 +0000
@@ -1,6 +1,6 @@
OpenTTD README
-Last updated: 2007-02-27
-Release version: 0.5.0
+Last updated: 2007-03-23
+Release version: 0.5.1-RC2
------------------------------------------------------------------------
--- a/source.list Sat Mar 24 14:56:31 2007 +0000
+++ b/source.list Sat Mar 24 15:19:35 2007 +0000
@@ -350,6 +350,7 @@
# NewGRF
newgrf.cpp
+newgrf_cargo.cpp
newgrf_config.cpp
newgrf_engine.cpp
newgrf_house.cpp
--- a/src/cargotype.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/cargotype.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -12,7 +12,7 @@
#include "table/cargo_const.h"
-static CargoSpec _cargo[NUM_CARGO];
+CargoSpec _cargo[NUM_CARGO];
static const byte INVALID_CARGO = 0xFF;
@@ -64,6 +64,7 @@
CargoID GetCargoIDByLabel(CargoLabel cl)
{
for (CargoID c = 0; c < lengthof(_cargo); c++) {
+ if (_cargo[c].bitnum == INVALID_CARGO) continue;
if (_cargo[c].label == cl) return c;
}
--- a/src/cargotype.h Sat Mar 24 14:56:31 2007 +0000
+++ b/src/cargotype.h Sat Mar 24 15:19:35 2007 +0000
@@ -31,7 +31,7 @@
bool is_freight;
TownEffect town_effect; ///< The effect this cargo type has on towns
uint16 multipliertowngrowth;
- uint8 callbackflags;
+ uint8 callback_mask;
StringID name;
StringID name_plural;
@@ -42,12 +42,14 @@
SpriteID sprite;
uint16 classes;
+ const struct SpriteGroup *group;
bool IsValid() const;
};
extern uint32 _cargo_mask;
+extern CargoSpec _cargo[NUM_CARGO];
/* Set up the default cargo types for the given landscape type */
--- a/src/clear_cmd.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/clear_cmd.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -668,8 +668,8 @@
TileLoopClearHelper(tile);
switch (_opt.landscape) {
- case LT_DESERT: TileLoopClearDesert(tile); break;
- case LT_HILLY: TileLoopClearAlps(tile); break;
+ case LT_TROPIC: TileLoopClearDesert(tile); break;
+ case LT_ARCTIC: TileLoopClearAlps(tile); break;
}
switch (GetClearGround(tile)) {
--- a/src/economy.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/economy.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -1113,12 +1113,11 @@
int32 GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, CargoID cargo_type)
{
- CargoID cargo = cargo_type;
const CargoSpec *cs = GetCargo(cargo_type);
byte f;
/* zero the distance if it's the bank and very short transport. */
- if (_opt.landscape == LT_NORMAL && cs->label == 'VALU' && dist < 10)
+ if (_opt.landscape == LT_TEMPERATE && cs->label == 'VALU' && dist < 10)
dist = 0;
f = 255;
@@ -1138,7 +1137,7 @@
}
if (f < 31) f = 31;
- return BIGMULSS(dist * f * num_pieces, _cargo_payment_rates[cargo], 21);
+ return BIGMULSS(dist * f * num_pieces, _cargo_payment_rates[cargo_type], 21);
}
static void DeliverGoodsToIndustry(TileIndex xy, CargoID cargo_type, int num_pieces)
--- a/src/genworld_gui.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/genworld_gui.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -240,7 +240,7 @@
SetWindowWidgetDisabledState(w, GLAND_SMOOTHNESS_PULLDOWN, _patches_newgame.land_generator == 0);
}
/* Disable snowline if not hilly */
- SetWindowWidgetDisabledState(w, GLAND_SNOW_LEVEL_TEXT, _opt_newgame.landscape != LT_HILLY);
+ SetWindowWidgetDisabledState(w, GLAND_SNOW_LEVEL_TEXT, _opt_newgame.landscape != LT_ARCTIC);
/* Disable town, industry and trees in SE */
SetWindowWidgetDisabledState(w, GLAND_TOWN_TEXT, _game_mode == GM_EDITOR);
SetWindowWidgetDisabledState(w, GLAND_TOWN_PULLDOWN, _game_mode == GM_EDITOR);
@@ -251,13 +251,13 @@
SetWindowWidgetDisabledState(w, GLAND_START_DATE_DOWN, _patches_newgame.starting_year <= MIN_YEAR);
SetWindowWidgetDisabledState(w, GLAND_START_DATE_UP, _patches_newgame.starting_year >= MAX_YEAR);
- SetWindowWidgetDisabledState(w, GLAND_SNOW_LEVEL_DOWN, _patches_newgame.snow_line_height <= 2 || _opt_newgame.landscape != LT_HILLY);
- SetWindowWidgetDisabledState(w, GLAND_SNOW_LEVEL_UP, _patches_newgame.snow_line_height >= 13 || _opt_newgame.landscape != LT_HILLY);
+ SetWindowWidgetDisabledState(w, GLAND_SNOW_LEVEL_DOWN, _patches_newgame.snow_line_height <= 2 || _opt_newgame.landscape != LT_ARCTIC);
+ SetWindowWidgetDisabledState(w, GLAND_SNOW_LEVEL_UP, _patches_newgame.snow_line_height >= 13 || _opt_newgame.landscape != LT_ARCTIC);
- SetWindowWidgetLoweredState(w, GLAND_TEMPERATE, _opt_newgame.landscape == LT_NORMAL);
- SetWindowWidgetLoweredState(w, GLAND_ARCTIC, _opt_newgame.landscape == LT_HILLY);
- SetWindowWidgetLoweredState(w, GLAND_TROPICAL, _opt_newgame.landscape == LT_DESERT);
- SetWindowWidgetLoweredState(w, GLAND_TOYLAND, _opt_newgame.landscape == LT_CANDY);
+ SetWindowWidgetLoweredState(w, GLAND_TEMPERATE, _opt_newgame.landscape == LT_TEMPERATE);
+ SetWindowWidgetLoweredState(w, GLAND_ARCTIC, _opt_newgame.landscape == LT_ARCTIC);
+ SetWindowWidgetLoweredState(w, GLAND_TROPICAL, _opt_newgame.landscape == LT_TROPIC);
+ SetWindowWidgetLoweredState(w, GLAND_TOYLAND, _opt_newgame.landscape == LT_TOYLAND);
DrawWindowWidgets(w);
y = (mode == GLWP_HEIGHTMAP) ? 22 : 0;
@@ -589,10 +589,10 @@
SetWindowWidgetDisabledState(w, CSCEN_FLAT_LAND_HEIGHT_DOWN, _patches_newgame.se_flat_world_height <= 0);
SetWindowWidgetDisabledState(w, CSCEN_FLAT_LAND_HEIGHT_UP, _patches_newgame.se_flat_world_height >= 15);
- SetWindowWidgetLoweredState(w, CSCEN_TEMPERATE, _opt_newgame.landscape == LT_NORMAL);
- SetWindowWidgetLoweredState(w, CSCEN_ARCTIC, _opt_newgame.landscape == LT_HILLY);
- SetWindowWidgetLoweredState(w, CSCEN_TROPICAL, _opt_newgame.landscape == LT_DESERT);
- SetWindowWidgetLoweredState(w, CSCEN_TOYLAND, _opt_newgame.landscape == LT_CANDY);
+ SetWindowWidgetLoweredState(w, CSCEN_TEMPERATE, _opt_newgame.landscape == LT_TEMPERATE);
+ SetWindowWidgetLoweredState(w, CSCEN_ARCTIC, _opt_newgame.landscape == LT_ARCTIC);
+ SetWindowWidgetLoweredState(w, CSCEN_TROPICAL, _opt_newgame.landscape == LT_TROPIC);
+ SetWindowWidgetLoweredState(w, CSCEN_TOYLAND, _opt_newgame.landscape == LT_TOYLAND);
DrawWindowWidgets(w);
DrawStringRightAligned(211, 97, STR_MAPSIZE, 0);
--- a/src/gfx.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/gfx.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -1555,7 +1555,7 @@
memcpy(old_val, d, c * sizeof(*old_val));
/* Dark blue water */
- s = (_opt.landscape == LT_CANDY) ? ev->ac : ev->a;
+ s = (_opt.landscape == LT_TOYLAND) ? ev->ac : ev->a;
j = EXTR(320, 5);
for (i = 0; i != 5; i++) {
*d++ = s[j];
@@ -1564,7 +1564,7 @@
}
/* Glittery water */
- s = (_opt.landscape == LT_CANDY) ? ev->bc : ev->b;
+ s = (_opt.landscape == LT_TOYLAND) ? ev->bc : ev->b;
j = EXTR(128, 15);
for (i = 0; i != 5; i++) {
*d++ = s[j];
@@ -1624,7 +1624,7 @@
/* Animate water for old DOS graphics */
if (_use_dos_palette) {
/* Dark blue water DOS */
- s = (_opt.landscape == LT_CANDY) ? ev->ac : ev->a;
+ s = (_opt.landscape == LT_TOYLAND) ? ev->ac : ev->a;
j = EXTR(320, 5);
for (i = 0; i != 5; i++) {
*d++ = s[j];
@@ -1633,7 +1633,7 @@
}
/* Glittery water DOS */
- s = (_opt.landscape == LT_CANDY) ? ev->bc : ev->b;
+ s = (_opt.landscape == LT_TOYLAND) ? ev->bc : ev->b;
j = EXTR(128, 15);
for (i = 0; i != 5; i++) {
*d++ = s[j];
--- a/src/gfxinit.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/gfxinit.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -357,7 +357,7 @@
}
/* Load additional sprites for climates other than temperate */
- if (_opt.landscape != LT_NORMAL) {
+ if (_opt.landscape != LT_TEMPERATE) {
LoadGrfIndexed(
files->landscape[_opt.landscape - 1].filename,
_landscape_spriteindexes[_opt.landscape - 1],
--- a/src/industry_cmd.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/industry_cmd.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -814,14 +814,14 @@
uint field_type;
int type;
- if (_opt.landscape == LT_HILLY) {
+ if (_opt.landscape == LT_ARCTIC) {
if (GetTileZ(tile) + TILE_HEIGHT * 2 >= GetSnowLine())
return;
}
/* determine field size */
r = (Random() & 0x303) + 0x404;
- if (_opt.landscape == LT_HILLY) r += 0x404;
+ if (_opt.landscape == LT_ARCTIC) r += 0x404;
size_x = GB(r, 0, 8);
size_y = GB(r, 8, 8);
@@ -852,7 +852,7 @@
END_TILE_LOOP(cur_tile, size_x, size_y, tile)
type = 3;
- if (_opt.landscape != LT_HILLY && _opt.landscape != LT_DESERT) {
+ if (_opt.landscape != LT_ARCTIC && _opt.landscape != LT_TROPIC) {
type = _plantfarmfield_type[Random() & 0xF];
}
@@ -1016,7 +1016,7 @@
static bool CheckNewIndustry_Forest(TileIndex tile)
{
- if (_opt.landscape == LT_HILLY) {
+ if (_opt.landscape == LT_ARCTIC) {
if (GetTileZ(tile) < HighestSnowLine() + TILE_HEIGHT * 2U) {
_error_message = STR_4831_FOREST_CAN_ONLY_BE_PLANTED;
return false;
@@ -1048,7 +1048,7 @@
static bool CheckNewIndustry_Farm(TileIndex tile)
{
- if (_opt.landscape == LT_HILLY) {
+ if (_opt.landscape == LT_ARCTIC) {
if (GetTileZ(tile) + TILE_HEIGHT * 2 >= HighestSnowLine()) {
_error_message = STR_0239_SITE_UNSUITABLE;
return false;
@@ -1766,7 +1766,7 @@
case INDUSTRYLIFE_PRODUCTION:
/* decrease or increase */
- if (type == IT_OIL_WELL && _opt.landscape == LT_NORMAL)
+ if (type == IT_OIL_WELL && _opt.landscape == LT_TEMPERATE)
only_decrease = true;
if (only_decrease || CHANCE16(1,3)) {
--- a/src/intro_gui.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/intro_gui.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -55,10 +55,10 @@
case WE_CREATE: LowerWindowWidget(w, _opt_newgame.landscape + 8); break;
case WE_PAINT:
- SetWindowWidgetLoweredState(w, 8, _opt_newgame.landscape == LT_NORMAL);
- SetWindowWidgetLoweredState(w, 9, _opt_newgame.landscape == LT_HILLY);
- SetWindowWidgetLoweredState(w, 10, _opt_newgame.landscape == LT_DESERT);
- SetWindowWidgetLoweredState(w, 11, _opt_newgame.landscape == LT_CANDY);
+ SetWindowWidgetLoweredState(w, 8, _opt_newgame.landscape == LT_TEMPERATE);
+ SetWindowWidgetLoweredState(w, 9, _opt_newgame.landscape == LT_ARCTIC);
+ SetWindowWidgetLoweredState(w, 10, _opt_newgame.landscape == LT_TROPIC);
+ SetWindowWidgetLoweredState(w, 11, _opt_newgame.landscape == LT_TOYLAND);
SetDParam(0, STR_6801_EASY + _opt_newgame.diff_level);
DrawWindowWidgets(w);
break;
--- a/src/landscape.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/landscape.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -692,15 +692,15 @@
uint32 r;
if (mode == GW_HEIGHTMAP) {
- SetGeneratingWorldProgress(GWP_LANDSCAPE, (_opt.landscape == LT_DESERT) ? 1 + gwp_desert_amount : 1);
+ SetGeneratingWorldProgress(GWP_LANDSCAPE, (_opt.landscape == LT_TROPIC) ? 1 + gwp_desert_amount : 1);
LoadHeightmap(_file_to_saveload.name);
IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
} else if (_patches.land_generator == LG_TERRAGENESIS) {
- SetGeneratingWorldProgress(GWP_LANDSCAPE, (_opt.landscape == LT_DESERT) ? 3 + gwp_desert_amount : 3);
+ SetGeneratingWorldProgress(GWP_LANDSCAPE, (_opt.landscape == LT_TROPIC) ? 3 + gwp_desert_amount : 3);
GenerateTerrainPerlin();
} else {
switch (_opt.landscape) {
- case LT_HILLY:
+ case LT_ARCTIC:
SetGeneratingWorldProgress(GWP_LANDSCAPE, 2);
for (i = ScaleByMapSize((Random() & 0x7F) + 950); i != 0; --i) {
@@ -716,7 +716,7 @@
IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
break;
- case LT_DESERT:
+ case LT_TROPIC:
SetGeneratingWorldProgress(GWP_LANDSCAPE, 3 + gwp_desert_amount);
for (i = ScaleByMapSize((Random() & 0x7F) + 170); i != 0; --i) {
@@ -753,7 +753,7 @@
ConvertGroundTilesIntoWaterTiles();
- if (_opt.landscape == LT_DESERT) CreateDesertOrRainForest();
+ if (_opt.landscape == LT_TROPIC) CreateDesertOrRainForest();
}
void OnTick_Town();
--- a/src/lang/danish.txt Sat Mar 24 14:56:31 2007 +0000
+++ b/src/lang/danish.txt Sat Mar 24 15:19:35 2007 +0000
@@ -2772,7 +2772,7 @@
STR_983C_REFIT_SHIP :{BLACK}Ombyg skibet
STR_983D_SELECT_TYPE_OF_CARGO_FOR :{BLACK}Vælg den slags last skibet skal sejle med
STR_983E_REFIT_SHIP_TO_CARRY_HIGHLIGHTED :{BLACK}Ombyg skibet til den markerede slags last
-STR_983F_SELECT_CARGO_TYPE_TO_CARRY :{GOLD}Vælg den lasttype der skal sejles med:
+STR_983F_SELECT_CARGO_TYPE_TO_CARRY :{GOLD}Vælg den lasttype der skal transporteres:
STR_9840_NEW_CAPACITY_COST_OF_REFIT :{BLACK}Ny kapacitet: {GOLD}{CARGO}{}{BLACK}Pris for ombyggelse: {GOLD}{CURRENCY}
STR_9841_CAN_T_REFIT_SHIP :{WHITE}Kan ikke ombygge skib...
STR_9842_REFITTABLE :(kan ombygges)
--- a/src/lang/german.txt Sat Mar 24 14:56:31 2007 +0000
+++ b/src/lang/german.txt Sat Mar 24 15:19:35 2007 +0000
@@ -728,6 +728,7 @@
STR_028D_PLACE_LIGHTHOUSE :{BLACK}Leuchtturm errichten
STR_028E_PLACE_TRANSMITTER :{BLACK}Sender errichten
STR_028F_DEFINE_DESERT_AREA :{BLACK}Lege Wüstengebiet an.{}STRG drücken zum entfernen
+STR_CREATE_LAKE :{BLACK}Wasser erzeugen.{}Baut einen Kanal. Bei gedrückter Strg.-Taste wird ein Wasserfeld erzeugt, das umliegendes Land flutet.
STR_0290_DELETE :{BLACK}Löschen
STR_0291_DELETE_THIS_TOWN_COMPLETELY :{BLACK}Diese Stadt vollständig löschen
STR_0292_SAVE_SCENARIO :Szenario speichern
@@ -1090,6 +1091,9 @@
STR_CONFIG_PATCHES_LIVERIES_OWN :Eigene Firma
STR_CONFIG_PATCHES_LIVERIES_ALL :Alle Firmen
STR_CONFIG_PATCHES_PREFER_TEAMCHAT :{LTBLUE}Bevorzuge Teamchat mit <ENTER>: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_SCROLLWHEEL_ZOOM :Karte vergrößern
+STR_CONFIG_PATCHES_SCROLLWHEEL_SCROLL :Kartenansicht verschieben
+STR_CONFIG_PATCHES_SCROLLWHEEL_OFF :Aus
STR_CONFIG_PATCHES_MAX_TRAINS :{LTBLUE}Maximale Anzahl der Züge pro Spieler: {ORANGE}{STRING}
STR_CONFIG_PATCHES_MAX_ROADVEH :{LTBLUE}Maximale Anzahl der Straßenfahrzeuge pro Spieler: {ORANGE}{STRING}
@@ -1208,6 +1212,7 @@
STR_TREES_RANDOM_TYPE_TIP :{BLACK}Zufällige Baumart pflanzen
STR_CANT_BUILD_CANALS :{WHITE}Kann hier keinen Kanal bauen...
+STR_BUILD_CANALS_TIP :{BLACK}Kanalbau.
STR_LANDINFO_CANAL :Kanal
STR_CANT_BUILD_LOCKS :{WHITE}Kann hier keine Schleuse bauen...
--- a/src/lang/hungarian.txt Sat Mar 24 14:56:31 2007 +0000
+++ b/src/lang/hungarian.txt Sat Mar 24 15:19:35 2007 +0000
@@ -1159,6 +1159,7 @@
STR_CONFIG_PATCHES_SCROLLWHEEL_SCROLLING :{LTBLUE}Scrollgomb funkció: {ORANGE}{STRING}
STR_CONFIG_PATCHES_SCROLLWHEEL_ZOOM :Térkép nagyítás
STR_CONFIG_PATCHES_SCROLLWHEEL_SCROLL :Térkép mozgatás
+STR_CONFIG_PATCHES_SCROLLWHEEL_OFF :Ki
STR_CONFIG_PATCHES_SCROLLWHEEL_MULTIPLIER :{LTBLUE}Scrollgomb sebessége a térképen: {ORANGE}{STRING}
STR_CONFIG_PATCHES_MAX_TRAINS :{LTBLUE}Maximum vonat játékosonként: {ORANGE}{STRING}
--- a/src/lang/portuguese.txt Sat Mar 24 14:56:31 2007 +0000
+++ b/src/lang/portuguese.txt Sat Mar 24 15:19:35 2007 +0000
@@ -727,6 +727,7 @@
STR_028D_PLACE_LIGHTHOUSE :{BLACK}Colocar farol
STR_028E_PLACE_TRANSMITTER :{BLACK}Colocar transmissor
STR_028F_DEFINE_DESERT_AREA :{BLACK}Definir área de deserto.{}Manter a tecla CTRL pressionada para remover
+STR_CREATE_LAKE :{BLACK}Definir área de água.{}Construir um canal com a tecla CTRL numa área que não seja a do mar, senão inundar-se-iam as zonas circundantes
STR_0290_DELETE :{BLACK}Apagar
STR_0291_DELETE_THIS_TOWN_COMPLETELY :{BLACK}Apagar completamente esta cidade
STR_0292_SAVE_SCENARIO :Guardar cenário
@@ -1089,6 +1090,11 @@
STR_CONFIG_PATCHES_LIVERIES_OWN :Própria companhia
STR_CONFIG_PATCHES_LIVERIES_ALL :Todas as companhias
STR_CONFIG_PATCHES_PREFER_TEAMCHAT :{LTBLUE}Escolher chat de equipa com <ENTER>: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_SCROLLWHEEL_SCROLLING :{LTBLUE}Função de scrollwheel: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_SCROLLWHEEL_ZOOM :Ampliar mapa
+STR_CONFIG_PATCHES_SCROLLWHEEL_SCROLL :Percorrer mapa
+STR_CONFIG_PATCHES_SCROLLWHEEL_OFF :Desligado
+STR_CONFIG_PATCHES_SCROLLWHEEL_MULTIPLIER :{LTBLUE}Velocidade do scrollwheel no mapa: {ORANGE}{STRING}
STR_CONFIG_PATCHES_MAX_TRAINS :{LTBLUE}Máximo de comboios por jogador: {ORANGE}{STRING}
STR_CONFIG_PATCHES_MAX_ROADVEH :{LTBLUE}Máximo de veículos de estrada por jogador: {ORANGE}{STRING}
@@ -1207,6 +1213,7 @@
STR_TREES_RANDOM_TYPE_TIP :{BLACK}Colocar árvores de tipo aleatório
STR_CANT_BUILD_CANALS :{WHITE}Não é possível construir canais aqui...
+STR_BUILD_CANALS_TIP :{BLACK}Construir canais.
STR_LANDINFO_CANAL :Canal
STR_CANT_BUILD_LOCKS :{WHITE}Não é possível construir diques aqui...
@@ -2907,6 +2914,7 @@
STR_NEWGRF_ERROR_INVALID_PARAMETER :Parâmetro inválido para {STRING}: parâmetro {STRING} ({NUM})
STR_NEWGRF_ERROR_LOAD_BEFORE :{STRING} deve ser carregado antes de {STRING}.
STR_NEWGRF_ERROR_LOAD_AFTER :{STRING} deve ser carregado antes de {STRING}.
+STR_NEWGRF_ERROR_AFTER_TRANSLATED_FILE :O ficheiro GRF foi desenhado para traduzir
STR_NEWGRF_ADD :{BLACK}Adicionar
STR_NEWGRF_ADD_TIP :{BLACK}Adicionar um ficheiro NewGRF à lista
--- a/src/lang/simplified_chinese.txt Sat Mar 24 14:56:31 2007 +0000
+++ b/src/lang/simplified_chinese.txt Sat Mar 24 15:19:35 2007 +0000
@@ -591,6 +591,7 @@
STR_0207_ARRIVAL_OF_FIRST_VEHICLE :{YELLOW}对手车站的剪彩仪式
STR_0208_ACCIDENTS_DISASTERS :{YELLOW}事故/灾难
STR_0209_COMPANY_INFORMATION :{YELLOW}公司信息
+STR_NEWS_OPEN_CLOSE :{YELLOW}开启/关闭工业设施
STR_020A_ECONOMY_CHANGES :{YELLOW}经济变化
STR_020B_ADVICE_INFORMATION_ON_PLAYER :{YELLOW}玩家车辆的状况报告
STR_020C_NEW_VEHICLES :{YELLOW}新的车辆类型
@@ -726,6 +727,7 @@
STR_028D_PLACE_LIGHTHOUSE :{BLACK}放置灯塔
STR_028E_PLACE_TRANSMITTER :{BLACK}放置转播塔
STR_028F_DEFINE_DESERT_AREA :{BLACK}定义沙漠区域。{}摁住 CTRL 可以去掉沙漠区域。
+STR_CREATE_LAKE :{BLACK}定义水域。{}修建运河,仅在CTRL被按下的情况下不会在海平面淹没周围的区域。
STR_0290_DELETE :{BLACK}删除
STR_0291_DELETE_THIS_TOWN_COMPLETELY :{BLACK}完全删除这座城镇
STR_0292_SAVE_SCENARIO :保存场景
@@ -1088,6 +1090,11 @@
STR_CONFIG_PATCHES_LIVERIES_OWN :本公司
STR_CONFIG_PATCHES_LIVERIES_ALL :所有公司
STR_CONFIG_PATCHES_PREFER_TEAMCHAT :{LTBLUE}输入 <ENTER> 时与偏好的团队交谈:{ORANGE}{STRING}
+STR_CONFIG_PATCHES_SCROLLWHEEL_SCROLLING :{LTBLUE}鼠标滚轮的作用:{ORANGE}{STRING}
+STR_CONFIG_PATCHES_SCROLLWHEEL_ZOOM :缩放地图
+STR_CONFIG_PATCHES_SCROLLWHEEL_SCROLL :滚动地图
+STR_CONFIG_PATCHES_SCROLLWHEEL_OFF :关闭
+STR_CONFIG_PATCHES_SCROLLWHEEL_MULTIPLIER :{LTBLUE}地图滚动速度:{ORANGE}{STRING}
STR_CONFIG_PATCHES_MAX_TRAINS :{LTBLUE}每位玩家最大火车数量:{ORANGE}{STRING}
STR_CONFIG_PATCHES_MAX_ROADVEH :{LTBLUE}每位玩家最大汽车数量:{ORANGE}{STRING}
@@ -1206,6 +1213,7 @@
STR_TREES_RANDOM_TYPE_TIP :{BLACK}种植随机类型的树木
STR_CANT_BUILD_CANALS :{WHITE}不能在这里兴建运河……
+STR_BUILD_CANALS_TIP :{BLACK}修建运河。
STR_LANDINFO_CANAL :运河
STR_CANT_BUILD_LOCKS :{WHITE}不能在这里兴建船闸……
@@ -2906,6 +2914,7 @@
STR_NEWGRF_ERROR_INVALID_PARAMETER :{STRING} 参数错误:参数 {STRING} ({NUM})
STR_NEWGRF_ERROR_LOAD_BEFORE :{STRING} 必须在 {STRING} 前加载。
STR_NEWGRF_ERROR_LOAD_AFTER :{STRING} 必须在 {STRING} 后加载。
+STR_NEWGRF_ERROR_AFTER_TRANSLATED_FILE :GRF 被设计为可平移
STR_NEWGRF_ADD :{BLACK}增加
STR_NEWGRF_ADD_TIP :{BLACK}向列表中增加一个 NewGRF 文件
--- a/src/main_gui.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/main_gui.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -1211,7 +1211,7 @@
static void EditorTerraformClick_DesertLightHouse(Window *w)
{
- HandlePlacePushButton(w, 10, SPR_CURSOR_LIGHTHOUSE, 1, (_opt.landscape == LT_DESERT) ? PlaceProc_DesertArea : PlaceProc_LightHouse);
+ HandlePlacePushButton(w, 10, SPR_CURSOR_LIGHTHOUSE, 1, (_opt.landscape == LT_TROPIC) ? PlaceProc_DesertArea : PlaceProc_LightHouse);
}
static void EditorTerraformClick_Transmitter(Window *w)
@@ -1275,7 +1275,7 @@
switch (e->event) {
case WE_CREATE:
/* XXX - lighthouse button is widget 10!! Don't forget when changing */
- w->widget[10].tooltips = (_opt.landscape == LT_DESERT) ? STR_028F_DEFINE_DESERT_AREA : STR_028D_PLACE_LIGHTHOUSE;
+ w->widget[10].tooltips = (_opt.landscape == LT_TROPIC) ? STR_028F_DEFINE_DESERT_AREA : STR_028D_PLACE_LIGHTHOUSE;
break;
case WE_PAINT:
--- a/src/newgrf.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/newgrf.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -77,10 +77,6 @@
/* Set if there are any newhouses loaded. */
bool _have_newhouses = false;
-/* Default cargo translation table. By default there are 27 possible cargo types */
-static const uint _default_cargo_max = 27;
-static CargoLabel _default_cargo_list[_default_cargo_max];
-
enum GrfDataType {
GDT_SOUND,
@@ -241,16 +237,20 @@
* @param str StringID that we want to have the equivalent in OoenTTD
* @return the properly adjusted StringID
*/
-static StringID MapGRFStringID(StringID str)
+static StringID MapGRFStringID(uint32 grfid, StringID str)
{
/* 0xD0 and 0xDC stand for all the TextIDs in the range
* of 0xD000 (misc graphics texts) and 0xDC00 (misc persistent texts).
* These strings are unique to each grf file, and thus require to be used with the
* grfid in which they are declared */
if (GB(str, 8, 8) == 0xD0 || GB(str, 8, 8) == 0xDC) {
- return GetGRFStringID(_cur_grffile->grfid, str);
+ return GetGRFStringID(grfid, str);
}
+ /* We have some changes in our cargo strings, resulting in some missing. */
+ if (str >= 0x006E && str <= 0x008D) return str - 0x20;
+ if (str >= 0x008E && str <= 0x00AD) return str - 0x20;
+
/* Map building names according to our lang file changes
* 0x200F = Tall Office Block, first house name in the original data, the one that TTDPatch stil uses
* 0x201F = Old houses is the last house name.
@@ -1306,8 +1306,8 @@
/* If value of goods is negative, it means in fact food or, if in toyland, fizzy_drink acceptance.
* Else, we have "standard" 3rd cargo type, goods or candy, for toyland once more */
- housespec[i]->accepts_cargo[2] = (goods >= 0) ? ((_opt.landscape == LT_CANDY) ? CT_CANDY : CT_GOODS) :
- ((_opt.landscape == LT_CANDY) ? CT_FIZZY_DRINKS : CT_FOOD);
+ housespec[i]->accepts_cargo[2] = (goods >= 0) ? ((_opt.landscape == LT_TOYLAND) ? CT_CANDY : CT_GOODS) :
+ ((_opt.landscape == LT_TOYLAND) ? CT_FIZZY_DRINKS : CT_FOOD);
housespec[i]->cargo_acceptance[2] = abs(goods); // but we do need positive value here
}
@@ -1322,7 +1322,7 @@
break;
case 0x12: // Building name ID
- FOR_EACH_OBJECT housespec[i]->building_name = MapGRFStringID(grf_load_word(&buf));
+ FOR_EACH_OBJECT housespec[i]->building_name = MapGRFStringID(_cur_grffile->grfid, grf_load_word(&buf));
break;
case 0x13: // Building availability mask
@@ -1537,6 +1537,129 @@
return ret;
}
+static bool CargoChangeInfo(uint cid, int numinfo, int prop, byte **bufp, int len)
+{
+ if (cid + numinfo > NUM_CARGO) {
+ grfmsg(2, "CargoChangeInfo: Cargo type %d out of range (max %d)", cid + numinfo, NUM_CARGO - 1);
+ return false;
+ }
+
+ CargoSpec *cs = &_cargo[cid];
+ byte *buf = *bufp;
+ int i;
+ bool ret = false;
+
+ switch (prop) {
+ case 0x08: /* Bit number of cargo */
+ FOR_EACH_OBJECT {
+ cs[i].bitnum = grf_load_byte(&buf);
+ cs[i].grfid = _cur_grffile->grfid;
+ if (cs->IsValid()) {
+ SETBIT(_cargo_mask, cid + i);
+ } else {
+ CLRBIT(_cargo_mask, cid + i);
+ }
+ }
+ break;
+
+ case 0x09: /* String ID for cargo type name */
+ FOR_EACH_OBJECT cs[i].name = grf_load_word(&buf);
+ break;
+
+ case 0x0A: /* String for cargo name, plural */
+ FOR_EACH_OBJECT cs[i].name_plural = grf_load_word(&buf);
+ break;
+
+ case 0x0B:
+ /* String for units of cargo. This is different in OpenTTD to TTDPatch
+ * (e.g. 10 tonnes of coal) */
+ FOR_EACH_OBJECT cs[i].units_volume = grf_load_word(&buf);
+ break;
+
+ case 0x0C: /* String for quantity of cargo (e.g. 10 tonnes of coal) */
+ FOR_EACH_OBJECT cs[i].quantifier = grf_load_word(&buf);
+ break;
+
+ case 0x0D: /* String for two letter cargo abbreviation */
+ FOR_EACH_OBJECT cs[i].abbrev = grf_load_word(&buf);
+ break;
+
+ case 0x0E: /* Sprite ID for cargo icon */
+ FOR_EACH_OBJECT cs[i].sprite = grf_load_word(&buf);
+ break;
+
+ case 0x0F: /* Weight of one unit of cargo */
+ FOR_EACH_OBJECT cs[i].weight = grf_load_byte(&buf);
+ break;
+
+ case 0x10: /* Used for payment calculation */
+ FOR_EACH_OBJECT cs[i].transit_days[0] = grf_load_byte(&buf);
+ break;
+
+ case 0x11: /* Used for payment calculation */
+ FOR_EACH_OBJECT cs[i].transit_days[1] = grf_load_byte(&buf);
+ break;
+
+ case 0x12: /* Base cargo price */
+ FOR_EACH_OBJECT cs[i].initial_payment = grf_load_dword(&buf);
+ break;
+
+ case 0x13: /* Colour for station rating bars */
+ FOR_EACH_OBJECT cs[i].rating_colour = grf_load_byte(&buf);
+ break;
+
+ case 0x14: /* Colour for cargo graph */
+ FOR_EACH_OBJECT cs[i].legend_colour = grf_load_byte(&buf);
+ break;
+
+ case 0x15: /* Freight status */
+ FOR_EACH_OBJECT cs[i].is_freight = grf_load_byte(&buf) != 0;
+ break;
+
+ case 0x16: /* Cargo classes */
+ FOR_EACH_OBJECT cs[i].classes = grf_load_word(&buf);
+ break;
+
+ case 0x17: /* Cargo label */
+ FOR_EACH_OBJECT {
+ cs[i].label = grf_load_dword(&buf);
+ cs[i].label = BSWAP32(cs[i].label);
+ }
+ break;
+
+ case 0x18: /* Town growth substitute type */
+ FOR_EACH_OBJECT {
+ uint8 substitute_type = grf_load_byte(&buf);
+ switch (substitute_type) {
+ case 0x00: cs[i].town_effect = TE_PASSENGERS; break;
+ case 0x02: cs[i].town_effect = TE_MAIL; break;
+ case 0x05: cs[i].town_effect = TE_GOODS; break;
+ case 0x09: cs[i].town_effect = TE_WATER; break;
+ case 0x0B: cs[i].town_effect = TE_FOOD; break;
+ default:
+ grfmsg(1, "CargoChangeInfo: Unknown town growth substitute value %d, setting to none.", substitute_type);
+ case 0xFF: cs[i].town_effect = TE_NONE; break;
+ }
+ }
+ break;
+
+ case 0x19: /* Town growth coefficient */
+ FOR_EACH_OBJECT cs[i].multipliertowngrowth = grf_load_word(&buf);
+ break;
+
+ case 0x1A: /* Bitmask of callbacks to use */
+ FOR_EACH_OBJECT cs[i].callback_mask = grf_load_byte(&buf);
+ break;
+
+ default:
+ ret = true;
+ }
+
+ *bufp = buf;
+ return ret;
+}
+
+
static bool SoundEffectChangeInfo(uint sid, int numinfo, int prop, byte **bufp, int len)
{
byte *buf = *bufp;
@@ -1629,7 +1752,7 @@
/* GSF_GLOBALVAR */ GlobalVarChangeInfo,
/* GSF_INDUSTRYTILES */NULL,
/* GSF_INDUSTRIES */ NULL,
- /* GSF_CARGOS */ NULL,
+ /* GSF_CARGOS */ NULL, /* Cargo is handled during reservation */
/* GSF_SOUNDFX */ SoundEffectChangeInfo,
};
@@ -1793,6 +1916,35 @@
}
}
+/* Action 0x00 (GLS_RESERVE) */
+static void ReserveChangeInfo(byte *buf, int len)
+{
+ byte *bufend = buf + len;
+
+ if (len == 1) {
+ grfmsg(8, "Silently ignoring one-byte special sprite 0x00");
+ return;
+ }
+
+ if (!check_length(len, 6, "InitChangeInfo")) return;
+ buf++;
+ uint8 feature = grf_load_byte(&buf);
+
+ if (feature != GSF_CARGOS) return;
+
+ uint8 numprops = grf_load_byte(&buf);
+ uint8 numinfo = grf_load_byte(&buf);
+ uint8 index = grf_load_byte(&buf);
+
+ while (numprops-- && buf < bufend) {
+ uint8 prop = grf_load_byte(&buf);
+
+ if (CargoChangeInfo(index, numinfo, prop, &buf, bufend - buf)) {
+ grfmsg(2, "FeatureChangeInfo: Ignoring property 0x%02X (not implemented)", prop);
+ }
+ }
+}
+
#undef FOR_EACH_OBJECT
/**
@@ -2065,6 +2217,7 @@
case GSF_SHIP:
case GSF_AIRCRAFT:
case GSF_STATION:
+ case GSF_CARGOS:
{
byte sprites = _cur_grffile->spriteset_numents;
byte num_loaded = type;
@@ -2198,14 +2351,35 @@
if (feature == GSF_STATION && ctype == 0xFE) return CT_DEFAULT_NA;
if (ctype == 0xFF) return CT_PURCHASE;
+ if (_cur_grffile->cargo_max == 0) {
+ /* No cargo table, so use bitnum values */
+ if (ctype >= 32) {
+ grfmsg(1, "FeatureMapSpriteGroup: Cargo bitnum %d out of range (max 31), skipping.", ctype);
+ return CT_INVALID;
+ }
+
+ for (CargoID c = 0; c < NUM_CARGO; c++) {
+ const CargoSpec *cs = GetCargo(c);
+ if (!cs->IsValid()) continue;
+
+ if (cs->bitnum == ctype) {
+ grfmsg(6, "FeatureMapSpriteGroup: Cargo bitnum %d mapped to cargo type %d.", ctype, c);
+ return c;
+ }
+ }
+
+ grfmsg(5, "FeatureMapSpriteGroup: Cargo bitnum %d not available in this climate, skipping.", ctype);
+ return CT_INVALID;
+ }
+
/* Check if the cargo type is out of bounds of the cargo translation table */
- if (ctype >= (_cur_grffile->cargo_max == 0 ? _default_cargo_max : _cur_grffile->cargo_max)) {
- grfmsg(1, "FeatureMapSpriteGroup: Cargo type %d out of range (max %d), skipping.", ctype, (_cur_grffile->cargo_max == 0 ? _default_cargo_max : _cur_grffile->cargo_max) - 1);
+ if (ctype >= _cur_grffile->cargo_max) {
+ grfmsg(1, "FeatureMapSpriteGroup: Cargo type %d out of range (max %d), skipping.", ctype, _cur_grffile->cargo_max - 1);
return CT_INVALID;
}
/* Look up the cargo label from the translation table */
- CargoLabel cl = _cur_grffile->cargo_max == 0 ? _default_cargo_list[ctype] : _cur_grffile->cargo_list[ctype];
+ CargoLabel cl = _cur_grffile->cargo_list[ctype];
if (cl == 0) {
grfmsg(5, "FeatureMapSpriteGroup: Cargo type %d not available in this climate, skipping.", ctype);
return CT_INVALID;
@@ -2221,149 +2395,27 @@
return ctype;
}
-/* Action 0x03 */
-static void FeatureMapSpriteGroup(byte *buf, int len)
+
+static void VehicleMapSpriteGroup(byte *buf, byte feature, uint8 idcount, uint8 cidcount, bool wagover)
{
- /* <03> <feature> <n-id> <ids>... <num-cid> [<cargo-type> <cid>]... <def-cid>
- * id-list := [<id>] [id-list]
- * cargo-list := <cargo-type> <cid> [cargo-list]
- *
- * B feature see action 0
- * B n-id bits 0-6: how many IDs this definition applies to
- * bit 7: if set, this is a wagon override definition (see below)
- * B ids the IDs for which this definition applies
- * B num-cid number of cargo IDs (sprite group IDs) in this definition
- * can be zero, in that case the def-cid is used always
- * B cargo-type type of this cargo type (e.g. mail=2, wood=7, see below)
- * W cid cargo ID (sprite group ID) for this type of cargo
- * W def-cid default cargo ID (sprite group ID) */
- /* TODO: Bridges, town houses. */
- /* TODO: Multiple cargo support could be useful even for trains/cars -
- * cargo id 0xff is used for showing images in the build train list. */
-
static byte *last_engines;
static int last_engines_count;
- if (!check_length(len, 6, "FeatureMapSpriteGroup")) return;
-
- uint8 feature = buf[1];
- uint8 idcount = buf[2] & 0x7F;
- bool wagover = (buf[2] & 0x80) == 0x80;
-
- if (!check_length(len, 3 + idcount, "FeatureMapSpriteGroup")) return;
-
- /* If idcount is zero, this is a feature callback */
- if (idcount == 0) {
- grfmsg(2, "FeatureMapSpriteGroup: Feature callbacks not implemented yet");
- return;
- }
-
- uint8 cidcount = buf[3 + idcount];
- if (!check_length(len, 4 + idcount + cidcount * 3, "FeatureMapSpriteGroup")) return;
-
- grfmsg(6, "FeatureMapSpriteGroup: Feature %d, %d ids, %d cids, wagon override %d",
- feature, idcount, cidcount, wagover);
-
- if (feature > GSF_STATION && feature != GSF_TOWNHOUSE) {
- grfmsg(1, "FeatureMapSpriteGroup: Unsupported feature %d, skipping", feature);
- return;
- }
-
-
- if (feature == GSF_STATION) {
- /* We do things differently for stations. */
-
- for (uint i = 0; i < idcount; i++) {
- uint8 stid = buf[3 + i];
- StationSpec *statspec = _cur_grffile->stations[stid];
- byte *bp = &buf[4 + idcount];
-
- for (uint c = 0; c < cidcount; c++) {
- uint8 ctype = grf_load_byte(&bp);
- uint16 groupid = grf_load_word(&bp);
-
- if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
- grfmsg(1, "FeatureMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping",
- groupid, _cur_grffile->spritegroups_count);
- return;
- }
-
- ctype = TranslateCargo(feature, ctype);
- if (ctype == CT_INVALID) continue;
-
- statspec->spritegroup[ctype] = _cur_grffile->spritegroups[groupid];
- }
+ if (!wagover) {
+ if (last_engines_count != idcount) {
+ last_engines = ReallocT(last_engines, idcount);
+ last_engines_count = idcount;
}
-
- {
- byte *bp = buf + 4 + idcount + cidcount * 3;
- uint16 groupid = grf_load_word(&bp);
-
- if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
- grfmsg(1, "FeatureMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping",
- groupid, _cur_grffile->spritegroups_count);
- return;
- }
-
- for (uint i = 0; i < idcount; i++) {
- uint8 stid = buf[3 + i];
- StationSpec *statspec = _cur_grffile->stations[stid];
-
- statspec->spritegroup[CT_DEFAULT] = _cur_grffile->spritegroups[groupid];
- statspec->grfid = _cur_grffile->grfid;
- statspec->localidx = stid;
- SetCustomStationSpec(statspec);
- }
- }
- return;
- } else if (feature == GSF_TOWNHOUSE) {
- byte *bp = &buf[4 + idcount + cidcount * 3];
- uint16 groupid = grf_load_word(&bp);
-
- if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
- grfmsg(1, "FeatureMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.",
- groupid, _cur_grffile->spritegroups_count);
- return;
- }
-
- for (uint i = 0; i < idcount; i++) {
- uint8 hid = buf[3 + i];
- HouseSpec *hs = _cur_grffile->housespec[hid];
-
- if (hs == NULL) {
- grfmsg(1, "FeatureMapSpriteGroup: Too many houses defined, skipping");
- return;
- }
-
- hs->spritegroup = _cur_grffile->spritegroups[groupid];
- }
- return;
- }
-
- /* FIXME: Tropicset contains things like:
- * 03 00 01 19 01 00 00 00 00 - this is missing one 00 at the end,
- * what should we exactly do with that? --pasky */
-
- if (_cur_grffile->spriteset_start == 0 || _cur_grffile->spritegroups == 0) {
- grfmsg(1, "FeatureMapSpriteGroup: No sprite set to work on! Skipping");
- return;
- }
-
- if (!wagover && last_engines_count != idcount) {
- last_engines = ReallocT(last_engines, idcount);
- last_engines_count = idcount;
- }
-
- if (wagover) {
+ } else {
if (last_engines_count == 0) {
grfmsg(0, "FeatureMapSpriteGroup: WagonOverride: No engine to do override with");
return;
}
+
grfmsg(6, "FeatureMapSpriteGroup: WagonOverride: %u engines, %u wagons",
last_engines_count, idcount);
}
-
for (uint i = 0; i < idcount; i++) {
uint8 engine_id = buf[3 + i];
uint8 engine = engine_id + _vehshifts[feature];
@@ -2384,7 +2436,7 @@
if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
grfmsg(1, "FeatureMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping", groupid, _cur_grffile->spritegroups_count);
- return;
+ continue;
}
ctype = TranslateCargo(feature, ctype);
@@ -2400,7 +2452,7 @@
}
{
- byte *bp = buf + 4 + idcount + cidcount * 3;
+ byte *bp = &buf[4 + idcount + cidcount * 3];
uint16 groupid = grf_load_word(&bp);
grfmsg(8, "-- Default group id 0x%04X", groupid);
@@ -2410,13 +2462,14 @@
/* Don't tell me you don't love duplicated code! */
if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
- grfmsg(1, "FeatureMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping", groupid, _cur_grffile->spritegroups_count);
- return;
+ grfmsg(1, "FeatureMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping",
+ groupid, _cur_grffile->spritegroups_count);
+ continue;
}
if (wagover) {
/* If the ID for this action 3 is the same as the vehicle ID,
- * this indicates we have a helicopter rotor override. */
+ * this indicates we have a helicopter rotor override. */
if (feature == GSF_AIRCRAFT && engine == last_engines[i]) {
SetRotorOverrideSprites(engine, _cur_grffile->spritegroups[groupid]);
} else {
@@ -2432,6 +2485,173 @@
}
}
+
+static void StationMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount)
+{
+ for (uint i = 0; i < idcount; i++) {
+ uint8 stid = buf[3 + i];
+ StationSpec *statspec = _cur_grffile->stations[stid];
+ byte *bp = &buf[4 + idcount];
+
+ for (uint c = 0; c < cidcount; c++) {
+ uint8 ctype = grf_load_byte(&bp);
+ uint16 groupid = grf_load_word(&bp);
+
+ if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
+ grfmsg(1, "FeatureMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping",
+ groupid, _cur_grffile->spritegroups_count);
+ continue;
+ }
+
+ ctype = TranslateCargo(GSF_STATION, ctype);
+ if (ctype == CT_INVALID) continue;
+
+ statspec->spritegroup[ctype] = _cur_grffile->spritegroups[groupid];
+ }
+ }
+
+ {
+ byte *bp = &buf[4 + idcount + cidcount * 3];
+ uint16 groupid = grf_load_word(&bp);
+
+ if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
+ grfmsg(1, "FeatureMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping",
+ groupid, _cur_grffile->spritegroups_count);
+ return;
+ }
+
+ for (uint i = 0; i < idcount; i++) {
+ uint8 stid = buf[3 + i];
+ StationSpec *statspec = _cur_grffile->stations[stid];
+
+ statspec->spritegroup[CT_DEFAULT] = _cur_grffile->spritegroups[groupid];
+ statspec->grfid = _cur_grffile->grfid;
+ statspec->localidx = stid;
+ SetCustomStationSpec(statspec);
+ }
+ }
+}
+
+
+static void TownHouseMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount)
+{
+ byte *bp = &buf[4 + idcount + cidcount * 3];
+ uint16 groupid = grf_load_word(&bp);
+
+ if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
+ grfmsg(1, "FeatureMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.",
+ groupid, _cur_grffile->spritegroups_count);
+ return;
+ }
+
+ for (uint i = 0; i < idcount; i++) {
+ uint8 hid = buf[3 + i];
+ HouseSpec *hs = _cur_grffile->housespec[hid];
+
+ if (hs == NULL) {
+ grfmsg(1, "FeatureMapSpriteGroup: Too many houses defined, skipping");
+ return;
+ }
+
+ hs->spritegroup = _cur_grffile->spritegroups[groupid];
+ }
+}
+
+
+static void CargoMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount)
+{
+ byte *bp = &buf[4 + idcount + cidcount * 3];
+ uint16 groupid = grf_load_word(&bp);
+
+ if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
+ grfmsg(1, "FeatureMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.",
+ groupid, _cur_grffile->spritegroups_count);
+ return;
+ }
+
+ for (uint i = 0; i < idcount; i++) {
+ CargoID cid = buf[3 + i];
+
+ if (cid >= NUM_CARGO) {
+ grfmsg(1, "FeatureMapSpriteGroup: Cargo ID %d out of range, skipping");
+ continue;
+ }
+
+ CargoSpec *cs = &_cargo[cid];
+ cs->grfid = _cur_grffile->grfid;
+ cs->group = _cur_grffile->spritegroups[groupid];
+ }
+}
+
+
+/* Action 0x03 */
+static void FeatureMapSpriteGroup(byte *buf, int len)
+{
+ /* <03> <feature> <n-id> <ids>... <num-cid> [<cargo-type> <cid>]... <def-cid>
+ * id-list := [<id>] [id-list]
+ * cargo-list := <cargo-type> <cid> [cargo-list]
+ *
+ * B feature see action 0
+ * B n-id bits 0-6: how many IDs this definition applies to
+ * bit 7: if set, this is a wagon override definition (see below)
+ * B ids the IDs for which this definition applies
+ * B num-cid number of cargo IDs (sprite group IDs) in this definition
+ * can be zero, in that case the def-cid is used always
+ * B cargo-type type of this cargo type (e.g. mail=2, wood=7, see below)
+ * W cid cargo ID (sprite group ID) for this type of cargo
+ * W def-cid default cargo ID (sprite group ID) */
+
+ if (!check_length(len, 6, "FeatureMapSpriteGroup")) return;
+
+ uint8 feature = buf[1];
+ uint8 idcount = buf[2] & 0x7F;
+ bool wagover = (buf[2] & 0x80) == 0x80;
+
+ if (!check_length(len, 3 + idcount, "FeatureMapSpriteGroup")) return;
+
+ /* If idcount is zero, this is a feature callback */
+ if (idcount == 0) {
+ grfmsg(2, "FeatureMapSpriteGroup: Feature callbacks not implemented yet");
+ return;
+ }
+
+ uint8 cidcount = buf[3 + idcount];
+ if (!check_length(len, 4 + idcount + cidcount * 3, "FeatureMapSpriteGroup")) return;
+
+ grfmsg(6, "FeatureMapSpriteGroup: Feature %d, %d ids, %d cids, wagon override %d",
+ feature, idcount, cidcount, wagover);
+
+ if (_cur_grffile->spriteset_start == 0 || _cur_grffile->spritegroups == 0) {
+ grfmsg(1, "FeatureMapSpriteGroup: No sprite set to work on! Skipping");
+ return;
+ }
+
+ switch (feature) {
+ case GSF_TRAIN:
+ case GSF_ROAD:
+ case GSF_SHIP:
+ case GSF_AIRCRAFT:
+ VehicleMapSpriteGroup(buf, feature, idcount, cidcount, wagover);
+ return;
+
+ case GSF_STATION:
+ StationMapSpriteGroup(buf, idcount, cidcount);
+ return;
+
+ case GSF_TOWNHOUSE:
+ TownHouseMapSpriteGroup(buf, idcount, cidcount);
+ return;
+
+ case GSF_CARGOS:
+ CargoMapSpriteGroup(buf, idcount, cidcount);
+ return;
+
+ default:
+ grfmsg(1, "FeatureMapSpriteGroup: Unsupported feature %d, skipping", feature);
+ return;
+ }
+}
+
/* Action 0x04 */
static void FeatureNewName(byte *buf, int len)
{
@@ -4004,13 +4224,6 @@
/* Set up the default cargo types */
SetupCargoForClimate(_opt.landscape);
- /* Generate default cargo translation table */
- memset(_default_cargo_list, 0, sizeof(_default_cargo_list));
- for (CargoID c = 0; c < NUM_CARGO; c++) {
- const CargoSpec *cs = GetCargo(c);
- if (cs->IsValid()) _default_cargo_list[cs->bitnum] = cs->label;
- }
-
/* Reset misc GRF features and train list display variables */
_misc_grf_features = 0;
_traininfo_vehicle_pitch = 0;
@@ -4255,6 +4468,26 @@
}
}
+
+/** Each cargo string needs to be mapped from TTDPatch to OpenTTD string IDs.
+ * This is done after loading so that strings from Action 4 will be mapped
+ * properly. */
+static void MapNewCargoStrings()
+{
+ for (CargoID c = 0; c < NUM_CARGO; c++) {
+ CargoSpec *cs = &_cargo[c];
+ /* Don't map if the cargo is unavailable or not from NewGRF */
+ if (!cs->IsValid() || cs->grfid == 0) continue;
+
+ cs->name = MapGRFStringID(cs->grfid, cs->name);
+ cs->name_plural = MapGRFStringID(cs->grfid, cs->name_plural);
+ cs->units_volume = MapGRFStringID(cs->grfid, cs->units_volume);
+ cs->quantifier = MapGRFStringID(cs->grfid, cs->quantifier);
+ cs->abbrev = MapGRFStringID(cs->grfid, cs->abbrev);
+ }
+}
+
+
/* Here we perform initial decoding of some special sprites (as are they
* described at http://www.ttdpatch.net/src/newgrf.txt, but this is only a very
* partial implementation yet). */
@@ -4276,26 +4509,26 @@
* is not in memory and scanning the file every time would be too expensive.
* In other stages we skip action 0x10 since it's already dealt with. */
static const SpecialSpriteHandler handlers[][GLS_END] = {
- /* 0x00 */ { NULL, SafeChangeInfo, NULL, InitChangeInfo, FeatureChangeInfo, },
- /* 0x01 */ { NULL, GRFUnsafe, NULL, NULL, NewSpriteSet, },
- /* 0x02 */ { NULL, GRFUnsafe, NULL, NULL, NewSpriteGroup, },
- /* 0x03 */ { NULL, GRFUnsafe, NULL, NULL, FeatureMapSpriteGroup, },
- /* 0x04 */ { NULL, NULL, NULL, NULL, FeatureNewName, },
- /* 0x05 */ { NULL, NULL, NULL, NULL, GraphicsNew, },
- /* 0x06 */ { NULL, NULL, NULL, CfgApply, CfgApply, },
- /* 0x07 */ { NULL, NULL, NULL, NULL, SkipIf, },
- /* 0x08 */ { ScanInfo, NULL, NULL, GRFInfo, GRFInfo, },
- /* 0x09 */ { NULL, NULL, NULL, SkipIf, SkipIf, },
- /* 0x0A */ { NULL, NULL, NULL, NULL, SpriteReplace, },
- /* 0x0B */ { NULL, NULL, NULL, GRFLoadError, GRFLoadError, },
- /* 0x0C */ { NULL, NULL, NULL, GRFComment, GRFComment, },
- /* 0x0D */ { NULL, SafeParamSet, NULL, ParamSet, ParamSet, },
- /* 0x0E */ { NULL, SafeGRFInhibit, NULL, GRFInhibit, GRFInhibit, },
- /* 0x0F */ { NULL, NULL, NULL, NULL, NULL, },
- /* 0x10 */ { NULL, NULL, DefineGotoLabel, NULL, NULL, },
- /* 0x11 */ { NULL, GRFUnsafe, NULL, NULL, GRFSound, },
- /* 0x12 */ { NULL, NULL, NULL, NULL, LoadFontGlyph, },
- /* 0x13 */ { NULL, NULL, NULL, NULL, TranslateGRFStrings, },
+ /* 0x00 */ { NULL, SafeChangeInfo, NULL, InitChangeInfo, ReserveChangeInfo, FeatureChangeInfo, },
+ /* 0x01 */ { NULL, GRFUnsafe, NULL, NULL, NULL, NewSpriteSet, },
+ /* 0x02 */ { NULL, GRFUnsafe, NULL, NULL, NULL, NewSpriteGroup, },
+ /* 0x03 */ { NULL, GRFUnsafe, NULL, NULL, NULL, FeatureMapSpriteGroup, },
+ /* 0x04 */ { NULL, NULL, NULL, NULL, NULL, FeatureNewName, },
+ /* 0x05 */ { NULL, NULL, NULL, NULL, NULL, GraphicsNew, },
+ /* 0x06 */ { NULL, NULL, NULL, CfgApply, NULL, CfgApply, },
+ /* 0x07 */ { NULL, NULL, NULL, NULL, SkipIf, SkipIf, },
+ /* 0x08 */ { ScanInfo, NULL, NULL, GRFInfo, NULL, GRFInfo, },
+ /* 0x09 */ { NULL, NULL, NULL, SkipIf, SkipIf, SkipIf, },
+ /* 0x0A */ { NULL, NULL, NULL, NULL, NULL, SpriteReplace, },
+ /* 0x0B */ { NULL, NULL, NULL, GRFLoadError, GRFLoadError, GRFLoadError, },
+ /* 0x0C */ { NULL, NULL, NULL, GRFComment, NULL, GRFComment, },
+ /* 0x0D */ { NULL, SafeParamSet, NULL, ParamSet, ParamSet, ParamSet, },
+ /* 0x0E */ { NULL, SafeGRFInhibit, NULL, GRFInhibit, GRFInhibit, GRFInhibit, },
+ /* 0x0F */ { NULL, NULL, NULL, NULL, NULL, NULL, },
+ /* 0x10 */ { NULL, NULL, DefineGotoLabel, NULL, NULL, NULL, },
+ /* 0x11 */ { NULL, GRFUnsafe, NULL, NULL, NULL, GRFSound, },
+ /* 0x12 */ { NULL, NULL, NULL, NULL, NULL, LoadFontGlyph, },
+ /* 0x13 */ { NULL, NULL, NULL, NULL, NULL, TranslateGRFStrings, },
};
byte* buf;
@@ -4430,6 +4663,10 @@
/* Add all new houses to the house array. */
FinaliseHouseArray();
+
+ /* Map cargo strings. This is a separate step because cargos are
+ * loaded before strings... */
+ MapNewCargoStrings();
}
void LoadNewGRF(uint load_index, uint file_index)
--- a/src/newgrf.h Sat Mar 24 14:56:31 2007 +0000
+++ b/src/newgrf.h Sat Mar 24 15:19:35 2007 +0000
@@ -16,6 +16,7 @@
GLS_SAFETYSCAN,
GLS_LABELSCAN,
GLS_INIT,
+ GLS_RESERVE,
GLS_ACTIVATION,
GLS_END,
};
--- a/src/newgrf_callbacks.h Sat Mar 24 14:56:31 2007 +0000
+++ b/src/newgrf_callbacks.h Sat Mar 24 15:19:35 2007 +0000
@@ -99,9 +99,15 @@
/* Called to play a special sound effect */
CBID_VEHICLE_SOUND_EFFECT = 0x33,
+ /* Called to calculate the income of delivered cargo */
+ CBID_CARGO_PROFIT_CALC = 0x39,
+
/* Called (if appropriate bit in callback mask set) to determine whether a
* town building can be destroyed. */
CBID_HOUSE_DENY_DESTRUCTION = 0x143,
+
+ /* Called to calculate part of a station rating */
+ CBID_CARGO_STATION_RATING_CALC = 0x145,
};
/**
@@ -145,6 +151,14 @@
};
/**
+ * Callback masks for cargos.
+ */
+enum CargoCallbackMask {
+ CBM_CARGO_PROFIT_CALC = 0,
+ CBM_CARGO_STATION_RATING_CALC = 1,
+};
+
+/**
* Result of a failed callback.
*/
enum {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/newgrf_cargo.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -0,0 +1,93 @@
+/* $Id$ */
+
+#include "stdafx.h"
+#include "openttd.h"
+#include "cargotype.h"
+#include "newgrf.h"
+#include "newgrf_callbacks.h"
+#include "newgrf_spritegroup.h"
+#include "newgrf_cargo.h"
+
+
+static uint32 CargoGetRandomBits(const ResolverObject *object)
+{
+ return 0;
+}
+
+
+static uint32 CargoGetTriggers(const ResolverObject *object)
+{
+ return 0;
+}
+
+
+static void CargoSetTriggers(const ResolverObject *object, int triggers)
+{
+ return;
+}
+
+
+static uint32 CargoGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available)
+{
+ *available = false;
+ return 0;
+}
+
+
+static const SpriteGroup *CargoResolveReal(const ResolverObject *object, const SpriteGroup *group)
+{
+ /* Cargo action 2s should always have only 1 "loaded" state */
+ if (group->g.real.num_loaded == 0) return NULL;
+
+ return group->g.real.loaded[0];
+}
+
+
+static void NewCargoResolver(ResolverObject *res, const CargoSpec *cs)
+{
+ res->GetRandomBits = &CargoGetRandomBits;
+ res->GetTriggers = &CargoGetTriggers;
+ res->SetTriggers = &CargoSetTriggers;
+ res->GetVariable = &CargoGetVariable;
+ res->ResolveReal = &CargoResolveReal;
+
+ res->u.cargo.cs = cs;
+
+ res->callback = 0;
+ res->callback_param1 = 0;
+ res->callback_param2 = 0;
+ res->last_value = 0;
+ res->trigger = 0;
+ res->reseed = 0;
+}
+
+
+SpriteID GetCustomCargoSprite(const CargoSpec *cs)
+{
+ const SpriteGroup *group;
+ ResolverObject object;
+
+ NewCargoResolver(&object, cs);
+
+ group = Resolve(cs->group, &object);
+ if (group == NULL || group->type != SGT_RESULT) return 0;
+
+ return group->g.result.sprite;
+}
+
+
+uint16 GetCargoCallback(uint16 callback, uint32 param1, uint32 param2, const CargoSpec *cs)
+{
+ ResolverObject object;
+ const SpriteGroup *group;
+
+ NewCargoResolver(&object, cs);
+ object.callback = callback;
+ object.callback_param1 = param1;
+ object.callback_param2 = param2;
+
+ group = Resolve(cs->group, &object);
+ if (group == NULL || group->type != SGT_CALLBACK) return CALLBACK_FAILED;
+
+ return group->g.callback.result;
+}
--- a/src/newgrf_cargo.h Sat Mar 24 14:56:31 2007 +0000
+++ b/src/newgrf_cargo.h Sat Mar 24 15:19:35 2007 +0000
@@ -21,4 +21,9 @@
static const CargoID CT_PURCHASE = NUM_CARGO + 1;
static const CargoID CT_DEFAULT_NA = NUM_CARGO + 2;
+typedef struct CargoSpec;
+
+SpriteID GetCustomCargoSprite(const CargoSpec *cs);
+uint16 GetCargoCallback(uint16 callback, uint32 param1, uint32 param2, const CargoSpec *cs);
+
#endif /* NEWGRF_CARGO_H */
--- a/src/newgrf_house.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/newgrf_house.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -252,8 +252,8 @@
static uint32 GetTerrainType(TileIndex tile)
{
switch (_opt.landscape) {
- case LT_DESERT: return GetTropicZone(tile) == TROPICZONE_DESERT ? 1 : 2;
- case LT_HILLY: return GetTileZ(tile) >= GetSnowLine() ? 4 : 0;
+ case LT_TROPIC: return GetTropicZone(tile) == TROPICZONE_DESERT ? 1 : 2;
+ case LT_ARCTIC: return GetTileZ(tile) >= GetSnowLine() ? 4 : 0;
default: return 0;
}
}
--- a/src/newgrf_spritegroup.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/newgrf_spritegroup.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -94,7 +94,7 @@
case 0x1A: return UINT_MAX;
case 0x1B: return GB(_display_opt, 0, 6);
case 0x1C: return object->last_value;
- case 0x20: return _opt.landscape == LT_HILLY ? GetSnowLine() : 0xFF;
+ case 0x20: return _opt.landscape == LT_ARCTIC ? GetSnowLine() : 0xFF;
/* Not a common variable, so evalute the feature specific variables */
default: return object->GetVariable(object, variable, parameter, available);
--- a/src/newgrf_spritegroup.h Sat Mar 24 14:56:31 2007 +0000
+++ b/src/newgrf_spritegroup.h Sat Mar 24 15:19:35 2007 +0000
@@ -191,6 +191,9 @@
Town *town;
HouseID house_id;
} house;
+ struct {
+ const struct CargoSpec *cs;
+ } cargo;
} u;
uint32 (*GetRandomBits)(const struct ResolverObject*);
--- a/src/newgrf_station.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/newgrf_station.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -389,8 +389,8 @@
case 0x40: return GetPlatformInfoHelper(tile, false, false, false);
case 0x41: return GetPlatformInfoHelper(tile, true, false, false);
case 0x42: // Terrain and rail type
- return ((_opt.landscape == LT_HILLY && GetTileZ(tile) > GetSnowLine()) ? 4 : 0) |
- (_opt.landscape == LT_DESERT ? GetTropicZone(tile) : 0) |
+ return ((_opt.landscape == LT_ARCTIC && GetTileZ(tile) > GetSnowLine()) ? 4 : 0) |
+ (_opt.landscape == LT_TROPIC ? GetTropicZone(tile) : 0) |
(GetRailType(tile) << 8);
case 0x43: return st->owner; // Station owner
case 0x44: return 2; // PBS status
--- a/src/openttd.h Sat Mar 24 14:56:31 2007 +0000
+++ b/src/openttd.h Sat Mar 24 15:19:35 2007 +0000
@@ -183,10 +183,10 @@
/* Landscape types */
enum {
- LT_NORMAL = 0,
- LT_HILLY = 1,
- LT_DESERT = 2,
- LT_CANDY = 3,
+ LT_TEMPERATE = 0,
+ LT_ARCTIC = 1,
+ LT_TROPIC = 2,
+ LT_TOYLAND = 3,
NUM_LANDSCAPE = 4,
};
--- a/src/order_cmd.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/order_cmd.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -463,6 +463,7 @@
*/
static void RemoveSharedOrderVehicleList(Vehicle *v)
{
+ assert(v->orders != NULL);
WindowClass window_class = WC_NONE;
switch (v->type) {
@@ -1159,7 +1160,7 @@
/* If we are the only one left in the Shared Order Vehicle List,
* remove it, as we are no longer a Shared Order Vehicle */
- if (u->prev_shared == NULL && u->next_shared == NULL) RemoveSharedOrderVehicleList(u);
+ if (u->prev_shared == NULL && u->next_shared == NULL && u->orders != NULL) RemoveSharedOrderVehicleList(u);
/* We only need to update this-one, because if there is a third
* vehicle which shares the same order-list, nothing will change. If
--- a/src/rail_cmd.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/rail_cmd.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -848,14 +848,23 @@
typedef int32 DoConvertRailProc(TileIndex tile, RailType totype, bool exec);
+/**
+ * Switches the rail type.
+ * Railtypes are stored on a per-tile basis, not on a per-track basis, so
+ * all the tracks in the given tile will be converted.
+ * @param tile The tile on which the railtype is to be convert.
+ * @param totype The railtype we want to convert to
+ * @param exec Switches between test and execute mode
+ * @return The cost and state of the operation
+ * @retval CMD_ERROR An error occured during the operation.
+ */
static int32 DoConvertRail(TileIndex tile, RailType totype, bool exec)
{
if (!CheckTileOwnership(tile)) return CMD_ERROR;
- if (!EnsureNoVehicle(tile) && (!IsCompatibleRail(GetRailType(tile), totype) || IsPlainRailTile(tile))) return CMD_ERROR;
+ if (GetRailType(tile) == totype) return CMD_ERROR;
- // tile is already of requested type?
- if (GetRailType(tile) == totype) return CMD_ERROR;
+ if (!EnsureNoVehicle(tile) && (!IsCompatibleRail(GetRailType(tile), totype) || IsPlainRailTile(tile))) return CMD_ERROR;
// 'hidden' elrails can't be downgraded to normal rail when elrails are disabled
if (_patches.disable_elrails && totype == RAILTYPE_RAIL && GetRailType(tile) == RAILTYPE_ELECTRIC) return CMD_ERROR;
@@ -1293,7 +1302,7 @@
// adjust ground tile for desert
// don't adjust for snow, because snow in depots looks weird
- if (IsSnowRailGround(ti->tile) && _opt.landscape == LT_DESERT) {
+ if (IsSnowRailGround(ti->tile) && _opt.landscape == LT_TROPIC) {
if (image != SPR_FLAT_GRASS_TILE) {
image += rti->snow_offset; // tile with tracks
} else {
@@ -1737,14 +1746,14 @@
RailGroundType new_ground;
switch (_opt.landscape) {
- case LT_HILLY:
+ case LT_ARCTIC:
if (GetTileZ(tile) > GetSnowLine()) {
new_ground = RAIL_GROUND_ICE_DESERT;
goto set_ground;
}
break;
- case LT_DESERT:
+ case LT_TROPIC:
if (GetTropicZone(tile) == TROPICZONE_DESERT) {
new_ground = RAIL_GROUND_ICE_DESERT;
goto set_ground;
--- a/src/road_cmd.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/road_cmd.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -367,6 +367,14 @@
return cost;
}
+/**
+ * Switches the rail type on a level crossing.
+ * @param tile The tile on which the railtype is to be convert.
+ * @param totype The railtype we want to convert to
+ * @param exec Switches between test and execute mode
+ * @return The cost and state of the operation
+ * @retval CMD_ERROR An error occured during the operation.
+ */
int32 DoConvertStreetRail(TileIndex tile, RailType totype, bool exec)
{
// not a railroad crossing?
@@ -386,7 +394,7 @@
YapfNotifyTrackLayoutChange(tile, FindFirstTrack(GetCrossingRailBits(tile)));
}
- return _price.build_rail >> 1;
+ return _price.build_rail / 2;
}
@@ -861,14 +869,14 @@
static void TileLoop_Road(TileIndex tile)
{
switch (_opt.landscape) {
- case LT_HILLY:
+ case LT_ARCTIC:
if (IsOnSnow(tile) != (GetTileZ(tile) > GetSnowLine())) {
ToggleSnow(tile);
MarkTileDirtyByTile(tile);
}
break;
- case LT_DESERT:
+ case LT_TROPIC:
if (GetTropicZone(tile) == TROPICZONE_DESERT && !IsOnDesert(tile)) {
ToggleDesert(tile);
MarkTileDirtyByTile(tile);
@@ -906,7 +914,7 @@
{
/* Adjust road ground type depending on 'grp' (grp is the distance to the center) */
- const Roadside* new_rs = (_opt.landscape == LT_CANDY) ? _town_road_types_2[grp] : _town_road_types[grp];
+ const Roadside* new_rs = (_opt.landscape == LT_TOYLAND) ? _town_road_types_2[grp] : _town_road_types[grp];
Roadside cur_rs = GetRoadside(tile);
/* We have our desired type, do nothing */
--- a/src/roadveh_cmd.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/roadveh_cmd.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -639,7 +639,7 @@
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
if (!PlayVehicleSound(v, VSE_BREAKDOWN)) {
- SndPlayVehicleFx((_opt.landscape != LT_CANDY) ?
+ SndPlayVehicleFx((_opt.landscape != LT_TOYLAND) ?
SND_0F_VEHICLE_BREAKDOWN : SND_35_COMEDY_BREAKDOWN, v);
}
--- a/src/settings.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/settings.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -585,8 +585,11 @@
}
case SDT_ONEOFMANY: {
long r = lookup_oneofmany(desc->many, str, -1);
- if (r != -1) return (void*)r;
- ShowInfoF("ini: invalid value '%s' for '%s'", str, desc->name);
+ /* if the first attempt of conversion from string to the appropriate value fails,
+ * look if we have defined a converter from old value to new value. */
+ if (r == -1 && desc->proc_cnvt != NULL) r = desc->proc_cnvt(str);
+ if (r != -1) return (void*)r; //and here goes converted value
+ ShowInfoF("ini: invalid value '%s' for '%s'", str, desc->name); //sorry, we failed
return 0;
}
case SDT_MANYOFMANY: {
@@ -945,15 +948,22 @@
* If nothing fits you, you can use the GENERAL macros, but it exposes the
* internal structure somewhat so it needs a little looking. There are _NULL()
* macros as well, these fill up space so you can add more patches there (in
- * place) and you DON'T have to increase the savegame version. */
+ * place) and you DON'T have to increase the savegame version.
+ *
+ * While reading values from openttd.cfg, some values may not be converted
+ * properly, for any kind of reasons. In order to allow a process of self-cleaning
+ * mechanism, a callback procedure is made available. You will have to supply the function, which
+ * will work on a string, one function per patch. And of course, enable the callback param
+ * on the appropriate macro.
+ */
-#define NSD_GENERAL(name, def, cmd, guiflags, min, max, interval, many, str, proc)\
- {name, (const void*)(def), {cmd}, {guiflags}, min, max, interval, many, str, proc}
+#define NSD_GENERAL(name, def, cmd, guiflags, min, max, interval, many, str, proc, load)\
+ {name, (const void*)(def), {cmd}, {guiflags}, min, max, interval, many, str, proc, load}
/* Macros for various objects to go in the configuration file.
* This section is for global variables */
#define SDTG_GENERAL(name, sdt_cmd, sle_cmd, type, flags, guiflags, var, length, def, min, max, interval, full, str, proc, from, to)\
- {NSD_GENERAL(name, def, sdt_cmd, guiflags, min, max, interval, full, str, proc), SLEG_GENERAL(sle_cmd, var, type | flags, length, from, to)}
+ {NSD_GENERAL(name, def, sdt_cmd, guiflags, min, max, interval, full, str, proc, NULL), SLEG_GENERAL(sle_cmd, var, type | flags, length, from, to)}
#define SDTG_CONDVAR(name, type, flags, guiflags, var, def, min, max, interval, str, proc, from, to)\
SDTG_GENERAL(name, SDT_NUMX, SL_VAR, type, flags, guiflags, var, 0, def, min, max, interval, NULL, str, proc, from, to)
@@ -986,58 +996,58 @@
SDTG_CONDMMANY(name, type, flags, guiflags, var, def, full, str, proc, 0, SL_MAX_VERSION)
#define SDTG_CONDNULL(length, from, to)\
- {{"", NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL}, SLEG_CONDNULL(length, from, to)}
+ {{"", NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL, NULL}, SLEG_CONDNULL(length, from, to)}
-#define SDTG_END() {{NULL, NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL}, SLEG_END()}
+#define SDTG_END() {{NULL, NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL, NULL}, SLEG_END()}
/* Macros for various objects to go in the configuration file.
* This section is for structures where their various members are saved */
-#define SDT_GENERAL(name, sdt_cmd, sle_cmd, type, flags, guiflags, base, var, length, def, min, max, interval, full, str, proc, from, to)\
- {NSD_GENERAL(name, def, sdt_cmd, guiflags, min, max, interval, full, str, proc), SLE_GENERAL(sle_cmd, base, var, type | flags, length, from, to)}
+#define SDT_GENERAL(name, sdt_cmd, sle_cmd, type, flags, guiflags, base, var, length, def, min, max, interval, full, str, proc, load, from, to)\
+ {NSD_GENERAL(name, def, sdt_cmd, guiflags, min, max, interval, full, str, proc, load), SLE_GENERAL(sle_cmd, base, var, type | flags, length, from, to)}
#define SDT_CONDVAR(base, var, type, from, to, flags, guiflags, def, min, max, interval, str, proc)\
- SDT_GENERAL(#var, SDT_NUMX, SL_VAR, type, flags, guiflags, base, var, 1, def, min, max, interval, NULL, str, proc, from, to)
+ SDT_GENERAL(#var, SDT_NUMX, SL_VAR, type, flags, guiflags, base, var, 1, def, min, max, interval, NULL, str, proc, NULL, from, to)
#define SDT_VAR(base, var, type, flags, guiflags, def, min, max, interval, str, proc)\
SDT_CONDVAR(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, min, max, interval, str, proc)
#define SDT_CONDBOOL(base, var, from, to, flags, guiflags, def, str, proc)\
- SDT_GENERAL(#var, SDT_BOOLX, SL_VAR, SLE_BOOL, flags, guiflags, base, var, 1, def, 0, 1, 0, NULL, str, proc, from, to)
+ SDT_GENERAL(#var, SDT_BOOLX, SL_VAR, SLE_BOOL, flags, guiflags, base, var, 1, def, 0, 1, 0, NULL, str, proc, NULL, from, to)
#define SDT_BOOL(base, var, flags, guiflags, def, str, proc)\
SDT_CONDBOOL(base, var, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc)
#define SDT_CONDLIST(base, var, type, from, to, flags, guiflags, def, str, proc)\
- SDT_GENERAL(#var, SDT_INTLIST, SL_ARR, type, flags, guiflags, base, var, lengthof(((base*)8)->var), def, 0, 0, 0, NULL, str, proc, from, to)
+ SDT_GENERAL(#var, SDT_INTLIST, SL_ARR, type, flags, guiflags, base, var, lengthof(((base*)8)->var), def, 0, 0, 0, NULL, str, proc, NULL, from, to)
#define SDT_LIST(base, var, type, flags, guiflags, def, str, proc)\
SDT_CONDLIST(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc)
#define SDT_CONDLISTO(base, var, length, type, from, to, flags, guiflags, def, str, proc)\
- SDT_GENERAL(#var, SDT_INTLIST, SL_ARR, type, flags, guiflags, base, var, length, def, 0, 0, 0, NULL, str, proc, from, to)
+ SDT_GENERAL(#var, SDT_INTLIST, SL_ARR, type, flags, guiflags, base, var, length, def, 0, 0, 0, NULL, str, proc, NULL, from, to)
#define SDT_CONDSTR(base, var, type, from, to, flags, guiflags, def, str, proc)\
- SDT_GENERAL(#var, SDT_STRING, SL_STR, type, flags, guiflags, base, var, lengthof(((base*)8)->var), def, 0, 0, 0, NULL, str, proc, from, to)
+ SDT_GENERAL(#var, SDT_STRING, SL_STR, type, flags, guiflags, base, var, lengthof(((base*)8)->var), def, 0, 0, 0, NULL, str, proc, NULL, from, to)
#define SDT_STR(base, var, type, flags, guiflags, def, str, proc)\
SDT_CONDSTR(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc)
#define SDT_CONDSTRO(base, var, length, type, from, to, flags, def, str, proc)\
SDT_GENERAL(#var, SDT_STRING, SL_STR, type, flags, 0, base, var, length, def, 0, 0, NULL, str, proc, from, to)
#define SDT_CONDCHR(base, var, from, to, flags, guiflags, def, str, proc)\
- SDT_GENERAL(#var, SDT_STRING, SL_VAR, SLE_CHAR, flags, guiflags, base, var, 1, def, 0, 0, 0, NULL, str, proc, from, to)
+ SDT_GENERAL(#var, SDT_STRING, SL_VAR, SLE_CHAR, flags, guiflags, base, var, 1, def, 0, 0, 0, NULL, str, proc, NULL, from, to)
#define SDT_CHR(base, var, flags, guiflags, def, str, proc)\
SDT_CONDCHR(base, var, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc)
-#define SDT_CONDOMANY(base, var, type, from, to, flags, guiflags, def, max, full, str, proc)\
- SDT_GENERAL(#var, SDT_ONEOFMANY, SL_VAR, type, flags, guiflags, base, var, 1, def, 0, max, 0, full, str, proc, from, to)
-#define SDT_OMANY(base, var, type, flags, guiflags, def, max, full, str, proc)\
- SDT_CONDOMANY(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, max, full, str, proc)
+#define SDT_CONDOMANY(base, var, type, from, to, flags, guiflags, def, max, full, str, proc, load)\
+ SDT_GENERAL(#var, SDT_ONEOFMANY, SL_VAR, type, flags, guiflags, base, var, 1, def, 0, max, 0, full, str, proc, load, from, to)
+#define SDT_OMANY(base, var, type, flags, guiflags, def, max, full, str, proc, load)\
+ SDT_CONDOMANY(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, max, full, str, proc, load)
#define SDT_CONDMMANY(base, var, type, from, to, flags, guiflags, def, full, str, proc)\
- SDT_GENERAL(#var, SDT_MANYOFMANY, SL_VAR, type, flags, guiflags, base, var, 1, def, 0, 0, 0, full, str, proc, from, to)
+ SDT_GENERAL(#var, SDT_MANYOFMANY, SL_VAR, type, flags, guiflags, base, var, 1, def, 0, 0, 0, full, str, proc, NULL, from, to)
#define SDT_MMANY(base, var, type, flags, guiflags, def, full, str, proc)\
SDT_CONDMMANY(base, var, type, 0, SL_MAX_VERSION, flags, guiflags, def, full, str, proc)
#define SDT_CONDNULL(length, from, to)\
- {{"", NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL}, SLE_CONDNULL(length, from, to)}
+ {{"", NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL, NULL}, SLE_CONDNULL(length, from, to)}
-#define SDT_END() {{NULL, NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL}, SLE_END()}
+#define SDT_END() {{NULL, NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL, NULL}, SLE_END()}
/* Shortcuts for macros below. Logically if we don't save the value
* we also don't sync it in a network game */
@@ -1142,6 +1152,18 @@
DoCommandP(0, 2, _patches.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
return 0;
}
+/** Conversion callback for _gameopt_settings.landscape
+ * It converts (or try) between old values and the new ones,
+ * without loosing initial setting of the user
+ * @param value that was read from config file
+ * @return the "hopefully" converted value
+ */
+static int32 ConvertLandscape(const char *value)
+{
+ /* try with the old values */
+ return lookup_oneofmany("normal|hilly|desert|candy", value, -1);
+}
+
/* End - Callback Functions */
#ifndef EXTERNAL_PLAYER
@@ -1234,17 +1256,17 @@
* XXX - To save file-space and since values are never bigger than about 10? only
* save the first 16 bits in the savegame. Question is why the values are still int32
* and why not byte for example? */
- SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 17, 0, 0, 0, 0, NULL, STR_NULL, NULL, 0, 3),
- SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 18, 0, 0, 0, 0, NULL, STR_NULL, NULL, 4, SL_MAX_VERSION),
+ SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 17, 0, 0, 0, 0, NULL, STR_NULL, NULL, NULL, 0, 3),
+ SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 18, 0, 0, 0, 0, NULL, STR_NULL, NULL, NULL, 4, SL_MAX_VERSION),
SDT_VAR(GameOptions, diff_level,SLE_UINT8, 0, 0, 9, 0, 9, 0, STR_NULL, NULL),
- SDT_OMANY(GameOptions, currency, SLE_UINT8, N, 0, 0, CUSTOM_CURRENCY_ID, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SIT|SEK|YTL|SKK|BRR|custom", STR_NULL, NULL),
- SDT_OMANY(GameOptions, units, SLE_UINT8, N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL),
- SDT_OMANY(GameOptions, town_name, SLE_UINT8, 0, 0, 0, 20, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL),
- SDT_OMANY(GameOptions, landscape, SLE_UINT8, 0, 0, 0, 3, "normal|hilly|desert|candy", STR_NULL, NULL),
+ SDT_OMANY(GameOptions, currency, SLE_UINT8, N, 0, 0, CUSTOM_CURRENCY_ID, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SIT|SEK|YTL|SKK|BRR|custom", STR_NULL, NULL, NULL),
+ SDT_OMANY(GameOptions, units, SLE_UINT8, N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL, NULL),
+ SDT_OMANY(GameOptions, town_name, SLE_UINT8, 0, 0, 0, 20, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL, NULL),
+ SDT_OMANY(GameOptions, landscape, SLE_UINT8, 0, 0, 0, 3, "temperate|arctic|tropic|toyland", STR_NULL, NULL, ConvertLandscape),
SDT_VAR(GameOptions, snow_line, SLE_UINT8, 0, 0, 1, 0, 56, 0, STR_NULL, NULL),
- SDT_CONDOMANY(GameOptions,autosave, SLE_UINT8, 0, 22, N, 0, 0, 0, "", STR_NULL, NULL),
- SDT_CONDOMANY(GameOptions,autosave, SLE_UINT8,23, SL_MAX_VERSION, S, 0, 1, 4, "off|monthly|quarterly|half year|yearly", STR_NULL, NULL),
- SDT_OMANY(GameOptions, road_side, SLE_UINT8, 0, 0, 1, 1, "left|right", STR_NULL, NULL),
+ SDT_CONDOMANY(GameOptions,autosave, SLE_UINT8, 0, 22, N, 0, 0, 0, "", STR_NULL, NULL, NULL),
+ SDT_CONDOMANY(GameOptions,autosave, SLE_UINT8,23, SL_MAX_VERSION, S, 0, 1, 4, "off|monthly|quarterly|half year|yearly", STR_NULL, NULL, NULL),
+ SDT_OMANY(GameOptions, road_side, SLE_UINT8, 0, 0, 1, 1, "left|right", STR_NULL, NULL, NULL),
SDT_END()
};
--- a/src/settings.h Sat Mar 24 14:56:31 2007 +0000
+++ b/src/settings.h Sat Mar 24 15:19:35 2007 +0000
@@ -44,7 +44,8 @@
typedef TinyEnumT<SettingGuiFlagLong> SettingGuiFlag;
-typedef int32 OnChange(int32 var);
+typedef int32 OnChange(int32 var); ///< callback prototype on data modification
+typedef int32 OnConvert(const char *value); ///< callback prototype for convertion error
struct SettingDescBase {
const char *name; ///< name of the setting. Used in configuration file and for console
@@ -56,6 +57,7 @@
const char *many; ///< ONE/MANY_OF_MANY: string of possible values for this type
StringID str; ///< (translated) string with descriptive text; gui and console
OnChange *proc; ///< callback procedure for when the value is changed
+ OnConvert *proc_cnvt; ///< callback procedure when loading value mechanism fails
};
struct SettingDesc {
--- a/src/ship_cmd.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/ship_cmd.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -208,7 +208,7 @@
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
if (!PlayVehicleSound(v, VSE_BREAKDOWN)) {
- SndPlayVehicleFx((_opt.landscape != LT_CANDY) ?
+ SndPlayVehicleFx((_opt.landscape != LT_TOYLAND) ?
SND_10_TRAIN_BREAKDOWN : SND_3A_COMEDY_BREAKDOWN_2, v);
}
--- a/src/smallmap_gui.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/smallmap_gui.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -492,7 +492,7 @@
case MP_TREES:
if (GetTreeGround(tile) == TREE_GROUND_SNOW_DESERT) {
- bits = (_opt.landscape == LT_HILLY) ? MKCOLOR(0x98575798) : MKCOLOR(0xC25757C2);
+ bits = (_opt.landscape == LT_ARCTIC) ? MKCOLOR(0x98575798) : MKCOLOR(0xC25757C2);
} else {
bits = MKCOLOR(0x54575754);
}
--- a/src/station_cmd.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/station_cmd.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -250,7 +250,7 @@
CountMapSquareAround(tile, MP_TREES, 0) >= 8 ||
CountMapSquareAround(tile, MP_INDUSTRY, IT_FOREST) >= 2)
) {
- found = _opt.landscape == LT_DESERT ?
+ found = _opt.landscape == LT_TROPIC ?
M(STR_SV_STNAME_FOREST) : M(STR_SV_STNAME_WOODS);
goto done;
}
@@ -1120,6 +1120,14 @@
return cost;
}
+/**
+ * Switches the rail type at a railway station tile.
+ * @param tile The tile on which the railtype is to be convert.
+ * @param totype The railtype we want to convert to
+ * @param exec Switches between test and execute mode
+ * @return The cost and state of the operation
+ * @retval CMD_ERROR An error occured during the operation.
+ */
int32 DoConvertStationRail(TileIndex tile, RailType totype, bool exec)
{
const Station* st = GetStationByTile(tile);
@@ -1140,7 +1148,7 @@
YapfNotifyTrackLayoutChange(tile, GetRailStationTrack(tile));
}
- return _price.build_rail >> 1;
+ return _price.build_rail / 2;
}
/**
--- a/src/station_gui.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/station_gui.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -667,6 +667,30 @@
{ WIDGETS_END},
};
+
+static void DrawCargoIcons(CargoID i, uint waiting, int x, int y)
+{
+ uint num = min((waiting + 5) / 10, 23);
+ if (num == 0) return;
+
+ const CargoSpec *cs = GetCargo(i);
+ SpriteID sprite;
+
+ if (cs->sprite == 0xFFFF) {
+ /* A value of 0xFFFF indicates we should draw a custom icon */
+ sprite = GetCustomCargoSprite(cs);
+ } else {
+ sprite = cs->sprite;
+ }
+
+ if (sprite == 0) return;
+
+ do {
+ DrawSprite(sprite, PAL_NONE, x, y);
+ x += 10;
+ } while (--num);
+}
+
static void DrawStationViewWindow(Window *w)
{
StationID station_id = w->window_number;
@@ -713,18 +737,9 @@
uint waiting = GB(st->goods[i].waiting_acceptance, 0, 12);
if (waiting == 0) continue;
- num = (waiting + 5) / 10;
- if (num != 0) {
- int cur_x = x;
- num = min(num, 23);
- do {
- DrawSprite(GetCargo(i)->sprite, PAL_NONE, cur_x, y);
- cur_x += 10;
- } while (--num);
- }
-
if (st->goods[i].enroute_from == station_id) {
if (--pos < 0) {
+ DrawCargoIcons(i, waiting, x, y);
SetDParam(1, waiting);
SetDParam(0, i);
DrawStringRightAligned(x + 234, y, STR_0009, 0);
@@ -733,6 +748,7 @@
} else {
/* enroute */
if (--pos < 0) {
+ DrawCargoIcons(i, waiting, x, y);
SetDParam(1, waiting);
SetDParam(0, i);
DrawStringRightAligned(x + 234, y, STR_000A_EN_ROUTE_FROM, 0);
--- a/src/strings.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/strings.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -585,9 +585,15 @@
}
default:
- buff = FormatCommaNumber(buff, GetInt32(&argv), last);
- buff = strecpy(buff, " ", last);
- buff = strecpy(buff, GetStringPtr(cargo_str), last);
+ if (cargo_str >= 0xE000 && cargo_str < 0xF800) {
+ /* NewGRF strings from Action 4 use a different format here,
+ * of e.g. "x tonnes of coal", so process accordingly. */
+ buff = GetStringWithArgs(buff, cargo_str, argv++, last);
+ } else {
+ buff = FormatCommaNumber(buff, GetInt32(&argv), last);
+ buff = strecpy(buff, " ", last);
+ buff = strecpy(buff, GetStringPtr(cargo_str), last);
+ }
break;
}
} break;
@@ -953,7 +959,7 @@
const char* const* base;
uint num;
- if (_opt_ptr->landscape == LT_CANDY) {
+ if (_opt_ptr->landscape == LT_TOYLAND) {
base = _silly_surname_list;
num = lengthof(_silly_surname_list);
} else {
@@ -983,7 +989,7 @@
buff = strecpy(buff, initial, last);
}
- if (_opt_ptr->landscape == LT_CANDY) {
+ if (_opt_ptr->landscape == LT_TOYLAND) {
base = _silly_surname_list;
num = lengthof(_silly_surname_list);
} else {
--- a/src/table/build_industry.h Sat Mar 24 14:56:31 2007 +0000
+++ b/src/table/build_industry.h Sat Mar 24 15:19:35 2007 +0000
@@ -1100,7 +1100,7 @@
IT_POWER_STATION, IT_INVALID, IT_INVALID, CHECK_NOTHING,
CT_COAL, 15, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_NORMAL | 1 << LT_HILLY,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TEMPERATE | 1 << LT_ARCTIC,
STR_4802_COAL_MINE, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4836_NEW_COAL_SEAM_FOUND_AT, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1108,7 +1108,7 @@
IT_COAL_MINE, IT_INVALID, IT_INVALID, CHECK_NOTHING,
CT_INVALID, 0, CT_INVALID, 0, 5,
CT_COAL, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_NOT_CLOSABLE, 1 << LT_NORMAL | 1 << LT_HILLY,
+ INDUSTRYLIFE_NOT_CLOSABLE, 1 << LT_TEMPERATE | 1 << LT_ARCTIC,
STR_4803_POWER_STATION, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1116,7 +1116,7 @@
IT_FOREST, IT_INVALID, IT_INVALID, CHECK_NOTHING,
CT_GOODS, 0, CT_INVALID, 0, 5,
CT_WOOD, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_CLOSABLE, 1 << LT_NORMAL,
+ INDUSTRYLIFE_CLOSABLE, 1 << LT_TEMPERATE,
STR_4804_SAWMILL, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1124,7 +1124,7 @@
IT_SAWMILL, IT_PAPER_MILL, IT_INVALID, CHECK_FOREST,
CT_WOOD, 13, CT_INVALID, 0, 30,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_NORMAL | 1 << LT_HILLY,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TEMPERATE | 1 << LT_ARCTIC,
STR_4805_FOREST, STR_482E_NEW_BEING_PLANTED_NEAR,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_483A_INSECT_INFESTATION_CAUSES),
@@ -1132,7 +1132,7 @@
IT_OIL_RIG, IT_INVALID, IT_INVALID, CHECK_REFINERY,
CT_GOODS, 0, CT_INVALID, 0, 5,
CT_OIL, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_CLOSABLE, 1 << LT_NORMAL | 1 << LT_HILLY | 1 << LT_DESERT,
+ INDUSTRYLIFE_CLOSABLE, 1 << LT_TEMPERATE | 1 << LT_ARCTIC | 1 << LT_TROPIC,
STR_4806_OIL_REFINERY, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1140,7 +1140,7 @@
IT_OIL_REFINERY, IT_INVALID, IT_INVALID, CHECK_OIL_RIG,
CT_OIL, 15, CT_PASSENGERS, 2, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_NORMAL,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TEMPERATE,
STR_4807_OIL_RIG, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4837_NEW_OIL_RESERVES_FOUND, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1148,7 +1148,7 @@
IT_FARM, IT_STEEL_MILL, IT_INVALID, CHECK_NOTHING,
CT_GOODS, 0, CT_INVALID, 0, 5,
CT_LIVESTOCK, CT_GRAIN, CT_STEEL,
- INDUSTRYLIFE_CLOSABLE, 1 << LT_NORMAL,
+ INDUSTRYLIFE_CLOSABLE, 1 << LT_TEMPERATE,
STR_4808_FACTORY, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1156,7 +1156,7 @@
IT_PAPER_MILL, IT_INVALID, IT_INVALID, CHECK_NOTHING,
CT_GOODS, 0, CT_INVALID, 0, 5,
CT_PAPER, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_CLOSABLE, 1 << LT_HILLY,
+ INDUSTRYLIFE_CLOSABLE, 1 << LT_ARCTIC,
STR_4809_PRINTING_WORKS, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1164,7 +1164,7 @@
IT_IRON_MINE, IT_FACTORY, IT_INVALID, CHECK_NOTHING,
CT_STEEL, 0, CT_INVALID, 0, 5,
CT_IRON_ORE, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_CLOSABLE, 1 << LT_NORMAL,
+ INDUSTRYLIFE_CLOSABLE, 1 << LT_TEMPERATE,
STR_480A_STEEL_MILL, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1172,7 +1172,7 @@
IT_FACTORY, IT_FOOD_PROCESS, IT_INVALID, CHECK_FARM,
CT_GRAIN, 10, CT_LIVESTOCK, 10, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_NORMAL | 1 << LT_HILLY,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TEMPERATE | 1 << LT_ARCTIC,
STR_480B_FARM, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4838_IMPROVED_FARMING_METHODS, STR_483A_INSECT_INFESTATION_CAUSES),
@@ -1180,7 +1180,7 @@
IT_FACTORY_2, IT_INVALID, IT_INVALID, CHECK_NOTHING,
CT_COPPER_ORE, 10, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_DESERT,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TROPIC,
STR_480C_COPPER_ORE_MINE, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1188,7 +1188,7 @@
IT_OIL_REFINERY, IT_INVALID, IT_INVALID, CHECK_NOTHING,
CT_OIL, 12, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_NORMAL | 1 << LT_HILLY | 1 << LT_DESERT,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TEMPERATE | 1 << LT_ARCTIC | 1 << LT_TROPIC,
STR_480D_OIL_WELLS, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4837_NEW_OIL_RESERVES_FOUND, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1196,7 +1196,7 @@
IT_BANK_TEMP, IT_INVALID, IT_INVALID, CHECK_NOTHING,
CT_VALUABLES, 6, CT_INVALID, 0, 5,
CT_VALUABLES, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_NOT_CLOSABLE, 1 << LT_NORMAL,
+ INDUSTRYLIFE_NOT_CLOSABLE, 1 << LT_TEMPERATE,
STR_480E_BANK, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1204,7 +1204,7 @@
IT_FRUIT_PLANTATION, IT_FARM, IT_FARM_2, CHECK_NOTHING,
CT_FOOD, 0, CT_INVALID, 0, 5,
CT_FRUIT, CT_MAIZE, CT_INVALID,
- INDUSTRYLIFE_CLOSABLE, 1 << LT_HILLY | 1 << LT_DESERT,
+ INDUSTRYLIFE_CLOSABLE, 1 << LT_ARCTIC | 1 << LT_TROPIC,
STR_480F_FOOD_PROCESSING_PLANT, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1212,7 +1212,7 @@
IT_FOREST, IT_PRINTING_WORKS, IT_INVALID, CHECK_NOTHING,
CT_PAPER, 0, CT_INVALID, 0, 5,
CT_WOOD, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_CLOSABLE, 1 << LT_HILLY,
+ INDUSTRYLIFE_CLOSABLE, 1 << LT_ARCTIC,
STR_4810_PAPER_MILL, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1220,7 +1220,7 @@
IT_BANK_TROPIC_ARCTIC, IT_INVALID, IT_INVALID, CHECK_NOTHING,
CT_GOLD, 7, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_DESERT,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TROPIC,
STR_4811_GOLD_MINE, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1228,7 +1228,7 @@
IT_GOLD_MINE, IT_DIAMOND_MINE, IT_INVALID, CHECK_NOTHING,
CT_INVALID, 0, CT_INVALID, 0, 5,
CT_GOLD, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_NOT_CLOSABLE, 1 << LT_HILLY | 1 << LT_DESERT,
+ INDUSTRYLIFE_NOT_CLOSABLE, 1 << LT_ARCTIC | 1 << LT_TROPIC,
STR_4812_BANK, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1236,7 +1236,7 @@
IT_BANK_TROPIC_ARCTIC, IT_INVALID, IT_INVALID, CHECK_NOTHING,
CT_DIAMONDS, 7, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_DESERT,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TROPIC,
STR_4813_DIAMOND_MINE, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1244,7 +1244,7 @@
IT_STEEL_MILL, IT_INVALID, IT_INVALID, CHECK_NOTHING,
CT_IRON_ORE, 10, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_NORMAL,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TEMPERATE,
STR_4814_IRON_ORE_MINE, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1252,7 +1252,7 @@
IT_FOOD_PROCESS, IT_INVALID, IT_INVALID, CHECK_PLANTATION,
CT_FRUIT, 10, CT_INVALID, 0, 15,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_DESERT,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TROPIC,
STR_4815_FRUIT_PLANTATION, STR_482E_NEW_BEING_PLANTED_NEAR,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4838_IMPROVED_FARMING_METHODS, STR_483A_INSECT_INFESTATION_CAUSES),
@@ -1260,7 +1260,7 @@
IT_FACTORY_2, IT_INVALID, IT_INVALID, CHECK_PLANTATION,
CT_RUBBER, 10, CT_INVALID, 0, 15,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_DESERT,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TROPIC,
STR_4816_RUBBER_PLANTATION, STR_482E_NEW_BEING_PLANTED_NEAR,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4838_IMPROVED_FARMING_METHODS, STR_483A_INSECT_INFESTATION_CAUSES),
@@ -1268,7 +1268,7 @@
IT_WATER_TOWER, IT_INVALID, IT_INVALID, CHECK_WATER,
CT_WATER, 12, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_DESERT,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TROPIC,
STR_4817_WATER_SUPPLY, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1276,7 +1276,7 @@
IT_WATER_SUPPLY, IT_INVALID, IT_INVALID, CHECK_WATER,
CT_INVALID, 0, CT_INVALID, 0, 5,
CT_WATER, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_NOT_CLOSABLE, 1 << LT_DESERT,
+ INDUSTRYLIFE_NOT_CLOSABLE, 1 << LT_TROPIC,
STR_4818_WATER_TOWER, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1284,7 +1284,7 @@
IT_RUBBER_PLANTATION, IT_COPPER_MINE, IT_LUMBER_MILL, CHECK_PLANTATION,
CT_GOODS, 0, CT_INVALID, 0, 5,
CT_RUBBER, CT_COPPER_ORE, CT_WOOD,
- INDUSTRYLIFE_CLOSABLE, 1 << LT_DESERT,
+ INDUSTRYLIFE_CLOSABLE, 1 << LT_TROPIC,
STR_4819_FACTORY, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1292,7 +1292,7 @@
IT_FOOD_PROCESS, IT_INVALID, IT_INVALID, CHECK_PLANTATION,
CT_MAIZE, 11, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_DESERT,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TROPIC,
STR_481A_FARM, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4838_IMPROVED_FARMING_METHODS, STR_483A_INSECT_INFESTATION_CAUSES),
@@ -1300,7 +1300,7 @@
IT_FACTORY_2, IT_INVALID, IT_INVALID, CHECK_LUMBERMILL,
CT_WOOD, 0, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_CLOSABLE, 1 << LT_DESERT,
+ INDUSTRYLIFE_CLOSABLE, 1 << LT_TROPIC,
STR_481B_LUMBER_MILL, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4834_LACK_OF_NEARBY_TREES_CAUSES, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1308,7 +1308,7 @@
IT_CANDY_FACTORY, IT_INVALID, IT_INVALID, CHECK_NOTHING,
CT_COTTON_CANDY, 13, CT_INVALID, 0, 30,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_CANDY,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TOYLAND,
STR_481C_COTTON_CANDY_FOREST, STR_482E_NEW_BEING_PLANTED_NEAR,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4838_IMPROVED_FARMING_METHODS, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1316,7 +1316,7 @@
IT_COTTON_CANDY, IT_TOFFEE_QUARRY, IT_SUGAR_MINE, CHECK_NOTHING,
CT_CANDY, 0, CT_INVALID, 0, 5,
CT_SUGAR, CT_TOFFEE, CT_COTTON_CANDY,
- INDUSTRYLIFE_CLOSABLE, 1 << LT_CANDY,
+ INDUSTRYLIFE_CLOSABLE, 1 << LT_TOYLAND,
STR_481D_CANDY_FACTORY, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1324,7 +1324,7 @@
IT_TOY_FACTORY, IT_INVALID, IT_INVALID, CHECK_NOTHING,
CT_BATTERIES, 11, CT_INVALID, 0, 30,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_CANDY,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TOYLAND,
STR_481E_BATTERY_FARM, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4838_IMPROVED_FARMING_METHODS, STR_483A_INSECT_INFESTATION_CAUSES),
@@ -1332,7 +1332,7 @@
IT_FIZZY_DRINK_FACTORY, IT_INVALID, IT_INVALID, CHECK_NOTHING,
CT_COLA, 12, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_CANDY,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TOYLAND,
STR_481F_COLA_WELLS, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1340,7 +1340,7 @@
IT_TOY_FACTORY, IT_INVALID, IT_INVALID, CHECK_NOTHING,
CT_INVALID, 0, CT_INVALID, 0, 5,
CT_TOYS, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_NOT_CLOSABLE, 1 << LT_CANDY,
+ INDUSTRYLIFE_NOT_CLOSABLE, 1 << LT_TOYLAND,
STR_4820_TOY_SHOP, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1348,7 +1348,7 @@
IT_PLASTIC_FOUNTAINS, IT_BATTERY_FARM, IT_TOY_SHOP, CHECK_NOTHING,
CT_TOYS, 0, CT_INVALID, 0, 5,
CT_PLASTIC, CT_BATTERIES, CT_INVALID,
- INDUSTRYLIFE_CLOSABLE, 1 << LT_CANDY,
+ INDUSTRYLIFE_CLOSABLE, 1 << LT_TOYLAND,
STR_4821_TOY_FACTORY, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1356,7 +1356,7 @@
IT_TOY_FACTORY, IT_INVALID, IT_INVALID, CHECK_NOTHING,
CT_PLASTIC, 14, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_CANDY,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TOYLAND,
STR_4822_PLASTIC_FOUNTAINS, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1364,7 +1364,7 @@
IT_COLA_WELLS, IT_BUBBLE_GENERATOR, IT_INVALID, CHECK_NOTHING,
CT_FIZZY_DRINKS, 0, CT_INVALID, 0, 5,
CT_COLA, CT_BUBBLES, CT_INVALID,
- INDUSTRYLIFE_CLOSABLE, 1 << LT_CANDY,
+ INDUSTRYLIFE_CLOSABLE, 1 << LT_TOYLAND,
STR_4823_FIZZY_DRINK_FACTORY, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1372,7 +1372,7 @@
IT_FIZZY_DRINK_FACTORY, IT_INVALID, IT_INVALID, CHECK_BUBBLEGEN,
CT_BUBBLES, 13, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_CANDY,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TOYLAND,
STR_4824_BUBBLE_GENERATOR, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1380,7 +1380,7 @@
IT_CANDY_FACTORY, IT_INVALID, IT_INVALID, CHECK_NOTHING,
CT_TOFFEE, 10, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_CANDY,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TOYLAND,
STR_4825_TOFFEE_QUARRY, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
@@ -1388,7 +1388,7 @@
IT_CANDY_FACTORY, IT_INVALID, IT_INVALID, CHECK_NOTHING,
CT_SUGAR, 11, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
- INDUSTRYLIFE_PRODUCTION, 1 << LT_CANDY,
+ INDUSTRYLIFE_PRODUCTION, 1 << LT_TOYLAND,
STR_4826_SUGAR_MINE, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
};
--- a/src/table/cargo_const.h Sat Mar 24 14:56:31 2007 +0000
+++ b/src/table/cargo_const.h Sat Mar 24 15:19:35 2007 +0000
@@ -3,7 +3,7 @@
/* Table of all default cargo types */
#define MK(bt, label, c, e, f, g, h, fr, te, ks1, ks2, ks3, ks4, ks5, l, m) \
- {bt, label, 0, c, c, e, f, {g, h}, fr, te, 0, 0, ks1, ks2, ks3, ks4, ks5, l, m}
+ {bt, label, 0, c, c, e, f, {g, h}, fr, te, 0, 0, ks1, ks2, ks3, ks4, ks5, l, m, NULL}
static const CargoSpec _default_cargo[] = {
MK( 0, 'PASS', 152, 1, 3185, 0, 24, false, TE_PASSENGERS,
STR_000F_PASSENGERS, STR_002F_PASSENGER, STR_PASSENGERS, STR_QUANTITY_PASSENGERS, STR_ABBREV_PASSENGERS,
--- a/src/texteff.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/texteff.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -145,15 +145,27 @@
}
}
+ int x = _textmsg_box.x;
+ int y = _screen.height - _textmsg_box.y - _textmsg_box.height;
+ int width = _textmsg_box.width;
+ int height = _textmsg_box.height;
+ if (y < 0) {
+ height = max(height + y, min(_textmsg_box.height, _screen.height));
+ y = 0;
+ }
+ if (x + width >= _screen.width) {
+ width = _screen.width - x;
+ }
+
_textmessage_visible = false;
/* Put our 'shot' back to the screen */
memcpy_pitch(
- _screen.dst_ptr + _textmsg_box.x + (_screen.height - _textmsg_box.y - _textmsg_box.height) * _screen.pitch,
+ _screen.dst_ptr + x + y * _screen.pitch,
_textmessage_backup,
- _textmsg_box.width, _textmsg_box.height, _textmsg_box.width, _screen.pitch);
+ width, height, _textmsg_box.width, _screen.pitch);
/* And make sure it is updated next time */
- _video_driver->make_dirty(_textmsg_box.x, _screen.height - _textmsg_box.y - _textmsg_box.height, _textmsg_box.width, _textmsg_box.height);
+ _video_driver->make_dirty(x, y, width, height);
_textmessage_dirty = true;
}
@@ -186,8 +198,6 @@
/* Draw the textmessage-box */
void DrawTextMessage()
{
- uint y, count;
-
if (!_textmessage_dirty) return;
/* First undraw if needed */
@@ -196,14 +206,25 @@
if (_iconsole_mode == ICONSOLE_FULL) return;
/* Check if we have anything to draw at all */
- count = GetTextMessageCount();
+ uint count = GetTextMessageCount();
if (count == 0) return;
+ int x = _textmsg_box.x;
+ int y = _screen.height - _textmsg_box.y - _textmsg_box.height;
+ int width = _textmsg_box.width;
+ int height = _textmsg_box.height;
+ if (y < 0) {
+ height = max(height + y, min(_textmsg_box.height, _screen.height));
+ y = 0;
+ }
+ if (x + width >= _screen.width) {
+ width = _screen.width - x;
+ }
/* Make a copy of the screen as it is before painting (for undraw) */
memcpy_pitch(
_textmessage_backup,
- _screen.dst_ptr + _textmsg_box.x + (_screen.height - _textmsg_box.y - _textmsg_box.height) * _screen.pitch,
- _textmsg_box.width, _textmsg_box.height, _screen.pitch, _textmsg_box.width);
+ _screen.dst_ptr + x + y * _screen.pitch,
+ width, height, _screen.pitch, _textmsg_box.width);
_cur_dpi = &_screen; // switch to _screen painting
@@ -217,12 +238,12 @@
);
/* Paint the messages starting with the lowest at the bottom */
- for (y = 13; count-- != 0; y += 13) {
+ for (uint y = 13; count-- != 0; y += 13) {
DoDrawString(_textmsg_list[count].message, _textmsg_box.x + 3, _screen.height - _textmsg_box.y - y + 1, _textmsg_list[count].color);
}
/* Make sure the data is updated next flush */
- _video_driver->make_dirty(_textmsg_box.x, _screen.height - _textmsg_box.y - _textmsg_box.height, _textmsg_box.width, _textmsg_box.height);
+ _video_driver->make_dirty(x, y, width, height);
_textmessage_visible = true;
_textmessage_dirty = false;
--- a/src/tgp.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/tgp.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -398,8 +398,8 @@
fheight = (double)(*h - h_min) / (double)(h_max - h_min);
/* Apply sine transform depending on landscape type */
switch(_opt.landscape) {
- case LT_CANDY:
- case LT_NORMAL:
+ case LT_TOYLAND:
+ case LT_TEMPERATE:
/* Move and scale 0..1 into -1..+1 */
fheight = 2 * fheight - 1;
/* Sine transform */
@@ -408,7 +408,7 @@
fheight = 0.5 * (fheight + 1);
break;
- case LT_HILLY:
+ case LT_ARCTIC:
{
/* Arctic terrain needs special height distribution.
* Redistribute heights to have more tiles at highest (75%..100%) range */
@@ -429,7 +429,7 @@
}
break;
- case LT_DESERT:
+ case LT_TROPIC:
{
/* Desert terrain needs special height distribution.
* Half of tiles should be at lowest (0..25%) heights */
--- a/src/town_cmd.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/town_cmd.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -1231,7 +1231,7 @@
uint rad = GetTownRadiusGroup(t, tile);
int land = _opt.landscape;
- if (land == LT_HILLY && z >= _opt.snow_line) land = -1;
+ if (land == LT_ARCTIC && z >= _opt.snow_line) land = -1;
bitmask = (1 << rad) + (1 << (land + 12));
}
@@ -1698,10 +1698,10 @@
m = _grow_count_values[min(n, 5) - 1];
}
- if (_opt.landscape == LT_HILLY) {
+ if (_opt.landscape == LT_ARCTIC) {
if (TilePixelHeight(t->xy) >= GetSnowLine() && t->act_food == 0 && t->population > 90)
return;
- } else if (_opt.landscape == LT_DESERT) {
+ } else if (_opt.landscape == LT_TROPIC) {
if (GetTropicZone(t->xy) == TROPICZONE_DESERT && (t->act_food==0 || t->act_water==0) && t->population > 60)
return;
}
--- a/src/train_cmd.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/train_cmd.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -3214,7 +3214,7 @@
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
if (!PlayVehicleSound(v, VSE_BREAKDOWN)) {
- SndPlayVehicleFx((_opt.landscape != LT_CANDY) ?
+ SndPlayVehicleFx((_opt.landscape != LT_TOYLAND) ?
SND_10_TRAIN_BREAKDOWN : SND_3A_COMEDY_BREAKDOWN_2, v);
}
--- a/src/tree_cmd.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/tree_cmd.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -28,13 +28,13 @@
static TreeType GetRandomTreeType(TileIndex tile, uint seed)
{
switch (_opt.landscape) {
- case LT_NORMAL:
+ case LT_TEMPERATE:
return (TreeType)(seed * TREE_COUNT_TEMPERATE / 256 + TREE_TEMPERATE);
- case LT_HILLY:
+ case LT_ARCTIC:
return (TreeType)(seed * TREE_COUNT_SUB_ARCTIC / 256 + TREE_SUB_ARCTIC);
- case LT_DESERT:
+ case LT_TROPIC:
switch (GetTropicZone(tile)) {
case TROPICZONE_INVALID: return (TreeType)(seed * TREE_COUNT_SUB_TROPICAL / 256 + TREE_SUB_TROPICAL);
case TROPICZONE_DESERT: return (TreeType)((seed > 12) ? TREE_INVALID : TREE_CACTUS);
@@ -54,7 +54,7 @@
MakeTree(tile, tree, GB(r, 22, 2), min(GB(r, 16, 3), 6), TREE_GROUND_GRASS, 0);
// above snowline?
- if (_opt.landscape == LT_HILLY && GetTileZ(tile) > GetSnowLine()) {
+ if (_opt.landscape == LT_ARCTIC && GetTileZ(tile) > GetSnowLine()) {
SetTreeGroundDensity(tile, TREE_GROUND_SNOW_DESERT, 3);
SetTreeCounter(tile, (TreeGround)GB(r, 24, 3));
} else {
@@ -151,7 +151,7 @@
j = GetTileZ(tile) / TILE_HEIGHT * 2;
while (j--) {
/* Above snowline more trees! */
- if (_opt.landscape == LT_HILLY && ht > GetSnowLine()) {
+ if (_opt.landscape == LT_ARCTIC && ht > GetSnowLine()) {
PlaceTreeAtSameHeight(tile, ht);
PlaceTreeAtSameHeight(tile, ht);
};
@@ -162,7 +162,7 @@
} while (--i);
/* place extra trees at rainforest area */
- if (_opt.landscape == LT_DESERT) {
+ if (_opt.landscape == LT_TROPIC) {
i = ScaleByMapSize(15000);
do {
@@ -187,16 +187,16 @@
if (_patches.tree_placer == TP_NONE) return;
- if (_opt.landscape != LT_CANDY) PlaceMoreTrees();
+ if (_opt.landscape != LT_TOYLAND) PlaceMoreTrees();
switch (_patches.tree_placer) {
- case TP_ORIGINAL: i = _opt.landscape == LT_HILLY ? 15 : 6; break;
- case TP_IMPROVED: i = _opt.landscape == LT_HILLY ? 4 : 2; break;
+ case TP_ORIGINAL: i = _opt.landscape == LT_ARCTIC ? 15 : 6; break;
+ case TP_IMPROVED: i = _opt.landscape == LT_ARCTIC ? 4 : 2; break;
default: NOT_REACHED(); return;
}
total = ScaleByMapSize(1000);
- if (_opt.landscape == LT_DESERT) total += ScaleByMapSize(15000);
+ if (_opt.landscape == LT_TROPIC) total += ScaleByMapSize(15000);
total *= i;
SetGeneratingWorldProgress(GWP_TREE, total);
@@ -524,8 +524,8 @@
static void TileLoop_Trees(TileIndex tile)
{
switch (_opt.landscape) {
- case LT_DESERT: TileLoopTreesDesert(tile); break;
- case LT_HILLY: TileLoopTreesAlps(tile); break;
+ case LT_TROPIC: TileLoopTreesDesert(tile); break;
+ case LT_ARCTIC: TileLoopTreesAlps(tile); break;
}
TileLoopClearHelper(tile);
@@ -538,7 +538,7 @@
switch (GetTreeGrowth(tile)) {
case 3: /* regular sized tree */
- if (_opt.landscape == LT_DESERT &&
+ if (_opt.landscape == LT_TROPIC &&
GetTreeType(tile) != TREE_CACTUS &&
GetTropicZone(tile) == TROPICZONE_DESERT) {
AddTreeGrowth(tile, 1);
@@ -613,7 +613,7 @@
TreeType tree;
/* place a tree at a random rainforest spot */
- if (_opt.landscape == LT_DESERT &&
+ if (_opt.landscape == LT_TROPIC &&
(r = Random(), tile = RandomTileSeed(r), GetTropicZone(tile) == TROPICZONE_RAINFOREST) &&
IsTileType(tile, MP_CLEAR) &&
!IsBridgeAbove(tile) &&
--- a/src/tunnelbridge_cmd.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/tunnelbridge_cmd.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -695,6 +695,16 @@
return CMD_ERROR;
}
+/**
+ * Switches the rail type for a tunnel or a bridgehead. As the railtype
+ * on the bridge are determined by the one of the bridgehead, this
+ * functions converts the railtype on the entire bridge.
+ * @param tile The tile on which the railtype is to be convert.
+ * @param totype The railtype we want to convert to
+ * @param exec Switches between test and execute mode
+ * @return The cost and state of the operation
+ * @retval CMD_ERROR An error occured during the operation.
+ */
int32 DoConvertTunnelBridgeRail(TileIndex tile, RailType totype, bool exec)
{
TileIndex endtile;
@@ -723,7 +733,7 @@
YapfNotifyTrackLayoutChange(tile, track);
YapfNotifyTrackLayoutChange(endtile, track);
}
- return (length + 1) * (_price.build_rail >> 1);
+ return (length + 1) * (_price.build_rail / 2);
} else if (IsBridge(tile) && GetBridgeTransportType(tile) == TRANSPORT_RAIL) {
if (!CheckTileOwnership(tile)) return CMD_ERROR;
@@ -757,7 +767,7 @@
}
}
- return (DistanceManhattan(tile, endtile) + 1) * (_price.build_rail >> 1);
+ return (DistanceManhattan(tile, endtile) + 1) * (_price.build_rail / 2);
} else {
return CMD_ERROR;
}
@@ -1177,7 +1187,7 @@
{
bool snow_or_desert = IsTunnelTile(tile) ? HasTunnelSnowOrDesert(tile) : HasBridgeSnowOrDesert(tile);
switch (_opt.landscape) {
- case LT_HILLY:
+ case LT_ARCTIC:
if (snow_or_desert != (GetTileZ(tile) > GetSnowLine())) {
if (IsTunnelTile(tile)) {
SetTunnelSnowOrDesert(tile, !snow_or_desert);
@@ -1188,7 +1198,7 @@
}
break;
- case LT_DESERT:
+ case LT_TROPIC:
if (GetTropicZone(tile) == TROPICZONE_DESERT && !snow_or_desert) {
if (IsTunnelTile(tile)) {
SetTunnelSnowOrDesert(tile, true);
--- a/src/unmovable_cmd.cpp Sat Mar 24 14:56:31 2007 +0000
+++ b/src/unmovable_cmd.cpp Sat Mar 24 15:19:35 2007 +0000
@@ -344,7 +344,7 @@
uint maxx;
uint maxy;
- if (_opt.landscape == LT_CANDY) return;
+ if (_opt.landscape == LT_TOYLAND) return;
/* add radio tower */
i = ScaleByMapSize(1000);
@@ -362,7 +362,7 @@
}
} while (--i);
- if (_opt.landscape == LT_DESERT) return;
+ if (_opt.landscape == LT_TROPIC) return;
/* add lighthouses */
i = li;