Commit Graph

198 Commits

Author SHA1 Message Date
frosch
30b1eb6e5f
Fix: [NewGRF] The result of Action123 evaluation affected rerandomisation in a weird corner case. (#14139)
Rerandomisation does not care about the Resolve result.
But we skipped it, in case of 'invalid SpriteGroup reference'.
2025-04-28 23:24:42 +02:00
Peter Nelson
2c4897c2cd
Codechange: Use EnumBitSet for HouseZones. (#14137) 2025-04-28 20:27:43 +01:00
frosch
b7e7f08f78 Codechange: Simplify usage of GRFFileProps by adding some common helper methods. 2025-04-28 13:44:46 +02:00
frosch
f62f728187
Codechange: Move usage of ResolverObjects to newgrf_xxx.cpp (#14116) 2025-04-26 20:53:50 +02:00
frosch
398524e49a
Add: [NewGRF] Provide random bits in var10 of house callback 1C 'construction stage changed'. (#14095) 2025-04-26 15:58:44 +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
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
264abfafe6 Codechange: Rename storage of random triggers to include the term 'random'. 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
5aed046d11
Fix: [NewGRF] Strange things happened, when using the synchronised tile loop animation trigger for houses. (#14011) 2025-04-17 12:15:49 +02:00
Peter Nelson
325f7f9767
Codechange: Use EnumBitSet for GoodsEntry status. (#13899) 2025-03-26 21:22:33 +00:00
Peter Nelson
8f14894024 Add: NewGRF Badges. 2025-02-16 22:24:25 +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
Jonathan G Rennison
d06b371254 Cleanup: Fix various spelling errors 2025-02-12 22:44:51 +01:00
Tyler Trahan
521b860394
Feature: Prevent towns from upgrading individually-placed houses (#13270) 2025-02-09 20:37:06 +00:00
Peter Nelson
95bd53ddf1 Codechange: Use EnumBitSet for BuildingFlags. 2025-02-01 14:16:25 +00:00
Peter Nelson
113205c540 Codechange: Use EnumBitSet for HouseExtraFlags. 2025-02-01 14:16:25 +00:00
Peter Nelson
40aeedeade Codechange: Use EnumBitSet for callback masks. 2025-01-31 17:08:24 +00:00
Rubidium
e894a5880c Codechange: rename CargoID to CargoType and amend related variables/comments 2025-01-26 18:07:10 +01:00
Peter Nelson
c72542431a
Change: Increase house type limit from 512 to 4096. (#12288)
This moves HouseType from m4+m3[6] to m8 making it 'easier' to access.
2024-12-22 18:14:06 +00:00
Peter Nelson
e73d6fcaac Codechange: Store grfid with entity grfprops.
This allows using the grfid without having to dereference the grffile pointer.

Uses no extra storage as it fits within otherwise wasted padding space.
2024-12-05 18:17:58 +00:00
Peter Nelson
6c09dcdd66
Codechange: Use reference for non-optional StationList parameter. (#13092) 2024-11-19 20:33:32 +00:00
Peter Nelson
e60c5f30a3
Fix ddf1510a23: House animation random data flag ignored. (#12963)
In the refactor to unified tile animation code, the test for `CALLBACK_1A_RANDOM_BITS` incorrectly got changed to a `HasBit()` test preventing it from working.

Use `HasFlag()` instead.
2024-09-23 17:18:28 +00:00
Loïc Guilloux
29ce013eda
Codechange: Pass avail(able) as reference instead of pointer since they are never nullptr (#12696) 2024-05-18 17:04:16 +02:00
Peter Nelson
ed67aedabf Feature: Allow manually placing town buildings in scenario editor.
House picker is accessed from the Landscaping toolbar as there is no town toolbar.

Once placed these houses behave like any other and can be removed by players and towns.

Uses the unified picker system, so also supports used/saved favourites. As town building don't have class labels, town zones are use to imitate them.
2024-05-14 21:11:48 +01:00
Peter Nelson
b731ab0632 Change: Allow sprite resolver to evaluate non-existent houses.
This could previous be done but only with a town and tile in mind, but for drawing in the UI, neither of those exist yet.
2024-05-14 21:11:48 +01:00
Peter Nelson
e16b982b6a Codechange: Use iteration when dealing with all HouseSpecs. 2024-03-28 23:23:00 +01:00
Peter Nelson
3e83dcedfd Codechange: Allocate houses dynamically instead of from a fixed array.
This uses vectors for HouseSpecs and global/town building counts.
2024-03-28 23:23:00 +01:00
Patric Stout
a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Rubidium
27eadc13ec Codechange: rename TILE_ADD(XY) to TileAdd(XY) 2024-03-10 15:50:24 +01:00
Peter Nelson
c0ab436077
Codechange: Store Colours in Colours type. (#11625)
This reduces casts, some magic numbers, and introduces a bit of type-safety.
2024-01-21 13:23:04 +00:00
Peter Nelson
ab535c0a86
Codechange: Add base() method to StrongType to allow access to the base type without casting. (#11445)
This removes the ability to explicitly cast to the base type, but the requirement
to use .base() means the conversion is still explicit.
2023-11-06 20:29:35 +00:00
frosch
b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
PeterN
6643c010bd
Fix: NewGRF house class mappings were not reset between games. (#11279) 2023-09-10 18:55:37 +01:00
Patric Stout
299570b2c1
Codechange: make TimerGameCalendar Date and Year types strongly typed (#10761) 2023-08-12 18:14:21 +00:00
Rubidium
eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
Peter Nelson
76516d7f70 Codechange: Use IsValidCargoID/IsValidCargoType.
IsValidCargoType() is used only for unmapped IDs.
2023-05-22 20:43:40 +01:00
Rubidium
fb856e16c1 Codechange: replace some min/clamp constructs to ClampTo 2023-05-06 21:26:13 +02:00
Jonathan G Rennison
4c1406a4b5 Add: NewGRF road stops 2023-02-26 21:28:30 +01:00
Rubidium
de6bc8e692 Codechange: move TILE_MASK to Map::WrapToMap 2023-01-21 17:11:40 +01:00
rubidium42
55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 2021-06-13 12:45:45 +02:00
Yexo
a82572d0f5 Codechange: remove has_newhouses global 2020-06-01 22:46:06 +02:00
Niels Martin Hansen
c8779fb311
Feature: NewGRF callback profiling (#7868)
Adds a console command newgrf_profile to collect some profiling data about NewGRF action 2 callbacks and produce a CSV file.
2020-01-26 13:45:51 +01:00
glx
ee7a8eebca Codechange: Replace FOR_ALL_TOWNS with range-based for loops 2019-12-21 20:13:03 +01:00
S. D. Cloudt
13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Henry Wilson
7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00