1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 08:52:40 +01:00
Commit Graph

650 Commits

Author SHA1 Message Date
Peter Nelson
f6eba87e47 Fix #14915: Crash due to divide-by-zero of industry probabilities. (#14918) 2025-12-15 16:42:10 +00:00
Cyprian Klimaszewski
99f04f27de Doc: Update information for receiving a copy of GPL. (#14869) 2025-12-07 11:25:08 +00:00
Peter Nelson
9adc4bfc0f Codechange: Make order load/unload flags value types. (#14861)
Order Load and Unload flags have complex logic to ensure that invalid combinations aren't used. In fact, apart from FullLoad and FullLoadAny, all mixed combinations are invalid.

Simplify logic by removing the use of bit values and treat each option as a value.
2025-12-06 18:30:31 +00:00
Tyler Trahan
595b696d61 Change: Avoid building farm fields in wetlands (#14846) 2025-12-02 14:28:12 +00:00
Rubidium
316f36fe14 Codefix: comparison of narrow type with wide type in loop condition 2025-11-24 23:02:00 +01:00
Peter Nelson
98275ee5d3 Codechange: Use enum class for water-related enums. (#14804) 2025-11-19 20:35:11 +00:00
Tyler Trahan
d1376d0b67 Fix #14737: Don't scale custom town and industry counts by land area (#14738) 2025-10-27 18:18:31 +00:00
Peter Nelson
a1920fc225 Change: Scale towns/industries by amount of land tiles. (#10063) 2025-10-24 16:32:09 -04:00
Jonathan G Rennison
2212169a8c Fix: Do not pre-fill industry production history for unused production slots (#14730) 2025-10-24 21:34:35 +02:00
Jonathan G Rennison
f64e1cdae0 Fix: Industry accept/produce when not contiguous range from 0 (#14555) 2025-09-27 18:12:49 +01:00
Rubidium
7c0f69a8fe Codefix: typos in comments and strings 2025-08-31 10:30:37 +02:00
Peter Nelson
f30f808b50 Codechange: Implement tile proc handler to test for building bridge over tile. 2025-08-20 21:40:41 +01:00
Peter Nelson
d09dfd843c Codechange: Extend industry cargo history to 24 years.
Monthly data is stored for the current 24 months.
Quarterly data is stored for a further 2-6 years.
Yearly data is stored for a further 6-24 years.
2025-07-30 01:13:05 +01:00
Peter Nelson
921d83c324 Codechange: Unify structures with sprite sub-tile bounds and simplify bounding boxes. (#14424)
Lots of different structs contain variations on sub-tile bounds with different naming. Unify into a single struct that can be inherited and passed directly to AddSortableSpriteToDraw.

At the same time, offsets now work more logically: sub-tile bounds now specify the bounding box, and an offset can be applied to the sprite.
2025-07-22 00:02:00 +01:00
Peter Nelson
56942a15c7 Add: Industry accepted and waiting history graphs.
Records amount of cargo accepted, and a rolling average of the waiting amount.

Average waiting samples the waiting amount once per day for each industry, spread out over an economy day.
2025-07-20 14:03:54 +01:00
Peter Nelson
290144c5c9 Fix #14396: Industry production graph showed zero instead of N/A.
Record the number of valid history records per industry so that the graph avoids showing values which are not present as zero.
2025-07-09 23:02:58 +01:00
Peter Nelson
9b55ad5b8d Codechange: Generic type and container for history statistics. 2025-07-09 23:02:58 +01:00
Peter Nelson
0455627d16 Codechange: Move ownership of Orders to OrderList. (#13948)
Removes the orders pool, and orders are now stored directly in each OrderList.

Iterating orders now no longer needs to traverse a linked-list, all orders in an OrderList are sequential.
2025-05-23 10:36:28 +01:00
frosch
6faa667644 Codechange: Remove global GetRegister(), instead return 100+ registers directly from GetXxxCallback(). 2025-05-06 22:24:41 +02:00
frosch
0d5b3ebd7f Codechange: Declare all IntervalTimers const, which can be const. 2025-05-06 18:29:41 +02:00
Peter Nelson
7c834921b2 Codechange: Use FlatSet for per-industry type industry lists. 2025-05-05 14:00:38 +01:00
frosch
b7e7f08f78 Codechange: Simplify usage of GRFFileProps by adding some common helper methods. 2025-04-28 13:44:46 +02:00
frosch
0d9074769d Change: [NewGRF] Animation-trigger 'construction stage changed' of houses and industries now also triggers at construction start. (#14089) 2025-04-26 14:42:49 +02:00
frosch
d7ddea4032 Codechange: Turn AnimationTrigger enums into enum classes. (#14067) 2025-04-21 20:53:31 +02:00
frosch
61a0a520f6 Codechange: Unify random trigger enums and turn them into enum classes. (#14066) 2025-04-21 20:03:34 +02:00
frosch
f399b8eb29 Codechange: Unify naming of NewGRF animation callbacks. 2025-04-21 19:06:13 +02:00
frosch
39220a5feb Codechange: Unify naming of NewGRF random trigger functions. 2025-04-21 19:06:13 +02:00
frosch
368d131fb7 Codechange: Use 'construction stage' consistently, instead of 'construction state'. 2025-04-21 19:06:13 +02:00
frosch
b956af631e Codechange: Replace CircularTileSearch with SpiralTileSequence. 2025-04-20 12:50:45 +02:00
frosch
cde350dc01 Codechange: Replace macros GENERAL_SPRITE_COLOUR and COMPANY_SPRITE_COLOUR with functions GetColourPalette and GetCompanyPalette. 2025-04-18 23:41:37 +02:00
frosch
03ed59a004 Codechange: Turn AnimationStatus into an enum class. 2025-04-15 20:42:44 +02:00
frosch
b0d678e375 Codechange: Rename _ignore_restrictions to _ignore_industry_restrictions. 2025-04-11 22:11:28 +02:00
Peter Nelson
93016b9a92 Fix #13842: Close industry production graph if industry is removed. (#13890) 2025-03-25 17:58:59 +00:00
Peter Nelson
b96b26ef15 Codechange: Rename short CargoType parameters cargo. (#13848)
Rename CargoType variables and parameters using short or meaningless names.
2025-03-24 18:18:21 +00:00
Peter Nelson
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
Rubidium
754311a779 Codechange: use std::move when appropriate 2025-03-13 13:00:24 +01:00
Peter Nelson
51fd2853cb Fix 6e10584b91: Keep custom news from game scripts in encoded form. (#13741)
This allows the news message to translated as appropriate.
2025-03-04 23:15:50 +00:00
Peter Nelson
b55af05626 Codechange: Pass encoded script strings as EncodedString.
This removes the ambiguity of having std::strings that may or may not be encoded.
2025-03-04 21:40:39 +00:00
Peter Nelson
3cf9b15959 Codechange: Handle SnowTile state separately from ClearGround.
This removes the need for ClearGround to pretend that CLEAR_SNOW exists.
2025-02-25 08:22:46 +00:00
Peter Nelson
96f260e718 Codechange: Pass TileDesc by reference. 2025-02-23 23:00:51 +00:00
Peter Nelson
6e10584b91 Codechange: Use EncodedStrings for News messages. (#13654) 2025-02-23 20:24:02 +00:00
Rubidium
fd4adc55e3 Codechange: replace INVALID_X with XID::Invalid() for PoolIDs 2025-02-16 20:23:00 +01:00
Rubidium
2d30df8110 Codefix: 'Declaration hides variable' 2025-02-16 13:44:37 +01:00
Peter Nelson
2d7d085e8e Codechange: Use EncodedString for error messages. (#13569) 2025-02-16 10:04:32 +00:00
Peter Nelson
ff7eb996e6 Codechange: Use variable storage for GrfProps with cargo-type groups. (#13557)
Slots are only allocated when used instead of being reserved.

Array-based GrfProps are still used when the number of options is more limited.
2025-02-14 18:30:17 +00:00
Rubidium
c3d5e6d2a0 Codechange: Use EnumBitSet for DoCommandFlags 2025-02-14 00:28:57 +01:00
Jonathan G Rennison
d06b371254 Cleanup: Fix various spelling errors 2025-02-12 22:44:51 +01:00
Rubidium
5f41bc0279 Codechange: put SourceType and SourceID into Source struct 2025-02-08 06:37:23 +01:00
Peter Nelson
50b384032d Codechange: Use EnumBitSet for IndustryControlFlags. 2025-02-07 22:01:59 +00:00
Peter Nelson
ca75a8ce19 Codechange: Use enum class for NewsType. 2025-02-07 19:36:52 +00:00