(svn r13509) [NoAI] -Sync: with trunk r13472:13508.
Binary file bin/data/openttdd.grf has changed
Binary file bin/data/openttdw.grf has changed
--- a/src/dock_gui.cpp Fri Jun 13 13:07:31 2008 +0000
+++ b/src/dock_gui.cpp Fri Jun 13 15:43:39 2008 +0000
@@ -69,7 +69,7 @@
DoCommandP(tile, 0, 0, CcBuildDocks, CMD_BUILD_LOCK | CMD_MSG(STR_CANT_BUILD_LOCKS));
}
-static void PlaceDocks_Bridge(TileIndex tile)
+static void PlaceDocks_Aqueduct(TileIndex tile)
{
VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_BUILD_BRIDGE);
}
@@ -89,7 +89,7 @@
DTW_DEPOT, ///< Build depot button
DTW_STATION, ///< Build station button
DTW_BUOY, ///< Build buoy button
- DTW_BUILD_BRIDGE, ///< Build bride button
+ DTW_BUILD_AQUEDUCT, ///< Build aqueduct button
DTW_END, ///< End of toolbar widgets
};
@@ -127,9 +127,9 @@
HandlePlacePushButton(w, DTW_BUOY, SPR_CURSOR_BOUY, VHM_RECT, PlaceDocks_Buoy);
}
-static void BuildDocksClick_Bridge(Window *w)
+static void BuildDocksClick_Aqueduct(Window *w)
{
- HandlePlacePushButton(w, DTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, VHM_RECT, PlaceDocks_Bridge);
+ HandlePlacePushButton(w, DTW_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, VHM_RECT, PlaceDocks_Aqueduct);
}
@@ -142,7 +142,7 @@
BuildDocksClick_Depot,
BuildDocksClick_Dock,
BuildDocksClick_Buoy,
- BuildDocksClick_Bridge
+ BuildDocksClick_Aqueduct
};
struct BuildDocksToolbarWindow : Window {
@@ -177,7 +177,8 @@
case '4': BuildDocksClick_Depot(this); break;
case '5': BuildDocksClick_Dock(this); break;
case '6': BuildDocksClick_Buoy(this); break;
- case '7': BuildDocksClick_Bridge(this); break;
+ case 'B':
+ case '7': BuildDocksClick_Aqueduct(this); break;
default: return ES_NOT_HANDLED;
}
return ES_HANDLED;
@@ -200,7 +201,7 @@
case DDSP_BUILD_BRIDGE:
ResetObjectToPlace();
extern void CcBuildBridge(bool success, TileIndex tile, uint32 p1, uint32 p2);
- DoCommandP(end_tile, start_tile, TRANSPORT_WATER << 15, CcBuildBridge, CMD_BUILD_BRIDGE | CMD_MSG(STR_5015_CAN_T_BUILD_BRIDGE_HERE));
+ DoCommandP(end_tile, start_tile, TRANSPORT_WATER << 15, CcBuildBridge, CMD_BUILD_BRIDGE | CMD_MSG(STR_CAN_T_BUILD_AQUEDUCT_HERE));
case DDSP_DEMOLISH_AREA:
GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
@@ -233,8 +234,8 @@
static const Widget _build_docks_toolb_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // DTW_CLOSEBOX
-{ WWT_CAPTION, RESIZE_NONE, 7, 11, 166, 0, 13, STR_9801_DOCK_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // DTW_CAPTION
-{ WWT_STICKYBOX, RESIZE_NONE, 7, 167, 178, 0, 13, 0x0, STR_STICKY_BUTTON}, // DTW_STICKY
+{ WWT_CAPTION, RESIZE_NONE, 7, 11, 145, 0, 13, STR_9801_DOCK_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, // DTW_CAPTION
+{ WWT_STICKYBOX, RESIZE_NONE, 7, 146, 157, 0, 13, 0x0, STR_STICKY_BUTTON}, // DTW_STICKY
{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 21, 14, 35, SPR_IMG_BUILD_CANAL, STR_BUILD_CANALS_TIP}, // DTW_CANAL
{ WWT_IMGBTN, RESIZE_NONE, 7, 22, 43, 14, 35, SPR_IMG_BUILD_LOCK, STR_BUILD_LOCKS_TIP}, // DTW_LOCK
@@ -244,12 +245,12 @@
{ WWT_IMGBTN, RESIZE_NONE, 7, 70, 91, 14, 35, SPR_IMG_SHIP_DEPOT, STR_981E_BUILD_SHIP_DEPOT_FOR_BUILDING}, // DTW_DEPOT
{ WWT_IMGBTN, RESIZE_NONE, 7, 92, 113, 14, 35, SPR_IMG_SHIP_DOCK, STR_981D_BUILD_SHIP_DOCK}, // DTW_STATION
{ WWT_IMGBTN, RESIZE_NONE, 7, 114, 135, 14, 35, SPR_IMG_BOUY, STR_9834_POSITION_BUOY_WHICH_CAN}, // DTW_BUOY
-{ WWT_IMGBTN, RESIZE_NONE, 7, 136, 178, 14, 35, SPR_IMG_BRIDGE, STR_180F_BUILD_ROAD_BRIDGE}, // DTW_BUILD_BRIDGE
+{ WWT_IMGBTN, RESIZE_NONE, 7, 136, 157, 14, 35, SPR_IMG_AQUEDUCT, STR_BUILD_AQUEDUCT}, // DTW_BUILD_AQUEDUCT
{ WIDGETS_END},
};
static const WindowDesc _build_docks_toolbar_desc = {
- WDP_ALIGN_TBR, 22, 179, 36, 179, 36,
+ WDP_ALIGN_TBR, 22, 158, 36, 158, 36,
WC_BUILD_TOOLBAR, WC_NONE,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
_build_docks_toolb_widgets,
--- a/src/genworld_gui.cpp Fri Jun 13 13:07:31 2008 +0000
+++ b/src/genworld_gui.cpp Fri Jun 13 15:43:39 2008 +0000
@@ -477,7 +477,7 @@
* (use random seed) it should not be possible to be
* entered into the input field; the generate seed
* button can be used instead. */
- _settings_newgame.game_creation.generation_seed = minu(strtoul(this->edit_str_buf, NULL, sizeof(this->edit_str_buf) - 1), MAX_UVALUE(uint32) - 1);
+ _settings_newgame.game_creation.generation_seed = minu(strtoul(this->edit_str_buf, NULL, 10), MAX_UVALUE(uint32) - 1);
return state;
}
--- a/src/gfx.cpp Fri Jun 13 13:07:31 2008 +0000
+++ b/src/gfx.cpp Fri Jun 13 15:43:39 2008 +0000
@@ -689,7 +689,7 @@
}
}
-static inline void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode, const SubSprite *sub)
+static void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode, const SubSprite *sub)
{
const DrawPixelInfo *dpi = _cur_dpi;
Blitter::BlitterParams bp;
@@ -715,8 +715,8 @@
bp.height = UnScaleByZoom(sprite->height - clip_top - clip_bottom, dpi->zoom);
bp.top = 0;
bp.left = 0;
- bp.skip_left = UnScaleByZoom(clip_left, dpi->zoom);
- bp.skip_top = UnScaleByZoom(clip_top, dpi->zoom);
+ bp.skip_left = UnScaleByZoomLower(clip_left, dpi->zoom);
+ bp.skip_top = UnScaleByZoomLower(clip_top, dpi->zoom);
x += ScaleByZoom(bp.skip_left, dpi->zoom);
y += ScaleByZoom(bp.skip_top, dpi->zoom);
@@ -767,6 +767,9 @@
if (bp.width <= 0) return;
}
+ assert(bp.skip_left + bp.width <= UnScaleByZoom(sprite->width, dpi->zoom));
+ assert(bp.skip_top + bp.height <= UnScaleByZoom(sprite->height, dpi->zoom));
+
BlitterFactoryBase::GetCurrentBlitter()->Draw(&bp, mode, dpi->zoom);
}
--- a/src/industry_cmd.cpp Fri Jun 13 13:07:31 2008 +0000
+++ b/src/industry_cmd.cpp Fri Jun 13 15:43:39 2008 +0000
@@ -338,8 +338,7 @@
IndustryGfx gfx = GetIndustryGfx(tile);
/* For NewGRF industry tiles we might not be drawing a foundation. We need to
- * account for this, otherwise we might be applying a FOUNDATION_LEVELED
- * on a steep slope which is not allowed. Furthermore other structures should
+ * account for this, as other structures should
* draw the wall of the foundation in this case.
*/
if (gfx >= NEW_INDUSTRYTILEOFFSET) {
--- a/src/landscape.cpp Fri Jun 13 13:07:31 2008 +0000
+++ b/src/landscape.cpp Fri Jun 13 15:43:39 2008 +0000
@@ -79,8 +79,9 @@
if (!IsFoundation(f)) return 0;
if (IsLeveledFoundation(f)) {
+ uint dz = TILE_HEIGHT + (IsSteepSlope(*s) ? TILE_HEIGHT : 0);
*s = SLOPE_FLAT;
- return TILE_HEIGHT;
+ return dz;
}
if (f != FOUNDATION_STEEP_BOTH && IsNonContinuousFoundation(f)) {
@@ -402,6 +403,9 @@
AddSortableSpriteToDraw(inclined_base + inclined, PAL_NONE, ti->x, ti->y, 16, 16, 1, ti->z);
OffsetGroundSprite(31, 9);
+ } else if (IsLeveledFoundation(f)) {
+ AddSortableSpriteToDraw(leveled_base + SlopeWithOneCornerRaised(highest_corner), PAL_NONE, ti->x, ti->y, 16, 16, 7, ti->z - TILE_HEIGHT);
+ OffsetGroundSprite(31, 1);
} else if (f == FOUNDATION_STEEP_LOWER) {
/* one corner raised */
OffsetGroundSprite(31, 1);
--- a/src/lang/english.txt Fri Jun 13 13:07:31 2008 +0000
+++ b/src/lang/english.txt Fri Jun 13 15:43:39 2008 +0000
@@ -1944,6 +1944,7 @@
STR_3804_WATER :Water
STR_3805_COAST_OR_RIVERBANK :Coast or riverbank
STR_3806_SHIP_DEPOT :Ship depot
+STR_AQUEDUCT :Aqueduct
STR_3807_CAN_T_BUILD_ON_WATER :{WHITE}...Can't build on water
STR_MUST_DEMOLISH_CANAL_FIRST :{WHITE}Must demolish canal first
@@ -3008,6 +3009,8 @@
STR_9833_CITIZENS_CELEBRATE_FIRST :{BLACK}{BIGFONT}Citizens celebrate . . .{}First ship arrives at {STATION}!
STR_9834_POSITION_BUOY_WHICH_CAN :{BLACK}Place a buoy which can be used as a waypoint
STR_9835_CAN_T_POSITION_BUOY_HERE :{WHITE}Can't place buoy here...
+STR_BUILD_AQUEDUCT :{BLACK}Build aqueduct
+STR_CAN_T_BUILD_AQUEDUCT_HERE :{WHITE}Can't build aqueduct here...
STR_9836_RENAME :{BLACK}Rename
STR_9837_RENAME_SHIP_TYPE :{BLACK}Rename ship type
STR_9838_RENAME_SHIP_TYPE :{WHITE}Rename ship type
--- a/src/newgrf.cpp Fri Jun 13 13:07:31 2008 +0000
+++ b/src/newgrf.cpp Fri Jun 13 15:43:39 2008 +0000
@@ -2948,7 +2948,7 @@
EngineID *engines = AllocaM(EngineID, idcount);
for (uint i = 0; i < idcount; i++) {
- engines[i] = GetNewEngine(_cur_grffile, (VehicleType)feature, grf_load_byte(&buf))->index;
+ engines[i] = GetNewEngine(_cur_grffile, (VehicleType)feature, grf_load_extended(&buf))->index;
if (!wagover) last_engines[i] = engines[i];
}
@@ -3281,7 +3281,14 @@
uint8 lang = grf_load_byte(&buf);
uint8 num = grf_load_byte(&buf);
bool generic = HasBit(lang, 7);
- uint16 id = generic ? grf_load_word(&buf) : grf_load_byte(&buf);
+ uint16 id;
+ if (generic) {
+ id = grf_load_word(&buf);
+ } else if (feature <= GSF_AIRCRAFT) {
+ id = grf_load_extended(&buf);
+ } else {
+ id = grf_load_byte(&buf);
+ }
ClrBit(lang, 7);
--- a/src/rail_cmd.cpp Fri Jun 13 13:07:31 2008 +0000
+++ b/src/rail_cmd.cpp Fri Jun 13 15:43:39 2008 +0000
@@ -1381,7 +1381,10 @@
cost.AddCost(ret);
}
- if (water_ground) {
+ /* when bankrupting, don't make water dirty, there could be a ship on lower halftile */
+ if (water_ground && !(flags & DC_BANKRUPT)) {
+ if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
+
/* The track was removed, and left a coast tile. Now also clear the water. */
if (flags & DC_EXEC) DoClearSquare(tile);
cost.AddCost(_price.clear_water);
@@ -2111,6 +2114,19 @@
static TrackStatus GetTileTrackStatus_Track(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
{
+ /* Case of half tile slope with water. */
+ if (mode == TRANSPORT_WATER && IsPlainRailTile(tile) && GetRailGroundType(tile) == RAIL_GROUND_WATER) {
+ TrackBits tb = GetTrackBits(tile);
+ switch (tb) {
+ default: NOT_REACHED();
+ case TRACK_BIT_UPPER: tb = TRACK_BIT_LOWER; break;
+ case TRACK_BIT_LOWER: tb = TRACK_BIT_UPPER; break;
+ case TRACK_BIT_LEFT: tb = TRACK_BIT_RIGHT; break;
+ case TRACK_BIT_RIGHT: tb = TRACK_BIT_LEFT; break;
+ }
+ return CombineTrackStatus(TrackBitsToTrackdirBits(tb), TRACKDIR_BIT_NONE);
+ }
+
if (mode != TRANSPORT_RAIL) return 0;
TrackBits trackbits = TRACK_BIT_NONE;
--- a/src/roadveh_cmd.cpp Fri Jun 13 13:07:31 2008 +0000
+++ b/src/roadveh_cmd.cpp Fri Jun 13 15:43:39 2008 +0000
@@ -1717,6 +1717,7 @@
_road_veh_data_1[v->u.road.state - RVSB_IN_ROAD_STOP + (_settings_game.vehicle.road_side << RVS_DRIVE_SIDE)] == v->u.road.frame) ||
(IsInsideMM(v->u.road.state, RVSB_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END) &&
v->current_order.ShouldStopAtStation(v, GetStationIndex(v->tile)) &&
+ v->owner == GetRoadOwner(v->tile, v->u.road.roadtype) &&
GetRoadStopType(v->tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? ROADSTOP_BUS : ROADSTOP_TRUCK) &&
v->u.road.frame == RVC_DRIVE_THROUGH_STOP_FRAME))) {
--- a/src/signs_func.h Fri Jun 13 13:07:31 2008 +0000
+++ b/src/signs_func.h Fri Jun 13 15:43:39 2008 +0000
@@ -15,6 +15,7 @@
/* signs_gui.cpp */
void ShowRenameSignWindow(const Sign *si);
+void HandleClickOnSign(const Sign *si);
void ShowSignList();
--- a/src/signs_gui.cpp Fri Jun 13 13:07:31 2008 +0000
+++ b/src/signs_gui.cpp Fri Jun 13 15:43:39 2008 +0000
@@ -8,6 +8,7 @@
#include "textbuf_gui.h"
#include "window_gui.h"
#include "player_gui.h"
+#include "player_func.h"
#include "signs_base.h"
#include "signs_func.h"
#include "debug.h"
@@ -301,6 +302,15 @@
_query_sign_edit_widgets,
};
+void HandleClickOnSign(const Sign *si)
+{
+ if (_ctrl_pressed && si->owner == _local_player) {
+ RenameSign(si->index, "");
+ return;
+ }
+ ShowRenameSignWindow(si);
+}
+
void ShowRenameSignWindow(const Sign *si)
{
/* Delete all other edit windows and the save window */
--- a/src/slope_func.h Fri Jun 13 13:07:31 2008 +0000
+++ b/src/slope_func.h Fri Jun 13 15:43:39 2008 +0000
@@ -347,13 +347,11 @@
* Returns the foundation needed to flatten a slope.
* The returned foundation is either FOUNDATION_NONE if the tile was already flat, or FOUNDATION_LEVELED.
*
- * @pre The slope must not be steep.
* @param s The current #Slope.
* @return The needed #Foundation.
*/
static inline Foundation FlatteningFoundation(Slope s)
{
- assert(!IsSteepSlope(s));
return (s == SLOPE_FLAT ? FOUNDATION_NONE : FOUNDATION_LEVELED);
}
--- a/src/table/files.h Fri Jun 13 13:07:31 2008 +0000
+++ b/src/table/files.h Fri Jun 13 15:43:39 2008 +0000
@@ -35,7 +35,7 @@
{ "TRGT.GRF", {0xfc, 0xde, 0x1d, 0x7e, 0x8a, 0x74, 0x19, 0x7d, 0x72, 0xa6, 0x26, 0x95, 0x88, 0x4b, 0x90, 0x9e} }
},
{ "SAMPLE.CAT", {0x42, 0x2e, 0xa3, 0xdd, 0x07, 0x4d, 0x28, 0x59, 0xbb, 0x51, 0x63, 0x9a, 0x6e, 0x0e, 0x85, 0xda} },
- { "OPENTTDD.GRF", {0x1e, 0x6c, 0x85, 0x87, 0xfa, 0x9c, 0x84, 0xed, 0x51, 0xc7, 0x96, 0x4c, 0x91, 0xcf, 0x61, 0xa4} }
+ { "OPENTTDD.GRF", {0xf8, 0x29, 0xf6, 0x2c, 0x13, 0x7d, 0x6d, 0x7c, 0x6e, 0x27, 0x2c, 0x48, 0x1b, 0x79, 0x6d, 0xd5} }
};
@@ -49,5 +49,5 @@
{ "TRGTR.GRF", {0xde, 0x53, 0x65, 0x05, 0x17, 0xfe, 0x66, 0x1c, 0xea, 0xa3, 0x13, 0x8c, 0x6e, 0xdb, 0x0e, 0xb8} }
},
{ "SAMPLE.CAT", {0x92, 0x12, 0xe8, 0x1e, 0x72, 0xba, 0xdd, 0x4b, 0xbe, 0x1e, 0xae, 0xae, 0x66, 0x45, 0x8e, 0x10} },
- { "OPENTTDW.GRF", {0x08, 0x2b, 0x0e, 0x53, 0x1a, 0x4e, 0x02, 0xb2, 0x1a, 0x87, 0x52, 0x08, 0x64, 0xab, 0xf8, 0xf4} }
+ { "OPENTTDW.GRF", {0x89, 0x4f, 0xa4, 0xb0, 0x4d, 0xc1, 0x6d, 0xc4, 0x39, 0x21, 0x49, 0x3f, 0xd8, 0x3d, 0x80, 0x9e} }
};
--- a/src/table/sprites.h Fri Jun 13 13:07:31 2008 +0000
+++ b/src/table/sprites.h Fri Jun 13 15:43:39 2008 +0000
@@ -49,7 +49,7 @@
/* Extra graphic spritenumbers */
SPR_OPENTTD_BASE = 4896,
- OPENTTD_SPRITE_COUNT = 145,
+ OPENTTD_SPRITE_COUNT = 147,
/* Halftile-selection sprites */
SPR_HALFTILE_SELECTION_FLAT = SPR_OPENTTD_BASE,
@@ -132,6 +132,7 @@
SPR_CANALS_BASE = SPR_SIGNALS_BASE + PRESIGNAL_SEMAPHORE_AND_PBS_SPRITE_COUNT,
CANALS_SPRITE_COUNT = 65,
+ /* Sprites for the Aqueduct. */
SPR_AQUEDUCT_BASE = SPR_CANALS_BASE + CANALS_SPRITE_COUNT,
SPR_AQUEDUCT_RAMP_SW = SPR_AQUEDUCT_BASE + 0,
SPR_AQUEDUCT_RAMP_SE = SPR_AQUEDUCT_BASE + 1,
@@ -143,10 +144,11 @@
SPR_AQUEDUCT_PILLAR_Y = SPR_AQUEDUCT_BASE + 7,
AQUEDUCT_SPRITE_COUNT = 8,
+ /* Sprites for 'highlighting' tracks on sloped land. */
SPR_TRACKS_FOR_SLOPES_BASE = SPR_AQUEDUCT_BASE + AQUEDUCT_SPRITE_COUNT,
- SPR_TRACKS_FOR_SLOPES_RAIL_BASE = SPR_AQUEDUCT_BASE + 0,
- SPR_TRACKS_FOR_SLOPES_MONO_BASE = SPR_AQUEDUCT_BASE + 4,
- SPR_TRACKS_FOR_SLOPES_MAGLEV_BASE = SPR_AQUEDUCT_BASE + 8,
+ SPR_TRACKS_FOR_SLOPES_RAIL_BASE = SPR_TRACKS_FOR_SLOPES_BASE + 0,
+ SPR_TRACKS_FOR_SLOPES_MONO_BASE = SPR_TRACKS_FOR_SLOPES_BASE + 4,
+ SPR_TRACKS_FOR_SLOPES_MAGLEV_BASE = SPR_TRACKS_FOR_SLOPES_BASE + 8,
TRACKS_FOR_SLOPES_SPRITE_COUNT = 12,
SPR_SLOPES_BASE = SPR_TRACKS_FOR_SLOPES_BASE + TRACKS_FOR_SLOPES_SPRITE_COUNT,
@@ -1252,6 +1254,7 @@
SPR_IMG_SHIP_DEPOT = 748,
SPR_IMG_SHIP_DOCK = 746,
SPR_IMG_BOUY = 693,
+ SPR_IMG_AQUEDUCT = SPR_OPENTTD_BASE + 145,
/* music_gui.c */
SPR_IMG_SKIP_TO_PREV = 709,
@@ -1354,6 +1357,7 @@
SPR_CURSOR_CANAL = SPR_OPENTTD_BASE + 89,
SPR_CURSOR_LOCK = SPR_OPENTTD_BASE + 87,
SPR_CURSOR_RIVER = SPR_OPENTTD_BASE + 137,
+ SPR_CURSOR_AQUEDUCT = SPR_OPENTTD_BASE + 146,
/* shared road & rail cursors */
SPR_CURSOR_BRIDGE = 2593,
--- a/src/toolbar_gui.cpp Fri Jun 13 13:07:31 2008 +0000
+++ b/src/toolbar_gui.cpp Fri Jun 13 15:43:39 2008 +0000
@@ -991,6 +991,18 @@
};
struct ScenarioEditorToolbarWindow : Window {
+private:
+ enum ToolbarScenEditorWidgets {
+ TBSE_PAUSE = 0,
+ TBSE_FASTFORWARD,
+ TBSE_SPACERPANEL = 4,
+ TBSE_DATEBACKWARD = 6,
+ TBSE_DATEFORWARD,
+ TBSE_ZOOMIN = 9,
+ TBSE_ZOOMOUT,
+ };
+
+public:
ScenarioEditorToolbarWindow(const WindowDesc *desc) : Window(desc)
{
CLRBITS(this->flags4, WF_WHITE_BORDER_MASK);
@@ -1002,8 +1014,8 @@
virtual void OnPaint()
{
- this->SetWidgetDisabledState(6, _settings_newgame.game_creation.starting_year <= MIN_YEAR);
- this->SetWidgetDisabledState(7, _settings_newgame.game_creation.starting_year >= MAX_YEAR);
+ this->SetWidgetDisabledState(TBSE_DATEBACKWARD, _settings_newgame.game_creation.starting_year <= MIN_YEAR);
+ this->SetWidgetDisabledState(TBSE_DATEFORWARD, _settings_newgame.game_creation.starting_year >= MAX_YEAR);
/* Draw brown-red toolbar bg. */
GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB2);
@@ -1012,12 +1024,13 @@
this->DrawWidgets();
SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1));
- DrawStringCenteredTruncated(this->widget[6].right, this->widget[7].left, 6, STR_00AF, TC_FROMSTRING);
+ DrawStringCenteredTruncated(this->widget[TBSE_DATEBACKWARD].right, this->widget[TBSE_DATEFORWARD].left, 6, STR_00AF, TC_FROMSTRING);
/* We hide this panel when the toolbar space gets too small */
- if (this->widget[4].left != this->widget[4].right) {
- DrawStringCenteredTruncated(this->widget[4].left + 1, this->widget[4].right - 1, 1, STR_0221_OPENTTD, TC_FROMSTRING);
- DrawStringCenteredTruncated(this->widget[4].left + 1, this->widget[4].right - 1, 11, STR_0222_SCENARIO_EDITOR, TC_FROMSTRING);
+ const Widget *panel = &this->widget[TBSE_SPACERPANEL];
+ if (panel->left != panel->right) {
+ DrawStringCenteredTruncated(panel->left + 1, panel->right - 1, 1, STR_0221_OPENTTD, TC_FROMSTRING);
+ DrawStringCenteredTruncated(panel->left + 1, panel->right - 1, 11, STR_0222_SCENARIO_EDITOR, TC_FROMSTRING);
}
}
@@ -1048,13 +1061,13 @@
case WKC_NUM_PLUS:
case WKC_EQUALS:
case WKC_SHIFT | WKC_EQUALS:
- case WKC_SHIFT | WKC_F5: ToolbarZoomInClick(this); break;
+ case WKC_SHIFT | WKC_F5: ToolbarScenZoomIn(this); break;
/* those following are all fall through */
case WKC_NUM_MINUS:
case WKC_MINUS:
case WKC_SHIFT | WKC_MINUS:
- case WKC_SHIFT | WKC_F6: ToolbarZoomOutClick(this); break;
+ case WKC_SHIFT | WKC_F6: ToolbarScenZoomOut(this); break;
case 'L': ShowEditorTerraformToolbar(); break;
case 'M': ShowSmallMap(); break;
@@ -1144,20 +1157,20 @@
virtual void OnTick()
{
- if (this->IsWidgetLowered(0) != !!_pause_game) {
- this->ToggleWidgetLoweredState(0);
+ if (this->IsWidgetLowered(TBSE_PAUSE) != !!_pause_game) {
+ this->ToggleWidgetLoweredState(TBSE_PAUSE);
this->SetDirty();
}
- if (this->IsWidgetLowered(1) != !!_fast_forward) {
- this->ToggleWidgetLoweredState(1);
+ if (this->IsWidgetLowered(TBSE_FASTFORWARD) != !!_fast_forward) {
+ this->ToggleWidgetLoweredState(TBSE_FASTFORWARD);
this->SetDirty();
}
}
virtual void OnInvalidateData(int data)
{
- if (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) HandleZoomMessage(this, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, 17, 18);
+ if (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) HandleZoomMessage(this, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, TBSE_ZOOMIN, TBSE_ZOOMOUT);
}
};
--- a/src/town_cmd.cpp Fri Jun 13 13:07:31 2008 +0000
+++ b/src/town_cmd.cpp Fri Jun 13 15:43:39 2008 +0000
@@ -1929,11 +1929,6 @@
}
if ((hs->extra_flags & BUILDING_IS_HISTORICAL) && !_generating_world) continue;
-
- if (HasBit(hs->callback_mask, CBM_HOUSE_ALLOW_CONSTRUCTION)) {
- uint16 callback_res = GetHouseCallback(CBID_HOUSE_ALLOW_CONSTRUCTION, 0, 0, house, t, tile);
- if (callback_res != CALLBACK_FAILED && GB(callback_res, 0, 8) == 0) continue;
- }
}
if (_cur_year < hs->min_year || _cur_year > hs->max_year) continue;
@@ -1947,7 +1942,7 @@
SetBit(oneof, TOWN_HAS_STADIUM);
}
- if (HASBITS(t->flags12 , oneof)) continue;
+ if (HASBITS(t->flags12, oneof)) continue;
/* Make sure there is no slope? */
bool noslope = (hs->building_flags & TILE_NOT_SLOPED) != 0;
@@ -1963,6 +1958,11 @@
/* 1x1 house checks are already done */
}
+ if (HasBit(hs->callback_mask, CBM_HOUSE_ALLOW_CONSTRUCTION)) {
+ uint16 callback_res = GetHouseCallback(CBID_HOUSE_ALLOW_CONSTRUCTION, 0, 0, house, t, tile);
+ if (callback_res != CALLBACK_FAILED && GB(callback_res, 0, 8) == 0) continue;
+ }
+
/* build the house */
t->num_houses++;
IncreaseBuildingCount(t, house);
--- a/src/train_cmd.cpp Fri Jun 13 13:07:31 2008 +0000
+++ b/src/train_cmd.cpp Fri Jun 13 15:43:39 2008 +0000
@@ -212,6 +212,8 @@
u->u.rail.first_engine = v == u ? INVALID_ENGINE : first_engine;
u->u.rail.railtype = rvi_u->railtype;
+ if (IsTrainEngine(u)) first_engine = u->engine_type;
+
/* Set user defined data to its default value */
u->u.rail.user_def_data = rvi_u->user_def_data;
}
@@ -226,8 +228,6 @@
if (!HasBit(EngInfo(u->engine_type)->misc_flags, EF_RAIL_TILTS)) train_can_tilt = false;
- if (IsTrainEngine(u)) first_engine = u->engine_type;
-
/* Cache wagon override sprite group. NULL is returned if there is none */
u->u.rail.cached_override = GetWagonOverrideSpriteSet(u->engine_type, u->cargo_type, u->u.rail.first_engine);
--- a/src/tunnelbridge_cmd.cpp Fri Jun 13 13:07:31 2008 +0000
+++ b/src/tunnelbridge_cmd.cpp Fri Jun 13 15:43:39 2008 +0000
@@ -738,7 +738,7 @@
* @param y Sprite Y position of front pillar.
* @param z_bridge Absolute height of bridge bottom.
*/
-static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo* ti, Axis axis, BridgeType type, int x, int y, int z_bridge)
+static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo* ti, Axis axis, bool drawfarpillar, int x, int y, int z_bridge)
{
/* Do not draw bridge pillars if they are invisible */
if (IsInvisibilitySet(TO_BRIDGES)) return;
@@ -746,8 +746,6 @@
SpriteID image = psid->sprite;
if (image != 0) {
- bool drawfarpillar = !HasBit(GetBridgeSpec(type)->flags, 0);
-
/* "side" specifies the side the pillars stand on.
* The length of the pillars is then set to the height of the bridge over the corners of this edge.
*
@@ -1041,32 +1039,25 @@
/* Z position of the bridge sprites relative to bridge height (downwards) */
static const int BRIDGE_Z_START = 3;
- const PalSpriteID *psid;
- uint base_offset;
- TileIndex rampnorth;
- TileIndex rampsouth;
- TransportType transport_type;
- Axis axis;
- uint piece;
- BridgeType type;
- int x;
- int y;
- uint z;
-
if (!IsBridgeAbove(ti->tile)) return;
- rampnorth = GetNorthernBridgeEnd(ti->tile);
- rampsouth = GetSouthernBridgeEnd(ti->tile);
- transport_type = GetTunnelBridgeTransportType(rampsouth);
+ TileIndex rampnorth = GetNorthernBridgeEnd(ti->tile);
+ TileIndex rampsouth = GetSouthernBridgeEnd(ti->tile);
+ TransportType transport_type = GetTunnelBridgeTransportType(rampsouth);
- axis = GetBridgeAxis(ti->tile);
- piece = CalcBridgePiece(
+ Axis axis = GetBridgeAxis(ti->tile);
+ uint piece = CalcBridgePiece(
GetTunnelBridgeLength(ti->tile, rampnorth) + 1,
GetTunnelBridgeLength(ti->tile, rampsouth) + 1
);
- type = GetBridgeType(rampsouth);
+ const PalSpriteID *psid;
+ bool drawfarpillar;
if (transport_type != TRANSPORT_WATER) {
+ BridgeType type = GetBridgeType(rampsouth);
+ drawfarpillar = !HasBit(GetBridgeSpec(type)->flags, 0);
+
+ uint base_offset;
if (transport_type == TRANSPORT_RAIL) {
base_offset = GetRailTypeInfo(GetRailType(rampsouth))->bridge_offset;
} else {
@@ -1075,14 +1066,16 @@
psid = base_offset + GetBridgeSpriteTable(type, piece);
} else {
+ drawfarpillar = true;
psid = _aqueduct_sprites;
}
+
if (axis != AXIS_X) psid += 4;
- x = ti->x;
- y = ti->y;
+ int x = ti->x;
+ int y = ti->y;
uint bridge_z = GetBridgeHeight(rampsouth);
- z = bridge_z - BRIDGE_Z_START;
+ uint z = bridge_z - BRIDGE_Z_START;
/* Add a bounding box, that separates the bridge from things below it. */
AddSortableSpriteToDraw(SPR_EMPTY_BOUNDING_BOX, PAL_NONE, x, y, 16, 16, 1, bridge_z - TILE_HEIGHT + BB_Z_SEPARATOR);
@@ -1147,7 +1140,7 @@
}
} else if (_settings_client.gui.bridge_pillars) {
/* draw pillars below for high bridges */
- DrawBridgePillars(psid, ti, axis, type, x, y, z);
+ DrawBridgePillars(psid, ti, axis, drawfarpillar, x, y, z);
}
}
@@ -1204,11 +1197,12 @@
static void GetTileDesc_TunnelBridge(TileIndex tile, TileDesc *td)
{
+ TransportType tt = GetTunnelBridgeTransportType(tile);
+
if (IsTunnel(tile)) {
- td->str = (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL) ?
- STR_5017_RAILROAD_TUNNEL : STR_5018_ROAD_TUNNEL;
- } else { //so it must be a bridge
- td->str = GetBridgeSpec(GetBridgeType(tile))->transport_name[GetTunnelBridgeTransportType(tile)];
+ td->str = (tt == TRANSPORT_RAIL) ? STR_5017_RAILROAD_TUNNEL : STR_5018_ROAD_TUNNEL;
+ } else { // IsBridge(tile)
+ td->str = (tt == TRANSPORT_WATER) ? STR_AQUEDUCT : GetBridgeSpec(GetBridgeType(tile))->transport_name[tt];
}
td->owner[0] = GetTileOwner(tile);
}
@@ -1268,9 +1262,9 @@
if (CmdFailed(DoCommand(tile, 0, 0, DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR))) {
/* When clearing the bridge/tunnel failed there are still vehicles on/in
* the bridge/tunnel. As all *our* vehicles are already removed, they
- * must be of another owner. Therefor this must be a road bridge/tunnel.
+ * must be of another owner. Therefore this can't be rail tunnel/bridge.
* In that case we can safely reassign the ownership to OWNER_NONE. */
- assert(GetTunnelBridgeTransportType(tile) == TRANSPORT_ROAD);
+ assert(GetTunnelBridgeTransportType(tile) != TRANSPORT_RAIL);
SetTileOwner(tile, OWNER_NONE);
}
}
--- a/src/vehicle.cpp Fri Jun 13 13:07:31 2008 +0000
+++ b/src/vehicle.cpp Fri Jun 13 15:43:39 2008 +0000
@@ -207,7 +207,7 @@
/** Procedure called for every vehicle found in tunnel/bridge in the hash map */
static void *GetVehicleTunnelBridgeProc(Vehicle *v, void *data)
{
- if (v->type != VEH_TRAIN && v->type != VEH_ROAD) return NULL;
+ if (v->type != VEH_TRAIN && v->type != VEH_ROAD && v->type != VEH_SHIP) return NULL;
_error_message = VehicleInTheWayErrMsg(v);
return v;
--- a/src/viewport.cpp Fri Jun 13 13:07:31 2008 +0000
+++ b/src/viewport.cpp Fri Jun 13 15:43:39 2008 +0000
@@ -1870,7 +1870,7 @@
y < si->sign.top + 12 &&
x >= si->sign.left &&
x < si->sign.left + si->sign.width_1) {
- ShowRenameSignWindow(si);
+ HandleClickOnSign(si);
return true;
}
}
@@ -1884,7 +1884,7 @@
y < si->sign.top + 24 &&
x >= si->sign.left &&
x < si->sign.left + si->sign.width_1 * 2) {
- ShowRenameSignWindow(si);
+ HandleClickOnSign(si);
return true;
}
}
@@ -1900,7 +1900,7 @@
y < si->sign.top + ScaleByZoom(12, vp->zoom) &&
x >= si->sign.left &&
x < si->sign.left + ScaleByZoom(si->sign.width_2, vp->zoom)) {
- ShowRenameSignWindow(si);
+ HandleClickOnSign(si);
return true;
}
}
--- a/src/water_cmd.cpp Fri Jun 13 13:07:31 2008 +0000
+++ b/src/water_cmd.cpp Fri Jun 13 15:43:39 2008 +0000
@@ -483,13 +483,19 @@
{
switch (GetTileType(tile)) {
case MP_WATER:
- if (!IsCoast(tile)) return true;
- switch (GetTileSlope(tile, NULL)) {
- case SLOPE_W: return (from == DIR_SE) || (from == DIR_E) || (from == DIR_NE);
- case SLOPE_S: return (from == DIR_NE) || (from == DIR_N) || (from == DIR_NW);
- case SLOPE_E: return (from == DIR_NW) || (from == DIR_W) || (from == DIR_SW);
- case SLOPE_N: return (from == DIR_SW) || (from == DIR_S) || (from == DIR_SE);
- default: return false;
+ switch (GetWaterTileType(tile)) {
+ default: NOT_REACHED();
+ case WATER_TILE_DEPOT: case WATER_TILE_CLEAR: return true;
+ case WATER_TILE_LOCK: return DiagDirToAxis(GetLockDirection(tile)) == DiagDirToAxis(DirToDiagDir(from));
+
+ case WATER_TILE_COAST:
+ switch (GetTileSlope(tile, NULL)) {
+ case SLOPE_W: return (from == DIR_SE) || (from == DIR_E) || (from == DIR_NE);
+ case SLOPE_S: return (from == DIR_NE) || (from == DIR_N) || (from == DIR_NW);
+ case SLOPE_E: return (from == DIR_NW) || (from == DIR_W) || (from == DIR_SW);
+ case SLOPE_N: return (from == DIR_SW) || (from == DIR_S) || (from == DIR_SE);
+ default: return false;
+ }
}
case MP_RAILWAY:
@@ -507,7 +513,7 @@
case MP_STATION: return IsOilRig(tile) || (IsDock(tile) && GetTileSlope(tile, NULL) == SLOPE_FLAT) || IsBuoy(tile);
case MP_INDUSTRY: return (GetIndustrySpec(GetIndustryType(tile))->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0;
- case MP_TUNNELBRIDGE: return GetTunnelBridgeTransportType(tile) == TRANSPORT_WATER;
+ case MP_TUNNELBRIDGE: return GetTunnelBridgeTransportType(tile) == TRANSPORT_WATER && ReverseDiagDir(GetTunnelBridgeDirection(tile)) == DirToDiagDir(from);
default: return false;
}
}
--- a/src/window.cpp Fri Jun 13 13:07:31 2008 +0000
+++ b/src/window.cpp Fri Jun 13 15:43:39 2008 +0000
@@ -1809,7 +1809,6 @@
DecreaseWindowCounters();
HandlePlacePresize();
UpdateTileSelection();
- HandleKeyScrolling();
if (!VpHandlePlaceSizingDrag()) return;
if (!HandleDragDrop()) return;
@@ -1949,6 +1948,7 @@
*/
void InputLoop()
{
+ HandleKeyScrolling();
HandleMouseEvents();
HandleAutoscroll();
}