Commit Graph
297 Commits
Author SHA1 Message Date
Peter NelsonandGitHub 79ef4e98fe Codechange: Use std::swap() instead of Swap() (#13883) 2025-03-24 23:47:34 +00:00
Peter NelsonandGitHub fc7b6c6cbb Codechange: Use .fill() to clear an array instead of assigning a new array. (#13880)
Avoids allocating a temporary on the stack.
2025-03-23 22:09:45 +00:00
Björn WärmedalandGitHub dc343ca141 Fix: GenerateCompanyName sends incorrect renaming event (#13794) 2025-03-13 08:24:35 +00:00
Peter NelsonandGitHub 2c211630cb Fix #13759: Really don't set error owner to OWNER_TOWN. (#13761) 2025-03-07 23:35:28 +00:00
Loïc GuillouxandGitHub c5e01c1907 Fix: More AI than max_no_competitors could start with competitors_interval=0 (#13670) 2025-03-03 13:39:31 +01:00
Rubidiumandrubidium42 09716dba75 Codechange: do not use MallocT for the pool
Needed to make the placement new operator use Tindex over size_t because of
ambiguity for the delete operator variant that also has the size.
2025-02-28 20:15:42 +01:00
Peter NelsonandGitHub 6e10584b91 Codechange: Use EncodedStrings for News messages. (#13654) 2025-02-23 20:24:02 +00:00
Rubidiumandrubidium42 24a7cde9cc Codechange: explicitly initialise Company member variables 2025-02-22 16:33:05 +01:00
Rubidiumandrubidium42 fd4adc55e3 Codechange: replace INVALID_X with XID::Invalid() for PoolIDs 2025-02-16 20:23:00 +01:00
Rubidiumandrubidium42 380e7b48ce Codechange: use std::variant instead of a custom version for news references 2025-02-16 14:50:15 +01:00
Rubidiumandrubidium42 ab8177ea77 Codechange: strongly type CompanyID 2025-02-16 14:02:18 +01:00
Rubidiumandrubidium42 5401ab1f7b Codechange: use ReferenceThroughBaseContainer for containers that are index by CompanyID 2025-02-16 14:02:18 +01:00
Rubidiumandrubidium42 1ffc950e22 Codechange: use prefix operator++ for CompanyID iterations 2025-02-16 14:02:18 +01:00
Peter NelsonandGitHub 2d7d085e8e Codechange: Use EncodedString for error messages. (#13569) 2025-02-16 10:04:32 +00:00
Peter NelsonandGitHub 20e57a02a2 Codechange: Use GetString() with argument parameters in simple cases. (#13551)
Avoids using global string parameters.
2025-02-14 00:10:56 +00:00
Rubidiumandrubidium42 c3d5e6d2a0 Codechange: Use EnumBitSet for DoCommandFlags 2025-02-14 00:28:57 +01:00
Rubidiumandrubidium42 37c215f1fd Fix #13513, ec492cb267: std::numeric_limits<CompanyMask> not working causes no vehicles to exist
std::numeric_limits<T>::max() returns 0 instead of an error when the type is unknown.
Solve it by implementing and using Set() and All() in BaseBitSet in same way as std::bitset.
2025-02-09 22:50:55 +01:00
Rubidiumandrubidium42 ec492cb267 Codechange: make CompanyMask a BaseBitSet implementation 2025-02-09 19:24:51 +01:00
Peter NelsonandPeter Nelson 9a6fc4eb76 Codechange: Use enum class for NewsReferenceType. 2025-02-07 19:36:52 +00:00
Peter NelsonandPeter Nelson ca75a8ce19 Codechange: Use enum class for NewsType. 2025-02-07 19:36:52 +00:00
Peter NelsonandGitHub eaa765d615 Codechange: Disentangle news window style from news flags. (#13482)
This avoids NewsFlags being used as both bitmask and bitstuffed data.
2025-02-07 13:10:39 +00:00
Rubidiumandrubidium42 2c7b3bb55d Codechange: rename ClientIndex to ClientPoolID 2025-02-01 11:15:51 +01:00
Rubidiumandrubidium42 4ca1fe6c32 Codechange: replace MAX_UVALUE with std::numeric_limits::max 2025-02-01 01:29:02 +01:00
Rubidiumandrubidium42 29129e12fd Add: [Script] Event for when a company's president name changes 2025-01-14 11:35:35 +01:00
Björn WärmedalandGitHub 9ab936f76b Add: [Script] ScriptEventCompanyRename (#12878) 2025-01-14 09:24:28 +00:00
Rubidiumandrubidium42 65731bb964 Codechange: use SPECSTR_..._END over _LAST, to prevent + 1 everywhere 2025-01-04 21:06:07 +01:00
Peter NelsonandGitHub e9e603b4fd Codefix: Company name is a StringID. (#13224)
StringID was passed to Company's constructor as a uint16_t.
2025-01-01 20:16:59 +00:00
Peter NelsonandGitHub 1e77fd0b61 Codechange: Remove unnecessary 'return_cmd_error` macro. (#13160)
This macro is a leftover from when errors used to be packed into a single int32_t.

`return CommandCost` is clearer, and doesn't need a macro.
2024-12-08 18:02:30 +00:00
Peter NelsonandGitHub 6f8e30c55d Codechange: Use unique_ptr throughout instead of new raw pointer for company news data. (#13148)
The pointer was already captured and converted to a unqiue_ptr, but hidden within the call stack.

This now makes it clearer that the object passed to Add.*NewsItem will become owned by the news item.
2024-12-04 12:18:34 +00:00
Peter NelsonandGitHub 0446123194 Change: Show company finances column if it has any values in it. (#13112)
This solves finances not being show if the company inauguration date is in the future.

Current period is now always shown in the same position instead of moving for the first 2 years.
2024-11-24 11:59:30 +00:00
Jonathan G RennisonandGitHub e477706bf5 Codechange: Add AssignBit function to assign the value of a single bit (#12934)
* Codechange: Add AssignBit function to assign the value of a single bit

* Codechange: Replace various uses of SB with AssignBit

* Codechange: Replace various uses of SB with a constant with SetBit
2024-09-10 08:36:58 -04:00
Kaiden Joyandrubidium42 7a698c7f1c Fix #12365: Company Window now displays proper inauguration year and period while in wallclock mode. 2024-08-13 20:13:51 +02:00
Rubidiumandrubidium42 fea9ffa808 Codechange: also allow removing clients from the company allow lists 2024-05-22 22:20:10 +02:00
Tyler TrahanandGitHub 9f63b9f65d Fix #12594: Give descriptive error when company takeover fails due to vehicle limit (#12676) 2024-05-13 10:10:03 -04:00
Rubidiumandrubidium42 a313676189 Doc: reason for using ::SendNet over ::Post in few cases 2024-05-09 21:51:26 +02:00
Rubidiumandrubidium42 a9318cf653 Cleanup: remove UI for changing the password 2024-05-07 00:03:15 +02:00
Rubidiumandrubidium42 66354ab9eb Codechange: introduce allow list infrastructure for companies 2024-05-07 00:03:15 +02:00
Jonathan G Rennisonandrubidium42 11ec156b64 Codechange: Add a priority field to TimerGameTick::TPeriod
Use this as the primary sort key for TimerGameTick::TPeriod,
to avoid container sort order changes on timer period saveload.
See: #12509
2024-04-25 20:08:24 +02:00
Loïc GuillouxandGitHub c5ef47ee09 Codechange: [Script] Use std::unique_ptr for Company::ai_instance (#12544) 2024-04-20 16:58:46 +02:00
Peter NelsonandGitHub 197fb00d31 Fix #12395: Ensure president name widget is tall enough. (#12419) 2024-04-04 17:56:16 +01:00
Peter NelsonandGitHub d683ec0183 Codechange: Move dropdown and slider out of widgets directory. (#12403)
Also shuffle headers to place widget includes near end.

This leaves the widgets directory solely for defining Widget IDs.
2024-03-31 19:37:16 +01:00
Patric StoutandGitHub a3cfd23cf9 Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Rubidiumandrubidium42 bab5a8a787 Codechange: use std::source_location over __FILE__ and __LINE__ for Backup 2024-03-10 10:14:20 +01:00
Peter NelsonandPeter Nelson 912d7bd80e Codechange: Give ColourShade values names instead of numbers. 2024-02-25 12:38:07 +00:00
Peter NelsonandPeter Nelson ae3390fe48 Codechange: Add ColourShade enum. 2024-02-25 12:38:07 +00:00
Peter NelsonandPeter Nelson 0463d4c198 Codechange: Remove direct access to _colour_gradient.
Access is now through GetColourGradient, which ensures parameters are in range.
2024-02-25 12:38:07 +00:00
Damian Laczakandrubidium42 49c3215751 Fix #10983: [AdminPort] Correct order of messages 2024-02-18 15:11:00 +01:00
Loïc GuillouxandGitHub 977aba73be Change: Store running AI config inside Company (#12003) 2024-02-09 22:55:49 +01:00
Jonathan G Rennisonandrubidium42 cb13ee90ef Fix: Second colour vehicle-type default liveries not being updated
When changing company default second colour
2024-02-04 07:14:39 +01:00
dPandGitHub 897b59c158 Add: [GS] Allow to set max loan for each company separately (#11224) 2024-01-30 19:15:19 +01:00