mirror of https://github.com/OpenTTD/OpenTTD
(svn r19222) [1.0] -Backport from trunk:
- Change: Improve error message with track building when signals are in the way (r19190, r19189) - Fix: GetDestination() is invalid for nearest-depot orders (r19210) - Fix: Compilation was broken for gcc 3.3 (r19207) - Fix: The vehicle info in the autoreplace gui was drawn even when the window was shaded [FS#3634] (r19187) - Fix: When selecting 'build many industries' in the scenario editor the 'build' button was not enabled [FS#3632] (r19176)release/1.0
parent
eb8263ce50
commit
5b188a4933
|
@ -382,20 +382,22 @@ public:
|
|||
|
||||
this->DrawWidgets();
|
||||
|
||||
int needed_height = this->details_height;
|
||||
/* Draw details panels. */
|
||||
for (int side = 0; side < 2; side++) {
|
||||
if (this->sel_engine[side] != INVALID_ENGINE) {
|
||||
NWidgetBase *nwi = this->GetWidget<NWidgetBase>(side == 0 ? RVW_WIDGET_LEFT_DETAILS : RVW_WIDGET_RIGHT_DETAILS);
|
||||
int text_end = DrawVehiclePurchaseInfo(nwi->pos_x + WD_FRAMETEXT_LEFT, nwi->pos_x + nwi->current_x - WD_FRAMETEXT_RIGHT,
|
||||
nwi->pos_y + WD_FRAMERECT_TOP, this->sel_engine[side]);
|
||||
needed_height = max(needed_height, text_end - (int)nwi->pos_y + WD_FRAMERECT_BOTTOM);
|
||||
if (!this->IsShaded()) {
|
||||
int needed_height = this->details_height;
|
||||
/* Draw details panels. */
|
||||
for (int side = 0; side < 2; side++) {
|
||||
if (this->sel_engine[side] != INVALID_ENGINE) {
|
||||
NWidgetBase *nwi = this->GetWidget<NWidgetBase>(side == 0 ? RVW_WIDGET_LEFT_DETAILS : RVW_WIDGET_RIGHT_DETAILS);
|
||||
int text_end = DrawVehiclePurchaseInfo(nwi->pos_x + WD_FRAMETEXT_LEFT, nwi->pos_x + nwi->current_x - WD_FRAMETEXT_RIGHT,
|
||||
nwi->pos_y + WD_FRAMERECT_TOP, this->sel_engine[side]);
|
||||
needed_height = max(needed_height, text_end - (int)nwi->pos_y + WD_FRAMERECT_BOTTOM);
|
||||
}
|
||||
}
|
||||
if (needed_height != this->details_height) { // Details window are not high enough, enlarge them.
|
||||
this->details_height = needed_height;
|
||||
this->ReInit();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!this->IsShaded() && needed_height != this->details_height) { // Details window are not high enough, enlarge them.
|
||||
this->details_height = needed_height;
|
||||
this->ReInit();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -155,6 +155,7 @@ class BuildIndustryWindow : public Window {
|
|||
|
||||
if (_game_mode == GM_EDITOR) { // give room for the Many Random "button"
|
||||
this->index[this->count] = INVALID_INDUSTRYTYPE;
|
||||
this->enabled[this->count] = true;
|
||||
this->count++;
|
||||
this->timer_enabled = false;
|
||||
}
|
||||
|
|
|
@ -561,7 +561,7 @@ STR_PERFORMANCE_DETAIL_MONEY :{BLACK}Money:
|
|||
STR_PERFORMANCE_DETAIL_LOAN :{BLACK}Loan:
|
||||
STR_PERFORMANCE_DETAIL_TOTAL :{BLACK}Total:
|
||||
############ End of order list
|
||||
STR_PERFORMANCE_DETAIL_VEHICLES_TOOLTIP :{BLACK}Number of vehicles that turned a profit last year; this includes road vehicles, trains, ships and aircraft
|
||||
STR_PERFORMANCE_DETAIL_VEHICLES_TOOLTIP :{BLACK}Number of vehicles that turned a profit last year. This includes road vehicles, trains, ships and aircraft
|
||||
STR_PERFORMANCE_DETAIL_STATIONS_TOOLTIP :{BLACK}Number of recently-serviced station parts. Every part of a station (e.g. train station, bus stop, airport) is counted, even if they are connected as one station
|
||||
STR_PERFORMANCE_DETAIL_MIN_PROFIT_TOOLTIP :{BLACK}The profit of the vehicle with the lowest income (only vehicles older than two years are considered)
|
||||
STR_PERFORMANCE_DETAIL_MIN_INCOME_TOOLTIP :{BLACK}Amount of cash made in the quarter with the lowest profit of the last 12 quarters
|
||||
|
@ -2378,7 +2378,7 @@ STR_NEWGRF_ERROR_READ_BOUNDS :Read past end o
|
|||
|
||||
# NewGRF related 'general' warnings
|
||||
STR_NEWGRF_POPUP_CAUTION_CAPTION :{WHITE}Caution!
|
||||
STR_NEWGRF_CONFIRMATION_TEXT :{YELLOW}You are about to make changes to a running game; this can crash OpenTTD.{}Are you absolutely sure about this?
|
||||
STR_NEWGRF_CONFIRMATION_TEXT :{YELLOW}You are about to make changes to a running game. This can crash OpenTTD.{}Are you absolutely sure about this?
|
||||
|
||||
STR_NEWGRF_DUPLICATE_GRFID :{WHITE}Can't add file: duplicate GRF ID
|
||||
STR_NEWGRF_COMPATIBLE_LOADED :{ORANGE}Matching file not found (compatible GRF loaded)
|
||||
|
@ -3474,6 +3474,7 @@ STR_ERROR_AUTOREPLACE_MONEY_LIMIT :(money limit)
|
|||
|
||||
# Rail construction errors
|
||||
STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION :{WHITE}Impossible track combination
|
||||
STR_ERROR_MUST_REMOVE_SIGNALS_FIRST :{WHITE}Must remove signals first
|
||||
STR_ERROR_NO_SUITABLE_RAILROAD_TRACK :{WHITE}No suitable railway track
|
||||
STR_ERROR_MUST_REMOVE_RAILROAD_TRACK :{WHITE}Must remove railway track first
|
||||
STR_ERROR_CROSSING_ON_ONEWAY_ROAD :{WHITE}Road is one way or blocked
|
||||
|
|
|
@ -126,7 +126,7 @@ struct CStrA : public CBlobT<char>
|
|||
}
|
||||
|
||||
/** Add formated string (like sprintf) at the end of existing contents. */
|
||||
int CDECL AddFormat(const char *format, ...) WARN_FORMAT(2, 3)
|
||||
int CDECL WARN_FORMAT(2, 3) AddFormat(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
@ -136,7 +136,7 @@ struct CStrA : public CBlobT<char>
|
|||
}
|
||||
|
||||
/** Assign formated string (like sprintf). */
|
||||
int CDECL Format(const char *format, ...) WARN_FORMAT(2, 3)
|
||||
int CDECL WARN_FORMAT(2, 3) Format(const char *format, ...)
|
||||
{
|
||||
base::Free();
|
||||
va_list args;
|
||||
|
|
|
@ -415,7 +415,9 @@ static TileIndex GetOrderLocation(const Order& o)
|
|||
default: NOT_REACHED();
|
||||
case OT_GOTO_WAYPOINT: return Waypoint::Get(o.GetDestination())->xy;
|
||||
case OT_GOTO_STATION: return Station::Get(o.GetDestination())->xy;
|
||||
case OT_GOTO_DEPOT: return Depot::Get(o.GetDestination())->xy;
|
||||
case OT_GOTO_DEPOT:
|
||||
if ((o.GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0) return INVALID_TILE;
|
||||
return Depot::Get(o.GetDestination())->xy;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -433,7 +435,10 @@ static uint GetOrderDistance(const Order *prev, const Order *cur, const Vehicle
|
|||
return max(dist1, dist2);
|
||||
}
|
||||
|
||||
return DistanceManhattan(GetOrderLocation(*prev), GetOrderLocation(*cur));
|
||||
TileIndex prev_tile = GetOrderLocation(*prev);
|
||||
TileIndex cur_tile = GetOrderLocation(*cur);
|
||||
if (prev_tile == INVALID_TILE || cur_tile == INVALID_TILE) return 0;
|
||||
return DistanceManhattan(prev_tile, cur_tile);
|
||||
}
|
||||
|
||||
/** Add an order to the orderlist of a vehicle.
|
||||
|
|
|
@ -172,11 +172,15 @@ static bool EnsureNoTrainOnTrack(TileIndex tile, Track track)
|
|||
return !HasVehicleOnPos(tile, &rail_bits, &EnsureNoTrainOnTrackProc);
|
||||
}
|
||||
|
||||
static bool CheckTrackCombination(TileIndex tile, TrackBits to_build, uint flags)
|
||||
/** Check that the new track bits may be built.
|
||||
* @param tile %Tile to build on.
|
||||
* @param to_build New track bits.
|
||||
* @param flags Flags of the operation.
|
||||
* @return Succeeded or failed command.
|
||||
*/
|
||||
static CommandCost CheckTrackCombination(TileIndex tile, TrackBits to_build, uint flags)
|
||||
{
|
||||
_error_message = STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION;
|
||||
|
||||
if (!IsPlainRail(tile)) return false;
|
||||
if (!IsPlainRail(tile)) return_cmd_error(STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION);
|
||||
|
||||
/* So, we have a tile with tracks on it (and possibly signals). Let's see
|
||||
* what tracks first */
|
||||
|
@ -186,19 +190,19 @@ static bool CheckTrackCombination(TileIndex tile, TrackBits to_build, uint flags
|
|||
/* Are we really building something new? */
|
||||
if (current == future) {
|
||||
/* Nothing new is being built */
|
||||
_error_message = STR_ERROR_ALREADY_BUILT;
|
||||
return false;
|
||||
return_cmd_error(STR_ERROR_ALREADY_BUILT);
|
||||
}
|
||||
|
||||
/* Let's see if we may build this */
|
||||
if ((flags & DC_NO_RAIL_OVERLAP) || HasSignals(tile)) {
|
||||
/* If we are not allowed to overlap (flag is on for ai companies or we have
|
||||
* signals on the tile), check that */
|
||||
return future == TRACK_BIT_HORZ || future == TRACK_BIT_VERT;
|
||||
} else {
|
||||
/* Normally, we may overlap and any combination is valid */
|
||||
return true;
|
||||
if (future != TRACK_BIT_HORZ && future != TRACK_BIT_VERT) {
|
||||
return_cmd_error((flags & DC_NO_RAIL_OVERLAP) ? STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION : STR_ERROR_MUST_REMOVE_SIGNALS_FIRST);
|
||||
}
|
||||
}
|
||||
/* Normally, we may overlap and any combination is valid */
|
||||
return CommandCost();
|
||||
}
|
||||
|
||||
|
||||
|
@ -382,12 +386,13 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
|||
|
||||
if (!IsCompatibleRail(GetRailType(tile), railtype)) return_cmd_error(STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION);
|
||||
|
||||
if (!CheckTrackCombination(tile, trackbit, flags) ||
|
||||
!EnsureNoTrainOnTrack(tile, track)) {
|
||||
return CMD_ERROR;
|
||||
}
|
||||
CommandCost ret = CheckTrackCombination(tile, trackbit, flags);
|
||||
ret.SetGlobalErrorMessage();
|
||||
if (ret.Failed()) return ret;
|
||||
|
||||
CommandCost ret = CheckRailSlope(tileh, trackbit, GetTrackBits(tile), tile);
|
||||
if (!EnsureNoTrainOnTrack(tile, track)) return CMD_ERROR;
|
||||
|
||||
ret = CheckRailSlope(tileh, trackbit, GetTrackBits(tile), tile);
|
||||
if (ret.Failed()) return ret;
|
||||
cost.AddCost(ret);
|
||||
|
||||
|
|
Loading…
Reference in New Issue