diff --git a/src/aircraft.h b/src/aircraft.h index ab26c5268c..e97bda1d3f 100644 --- a/src/aircraft.h +++ b/src/aircraft.h @@ -45,6 +45,8 @@ enum AirVehicleFlags { * landscape at a fixed altitude. This only has effect when there are more than 15 height levels. */ VAF_IN_MAX_HEIGHT_CORRECTION = 1, ///< The vehicle is currently lowering its altitude because it hit the upper bound. VAF_IN_MIN_HEIGHT_CORRECTION = 2, ///< The vehicle is currently raising its altitude because it hit the lower bound. + + VAF_HELI_DIRECT_DESCENT = 3, ///< The helicopter is descending directly at its destination (helipad or in front of hangar) }; static const int ROTOR_Z_OFFSET = 5; ///< Z Offset between helicopter- and rotorsprite. diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index d333840dfc..fc0ccc2caa 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -933,6 +933,8 @@ static bool AircraftController(Aircraft *v) /* Helicopter landing. */ if (amd.flag & AMED_HELI_LOWER) { + SetBit(v->flags, VAF_HELI_DIRECT_DESCENT); + if (st == NULL) { /* FIXME - AircraftController -> if station no longer exists, do not land * helicopter will circle until sign disappears, then go to next order @@ -953,7 +955,10 @@ static bool AircraftController(Aircraft *v) Vehicle *u = v->Next()->Next(); /* Increase speed of rotors. When speed is 80, we've landed. */ - if (u->cur_speed >= 80) return true; + if (u->cur_speed >= 80) { + ClrBit(v->flags, VAF_HELI_DIRECT_DESCENT); + return true; + } u->cur_speed += 4; } else { count = UpdateAircraftSpeed(v); @@ -1679,6 +1684,7 @@ static void AircraftEventHandler_Flying(Aircraft *v, const AirportFTAClass *apc) uint16 tsubspeed = v->subspeed; if (!AirportHasBlock(v, current, apc)) { v->state = landingtype; // LANDING / HELILANDING + if (v->state == HELILANDING) SetBit(v->flags, VAF_HELI_DIRECT_DESCENT); /* it's a bit dirty, but I need to set position to next position, otherwise * if there are multiple runways, plane won't know which one it took (because * they all have heading LANDING). And also occupy that block! */ diff --git a/src/economy.cpp b/src/economy.cpp index 6e80495aea..79f9bd146a 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -99,7 +99,7 @@ const ScoreInfo _score_info[] = { { 0, 0} // SCORE_TOTAL }; -int _score_part[MAX_COMPANIES][SCORE_END]; +int64 _score_part[MAX_COMPANIES][SCORE_END]; Economy _economy; Prices _price; Money _additional_cash_required; @@ -187,7 +187,7 @@ int UpdateCompanyRatingAndValue(Company *c, bool update) _score_part[owner][SCORE_VEHICLES] = num; /* Don't allow negative min_profit to show */ if (min_profit > 0) { - _score_part[owner][SCORE_MIN_PROFIT] = ClampToI32(min_profit); + _score_part[owner][SCORE_MIN_PROFIT] = min_profit; } } @@ -217,10 +217,10 @@ int UpdateCompanyRatingAndValue(Company *c, bool update) } while (++cee, --numec); if (min_income > 0) { - _score_part[owner][SCORE_MIN_INCOME] = ClampToI32(min_income); + _score_part[owner][SCORE_MIN_INCOME] = min_income; } - _score_part[owner][SCORE_MAX_INCOME] = ClampToI32(max_income); + _score_part[owner][SCORE_MAX_INCOME] = max_income; } } @@ -234,7 +234,7 @@ int UpdateCompanyRatingAndValue(Company *c, bool update) total_delivered += cee->delivered_cargo.GetSum(); } while (++cee, --numec); - _score_part[owner][SCORE_DELIVERED] = ClampToI32(total_delivered); + _score_part[owner][SCORE_DELIVERED] = total_delivered; } } @@ -246,13 +246,13 @@ int UpdateCompanyRatingAndValue(Company *c, bool update) /* Generate score for company's money */ { if (c->money > 0) { - _score_part[owner][SCORE_MONEY] = ClampToI32(c->money); + _score_part[owner][SCORE_MONEY] = c->money; } } /* Generate score for loan */ { - _score_part[owner][SCORE_LOAN] = ClampToI32(_score_info[SCORE_LOAN].needed - c->current_loan); + _score_part[owner][SCORE_LOAN] = _score_info[SCORE_LOAN].needed - c->current_loan; } /* Now we calculate the score for each item.. */ diff --git a/src/economy_func.h b/src/economy_func.h index 111ce85a27..7b369b7d60 100644 --- a/src/economy_func.h +++ b/src/economy_func.h @@ -22,7 +22,7 @@ void ResetPriceBaseMultipliers(); void SetPriceBaseMultiplier(Price price, int factor); extern const ScoreInfo _score_info[]; -extern int _score_part[MAX_COMPANIES][SCORE_END]; +extern int64 _score_part[MAX_COMPANIES][SCORE_END]; extern Economy _economy; /* Prices and also the fractional part. */ extern Prices _price; diff --git a/src/fios.h b/src/fios.h index c954c5c83c..f937972d61 100644 --- a/src/fios.h +++ b/src/fios.h @@ -18,6 +18,13 @@ #include "network/core/tcp_content.h" +/** Special values for save-load window for the data parameter of #InvalidateWindowData. */ +enum SaveLoadInvalidateWindowData { + SLIWD_RESCAN_FILES, ///< Rescan all files (when changed directory, ...) + SLIWD_SELECTION_CHANGES, ///< File selection has changed (user click, ...) + SLIWD_FILTER_CHANGES, ///< The filename filter has changed (via the editbox) +}; + typedef SmallMap CompanyPropertiesMap; /** diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index 9aa5277acf..e149d07b47 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -28,6 +28,7 @@ #include "date_func.h" #include "core/geometry_func.hpp" #include "gamelog.h" +#include "stringfilter_type.h" #include "widgets/fios_widget.h" @@ -76,9 +77,20 @@ static const NWidgetPart _nested_load_dialog_widgets[] = { NWidget(WWT_CAPTION, COLOUR_GREY, WID_SL_CAPTION), NWidget(WWT_DEFSIZEBOX, COLOUR_GREY), EndContainer(), + /* Current directory and free space */ NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_BACKGROUND), SetFill(1, 0), SetResize(1, 0), EndContainer(), + NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(NWID_VERTICAL), + /* Left side : filter box and available files */ + NWidget(WWT_PANEL, COLOUR_GREY), SetFill(1, 1), SetResize(1, 1), + /* Filter box with label */ + NWidget(NWID_HORIZONTAL), SetPadding(WD_FRAMERECT_TOP, 0, WD_FRAMERECT_BOTTOM, 0), + SetPIP(WD_FRAMETEXT_LEFT, WD_FRAMETEXT_RIGHT, 0), + NWidget(WWT_TEXT, COLOUR_GREY), SetFill(0, 1), SetDataTip(STR_SAVELOAD_FILTER_TITLE , STR_NULL), + NWidget(WWT_EDITBOX, COLOUR_GREY, WID_SL_FILTER), SetFill(1, 0), SetMinimalSize(50, 12), SetResize(1, 0), + SetDataTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP), + EndContainer(), + /* Sort buttons */ NWidget(NWID_HORIZONTAL), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_SORT_BYNAME), SetDataTip(STR_SORT_BY_CAPTION_NAME, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0), @@ -86,6 +98,7 @@ static const NWidgetPart _nested_load_dialog_widgets[] = { EndContainer(), NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_SL_HOME_BUTTON), SetMinimalSize(12, 12), SetDataTip(SPR_HOUSE_ICON, STR_SAVELOAD_HOME_BUTTON), EndContainer(), + /* Files */ NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_FILE_BACKGROUND), NWidget(NWID_HORIZONTAL), NWidget(WWT_INSET, COLOUR_GREY, WID_SL_DRIVES_DIRECTORIES_LIST), SetFill(1, 1), SetPadding(2, 1, 2, 2), @@ -98,6 +111,8 @@ static const NWidgetPart _nested_load_dialog_widgets[] = { EndContainer(), EndContainer(), EndContainer(), + + /* Right side : game details */ NWidget(WWT_PANEL, COLOUR_GREY), NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SL_DETAILS), SetResize(1, 1), SetFill(1, 1), NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_MISSING_NEWGRFS), SetDataTip(STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_BUTTON, STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_TOOLTIP), SetFill(1, 0), SetResize(1, 0), @@ -119,8 +134,18 @@ static const NWidgetPart _nested_load_heightmap_dialog_widgets[] = { NWidget(WWT_CAPTION, COLOUR_GREY, WID_SL_CAPTION), NWidget(WWT_DEFSIZEBOX, COLOUR_GREY), EndContainer(), + /* Current directory and free space */ NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_BACKGROUND), SetFill(1, 0), SetResize(1, 0), EndContainer(), - NWidget(NWID_VERTICAL), + + NWidget(WWT_PANEL, COLOUR_GREY), SetFill(1, 1), SetResize(1, 1), + /* Filter box with label */ + NWidget(NWID_HORIZONTAL), SetPadding(WD_FRAMERECT_TOP, 0, WD_FRAMERECT_BOTTOM, 0), + SetPIP(WD_FRAMETEXT_LEFT, WD_FRAMETEXT_RIGHT, 0), + NWidget(WWT_TEXT, COLOUR_GREY), SetFill(0, 1), SetDataTip(STR_SAVELOAD_FILTER_TITLE , STR_NULL), + NWidget(WWT_EDITBOX, COLOUR_GREY, WID_SL_FILTER), SetFill(1, 0), SetMinimalSize(50, 12), SetResize(1, 0), + SetDataTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP), + EndContainer(), + /* Sort Buttons */ NWidget(NWID_HORIZONTAL), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_SORT_BYNAME), SetDataTip(STR_SORT_BY_CAPTION_NAME, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0), @@ -128,6 +153,7 @@ static const NWidgetPart _nested_load_heightmap_dialog_widgets[] = { EndContainer(), NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_SL_HOME_BUTTON), SetMinimalSize(12, 12), SetDataTip(SPR_HOUSE_ICON, STR_SAVELOAD_HOME_BUTTON), EndContainer(), + /* Files */ NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_FILE_BACKGROUND), NWidget(NWID_HORIZONTAL), NWidget(WWT_INSET, COLOUR_GREY, WID_SL_DRIVES_DIRECTORIES_LIST), SetFill(1, 1), SetPadding(2, 1, 2, 2), @@ -152,9 +178,19 @@ static const NWidgetPart _nested_save_dialog_widgets[] = { NWidget(WWT_CAPTION, COLOUR_GREY, WID_SL_CAPTION), NWidget(WWT_DEFSIZEBOX, COLOUR_GREY), EndContainer(), + /* Current directory and free space */ NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_BACKGROUND), SetFill(1, 0), SetResize(1, 0), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(NWID_VERTICAL), + /* Left side : filter box and available files */ + NWidget(WWT_PANEL, COLOUR_GREY), SetFill(1, 1), SetResize(1, 1), + /* Filter box with label */ + NWidget(NWID_HORIZONTAL), SetPadding(WD_FRAMERECT_TOP, 0, WD_FRAMERECT_BOTTOM, 0), + SetPIP(WD_FRAMETEXT_LEFT, WD_FRAMETEXT_RIGHT, 0), + NWidget(WWT_TEXT, COLOUR_GREY), SetFill(0, 1), SetDataTip(STR_SAVELOAD_FILTER_TITLE , STR_NULL), + NWidget(WWT_EDITBOX, COLOUR_GREY, WID_SL_FILTER), SetFill(1, 0), SetMinimalSize(50, 12), SetResize(1, 0), + SetDataTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP), + EndContainer(), + /* Sort buttons */ NWidget(NWID_HORIZONTAL), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_SORT_BYNAME), SetDataTip(STR_SORT_BY_CAPTION_NAME, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0), @@ -162,6 +198,7 @@ static const NWidgetPart _nested_save_dialog_widgets[] = { EndContainer(), NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_SL_HOME_BUTTON), SetMinimalSize(12, 12), SetDataTip(SPR_HOUSE_ICON, STR_SAVELOAD_HOME_BUTTON), EndContainer(), + /* Files */ NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_FILE_BACKGROUND), NWidget(NWID_HORIZONTAL), NWidget(WWT_INSET, COLOUR_GREY, WID_SL_DRIVES_DIRECTORIES_LIST), SetPadding(2, 1, 0, 2), @@ -171,11 +208,14 @@ static const NWidgetPart _nested_save_dialog_widgets[] = { NWidget(WWT_EDITBOX, COLOUR_GREY, WID_SL_SAVE_OSK_TITLE), SetPadding(3, 2, 2, 2), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_SAVELOAD_OSKTITLE, STR_SAVELOAD_EDITBOX_TOOLTIP), EndContainer(), + /* Save/delete buttons */ NWidget(NWID_HORIZONTAL), NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_DELETE_SELECTION), SetDataTip(STR_SAVELOAD_DELETE_BUTTON, STR_SAVELOAD_DELETE_TOOLTIP), SetFill(1, 0), SetResize(1, 0), NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_SAVE_GAME), SetDataTip(STR_SAVELOAD_SAVE_BUTTON, STR_SAVELOAD_SAVE_TOOLTIP), SetFill(1, 0), SetResize(1, 0), EndContainer(), EndContainer(), + + /* Right side : game details */ NWidget(WWT_PANEL, COLOUR_GREY), NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SL_DETAILS), SetResize(1, 1), SetFill(1, 1), NWidget(NWID_HORIZONTAL), @@ -227,6 +267,8 @@ static void SortSaveGameList(FileList &file_list) struct SaveLoadWindow : public Window { private: + static const uint EDITBOX_MAX_SIZE = 50; + QueryString filename_editbox; ///< Filename editbox. AbstractFileType abstract_filetype; /// Type of file to select. SaveLoadOperation fop; ///< File operation to perform. @@ -234,6 +276,11 @@ private: FiosItem o_dir; const FiosItem *selected; ///< Selected game in #fios_items, or \c NULL. Scrollbar *vscroll; + + StringFilter string_filter; ///< Filter for available games. + QueryString filter_editbox; ///< Filter editbox; + SmallVector fios_items_shown; ///< Map of the filtered out fios items + public: /** Generate a default save filename. */ @@ -244,7 +291,7 @@ public: } SaveLoadWindow(WindowDesc *desc, AbstractFileType abstract_filetype, SaveLoadOperation fop) - : Window(desc), filename_editbox(64), abstract_filetype(abstract_filetype), fop(fop) + : Window(desc), filename_editbox(64), abstract_filetype(abstract_filetype), fop(fop), filter_editbox(EDITBOX_MAX_SIZE) { assert(this->fop == SLO_SAVE || this->fop == SLO_LOAD); @@ -296,6 +343,8 @@ public: this->FinishInitNested(0); this->LowerWidget(WID_SL_DRIVES_DIRECTORIES_LIST); + this->querystrings[WID_SL_FILTER] = &this->filter_editbox; + this->filter_editbox.cancel_button = QueryString::ACTION_CLEAR; /* pause is only used in single-player, non-editor mode, non-menu mode. It * will be unpaused in the WE_DESTROY event handler. */ @@ -304,7 +353,7 @@ public: } SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0); - this->OnInvalidateData(0); + this->OnInvalidateData(SLIWD_RESCAN_FILES); ResetObjectToPlace(); @@ -327,8 +376,15 @@ public: strecpy(o_dir.name, _personal_dir, lastof(o_dir.name)); } - /* Focus the edit box by default in the save windows */ - if (this->fop == SLO_SAVE) this->SetFocusedWidget(WID_SL_SAVE_OSK_TITLE); + switch (this->fop) { + case SLO_SAVE: + /* Focus the edit box by default in the save window */ + this->SetFocusedWidget(WID_SL_SAVE_OSK_TITLE); + break; + + default: + this->SetFocusedWidget(WID_SL_FILTER); + } } virtual ~SaveLoadWindow() @@ -370,6 +426,10 @@ public: uint y = r.top + WD_FRAMERECT_TOP; for (uint pos = this->vscroll->GetPosition(); pos < this->fios_items.Length(); pos++) { + if (!this->fios_items_shown[pos]) { + /* The current item is filtered out : we do not show it */ + continue; + } const FiosItem *item = this->fios_items.Get(pos); if (item == this->selected) { @@ -507,7 +567,6 @@ public: SortSaveGameList(this->fios_items); } - this->vscroll->SetCount(this->fios_items.Length()); this->DrawWidgets(); } @@ -530,7 +589,7 @@ public: case WID_SL_HOME_BUTTON: // OpenTTD 'button', jumps to OpenTTD directory FiosBrowseTo(&o_dir); - this->InvalidateData(); + this->InvalidateData(SLIWD_RESCAN_FILES); break; case WID_SL_LOAD_BUTTON: @@ -572,6 +631,12 @@ public: int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_SL_DRIVES_DIRECTORIES_LIST, WD_FRAMERECT_TOP); if (y == INT_MAX) return; + /* Get the corresponding non-filtered out item from the list */ + int i = 0; + while (i <= y) { + if (!this->fios_items_shown[i]) y++; + i++; + } const FiosItem *file = this->fios_items.Get(y); const char *name = FiosBrowseTo(file); @@ -586,7 +651,7 @@ public: SaveOrLoad(name, SLO_CHECK, DFT_GAME_FILE, NO_DIRECTORY, false); } - this->InvalidateData(1); + this->InvalidateData(SLIWD_SELECTION_CHANGES); } if (this->fop == SLO_SAVE) { /* Copy clicked name to editbox */ @@ -611,7 +676,7 @@ public: } } else { /* Changed directory, need refresh. */ - this->InvalidateData(); + this->InvalidateData(SLIWD_RESCAN_FILES); } break; } @@ -660,7 +725,7 @@ public: if (!FiosDelete(this->filename_editbox.text.buf)) { ShowErrorMessage(STR_ERROR_UNABLE_TO_DELETE_FILE, INVALID_STRING_ID, WL_ERROR); } else { - this->InvalidateData(); + this->InvalidateData(SLIWD_RESCAN_FILES); /* Reset file name to current date on successful delete */ if (this->abstract_filetype == FT_SAVEGAME) GenerateFileName(); } @@ -691,7 +756,7 @@ public: virtual void OnInvalidateData(int data = 0, bool gui_scope = true) { switch (data) { - case 0: + case SLIWD_RESCAN_FILES: /* Rescan files */ this->selected = NULL; _load_check_data.Clear(); @@ -702,9 +767,13 @@ public: this->vscroll->SetCount(this->fios_items.Length()); this->selected = NULL; _load_check_data.Clear(); + + /* We reset the files filtered */ + this->OnInvalidateData(SLIWD_FILTER_CHANGES); + FALLTHROUGH; - case 1: + case SLIWD_SELECTION_CHANGES: /* Selection changes */ if (!gui_scope) break; @@ -732,6 +801,41 @@ public: NOT_REACHED(); } break; + + case SLIWD_FILTER_CHANGES: + /* Filter changes */ + this->fios_items_shown.Resize(this->fios_items.Length()); + uint items_shown_count = 0; ///< The number of items shown in the list + /* We pass through every fios item */ + for (uint i = 0; i < this->fios_items.Length(); i++) { + if (this->string_filter.IsEmpty()) { + /* We don't filter anything out if the filter editbox is empty */ + this->fios_items_shown[i] = true; + items_shown_count++; + } else { + this->string_filter.ResetState(); + this->string_filter.AddLine(this->fios_items[i].title); + /* We set the vector to show this fios element as filtered depending on the result of the filter */ + this->fios_items_shown[i] = this->string_filter.GetState(); + if (this->fios_items_shown[i]) items_shown_count++; + + if (&(this->fios_items[i]) == this->selected && this->fios_items_shown[i] == false) { + /* The selected element has been filtered out */ + this->selected = NULL; + this->OnInvalidateData(SLIWD_SELECTION_CHANGES); + } + } + } + this->vscroll->SetCount(items_shown_count); + break; + } + } + + virtual void OnEditboxChanged(int wid) + { + if (wid == WID_SL_FILTER) { + this->string_filter.SetFilterTerm(this->filter_editbox.text.buf); + this->InvalidateData(SLIWD_FILTER_CHANGES); } } }; diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp index 021958d323..7e8e5f34fd 100644 --- a/src/framerate_gui.cpp +++ b/src/framerate_gui.cpp @@ -22,11 +22,14 @@ #include "widgets/framerate_widget.h" +/** + * Private declarations for performance measurement implementation + */ namespace { /** Number of data points to keep in buffer for each performance measurement */ const int NUM_FRAMERATE_POINTS = 512; - /** Units a second is divided into in performance measurements */ + /** %Units a second is divided into in performance measurements */ const TimingMeasurement TIMESTAMP_PRECISION = 1000000; struct PerformanceData { @@ -51,8 +54,15 @@ namespace { /** Start time for current accumulation cycle */ TimingMeasurement acc_timestamp; + /** + * Initialize a data element with an expected collection rate + * @param expected_rate + * Expected number of cycles per second of the performance element. Use 1 if unknown or not relevant. + * The rate is used for highlighting slow-running elements in the GUI. + */ explicit PerformanceData(double expected_rate) : expected_rate(expected_rate), next_index(0), prev_index(0), num_valid(0) { } + /** Collect a complete measurement, given start and ending times for a processing block */ void Add(TimingMeasurement start_time, TimingMeasurement end_time) { this->durations[this->next_index] = end_time - start_time; @@ -63,6 +73,7 @@ namespace { this->num_valid = min(NUM_FRAMERATE_POINTS, this->num_valid + 1); } + /** Begin an accumulation of multiple measurements into a single value, from a given start time */ void BeginAccumulate(TimingMeasurement start_time) { this->timestamps[this->next_index] = this->acc_timestamp; @@ -76,11 +87,13 @@ namespace { this->acc_timestamp = start_time; } + /** Accumulate a period onto the current measurement */ void AddAccumulate(TimingMeasurement duration) { this->acc_duration += duration; } + /** Indicate a pause/expected discontinuity in processing the element */ void AddPause(TimingMeasurement start_time) { if (this->durations[this->prev_index] != INVALID_DURATION) { @@ -125,11 +138,11 @@ namespace { int last_point = this->next_index - this->num_valid; if (last_point < 0) last_point += NUM_FRAMERATE_POINTS; - /** Number of data points collected */ + /* Number of data points collected */ int count = 0; - /** Time of previous data point */ + /* Time of previous data point */ TimingMeasurement last = this->timestamps[point]; - /** Total duration covered by collected points */ + /* Total duration covered by collected points */ TimingMeasurement total = 0; while (point != last_point) { @@ -149,9 +162,14 @@ namespace { } }; - /** Game loop rate, cycles per second */ + /** %Game loop rate, cycles per second */ static const double GL_RATE = 1000.0 / MILLISECONDS_PER_TICK; + /** + * Storage for all performance element measurements. + * Elements are initialized with the expected rate in recorded values per second. + * @hideinitializer + */ PerformanceData _pf_data[PFE_MAX] = { PerformanceData(GL_RATE), // PFE_GAMELOOP PerformanceData(1), // PFE_ACC_GL_ECONOMY @@ -182,7 +200,10 @@ static TimingMeasurement GetPerformanceTimer() } -/** Begin a cycle of a measured element. */ +/** + * Begin a cycle of a measured element. + * @param elem The element to be measured + */ PerformanceMeasurer::PerformanceMeasurer(PerformanceElement elem) { assert(elem < PFE_MAX); @@ -203,14 +224,20 @@ void PerformanceMeasurer::SetExpectedRate(double rate) _pf_data[this->elem].expected_rate = rate; } -/** Indicate that a cycle of "pause" where no processing occurs. */ +/** + * Indicate that a cycle of "pause" where no processing occurs. + * @param elem The element not currently being processed + */ void PerformanceMeasurer::Paused(PerformanceElement elem) { _pf_data[elem].AddPause(GetPerformanceTimer()); } -/** Begin measuring one block of the accumulating value. */ +/** + * Begin measuring one block of the accumulating value. + * @param elem The element to be measured + */ PerformanceAccumulator::PerformanceAccumulator(PerformanceElement elem) { assert(elem < PFE_MAX); @@ -225,7 +252,11 @@ PerformanceAccumulator::~PerformanceAccumulator() _pf_data[this->elem].AddAccumulate(GetPerformanceTimer() - this->start_time); } -/** Store the previous accumulator value and reset for a new cycle of accumulating measurements. */ +/** + * Store the previous accumulator value and reset for a new cycle of accumulating measurements. + * @note This function must be called once per frame, otherwise measurements are not collected. + * @param elem The element to begin a new measurement cycle of + */ void PerformanceAccumulator::Reset(PerformanceElement elem) { _pf_data[elem].BeginAccumulate(GetPerformanceTimer()); @@ -235,6 +266,7 @@ void PerformanceAccumulator::Reset(PerformanceElement elem) void ShowFrametimeGraphWindow(PerformanceElement elem); +/** @hideinitializer */ static const NWidgetPart _framerate_window_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), @@ -418,7 +450,7 @@ struct FramerateWindow : Window { void DrawElementTimesColumn(const Rect &r, StringID heading_str, const CachedDecimal *values) const { int y = r.top; - DrawString(r.left, r.right, y, heading_str, TC_FROMSTRING, SA_CENTER); + DrawString(r.left, r.right, y, heading_str, TC_FROMSTRING, SA_CENTER, true); y += FONT_HEIGHT_NORMAL + VSPACING; for (PerformanceElement e = PFE_FIRST; e < PFE_MAX; e++) { @@ -478,6 +510,7 @@ static WindowDesc _framerate_display_desc( ); +/** @hideinitializer */ static const NWidgetPart _frametime_graph_window_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), @@ -758,17 +791,20 @@ static WindowDesc _frametime_graph_window_desc( +/** Open the general framerate window */ void ShowFramerateWindow() { AllocateWindowDescFront(&_framerate_display_desc, 0); } +/** Open a graph window for a performance element */ void ShowFrametimeGraphWindow(PerformanceElement elem) { if (elem < PFE_FIRST || elem >= PFE_MAX) return; // maybe warn? AllocateWindowDescFront(&_frametime_graph_window_desc, elem, true); } +/** Print performance statistics to game console */ void ConPrintFramerate() { const int count1 = NUM_FRAMERATE_POINTS / 8; diff --git a/src/framerate_type.h b/src/framerate_type.h index 295939efec..8df9a279a1 100644 --- a/src/framerate_type.h +++ b/src/framerate_type.h @@ -7,12 +7,45 @@ * 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 . */ -#ifndef FRAMERATE_GUI_H -#define FRAMERATE_GUI_H +/** @file framerate_type.h + * Types for recording game performance data. + * + * @par Adding new measurements + * Adding a new measurement requires multiple steps, which are outlined here. + * The first thing to do is add a new member of the #PerformanceElement enum. + * It must be added before \c PFE_MAX and should be added in a logical place. + * For example, an element of the game loop would be added next to the other game loop elements, and a rendering element next to the other rendering elements. + * + * @par + * Second is adding a member to the \link anonymous_namespace{framerate_gui.cpp}::_pf_data _pf_data \endlink array, in the same position as the new #PerformanceElement member. + * + * @par + * Third is adding strings for the new element. There is an array in #ConPrintFramerate with strings used for the console command. + * Additionally, there are two sets of strings in \c english.txt for two GUI uses, also in the #PerformanceElement order. + * Search for \c STR_FRAMERATE_GAMELOOP and \c STR_FRAMETIME_CAPTION_GAMELOOP in \c english.txt to find those. + * + * @par + * Last is actually adding the measurements. There are two ways to measure, either one-shot (a single function/block handling all processing), + * or as an accumulated element (multiple functions/blocks that need to be summed across each frame/tick). + * Use either the PerformanceMeasurer or the PerformanceAccumulator class respectively for the two cases. + * Either class is used by instantiating an object of it at the beginning of the block to be measured, so it auto-destructs at the end of the block. + * For PerformanceAccumulator, make sure to also call PerformanceAccumulator::Reset once at the beginning of a new frame. Usually the StateGameLoop function is appropriate for this. + * + * @see framerate_gui.cpp for implementation + */ + +#ifndef FRAMERATE_TYPE_H +#define FRAMERATE_TYPE_H #include "stdafx.h" #include "core/enum_type.hpp" +/** + * Elements of game performance that can be measured. + * + * @note When adding new elements here, make sure to also update all other locations depending on the length and order of this enum. + * See Adding new measurements above. + */ enum PerformanceElement { PFE_FIRST = 0, PFE_GAMELOOP = 0, ///< Speed of gameloop processing. @@ -31,12 +64,15 @@ enum PerformanceElement { }; DECLARE_POSTFIX_INCREMENT(PerformanceElement) +/** Type used to hold a performance timing measurement */ typedef uint64 TimingMeasurement; /** * RAII class for measuring simple elements of performance. * Construct an object with the appropriate element parameter when processing begins, * time is automatically taken when the object goes out of scope again. + * + * Call Paused at the start of a frame if the processing of this element is paused. */ class PerformanceMeasurer { PerformanceElement elem; @@ -52,6 +88,12 @@ public: * RAII class for measuring multi-step elements of performance. * At the beginning of a frame, call Reset on the element, then construct an object in the scope where * each processing cycle happens. The measurements are summed between resets. + * + * Usually StateGameLoop is an appropriate function to place Reset calls in, but for elements with + * more isolated scopes it can also be appropriate to Reset somewhere else. + * An example is the CallVehicleTicks function where all the vehicle type elements are reset. + * + * The PerformanceMeasurer::Paused function can also be used with elements otherwise measured with this class. */ class PerformanceAccumulator { PerformanceElement elem; @@ -64,4 +106,4 @@ public: void ShowFramerateWindow(); -#endif /* FRAMERATE_GUI_H */ +#endif /* FRAMERATE_TYPE_H */ diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index f4334429fb..48b8c4c84a 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -1402,9 +1402,9 @@ struct PerformanceRatingDetailWindow : Window { int colour_notdone = _colour_gradient[COLOUR_RED][4]; /* Draw all the score parts */ - int val = _score_part[company][score_type]; - int needed = _score_info[score_type].needed; - int score = _score_info[score_type].score; + int64 val = _score_part[company][score_type]; + int64 needed = _score_info[score_type].needed; + int score = _score_info[score_type].score; /* SCORE_TOTAL has his own rules ;) */ if (score_type == SCORE_TOTAL) { @@ -1422,7 +1422,7 @@ struct PerformanceRatingDetailWindow : Window { DrawString(this->score_info_left, this->score_info_right, text_top, STR_BLACK_COMMA, TC_FROMSTRING, SA_RIGHT); /* Calculate the %-bar */ - uint x = Clamp(val, 0, needed) * this->bar_width / needed; + uint x = Clamp(val, 0, needed) * this->bar_width / needed; bool rtl = _current_text_dir == TD_RTL; if (rtl) { x = this->bar_right - x; @@ -1435,7 +1435,7 @@ struct PerformanceRatingDetailWindow : Window { if (x != this->bar_right) GfxFillRect(x, bar_top, this->bar_right, bar_top + this->bar_height, rtl ? colour_done : colour_notdone); /* Draw it */ - SetDParam(0, Clamp(val, 0, needed) * 100 / needed); + SetDParam(0, Clamp(val, 0, needed) * 100 / needed); DrawString(this->bar_left, this->bar_right, text_top, STR_PERFORMANCE_DETAIL_PERCENT, TC_FROMSTRING, SA_HOR_CENTER); /* SCORE_LOAN is inversed */ diff --git a/src/lang/english.txt b/src/lang/english.txt index 394a97b030..df4ffd1a37 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3219,36 +3219,36 @@ STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}OpenTTD # Framerate display window STR_FRAMERATE_CAPTION :{WHITE}Frame rate STR_FRAMERATE_CAPTION_SMALL :{STRING2}{WHITE} ({DECIMAL}x) -STR_FRAMERATE_RATE_GAMELOOP :{WHITE}Simulation rate: {STRING2} +STR_FRAMERATE_RATE_GAMELOOP :{BLACK}Simulation rate: {STRING2} STR_FRAMERATE_RATE_GAMELOOP_TOOLTIP :{BLACK}Number of game ticks simulated per second. -STR_FRAMERATE_RATE_BLITTER :{WHITE}Graphics frame rate: {STRING2} +STR_FRAMERATE_RATE_BLITTER :{BLACK}Graphics frame rate: {STRING2} STR_FRAMERATE_RATE_BLITTER_TOOLTIP :{BLACK}Number of video frames rendered per second. -STR_FRAMERATE_SPEED_FACTOR :{WHITE}Current game speed factor: {DECIMAL}x +STR_FRAMERATE_SPEED_FACTOR :{BLACK}Current game speed factor: {DECIMAL}x STR_FRAMERATE_SPEED_FACTOR_TOOLTIP :{BLACK}How fast the game is currently running, compared to the expected speed at normal simulation rate. STR_FRAMERATE_CURRENT :{WHITE}Current STR_FRAMERATE_AVERAGE :{WHITE}Average -STR_FRAMERATE_DATA_POINTS :{WHITE}Data based on {COMMA} measurements -STR_FRAMERATE_MS_GOOD :{LTBLUE}{DECIMAL}{WHITE} ms -STR_FRAMERATE_MS_WARN :{YELLOW}{DECIMAL}{WHITE} ms -STR_FRAMERATE_MS_BAD :{RED}{DECIMAL}{WHITE} ms -STR_FRAMERATE_FPS_GOOD :{LTBLUE}{DECIMAL}{WHITE} frames/s -STR_FRAMERATE_FPS_WARN :{YELLOW}{DECIMAL}{WHITE} frames/s -STR_FRAMERATE_FPS_BAD :{RED}{DECIMAL}{WHITE} frames/s +STR_FRAMERATE_DATA_POINTS :{BLACK}Data based on {COMMA} measurements +STR_FRAMERATE_MS_GOOD :{LTBLUE}{DECIMAL} ms +STR_FRAMERATE_MS_WARN :{YELLOW}{DECIMAL} ms +STR_FRAMERATE_MS_BAD :{RED}{DECIMAL} ms +STR_FRAMERATE_FPS_GOOD :{LTBLUE}{DECIMAL} frames/s +STR_FRAMERATE_FPS_WARN :{YELLOW}{DECIMAL} frames/s +STR_FRAMERATE_FPS_BAD :{RED}{DECIMAL} frames/s STR_FRAMERATE_GRAPH_MILLISECONDS :{TINY_FONT}{COMMA} ms STR_FRAMERATE_GRAPH_SECONDS :{TINY_FONT}{COMMA} s ############ Leave those lines in this order!! -STR_FRAMERATE_GAMELOOP :{WHITE}Game loop total: -STR_FRAMERATE_GL_ECONOMY :{WHITE} Cargo handling: -STR_FRAMERATE_GL_TRAINS :{WHITE} Train ticks: -STR_FRAMERATE_GL_ROADVEHS :{WHITE} Road vehicle ticks: -STR_FRAMERATE_GL_SHIPS :{WHITE} Ship ticks: -STR_FRAMERATE_GL_AIRCRAFT :{WHITE} Aircraft ticks: -STR_FRAMERATE_GL_LANDSCAPE :{WHITE} World ticks: -STR_FRAMERATE_GL_LINKGRAPH :{WHITE} Link graph delay: -STR_FRAMERATE_DRAWING :{WHITE}Graphics rendering: -STR_FRAMERATE_DRAWING_VIEWPORTS :{WHITE} World viewports: -STR_FRAMERATE_VIDEO :{WHITE}Video output: -STR_FRAMERATE_SOUND :{WHITE}Sound mixing: +STR_FRAMERATE_GAMELOOP :{BLACK}Game loop total: +STR_FRAMERATE_GL_ECONOMY :{BLACK} Cargo handling: +STR_FRAMERATE_GL_TRAINS :{BLACK} Train ticks: +STR_FRAMERATE_GL_ROADVEHS :{BLACK} Road vehicle ticks: +STR_FRAMERATE_GL_SHIPS :{BLACK} Ship ticks: +STR_FRAMERATE_GL_AIRCRAFT :{BLACK} Aircraft ticks: +STR_FRAMERATE_GL_LANDSCAPE :{BLACK} World ticks: +STR_FRAMERATE_GL_LINKGRAPH :{BLACK} Link graph delay: +STR_FRAMERATE_DRAWING :{BLACK}Graphics rendering: +STR_FRAMERATE_DRAWING_VIEWPORTS :{BLACK} World viewports: +STR_FRAMERATE_VIDEO :{BLACK}Video output: +STR_FRAMERATE_SOUND :{BLACK}Sound mixing: ############ End of leave-in-this-order ############ Leave those lines in this order!! STR_FRAMETIME_CAPTION_GAMELOOP :Game loop @@ -3288,6 +3288,7 @@ STR_SAVELOAD_DETAIL_CAPTION :{BLACK}Game Det STR_SAVELOAD_DETAIL_NOT_AVAILABLE :{BLACK}No information available STR_SAVELOAD_DETAIL_COMPANY_INDEX :{SILVER}{COMMA}: {WHITE}{STRING1} STR_SAVELOAD_DETAIL_GRFSTATUS :{SILVER}NewGRF: {WHITE}{STRING} +STR_SAVELOAD_FILTER_TITLE :{BLACK}Filter string: STR_SAVELOAD_OSKTITLE :{BLACK}Enter a name for the savegame diff --git a/src/lang/korean.txt b/src/lang/korean.txt index 294b881367..795689cf0f 100644 --- a/src/lang/korean.txt +++ b/src/lang/korean.txt @@ -1014,7 +1014,7 @@ STR_GAME_OPTIONS_BASE_MUSIC_STATUS :{RED}{NUM}개 STR_GAME_OPTIONS_BASE_MUSIC_DESCRIPTION_TOOLTIP :{BLACK}기본 배경 음악 세트에 대한 추가 정보를 봅니다. STR_ERROR_RESOLUTION_LIST_FAILED :{WHITE}지원되는 해상도 목록을 불러오는데 실패하였습니다. -STR_ERROR_FULLSCREEN_FAILED :{WHITE}풀스크린 모드 실패 +STR_ERROR_FULLSCREEN_FAILED :{WHITE}전체화면 모드 실패 # Custom currency window @@ -1289,7 +1289,7 @@ STR_CONFIG_SETTING_ORDER_REVIEW_HELPTEXT :이 설정을 STR_CONFIG_SETTING_ORDER_REVIEW_OFF :검사하지 않음 STR_CONFIG_SETTING_ORDER_REVIEW_EXDEPOT :정지한 차량을 제외하고 검사 STR_CONFIG_SETTING_ORDER_REVIEW_ON :모든 차량을 검사 -STR_CONFIG_SETTING_WARN_INCOME_LESS :차량의 수입이 적자일때 경고하기: {STRING} +STR_CONFIG_SETTING_WARN_INCOME_LESS :차량의 수입이 적자일 때 경고하기: {STRING} STR_CONFIG_SETTING_WARN_INCOME_LESS_HELPTEXT :이 설정을 켜면, 지난 해에 수익이 없는 차량이 있으면 뉴스 메시지로 알려줍니다. STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES :옛날 차량을 사라지지 않고 계속 만들 수 있게 함: {STRING} STR_CONFIG_SETTING_NEVER_EXPIRE_VEHICLES_HELPTEXT :이 설정을 켜면, 오래된 차량 모델을 포함하여 모든 차량 모델을 도입 이후에 계속 사용할 수 있게 됩니다. @@ -3449,6 +3449,8 @@ STR_NEWGRF_ERROR_READ_BOUNDS :유사 스프 STR_NEWGRF_ERROR_GRM_FAILED :요청한 GRF 자원을 사용할 수 없음 (스프라이트 {3:NUM}) STR_NEWGRF_ERROR_FORCEFULLY_DISABLED :{1:STRING}(은)는 {STRING} 때문에 사용할 수 없습니다 STR_NEWGRF_ERROR_INVALID_SPRITE_LAYOUT :유효하지 않은/알 수 없는 스프라이트 구조 유형 (스프라이트 {3:NUM}) +STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG :속성값 목록에 너무 많은 요소가 있음 (스프라이트 {3:NUM}, 속성 {4:HEX}) +STR_NEWGRF_ERROR_INDPROD_CALLBACK :유효하지 않은 산업 생산 콜백 (스프라이트 {3:NUM}, "{1:STRING}") # NewGRF related 'general' warnings STR_NEWGRF_POPUP_CAUTION_CAPTION :{WHITE}경고! diff --git a/src/lang/russian.txt b/src/lang/russian.txt index 09e0f614ac..ef53bca8fb 100644 --- a/src/lang/russian.txt +++ b/src/lang/russian.txt @@ -602,6 +602,7 @@ STR_ABOUT_MENU_SCREENSHOT :Снимок э STR_ABOUT_MENU_ZOOMIN_SCREENSHOT :Снимок экрана в макс. приближении STR_ABOUT_MENU_DEFAULTZOOM_SCREENSHOT :Снимок экрана в обычном масштабе STR_ABOUT_MENU_GIANT_SCREENSHOT :Снимок всей карты +STR_ABOUT_MENU_SHOW_FRAMERATE :Показать кол-во кадров/с STR_ABOUT_MENU_ABOUT_OPENTTD :Об игре STR_ABOUT_MENU_SPRITE_ALIGNER :Выравнивание спрайтов STR_ABOUT_MENU_TOGGLE_BOUNDING_BOXES :Переключить ограничивающие рамки @@ -960,6 +961,7 @@ STR_NEWS_MERGER_TAKEOVER_TITLE :{BIG_FONT}{BLAC STR_PRESIDENT_NAME_MANAGER :{BLACK}{PRESIDENT_NAME}{}(Директор) STR_NEWS_NEW_TOWN :{BLACK}{BIG_FONT}Компания «{STRING}» профинансировала основание города {TOWN}! +STR_NEWS_NEW_TOWN_UNSPONSORED :{BLACK}{BIG_FONT}Основан новый город - {TOWN}! STR_NEWS_INDUSTRY_CONSTRUCTION :{BIG_FONT}{BLACK}Новое предприятие! {STRING} стро{G 0 и и и я}тся возле г.{NBSP}{TOWN}! STR_NEWS_INDUSTRY_PLANTED :{BIG_FONT}{BLACK}Новое предприятие! {STRING} заложен{G 0 "" а о ы} возле г.{NBSP}{TOWN}! @@ -2884,6 +2886,9 @@ STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}OpenTTD # Framerate display window STR_FRAMERATE_CAPTION_SMALL :{STRING}{WHITE} ({DECIMAL}x) +STR_FRAMERATE_RATE_GAMELOOP_TOOLTIP :{BLACK}Кол-во игровых циклов, рассчитываемых в секунду. +STR_FRAMERATE_RATE_BLITTER_TOOLTIP :{BLACK}Кол-во отображаемых кадров в секунду. +STR_FRAMERATE_DATA_POINTS :{WHITE}Данные по {COMMA} измерени{P ю ям ям} STR_FRAMERATE_MS_GOOD :{LTBLUE}{DECIMAL}{WHITE} мс STR_FRAMERATE_MS_WARN :{YELLOW}{DECIMAL}{WHITE} мс STR_FRAMERATE_MS_BAD :{RED}{DECIMAL}{WHITE} мс @@ -2893,8 +2898,11 @@ STR_FRAMERATE_FPS_BAD :{RED}{DECIMAL}{ STR_FRAMERATE_GRAPH_MILLISECONDS :{TINY_FONT}{COMMA} мс STR_FRAMERATE_GRAPH_SECONDS :{TINY_FONT}{COMMA} с ############ Leave those lines in this order!! +STR_FRAMERATE_GL_LINKGRAPH :{WHITE} Задержка графа распределения: ############ End of leave-in-this-order ############ Leave those lines in this order!! +STR_FRAMETIME_CAPTION_GL_LINKGRAPH :Задержка графа распределения +STR_FRAMETIME_CAPTION_DRAWING :Отрисовка графики ############ End of leave-in-this-order diff --git a/src/lang/spanish.txt b/src/lang/spanish.txt index 90c0ae4f47..01888fd4c4 100644 --- a/src/lang/spanish.txt +++ b/src/lang/spanish.txt @@ -2691,9 +2691,12 @@ STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}OpenTTD STR_FRAMERATE_CAPTION :{WHITE}Fotogramas por segundo - FPS STR_FRAMERATE_CURRENT :{WHITE}Actual STR_FRAMERATE_AVERAGE :{WHITE}Medio +STR_FRAMERATE_DATA_POINTS :{WHITE}Datos basados en {COMMA} medidas +STR_FRAMERATE_MS_GOOD :{LTBLUE}{DECIMAL}{WHITE} ms ############ Leave those lines in this order!! ############ End of leave-in-this-order ############ Leave those lines in this order!! +STR_FRAMETIME_CAPTION_DRAWING :Renderizado gráfico ############ End of leave-in-this-order diff --git a/src/lang/spanish_MX.txt b/src/lang/spanish_MX.txt index 40d54b98d9..56278624cc 100644 --- a/src/lang/spanish_MX.txt +++ b/src/lang/spanish_MX.txt @@ -2969,6 +2969,8 @@ STR_NEWGRF_ERROR_READ_BOUNDS :La lectura exce STR_NEWGRF_ERROR_GRM_FAILED :Recursos GRF solicitados no disponibles (sprite {3:NUM}) STR_NEWGRF_ERROR_FORCEFULLY_DISABLED :{1:STRING} fue desactivado por {STRING} STR_NEWGRF_ERROR_INVALID_SPRITE_LAYOUT :Formato de colocación de sprites no válido o desconocido (sprite {3:NUM}) +STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG :Demasiados elementos en la lista de valores de propiedad (sprite {3:NUM}, property {4:HEX}) +STR_NEWGRF_ERROR_INDPROD_CALLBACK :Llamada de producción de industria no válida (sprite {3:NUM}, "{1:STRING}") # NewGRF related 'general' warnings STR_NEWGRF_POPUP_CAUTION_CAPTION :{WHITE}¡Precaución! diff --git a/src/music_gui.cpp b/src/music_gui.cpp index 7bf08fd1dc..87a073b0a7 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -173,6 +173,9 @@ void MusicSystem::ChangeMusicSet(const char *set_name) { BaseMusic::SetSet(set_name); + free(BaseMusic::ini_set); + BaseMusic::ini_set = stredup(set_name); + this->BuildPlaylists(); this->ChangePlaylist(this->selected_playlist); diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp index 254e94bf99..c9d85726fb 100644 --- a/src/vehicle_cmd.cpp +++ b/src/vehicle_cmd.cpp @@ -603,7 +603,8 @@ CommandCost CmdStartStopVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, case VEH_AIRCRAFT: { Aircraft *a = Aircraft::From(v); /* cannot stop airplane when in flight, or when taking off / landing */ - if (!(v->vehstatus & VS_CRASHED) && a->state >= STARTTAKEOFF && a->state < TERM7) return_cmd_error(STR_ERROR_AIRCRAFT_IS_IN_FLIGHT); + if (a->state >= STARTTAKEOFF && a->state < TERM7) return_cmd_error(STR_ERROR_AIRCRAFT_IS_IN_FLIGHT); + if (HasBit(a->flags, VAF_HELI_DIRECT_DESCENT)) return_cmd_error(STR_ERROR_AIRCRAFT_IS_IN_FLIGHT); break; } diff --git a/src/widgets/fios_widget.h b/src/widgets/fios_widget.h index c94655d767..2351f8035e 100644 --- a/src/widgets/fios_widget.h +++ b/src/widgets/fios_widget.h @@ -17,6 +17,7 @@ enum SaveLoadWidgets { WID_SL_CAPTION, ///< Caption of the window. WID_SL_SORT_BYNAME, ///< Sort by name button. WID_SL_SORT_BYDATE, ///< Sort by date button. + WID_SL_FILTER, ///< Filter list of files WID_SL_BACKGROUND, ///< Background of window. WID_SL_FILE_BACKGROUND, ///< Background of file selection. WID_SL_HOME_BUTTON, ///< Home button.