mirror of https://github.com/OpenTTD/OpenTTD
Compare commits
1 Commits
2f1a3ecd5a
...
f12b90f3cd
Author | SHA1 | Date |
---|---|---|
|
f12b90f3cd |
49
src/gfx.cpp
49
src/gfx.cpp
|
@ -523,9 +523,10 @@ static int DrawLayoutLine(const ParagraphLayouter::Line &line, int y, int left,
|
|||
int max_x = right; // The maximum x position to draw normal glyphs on.
|
||||
|
||||
truncation &= max_w < w; // Whether we need to do truncation.
|
||||
int truncation_width = 0; // Width of the ellipsis string.
|
||||
int dot_width = 0; // Cache for the width of the dot.
|
||||
const Sprite *dot_sprite = nullptr; // Cache for the sprite of the dot.
|
||||
bool dot_has_shadow = false; // Whether the dot's font requires shadows.
|
||||
|
||||
std::optional<Layouter> truncation_layout; ///< Layout for truncation ellipsis.
|
||||
if (truncation) {
|
||||
/*
|
||||
* Assumption may be made that all fonts of a run are of the same size.
|
||||
|
@ -533,17 +534,20 @@ static int DrawLayoutLine(const ParagraphLayouter::Line &line, int y, int left,
|
|||
* another size would be chosen it won't have truncated too little for
|
||||
* the truncation dots.
|
||||
*/
|
||||
truncation_layout.emplace(GetEllipsis(), INT32_MAX, line.GetVisualRun(0).GetFont()->fc->GetSize());
|
||||
truncation_width = truncation_layout->GetBounds().width;
|
||||
FontCache *fc = line.GetVisualRun(0).GetFont()->fc;
|
||||
dot_has_shadow = fc->GetDrawGlyphShadow();
|
||||
GlyphID dot_glyph = fc->MapCharToGlyph('.');
|
||||
dot_width = fc->GetGlyphWidth(dot_glyph);
|
||||
dot_sprite = fc->GetGlyph(dot_glyph);
|
||||
|
||||
/* Is there enough space even for an ellipsis? */
|
||||
if (max_w < truncation_width) return (_current_text_dir == TD_RTL) ? left : right;
|
||||
if (max_w < dot_width * 3) return (_current_text_dir == TD_RTL) ? left : right;
|
||||
|
||||
if (_current_text_dir == TD_RTL) {
|
||||
min_x += truncation_width;
|
||||
min_x += 3 * dot_width;
|
||||
offset_x = w - max_w;
|
||||
} else {
|
||||
max_x -= truncation_width;
|
||||
max_x -= 3 * dot_width;
|
||||
}
|
||||
|
||||
w = max_w;
|
||||
|
@ -579,11 +583,9 @@ static int DrawLayoutLine(const ParagraphLayouter::Line &line, int y, int left,
|
|||
|
||||
const uint shadow_offset = ScaleGUITrad(1);
|
||||
|
||||
auto draw_line = [&](const ParagraphLayouter::Line &line, bool do_shadow, int left, int min_x, int max_x, bool truncation) {
|
||||
const DrawPixelInfo *dpi = _cur_dpi;
|
||||
int dpi_left = dpi->left;
|
||||
int dpi_right = dpi->left + dpi->width - 1;
|
||||
|
||||
/* Draw shadow, then foreground */
|
||||
for (bool do_shadow : { true, false }) {
|
||||
bool colour_has_shadow = false;
|
||||
for (int run_index = 0; run_index < line.CountRuns(); run_index++) {
|
||||
const ParagraphLayouter::VisualRun &run = line.GetVisualRun(run_index);
|
||||
const auto &glyphs = run.GetGlyphs();
|
||||
|
@ -593,18 +595,22 @@ static int DrawLayoutLine(const ParagraphLayouter::Line &line, int y, int left,
|
|||
FontCache *fc = f->fc;
|
||||
TextColour colour = f->colour;
|
||||
if (colour == TC_INVALID || HasFlag(default_colour, TC_FORCED)) colour = default_colour;
|
||||
bool colour_has_shadow = (colour & TC_NO_SHADE) == 0 && colour != TC_BLACK;
|
||||
colour_has_shadow = (colour & TC_NO_SHADE) == 0 && colour != TC_BLACK;
|
||||
SetColourRemap(do_shadow ? TC_BLACK : colour); // the last run also sets the colour for the truncation dots
|
||||
if (do_shadow && (!fc->GetDrawGlyphShadow() || !colour_has_shadow)) continue;
|
||||
|
||||
DrawPixelInfo *dpi = _cur_dpi;
|
||||
int dpi_left = dpi->left;
|
||||
int dpi_right = dpi->left + dpi->width - 1;
|
||||
|
||||
for (int i = 0; i < run.GetGlyphCount(); i++) {
|
||||
GlyphID glyph = glyphs[i];
|
||||
|
||||
/* Not a valid glyph (empty) */
|
||||
if (glyph == 0xFFFF) continue;
|
||||
|
||||
int begin_x = positions[i].left + left;
|
||||
int end_x = positions[i].right + left;
|
||||
int begin_x = positions[i].left + left - offset_x;
|
||||
int end_x = positions[i].right + left - offset_x;
|
||||
int top = positions[i].top + y;
|
||||
|
||||
/* Truncated away. */
|
||||
|
@ -619,15 +625,12 @@ static int DrawLayoutLine(const ParagraphLayouter::Line &line, int y, int left,
|
|||
GfxMainBlitter(sprite, begin_x + (do_shadow ? shadow_offset : 0), top + (do_shadow ? shadow_offset : 0), BlitterMode::ColourRemap);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* Draw shadow, then foreground */
|
||||
for (bool do_shadow : {true, false}) {
|
||||
draw_line(line, do_shadow, left - offset_x, min_x, max_x, truncation);
|
||||
|
||||
if (truncation) {
|
||||
int x = (_current_text_dir == TD_RTL) ? left : (right - truncation_width);
|
||||
draw_line(*truncation_layout->front(), do_shadow, x, INT32_MIN, INT32_MAX, false);
|
||||
if (truncation && (!do_shadow || (dot_has_shadow && colour_has_shadow))) {
|
||||
int x = (_current_text_dir == TD_RTL) ? left : (right - 3 * dot_width);
|
||||
for (int i = 0; i < 3; i++, x += dot_width) {
|
||||
GfxMainBlitter(dot_sprite, x + (do_shadow ? shadow_offset : 0), y + (do_shadow ? shadow_offset : 0), BlitterMode::ColourRemap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -88,12 +88,12 @@ void UndrawMouseCursor();
|
|||
void RedrawScreenRect(int left, int top, int right, int bottom);
|
||||
void GfxScroll(int left, int top, int width, int height, int xo, int yo);
|
||||
|
||||
Dimension GetSpriteSize(SpriteID sprid, Point *offset = nullptr, ZoomLevel zoom = _gui_zoom);
|
||||
Dimension GetSpriteSize(SpriteID sprid, Point *offset = nullptr, ZoomLevel zoom = ZOOM_LVL_GUI);
|
||||
Dimension GetScaledSpriteSize(SpriteID sprid); /* widget.cpp */
|
||||
void DrawSpriteViewport(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub = nullptr);
|
||||
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub = nullptr, ZoomLevel zoom = _gui_zoom);
|
||||
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub = nullptr, ZoomLevel zoom = ZOOM_LVL_GUI);
|
||||
void DrawSpriteIgnorePadding(SpriteID img, PaletteID pal, const Rect &r, StringAlignment align); /* widget.cpp */
|
||||
std::unique_ptr<uint32_t[]> DrawSpriteToRgbaBuffer(SpriteID spriteId, ZoomLevel zoom = _gui_zoom);
|
||||
std::unique_ptr<uint32_t[]> DrawSpriteToRgbaBuffer(SpriteID spriteId, ZoomLevel zoom = ZOOM_LVL_GUI);
|
||||
|
||||
int DrawString(int left, int right, int top, std::string_view str, TextColour colour = TC_FROMSTRING, StringAlignment align = SA_LEFT, bool underline = false, FontSize fontsize = FS_NORMAL);
|
||||
int DrawString(int left, int right, int top, StringID str, TextColour colour = TC_FROMSTRING, StringAlignment align = SA_LEFT, bool underline = false, FontSize fontsize = FS_NORMAL);
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
/** @file graph_gui.cpp GUI that shows performance graphs. */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "misc/history_func.hpp"
|
||||
#include "graph_gui.h"
|
||||
#include "window_gui.h"
|
||||
#include "company_base.h"
|
||||
|
@ -216,15 +215,6 @@ protected:
|
|||
uint8_t highlight_range = UINT8_MAX; ///< Data range that should be highlighted, or UINT8_MAX for none.
|
||||
bool highlight_state = false; ///< Current state of highlight, toggled every TIMER_BLINK_INTERVAL period.
|
||||
|
||||
template <typename Tprojection>
|
||||
struct Filler {
|
||||
DataSet &dataset; ///< Dataset to fill.
|
||||
const Tprojection &proj; ///< Projection to apply.
|
||||
|
||||
inline void Fill(uint i, const auto &data) const { this->dataset.values[i] = std::invoke(this->proj, data); }
|
||||
inline void MakeInvalid(uint i) const { this->dataset.values[i] = INVALID_DATAPOINT; }
|
||||
};
|
||||
|
||||
/**
|
||||
* Get appropriate part of dataset values for the current number of horizontal points.
|
||||
* @param dataset Dataset to get values of
|
||||
|
@ -388,9 +378,7 @@ protected:
|
|||
/* Draw the background of the graph itself. */
|
||||
GfxFillRect(r.left, r.top, r.right, r.bottom, GRAPH_BASE_COLOUR);
|
||||
|
||||
/* Draw the grid lines. */
|
||||
int gridline_width = WidgetDimensions::scaled.bevel.top;
|
||||
int grid_colour = GRAPH_GRID_COLOUR;
|
||||
/* Draw the vertical grid lines. */
|
||||
|
||||
/* Don't draw the first line, as that's where the axis will be. */
|
||||
if (rtl) {
|
||||
|
@ -400,12 +388,13 @@ protected:
|
|||
x = r.left + x_sep;
|
||||
}
|
||||
|
||||
int grid_colour = GRAPH_GRID_COLOUR;
|
||||
for (int i = 1; i < this->num_vert_lines + 1; i++) {
|
||||
/* If using wallclock units, we separate periods with a lighter line. */
|
||||
if (TimerGameEconomy::UsingWallclockUnits()) {
|
||||
grid_colour = (i % 4 == 0) ? GRAPH_YEAR_LINE_COLOUR : GRAPH_GRID_COLOUR;
|
||||
}
|
||||
GfxFillRect(x, r.top, x + gridline_width - 1, r.bottom, grid_colour);
|
||||
GfxFillRect(x, r.top, x, r.bottom, grid_colour);
|
||||
x += x_sep;
|
||||
}
|
||||
|
||||
|
@ -414,20 +403,20 @@ protected:
|
|||
|
||||
for (int i = 0; i < (num_hori_lines + 1); i++) {
|
||||
if (rtl) {
|
||||
GfxFillRect(r.right + 1, y, r.right + ScaleGUITrad(3), y + gridline_width - 1, GRAPH_AXIS_LINE_COLOUR);
|
||||
GfxFillRect(r.right + 1, y, r.right + ScaleGUITrad(3), y, GRAPH_AXIS_LINE_COLOUR);
|
||||
} else {
|
||||
GfxFillRect(r.left - ScaleGUITrad(3), y, r.left - 1, y + gridline_width - 1, GRAPH_AXIS_LINE_COLOUR);
|
||||
GfxFillRect(r.left - ScaleGUITrad(3), y, r.left - 1, y, GRAPH_AXIS_LINE_COLOUR);
|
||||
}
|
||||
GfxFillRect(r.left, y, r.right + gridline_width - 1, y + gridline_width - 1, GRAPH_GRID_COLOUR);
|
||||
GfxFillRect(r.left, y, r.right, y, GRAPH_GRID_COLOUR);
|
||||
y -= y_sep;
|
||||
}
|
||||
|
||||
/* Draw the y axis. */
|
||||
GfxFillRect(r.left, r.top, r.left + gridline_width - 1, r.bottom + gridline_width - 1, GRAPH_AXIS_LINE_COLOUR);
|
||||
GfxFillRect(r.left, r.top, r.left, r.bottom, GRAPH_AXIS_LINE_COLOUR);
|
||||
|
||||
/* Draw the x axis. */
|
||||
y = x_axis_offset + r.top;
|
||||
GfxFillRect(r.left, y, r.right + gridline_width - 1, y + gridline_width - 1, GRAPH_ZERO_LINE_COLOUR);
|
||||
GfxFillRect(r.left, y, r.right, y, GRAPH_ZERO_LINE_COLOUR);
|
||||
|
||||
/* Find the largest value that will be drawn. */
|
||||
if (this->num_on_x_axis == 0) return;
|
||||
|
@ -482,7 +471,7 @@ protected:
|
|||
year++;
|
||||
|
||||
/* Draw a lighter grid line between years. Top and bottom adjustments ensure we don't draw over top and bottom horizontal grid lines. */
|
||||
GfxFillRect(x + x_sep, r.top + gridline_width, x + x_sep + gridline_width - 1, r.bottom - 1, GRAPH_YEAR_LINE_COLOUR);
|
||||
GfxFillRect(x + x_sep, r.top + 1, x + x_sep, r.bottom - 1, GRAPH_YEAR_LINE_COLOUR);
|
||||
}
|
||||
x += x_sep;
|
||||
}
|
||||
|
@ -510,11 +499,10 @@ protected:
|
|||
}
|
||||
}
|
||||
|
||||
/* Draw lines and dots. */
|
||||
uint linewidth = ScaleGUITrad(_settings_client.gui.graph_line_thickness);
|
||||
uint pointwidth = ScaleGUITrad(_settings_client.gui.graph_line_thickness + 1);
|
||||
uint pointoffs1 = pointwidth / 2;
|
||||
uint pointoffs2 = pointwidth - pointoffs1;
|
||||
/* draw lines and dots */
|
||||
uint linewidth = _settings_client.gui.graph_line_thickness;
|
||||
uint pointoffs1 = (linewidth + 1) / 2;
|
||||
uint pointoffs2 = linewidth + 1 - pointoffs1;
|
||||
|
||||
auto draw_dataset = [&](const DataSet &dataset, uint8_t colour) {
|
||||
if (HasBit(this->excluded_data, dataset.exclude_bit)) return;
|
||||
|
@ -1673,22 +1661,24 @@ struct IndustryProductionGraphWindow : BaseCargoGraphWindow {
|
|||
if (!IsValidCargoType(p.cargo)) continue;
|
||||
const CargoSpec *cs = CargoSpec::Get(p.cargo);
|
||||
|
||||
this->data.reserve(this->data.size() + 2);
|
||||
|
||||
DataSet &produced = this->data.emplace_back();
|
||||
produced.colour = cs->legend_colour;
|
||||
produced.exclude_bit = cs->Index();
|
||||
produced.range_bit = 0;
|
||||
auto produced_filler = Filler{produced, &Industry::ProducedHistory::production};
|
||||
|
||||
for (uint j = 0; j < GRAPH_NUM_MONTHS; j++) {
|
||||
produced.values[j] = p.history[GRAPH_NUM_MONTHS - j].production;
|
||||
}
|
||||
|
||||
DataSet &transported = this->data.emplace_back();
|
||||
transported.colour = cs->legend_colour;
|
||||
transported.exclude_bit = cs->Index();
|
||||
transported.range_bit = 1;
|
||||
transported.dash = 2;
|
||||
auto transported_filler = Filler{transported, &Industry::ProducedHistory::transported};
|
||||
|
||||
FillFromHistory<GRAPH_NUM_MONTHS>(p.history, i->valid_history, produced_filler, transported_filler);
|
||||
for (uint j = 0; j < GRAPH_NUM_MONTHS; j++) {
|
||||
transported.values[j] = p.history[GRAPH_NUM_MONTHS - j].transported;
|
||||
}
|
||||
}
|
||||
|
||||
this->SetDirty();
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#define INDUSTRY_H
|
||||
|
||||
#include "core/flatset_type.hpp"
|
||||
#include "misc/history_type.hpp"
|
||||
#include "newgrf_storage.h"
|
||||
#include "subsidy_type.h"
|
||||
#include "industry_map.h"
|
||||
|
@ -56,6 +55,9 @@ enum class IndustryControlFlag : uint8_t {
|
|||
};
|
||||
using IndustryControlFlags = EnumBitSet<IndustryControlFlag, uint8_t, IndustryControlFlag::End>;
|
||||
|
||||
static const int THIS_MONTH = 0;
|
||||
static const int LAST_MONTH = 1;
|
||||
|
||||
/**
|
||||
* Defines the internal data of a functional industry.
|
||||
*/
|
||||
|
@ -70,11 +72,12 @@ struct Industry : IndustryPool::PoolItem<&_industry_pool> {
|
|||
return ClampTo<uint8_t>(this->transported * 256 / this->production);
|
||||
}
|
||||
};
|
||||
|
||||
struct ProducedCargo {
|
||||
CargoType cargo = 0; ///< Cargo type
|
||||
uint16_t waiting = 0; ///< Amount of cargo produced
|
||||
uint8_t rate = 0; ///< Production rate
|
||||
HistoryData<ProducedHistory> history{}; ///< History of cargo produced and transported for this month and 24 previous months
|
||||
std::array<ProducedHistory, 25> history{}; ///< History of cargo produced and transported for this month and 24 previous months
|
||||
};
|
||||
|
||||
struct AcceptedCargo {
|
||||
|
@ -89,7 +92,6 @@ struct Industry : IndustryPool::PoolItem<&_industry_pool> {
|
|||
TileArea location{INVALID_TILE, 0, 0}; ///< Location of the industry
|
||||
Town *town = nullptr; ///< Nearest town
|
||||
Station *neutral_station = nullptr; ///< Associated neutral station
|
||||
ValidHistoryMask valid_history = 0; ///< Mask of valid history records.
|
||||
ProducedCargoes produced{}; ///< produced cargo slots
|
||||
AcceptedCargoes accepted{}; ///< accepted cargo slots
|
||||
uint8_t prod_level = 0; ///< general production level
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
/** @file industry_cmd.cpp Handling of industry tiles. */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "misc/history_type.hpp"
|
||||
#include "misc/history_func.hpp"
|
||||
#include "clear_map.h"
|
||||
#include "industry.h"
|
||||
#include "station_base.h"
|
||||
|
@ -1831,8 +1829,6 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
|
|||
for (auto &p : i->produced) {
|
||||
p.history[LAST_MONTH].production += ScaleByCargoScale(p.rate * 8, false);
|
||||
}
|
||||
|
||||
UpdateValidHistory(i->valid_history);
|
||||
}
|
||||
|
||||
if (indspec->callback_mask.Test(IndustryCallbackMask::DecideColour)) {
|
||||
|
@ -2490,13 +2486,14 @@ void GenerateIndustries()
|
|||
*/
|
||||
static void UpdateIndustryStatistics(Industry *i)
|
||||
{
|
||||
UpdateValidHistory(i->valid_history);
|
||||
|
||||
for (auto &p : i->produced) {
|
||||
if (IsValidCargoType(p.cargo)) {
|
||||
if (p.history[THIS_MONTH].production != 0) i->last_prod_year = TimerGameEconomy::year;
|
||||
|
||||
RotateHistory(p.history);
|
||||
/* Move history from this month to last month. */
|
||||
std::rotate(std::rbegin(p.history), std::rbegin(p.history) + 1, std::rend(p.history));
|
||||
p.history[THIS_MONTH].production = 0;
|
||||
p.history[THIS_MONTH].transported = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -268,7 +268,6 @@ STR_UNITS_YEARS :{NUM}{NBSP}ano{
|
|||
STR_UNITS_PERIODS :{NUM}{NBSP}período{P "" s}
|
||||
|
||||
STR_LIST_SEPARATOR :,{SPACE}
|
||||
STR_TRUNCATION_ELLIPSIS :...
|
||||
|
||||
# Common window strings
|
||||
STR_LIST_FILTER_TITLE :{BLACK}Filtro:
|
||||
|
|
|
@ -267,7 +267,6 @@ STR_UNITS_YEARS :{NUM}{NBSP}jaar
|
|||
STR_UNITS_PERIODS :{NUM}{NBSP}period{P "" en}
|
||||
|
||||
STR_LIST_SEPARATOR :,{SPACE}
|
||||
STR_TRUNCATION_ELLIPSIS :...
|
||||
|
||||
# Common window strings
|
||||
STR_LIST_FILTER_TITLE :{BLACK}Filter:
|
||||
|
|
|
@ -267,7 +267,6 @@ STR_UNITS_YEARS :{NUM}{NBSP}year
|
|||
STR_UNITS_PERIODS :{NUM}{NBSP}period{P "" s}
|
||||
|
||||
STR_LIST_SEPARATOR :,{SPACE}
|
||||
STR_TRUNCATION_ELLIPSIS :...
|
||||
|
||||
# Common window strings
|
||||
STR_LIST_FILTER_TITLE :{BLACK}Filter:
|
||||
|
|
|
@ -267,7 +267,6 @@ STR_UNITS_YEARS :{NUM}{NBSP}year
|
|||
STR_UNITS_PERIODS :{NUM}{NBSP}period{P "" s}
|
||||
|
||||
STR_LIST_SEPARATOR :,{SPACE}
|
||||
STR_TRUNCATION_ELLIPSIS :...
|
||||
|
||||
# Common window strings
|
||||
STR_LIST_FILTER_TITLE :{BLACK}Filter:
|
||||
|
|
|
@ -267,7 +267,6 @@ STR_UNITS_YEARS :{NUM}{NBSP}year
|
|||
STR_UNITS_PERIODS :{NUM}{NBSP}period{P "" s}
|
||||
|
||||
STR_LIST_SEPARATOR :,{SPACE}
|
||||
STR_TRUNCATION_ELLIPSIS :...
|
||||
|
||||
# Common window strings
|
||||
STR_LIST_FILTER_TITLE :{BLACK}Filter:
|
||||
|
|
|
@ -267,7 +267,6 @@ STR_UNITS_YEARS :{NUM}{NBSP}vuo{
|
|||
STR_UNITS_PERIODS :{NUM}{NBSP}jakso{P "" a}
|
||||
|
||||
STR_LIST_SEPARATOR :,{SPACE}
|
||||
STR_TRUNCATION_ELLIPSIS :…
|
||||
|
||||
# Common window strings
|
||||
STR_LIST_FILTER_TITLE :{BLACK}Suodatin:
|
||||
|
|
|
@ -268,7 +268,6 @@ STR_UNITS_YEARS :{NUM}{NBSP}ano{
|
|||
STR_UNITS_PERIODS :{NUM}{NBSP}período{P "" s}
|
||||
|
||||
STR_LIST_SEPARATOR :,{SPACE}
|
||||
STR_TRUNCATION_ELLIPSIS :...
|
||||
|
||||
# Common window strings
|
||||
STR_LIST_FILTER_TITLE :{BLACK}Filtrar:
|
||||
|
@ -1303,9 +1302,6 @@ STR_CONFIG_SETTING_INTEREST_RATE_HELPTEXT :A taxa de inter
|
|||
STR_CONFIG_SETTING_RUNNING_COSTS :Custos de explotación: {STRING}
|
||||
STR_CONFIG_SETTING_RUNNING_COSTS_HELPTEXT :Establece o nivel de mantemento e custo de operación de vehículos e infraestrutura
|
||||
###length 3
|
||||
STR_CONFIG_SETTING_RUNNING_COSTS_LOW :Baixo
|
||||
STR_CONFIG_SETTING_RUNNING_COSTS_MEDIUM :Medio
|
||||
STR_CONFIG_SETTING_RUNNING_COSTS_HIGH :Alto
|
||||
|
||||
STR_CONFIG_SETTING_CONSTRUCTION_SPEED :Velocidade de construción: {STRING}
|
||||
STR_CONFIG_SETTING_CONSTRUCTION_SPEED_HELPTEXT :Limita a cantidade de accións construtivas das IAs
|
||||
|
@ -1328,9 +1324,6 @@ STR_CONFIG_SETTING_SUBSIDY_DURATION_DISABLED :Sen subvención
|
|||
STR_CONFIG_SETTING_CONSTRUCTION_COSTS :Custos de construción: {STRING}
|
||||
STR_CONFIG_SETTING_CONSTRUCTION_COSTS_HELPTEXT :Fixa o nivel de custos de construción e compra
|
||||
###length 3
|
||||
STR_CONFIG_SETTING_CONSTRUCTION_COSTS_LOW :Baixo
|
||||
STR_CONFIG_SETTING_CONSTRUCTION_COSTS_MEDIUM :Medio
|
||||
STR_CONFIG_SETTING_CONSTRUCTION_COSTS_HIGH :Alto
|
||||
|
||||
STR_CONFIG_SETTING_RECESSIONS :Recesións económicas: {STRING}
|
||||
STR_CONFIG_SETTING_RECESSIONS_HELPTEXT :Se está activado, a economía pode entrar en recesión periódicamente. Durante unha recesión tódalas producións son significativamente máis baixas (volvendo ao nivel anterior cando a recesión remata)
|
||||
|
@ -2086,9 +2079,9 @@ STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED_HELPTEXT :A clase de merc
|
|||
STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT :Xeito de distribución para outros tipos de mercadoría: {STRING}
|
||||
STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT_HELPTEXT :"Asimétrico" significa que calquera cantidade de mercadorías pode ser enviada en calquera dirección. "Manual" significa que non haberá distribución automática para estas mercadorías
|
||||
###length 3
|
||||
STR_CONFIG_SETTING_DISTRIBUTION_MANUAL :Manual
|
||||
STR_CONFIG_SETTING_DISTRIBUTION_ASYMMETRIC :Asimétrica
|
||||
STR_CONFIG_SETTING_DISTRIBUTION_SYMMETRIC :Simétrica
|
||||
STR_CONFIG_SETTING_DISTRIBUTION_MANUAL :manual
|
||||
STR_CONFIG_SETTING_DISTRIBUTION_ASYMMETRIC :asimétrica
|
||||
STR_CONFIG_SETTING_DISTRIBUTION_SYMMETRIC :simétrica
|
||||
|
||||
STR_CONFIG_SETTING_LINKGRAPH_ACCURACY :Precisión da distribución: {STRING}
|
||||
STR_CONFIG_SETTING_LINKGRAPH_ACCURACY_HELPTEXT :Canto máis alto sexa o valor, máis tempo de CPU levará o cálculo de distribución. Se leva demasiado tempo podes experimentar retraso. Se sen embargo o fixas nun valor baixo, a distribución será imprecisa, e pode que a carga non sexa enviada aos destinos que ti queres
|
||||
|
|
|
@ -329,7 +329,6 @@ STR_UNITS_YEARS :{NUM}{NBSP}έτ
|
|||
STR_UNITS_PERIODS :{NUM}{NBSP}περίοδ{P 0 ος οι}
|
||||
|
||||
STR_LIST_SEPARATOR :,{SPACE}
|
||||
STR_TRUNCATION_ELLIPSIS :...
|
||||
|
||||
# Common window strings
|
||||
STR_LIST_FILTER_TITLE :{BLACK}Φιλτράρισμα λίστας:
|
||||
|
|
|
@ -268,7 +268,6 @@ STR_UNITS_YEARS :{NUM}년
|
|||
STR_UNITS_PERIODS :{NUM}기간
|
||||
|
||||
STR_LIST_SEPARATOR :,{SPACE}
|
||||
STR_TRUNCATION_ELLIPSIS :…
|
||||
|
||||
# Common window strings
|
||||
STR_LIST_FILTER_TITLE :{BLACK}검색:
|
||||
|
|
|
@ -646,7 +646,6 @@ STR_UNITS_YEARS :{NUM}{NBSP}{P r
|
|||
STR_UNITS_PERIODS :{NUM}{NBSP}okres{P "" y ów}
|
||||
|
||||
STR_LIST_SEPARATOR :,{SPACE}
|
||||
STR_TRUNCATION_ELLIPSIS :...
|
||||
|
||||
# Common window strings
|
||||
STR_LIST_FILTER_TITLE :{BLACK}Filtr:
|
||||
|
|
|
@ -268,7 +268,6 @@ STR_UNITS_YEARS :{NUM}{NBSP}ano{
|
|||
STR_UNITS_PERIODS :{NUM}{NBSP}período{P "" s}
|
||||
|
||||
STR_LIST_SEPARATOR :,{SPACE}
|
||||
STR_TRUNCATION_ELLIPSIS :...
|
||||
|
||||
# Common window strings
|
||||
STR_LIST_FILTER_TITLE :{BLACK}Filtro:
|
||||
|
@ -739,7 +738,7 @@ STR_PLAYLIST_TOOLTIP_CLICK_TO_ADD_TRACK :{BLACK}Clique n
|
|||
STR_PLAYLIST_TOOLTIP_CLICK_TO_REMOVE_TRACK :{BLACK}Clique numa faixa para a remover da lista (apenas Personalização 1 ou Personalização 2)
|
||||
|
||||
# Highscore window
|
||||
STR_HIGHSCORE_TOP_COMPANIES :{BIG_FONT}{BLACK}As melhores empresas
|
||||
STR_HIGHSCORE_TOP_COMPANIES :{BIG_FONT}{BLACK}Melhores empresas
|
||||
STR_HIGHSCORE_POSITION :{BIG_FONT}{BLACK}{COMMA}.
|
||||
STR_HIGHSCORE_PERFORMANCE_TITLE_BUSINESSMAN :Negociante
|
||||
STR_HIGHSCORE_PERFORMANCE_TITLE_ENTREPRENEUR :Empresário
|
||||
|
@ -749,7 +748,7 @@ STR_HIGHSCORE_PERFORMANCE_TITLE_MAGNATE :Magnata
|
|||
STR_HIGHSCORE_PERFORMANCE_TITLE_MOGUL :Grande magnata
|
||||
STR_HIGHSCORE_PERFORMANCE_TITLE_TYCOON_OF_THE_CENTURY :Magnata do século
|
||||
STR_HIGHSCORE_NAME :{PRESIDENT_NAME}, {COMPANY}
|
||||
STR_HIGHSCORE_STATS :{BIG_FONT}"{STRING}" ({COMMA})
|
||||
STR_HIGHSCORE_STATS :{BIG_FONT}'{STRING}' ({COMMA})
|
||||
STR_HIGHSCORE_COMPANY_ACHIEVES_STATUS :{BIG_FONT}{BLACK}{COMPANY} conquista o estatuto de '{STRING}'!
|
||||
STR_HIGHSCORE_PRESIDENT_OF_COMPANY_ACHIEVES_STATUS :{BIG_FONT}{WHITE}{PRESIDENT_NAME} de {COMPANY} conquista o estatuto de '{STRING}'!
|
||||
|
||||
|
@ -3117,8 +3116,8 @@ STR_INDUSTRY_CARGOES_SELECT_INDUSTRY_TOOLTIP :{BLACK}Selecion
|
|||
# Land area window
|
||||
STR_LAND_AREA_INFORMATION_CAPTION :{WHITE}Informações do Terreno
|
||||
STR_LAND_AREA_INFORMATION_LOCATION_TOOLTIP :{BLACK}Centrar visualização na localização do mosaico. Ctrl+Clique para abrir uma nova janela de visualização nesse mosaico.
|
||||
STR_LAND_AREA_INFORMATION_COST_TO_CLEAR_N_A :{BLACK}Custo de desobstrução: {LTBLUE}N/D
|
||||
STR_LAND_AREA_INFORMATION_COST_TO_CLEAR :{BLACK}Custo de desobstrução: {RED}{CURRENCY_LONG}
|
||||
STR_LAND_AREA_INFORMATION_COST_TO_CLEAR_N_A :{BLACK}Custo para limpar: {LTBLUE}N/D
|
||||
STR_LAND_AREA_INFORMATION_COST_TO_CLEAR :{BLACK}Custo para limpar: {RED}{CURRENCY_LONG}
|
||||
STR_LAND_AREA_INFORMATION_REVENUE_WHEN_CLEARED :{BLACK}Receitas apuradas: {LTBLUE}{CURRENCY_LONG}
|
||||
STR_LAND_AREA_INFORMATION_OWNER_N_A :N/D
|
||||
STR_LAND_AREA_INFORMATION_OWNER :{BLACK}Proprietário: {LTBLUE}{STRING}
|
||||
|
@ -3126,7 +3125,7 @@ STR_LAND_AREA_INFORMATION_ROAD_OWNER :{BLACK}Dono da
|
|||
STR_LAND_AREA_INFORMATION_TRAM_OWNER :{BLACK}Dono da linha de eléctrico: {LTBLUE}{STRING}
|
||||
STR_LAND_AREA_INFORMATION_RAIL_OWNER :{BLACK}Dono da linha férrea: {LTBLUE}{STRING}
|
||||
STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY :{BLACK}Autoridade local: {LTBLUE}{STRING}
|
||||
STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY_NONE :Nenhuma
|
||||
STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY_NONE :Nenhum
|
||||
STR_LAND_AREA_INFORMATION_LANDINFO_COORDS :{BLACK}Coordenadas: {LTBLUE}{NUM} x {NUM} x {NUM}
|
||||
STR_LAND_AREA_INFORMATION_LANDINFO_INDEX :{BLACK}Índice do mosaico: {LTBLUE}{NUM} ({HEX})
|
||||
STR_LAND_AREA_INFORMATION_BUILD_DATE :{BLACK}Construído/renovado: {LTBLUE}{DATE_LONG}
|
||||
|
@ -3685,9 +3684,9 @@ STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_REQUIRED_WINTER :{BLACK}No inver
|
|||
STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_DELIVERED_GENERAL :{ORANGE}{STRING}{GREEN} fo{G 0 i i i ram ram} entregue{G 0 "" "" "" s s}
|
||||
STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_REQUIRED :{ORANGE}{CARGO_TINY} / {CARGO_LONG}{RED} (ainda necessário)
|
||||
STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_DELIVERED :{ORANGE}{CARGO_TINY} / {CARGO_LONG}{GREEN} (entregue)
|
||||
STR_TOWN_VIEW_TOWN_GROWS_EVERY :{BLACK}A localidade cresce a cada {ORANGE}{UNITS_DAYS_OR_SECONDS}
|
||||
STR_TOWN_VIEW_TOWN_GROWS_EVERY_FUNDED :{BLACK}A localidade cresce a cada {ORANGE}{UNITS_DAYS_OR_SECONDS} (financiada)
|
||||
STR_TOWN_VIEW_TOWN_GROW_STOPPED :{BLACK}A localidade {RED}não{BLACK} está a crescer
|
||||
STR_TOWN_VIEW_TOWN_GROWS_EVERY :{BLACK}Localidade cresce a cada {ORANGE}{UNITS_DAYS_OR_SECONDS}
|
||||
STR_TOWN_VIEW_TOWN_GROWS_EVERY_FUNDED :{BLACK}Localidade cresce a cada {ORANGE}{UNITS_DAYS_OR_SECONDS} (financiada)
|
||||
STR_TOWN_VIEW_TOWN_GROW_STOPPED :{BLACK}Localidade {RED}não{BLACK} está a crescer
|
||||
STR_TOWN_VIEW_NOISE_IN_TOWN :{BLACK}Limite de ruído na localidade: {ORANGE}{COMMA}{BLACK} máx: {ORANGE}{COMMA}
|
||||
STR_TOWN_VIEW_CENTER_TOOLTIP :{BLACK}Centrar visualização na localização da localidade. Ctrl+Clique para abrir um novo visualizador na localização da localidade
|
||||
STR_TOWN_VIEW_LOCAL_AUTHORITY_BUTTON :{BLACK}Autoridade Local
|
||||
|
@ -3700,8 +3699,8 @@ STR_TOWN_VIEW_EXPAND_BUILDINGS_BUTTON :{BLACK}Expandir
|
|||
STR_TOWN_VIEW_EXPAND_BUILDINGS_TOOLTIP :{BLACK}Aumentar os edifícios da localidade
|
||||
STR_TOWN_VIEW_EXPAND_ROADS_BUTTON :{BLACK}Expandir estradas
|
||||
STR_TOWN_VIEW_EXPAND_ROADS_TOOLTIP :{BLACK}Aumentar as estradas da localidade
|
||||
STR_TOWN_VIEW_DELETE_BUTTON :{BLACK}Remover
|
||||
STR_TOWN_VIEW_DELETE_TOOLTIP :{BLACK}Remover completamente esta localidade
|
||||
STR_TOWN_VIEW_DELETE_BUTTON :{BLACK}Apagar
|
||||
STR_TOWN_VIEW_DELETE_TOOLTIP :{BLACK}Apagar completamente esta localidade
|
||||
|
||||
STR_TOWN_VIEW_RENAME_TOWN_BUTTON :Renomear Localidade
|
||||
|
||||
|
@ -3855,12 +3854,12 @@ STR_STATION_VIEW_VIA_HERE :{GREEN}{CARGO_S
|
|||
STR_STATION_VIEW_TO_HERE :{GREEN}{CARGO_SHORT} para esta estação
|
||||
STR_STATION_VIEW_NONSTOP :{YELLOW}{CARGO_SHORT} sem parar
|
||||
|
||||
STR_STATION_VIEW_GROUP_S_V_D :Origem-Via-Destino
|
||||
STR_STATION_VIEW_GROUP_S_D_V :Origem-Destino-Via
|
||||
STR_STATION_VIEW_GROUP_V_S_D :Via-Origem-Destino
|
||||
STR_STATION_VIEW_GROUP_V_D_S :Via-Destino-Origem
|
||||
STR_STATION_VIEW_GROUP_D_S_V :Destino-Origem-Via
|
||||
STR_STATION_VIEW_GROUP_D_V_S :Destino-Via-Origem
|
||||
STR_STATION_VIEW_GROUP_S_V_D :Fonte-Via-Destino
|
||||
STR_STATION_VIEW_GROUP_S_D_V :Fonte-Destino-Via
|
||||
STR_STATION_VIEW_GROUP_V_S_D :Via-Fonte-Destino
|
||||
STR_STATION_VIEW_GROUP_V_D_S :Via-Destino-Fonte
|
||||
STR_STATION_VIEW_GROUP_D_S_V :Destino-Fonte-Via
|
||||
STR_STATION_VIEW_GROUP_D_V_S :Destino-Via-Fonte
|
||||
|
||||
###length 8
|
||||
STR_CARGO_RATING_APPALLING :Inexistente
|
||||
|
@ -3943,7 +3942,7 @@ STR_FINANCES_INFRASTRUCTURE_BUTTON :{BLACK}Infraest
|
|||
STR_COMPANY_VIEW_CAPTION :{WHITE}{COMPANY} {BLACK}{COMPANY_NUM}
|
||||
STR_COMPANY_VIEW_PRESIDENT_MANAGER_TITLE :{WHITE}{PRESIDENT_NAME}{}{GOLD}(Presidente)
|
||||
|
||||
STR_COMPANY_VIEW_INAUGURATED_TITLE :{GOLD}Inaugurada em: {WHITE}{NUM}
|
||||
STR_COMPANY_VIEW_INAUGURATED_TITLE :{GOLD}Inaugurado: {WHITE}{NUM}
|
||||
STR_COMPANY_VIEW_INAUGURATED_TITLE_WALLCLOCK :{GOLD}Inaugurada: {WHITE}{NUM} (período {NUM})
|
||||
STR_COMPANY_VIEW_COLOUR_SCHEME_TITLE :{GOLD}Cores:
|
||||
STR_COMPANY_VIEW_VEHICLES_TITLE :{GOLD}Veículos:
|
||||
|
|
|
@ -393,7 +393,6 @@ STR_UNITS_YEARS :{NUM}{NBSP}{P
|
|||
STR_UNITS_PERIODS :{NUM}{NBSP}цикл{P "" а ов}
|
||||
|
||||
STR_LIST_SEPARATOR :,{SPACE}
|
||||
STR_TRUNCATION_ELLIPSIS :...
|
||||
|
||||
# Common window strings
|
||||
STR_LIST_FILTER_TITLE :{BLACK}Фильтр:
|
||||
|
|
|
@ -267,7 +267,6 @@ STR_UNITS_YEARS :{NUM}{NBSP}年
|
|||
STR_UNITS_PERIODS :{NUM}{NBSP}个周期
|
||||
|
||||
STR_LIST_SEPARATOR :、
|
||||
STR_TRUNCATION_ELLIPSIS :…
|
||||
|
||||
# Common window strings
|
||||
STR_LIST_FILTER_TITLE :{BLACK}搜索:
|
||||
|
|
|
@ -268,7 +268,6 @@ STR_UNITS_YEARS :{NUM}{NBSP}año
|
|||
STR_UNITS_PERIODS :{NUM}{NBSP}período{P "" s}
|
||||
|
||||
STR_LIST_SEPARATOR :,{SPACE}
|
||||
STR_TRUNCATION_ELLIPSIS :...
|
||||
|
||||
# Common window strings
|
||||
STR_LIST_FILTER_TITLE :{BLACK}Filtrar:
|
||||
|
|
|
@ -267,7 +267,6 @@ STR_UNITS_YEARS :{NUM}{NBSP}年
|
|||
STR_UNITS_PERIODS :{NUM}{NBSP}個週期
|
||||
|
||||
STR_LIST_SEPARATOR :、
|
||||
STR_TRUNCATION_ELLIPSIS :……
|
||||
|
||||
# Common window strings
|
||||
STR_LIST_FILTER_TITLE :{BLACK}篩選:
|
||||
|
|
|
@ -8,7 +8,5 @@ add_files(
|
|||
getoptdata.cpp
|
||||
getoptdata.h
|
||||
hashtable.hpp
|
||||
history_func.hpp
|
||||
history_type.hpp
|
||||
lrucache.hpp
|
||||
)
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file history_func.hpp Functions for storing historical data. */
|
||||
|
||||
#ifndef HISTORY_FUNC_HPP
|
||||
#define HISTORY_FUNC_HPP
|
||||
|
||||
#include "../core/bitmath_func.hpp"
|
||||
#include "history_type.hpp"
|
||||
|
||||
/**
|
||||
* Update mask of valid history records.
|
||||
* @param[in,out] valid_history Valid history records.
|
||||
*/
|
||||
inline void UpdateValidHistory(ValidHistoryMask &valid_history)
|
||||
{
|
||||
SB(valid_history, LAST_MONTH, HISTORY_RECORDS - LAST_MONTH, GB(valid_history, LAST_MONTH, HISTORY_RECORDS - LAST_MONTH) << 1ULL | 1ULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotate history.
|
||||
* @tparam T type of history data element.
|
||||
* @param history Historical data to rotate.
|
||||
*/
|
||||
template <typename T>
|
||||
void RotateHistory(HistoryData<T> &history)
|
||||
{
|
||||
std::rotate(std::rbegin(history), std::rbegin(history) + 1, std::rend(history));
|
||||
history[THIS_MONTH] = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill some data with historical data.
|
||||
* @param history Historical data to fill from.
|
||||
* @param valid_history Mask of valid history records.
|
||||
* @param fillers Fillers to fill with history data.
|
||||
*/
|
||||
template <uint N, typename T, typename... Tfillers>
|
||||
void FillFromHistory(const HistoryData<T> &history, ValidHistoryMask valid_history, Tfillers... fillers)
|
||||
{
|
||||
for (uint i = 0; i != N; ++i) {
|
||||
if (HasBit(valid_history, N - i)) {
|
||||
auto &data = history[N - i];
|
||||
(fillers.Fill(i, data), ...);
|
||||
} else {
|
||||
(fillers.MakeInvalid(i), ...);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HISTORY_FUNC_HPP */
|
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file history_type.hpp Types for storing historical data. */
|
||||
|
||||
#ifndef HISTORY_TYPE_HPP
|
||||
#define HISTORY_TYPE_HPP
|
||||
|
||||
static constexpr uint8_t HISTORY_RECORDS = 25;
|
||||
|
||||
static constexpr uint8_t THIS_MONTH = 0;
|
||||
static constexpr uint8_t LAST_MONTH = 1;
|
||||
|
||||
/**
|
||||
* Container type for storing history data.
|
||||
* @tparam T type of history data.
|
||||
*/
|
||||
template <typename T>
|
||||
using HistoryData = std::array<T, HISTORY_RECORDS>;
|
||||
|
||||
/** Mask of valid history records. */
|
||||
using ValidHistoryMask = uint64_t;
|
||||
|
||||
#endif /* HISTORY_TYPE_HPP */
|
|
@ -162,8 +162,6 @@ static const SaveLoad _industry_desc[] = {
|
|||
SLE_CONDVAR(Industry, random, SLE_UINT16, SLV_82, SL_MAX_VERSION),
|
||||
SLE_CONDSSTR(Industry, text, SLE_STR | SLF_ALLOW_CONTROL, SLV_INDUSTRY_TEXT, SL_MAX_VERSION),
|
||||
|
||||
SLE_CONDVAR(Industry, valid_history, SLE_UINT64, SLV_INDUSTRY_NUM_VALID_HISTORY, SL_MAX_VERSION),
|
||||
|
||||
SLEG_CONDSTRUCTLIST("accepted", SlIndustryAccepted, SLV_INDUSTRY_CARGO_REORGANISE, SL_MAX_VERSION),
|
||||
SLEG_CONDSTRUCTLIST("produced", SlIndustryProduced, SLV_INDUSTRY_CARGO_REORGANISE, SL_MAX_VERSION),
|
||||
};
|
||||
|
@ -230,24 +228,6 @@ struct INDYChunkHandler : ChunkHandler {
|
|||
} else if (IsSavegameVersionBefore(SLV_INDUSTRY_CARGO_REORGANISE)) {
|
||||
LoadMoveAcceptsProduced(i, INDUSTRY_NUM_INPUTS, INDUSTRY_NUM_OUTPUTS);
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(SLV_INDUSTRY_NUM_VALID_HISTORY)) {
|
||||
/* The last month has always been recorded. */
|
||||
size_t oldest_valid = LAST_MONTH;
|
||||
if (!IsSavegameVersionBefore(SLV_PRODUCTION_HISTORY)) {
|
||||
/* History was extended but we did not keep track of valid history, so assume it from the oldest non-zero value. */
|
||||
for (const auto &p : i->produced) {
|
||||
if (!IsValidCargoType(p.cargo)) continue;
|
||||
for (size_t n = LAST_MONTH; n < std::size(p.history); ++n) {
|
||||
if (p.history[n].production == 0 && p.history[n].transported == 0) continue;
|
||||
oldest_valid = std::max(oldest_valid, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Set mask bits up to and including the oldest valid record. */
|
||||
i->valid_history = (std::numeric_limits<uint64_t>::max() >> (std::numeric_limits<uint64_t>::digits - (oldest_valid + 1 - LAST_MONTH))) << LAST_MONTH;
|
||||
}
|
||||
|
||||
Industry::industries[i->type].insert(i->index);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -404,7 +404,6 @@ enum SaveLoadVersion : uint16_t {
|
|||
SLV_ORDERS_OWNED_BY_ORDERLIST, ///< 354 PR#13948 Orders stored in OrderList, pool removed.
|
||||
|
||||
SLV_FACE_STYLES, ///< 355 PR#14319 Addition of face styles, replacing gender and ethnicity.
|
||||
SLV_INDUSTRY_NUM_VALID_HISTORY, ///< 356 PR#14416 Store number of valid history records for industries.
|
||||
|
||||
SL_MAX_VERSION, ///< Highest possible saveload version
|
||||
};
|
||||
|
|
|
@ -667,15 +667,6 @@ static void ChangeMinutesPerYear(int32_t new_value)
|
|||
}
|
||||
}
|
||||
|
||||
/* Get the valid range of the "minutes per calendar year" setting. */
|
||||
static std::tuple<int32_t, uint32_t> GetMinutesPerYearRange(const IntSettingDesc &)
|
||||
{
|
||||
/* Allow a non-default value only if using Wallclock timekeeping units. */
|
||||
if (_settings_newgame.economy.timekeeping_units == TKU_WALLCLOCK) return { CalendarTime::FROZEN_MINUTES_PER_YEAR, CalendarTime::MAX_MINUTES_PER_YEAR };
|
||||
|
||||
return { CalendarTime::DEF_MINUTES_PER_YEAR, CalendarTime::DEF_MINUTES_PER_YEAR };
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-callback check when trying to change the timetable mode. This is locked to Seconds when using wallclock units.
|
||||
* @param Unused.
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "table/sprites.h"
|
||||
|
||||
struct SpriteBounds {
|
||||
PointXyz<int8_t> origin; ///< Position of northern corner within tile.
|
||||
PointXyz<int8_t> origin; ///< Position of orthern corner within tile.
|
||||
PointXyz<uint8_t> extent; ///< Size of bounding box.
|
||||
PointXyz<int8_t> offset; ///< Relative position of sprite from bounding box.
|
||||
};
|
||||
|
|
|
@ -526,7 +526,7 @@ static void *ReadSprite(const SpriteCache *sc, SpriteID id, SpriteType sprite_ty
|
|||
}
|
||||
|
||||
if (sprite_type == SpriteType::Font && _font_zoom != ZoomLevel::Min) {
|
||||
/* Make ZoomLevel::Min the desired font zoom level. */
|
||||
/* Make ZoomLevel::Min be ZOOM_LVL_GUI */
|
||||
sprite[ZoomLevel::Min] = sprite[_font_zoom];
|
||||
}
|
||||
|
||||
|
|
|
@ -286,7 +286,6 @@ struct LoadedLanguagePack {
|
|||
std::array<uint, TEXT_TAB_END> langtab_start; ///< Offset into langpack offs
|
||||
|
||||
std::string list_separator; ///< Current list separator string.
|
||||
std::string ellipsis; ///< Current ellipsis string.
|
||||
};
|
||||
|
||||
static LoadedLanguagePack _langpack;
|
||||
|
@ -302,15 +301,6 @@ std::string_view GetListSeparator()
|
|||
return _langpack.list_separator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ellipsis string for the current language.
|
||||
* @returns string containing ellipsis to use.
|
||||
*/
|
||||
std::string_view GetEllipsis()
|
||||
{
|
||||
return _langpack.ellipsis;
|
||||
}
|
||||
|
||||
std::string_view GetStringPtr(StringID string)
|
||||
{
|
||||
switch (GetStringTab(string)) {
|
||||
|
@ -2073,7 +2063,6 @@ bool ReadLanguagePack(const LanguageMetadata *lang)
|
|||
_config_language_file = FS2OTTD(_current_language->file.filename().native());
|
||||
SetCurrentGrfLangID(_current_language->newgrflangid);
|
||||
_langpack.list_separator = GetString(STR_LIST_SEPARATOR);
|
||||
_langpack.ellipsis = GetString(STR_TRUNCATION_ELLIPSIS);
|
||||
|
||||
#ifdef _WIN32
|
||||
extern void Win32SetCurrentLocaleName(std::string iso_code);
|
||||
|
|
|
@ -98,7 +98,6 @@ extern TextDirection _current_text_dir; ///< Text direction of the currently sel
|
|||
void InitializeLanguagePacks();
|
||||
std::string_view GetCurrentLanguageIsoCode();
|
||||
std::string_view GetListSeparator();
|
||||
std::string_view GetEllipsis();
|
||||
|
||||
/**
|
||||
* Helper to create the StringParameters with its own buffer with the given
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
static void TownFoundingChanged(int32_t new_value);
|
||||
static void ChangeTimekeepingUnits(int32_t new_value);
|
||||
static void ChangeMinutesPerYear(int32_t new_value);
|
||||
static std::tuple<int32_t, uint32_t> GetMinutesPerYearRange(const IntSettingDesc &sd);
|
||||
|
||||
static constexpr std::initializer_list<std::string_view> _place_houses{"forbidden"sv, "allowed"sv, "fully constructed"sv};
|
||||
|
||||
|
@ -333,7 +332,6 @@ strhelp = STR_CONFIG_SETTING_MINUTES_PER_YEAR_HELPTEXT
|
|||
strval = STR_CONFIG_SETTING_MINUTES_PER_YEAR_VALUE
|
||||
pre_cb = [](auto) { return _game_mode == GM_MENU || _settings_game.economy.timekeeping_units == 1; }
|
||||
post_cb = ChangeMinutesPerYear
|
||||
range_cb = GetMinutesPerYearRange
|
||||
cat = SC_BASIC
|
||||
|
||||
[SDT_VAR]
|
||||
|
|
|
@ -1628,7 +1628,7 @@ static CargoTypes GetProducedCargoOfHouse(const HouseSpec *hs)
|
|||
|
||||
struct BuildHouseWindow : public PickerWindow {
|
||||
std::string house_info{};
|
||||
static inline bool house_protected;
|
||||
bool house_protected = false;
|
||||
|
||||
BuildHouseWindow(WindowDesc &desc, Window *parent) : PickerWindow(desc, parent, 0, HousePickerCallbacks::instance)
|
||||
{
|
||||
|
@ -1735,9 +1735,9 @@ struct BuildHouseWindow : public PickerWindow {
|
|||
switch (widget) {
|
||||
case WID_BH_PROTECT_OFF:
|
||||
case WID_BH_PROTECT_ON:
|
||||
BuildHouseWindow::house_protected = (widget == WID_BH_PROTECT_ON);
|
||||
this->SetWidgetLoweredState(WID_BH_PROTECT_OFF, !BuildHouseWindow::house_protected);
|
||||
this->SetWidgetLoweredState(WID_BH_PROTECT_ON, BuildHouseWindow::house_protected);
|
||||
this->house_protected = (widget == WID_BH_PROTECT_ON);
|
||||
this->SetWidgetLoweredState(WID_BH_PROTECT_OFF, !this->house_protected);
|
||||
this->SetWidgetLoweredState(WID_BH_PROTECT_ON, this->house_protected);
|
||||
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
this->SetDirty();
|
||||
|
@ -1764,10 +1764,10 @@ struct BuildHouseWindow : public PickerWindow {
|
|||
|
||||
/* If house spec already has the protected flag, handle it automatically and disable the buttons. */
|
||||
bool hasflag = spec->extra_flags.Test(HouseExtraFlag::BuildingIsProtected);
|
||||
if (hasflag) BuildHouseWindow::house_protected = true;
|
||||
if (hasflag) this->house_protected = true;
|
||||
|
||||
this->SetWidgetLoweredState(WID_BH_PROTECT_OFF, !BuildHouseWindow::house_protected);
|
||||
this->SetWidgetLoweredState(WID_BH_PROTECT_ON, BuildHouseWindow::house_protected);
|
||||
this->SetWidgetLoweredState(WID_BH_PROTECT_OFF, !this->house_protected);
|
||||
this->SetWidgetLoweredState(WID_BH_PROTECT_ON, this->house_protected);
|
||||
|
||||
this->SetWidgetDisabledState(WID_BH_PROTECT_OFF, hasflag);
|
||||
this->SetWidgetDisabledState(WID_BH_PROTECT_ON, hasflag);
|
||||
|
@ -1776,7 +1776,7 @@ struct BuildHouseWindow : public PickerWindow {
|
|||
void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override
|
||||
{
|
||||
const HouseSpec *spec = HouseSpec::Get(HousePickerCallbacks::sel_type);
|
||||
Command<CMD_PLACE_HOUSE>::Post(STR_ERROR_CAN_T_BUILD_HOUSE, CcPlaySound_CONSTRUCTION_OTHER, tile, spec->Index(), BuildHouseWindow::house_protected);
|
||||
Command<CMD_PLACE_HOUSE>::Post(STR_ERROR_CAN_T_BUILD_HOUSE, CcPlaySound_CONSTRUCTION_OTHER, tile, spec->Index(), this->house_protected);
|
||||
}
|
||||
|
||||
const IntervalTimer<TimerWindow> view_refresh_interval = {std::chrono::milliseconds(2500), [this](auto) {
|
||||
|
|
|
@ -1398,7 +1398,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
|||
|
||||
if (catenary || railtype_overlay != 0) EndSpriteCombine();
|
||||
|
||||
/* Add helper BB for sprite sorting that separates the tunnel from things beside of it. */
|
||||
// /* Add helper BB for sprite sorting that separates the tunnel from things beside of it. */
|
||||
AddSortableSpriteToDraw(SPR_EMPTY_BOUNDING_BOX, PAL_NONE, *ti, rear_sep[tunnelbridge_direction]);
|
||||
AddSortableSpriteToDraw(SPR_EMPTY_BOUNDING_BOX, PAL_NONE, *ti, front_sep[tunnelbridge_direction]);
|
||||
|
||||
|
|
|
@ -1080,9 +1080,9 @@ void OpenGLBackend::DrawMouseCursor()
|
|||
const OpenGLSprite *spr = this->cursor_cache.Get(cs.image.sprite).get();
|
||||
|
||||
this->RenderOglSprite(spr, cs.image.pal,
|
||||
this->cursor_pos.x + cs.pos.x + UnScaleByZoom(spr->x_offs, _gui_zoom),
|
||||
this->cursor_pos.y + cs.pos.y + UnScaleByZoom(spr->y_offs, _gui_zoom),
|
||||
_gui_zoom);
|
||||
this->cursor_pos.x + cs.pos.x + UnScaleByZoom(spr->x_offs, ZOOM_LVL_GUI),
|
||||
this->cursor_pos.y + cs.pos.y + UnScaleByZoom(spr->y_offs, ZOOM_LVL_GUI),
|
||||
ZOOM_LVL_GUI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ static std::string GetStringForWidget(const Window *w, const NWidgetCore *nwid,
|
|||
/**
|
||||
* Scale a RectPadding to GUI zoom level.
|
||||
* @param r RectPadding at ZOOM_BASE (traditional "normal" interface size).
|
||||
* @return RectPadding at current interface size.
|
||||
* @return RectPadding at #ZOOM_LVL_GUI (current interface size).
|
||||
*/
|
||||
static inline RectPadding ScaleGUITrad(const RectPadding &r)
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ static inline RectPadding ScaleGUITrad(const RectPadding &r)
|
|||
/**
|
||||
* Scale a Dimension to GUI zoom level.
|
||||
* @param d Dimension at ZOOM_BASE (traditional "normal" interface size).
|
||||
* @return Dimension at current interface size.
|
||||
* @return Dimension at #ZOOM_LVL_GUI (current interface size).
|
||||
*/
|
||||
static inline Dimension ScaleGUITrad(const Dimension &dim)
|
||||
{
|
||||
|
|
|
@ -72,11 +72,11 @@ inline int UnScaleByZoomLower(int value, ZoomLevel zoom)
|
|||
/**
|
||||
* Short-hand to apply GUI zoom level.
|
||||
* @param value Pixel amount at #ZoomLevel::Min (full zoom in).
|
||||
* @return Pixel amount at current interface size.
|
||||
* @return Pixel amount at #ZOOM_LVL_GUI (current interface size).
|
||||
*/
|
||||
inline int UnScaleGUI(int value)
|
||||
{
|
||||
return UnScaleByZoom(value, _gui_zoom);
|
||||
return UnScaleByZoom(value, ZOOM_LVL_GUI);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -86,7 +86,7 @@ inline int UnScaleGUI(int value)
|
|||
*/
|
||||
inline ZoomLevel ScaleZoomGUI(ZoomLevel value)
|
||||
{
|
||||
return std::clamp(value + (_gui_zoom - ZoomLevel::Normal), ZoomLevel::Min, ZoomLevel::Max);
|
||||
return std::clamp(value + (ZOOM_LVL_GUI - ZoomLevel::Normal), ZoomLevel::Min, ZoomLevel::Max);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,13 +96,13 @@ inline ZoomLevel ScaleZoomGUI(ZoomLevel value)
|
|||
*/
|
||||
inline ZoomLevel UnScaleZoomGUI(ZoomLevel value)
|
||||
{
|
||||
return std::clamp(value - (_gui_zoom - ZoomLevel::Normal), ZoomLevel::Min, ZoomLevel::Max);
|
||||
return std::clamp(value - (ZOOM_LVL_GUI - ZoomLevel::Normal), ZoomLevel::Min, ZoomLevel::Max);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale traditional pixel dimensions to GUI zoom level, for drawing sprites.
|
||||
* @param value Pixel amount at #ZOOM_BASE (traditional "normal" interface size).
|
||||
* @return Pixel amount at current interface size.
|
||||
* @return Pixel amount at #ZOOM_LVL_GUI (current interface size).
|
||||
*/
|
||||
inline int ScaleSpriteTrad(int value)
|
||||
{
|
||||
|
@ -112,7 +112,7 @@ inline int ScaleSpriteTrad(int value)
|
|||
/**
|
||||
* Scale traditional pixel dimensions to GUI zoom level.
|
||||
* @param value Pixel amount at #ZOOM_BASE (traditional "normal" interface size).
|
||||
* @return Pixel amount at current interface size.
|
||||
* @return Pixel amount at #ZOOM_LVL_GUI (current interface size).
|
||||
*/
|
||||
inline int ScaleGUITrad(int value)
|
||||
{
|
||||
|
|
|
@ -52,6 +52,7 @@ extern int _gui_scale_cfg;
|
|||
|
||||
extern ZoomLevel _gui_zoom;
|
||||
extern ZoomLevel _font_zoom;
|
||||
#define ZOOM_LVL_GUI (_gui_zoom)
|
||||
|
||||
static const int MIN_INTERFACE_SCALE = 100;
|
||||
static const int MAX_INTERFACE_SCALE = 500;
|
||||
|
|
Loading…
Reference in New Issue