mirror of https://github.com/OpenTTD/OpenTTD
Compare commits
11 Commits
f12b90f3cd
...
2f1a3ecd5a
Author | SHA1 | Date |
---|---|---|
|
2f1a3ecd5a | |
|
baced00e9f | |
|
aaf5d39b15 | |
|
7db135099a | |
|
290144c5c9 | |
|
9b55ad5b8d | |
|
f6e78a480d | |
|
259830777c | |
|
753905ae2d | |
|
d2ee2add28 | |
|
8de32c4509 |
49
src/gfx.cpp
49
src/gfx.cpp
|
@ -523,10 +523,9 @@ static int DrawLayoutLine(const ParagraphLayouter::Line &line, int y, int left,
|
||||||
int max_x = right; // The maximum x position to draw normal glyphs on.
|
int max_x = right; // The maximum x position to draw normal glyphs on.
|
||||||
|
|
||||||
truncation &= max_w < w; // Whether we need to do truncation.
|
truncation &= max_w < w; // Whether we need to do truncation.
|
||||||
int dot_width = 0; // Cache for the width of the dot.
|
int truncation_width = 0; // Width of the ellipsis string.
|
||||||
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) {
|
if (truncation) {
|
||||||
/*
|
/*
|
||||||
* Assumption may be made that all fonts of a run are of the same size.
|
* Assumption may be made that all fonts of a run are of the same size.
|
||||||
|
@ -534,20 +533,17 @@ static int DrawLayoutLine(const ParagraphLayouter::Line &line, int y, int left,
|
||||||
* another size would be chosen it won't have truncated too little for
|
* another size would be chosen it won't have truncated too little for
|
||||||
* the truncation dots.
|
* the truncation dots.
|
||||||
*/
|
*/
|
||||||
FontCache *fc = line.GetVisualRun(0).GetFont()->fc;
|
truncation_layout.emplace(GetEllipsis(), INT32_MAX, line.GetVisualRun(0).GetFont()->fc->GetSize());
|
||||||
dot_has_shadow = fc->GetDrawGlyphShadow();
|
truncation_width = truncation_layout->GetBounds().width;
|
||||||
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? */
|
/* Is there enough space even for an ellipsis? */
|
||||||
if (max_w < dot_width * 3) return (_current_text_dir == TD_RTL) ? left : right;
|
if (max_w < truncation_width) return (_current_text_dir == TD_RTL) ? left : right;
|
||||||
|
|
||||||
if (_current_text_dir == TD_RTL) {
|
if (_current_text_dir == TD_RTL) {
|
||||||
min_x += 3 * dot_width;
|
min_x += truncation_width;
|
||||||
offset_x = w - max_w;
|
offset_x = w - max_w;
|
||||||
} else {
|
} else {
|
||||||
max_x -= 3 * dot_width;
|
max_x -= truncation_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
w = max_w;
|
w = max_w;
|
||||||
|
@ -583,9 +579,11 @@ static int DrawLayoutLine(const ParagraphLayouter::Line &line, int y, int left,
|
||||||
|
|
||||||
const uint shadow_offset = ScaleGUITrad(1);
|
const uint shadow_offset = ScaleGUITrad(1);
|
||||||
|
|
||||||
/* Draw shadow, then foreground */
|
auto draw_line = [&](const ParagraphLayouter::Line &line, bool do_shadow, int left, int min_x, int max_x, bool truncation) {
|
||||||
for (bool do_shadow : { true, false }) {
|
const DrawPixelInfo *dpi = _cur_dpi;
|
||||||
bool colour_has_shadow = false;
|
int dpi_left = dpi->left;
|
||||||
|
int dpi_right = dpi->left + dpi->width - 1;
|
||||||
|
|
||||||
for (int run_index = 0; run_index < line.CountRuns(); run_index++) {
|
for (int run_index = 0; run_index < line.CountRuns(); run_index++) {
|
||||||
const ParagraphLayouter::VisualRun &run = line.GetVisualRun(run_index);
|
const ParagraphLayouter::VisualRun &run = line.GetVisualRun(run_index);
|
||||||
const auto &glyphs = run.GetGlyphs();
|
const auto &glyphs = run.GetGlyphs();
|
||||||
|
@ -595,22 +593,18 @@ static int DrawLayoutLine(const ParagraphLayouter::Line &line, int y, int left,
|
||||||
FontCache *fc = f->fc;
|
FontCache *fc = f->fc;
|
||||||
TextColour colour = f->colour;
|
TextColour colour = f->colour;
|
||||||
if (colour == TC_INVALID || HasFlag(default_colour, TC_FORCED)) colour = default_colour;
|
if (colour == TC_INVALID || HasFlag(default_colour, TC_FORCED)) colour = default_colour;
|
||||||
colour_has_shadow = (colour & TC_NO_SHADE) == 0 && colour != TC_BLACK;
|
bool 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
|
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;
|
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++) {
|
for (int i = 0; i < run.GetGlyphCount(); i++) {
|
||||||
GlyphID glyph = glyphs[i];
|
GlyphID glyph = glyphs[i];
|
||||||
|
|
||||||
/* Not a valid glyph (empty) */
|
/* Not a valid glyph (empty) */
|
||||||
if (glyph == 0xFFFF) continue;
|
if (glyph == 0xFFFF) continue;
|
||||||
|
|
||||||
int begin_x = positions[i].left + left - offset_x;
|
int begin_x = positions[i].left + left;
|
||||||
int end_x = positions[i].right + left - offset_x;
|
int end_x = positions[i].right + left;
|
||||||
int top = positions[i].top + y;
|
int top = positions[i].top + y;
|
||||||
|
|
||||||
/* Truncated away. */
|
/* Truncated away. */
|
||||||
|
@ -625,12 +619,15 @@ 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);
|
GfxMainBlitter(sprite, begin_x + (do_shadow ? shadow_offset : 0), top + (do_shadow ? shadow_offset : 0), BlitterMode::ColourRemap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (truncation && (!do_shadow || (dot_has_shadow && colour_has_shadow))) {
|
/* Draw shadow, then foreground */
|
||||||
int x = (_current_text_dir == TD_RTL) ? left : (right - 3 * dot_width);
|
for (bool do_shadow : {true, false}) {
|
||||||
for (int i = 0; i < 3; i++, x += dot_width) {
|
draw_line(line, do_shadow, left - offset_x, min_x, max_x, truncation);
|
||||||
GfxMainBlitter(dot_sprite, x + (do_shadow ? shadow_offset : 0), y + (do_shadow ? shadow_offset : 0), BlitterMode::ColourRemap);
|
|
||||||
}
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,12 +88,12 @@ void UndrawMouseCursor();
|
||||||
void RedrawScreenRect(int left, int top, int right, int bottom);
|
void RedrawScreenRect(int left, int top, int right, int bottom);
|
||||||
void GfxScroll(int left, int top, int width, int height, int xo, int yo);
|
void GfxScroll(int left, int top, int width, int height, int xo, int yo);
|
||||||
|
|
||||||
Dimension GetSpriteSize(SpriteID sprid, Point *offset = nullptr, ZoomLevel zoom = ZOOM_LVL_GUI);
|
Dimension GetSpriteSize(SpriteID sprid, Point *offset = nullptr, ZoomLevel zoom = _gui_zoom);
|
||||||
Dimension GetScaledSpriteSize(SpriteID sprid); /* widget.cpp */
|
Dimension GetScaledSpriteSize(SpriteID sprid); /* widget.cpp */
|
||||||
void DrawSpriteViewport(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub = nullptr);
|
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 = ZOOM_LVL_GUI);
|
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub = nullptr, ZoomLevel zoom = _gui_zoom);
|
||||||
void DrawSpriteIgnorePadding(SpriteID img, PaletteID pal, const Rect &r, StringAlignment align); /* widget.cpp */
|
void DrawSpriteIgnorePadding(SpriteID img, PaletteID pal, const Rect &r, StringAlignment align); /* widget.cpp */
|
||||||
std::unique_ptr<uint32_t[]> DrawSpriteToRgbaBuffer(SpriteID spriteId, ZoomLevel zoom = ZOOM_LVL_GUI);
|
std::unique_ptr<uint32_t[]> DrawSpriteToRgbaBuffer(SpriteID spriteId, ZoomLevel zoom = _gui_zoom);
|
||||||
|
|
||||||
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, 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);
|
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,6 +8,7 @@
|
||||||
/** @file graph_gui.cpp GUI that shows performance graphs. */
|
/** @file graph_gui.cpp GUI that shows performance graphs. */
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include "misc/history_func.hpp"
|
||||||
#include "graph_gui.h"
|
#include "graph_gui.h"
|
||||||
#include "window_gui.h"
|
#include "window_gui.h"
|
||||||
#include "company_base.h"
|
#include "company_base.h"
|
||||||
|
@ -215,6 +216,15 @@ protected:
|
||||||
uint8_t highlight_range = UINT8_MAX; ///< Data range that should be highlighted, or UINT8_MAX for none.
|
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.
|
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.
|
* Get appropriate part of dataset values for the current number of horizontal points.
|
||||||
* @param dataset Dataset to get values of
|
* @param dataset Dataset to get values of
|
||||||
|
@ -378,7 +388,9 @@ protected:
|
||||||
/* Draw the background of the graph itself. */
|
/* Draw the background of the graph itself. */
|
||||||
GfxFillRect(r.left, r.top, r.right, r.bottom, GRAPH_BASE_COLOUR);
|
GfxFillRect(r.left, r.top, r.right, r.bottom, GRAPH_BASE_COLOUR);
|
||||||
|
|
||||||
/* Draw the vertical grid lines. */
|
/* Draw the grid lines. */
|
||||||
|
int gridline_width = WidgetDimensions::scaled.bevel.top;
|
||||||
|
int grid_colour = GRAPH_GRID_COLOUR;
|
||||||
|
|
||||||
/* Don't draw the first line, as that's where the axis will be. */
|
/* Don't draw the first line, as that's where the axis will be. */
|
||||||
if (rtl) {
|
if (rtl) {
|
||||||
|
@ -388,13 +400,12 @@ protected:
|
||||||
x = r.left + x_sep;
|
x = r.left + x_sep;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grid_colour = GRAPH_GRID_COLOUR;
|
|
||||||
for (int i = 1; i < this->num_vert_lines + 1; i++) {
|
for (int i = 1; i < this->num_vert_lines + 1; i++) {
|
||||||
/* If using wallclock units, we separate periods with a lighter line. */
|
/* If using wallclock units, we separate periods with a lighter line. */
|
||||||
if (TimerGameEconomy::UsingWallclockUnits()) {
|
if (TimerGameEconomy::UsingWallclockUnits()) {
|
||||||
grid_colour = (i % 4 == 0) ? GRAPH_YEAR_LINE_COLOUR : GRAPH_GRID_COLOUR;
|
grid_colour = (i % 4 == 0) ? GRAPH_YEAR_LINE_COLOUR : GRAPH_GRID_COLOUR;
|
||||||
}
|
}
|
||||||
GfxFillRect(x, r.top, x, r.bottom, grid_colour);
|
GfxFillRect(x, r.top, x + gridline_width - 1, r.bottom, grid_colour);
|
||||||
x += x_sep;
|
x += x_sep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,20 +414,20 @@ protected:
|
||||||
|
|
||||||
for (int i = 0; i < (num_hori_lines + 1); i++) {
|
for (int i = 0; i < (num_hori_lines + 1); i++) {
|
||||||
if (rtl) {
|
if (rtl) {
|
||||||
GfxFillRect(r.right + 1, y, r.right + ScaleGUITrad(3), y, GRAPH_AXIS_LINE_COLOUR);
|
GfxFillRect(r.right + 1, y, r.right + ScaleGUITrad(3), y + gridline_width - 1, GRAPH_AXIS_LINE_COLOUR);
|
||||||
} else {
|
} else {
|
||||||
GfxFillRect(r.left - ScaleGUITrad(3), y, r.left - 1, y, GRAPH_AXIS_LINE_COLOUR);
|
GfxFillRect(r.left - ScaleGUITrad(3), y, r.left - 1, y + gridline_width - 1, GRAPH_AXIS_LINE_COLOUR);
|
||||||
}
|
}
|
||||||
GfxFillRect(r.left, y, r.right, y, GRAPH_GRID_COLOUR);
|
GfxFillRect(r.left, y, r.right + gridline_width - 1, y + gridline_width - 1, GRAPH_GRID_COLOUR);
|
||||||
y -= y_sep;
|
y -= y_sep;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw the y axis. */
|
/* Draw the y axis. */
|
||||||
GfxFillRect(r.left, r.top, r.left, r.bottom, GRAPH_AXIS_LINE_COLOUR);
|
GfxFillRect(r.left, r.top, r.left + gridline_width - 1, r.bottom + gridline_width - 1, GRAPH_AXIS_LINE_COLOUR);
|
||||||
|
|
||||||
/* Draw the x axis. */
|
/* Draw the x axis. */
|
||||||
y = x_axis_offset + r.top;
|
y = x_axis_offset + r.top;
|
||||||
GfxFillRect(r.left, y, r.right, y, GRAPH_ZERO_LINE_COLOUR);
|
GfxFillRect(r.left, y, r.right + gridline_width - 1, y + gridline_width - 1, GRAPH_ZERO_LINE_COLOUR);
|
||||||
|
|
||||||
/* Find the largest value that will be drawn. */
|
/* Find the largest value that will be drawn. */
|
||||||
if (this->num_on_x_axis == 0) return;
|
if (this->num_on_x_axis == 0) return;
|
||||||
|
@ -471,7 +482,7 @@ protected:
|
||||||
year++;
|
year++;
|
||||||
|
|
||||||
/* Draw a lighter grid line between years. Top and bottom adjustments ensure we don't draw over top and bottom horizontal grid lines. */
|
/* 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 + 1, x + x_sep, r.bottom - 1, GRAPH_YEAR_LINE_COLOUR);
|
GfxFillRect(x + x_sep, r.top + gridline_width, x + x_sep + gridline_width - 1, r.bottom - 1, GRAPH_YEAR_LINE_COLOUR);
|
||||||
}
|
}
|
||||||
x += x_sep;
|
x += x_sep;
|
||||||
}
|
}
|
||||||
|
@ -499,10 +510,11 @@ protected:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* draw lines and dots */
|
/* Draw lines and dots. */
|
||||||
uint linewidth = _settings_client.gui.graph_line_thickness;
|
uint linewidth = ScaleGUITrad(_settings_client.gui.graph_line_thickness);
|
||||||
uint pointoffs1 = (linewidth + 1) / 2;
|
uint pointwidth = ScaleGUITrad(_settings_client.gui.graph_line_thickness + 1);
|
||||||
uint pointoffs2 = linewidth + 1 - pointoffs1;
|
uint pointoffs1 = pointwidth / 2;
|
||||||
|
uint pointoffs2 = pointwidth - pointoffs1;
|
||||||
|
|
||||||
auto draw_dataset = [&](const DataSet &dataset, uint8_t colour) {
|
auto draw_dataset = [&](const DataSet &dataset, uint8_t colour) {
|
||||||
if (HasBit(this->excluded_data, dataset.exclude_bit)) return;
|
if (HasBit(this->excluded_data, dataset.exclude_bit)) return;
|
||||||
|
@ -1661,24 +1673,22 @@ struct IndustryProductionGraphWindow : BaseCargoGraphWindow {
|
||||||
if (!IsValidCargoType(p.cargo)) continue;
|
if (!IsValidCargoType(p.cargo)) continue;
|
||||||
const CargoSpec *cs = CargoSpec::Get(p.cargo);
|
const CargoSpec *cs = CargoSpec::Get(p.cargo);
|
||||||
|
|
||||||
|
this->data.reserve(this->data.size() + 2);
|
||||||
|
|
||||||
DataSet &produced = this->data.emplace_back();
|
DataSet &produced = this->data.emplace_back();
|
||||||
produced.colour = cs->legend_colour;
|
produced.colour = cs->legend_colour;
|
||||||
produced.exclude_bit = cs->Index();
|
produced.exclude_bit = cs->Index();
|
||||||
produced.range_bit = 0;
|
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();
|
DataSet &transported = this->data.emplace_back();
|
||||||
transported.colour = cs->legend_colour;
|
transported.colour = cs->legend_colour;
|
||||||
transported.exclude_bit = cs->Index();
|
transported.exclude_bit = cs->Index();
|
||||||
transported.range_bit = 1;
|
transported.range_bit = 1;
|
||||||
transported.dash = 2;
|
transported.dash = 2;
|
||||||
|
auto transported_filler = Filler{transported, &Industry::ProducedHistory::transported};
|
||||||
|
|
||||||
for (uint j = 0; j < GRAPH_NUM_MONTHS; j++) {
|
FillFromHistory<GRAPH_NUM_MONTHS>(p.history, i->valid_history, produced_filler, transported_filler);
|
||||||
transported.values[j] = p.history[GRAPH_NUM_MONTHS - j].transported;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#define INDUSTRY_H
|
#define INDUSTRY_H
|
||||||
|
|
||||||
#include "core/flatset_type.hpp"
|
#include "core/flatset_type.hpp"
|
||||||
|
#include "misc/history_type.hpp"
|
||||||
#include "newgrf_storage.h"
|
#include "newgrf_storage.h"
|
||||||
#include "subsidy_type.h"
|
#include "subsidy_type.h"
|
||||||
#include "industry_map.h"
|
#include "industry_map.h"
|
||||||
|
@ -55,9 +56,6 @@ enum class IndustryControlFlag : uint8_t {
|
||||||
};
|
};
|
||||||
using IndustryControlFlags = EnumBitSet<IndustryControlFlag, uint8_t, IndustryControlFlag::End>;
|
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.
|
* Defines the internal data of a functional industry.
|
||||||
*/
|
*/
|
||||||
|
@ -72,12 +70,11 @@ struct Industry : IndustryPool::PoolItem<&_industry_pool> {
|
||||||
return ClampTo<uint8_t>(this->transported * 256 / this->production);
|
return ClampTo<uint8_t>(this->transported * 256 / this->production);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ProducedCargo {
|
struct ProducedCargo {
|
||||||
CargoType cargo = 0; ///< Cargo type
|
CargoType cargo = 0; ///< Cargo type
|
||||||
uint16_t waiting = 0; ///< Amount of cargo produced
|
uint16_t waiting = 0; ///< Amount of cargo produced
|
||||||
uint8_t rate = 0; ///< Production rate
|
uint8_t rate = 0; ///< Production rate
|
||||||
std::array<ProducedHistory, 25> history{}; ///< History of cargo produced and transported for this month and 24 previous months
|
HistoryData<ProducedHistory> history{}; ///< History of cargo produced and transported for this month and 24 previous months
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AcceptedCargo {
|
struct AcceptedCargo {
|
||||||
|
@ -92,6 +89,7 @@ struct Industry : IndustryPool::PoolItem<&_industry_pool> {
|
||||||
TileArea location{INVALID_TILE, 0, 0}; ///< Location of the industry
|
TileArea location{INVALID_TILE, 0, 0}; ///< Location of the industry
|
||||||
Town *town = nullptr; ///< Nearest town
|
Town *town = nullptr; ///< Nearest town
|
||||||
Station *neutral_station = nullptr; ///< Associated neutral station
|
Station *neutral_station = nullptr; ///< Associated neutral station
|
||||||
|
ValidHistoryMask valid_history = 0; ///< Mask of valid history records.
|
||||||
ProducedCargoes produced{}; ///< produced cargo slots
|
ProducedCargoes produced{}; ///< produced cargo slots
|
||||||
AcceptedCargoes accepted{}; ///< accepted cargo slots
|
AcceptedCargoes accepted{}; ///< accepted cargo slots
|
||||||
uint8_t prod_level = 0; ///< general production level
|
uint8_t prod_level = 0; ///< general production level
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
/** @file industry_cmd.cpp Handling of industry tiles. */
|
/** @file industry_cmd.cpp Handling of industry tiles. */
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include "misc/history_type.hpp"
|
||||||
|
#include "misc/history_func.hpp"
|
||||||
#include "clear_map.h"
|
#include "clear_map.h"
|
||||||
#include "industry.h"
|
#include "industry.h"
|
||||||
#include "station_base.h"
|
#include "station_base.h"
|
||||||
|
@ -1829,6 +1831,8 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
|
||||||
for (auto &p : i->produced) {
|
for (auto &p : i->produced) {
|
||||||
p.history[LAST_MONTH].production += ScaleByCargoScale(p.rate * 8, false);
|
p.history[LAST_MONTH].production += ScaleByCargoScale(p.rate * 8, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateValidHistory(i->valid_history);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (indspec->callback_mask.Test(IndustryCallbackMask::DecideColour)) {
|
if (indspec->callback_mask.Test(IndustryCallbackMask::DecideColour)) {
|
||||||
|
@ -2486,14 +2490,13 @@ void GenerateIndustries()
|
||||||
*/
|
*/
|
||||||
static void UpdateIndustryStatistics(Industry *i)
|
static void UpdateIndustryStatistics(Industry *i)
|
||||||
{
|
{
|
||||||
|
UpdateValidHistory(i->valid_history);
|
||||||
|
|
||||||
for (auto &p : i->produced) {
|
for (auto &p : i->produced) {
|
||||||
if (IsValidCargoType(p.cargo)) {
|
if (IsValidCargoType(p.cargo)) {
|
||||||
if (p.history[THIS_MONTH].production != 0) i->last_prod_year = TimerGameEconomy::year;
|
if (p.history[THIS_MONTH].production != 0) i->last_prod_year = TimerGameEconomy::year;
|
||||||
|
|
||||||
/* Move history from this month to last month. */
|
RotateHistory(p.history);
|
||||||
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,6 +268,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}ano{
|
||||||
STR_UNITS_PERIODS :{NUM}{NBSP}período{P "" s}
|
STR_UNITS_PERIODS :{NUM}{NBSP}período{P "" s}
|
||||||
|
|
||||||
STR_LIST_SEPARATOR :,{SPACE}
|
STR_LIST_SEPARATOR :,{SPACE}
|
||||||
|
STR_TRUNCATION_ELLIPSIS :...
|
||||||
|
|
||||||
# Common window strings
|
# Common window strings
|
||||||
STR_LIST_FILTER_TITLE :{BLACK}Filtro:
|
STR_LIST_FILTER_TITLE :{BLACK}Filtro:
|
||||||
|
|
|
@ -267,6 +267,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}jaar
|
||||||
STR_UNITS_PERIODS :{NUM}{NBSP}period{P "" en}
|
STR_UNITS_PERIODS :{NUM}{NBSP}period{P "" en}
|
||||||
|
|
||||||
STR_LIST_SEPARATOR :,{SPACE}
|
STR_LIST_SEPARATOR :,{SPACE}
|
||||||
|
STR_TRUNCATION_ELLIPSIS :...
|
||||||
|
|
||||||
# Common window strings
|
# Common window strings
|
||||||
STR_LIST_FILTER_TITLE :{BLACK}Filter:
|
STR_LIST_FILTER_TITLE :{BLACK}Filter:
|
||||||
|
|
|
@ -267,6 +267,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}year
|
||||||
STR_UNITS_PERIODS :{NUM}{NBSP}period{P "" s}
|
STR_UNITS_PERIODS :{NUM}{NBSP}period{P "" s}
|
||||||
|
|
||||||
STR_LIST_SEPARATOR :,{SPACE}
|
STR_LIST_SEPARATOR :,{SPACE}
|
||||||
|
STR_TRUNCATION_ELLIPSIS :...
|
||||||
|
|
||||||
# Common window strings
|
# Common window strings
|
||||||
STR_LIST_FILTER_TITLE :{BLACK}Filter:
|
STR_LIST_FILTER_TITLE :{BLACK}Filter:
|
||||||
|
|
|
@ -267,6 +267,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}year
|
||||||
STR_UNITS_PERIODS :{NUM}{NBSP}period{P "" s}
|
STR_UNITS_PERIODS :{NUM}{NBSP}period{P "" s}
|
||||||
|
|
||||||
STR_LIST_SEPARATOR :,{SPACE}
|
STR_LIST_SEPARATOR :,{SPACE}
|
||||||
|
STR_TRUNCATION_ELLIPSIS :...
|
||||||
|
|
||||||
# Common window strings
|
# Common window strings
|
||||||
STR_LIST_FILTER_TITLE :{BLACK}Filter:
|
STR_LIST_FILTER_TITLE :{BLACK}Filter:
|
||||||
|
|
|
@ -267,6 +267,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}year
|
||||||
STR_UNITS_PERIODS :{NUM}{NBSP}period{P "" s}
|
STR_UNITS_PERIODS :{NUM}{NBSP}period{P "" s}
|
||||||
|
|
||||||
STR_LIST_SEPARATOR :,{SPACE}
|
STR_LIST_SEPARATOR :,{SPACE}
|
||||||
|
STR_TRUNCATION_ELLIPSIS :...
|
||||||
|
|
||||||
# Common window strings
|
# Common window strings
|
||||||
STR_LIST_FILTER_TITLE :{BLACK}Filter:
|
STR_LIST_FILTER_TITLE :{BLACK}Filter:
|
||||||
|
|
|
@ -267,6 +267,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}vuo{
|
||||||
STR_UNITS_PERIODS :{NUM}{NBSP}jakso{P "" a}
|
STR_UNITS_PERIODS :{NUM}{NBSP}jakso{P "" a}
|
||||||
|
|
||||||
STR_LIST_SEPARATOR :,{SPACE}
|
STR_LIST_SEPARATOR :,{SPACE}
|
||||||
|
STR_TRUNCATION_ELLIPSIS :…
|
||||||
|
|
||||||
# Common window strings
|
# Common window strings
|
||||||
STR_LIST_FILTER_TITLE :{BLACK}Suodatin:
|
STR_LIST_FILTER_TITLE :{BLACK}Suodatin:
|
||||||
|
|
|
@ -268,6 +268,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}ano{
|
||||||
STR_UNITS_PERIODS :{NUM}{NBSP}período{P "" s}
|
STR_UNITS_PERIODS :{NUM}{NBSP}período{P "" s}
|
||||||
|
|
||||||
STR_LIST_SEPARATOR :,{SPACE}
|
STR_LIST_SEPARATOR :,{SPACE}
|
||||||
|
STR_TRUNCATION_ELLIPSIS :...
|
||||||
|
|
||||||
# Common window strings
|
# Common window strings
|
||||||
STR_LIST_FILTER_TITLE :{BLACK}Filtrar:
|
STR_LIST_FILTER_TITLE :{BLACK}Filtrar:
|
||||||
|
@ -1302,6 +1303,9 @@ 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 :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
|
STR_CONFIG_SETTING_RUNNING_COSTS_HELPTEXT :Establece o nivel de mantemento e custo de operación de vehículos e infraestrutura
|
||||||
###length 3
|
###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 :Velocidade de construción: {STRING}
|
||||||
STR_CONFIG_SETTING_CONSTRUCTION_SPEED_HELPTEXT :Limita a cantidade de accións construtivas das IAs
|
STR_CONFIG_SETTING_CONSTRUCTION_SPEED_HELPTEXT :Limita a cantidade de accións construtivas das IAs
|
||||||
|
@ -1324,6 +1328,9 @@ STR_CONFIG_SETTING_SUBSIDY_DURATION_DISABLED :Sen subvención
|
||||||
STR_CONFIG_SETTING_CONSTRUCTION_COSTS :Custos de construción: {STRING}
|
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
|
STR_CONFIG_SETTING_CONSTRUCTION_COSTS_HELPTEXT :Fixa o nivel de custos de construción e compra
|
||||||
###length 3
|
###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 :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)
|
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)
|
||||||
|
@ -2079,9 +2086,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 :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
|
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
|
###length 3
|
||||||
STR_CONFIG_SETTING_DISTRIBUTION_MANUAL :manual
|
STR_CONFIG_SETTING_DISTRIBUTION_MANUAL :Manual
|
||||||
STR_CONFIG_SETTING_DISTRIBUTION_ASYMMETRIC :asimétrica
|
STR_CONFIG_SETTING_DISTRIBUTION_ASYMMETRIC :Asimétrica
|
||||||
STR_CONFIG_SETTING_DISTRIBUTION_SYMMETRIC :simétrica
|
STR_CONFIG_SETTING_DISTRIBUTION_SYMMETRIC :Simétrica
|
||||||
|
|
||||||
STR_CONFIG_SETTING_LINKGRAPH_ACCURACY :Precisión da distribución: {STRING}
|
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
|
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,6 +329,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}έτ
|
||||||
STR_UNITS_PERIODS :{NUM}{NBSP}περίοδ{P 0 ος οι}
|
STR_UNITS_PERIODS :{NUM}{NBSP}περίοδ{P 0 ος οι}
|
||||||
|
|
||||||
STR_LIST_SEPARATOR :,{SPACE}
|
STR_LIST_SEPARATOR :,{SPACE}
|
||||||
|
STR_TRUNCATION_ELLIPSIS :...
|
||||||
|
|
||||||
# Common window strings
|
# Common window strings
|
||||||
STR_LIST_FILTER_TITLE :{BLACK}Φιλτράρισμα λίστας:
|
STR_LIST_FILTER_TITLE :{BLACK}Φιλτράρισμα λίστας:
|
||||||
|
|
|
@ -268,6 +268,7 @@ STR_UNITS_YEARS :{NUM}년
|
||||||
STR_UNITS_PERIODS :{NUM}기간
|
STR_UNITS_PERIODS :{NUM}기간
|
||||||
|
|
||||||
STR_LIST_SEPARATOR :,{SPACE}
|
STR_LIST_SEPARATOR :,{SPACE}
|
||||||
|
STR_TRUNCATION_ELLIPSIS :…
|
||||||
|
|
||||||
# Common window strings
|
# Common window strings
|
||||||
STR_LIST_FILTER_TITLE :{BLACK}검색:
|
STR_LIST_FILTER_TITLE :{BLACK}검색:
|
||||||
|
|
|
@ -646,6 +646,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}{P r
|
||||||
STR_UNITS_PERIODS :{NUM}{NBSP}okres{P "" y ów}
|
STR_UNITS_PERIODS :{NUM}{NBSP}okres{P "" y ów}
|
||||||
|
|
||||||
STR_LIST_SEPARATOR :,{SPACE}
|
STR_LIST_SEPARATOR :,{SPACE}
|
||||||
|
STR_TRUNCATION_ELLIPSIS :...
|
||||||
|
|
||||||
# Common window strings
|
# Common window strings
|
||||||
STR_LIST_FILTER_TITLE :{BLACK}Filtr:
|
STR_LIST_FILTER_TITLE :{BLACK}Filtr:
|
||||||
|
|
|
@ -268,6 +268,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}ano{
|
||||||
STR_UNITS_PERIODS :{NUM}{NBSP}período{P "" s}
|
STR_UNITS_PERIODS :{NUM}{NBSP}período{P "" s}
|
||||||
|
|
||||||
STR_LIST_SEPARATOR :,{SPACE}
|
STR_LIST_SEPARATOR :,{SPACE}
|
||||||
|
STR_TRUNCATION_ELLIPSIS :...
|
||||||
|
|
||||||
# Common window strings
|
# Common window strings
|
||||||
STR_LIST_FILTER_TITLE :{BLACK}Filtro:
|
STR_LIST_FILTER_TITLE :{BLACK}Filtro:
|
||||||
|
@ -738,7 +739,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)
|
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
|
# Highscore window
|
||||||
STR_HIGHSCORE_TOP_COMPANIES :{BIG_FONT}{BLACK}Melhores empresas
|
STR_HIGHSCORE_TOP_COMPANIES :{BIG_FONT}{BLACK}As melhores empresas
|
||||||
STR_HIGHSCORE_POSITION :{BIG_FONT}{BLACK}{COMMA}.
|
STR_HIGHSCORE_POSITION :{BIG_FONT}{BLACK}{COMMA}.
|
||||||
STR_HIGHSCORE_PERFORMANCE_TITLE_BUSINESSMAN :Negociante
|
STR_HIGHSCORE_PERFORMANCE_TITLE_BUSINESSMAN :Negociante
|
||||||
STR_HIGHSCORE_PERFORMANCE_TITLE_ENTREPRENEUR :Empresário
|
STR_HIGHSCORE_PERFORMANCE_TITLE_ENTREPRENEUR :Empresário
|
||||||
|
@ -748,7 +749,7 @@ STR_HIGHSCORE_PERFORMANCE_TITLE_MAGNATE :Magnata
|
||||||
STR_HIGHSCORE_PERFORMANCE_TITLE_MOGUL :Grande magnata
|
STR_HIGHSCORE_PERFORMANCE_TITLE_MOGUL :Grande magnata
|
||||||
STR_HIGHSCORE_PERFORMANCE_TITLE_TYCOON_OF_THE_CENTURY :Magnata do século
|
STR_HIGHSCORE_PERFORMANCE_TITLE_TYCOON_OF_THE_CENTURY :Magnata do século
|
||||||
STR_HIGHSCORE_NAME :{PRESIDENT_NAME}, {COMPANY}
|
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_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}'!
|
STR_HIGHSCORE_PRESIDENT_OF_COMPANY_ACHIEVES_STATUS :{BIG_FONT}{WHITE}{PRESIDENT_NAME} de {COMPANY} conquista o estatuto de '{STRING}'!
|
||||||
|
|
||||||
|
@ -3116,8 +3117,8 @@ STR_INDUSTRY_CARGOES_SELECT_INDUSTRY_TOOLTIP :{BLACK}Selecion
|
||||||
# Land area window
|
# Land area window
|
||||||
STR_LAND_AREA_INFORMATION_CAPTION :{WHITE}Informações do Terreno
|
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_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 para limpar: {LTBLUE}N/D
|
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 para limpar: {RED}{CURRENCY_LONG}
|
STR_LAND_AREA_INFORMATION_COST_TO_CLEAR :{BLACK}Custo de desobstrução: {RED}{CURRENCY_LONG}
|
||||||
STR_LAND_AREA_INFORMATION_REVENUE_WHEN_CLEARED :{BLACK}Receitas apuradas: {LTBLUE}{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_N_A :N/D
|
||||||
STR_LAND_AREA_INFORMATION_OWNER :{BLACK}Proprietário: {LTBLUE}{STRING}
|
STR_LAND_AREA_INFORMATION_OWNER :{BLACK}Proprietário: {LTBLUE}{STRING}
|
||||||
|
@ -3125,7 +3126,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_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_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 :{BLACK}Autoridade local: {LTBLUE}{STRING}
|
||||||
STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY_NONE :Nenhum
|
STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY_NONE :Nenhuma
|
||||||
STR_LAND_AREA_INFORMATION_LANDINFO_COORDS :{BLACK}Coordenadas: {LTBLUE}{NUM} x {NUM} x {NUM}
|
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_LANDINFO_INDEX :{BLACK}Índice do mosaico: {LTBLUE}{NUM} ({HEX})
|
||||||
STR_LAND_AREA_INFORMATION_BUILD_DATE :{BLACK}Construído/renovado: {LTBLUE}{DATE_LONG}
|
STR_LAND_AREA_INFORMATION_BUILD_DATE :{BLACK}Construído/renovado: {LTBLUE}{DATE_LONG}
|
||||||
|
@ -3684,9 +3685,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_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_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_CARGO_FOR_TOWNGROWTH_DELIVERED :{ORANGE}{CARGO_TINY} / {CARGO_LONG}{GREEN} (entregue)
|
||||||
STR_TOWN_VIEW_TOWN_GROWS_EVERY :{BLACK}Localidade cresce a cada {ORANGE}{UNITS_DAYS_OR_SECONDS}
|
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}Localidade cresce a cada {ORANGE}{UNITS_DAYS_OR_SECONDS} (financiada)
|
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}Localidade {RED}não{BLACK} está a crescer
|
STR_TOWN_VIEW_TOWN_GROW_STOPPED :{BLACK}A 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_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_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
|
STR_TOWN_VIEW_LOCAL_AUTHORITY_BUTTON :{BLACK}Autoridade Local
|
||||||
|
@ -3699,8 +3700,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_BUILDINGS_TOOLTIP :{BLACK}Aumentar os edifícios da localidade
|
||||||
STR_TOWN_VIEW_EXPAND_ROADS_BUTTON :{BLACK}Expandir estradas
|
STR_TOWN_VIEW_EXPAND_ROADS_BUTTON :{BLACK}Expandir estradas
|
||||||
STR_TOWN_VIEW_EXPAND_ROADS_TOOLTIP :{BLACK}Aumentar as estradas da localidade
|
STR_TOWN_VIEW_EXPAND_ROADS_TOOLTIP :{BLACK}Aumentar as estradas da localidade
|
||||||
STR_TOWN_VIEW_DELETE_BUTTON :{BLACK}Apagar
|
STR_TOWN_VIEW_DELETE_BUTTON :{BLACK}Remover
|
||||||
STR_TOWN_VIEW_DELETE_TOOLTIP :{BLACK}Apagar completamente esta localidade
|
STR_TOWN_VIEW_DELETE_TOOLTIP :{BLACK}Remover completamente esta localidade
|
||||||
|
|
||||||
STR_TOWN_VIEW_RENAME_TOWN_BUTTON :Renomear Localidade
|
STR_TOWN_VIEW_RENAME_TOWN_BUTTON :Renomear Localidade
|
||||||
|
|
||||||
|
@ -3854,12 +3855,12 @@ STR_STATION_VIEW_VIA_HERE :{GREEN}{CARGO_S
|
||||||
STR_STATION_VIEW_TO_HERE :{GREEN}{CARGO_SHORT} para esta estação
|
STR_STATION_VIEW_TO_HERE :{GREEN}{CARGO_SHORT} para esta estação
|
||||||
STR_STATION_VIEW_NONSTOP :{YELLOW}{CARGO_SHORT} sem parar
|
STR_STATION_VIEW_NONSTOP :{YELLOW}{CARGO_SHORT} sem parar
|
||||||
|
|
||||||
STR_STATION_VIEW_GROUP_S_V_D :Fonte-Via-Destino
|
STR_STATION_VIEW_GROUP_S_V_D :Origem-Via-Destino
|
||||||
STR_STATION_VIEW_GROUP_S_D_V :Fonte-Destino-Via
|
STR_STATION_VIEW_GROUP_S_D_V :Origem-Destino-Via
|
||||||
STR_STATION_VIEW_GROUP_V_S_D :Via-Fonte-Destino
|
STR_STATION_VIEW_GROUP_V_S_D :Via-Origem-Destino
|
||||||
STR_STATION_VIEW_GROUP_V_D_S :Via-Destino-Fonte
|
STR_STATION_VIEW_GROUP_V_D_S :Via-Destino-Origem
|
||||||
STR_STATION_VIEW_GROUP_D_S_V :Destino-Fonte-Via
|
STR_STATION_VIEW_GROUP_D_S_V :Destino-Origem-Via
|
||||||
STR_STATION_VIEW_GROUP_D_V_S :Destino-Via-Fonte
|
STR_STATION_VIEW_GROUP_D_V_S :Destino-Via-Origem
|
||||||
|
|
||||||
###length 8
|
###length 8
|
||||||
STR_CARGO_RATING_APPALLING :Inexistente
|
STR_CARGO_RATING_APPALLING :Inexistente
|
||||||
|
@ -3942,7 +3943,7 @@ STR_FINANCES_INFRASTRUCTURE_BUTTON :{BLACK}Infraest
|
||||||
STR_COMPANY_VIEW_CAPTION :{WHITE}{COMPANY} {BLACK}{COMPANY_NUM}
|
STR_COMPANY_VIEW_CAPTION :{WHITE}{COMPANY} {BLACK}{COMPANY_NUM}
|
||||||
STR_COMPANY_VIEW_PRESIDENT_MANAGER_TITLE :{WHITE}{PRESIDENT_NAME}{}{GOLD}(Presidente)
|
STR_COMPANY_VIEW_PRESIDENT_MANAGER_TITLE :{WHITE}{PRESIDENT_NAME}{}{GOLD}(Presidente)
|
||||||
|
|
||||||
STR_COMPANY_VIEW_INAUGURATED_TITLE :{GOLD}Inaugurado: {WHITE}{NUM}
|
STR_COMPANY_VIEW_INAUGURATED_TITLE :{GOLD}Inaugurada em: {WHITE}{NUM}
|
||||||
STR_COMPANY_VIEW_INAUGURATED_TITLE_WALLCLOCK :{GOLD}Inaugurada: {WHITE}{NUM} (período {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_COLOUR_SCHEME_TITLE :{GOLD}Cores:
|
||||||
STR_COMPANY_VIEW_VEHICLES_TITLE :{GOLD}Veículos:
|
STR_COMPANY_VIEW_VEHICLES_TITLE :{GOLD}Veículos:
|
||||||
|
|
|
@ -393,6 +393,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}{P
|
||||||
STR_UNITS_PERIODS :{NUM}{NBSP}цикл{P "" а ов}
|
STR_UNITS_PERIODS :{NUM}{NBSP}цикл{P "" а ов}
|
||||||
|
|
||||||
STR_LIST_SEPARATOR :,{SPACE}
|
STR_LIST_SEPARATOR :,{SPACE}
|
||||||
|
STR_TRUNCATION_ELLIPSIS :...
|
||||||
|
|
||||||
# Common window strings
|
# Common window strings
|
||||||
STR_LIST_FILTER_TITLE :{BLACK}Фильтр:
|
STR_LIST_FILTER_TITLE :{BLACK}Фильтр:
|
||||||
|
|
|
@ -267,6 +267,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}年
|
||||||
STR_UNITS_PERIODS :{NUM}{NBSP}个周期
|
STR_UNITS_PERIODS :{NUM}{NBSP}个周期
|
||||||
|
|
||||||
STR_LIST_SEPARATOR :、
|
STR_LIST_SEPARATOR :、
|
||||||
|
STR_TRUNCATION_ELLIPSIS :…
|
||||||
|
|
||||||
# Common window strings
|
# Common window strings
|
||||||
STR_LIST_FILTER_TITLE :{BLACK}搜索:
|
STR_LIST_FILTER_TITLE :{BLACK}搜索:
|
||||||
|
|
|
@ -268,6 +268,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}año
|
||||||
STR_UNITS_PERIODS :{NUM}{NBSP}período{P "" s}
|
STR_UNITS_PERIODS :{NUM}{NBSP}período{P "" s}
|
||||||
|
|
||||||
STR_LIST_SEPARATOR :,{SPACE}
|
STR_LIST_SEPARATOR :,{SPACE}
|
||||||
|
STR_TRUNCATION_ELLIPSIS :...
|
||||||
|
|
||||||
# Common window strings
|
# Common window strings
|
||||||
STR_LIST_FILTER_TITLE :{BLACK}Filtrar:
|
STR_LIST_FILTER_TITLE :{BLACK}Filtrar:
|
||||||
|
|
|
@ -267,6 +267,7 @@ STR_UNITS_YEARS :{NUM}{NBSP}年
|
||||||
STR_UNITS_PERIODS :{NUM}{NBSP}個週期
|
STR_UNITS_PERIODS :{NUM}{NBSP}個週期
|
||||||
|
|
||||||
STR_LIST_SEPARATOR :、
|
STR_LIST_SEPARATOR :、
|
||||||
|
STR_TRUNCATION_ELLIPSIS :……
|
||||||
|
|
||||||
# Common window strings
|
# Common window strings
|
||||||
STR_LIST_FILTER_TITLE :{BLACK}篩選:
|
STR_LIST_FILTER_TITLE :{BLACK}篩選:
|
||||||
|
|
|
@ -8,5 +8,7 @@ add_files(
|
||||||
getoptdata.cpp
|
getoptdata.cpp
|
||||||
getoptdata.h
|
getoptdata.h
|
||||||
hashtable.hpp
|
hashtable.hpp
|
||||||
|
history_func.hpp
|
||||||
|
history_type.hpp
|
||||||
lrucache.hpp
|
lrucache.hpp
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
* 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 */
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* 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,6 +162,8 @@ static const SaveLoad _industry_desc[] = {
|
||||||
SLE_CONDVAR(Industry, random, SLE_UINT16, SLV_82, SL_MAX_VERSION),
|
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_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("accepted", SlIndustryAccepted, SLV_INDUSTRY_CARGO_REORGANISE, SL_MAX_VERSION),
|
||||||
SLEG_CONDSTRUCTLIST("produced", SlIndustryProduced, SLV_INDUSTRY_CARGO_REORGANISE, SL_MAX_VERSION),
|
SLEG_CONDSTRUCTLIST("produced", SlIndustryProduced, SLV_INDUSTRY_CARGO_REORGANISE, SL_MAX_VERSION),
|
||||||
};
|
};
|
||||||
|
@ -228,6 +230,24 @@ struct INDYChunkHandler : ChunkHandler {
|
||||||
} else if (IsSavegameVersionBefore(SLV_INDUSTRY_CARGO_REORGANISE)) {
|
} else if (IsSavegameVersionBefore(SLV_INDUSTRY_CARGO_REORGANISE)) {
|
||||||
LoadMoveAcceptsProduced(i, INDUSTRY_NUM_INPUTS, INDUSTRY_NUM_OUTPUTS);
|
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);
|
Industry::industries[i->type].insert(i->index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -404,6 +404,7 @@ enum SaveLoadVersion : uint16_t {
|
||||||
SLV_ORDERS_OWNED_BY_ORDERLIST, ///< 354 PR#13948 Orders stored in OrderList, pool removed.
|
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_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
|
SL_MAX_VERSION, ///< Highest possible saveload version
|
||||||
};
|
};
|
||||||
|
|
|
@ -667,6 +667,15 @@ 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.
|
* Pre-callback check when trying to change the timetable mode. This is locked to Seconds when using wallclock units.
|
||||||
* @param Unused.
|
* @param Unused.
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include "table/sprites.h"
|
#include "table/sprites.h"
|
||||||
|
|
||||||
struct SpriteBounds {
|
struct SpriteBounds {
|
||||||
PointXyz<int8_t> origin; ///< Position of orthern corner within tile.
|
PointXyz<int8_t> origin; ///< Position of northern corner within tile.
|
||||||
PointXyz<uint8_t> extent; ///< Size of bounding box.
|
PointXyz<uint8_t> extent; ///< Size of bounding box.
|
||||||
PointXyz<int8_t> offset; ///< Relative position of sprite from 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) {
|
if (sprite_type == SpriteType::Font && _font_zoom != ZoomLevel::Min) {
|
||||||
/* Make ZoomLevel::Min be ZOOM_LVL_GUI */
|
/* Make ZoomLevel::Min the desired font zoom level. */
|
||||||
sprite[ZoomLevel::Min] = sprite[_font_zoom];
|
sprite[ZoomLevel::Min] = sprite[_font_zoom];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -286,6 +286,7 @@ struct LoadedLanguagePack {
|
||||||
std::array<uint, TEXT_TAB_END> langtab_start; ///< Offset into langpack offs
|
std::array<uint, TEXT_TAB_END> langtab_start; ///< Offset into langpack offs
|
||||||
|
|
||||||
std::string list_separator; ///< Current list separator string.
|
std::string list_separator; ///< Current list separator string.
|
||||||
|
std::string ellipsis; ///< Current ellipsis string.
|
||||||
};
|
};
|
||||||
|
|
||||||
static LoadedLanguagePack _langpack;
|
static LoadedLanguagePack _langpack;
|
||||||
|
@ -301,6 +302,15 @@ std::string_view GetListSeparator()
|
||||||
return _langpack.list_separator;
|
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)
|
std::string_view GetStringPtr(StringID string)
|
||||||
{
|
{
|
||||||
switch (GetStringTab(string)) {
|
switch (GetStringTab(string)) {
|
||||||
|
@ -2063,6 +2073,7 @@ bool ReadLanguagePack(const LanguageMetadata *lang)
|
||||||
_config_language_file = FS2OTTD(_current_language->file.filename().native());
|
_config_language_file = FS2OTTD(_current_language->file.filename().native());
|
||||||
SetCurrentGrfLangID(_current_language->newgrflangid);
|
SetCurrentGrfLangID(_current_language->newgrflangid);
|
||||||
_langpack.list_separator = GetString(STR_LIST_SEPARATOR);
|
_langpack.list_separator = GetString(STR_LIST_SEPARATOR);
|
||||||
|
_langpack.ellipsis = GetString(STR_TRUNCATION_ELLIPSIS);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
extern void Win32SetCurrentLocaleName(std::string iso_code);
|
extern void Win32SetCurrentLocaleName(std::string iso_code);
|
||||||
|
|
|
@ -98,6 +98,7 @@ extern TextDirection _current_text_dir; ///< Text direction of the currently sel
|
||||||
void InitializeLanguagePacks();
|
void InitializeLanguagePacks();
|
||||||
std::string_view GetCurrentLanguageIsoCode();
|
std::string_view GetCurrentLanguageIsoCode();
|
||||||
std::string_view GetListSeparator();
|
std::string_view GetListSeparator();
|
||||||
|
std::string_view GetEllipsis();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper to create the StringParameters with its own buffer with the given
|
* Helper to create the StringParameters with its own buffer with the given
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
static void TownFoundingChanged(int32_t new_value);
|
static void TownFoundingChanged(int32_t new_value);
|
||||||
static void ChangeTimekeepingUnits(int32_t new_value);
|
static void ChangeTimekeepingUnits(int32_t new_value);
|
||||||
static void ChangeMinutesPerYear(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};
|
static constexpr std::initializer_list<std::string_view> _place_houses{"forbidden"sv, "allowed"sv, "fully constructed"sv};
|
||||||
|
|
||||||
|
@ -332,6 +333,7 @@ strhelp = STR_CONFIG_SETTING_MINUTES_PER_YEAR_HELPTEXT
|
||||||
strval = STR_CONFIG_SETTING_MINUTES_PER_YEAR_VALUE
|
strval = STR_CONFIG_SETTING_MINUTES_PER_YEAR_VALUE
|
||||||
pre_cb = [](auto) { return _game_mode == GM_MENU || _settings_game.economy.timekeeping_units == 1; }
|
pre_cb = [](auto) { return _game_mode == GM_MENU || _settings_game.economy.timekeeping_units == 1; }
|
||||||
post_cb = ChangeMinutesPerYear
|
post_cb = ChangeMinutesPerYear
|
||||||
|
range_cb = GetMinutesPerYearRange
|
||||||
cat = SC_BASIC
|
cat = SC_BASIC
|
||||||
|
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
|
|
|
@ -1628,7 +1628,7 @@ static CargoTypes GetProducedCargoOfHouse(const HouseSpec *hs)
|
||||||
|
|
||||||
struct BuildHouseWindow : public PickerWindow {
|
struct BuildHouseWindow : public PickerWindow {
|
||||||
std::string house_info{};
|
std::string house_info{};
|
||||||
bool house_protected = false;
|
static inline bool house_protected;
|
||||||
|
|
||||||
BuildHouseWindow(WindowDesc &desc, Window *parent) : PickerWindow(desc, parent, 0, HousePickerCallbacks::instance)
|
BuildHouseWindow(WindowDesc &desc, Window *parent) : PickerWindow(desc, parent, 0, HousePickerCallbacks::instance)
|
||||||
{
|
{
|
||||||
|
@ -1735,9 +1735,9 @@ struct BuildHouseWindow : public PickerWindow {
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case WID_BH_PROTECT_OFF:
|
case WID_BH_PROTECT_OFF:
|
||||||
case WID_BH_PROTECT_ON:
|
case WID_BH_PROTECT_ON:
|
||||||
this->house_protected = (widget == WID_BH_PROTECT_ON);
|
BuildHouseWindow::house_protected = (widget == WID_BH_PROTECT_ON);
|
||||||
this->SetWidgetLoweredState(WID_BH_PROTECT_OFF, !this->house_protected);
|
this->SetWidgetLoweredState(WID_BH_PROTECT_OFF, !BuildHouseWindow::house_protected);
|
||||||
this->SetWidgetLoweredState(WID_BH_PROTECT_ON, this->house_protected);
|
this->SetWidgetLoweredState(WID_BH_PROTECT_ON, BuildHouseWindow::house_protected);
|
||||||
|
|
||||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||||
this->SetDirty();
|
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. */
|
/* If house spec already has the protected flag, handle it automatically and disable the buttons. */
|
||||||
bool hasflag = spec->extra_flags.Test(HouseExtraFlag::BuildingIsProtected);
|
bool hasflag = spec->extra_flags.Test(HouseExtraFlag::BuildingIsProtected);
|
||||||
if (hasflag) this->house_protected = true;
|
if (hasflag) BuildHouseWindow::house_protected = true;
|
||||||
|
|
||||||
this->SetWidgetLoweredState(WID_BH_PROTECT_OFF, !this->house_protected);
|
this->SetWidgetLoweredState(WID_BH_PROTECT_OFF, !BuildHouseWindow::house_protected);
|
||||||
this->SetWidgetLoweredState(WID_BH_PROTECT_ON, this->house_protected);
|
this->SetWidgetLoweredState(WID_BH_PROTECT_ON, BuildHouseWindow::house_protected);
|
||||||
|
|
||||||
this->SetWidgetDisabledState(WID_BH_PROTECT_OFF, hasflag);
|
this->SetWidgetDisabledState(WID_BH_PROTECT_OFF, hasflag);
|
||||||
this->SetWidgetDisabledState(WID_BH_PROTECT_ON, 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
|
void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override
|
||||||
{
|
{
|
||||||
const HouseSpec *spec = HouseSpec::Get(HousePickerCallbacks::sel_type);
|
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(), this->house_protected);
|
Command<CMD_PLACE_HOUSE>::Post(STR_ERROR_CAN_T_BUILD_HOUSE, CcPlaySound_CONSTRUCTION_OTHER, tile, spec->Index(), BuildHouseWindow::house_protected);
|
||||||
}
|
}
|
||||||
|
|
||||||
const IntervalTimer<TimerWindow> view_refresh_interval = {std::chrono::milliseconds(2500), [this](auto) {
|
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();
|
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, rear_sep[tunnelbridge_direction]);
|
||||||
AddSortableSpriteToDraw(SPR_EMPTY_BOUNDING_BOX, PAL_NONE, *ti, front_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();
|
const OpenGLSprite *spr = this->cursor_cache.Get(cs.image.sprite).get();
|
||||||
|
|
||||||
this->RenderOglSprite(spr, cs.image.pal,
|
this->RenderOglSprite(spr, cs.image.pal,
|
||||||
this->cursor_pos.x + cs.pos.x + UnScaleByZoom(spr->x_offs, ZOOM_LVL_GUI),
|
this->cursor_pos.x + cs.pos.x + UnScaleByZoom(spr->x_offs, _gui_zoom),
|
||||||
this->cursor_pos.y + cs.pos.y + UnScaleByZoom(spr->y_offs, ZOOM_LVL_GUI),
|
this->cursor_pos.y + cs.pos.y + UnScaleByZoom(spr->y_offs, _gui_zoom),
|
||||||
ZOOM_LVL_GUI);
|
_gui_zoom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ static std::string GetStringForWidget(const Window *w, const NWidgetCore *nwid,
|
||||||
/**
|
/**
|
||||||
* Scale a RectPadding to GUI zoom level.
|
* Scale a RectPadding to GUI zoom level.
|
||||||
* @param r RectPadding at ZOOM_BASE (traditional "normal" interface size).
|
* @param r RectPadding at ZOOM_BASE (traditional "normal" interface size).
|
||||||
* @return RectPadding at #ZOOM_LVL_GUI (current interface size).
|
* @return RectPadding at current interface size.
|
||||||
*/
|
*/
|
||||||
static inline RectPadding ScaleGUITrad(const RectPadding &r)
|
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.
|
* Scale a Dimension to GUI zoom level.
|
||||||
* @param d Dimension at ZOOM_BASE (traditional "normal" interface size).
|
* @param d Dimension at ZOOM_BASE (traditional "normal" interface size).
|
||||||
* @return Dimension at #ZOOM_LVL_GUI (current interface size).
|
* @return Dimension at current interface size.
|
||||||
*/
|
*/
|
||||||
static inline Dimension ScaleGUITrad(const Dimension &dim)
|
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.
|
* Short-hand to apply GUI zoom level.
|
||||||
* @param value Pixel amount at #ZoomLevel::Min (full zoom in).
|
* @param value Pixel amount at #ZoomLevel::Min (full zoom in).
|
||||||
* @return Pixel amount at #ZOOM_LVL_GUI (current interface size).
|
* @return Pixel amount at current interface size.
|
||||||
*/
|
*/
|
||||||
inline int UnScaleGUI(int value)
|
inline int UnScaleGUI(int value)
|
||||||
{
|
{
|
||||||
return UnScaleByZoom(value, ZOOM_LVL_GUI);
|
return UnScaleByZoom(value, _gui_zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,7 +86,7 @@ inline int UnScaleGUI(int value)
|
||||||
*/
|
*/
|
||||||
inline ZoomLevel ScaleZoomGUI(ZoomLevel value)
|
inline ZoomLevel ScaleZoomGUI(ZoomLevel value)
|
||||||
{
|
{
|
||||||
return std::clamp(value + (ZOOM_LVL_GUI - ZoomLevel::Normal), ZoomLevel::Min, ZoomLevel::Max);
|
return std::clamp(value + (_gui_zoom - ZoomLevel::Normal), ZoomLevel::Min, ZoomLevel::Max);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,13 +96,13 @@ inline ZoomLevel ScaleZoomGUI(ZoomLevel value)
|
||||||
*/
|
*/
|
||||||
inline ZoomLevel UnScaleZoomGUI(ZoomLevel value)
|
inline ZoomLevel UnScaleZoomGUI(ZoomLevel value)
|
||||||
{
|
{
|
||||||
return std::clamp(value - (ZOOM_LVL_GUI - ZoomLevel::Normal), ZoomLevel::Min, ZoomLevel::Max);
|
return std::clamp(value - (_gui_zoom - ZoomLevel::Normal), ZoomLevel::Min, ZoomLevel::Max);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scale traditional pixel dimensions to GUI zoom level, for drawing sprites.
|
* Scale traditional pixel dimensions to GUI zoom level, for drawing sprites.
|
||||||
* @param value Pixel amount at #ZOOM_BASE (traditional "normal" interface size).
|
* @param value Pixel amount at #ZOOM_BASE (traditional "normal" interface size).
|
||||||
* @return Pixel amount at #ZOOM_LVL_GUI (current interface size).
|
* @return Pixel amount at current interface size.
|
||||||
*/
|
*/
|
||||||
inline int ScaleSpriteTrad(int value)
|
inline int ScaleSpriteTrad(int value)
|
||||||
{
|
{
|
||||||
|
@ -112,7 +112,7 @@ inline int ScaleSpriteTrad(int value)
|
||||||
/**
|
/**
|
||||||
* Scale traditional pixel dimensions to GUI zoom level.
|
* Scale traditional pixel dimensions to GUI zoom level.
|
||||||
* @param value Pixel amount at #ZOOM_BASE (traditional "normal" interface size).
|
* @param value Pixel amount at #ZOOM_BASE (traditional "normal" interface size).
|
||||||
* @return Pixel amount at #ZOOM_LVL_GUI (current interface size).
|
* @return Pixel amount at current interface size.
|
||||||
*/
|
*/
|
||||||
inline int ScaleGUITrad(int value)
|
inline int ScaleGUITrad(int value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,7 +52,6 @@ extern int _gui_scale_cfg;
|
||||||
|
|
||||||
extern ZoomLevel _gui_zoom;
|
extern ZoomLevel _gui_zoom;
|
||||||
extern ZoomLevel _font_zoom;
|
extern ZoomLevel _font_zoom;
|
||||||
#define ZOOM_LVL_GUI (_gui_zoom)
|
|
||||||
|
|
||||||
static const int MIN_INTERFACE_SCALE = 100;
|
static const int MIN_INTERFACE_SCALE = 100;
|
||||||
static const int MAX_INTERFACE_SCALE = 500;
|
static const int MAX_INTERFACE_SCALE = 500;
|
||||||
|
|
Loading…
Reference in New Issue