From ae422be979d50d24d5d444c4b86dbbdc10e2ecbc Mon Sep 17 00:00:00 2001 From: Rubidium Date: Thu, 26 Jan 2023 22:48:08 +0100 Subject: [PATCH 01/12] Cleanup: remove/replace trailing ; with . in comments --- src/3rdparty/squirrel/squirrel/sqstate.cpp | 2 +- src/fios.cpp | 2 +- src/newgrf_commons.h | 2 +- src/pathfinder/follow_track.hpp | 2 +- src/video/opengl.h | 14 +++++++------- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/3rdparty/squirrel/squirrel/sqstate.cpp b/src/3rdparty/squirrel/squirrel/sqstate.cpp index 574311cf77..6c1c9ec2fb 100644 --- a/src/3rdparty/squirrel/squirrel/sqstate.cpp +++ b/src/3rdparty/squirrel/squirrel/sqstate.cpp @@ -453,7 +453,7 @@ void RefTable::Resize(SQUnsignedInteger size) [[maybe_unused]] SQUnsignedInteger nfound = 0; for(SQUnsignedInteger n = 0; n < oldnumofslots; n++) { if(type(t->obj) != OT_NULL) { - //add back; + //add back assert(t->refs != 0); RefNode *nn = Add(::HashObj(t->obj)&(_numofslots-1),t->obj); nn->refs = t->refs; diff --git a/src/fios.cpp b/src/fios.cpp index 0491c1e51b..b07db3c8b1 100644 --- a/src/fios.cpp +++ b/src/fios.cpp @@ -295,7 +295,7 @@ bool FiosFileScanner::AddFile(const std::string &filename, size_t basepath_lengt std::string ext = filename.substr(sep); char fios_title[64]; - fios_title[0] = '\0'; // reset the title; + fios_title[0] = '\0'; // reset the title FiosType type = this->callback_proc(this->fop, filename, ext.c_str(), fios_title, lastof(fios_title)); if (type == FIOS_TYPE_INVALID) return false; diff --git a/src/newgrf_commons.h b/src/newgrf_commons.h index bf338c2da5..a53752ed0e 100644 --- a/src/newgrf_commons.h +++ b/src/newgrf_commons.h @@ -197,7 +197,7 @@ protected: uint16 max_offset; ///< what is the length of the original entity's array of specs uint16 max_entities; ///< what is the amount of entities, old and new summed - uint16 invalid_id; ///< ID used to detected invalid entities; + uint16 invalid_id; ///< ID used to detected invalid entities virtual bool CheckValidNewID(uint16 testid) { return true; } public: diff --git a/src/pathfinder/follow_track.hpp b/src/pathfinder/follow_track.hpp index a9a51da68a..ed5f181437 100644 --- a/src/pathfinder/follow_track.hpp +++ b/src/pathfinder/follow_track.hpp @@ -371,7 +371,7 @@ protected: /* entered railway station * get platform length */ uint length = BaseStation::GetByTile(m_new_tile)->GetPlatformLength(m_new_tile, TrackdirToExitdir(m_old_td)); - /* how big step we must do to get to the last platform tile; */ + /* how big step we must do to get to the last platform tile? */ m_tiles_skipped = length - 1; /* move to the platform end */ TileIndexDiff diff = TileOffsByDiagDir(m_exitdir); diff --git a/src/video/opengl.h b/src/video/opengl.h index 49fade6b02..0cdb89035a 100644 --- a/src/video/opengl.h +++ b/src/video/opengl.h @@ -48,16 +48,16 @@ private: GLuint remap_program; ///< Shader program for blending and rendering a RGBA + remap texture. GLint remap_sprite_loc; ///< Uniform location for sprite parameters. - GLint remap_screen_loc; ///< Uniform location for screen size; - GLint remap_zoom_loc; ///< Uniform location for sprite zoom; - GLint remap_rgb_loc; ///< Uniform location for RGB mode flag; + GLint remap_screen_loc; ///< Uniform location for screen size. + GLint remap_zoom_loc; ///< Uniform location for sprite zoom. + GLint remap_rgb_loc; ///< Uniform location for RGB mode flag. GLuint sprite_program; ///< Shader program for blending and rendering a sprite to the video buffer. GLint sprite_sprite_loc; ///< Uniform location for sprite parameters. - GLint sprite_screen_loc; ///< Uniform location for screen size; - GLint sprite_zoom_loc; ///< Uniform location for sprite zoom; - GLint sprite_rgb_loc; ///< Uniform location for RGB mode flag; - GLint sprite_crash_loc; ///< Uniform location for crash remap mode flag; + GLint sprite_screen_loc; ///< Uniform location for screen size. + GLint sprite_zoom_loc; ///< Uniform location for sprite zoom. + GLint sprite_rgb_loc; ///< Uniform location for RGB mode flag. + GLint sprite_crash_loc; ///< Uniform location for crash remap mode flag. LRUCache cursor_cache; ///< Cache of encoded cursor sprites. PaletteID last_sprite_pal = (PaletteID)-1; ///< Last uploaded remap palette. From 5863d78cb48dc87b36395c56104164ca114e5122 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Thu, 26 Jan 2023 22:49:57 +0100 Subject: [PATCH 02/12] Codechange: use commented out code, or guard by #ifdef --- src/3rdparty/squirrel/squirrel/sqvm.cpp | 12 +++++++----- src/saveload/saveload.h | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/3rdparty/squirrel/squirrel/sqvm.cpp b/src/3rdparty/squirrel/squirrel/sqvm.cpp index 1f81a2e9a6..fd41212dfb 100644 --- a/src/3rdparty/squirrel/squirrel/sqvm.cpp +++ b/src/3rdparty/squirrel/squirrel/sqvm.cpp @@ -140,7 +140,6 @@ void SQVM::Finalize() SQVM::~SQVM() { Finalize(); - //sq_free(_callsstack,_alloccallsstacksize*sizeof(CallInfo)); REMOVE_FROM_CHAIN(&_ss(this)->_gc_chain,this); } @@ -712,7 +711,6 @@ bool SQVM::Execute(SQObjectPtr &closure, SQInteger target, SQInteger nargs, SQIn return false; } if (_funcproto(_closure(temp_reg)->_function)->_bgenerator) { - //SQFunctionProto *f = _funcproto(_closure(temp_reg)->_function); SQGenerator *gen = SQGenerator::Create(_ss(this), _closure(temp_reg)); _GUARD(gen->Yield(this)); Return(1, ci->_target, temp_reg); @@ -747,8 +745,10 @@ exception_restore: if (ShouldSuspend()) { _suspended = SQTrue; _suspended_traps = traps; return true; } const SQInstruction &_i_ = *ci->_ip++; - //dumpstack(_stackbase); - //printf("%s %d %d %d %d\n",g_InstrDesc[_i_.op].name,arg0,arg1,arg2,arg3); +#ifdef _DEBUG_DUMP + dumpstack(_stackbase); + printf("%s %d %d %d %d\n",g_InstrDesc[_i_.op].name,arg0,arg1,arg2,arg3); +#endif switch(_i_.op) { case _OP_LINE: @@ -1053,7 +1053,9 @@ common_call: exception_trap: { SQObjectPtr currerror = _lasterror; -// dumpstack(_stackbase); +#ifdef _DEBUG_DUMP + dumpstack(_stackbase); +#endif SQInteger n = 0; SQInteger last_top = _top; if(ci) { diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index bd57fb727f..ca099cafdc 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -1067,7 +1067,7 @@ static inline bool SlIsObjectCurrentlyValid(SaveLoadVersion version_from, SaveLo */ static inline VarType GetVarMemType(VarType type) { - return type & 0xF0; // GB(type, 4, 4) << 4; + return GB(type, 4, 4) << 4; } /** @@ -1078,7 +1078,7 @@ static inline VarType GetVarMemType(VarType type) */ static inline VarType GetVarFileType(VarType type) { - return type & 0xF; // GB(type, 0, 4); + return GB(type, 0, 4); } /** From 71b46db8d099c5f6d632a9d5fed331ca26fc8089 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Thu, 26 Jan 2023 22:50:43 +0100 Subject: [PATCH 03/12] Cleanup: remove commented out code --- src/3rdparty/squirrel/squirrel/sqcompiler.cpp | 9 --------- src/3rdparty/squirrel/squirrel/sqlexer.cpp | 1 - src/3rdparty/squirrel/squirrel/sqvm.h | 1 - src/blitter/40bpp_anim.hpp | 1 - src/misc/countedptr.hpp | 6 ------ src/pathfinder/npf/aystar.h | 2 -- src/pathfinder/npf/npf.cpp | 2 -- src/string.cpp | 2 -- src/viewport.cpp | 4 ++-- 9 files changed, 2 insertions(+), 26 deletions(-) diff --git a/src/3rdparty/squirrel/squirrel/sqcompiler.cpp b/src/3rdparty/squirrel/squirrel/sqcompiler.cpp index 3af111a28a..9ba1597120 100644 --- a/src/3rdparty/squirrel/squirrel/sqcompiler.cpp +++ b/src/3rdparty/squirrel/squirrel/sqcompiler.cpp @@ -607,7 +607,6 @@ public: switch(_token) { case TK_STRING_LITERAL: { - //SQObjectPtr id(SQString::Create(_ss(_vm), _lex._svalue,_lex._longstr.size()-1)); _fs->AddInstruction(_OP_LOAD, _fs->PushTarget(), _fs->GetConstant(_fs->CreateString(_lex._svalue,_lex._longstr.size()-1))); Lex(); } @@ -840,7 +839,6 @@ public: unsigned char flags = (hasattrs?NEW_SLOT_ATTRIBUTES_FLAG:0)|(isstatic?NEW_SLOT_STATIC_FLAG:0); SQInteger table = _fs->TopTarget(); //<AddInstruction(_OP_NEWSLOTA, flags, table, key, val); - //_fs->PopTarget(); } if(separator == ',') //hack recognizes a table from the separator _fs->SetIntructionParam(tpos, 1, nkeys); @@ -1053,7 +1051,6 @@ public: if(tonextcondjmp != -1) _fs->SetIntructionParam(tonextcondjmp, 1, _fs->GetCurrentPos() - tonextcondjmp); if(_token == TK_DEFAULT) { - // _fs->AddLineInfos(_lex._currentline, _lineinfo); Lex(); Expect(':'); SQInteger stacksize = _fs->GetStackSize(); _last_stacksize = _fs->GetStackSize(); @@ -1167,11 +1164,6 @@ public: } SQTable *enums = _table(_ss(_vm)->_consts); SQObjectPtr strongid = id; - /*SQObjectPtr dummy; - if(enums->Get(strongid,dummy)) { - dummy.Null(); strongid.Null(); - Error("enumeration already exists"); - }*/ enums->NewSlot(SQObjectPtr(strongid),SQObjectPtr(table)); strongid.Null(); Lex(); @@ -1318,7 +1310,6 @@ public: funcstate->AddLineInfos(_lex._prevtoken == '\n'?_lex._lasttokenline:_lex._currentline, _lineinfo, true); funcstate->AddInstruction(_OP_RETURN, -1); funcstate->SetStackSize(0); - //_fs->->_stacksize = _fs->_stacksize; SQFunctionProto *func = funcstate->BuildProto(); #ifdef _DEBUG_DUMP funcstate->Dump(func); diff --git a/src/3rdparty/squirrel/squirrel/sqlexer.cpp b/src/3rdparty/squirrel/squirrel/sqlexer.cpp index a4bac82279..c4fb852991 100644 --- a/src/3rdparty/squirrel/squirrel/sqlexer.cpp +++ b/src/3rdparty/squirrel/squirrel/sqlexer.cpp @@ -177,7 +177,6 @@ SQInteger SQLexer::Lex() else if ( CUR_CHAR == '-' ) { NEXT(); RETURN_TOKEN(TK_NEWSLOT); } else if ( CUR_CHAR == '<' ) { NEXT(); RETURN_TOKEN(TK_SHIFTL); } else if ( CUR_CHAR == '/' ) { NEXT(); RETURN_TOKEN(TK_ATTR_OPEN); } - //else if ( CUR_CHAR == '[' ) { NEXT(); ReadMultilineString(); RETURN_TOKEN(TK_STRING_LITERAL); } else { RETURN_TOKEN('<') } case '>': NEXT(); diff --git a/src/3rdparty/squirrel/squirrel/sqvm.h b/src/3rdparty/squirrel/squirrel/sqvm.h index dbfe2309c7..6389058923 100644 --- a/src/3rdparty/squirrel/squirrel/sqvm.h +++ b/src/3rdparty/squirrel/squirrel/sqvm.h @@ -36,7 +36,6 @@ struct SQVM : public CHAINABLE_OBJ }; struct CallInfo{ - //CallInfo() { _generator._type = OT_NULL;} SQInstruction *_ip; SQObjectPtr *_literals; SQObjectPtr _closure; diff --git a/src/blitter/40bpp_anim.hpp b/src/blitter/40bpp_anim.hpp index 6b7a6d0dc6..c530889f49 100644 --- a/src/blitter/40bpp_anim.hpp +++ b/src/blitter/40bpp_anim.hpp @@ -18,7 +18,6 @@ class Blitter_40bppAnim : public Blitter_32bppOptimized { public: - // void *MoveTo(void *video, int x, int y) override; void SetPixel(void *video, int x, int y, uint8 colour) override; void DrawRect(void *video, int width, int height, uint8 colour) override; void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override; diff --git a/src/misc/countedptr.hpp b/src/misc/countedptr.hpp index 8ced8d48e1..ee0edea67c 100644 --- a/src/misc/countedptr.hpp +++ b/src/misc/countedptr.hpp @@ -125,12 +125,6 @@ public: return m_pT == nullptr; } - /** another way how to test for nullptr value */ - //inline bool operator == (const CCountedPtr &sp) const {return m_pT == sp.m_pT;} - - /** yet another way how to test for nullptr value */ - //inline bool operator != (const CCountedPtr &sp) const {return m_pT != sp.m_pT;} - /** assign pointer w/o incrementing ref count */ inline void Attach(Tcls *pT) { diff --git a/src/pathfinder/npf/aystar.h b/src/pathfinder/npf/aystar.h index cbbe8a4157..aa57037d16 100644 --- a/src/pathfinder/npf/aystar.h +++ b/src/pathfinder/npf/aystar.h @@ -20,8 +20,6 @@ #include "../../tile_type.h" #include "../../track_type.h" -//#define AYSTAR_DEBUG - /** Return status of #AyStar methods. */ enum AystarStatus { AYSTAR_FOUND_END_NODE, ///< An end node was found. diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp index 25681507c7..c880124dd9 100644 --- a/src/pathfinder/npf/npf.cpp +++ b/src/pathfinder/npf/npf.cpp @@ -314,7 +314,6 @@ static Vehicle *CountShipProc(Vehicle *v, void *data) static int32 NPFWaterPathCost(AyStar *as, AyStarNode *current, OpenListNode *parent) { - /* TileIndex tile = current->tile; */ int32 cost = 0; Trackdir trackdir = current->direction; @@ -1114,7 +1113,6 @@ void InitializeNPF() } _npf_aystar.loops_per_tick = 0; _npf_aystar.max_path_cost = 0; - //_npf_aystar.max_search_nodes = 0; /* We will limit the number of nodes for now, until we have a better * solution to really fix performance */ _npf_aystar.max_search_nodes = _settings_game.pf.npf.npf_max_search_nodes; diff --git a/src/string.cpp b/src/string.cpp index 9bdbafa46a..0886f2805a 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -618,7 +618,6 @@ size_t Utf8Decode(WChar *c, const char *s) } } - /* Debug(misc, 1, "[utf8] invalid UTF-8 sequence"); */ *c = '?'; return 1; } @@ -654,7 +653,6 @@ inline size_t Utf8Encode(T buf, WChar c) return 4; } - /* Debug(misc, 1, "[utf8] can't UTF-8 encode value 0x{:X}", c); */ *buf = '?'; return 1; } diff --git a/src/viewport.cpp b/src/viewport.cpp index 5310a02dc5..c52449f5e1 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -262,8 +262,8 @@ void InitializeWindowViewport(Window *w, int x, int y, vp->overlay = nullptr; w->viewport = vp; - vp->virtual_left = 0; // pt.x; - vp->virtual_top = 0; // pt.y; + vp->virtual_left = 0; + vp->virtual_top = 0; } static Point _vp_move_offs; From 755e41de9f026a4d05370bd603e6915a331bd741 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Thu, 26 Jan 2023 22:59:32 +0100 Subject: [PATCH 04/12] Codechange: make rounding code clearer -O1 already optimizes it to the original hand optimized magic code --- src/elrail.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/elrail.cpp b/src/elrail.cpp index f284e6fe2f..36c5396f11 100644 --- a/src/elrail.cpp +++ b/src/elrail.cpp @@ -234,7 +234,9 @@ static int GetPCPElevation(TileIndex tile, DiagDirection PCPpos) int z = GetSlopePixelZ(TileX(tile) * TILE_SIZE + std::min(x_pcp_offsets[PCPpos], TILE_SIZE - 1), TileY(tile) * TILE_SIZE + std::min(y_pcp_offsets[PCPpos], TILE_SIZE - 1)); - return (z + 2) & ~3; // this means z = (z + TILE_HEIGHT / 4) / (TILE_HEIGHT / 2) * (TILE_HEIGHT / 2); + /* Round the Z to the nearest half tile height. */ + static const uint HALF_TILE_HEIGHT = TILE_HEIGHT / 2; + return (z + HALF_TILE_HEIGHT / 2) / HALF_TILE_HEIGHT * HALF_TILE_HEIGHT; } /** From 00721787e18569e1d70db36be3de6814c861d99c Mon Sep 17 00:00:00 2001 From: Rubidium Date: Thu, 26 Jan 2023 23:34:28 +0100 Subject: [PATCH 05/12] Fix: wrong type for INVALID_LINK_GRAPH_JOB --- src/linkgraph/linkgraph_type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linkgraph/linkgraph_type.h b/src/linkgraph/linkgraph_type.h index a2618ae84f..1839633bf6 100644 --- a/src/linkgraph/linkgraph_type.h +++ b/src/linkgraph/linkgraph_type.h @@ -14,7 +14,7 @@ typedef uint16 LinkGraphID; static const LinkGraphID INVALID_LINK_GRAPH = UINT16_MAX; typedef uint16 LinkGraphJobID; -static const LinkGraphID INVALID_LINK_GRAPH_JOB = UINT16_MAX; +static const LinkGraphJobID INVALID_LINK_GRAPH_JOB = UINT16_MAX; typedef uint16 NodeID; static const NodeID INVALID_NODE = UINT16_MAX; From 7e1d272397085bd2add0999507657f57b9bd3840 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Thu, 26 Jan 2023 23:34:52 +0100 Subject: [PATCH 06/12] Cleanup: remove unused static variables --- src/network/core/config.h | 3 --- src/order_backup.h | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/network/core/config.h b/src/network/core/config.h index 3c9e1a50c1..667dceef58 100644 --- a/src/network/core/config.h +++ b/src/network/core/config.h @@ -24,7 +24,6 @@ static const uint16 NETWORK_COORDINATOR_SERVER_PORT = 3976; ///< The d static const uint16 NETWORK_STUN_SERVER_PORT = 3975; ///< The default port of the STUN server (TCP) static const uint16 NETWORK_TURN_SERVER_PORT = 3974; ///< The default port of the TURN server (TCP) static const uint16 NETWORK_CONTENT_SERVER_PORT = 3978; ///< The default port of the content server (TCP) -static const uint16 NETWORK_CONTENT_MIRROR_PORT = 80; ///< The default port of the content mirror (TCP) static const uint16 NETWORK_DEFAULT_PORT = 3979; ///< The default port of the game server (TCP & UDP) static const uint16 NETWORK_ADMIN_PORT = 3977; ///< The default port for admin network static const uint16 NETWORK_DEFAULT_DEBUGLOG_PORT = 3982; ///< The default port debug-log is sent to (TCP) @@ -49,7 +48,6 @@ static const uint16 COMPAT_MTU = 1460; ///< Numbe static const byte NETWORK_GAME_ADMIN_VERSION = 2; ///< What version of the admin network do we use? static const byte NETWORK_GAME_INFO_VERSION = 6; ///< What version of game-info do we use? -static const byte NETWORK_COMPANY_INFO_VERSION = 6; ///< What version of company info is this? static const byte NETWORK_COORDINATOR_VERSION = 6; ///< What version of game-coordinator-protocol do we use? static const uint NETWORK_NAME_LENGTH = 80; ///< The maximum length of the server name and map name, in bytes including '\0' @@ -59,7 +57,6 @@ static const uint NETWORK_HOSTNAME_PORT_LENGTH = 80 + 6; ///< The m static const uint NETWORK_SERVER_ID_LENGTH = 33; ///< The maximum length of the network id of the servers, in bytes including '\0' static const uint NETWORK_REVISION_LENGTH = 33; ///< The maximum length of the revision, in bytes including '\0' static const uint NETWORK_PASSWORD_LENGTH = 33; ///< The maximum length of the password, in bytes including '\0' (must be >= NETWORK_SERVER_ID_LENGTH) -static const uint NETWORK_CLIENTS_LENGTH = 200; ///< The maximum length for the list of clients that controls a company, in bytes including '\0' static const uint NETWORK_CLIENT_NAME_LENGTH = 25; ///< The maximum length of a client's name, in bytes including '\0' static const uint NETWORK_RCONCOMMAND_LENGTH = 500; ///< The maximum length of a rconsole command, in bytes including '\0' static const uint NETWORK_GAMESCRIPT_JSON_LENGTH = COMPAT_MTU - 3; ///< The maximum length of a gamescript json string, in bytes including '\0'. Must not be longer than COMPAT_MTU including header (3 bytes) diff --git a/src/order_backup.h b/src/order_backup.h index c92adbb411..2795eba69f 100644 --- a/src/order_backup.h +++ b/src/order_backup.h @@ -26,9 +26,6 @@ typedef Pool OrderBackupPool; /** The pool with order backups. */ extern OrderBackupPool _order_backup_pool; -/** Flag to pass to the vehicle construction command when an order should be preserved. */ -static const uint32 MAKE_ORDER_BACKUP_FLAG = 1U << 31; - /** * Data for backing up an order of a vehicle so it can be * restored after a vehicle is rebuilt in the same depot. From dbc666905dbda26806211b8425649ba8eb105c33 Mon Sep 17 00:00:00 2001 From: translators Date: Fri, 27 Jan 2023 18:45:27 +0000 Subject: [PATCH 07/12] Update: Translations from eints czech: 10 changes by jacobczsk dutch: 4 changes by Afoklala --- src/lang/czech.txt | 16 ++++++++++------ src/lang/dutch.txt | 4 ++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/lang/czech.txt b/src/lang/czech.txt index 3841b58be6..625c1c5b30 100644 --- a/src/lang/czech.txt +++ b/src/lang/czech.txt @@ -461,7 +461,7 @@ STR_SCENEDIT_TOOLBAR_TOWN_GENERATION :{BLACK}Generov STR_SCENEDIT_TOOLBAR_INDUSTRY_GENERATION :{BLACK}Generování průmyslu STR_SCENEDIT_TOOLBAR_ROAD_CONSTRUCTION :{BLACK}Výstavba silniční sítě STR_SCENEDIT_TOOLBAR_TRAM_CONSTRUCTION :{BLACK}Výstavba tramvajové tratě -STR_SCENEDIT_TOOLBAR_PLANT_TREES :{BLACK}Vysadit stromy. Shift zobrazí odhad ceny +STR_SCENEDIT_TOOLBAR_PLANT_TREES :{BLACK}Vysadit stromy. Ctrl vybírá území úhlopříčně. Shift zobrazí odhad ceny STR_SCENEDIT_TOOLBAR_PLACE_SIGN :{BLACK}Umístit popisek STR_SCENEDIT_TOOLBAR_PLACE_OBJECT :{BLACK}Umisťte objekt. Pro zobrazení odhadu ceny podrž Shift. Ctrl vybírá oblast diagonálně @@ -2012,13 +2012,13 @@ STR_CONFIG_SETTING_LINKGRAPH_TIME :Zaber si {STRIN STR_CONFIG_SETTING_LINKGRAPH_TIME_HELPTEXT :Čas vyhrazený pro každý přepočet části grafu spojení. Pokud přepočet začne, je vytvořeno nové vlákno, které má dovoleno běžet po zvolený počet dnů. Čím nižší hodnotu nastavíš tím je pravděpodobnější, že vlákno nebude dokončeno kdy má. Pokud se tak stane, hra se zastaví ("lagne") dokud dokončeno nebude. Čím vyšší hodnotu nastavíš, tím déle bude trvat aktualizace grafu pokud se trasy změní. STR_CONFIG_SETTING_DISTRIBUTION_PAX :Mód distribuce pro cestující: {STRING} -STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :"Rovnoměrný" znamená, že téměř stejné množství cestujících chce cestovat ze stanice A do stanice B, jako ze stanice B do A. "Nerovnoměrný znamená", že libovolné množství cestujících může cestovat v jakýchkoliv směrech. "manuální" znamená, že zde nebude žádná automatická distribuce pro cestující. +STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :"Rovnoměrný" znamená, že téměř stejné množství cestujících chce cestovat ze stanice A do stanice B, jako ze stanice B do A. "Nerovnoměrný" znamená, že libovolné množství cestujících může cestovat v jakémkoliv směru. "Manuální" znamená, že zde nebude žádná automatická distribuce pro cestující. STR_CONFIG_SETTING_DISTRIBUTION_MAIL :Mód distribuce pro poštu: {STRING} -STR_CONFIG_SETTING_DISTRIBUTION_MAIL_HELPTEXT :"Rovnoměrný" znamená, že téměř stejné množství pošty bude odesláno ze stanice A do stanice B, jako ze stanice B do A. "Nerovnoměrný znamená", že libovolné množství pošty může být odesláno v jakýchkoliv směrech. "manuální" znamená, že zde nebude žádná automatická distribuce pro poštu. +STR_CONFIG_SETTING_DISTRIBUTION_MAIL_HELPTEXT :"Rovnoměrný" znamená, že téměř stejné množství pošty bude odesláno ze stanice A do stanice B, jako ze stanice B do A. "Nerovnoměrný" znamená, že libovolné množství pošty může být odesláno v jakémkoli směru. "Manuální" znamená, že zde nebude žádná automatická distribuce pro poštu. STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED :Mód distribuce pro náklady pancéřových vozů: {STRING} -STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED_HELPTEXT :Pancéřované vozy převážejí ceniny v mírném, diamanty v subtropickém nebo zlato v subarktickém klimatu. Nové grafiky však toho mohou změnit. "Rovnoměrný" znamená, že téměř stejné množství nákladu bude odesláno ze stanice A do stanice B, jako ze stanice B do A. "Nerovnoměrný znamená", že libovolná množství nákladu mohou být odeslána v jakýchkoliv směrech. "manuální" znamená, že zde nebude žádná automatická distribuce pro tyto druhy nákladu. Je doporučeno nastavit "nerovnoměrný" nebo "manuální" při hraní v subarktickém klimatu, neboť banky neposílají do dolů žádné zlato. Pro mírné a subtropické klima můžeš nastavit "rovnoměrné", neboť banky odesílají zpět do původní banky nějaký náklad cenin. +STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED_HELPTEXT :Pancéřované vozy převážejí ceniny v mírném, diamanty v subtropickém nebo zlato v subarktickém klimatu. Nové grafiky však toho mohou změnit. "Rovnoměrný" znamená, že téměř stejné množství nákladu bude odesláno ze stanice A do stanice B, jako ze stanice B do A. "Nerovnoměrný" znamená, že libovolná množství nákladu mohou být odeslána v jakémkoliv směru. "Manuální" znamená, že zde nebude žádná automatická distribuce pro tyto druhy nákladu. Je doporučeno nastavit "nerovnoměrný" nebo "manuální" při hraní v subarktickém klimatu, neboť banky neposílají do dolů žádné zlato. Pro mírné a subtropické klima můžeš nastavit "rovnoměrné", neboť banky odesílají zpět do původní banky nějaký náklad cenin. STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT :Módy distribuce pro ostatní třídy nákladu: {STRING} -STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT_HELPTEXT :"Rovnoměrný" znamená, že téměř stejné množství nákladu bude odesláno ze stanice A do stanice B, jako ze stanice B do A. "Nerovnoměrný znamená", že libovolná množství nákladu mohou být odeslána v jakýchkoliv směrech. "manuální" znamená, že zde nebude žádná automatická distribuce pro tyto druhy nákladu. Pravděpodobně chceš nastavit "nerovnoměrná" nebo "manuální"." +STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT_HELPTEXT :"Nerovnoměrný" znamená, že libovolná množství nákladu mohou být odeslána v jakémkoli směru. "manuální" znamená, že zde nebude žádná automatická distribuce pro tyto druhy nákladu. ###length 3 STR_CONFIG_SETTING_DISTRIBUTION_MANUAL :manuální STR_CONFIG_SETTING_DISTRIBUTION_ASYMMETRIC :nerovnoměrný @@ -2785,6 +2785,10 @@ STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_INCREASE_TOOLTIP :{BLACK}Zvýšit STR_SELECT_RAIL_BRIDGE_CAPTION :{WHITE}Zvolit železniční most STR_SELECT_ROAD_BRIDGE_CAPTION :{WHITE}Zvolit silniční most STR_SELECT_BRIDGE_SELECTION_TOOLTIP :{BLACK}Výběr mostů - staví se kliknutím na obrázek mostu +STR_SELECT_BRIDGE_INFO_NAME :{GOLD}{STRING} +STR_SELECT_BRIDGE_INFO_NAME_MAX_SPEED :{GOLD}{STRING},{} {VELOCITY} +STR_SELECT_BRIDGE_INFO_NAME_COST :{GOLD}{0:STRING},{} {WHITE}{2:CURRENCY_LONG} +STR_SELECT_BRIDGE_INFO_NAME_MAX_SPEED_COST :{GOLD}{STRING},{} {VELOCITY} {WHITE}{CURRENCY_LONG} STR_BRIDGE_NAME_SUSPENSION_STEEL :Zavěšený, ocelový STR_BRIDGE_NAME_GIRDER_STEEL :Trámový, ocelový STR_BRIDGE_NAME_CANTILEVER_STEEL :Konzolový, ocelový @@ -2904,7 +2908,7 @@ STR_OBJECT_CLASS_TRNS :Vysílače STR_PLANT_TREE_CAPTION :{WHITE}Stromy STR_PLANT_TREE_TOOLTIP :{BLACK}Zvol druh stromu na vysazení. Pokud se na políčku už nějaký strom nachází, přidá se k němu několik různých druhů bez ohledu na výběr druhu STR_TREES_RANDOM_TYPE :{BLACK}Různé stromy -STR_TREES_RANDOM_TYPE_TOOLTIP :{BLACK}Umístit nahodné stromy. Stisknutý Shift pro zobrazení odhadu ceny +STR_TREES_RANDOM_TYPE_TOOLTIP :{BLACK}Umístit nahodné stromy. Ctrl vybírá území úhlopříčně. Stisknutý Shift pro zobrazení odhadu ceny STR_TREES_RANDOM_TREES_BUTTON :{BLACK}Náhodné stromy STR_TREES_RANDOM_TREES_TOOLTIP :{BLACK}Umístit stromy náhodně po krajině STR_TREES_MODE_NORMAL_BUTTON :{BLACK}Normální diff --git a/src/lang/dutch.txt b/src/lang/dutch.txt index cb6dc3b0fd..0f1427b1cb 100644 --- a/src/lang/dutch.txt +++ b/src/lang/dutch.txt @@ -2698,6 +2698,10 @@ STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_INCREASE_TOOLTIP :{BLACK}Dichthei STR_SELECT_RAIL_BRIDGE_CAPTION :{WHITE}Selecteer type spoorbrug STR_SELECT_ROAD_BRIDGE_CAPTION :{WHITE}Selecteer type wegbrug STR_SELECT_BRIDGE_SELECTION_TOOLTIP :{BLACK}Brugkeuze - klik op de gewenste brug om die te bouwen +STR_SELECT_BRIDGE_INFO_NAME :{GOLD}{STRING} +STR_SELECT_BRIDGE_INFO_NAME_MAX_SPEED :{GOLD}{STRING},{} {VELOCITY} +STR_SELECT_BRIDGE_INFO_NAME_COST :{GOLD}{0:STRING},{} {WHITE}{2:CURRENCY_LONG} +STR_SELECT_BRIDGE_INFO_NAME_MAX_SPEED_COST :{GOLD}{STRING},{} {VELOCITY} {WHITE}{CURRENCY_LONG} STR_BRIDGE_NAME_SUSPENSION_STEEL :Hangend, staal STR_BRIDGE_NAME_GIRDER_STEEL :Ligger, staal STR_BRIDGE_NAME_CANTILEVER_STEEL :Vrijdragend, staal From ed7685910de19c1b8f52dceb167bf89b4149c059 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Sat, 28 Jan 2023 13:02:05 +0100 Subject: [PATCH 08/12] Codechange: pass large objects by reference instead of value Especially when they get passed on directly to the next function or via a constructor into an instance variable --- src/network/core/tcp.h | 2 +- src/network/core/tcp_connect.cpp | 2 +- src/settings_internal.h | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/network/core/tcp.h b/src/network/core/tcp.h index 7bce8f6c0a..252f2c2456 100644 --- a/src/network/core/tcp.h +++ b/src/network/core/tcp.h @@ -115,7 +115,7 @@ private: public: TCPConnecter() {}; - TCPConnecter(const std::string &connection_string, uint16 default_port, NetworkAddress bind_address = {}, int family = AF_UNSPEC); + TCPConnecter(const std::string &connection_string, uint16 default_port, const NetworkAddress &bind_address = {}, int family = AF_UNSPEC); virtual ~TCPConnecter(); /** diff --git a/src/network/core/tcp_connect.cpp b/src/network/core/tcp_connect.cpp index a9cc77934e..17c1de886f 100644 --- a/src/network/core/tcp_connect.cpp +++ b/src/network/core/tcp_connect.cpp @@ -29,7 +29,7 @@ static std::vector _tcp_connecters; * @param default_port If not indicated in connection_string, what port to use. * @param bind_address The local bind address to use. Defaults to letting the OS find one. */ -TCPConnecter::TCPConnecter(const std::string &connection_string, uint16 default_port, NetworkAddress bind_address, int family) : +TCPConnecter::TCPConnecter(const std::string &connection_string, uint16 default_port, const NetworkAddress &bind_address, int family) : bind_address(bind_address), family(family) { diff --git a/src/settings_internal.h b/src/settings_internal.h index 75b520222c..914c8a79fa 100644 --- a/src/settings_internal.h +++ b/src/settings_internal.h @@ -70,7 +70,7 @@ struct IniItem; /** Properties of config file settings. */ struct SettingDesc { - SettingDesc(SaveLoad save, SettingFlag flags, bool startup) : + SettingDesc(const SaveLoad &save, SettingFlag flags, bool startup) : flags(flags), startup(startup), save(save) {} virtual ~SettingDesc() {} @@ -149,7 +149,7 @@ struct IntSettingDesc : SettingDesc { */ typedef void PostChangeCallback(int32 value); - IntSettingDesc(SaveLoad save, SettingFlag flags, bool startup, int32 def, + IntSettingDesc(const SaveLoad &save, SettingFlag flags, bool startup, int32 def, int32 min, uint32 max, int32 interval, StringID str, StringID str_help, StringID str_val, SettingCategory cat, PreChangeCheck pre_check, PostChangeCallback post_callback) : SettingDesc(save, flags, startup), def(def), min(min), max(max), interval(interval), @@ -191,7 +191,7 @@ private: /** Boolean setting. */ struct BoolSettingDesc : IntSettingDesc { - BoolSettingDesc(SaveLoad save, SettingFlag flags, bool startup, bool def, + BoolSettingDesc(const SaveLoad &save, SettingFlag flags, bool startup, bool def, StringID str, StringID str_help, StringID str_val, SettingCategory cat, PreChangeCheck pre_check, PostChangeCallback post_callback) : IntSettingDesc(save, flags, startup, def, 0, 1, 0, str, str_help, str_val, cat, @@ -207,7 +207,7 @@ struct BoolSettingDesc : IntSettingDesc { struct OneOfManySettingDesc : IntSettingDesc { typedef size_t OnConvert(const char *value); ///< callback prototype for conversion error - OneOfManySettingDesc(SaveLoad save, SettingFlag flags, bool startup, int32 def, + OneOfManySettingDesc(const SaveLoad &save, SettingFlag flags, bool startup, int32 def, int32 max, StringID str, StringID str_help, StringID str_val, SettingCategory cat, PreChangeCheck pre_check, PostChangeCallback post_callback, std::initializer_list many, OnConvert *many_cnvt) : @@ -231,7 +231,7 @@ struct OneOfManySettingDesc : IntSettingDesc { /** Many of many setting. */ struct ManyOfManySettingDesc : OneOfManySettingDesc { - ManyOfManySettingDesc(SaveLoad save, SettingFlag flags, bool startup, + ManyOfManySettingDesc(const SaveLoad &save, SettingFlag flags, bool startup, int32 def, StringID str, StringID str_help, StringID str_val, SettingCategory cat, PreChangeCheck pre_check, PostChangeCallback post_callback, std::initializer_list many, OnConvert *many_cnvt) : @@ -260,7 +260,7 @@ struct StringSettingDesc : SettingDesc { */ typedef void PostChangeCallback(const std::string &value); - StringSettingDesc(SaveLoad save, SettingFlag flags, bool startup, const char *def, + StringSettingDesc(const SaveLoad &save, SettingFlag flags, bool startup, const char *def, uint32 max_length, PreChangeCheck pre_check, PostChangeCallback post_callback) : SettingDesc(save, flags, startup), def(def == nullptr ? "" : def), max_length(max_length), pre_check(pre_check), post_callback(post_callback) {} @@ -286,7 +286,7 @@ private: /** List/array settings. */ struct ListSettingDesc : SettingDesc { - ListSettingDesc(SaveLoad save, SettingFlag flags, bool startup, const char *def) : + ListSettingDesc(const SaveLoad &save, SettingFlag flags, bool startup, const char *def) : SettingDesc(save, flags, startup), def(def) {} virtual ~ListSettingDesc() {} @@ -299,7 +299,7 @@ struct ListSettingDesc : SettingDesc { /** Placeholder for settings that have been removed, but might still linger in the savegame. */ struct NullSettingDesc : SettingDesc { - NullSettingDesc(SaveLoad save) : + NullSettingDesc(const SaveLoad &save) : SettingDesc(save, SF_NOT_IN_CONFIG, false) {} virtual ~NullSettingDesc() {} From d51d08ddcb58ff1649a3350b052a4917d140cde3 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Fri, 27 Jan 2023 22:40:30 +0100 Subject: [PATCH 09/12] Codechange: put stack variables in global variables for gamelog/crashlog --- src/crashlog.cpp | 23 ++++++----------------- src/crashlog.h | 14 +++----------- src/gamelog.cpp | 24 +++++++----------------- src/gamelog.h | 9 ++------- src/os/macosx/crashlog_osx.cpp | 2 +- src/os/unix/crashlog_unix.cpp | 2 +- src/os/windows/crashlog_win.cpp | 2 +- 7 files changed, 21 insertions(+), 55 deletions(-) diff --git a/src/crashlog.cpp b/src/crashlog.cpp index 3ac2dd6035..594884c712 100644 --- a/src/crashlog.cpp +++ b/src/crashlog.cpp @@ -67,9 +67,7 @@ #include "safeguards.h" -/* static */ const char *CrashLog::message = nullptr; -/* static */ char *CrashLog::gamelog_buffer = nullptr; -/* static */ const char *CrashLog::gamelog_last = nullptr; +/* static */ std::string CrashLog::message{ "" }; char *CrashLog::LogCompiler(char *buffer, const char *last) const { @@ -279,15 +277,6 @@ char *CrashLog::LogLibraries(char *buffer, const char *last) const return buffer; } -/** - * Helper function for printing the gamelog. - * @param s the string to print. - */ -/* static */ void CrashLog::GamelogFillCrashLog(const char *s) -{ - CrashLog::gamelog_buffer += seprintf(CrashLog::gamelog_buffer, CrashLog::gamelog_last, "%s\n", s); -} - /** * Writes the gamelog data to the buffer. * @param buffer The begin where to write at. @@ -296,10 +285,10 @@ char *CrashLog::LogLibraries(char *buffer, const char *last) const */ char *CrashLog::LogGamelog(char *buffer, const char *last) const { - CrashLog::gamelog_buffer = buffer; - CrashLog::gamelog_last = last; - GamelogPrint(&CrashLog::GamelogFillCrashLog); - return CrashLog::gamelog_buffer + seprintf(CrashLog::gamelog_buffer, last, "\n"); + GamelogPrint([&buffer, last](const char *s) { + buffer += seprintf(buffer, last, "%s\n", s); + }); + return buffer + seprintf(buffer, last, "\n"); } /** @@ -358,7 +347,7 @@ char *CrashLog::FillCrashLog(char *buffer, const char *last) const ConvertDateToYMD(_date, &ymd); buffer += seprintf(buffer, last, "In game date: %i-%02i-%02i (%i)\n\n", ymd.year, ymd.month + 1, ymd.day, _date_fract); - buffer = this->LogError(buffer, last, CrashLog::message); + buffer = this->LogError(buffer, last, CrashLog::message.c_str()); buffer = this->LogOpenTTDVersion(buffer, last); buffer = this->LogRegisters(buffer, last); buffer = this->LogStacktrace(buffer, last); diff --git a/src/crashlog.h b/src/crashlog.h index b7945a9839..5f24fc80d6 100644 --- a/src/crashlog.h +++ b/src/crashlog.h @@ -15,16 +15,8 @@ */ class CrashLog { private: - /** Pointer to the error message. */ - static const char *message; - - /** Temporary 'local' location of the buffer. */ - static char *gamelog_buffer; - - /** Temporary 'local' location of the end of the buffer. */ - static const char *gamelog_last; - - static void GamelogFillCrashLog(const char *s); + /** Error message coming from #error(const char *, ...). */ + static std::string message; protected: /** * Writes OS' version to the buffer. @@ -46,7 +38,7 @@ protected: * Writes actually encountered error to the buffer. * @param buffer The begin where to write at. * @param last The last position in the buffer to write to. - * @param message Message passed to use for possible errors. Can be nullptr. + * @param message Message passed to use for errors. * @return the position of the \c '\0' character after the buffer. */ virtual char *LogError(char *buffer, const char *last, const char *message) const = 0; diff --git a/src/gamelog.cpp b/src/gamelog.cpp index 7880d06e42..5a6e4b477b 100644 --- a/src/gamelog.cpp +++ b/src/gamelog.cpp @@ -189,7 +189,7 @@ typedef SmallMap GrfIDMapping; * Prints active gamelog * @param proc the procedure to draw with */ -void GamelogPrint(GamelogPrintProc *proc) +void GamelogPrint(std::function proc) { char buffer[1024]; GrfIDMapping grf_names; @@ -341,25 +341,14 @@ void GamelogPrint(GamelogPrintProc *proc) } -static void GamelogPrintConsoleProc(const char *s) -{ - IConsolePrint(CC_WARNING, s); -} - /** Print the gamelog data to the console. */ void GamelogPrintConsole() { - GamelogPrint(&GamelogPrintConsoleProc); + GamelogPrint([](const char *s) { + IConsolePrint(CC_WARNING, s); + }); } -static int _gamelog_print_level = 0; ///< gamelog debug level we need to print stuff - -static void GamelogPrintDebugProc(const char *s) -{ - Debug(gamelog, _gamelog_print_level, "{}", s); -} - - /** * Prints gamelog to debug output. Code is executed even when * there will be no output. It is called very seldom, so it @@ -368,8 +357,9 @@ static void GamelogPrintDebugProc(const char *s) */ void GamelogPrintDebug(int level) { - _gamelog_print_level = level; - GamelogPrint(&GamelogPrintDebugProc); + GamelogPrint([level](const char *s) { + Debug(gamelog, level, "{}", s); + }); } diff --git a/src/gamelog.h b/src/gamelog.h index cfa6c626a2..0555ca5e77 100644 --- a/src/gamelog.h +++ b/src/gamelog.h @@ -10,6 +10,7 @@ #ifndef GAMELOG_H #define GAMELOG_H +#include #include "newgrf_config.h" /** The actions we log. */ @@ -32,13 +33,7 @@ void GamelogStopAnyAction(); void GamelogFree(struct LoggedAction *gamelog_action, uint gamelog_actions); void GamelogReset(); -/** - * Callback for printing text. - * @param s The string to print. - */ -typedef void GamelogPrintProc(const char *s); -void GamelogPrint(GamelogPrintProc *proc); // needed for WIN32 crash.log - +void GamelogPrint(std::function proc); void GamelogPrintDebug(int level); void GamelogPrintConsole(); diff --git a/src/os/macosx/crashlog_osx.cpp b/src/os/macosx/crashlog_osx.cpp index 682ed6d073..68e2e5633d 100644 --- a/src/os/macosx/crashlog_osx.cpp +++ b/src/os/macosx/crashlog_osx.cpp @@ -80,7 +80,7 @@ class CrashLogOSX : public CrashLog { " Message: %s\n\n", strsignal(this->signum), this->signum, - message == nullptr ? "" : message + message ); } diff --git a/src/os/unix/crashlog_unix.cpp b/src/os/unix/crashlog_unix.cpp index fc3682d024..cb4103e693 100644 --- a/src/os/unix/crashlog_unix.cpp +++ b/src/os/unix/crashlog_unix.cpp @@ -66,7 +66,7 @@ class CrashLogUnix : public CrashLog { " Message: %s\n\n", strsignal(this->signum), this->signum, - message == nullptr ? "" : message + message ); } diff --git a/src/os/windows/crashlog_win.cpp b/src/os/windows/crashlog_win.cpp index e1a05a8aaf..9079267358 100644 --- a/src/os/windows/crashlog_win.cpp +++ b/src/os/windows/crashlog_win.cpp @@ -114,7 +114,7 @@ public: " Message: %s\n\n", (int)ep->ExceptionRecord->ExceptionCode, (size_t)ep->ExceptionRecord->ExceptionAddress, - message == nullptr ? "" : message + message ); } From 04d10b3d2da67260818f5e6b1614bace04d46507 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Sat, 28 Jan 2023 10:53:42 +0100 Subject: [PATCH 10/12] Codechange: instead of global pointer to stack variable, just put variable in that global Removes one indirection and a dangling pointer to a stack location --- src/tile_cmd.h | 4 ++-- src/viewport.cpp | 30 ++++++++++++++---------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/tile_cmd.h b/src/tile_cmd.h index 75964abad5..2fdf1b30bf 100644 --- a/src/tile_cmd.h +++ b/src/tile_cmd.h @@ -40,8 +40,8 @@ DECLARE_ENUM_AS_BIT_SET(VehicleEnterTileStatus) /** Tile information, used while rendering the tile */ struct TileInfo { - uint x; ///< X position of the tile in unit coordinates - uint y; ///< Y position of the tile in unit coordinates + int x; ///< X position of the tile in unit coordinates + int y; ///< Y position of the tile in unit coordinates Slope tileh; ///< Slope of the tile TileIndex tile; ///< Tile index int z; ///< Height diff --git a/src/viewport.cpp b/src/viewport.cpp index c52449f5e1..3823b63e38 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -186,7 +186,7 @@ static bool MarkViewportDirty(const Viewport *vp, int left, int top, int right, static ViewportDrawer _vd; TileHighlightData _thd; -static TileInfo *_cur_ti; +static TileInfo _cur_ti; bool _draw_bounding_boxes = false; bool _draw_dirty_blocks = false; uint _dirty_block_colour = 0; @@ -566,7 +566,7 @@ void DrawGroundSpriteAt(SpriteID image, PaletteID pal, int32 x, int32 y, int z, Point pt = RemapCoords(x, y, z); AddChildSpriteToFoundation(image, pal, sub, _vd.foundation_part, pt.x + extra_offs_x * ZOOM_LVL_BASE, pt.y + extra_offs_y * ZOOM_LVL_BASE); } else { - AddTileSpriteToDraw(image, pal, _cur_ti->x + x, _cur_ti->y + y, _cur_ti->z + z, sub, extra_offs_x * ZOOM_LVL_BASE, extra_offs_y * ZOOM_LVL_BASE); + AddTileSpriteToDraw(image, pal, _cur_ti.x + x, _cur_ti.y + y, _cur_ti.z + z, sub, extra_offs_x * ZOOM_LVL_BASE, extra_offs_y * ZOOM_LVL_BASE); } } @@ -1219,26 +1219,24 @@ static void ViewportAddLandscape() assert(row == tilecoord.y + tilecoord.x); TileType tile_type; - TileInfo tile_info; - _cur_ti = &tile_info; - tile_info.x = tilecoord.x * TILE_SIZE; // FIXME tile_info should use signed integers - tile_info.y = tilecoord.y * TILE_SIZE; + _cur_ti.x = tilecoord.x * TILE_SIZE; + _cur_ti.y = tilecoord.y * TILE_SIZE; if (IsInsideBS(tilecoord.x, 0, Map::SizeX()) && IsInsideBS(tilecoord.y, 0, Map::SizeY())) { /* This includes the south border at Map::MaxX / Map::MaxY. When terraforming we still draw tile selections there. */ - tile_info.tile = TileXY(tilecoord.x, tilecoord.y); - tile_type = GetTileType(tile_info.tile); + _cur_ti.tile = TileXY(tilecoord.x, tilecoord.y); + tile_type = GetTileType(_cur_ti.tile); } else { - tile_info.tile = INVALID_TILE; + _cur_ti.tile = INVALID_TILE; tile_type = MP_VOID; } if (tile_type != MP_VOID) { /* We are inside the map => paint landscape. */ - tile_info.tileh = GetTilePixelSlope(tile_info.tile, &tile_info.z); + _cur_ti.tileh = GetTilePixelSlope(_cur_ti.tile, &_cur_ti.z); } else { /* We are outside the map => paint black. */ - tile_info.tileh = GetTilePixelSlopeOutsideMap(tilecoord.x, tilecoord.y, &tile_info.z); + _cur_ti.tileh = GetTilePixelSlopeOutsideMap(tilecoord.x, tilecoord.y, &_cur_ti.z); } int viewport_y = GetViewportY(tilecoord); @@ -1257,10 +1255,10 @@ static void ViewportAddLandscape() /* Is tile with buildings visible? */ if (min_visible_height < MAX_TILE_EXTENT_TOP) tile_visible = true; - if (IsBridgeAbove(tile_info.tile)) { + if (IsBridgeAbove(_cur_ti.tile)) { /* Is the bridge visible? */ - TileIndex bridge_tile = GetNorthernBridgeEnd(tile_info.tile); - int bridge_height = ZOOM_LVL_BASE * (GetBridgePixelHeight(bridge_tile) - TilePixelHeight(tile_info.tile)); + TileIndex bridge_tile = GetNorthernBridgeEnd(_cur_ti.tile); + int bridge_height = ZOOM_LVL_BASE * (GetBridgePixelHeight(bridge_tile) - TilePixelHeight(_cur_ti.tile)); if (min_visible_height < bridge_height + MAX_TILE_EXTENT_TOP) tile_visible = true; } @@ -1281,8 +1279,8 @@ static void ViewportAddLandscape() _vd.last_foundation_child[0] = nullptr; _vd.last_foundation_child[1] = nullptr; - _tile_type_procs[tile_type]->draw_tile_proc(&tile_info); - if (tile_info.tile != INVALID_TILE) DrawTileSelection(&tile_info); + _tile_type_procs[tile_type]->draw_tile_proc(&_cur_ti); + if (_cur_ti.tile != INVALID_TILE) DrawTileSelection(&_cur_ti); } } } From 4a58d197ee69ed063d4bbcc3f2d44c2f08733294 Mon Sep 17 00:00:00 2001 From: translators Date: Sat, 28 Jan 2023 18:44:03 +0000 Subject: [PATCH 11/12] Update: Translations from eints japanese: 26 changes by Azusa257 vietnamese: 4 changes by KhoiCanDev chinese (simplified): 4 changes by XiaoJi-Game french: 8 changes by glx22 --- src/lang/french.txt | 12 ++++++++---- src/lang/japanese.txt | 26 ++++++++++++++++++++++++++ src/lang/simplified_chinese.txt | 4 ++++ src/lang/vietnamese.txt | 4 ++++ 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/lang/french.txt b/src/lang/french.txt index 416b84f42b..c485ef3aca 100644 --- a/src/lang/french.txt +++ b/src/lang/french.txt @@ -1926,13 +1926,13 @@ STR_CONFIG_SETTING_LINKGRAPH_TIME :Prendre {STRING STR_CONFIG_SETTING_LINKGRAPH_TIME_HELPTEXT :Durée maximale (en jours) du recalcul d'une composante du graphe. À chaque itération, un thread est initié, qui a une durée maximale définie par ce réglage. Plus celui-ci est court, plus la probabilité que le thread ne termine pas sa tâche à temps est élevée. Le jeu s'interrompt alors jusqu'à la fin du recalcul ("lag"). Plus le réglage est long, et moins rapidement la distribution sera réactualisée en cas de changement de routes. STR_CONFIG_SETTING_DISTRIBUTION_PAX :Type de distribution pour les passagers{NBSP}: {STRING} -STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :"symétrique" signifie qu'autant de passagers iront d'une station A vers une station B, que de la station B vers la station A. "asymétrique" signifie qu'un nombre arbitraire de passagers peut être envoyé dans les deux directions. "manuel" signifie qu'aucune distribution n'est mise en place pour les passagers. +STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :"Symétrique" signifie qu'autant de passagers iront d'une station A vers une station B, que de la station B vers la station A. "Asymétrique" signifie qu'un nombre arbitraire de passagers peut être envoyé dans les deux directions. "Manuel" signifie qu'aucune distribution n'est mise en place pour les passagers. STR_CONFIG_SETTING_DISTRIBUTION_MAIL :Type de distribution pour le courrier{NBSP}: {STRING} -STR_CONFIG_SETTING_DISTRIBUTION_MAIL_HELPTEXT :"symétrique" signifie qu'autant de courrier ira d'une station A vers une station B, que de la station B vers la station A. "asymétrique" signifie qu'une quantité arbitraire de courrier peut être envoyée dans les deux directions. "manuel" signifie qu'aucune distribution n'est mise en place pour le courrier. +STR_CONFIG_SETTING_DISTRIBUTION_MAIL_HELPTEXT :"Symétrique" signifie qu'autant de courrier ira d'une station A vers une station B, que de la station B vers la station A. "Asymétrique" signifie qu'une quantité arbitraire de courrier peut être envoyée dans les deux directions. "Manuel" signifie qu'aucune distribution n'est mise en place pour le courrier. STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED :Type de distribution pour les cargaisons de classe ARMOURED{NBSP}: {STRING} -STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED_HELPTEXT :La classe de cargaison ARMOURED contient des biens de valeur dans les climats tempéré, des diamants dans le climat subtropical, et de l'or dans le climat subarctique. Les NewGRFs peuvent changer ça. "symétrique" signifie qu'autant de ces cargaisons iront d'une station A vers une station B, que de la station B vers la station A. "asymétrique" signifie qu'une quantité arbitraire de ces cargaisons peut être envoyée dans les deux directions. "manuel" signifie qu'aucune distribution n'est mise en place pour ces cargaisons. Il est conseillé de choisir "asymétrique" ou "manuel" dans le climat subarctique, car les banques n'enverront pas d'or en retour vers les mines d'or. Dans les climats tempéré et subtropical, on peut choisir aussi "symétrique", car les banques peuvent renvoyer en retour des biens de valeurs aux banques qui en envoient à l'origine. +STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED_HELPTEXT :La classe de cargaison ARMOURED contient des biens de valeur dans les climats tempéré, des diamants dans le climat subtropical, et de l'or dans le climat subarctique. Les NewGRFs peuvent changer ça. "Symétrique" signifie qu'autant de ces cargaisons iront d'une station A vers une station B, que de la station B vers la station A. "Asymétrique" signifie qu'une quantité arbitraire de ces cargaisons peut être envoyée dans les deux directions. "Manuel" signifie qu'aucune distribution n'est mise en place pour ces cargaisons. Il est conseillé de choisir "asymétrique" ou "manuel" dans les climats subarctique ou subtropical, car les banques ne font que recevoir des marchandises dans ces climats. Dans le climat tempéré, on peut choisir aussi "symétrique", car les banques peuvent renvoyer en retour des biens de valeurs aux banques qui en envoient à l'origine. STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT :Type de distribution pour les autres classes de cargaison{NBSP}: {STRING} -STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT_HELPTEXT :"asymétrique" signifie qu'une quantité arbitraire de cargaison peut être envoyée dans les deux directions. "manuel" signifie qu'aucune distribution n'est mise en place pour la cargaison. +STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT_HELPTEXT :"Asymétrique" signifie qu'une quantité arbitraire de cargaison peut être envoyée dans les deux directions. "Manuel" signifie qu'aucune distribution n'est mise en place pour la cargaison. ###length 3 STR_CONFIG_SETTING_DISTRIBUTION_MANUAL :manuel STR_CONFIG_SETTING_DISTRIBUTION_ASYMMETRIC :asymétrique @@ -2699,6 +2699,10 @@ STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_INCREASE_TOOLTIP :{BLACK}Augmente STR_SELECT_RAIL_BRIDGE_CAPTION :{WHITE}Choisir un pont ferroviaire STR_SELECT_ROAD_BRIDGE_CAPTION :{WHITE}Choisir un pont routier STR_SELECT_BRIDGE_SELECTION_TOOLTIP :{BLACK}Sélection de pont - Cliquer sur le type de pont désiré pour le construire. +STR_SELECT_BRIDGE_INFO_NAME :{GOLD}{STRING} +STR_SELECT_BRIDGE_INFO_NAME_MAX_SPEED :{GOLD}{STRING},{} {VELOCITY} +STR_SELECT_BRIDGE_INFO_NAME_COST :{GOLD}{0:STRING},{} {WHITE}{2:CURRENCY_LONG} +STR_SELECT_BRIDGE_INFO_NAME_MAX_SPEED_COST :{GOLD}{STRING},{} {VELOCITY} {WHITE}{CURRENCY_LONG} STR_BRIDGE_NAME_SUSPENSION_STEEL :Suspendu en acier STR_BRIDGE_NAME_GIRDER_STEEL :À poutres en acier STR_BRIDGE_NAME_CANTILEVER_STEEL :Porte-à-faux en acier diff --git a/src/lang/japanese.txt b/src/lang/japanese.txt index 33dffb1217..98d2eb8ed7 100644 --- a/src/lang/japanese.txt +++ b/src/lang/japanese.txt @@ -200,7 +200,11 @@ STR_UNITS_POWER_IMPERIAL :{COMMA}英馬 STR_UNITS_POWER_METRIC :{COMMA}仏馬力 STR_UNITS_POWER_SI :{COMMA}kW +STR_UNITS_POWER_METRIC_TO_WEIGHT_IMPERIAL :{DECIMAL}{NBSP}hp/t +STR_UNITS_POWER_METRIC_TO_WEIGHT_METRIC :{DECIMAL}{NBSP}hp/t +STR_UNITS_POWER_METRIC_TO_WEIGHT_SI :{DECIMAL}{NBSP}hp/Mg STR_UNITS_POWER_SI_TO_WEIGHT_IMPERIAL :{DECIMAL}{NBSP}kW/t +STR_UNITS_POWER_SI_TO_WEIGHT_METRIC :{DECIMAL}{NBSP}kW/t STR_UNITS_POWER_SI_TO_WEIGHT_SI :{DECIMAL}{NBSP}W/kg STR_UNITS_WEIGHT_SHORT_IMPERIAL :{COMMA}t @@ -397,6 +401,8 @@ STR_SCENEDIT_FILE_MENU_QUIT :OpenTTDを終 ###length 15 STR_SETTINGS_MENU_GAME_OPTIONS :ゲームオプション設定 STR_SETTINGS_MENU_CONFIG_SETTINGS_TREE :設定 +STR_SETTINGS_MENU_AI_SETTINGS :AI設定 +STR_SETTINGS_MENU_GAMESCRIPT_SETTINGS :ゲームスクリプト設定 STR_SETTINGS_MENU_NEWGRF_SETTINGS :NewGRFの設定 STR_SETTINGS_MENU_TRANSPARENCY_OPTIONS :透過表示設定 STR_SETTINGS_MENU_TOWN_NAMES_DISPLAYED :街名を表示 @@ -999,9 +1005,14 @@ STR_GAME_OPTIONS_VIDEO_VSYNC_TOOLTIP :{BLACK}ここ STR_GAME_OPTIONS_GUI_SCALE_FRAME :{BLACK}インターフェイスのサイズ +STR_GAME_OPTIONS_GUI_SCALE_TOOLTIP :{BLACK}スライダーをドラッグでインターフェースの大きさを調整できます。Ctrl押しながらで微調整できます。 STR_GAME_OPTIONS_GUI_SCALE_AUTO :{BLACK}サイズを自動調整 +STR_GAME_OPTIONS_GUI_SCALE_BEVELS :{BLACK}ベベルのスケール +STR_GAME_OPTIONS_GUI_SCALE_2X :2x +STR_GAME_OPTIONS_GUI_SCALE_3X :3x +STR_GAME_OPTIONS_GUI_SCALE_4X :4x STR_GAME_OPTIONS_GRAPHICS :{BLACK}グラフィクス @@ -1412,6 +1423,7 @@ STR_CONFIG_SETTING_GRAPH_LINE_THICKNESS_HELPTEXT :グラフ画面 STR_CONFIG_SETTING_SHOW_NEWGRF_NAME :購入可能な車両の一覧の詳細部分に NewGRF 名を表示する: {STRING} STR_CONFIG_SETTING_SHOW_NEWGRF_NAME_HELPTEXT :購入可能な車両の一覧の詳細部分に由来する NewGRF を表示します +STR_CONFIG_SETTING_SHOW_CARGO_IN_LISTS_HELPTEXT :有効にすると車両リスト内で車両の積載可能な貨物が上に表示されます STR_CONFIG_SETTING_LANDSCAPE :地形: {STRING} STR_CONFIG_SETTING_LANDSCAPE_HELPTEXT :地形は様々な貨物と街の成長要件に関する基礎的なゲームプレイシナリオを定義します。NewGRFとゲームスクリプトによってより効果的なコントロールが可能になります。 @@ -1499,6 +1511,8 @@ STR_CONFIG_SETTING_SMALLMAP_LAND_COLOUR_VIOLET :青紫 STR_CONFIG_SETTING_LINKGRAPH_COLOURS_HELPTEXT :貨物の流れのオーバーレイに使用される配色を設定します。 ###length 4 STR_CONFIG_SETTING_LINKGRAPH_COLOURS_GREEN_TO_BLUE :緑から青 +STR_CONFIG_SETTING_LINKGRAPH_COLOURS_GREY_TO_RED :灰色から赤 +STR_CONFIG_SETTING_LINKGRAPH_COLOURS_GREYSCALE :グレイスケール STR_CONFIG_SETTING_SCROLLMODE :ビューポートのスクロール挙動: {STRING} STR_CONFIG_SETTING_SCROLLMODE_HELPTEXT :マップのスクロール挙動 @@ -2043,6 +2057,7 @@ STR_INTRO_HIGHSCORE :{BLACK}ハイ STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}設定 STR_INTRO_NEWGRF_SETTINGS :{BLACK}NewGRFの設定 STR_INTRO_ONLINE_CONTENT :{BLACK}オンラインコンテンツの確認 +STR_INTRO_AI_SETTINGS :{BLACK}AI設定 STR_INTRO_QUIT :{BLACK}終了 STR_INTRO_TOOLTIP_NEW_GAME :{BLACK}新規ゲームを開始します。Ctrl+クリックで地形生成設定をスキップします @@ -2574,6 +2589,7 @@ STR_LINKGRAPH_LEGEND_SATURATED :{TINY_FONT}{BLA STR_LINKGRAPH_LEGEND_OVERLOADED :{TINY_FONT}{BLACK}供給過多 # Linkgraph tooltip +STR_LINKGRAPH_STATS_TOOLTIP_TIME_EXTENSION :{}平均移動時間: {NUM}{NBSP}日 # Base for station construction window(s) STR_STATION_BUILD_COVERAGE_AREA_TITLE :{BLACK}集荷範囲のハイライト @@ -2666,6 +2682,7 @@ STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_INCREASE_TOOLTIP :{BLACK}ドラ STR_SELECT_RAIL_BRIDGE_CAPTION :{WHITE}鉄道橋建設 STR_SELECT_ROAD_BRIDGE_CAPTION :{WHITE}道路橋建設 STR_SELECT_BRIDGE_SELECTION_TOOLTIP :{BLACK}建設したい橋の種類をクリックしてください +STR_SELECT_BRIDGE_INFO_NAME :{GOLD}{STRING} STR_BRIDGE_NAME_SUSPENSION_STEEL :吊橋(S造) STR_BRIDGE_NAME_GIRDER_STEEL :桁橋(S造) STR_BRIDGE_NAME_CANTILEVER_STEEL :カンチレバートラス橋(S造) @@ -3117,6 +3134,7 @@ STR_MAPGEN_SMOOTHNESS :{BLACK}地形 STR_MAPGEN_VARIETY :{BLACK}地形の地域性: STR_MAPGEN_GENERATE :{WHITE}作成 STR_MAPGEN_NEWGRF_SETTINGS_TOOLTIP :{BLACK}NewGRFの設定を表示 +STR_MAPGEN_AI_SETTINGS :{BLACK}AI設定 STR_MAPGEN_AI_SETTINGS_TOOLTIP :{BLACK}AI設定を表示 STR_MAPGEN_GS_SETTINGS_TOOLTIP :{BLACK}ゲームスクリプトの設定を表示 @@ -3609,6 +3627,9 @@ STR_FINANCES_CAPTION :{WHITE}{COMPANY STR_FINANCES_YEAR :{WHITE}{NUM} ###length 3 +STR_FINANCES_REVENUE_TITLE :{WHITE}収益 +STR_FINANCES_OPERATING_EXPENSES_TITLE :{WHITE}営業費 +STR_FINANCES_CAPITAL_EXPENSES_TITLE :{WHITE}資本的支出 ###length 13 @@ -3618,10 +3639,12 @@ STR_FINANCES_SECTION_TRAIN_RUNNING_COSTS :{GOLD}列車運 STR_FINANCES_SECTION_ROAD_VEHICLE_RUNNING_COSTS :{GOLD}車両運用費 STR_FINANCES_SECTION_AIRCRAFT_RUNNING_COSTS :{GOLD}航空機運用費 STR_FINANCES_SECTION_SHIP_RUNNING_COSTS :{GOLD}船舶運用費 +STR_FINANCES_SECTION_SHIP_REVENUE :{GOLD}船舶 STR_FINANCES_SECTION_LOAN_INTEREST :{GOLD}借入金利息 STR_FINANCES_SECTION_OTHER :{GOLD}その他 STR_FINANCES_NEGATIVE_INCOME :{BLACK}-{CURRENCY_LONG} +STR_FINANCES_ZERO_INCOME :{CURRENCY_LONG} STR_FINANCES_POSITIVE_INCOME :{BLACK}+{CURRENCY_LONG} STR_FINANCES_PROFIT :{WHITE}利益 STR_FINANCES_BANK_BALANCE_TITLE :{WHITE}預金残高 @@ -4977,6 +5000,7 @@ STR_ERROR_CAN_T_CHANGE_SERVICING :{WHITE}点検 STR_ERROR_VEHICLE_IS_DESTROYED :{WHITE}輸送機器が破壊されます +STR_ERROR_CAN_T_CLONE_VEHICLE_LIST :{WHITE}... 全車両が同一ではありません STR_ERROR_NO_VEHICLES_AVAILABLE_AT_ALL :{WHITE}利用できる輸送機器が全くなくなります STR_ERROR_NO_VEHICLES_AVAILABLE_AT_ALL_EXPLANATION :{WHITE}NewGRFの設定を変更してください @@ -5004,6 +5028,8 @@ STR_ERROR_CAN_T_SKIP_TO_ORDER :{WHITE}選択 STR_ERROR_CAN_T_COPY_SHARE_ORDER :{WHITE}この輸送機器は指令されたいずれの停留施設にも辿り着けません STR_ERROR_CAN_T_ADD_ORDER :{WHITE}この輸送機器はその停留施設に辿り着けません STR_ERROR_CAN_T_ADD_ORDER_SHARED :{WHITE}指令を共有している輸送機器がその停留施設に辿り着けません +STR_ERROR_CAN_T_COPY_ORDER_VEHICLE_LIST :{WHITE}... すべての車両の指令が同じではありません +STR_ERROR_CAN_T_SHARE_ORDER_VEHICLE_LIST :{WHITE}... すべての車両の指令が共有されていません STR_ERROR_CAN_T_SHARE_ORDER_LIST :{WHITE}指令リストを共有できません STR_ERROR_CAN_T_STOP_SHARING_ORDER_LIST :{WHITE}指令リストの共有を解除できません diff --git a/src/lang/simplified_chinese.txt b/src/lang/simplified_chinese.txt index fd73a7695e..bb9d6b7a61 100644 --- a/src/lang/simplified_chinese.txt +++ b/src/lang/simplified_chinese.txt @@ -2698,6 +2698,10 @@ STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_INCREASE_TOOLTIP :{BLACK}增加 STR_SELECT_RAIL_BRIDGE_CAPTION :{WHITE}选择铁路桥 STR_SELECT_ROAD_BRIDGE_CAPTION :{WHITE}选择公路桥梁 STR_SELECT_BRIDGE_SELECTION_TOOLTIP :{BLACK}选择桥梁 - 点击选择喜欢的桥梁进行建设 +STR_SELECT_BRIDGE_INFO_NAME :{GOLD}{STRING} +STR_SELECT_BRIDGE_INFO_NAME_MAX_SPEED :{GOLD}{STRING},{} {VELOCITY} +STR_SELECT_BRIDGE_INFO_NAME_COST :{GOLD}{0:STRING},{} {WHITE}{2:CURRENCY_LONG} +STR_SELECT_BRIDGE_INFO_NAME_MAX_SPEED_COST :{GOLD}{STRING},{} {VELOCITY} {WHITE}{CURRENCY_LONG} STR_BRIDGE_NAME_SUSPENSION_STEEL :钢制悬索 STR_BRIDGE_NAME_GIRDER_STEEL :钢制桁桥 STR_BRIDGE_NAME_CANTILEVER_STEEL :钢制悬臂 diff --git a/src/lang/vietnamese.txt b/src/lang/vietnamese.txt index 6a4267cf97..bab542223b 100644 --- a/src/lang/vietnamese.txt +++ b/src/lang/vietnamese.txt @@ -2698,6 +2698,10 @@ STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_INCREASE_TOOLTIP :{BLACK}Tăng m STR_SELECT_RAIL_BRIDGE_CAPTION :{WHITE}Chọn Loại Cầu Tàu Hỏa STR_SELECT_ROAD_BRIDGE_CAPTION :{WHITE}Chọn Loại Cầu Đường Bộ STR_SELECT_BRIDGE_SELECTION_TOOLTIP :{BLACK}Chọn cầu - chọn loại cầu bạn muốn xây dựng +STR_SELECT_BRIDGE_INFO_NAME :{GOLD}{STRING} +STR_SELECT_BRIDGE_INFO_NAME_MAX_SPEED :{GOLD}{STRING},{} {VELOCITY} +STR_SELECT_BRIDGE_INFO_NAME_COST :{GOLD}{0:STRING},{} {WHITE}{2:CURRENCY_LONG} +STR_SELECT_BRIDGE_INFO_NAME_MAX_SPEED_COST :{GOLD}{STRING},{} {VELOCITY} {WHITE}{CURRENCY_LONG} STR_BRIDGE_NAME_SUSPENSION_STEEL :Cầu treo thép STR_BRIDGE_NAME_GIRDER_STEEL :Cầu dầm thép STR_BRIDGE_NAME_CANTILEVER_STEEL :Cầu dầm chìa thép From df89c34e03af1c2c06358f551e53ced40d96d161 Mon Sep 17 00:00:00 2001 From: SamuXarick <43006711+SamuXarick@users.noreply.github.com> Date: Sat, 28 Jan 2023 19:18:28 +0000 Subject: [PATCH 12/12] Fix 7e1e275: Measure AI Collect Garbage performance (#9924) --- src/ai/ai_core.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/ai/ai_core.cpp b/src/ai/ai_core.cpp index 4d878b2905..64a16758d1 100644 --- a/src/ai/ai_core.cpp +++ b/src/ai/ai_core.cpp @@ -82,18 +82,16 @@ PerformanceMeasurer framerate((PerformanceElement)(PFE_AI0 + c->index)); cur_company.Change(c->index); c->ai_instance->GameLoop(); + /* Occasionally collect garbage; every 255 ticks do one company. + * Effectively collecting garbage once every two months per AI. */ + if ((AI::frame_counter & 255) == 0 && (CompanyID)GB(AI::frame_counter, 8, 4) == c->index) { + c->ai_instance->CollectGarbage(); + } } else { PerformanceMeasurer::SetInactive((PerformanceElement)(PFE_AI0 + c->index)); } } cur_company.Restore(); - - /* Occasionally collect garbage; every 255 ticks do one company. - * Effectively collecting garbage once every two months per AI. */ - if ((AI::frame_counter & 255) == 0) { - CompanyID cid = (CompanyID)GB(AI::frame_counter, 8, 4); - if (Company::IsValidAiID(cid)) Company::Get(cid)->ai_instance->CollectGarbage(); - } } /* static */ uint AI::GetTick()