v15 released
This commit is contained in:
@@ -2382,6 +2382,7 @@ STR_ROAD_TOOLBAR_TRAM_CONSTRUCTION_CAPTION :{WHITE}Tramway
|
||||
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_SECTION :{BLACK}Build road section. Ctrl toggles build/remove for road construction. Shift toggles building/showing cost estimate
|
||||
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAMWAY_SECTION :{BLACK}Build tramway section. Ctrl toggles build/remove for tramway construction. Shift toggles building/showing cost estimate
|
||||
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_AUTOROAD :{BLACK}Build road section using the Autoroad mode. Ctrl toggles build/remove for road construction. Shift toggles building/showing cost estimate
|
||||
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_FULLROAD :{BLACK}Build road section using the Autoroad mode with only full tile roads. Ctrl toggles build/remove for road construction. Shift toggles building/showing cost estimate
|
||||
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_AUTOTRAM :{BLACK}Build tramway section using the Autotram mode. Ctrl toggles build/remove for tramway construction. Shift toggles building/showing cost estimate
|
||||
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_VEHICLE_DEPOT :{BLACK}Build road vehicle depot (for buying and servicing vehicles). Shift toggles building/showing cost estimate
|
||||
STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAM_VEHICLE_DEPOT :{BLACK}Build tram vehicle depot (for buying and servicing vehicles). Shift toggles building/showing cost estimate
|
||||
@@ -5043,8 +5044,8 @@ STR_TOWN_DIRECTORY_TOWN_COLOUR :{TOWN}{BLACK} (
|
||||
STR_OLD_DEPOT_TRAINT_LENGTH :Old depot length format: {STRING2}
|
||||
STR_TOWN_DIRECTORY_CAPTION_EXTRA :{WHITE}Towns ({YELLOW}{COMMA}{WHITE} / {ORANGE}{COMMA}{WHITE})
|
||||
STR_SMALLMAP_TOWN_LARGE :{TINY_FONT}{YELLOW}{TOWN}
|
||||
STR_TOWN_VIEW_TOWN_CAPTION_EXTRA :{WHITE}{TOWN} [{COMMA}]
|
||||
STR_TOWN_VIEW_CITY_CAPTION_EXTRA :{WHITE}{TOWN} (City) [{COMMA}]
|
||||
STR_TOWN_VIEW_TOWN_CAPTION_EXTRA :{WHITE}{TOWN} {COMMA} [{COMMA}]
|
||||
STR_TOWN_VIEW_CITY_CAPTION_EXTRA :{WHITE}{TOWN} (City) {COMMA} [{COMMA}]
|
||||
|
||||
STR_ORDER_DIST :{NUM}, {NUM}
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ enum {
|
||||
GHK_QUIT,
|
||||
GHK_ABANDON,
|
||||
GHK_CONSOLE,
|
||||
GHK_BOUNDING_BOXES,
|
||||
GHK_BOUNDING_BOXES,
|
||||
GHK_DIRTY_BLOCKS,
|
||||
GHK_CENTER,
|
||||
GHK_CENTER_ZOOM,
|
||||
@@ -225,6 +225,7 @@ enum {
|
||||
GHK_TOGGLE_INVISIBILITY = GHK_TOGGLE_TRANSPARENCY + 9,
|
||||
GHK_TRANSPARENCY_TOOLBAR = GHK_TOGGLE_INVISIBILITY + 8,
|
||||
GHK_TRANSPARANCY,
|
||||
GHK_BORROW_ALL,
|
||||
GHK_CHAT,
|
||||
GHK_CHAT_ALL,
|
||||
GHK_CHAT_COMPANY,
|
||||
@@ -391,6 +392,10 @@ struct MainWindow : Window
|
||||
ResetRestoreAllTransparency();
|
||||
break;
|
||||
|
||||
case GHK_BORROW_ALL:
|
||||
DoCommandP(0, 0, 1, CMD_INCREASE_LOAN | CMD_MSG(STR_ERROR_CAN_T_BORROW_ANY_MORE_MONEY));
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
case GHK_CHAT: // smart chat; send to team if any, otherwise to all
|
||||
if (_networking) {
|
||||
@@ -509,6 +514,7 @@ static Hotkey global_hotkeys[] = {
|
||||
Hotkey('8' | WKC_CTRL | WKC_SHIFT, "invisibility_catenary", GHK_TOGGLE_INVISIBILITY + 7),
|
||||
Hotkey('X' | WKC_CTRL, "transparency_toolbar", GHK_TRANSPARENCY_TOOLBAR),
|
||||
Hotkey('X', "toggle_transparency", GHK_TRANSPARANCY),
|
||||
Hotkey(WKC_NONE, "borrow_all", GHK_BORROW_ALL),
|
||||
#ifdef ENABLE_NETWORK
|
||||
Hotkey(_ghk_chat_keys, "chat", GHK_CHAT),
|
||||
Hotkey(_ghk_chat_all_keys, "chat_all", GHK_CHAT_ALL),
|
||||
|
||||
@@ -294,7 +294,7 @@ static bool RoadToolbar_CtrlChanged(Window *w)
|
||||
if (w->IsWidgetDisabled(WID_ROT_REMOVE)) return false;
|
||||
|
||||
/* allow ctrl to switch remove mode only for these widgets */
|
||||
for (uint i = WID_ROT_ROAD_X; i <= WID_ROT_AUTOROAD; i++) {
|
||||
for (uint i = WID_ROT_ROAD_X; i <= WID_ROT_FULLROAD; i++) {
|
||||
if (w->IsWidgetLowered(i)) {
|
||||
ToggleRoadButton_Remove(w);
|
||||
return true;
|
||||
@@ -372,6 +372,7 @@ struct BuildRoadToolbarWindow : Window {
|
||||
case WID_ROT_ROAD_X:
|
||||
case WID_ROT_ROAD_Y:
|
||||
case WID_ROT_AUTOROAD:
|
||||
case WID_ROT_FULLROAD:
|
||||
this->SetWidgetsDisabledState(!this->IsWidgetLowered(clicked_widget),
|
||||
WID_ROT_REMOVE,
|
||||
WID_ROT_ONE_WAY,
|
||||
@@ -393,6 +394,16 @@ struct BuildRoadToolbarWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void DrawWidget(const Rect &r, int widget) const
|
||||
{
|
||||
if (widget == WID_ROT_FULLROAD) {
|
||||
Dimension d = GetSpriteSize(SPR_BLOT);
|
||||
uint offset = this->IsWidgetLowered(WID_ROT_FULLROAD) ? 1 : 0;
|
||||
DrawSprite(SPR_BLOT, PALETTE_TO_GREY, (r.left + r.right - d.width) / 2 + offset, (r.top + r.bottom - d.height) / 2 + offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual void OnClick(Point pt, int widget, int click_count)
|
||||
{
|
||||
_remove_button_clicked = false;
|
||||
@@ -413,6 +424,11 @@ struct BuildRoadToolbarWindow : Window {
|
||||
this->last_started_action = widget;
|
||||
break;
|
||||
|
||||
case WID_ROT_FULLROAD:
|
||||
HandlePlacePushButton(this, WID_ROT_FULLROAD, _road_type_infos[_cur_roadtype].cursor_autoroad, HT_RECT);
|
||||
this->last_started_action = widget;
|
||||
break;
|
||||
|
||||
case WID_ROT_DEMOLISH:
|
||||
HandlePlacePushButton(this, WID_ROT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
|
||||
this->last_started_action = widget;
|
||||
@@ -503,6 +519,11 @@ struct BuildRoadToolbarWindow : Window {
|
||||
VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_PLACE_AUTOROAD);
|
||||
break;
|
||||
|
||||
case WID_ROT_FULLROAD:
|
||||
_place_road_flag = RF_NONE;
|
||||
VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_PLACE_FULLROAD);
|
||||
break;
|
||||
|
||||
case WID_ROT_DEMOLISH:
|
||||
PlaceProc_DemolishArea(tile);
|
||||
break;
|
||||
@@ -586,6 +607,21 @@ struct BuildRoadToolbarWindow : Window {
|
||||
|
||||
break;
|
||||
|
||||
case DDSP_PLACE_FULLROAD:
|
||||
/* For autoroad we need to update the
|
||||
* direction of the road */
|
||||
if (_thd.size.x > _thd.size.y || (_thd.size.x == _thd.size.y &&
|
||||
( (_tile_fract_coords.x < _tile_fract_coords.y && (_tile_fract_coords.x + _tile_fract_coords.y) < 16) ||
|
||||
(_tile_fract_coords.x > _tile_fract_coords.y && (_tile_fract_coords.x + _tile_fract_coords.y) > 16) ))) {
|
||||
/* Set dir = X */
|
||||
_place_road_flag &= ~RF_DIR_Y;
|
||||
} else {
|
||||
/* Set dir = Y */
|
||||
_place_road_flag |= RF_DIR_Y;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -622,6 +658,16 @@ struct BuildRoadToolbarWindow : Window {
|
||||
CMD_BUILD_LONG_ROAD | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_road), CcPlaySound1D);
|
||||
break;
|
||||
|
||||
case DDSP_PLACE_FULLROAD:
|
||||
DoCommandP(start_tile, end_tile,
|
||||
_place_road_flag | (_cur_roadtype << 3) |
|
||||
(_one_way_button_clicked << 5) | (1 << 6) |
|
||||
(start_tile > end_tile ? 1 : 2), // always build full roads
|
||||
_remove_button_clicked ?
|
||||
CMD_REMOVE_LONG_ROAD | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_road) :
|
||||
CMD_BUILD_LONG_ROAD | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_road), CcPlaySound1D);
|
||||
break;
|
||||
|
||||
case DDSP_BUILD_BUSSTOP:
|
||||
PlaceRoadStop(start_tile, end_tile, (_ctrl_pressed << 5) | RoadTypeToRoadTypes(_cur_roadtype) << 2 | ROADSTOP_BUS, CMD_BUILD_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_station[ROADSTOP_BUS]));
|
||||
break;
|
||||
@@ -691,11 +737,12 @@ static Hotkey roadtoolbar_hotkeys[] = {
|
||||
Hotkey('1', "build_x", WID_ROT_ROAD_X),
|
||||
Hotkey('2', "build_y", WID_ROT_ROAD_Y),
|
||||
Hotkey('3', "autoroad", WID_ROT_AUTOROAD),
|
||||
Hotkey('4', "demolish", WID_ROT_DEMOLISH),
|
||||
Hotkey('5', "depot", WID_ROT_DEPOT),
|
||||
Hotkey('6', "bus_station", WID_ROT_BUS_STATION),
|
||||
Hotkey('7', "truck_station", WID_ROT_TRUCK_STATION),
|
||||
Hotkey('8', "oneway", WID_ROT_ONE_WAY),
|
||||
Hotkey('4', "fullroad", WID_ROT_FULLROAD),
|
||||
Hotkey('5', "demolish", WID_ROT_DEMOLISH),
|
||||
Hotkey('6', "depot", WID_ROT_DEPOT),
|
||||
Hotkey('7', "bus_station", WID_ROT_BUS_STATION),
|
||||
Hotkey('8', "truck_station", WID_ROT_TRUCK_STATION),
|
||||
Hotkey('9', "oneway", WID_ROT_ONE_WAY),
|
||||
Hotkey('B', "bridge", WID_ROT_BUILD_BRIDGE),
|
||||
Hotkey('T', "tunnel", WID_ROT_BUILD_TUNNEL),
|
||||
Hotkey('R', "remove", WID_ROT_REMOVE),
|
||||
@@ -717,6 +764,8 @@ static const NWidgetPart _nested_build_road_widgets[] = {
|
||||
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_Y_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_SECTION),
|
||||
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_AUTOROAD),
|
||||
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AUTOROAD, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_AUTOROAD),
|
||||
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_FULLROAD),
|
||||
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AUTOROAD, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_FULLROAD),
|
||||
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_DEMOLISH),
|
||||
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
|
||||
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_ROT_DEPOT),
|
||||
|
||||
@@ -30,6 +30,7 @@ void RebuildTownCaches()
|
||||
FOR_ALL_TOWNS(town) {
|
||||
town->cache.population = 0;
|
||||
town->cache.num_houses = 0;
|
||||
town->cache.potential_pop = 0;
|
||||
}
|
||||
|
||||
for (TileIndex t = 0; t < MapSize(); t++) {
|
||||
@@ -39,6 +40,7 @@ void RebuildTownCaches()
|
||||
town = Town::GetByTile(t);
|
||||
IncreaseBuildingCount(town, house_id);
|
||||
if (IsHouseCompleted(t)) town->cache.population += HouseSpec::Get(house_id)->population;
|
||||
town->cache.potential_pop += HouseSpec::Get(house_id)->population;
|
||||
|
||||
/* Increase the number of houses for every house, but only once. */
|
||||
if (GetHouseNorthPart(house_id) == 0) town->cache.num_houses++;
|
||||
|
||||
@@ -49,6 +49,7 @@ extern TownPool _town_pool;
|
||||
struct TownCache {
|
||||
uint32 num_houses; ///< Amount of houses
|
||||
uint32 population; ///< Current population of people
|
||||
uint32 potential_pop; ///< Potential population (if all houses are finished)
|
||||
ViewportSign sign; ///< Location of name sign, UpdateVirtCoord updates this
|
||||
PartOfSubsidyByte part_of_subsidy; ///< Is this town a source/destination of a subsidy?
|
||||
uint32 squared_town_zone_radius[HZB_END]; ///< UpdateTownRadius updates this given the house count
|
||||
|
||||
@@ -2487,6 +2487,7 @@ static bool BuildTownHouse(Town *t, TileIndex tile)
|
||||
|
||||
/* build the house */
|
||||
t->cache.num_houses++;
|
||||
t->cache.potential_pop += hs->population;
|
||||
|
||||
/* Special houses that there can be only one of. */
|
||||
t->flags |= oneof;
|
||||
@@ -2578,6 +2579,7 @@ void ClearTownHouse(Town *t, TileIndex tile)
|
||||
}
|
||||
|
||||
t->cache.num_houses--;
|
||||
t->cache.potential_pop -= hs->population;
|
||||
|
||||
/* Clear flags for houses that only may exist once/town. */
|
||||
if (hs->building_flags & BUILDING_IS_CHURCH) {
|
||||
|
||||
@@ -45,7 +45,7 @@ struct CargoX {
|
||||
};
|
||||
void ShowCBTownWindow(uint town);
|
||||
|
||||
void TownExecuteHotkeyAction(TileIndex tile, int townid, uint action){
|
||||
void TownExecuteHotkeyAction(TileIndex tile, int townid, uint action) {
|
||||
DoCommandP(tile, townid, action, CMD_DO_TOWN_ACTION | CMD_MSG(STR_ERROR_CAN_T_DO_THIS));
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ public:
|
||||
virtual EventState OnHotkey(int hotkey)
|
||||
{
|
||||
TownExecuteHotkeyAction(this->town->xy, this->window_number, hotkey);
|
||||
return ES_NOT_HANDLED;
|
||||
return ES_HANDLED;
|
||||
}
|
||||
|
||||
static HotkeyList hotkeys;
|
||||
@@ -354,7 +354,8 @@ public:
|
||||
{
|
||||
if (widget == WID_TV_CAPTION){
|
||||
SetDParam(0, this->town->index);
|
||||
SetDParam(1, this->town->ratings[_current_company]);
|
||||
SetDParam(1, this->town->cache.potential_pop);
|
||||
SetDParam(2, this->town->ratings[_current_company]);
|
||||
}
|
||||
if (widget == WID_TV_CB){
|
||||
extern bool _novahost;
|
||||
@@ -594,7 +595,7 @@ public:
|
||||
virtual EventState OnHotkey(int hotkey)
|
||||
{
|
||||
TownExecuteHotkeyAction(this->town->xy, this->window_number, hotkey);
|
||||
return ES_NOT_HANDLED;
|
||||
return ES_HANDLED;
|
||||
}
|
||||
|
||||
static HotkeyList hotkeys;
|
||||
@@ -1506,7 +1507,7 @@ public:
|
||||
virtual EventState OnHotkey(int hotkey)
|
||||
{
|
||||
TownExecuteHotkeyAction(this->town->xy, this->window_number, hotkey);
|
||||
return ES_NOT_HANDLED;
|
||||
return ES_HANDLED;
|
||||
}
|
||||
|
||||
static HotkeyList hotkeys;
|
||||
|
||||
@@ -1981,11 +1981,11 @@ bool HandleViewportClicked(const ViewPort *vp, int x, int y, bool double_click)
|
||||
}
|
||||
|
||||
/* Double-clicking finishes current polyline and starts new one. */
|
||||
if (double_click && (_thd.place_mode & HT_POLY)) {
|
||||
/* if (double_click && (_thd.place_mode & HT_POLY)) {
|
||||
ClearRailPlacementEndpoints();
|
||||
SetTileSelectSize(1, 1);
|
||||
return true;
|
||||
}
|
||||
} */
|
||||
|
||||
/* Vehicle placement mode already handled above. */
|
||||
if ((_thd.place_mode & HT_DRAG_MASK) != HT_NONE) {
|
||||
|
||||
@@ -116,6 +116,7 @@ enum ViewportDragDropSelectionProcess {
|
||||
DDSP_PLACE_ROAD_X_DIR, ///< Road placement (X axis)
|
||||
DDSP_PLACE_ROAD_Y_DIR, ///< Road placement (Y axis)
|
||||
DDSP_PLACE_AUTOROAD, ///< Road placement (auto)
|
||||
DDSP_PLACE_FULLROAD, ///< Road placement (auto, full roads)
|
||||
DDSP_BUILD_BUSSTOP, ///< Road stop placement (buses)
|
||||
DDSP_BUILD_TRUCKSTOP, ///< Road stop placement (trucks)
|
||||
DDSP_REMOVE_BUSSTOP, ///< Road stop removal (buses)
|
||||
|
||||
@@ -17,7 +17,8 @@ enum RoadToolbarWidgets {
|
||||
/* Name starts with RO instead of R, because of collision with RailToolbarWidgets */
|
||||
WID_ROT_ROAD_X, ///< Build road in x-direction.
|
||||
WID_ROT_ROAD_Y, ///< Build road in y-direction.
|
||||
WID_ROT_AUTOROAD, ///< Autorail.
|
||||
WID_ROT_AUTOROAD, ///< Autoroad.
|
||||
WID_ROT_FULLROAD, ///< Auto full road (no half-tiles).
|
||||
WID_ROT_DEMOLISH, ///< Demolish.
|
||||
WID_ROT_DEPOT, ///< Build depot.
|
||||
WID_ROT_BUS_STATION, ///< Build bus station.
|
||||
|
||||
3443
src/window.cpp.orig
3443
src/window.cpp.orig
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user