Commit Graph

80 Commits

Author SHA1 Message Date
Peter Nelson d2c8b476b5 Codechange: Add functions to test if a station/roadstop class is a waypoint.
This is now checked by class label instead of by index.
2024-05-11 02:12:41 +01:00
Peter Nelson 9f8c9724be Codechange: Add station/roadstop class labels for DFLT/WAYP.
This avoids repeating the same multichar literal value.
2024-05-11 02:12:41 +01:00
Peter Nelson d5671030b1 Codechange: Add NewGRFSpecsBase class to hold class/index information.
Standardises how the class index is stored in the spec, instead of relying ot the Spec structs having the same members.

This allows retrieving class_index and index without searching or using pointer arithmetic.

'cls_id' is renamed to 'class_index' to make it clearer that it is an index rather than the multichar label of the class.
2024-05-11 02:12:41 +01:00
Peter Nelson 774f811217
Codechange: Use std::optional for town parent scope resolver. (#12530)
When resolving NewGRF, the parent town_scope is lazily initialised as it does not always need to be used.

Replace the manually managed pointer with std::optional to simplify. Using std::optional avoids extra memory allocation.
2024-04-18 22:14:16 +01:00
Peter Nelson 1773c5b810
Change: Increase object/station/roadstop class limit. (#12094)
The class limit is arbitrary and not stored in game state.

This change prevents all entities in classes after the 255th class from being dumped into the first class.
2024-04-09 23:16:20 +01:00
Peter Nelson 668186ca5b
Codechange: Remove macros involved with NewGRFClass. (#12363)
Use direct class instantiation instead.
2024-03-23 21:55:50 +00:00
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
frosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
Peter Nelson 952d111b94 Codechange: Split CT_INVALID into CT_INVALID and INVALID_CARGO.
INVALID_CARGO is a CargoID and should be used for most purposes in game.
CT_INVALID is a CargoType used for defining default properties.
2024-01-09 18:56:05 +00:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02: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
PeterN 9910240f0e
Cleanup: Remove obsolete (Make)EnumPropsT. (#10697)
This was used by the command system to help extract p1/p2 parameters, which no longer happens.
2023-04-23 17:46:14 +01:00
Peter Nelson a3e49178d1 Codechange: Use std::vector for NewGRF station tile sprite layouts. 2021-05-02 17:15:27 +01:00
Peter Nelson bd1a20f6ee Codechange: Use std::vector for NewGRF station platform layouts.
This avoids the need to custom memory management and additional members.

This also resolves use-after-free if modifying copied layouts, so presumably nobody has ever done that.
2021-05-02 17:15:27 +01: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
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Charles Pigott fcf06ba4c4 Codechange: Remove StationClassIDByte, and drop STAT_CLASS_MAX by one 2019-04-29 17:40:22 +01:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Henry Wilson af7d9020a1 Codechange: Use override specifer for overriding member declarations
This is a C++11 feature that allows the compiler to check that a virtual
member declaration overrides a base-class member with the same signature.

Also src/blitter/32bpp_anim_sse4.hpp +38 is no longer erroneously marked
as virtual despite being a template.
2019-03-24 16:10:04 +01:00
PeterN 4cebebcf68
Change: Add CargoTypes type for cargo masks. (#6790) 2018-05-21 22:08:39 +01:00
J0an Josep cfb8092397 Fix b4b98e5165: Use FALLTHROUGH attribute with correct indentation. 2018-04-30 21:52:40 +02:00
frosch d9d669dcf8 (svn r27984) -Codechange: Make ScopeResolver constructors/destructors inlineable. Speedup sprite resolving by about 8 percent. 2018-03-11 13:19:41 +00:00
frosch 82ae414e8d (svn r27928) -Fix: [NewGRF] While executing random triggers, var 5F should include the new triggers.
-Fix: [NewGRF] Reset used random triggers only after all A123 chains have been resolved, so that all RA2 in all chains can test the shard triggers. This also includes multiple RA2 in the same A123 chain.
-Fix: [NewGRF] Industry random triggers are stored per tile, even when randomising the shared random bits of the parent industry.
2017-10-25 15:38:14 +00:00
frosch b4b98e5165 (svn r27893) -Codechange: Use fallthrough attribute. (LordAro) 2017-08-13 18:38:42 +00:00
frosch db894b0b3f (svn r26085) -Codechange: Pass ResolverObjects as reference instead of pointer since they are never NULL. 2013-11-24 14:41:19 +00:00
peter1138 c00a400cc7 (svn r24905) -Feature(ish): Implement station randomisation triggers. 2013-01-11 07:39:25 +00:00
planetmaker c24374f99c (svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by Eagle_rainbow) 2013-01-08 22:46:42 +00:00
alberth 33ff55a8f1 (svn r24693) -Doc: Add some doxymentation into the newgrf code. 2012-11-10 20:46:39 +00:00
alberth 4c9bea2a71 (svn r24692) -Cleanup: Cleanup final parts of the old resolver code. 2012-11-10 20:45:59 +00:00
alberth c417efc962 (svn r24684) -Codechange: Add resolver classes for stations. 2012-11-10 20:41:08 +00:00
yexo 620a96f77f (svn r24031) -Feature: increase the station class limit from 32 to 256 2012-03-15 22:42:28 +00:00
rubidium e40eb8177a (svn r23735) -Codechange: remove ~50 includes from headers that weren't needed 2012-01-03 20:26:05 +00:00
michi_cc d579af11e8 (svn r22659) -Add: [NewGRF] Support for the land slope check callback for stations. 2011-07-11 16:32:35 +00:00
terkhen e8df5563db (svn r22559) -Codechange: Remove constness from Station in ResolverObject. 2011-06-12 20:34:37 +00:00
terkhen c98a8308cc (svn r22558) -Codechange: Remove constness from BaseStation in ResolverObject. 2011-06-12 20:34:03 +00:00
terkhen e127fca384 (svn r22557) -Codechange: Remove constness from AnimationBase callbacks. 2011-06-12 20:32:52 +00:00
frosch 7415b9cca2 (svn r22456) -Codechange: Derive NewGRFSpriteLayout from DrawTileSprites for spritelayouts allocated on the heap, and make use of constructors and destructors. 2011-05-14 17:25:45 +00:00
frosch 20e86fd5ea (svn r22454) -Codechange: Deduplicate GetCustomStationGroundRelocation() into GetCustomStationRelocation() and only call it if actually needed. 2011-05-14 13:12:47 +00:00
frosch fdd2f8447e (svn r22453) -Feature(ette): Implement variable 18 for custom station foundations. 2011-05-14 12:38:10 +00:00
yexo 261b34b705 (svn r22175) -Fix: [NewGRF] memory leak if a station newgrf contains prop 09 twice for the same station id 2011-03-03 21:24:03 +00:00
rubidium 7eba2bf4d3 (svn r21890) -Cleanup: remove some unneeded includes 2011-01-22 14:52:20 +00:00
rubidium e2e26190d5 (svn r20623) -Codechange: unify the storing of animation related information 2010-08-26 15:31:40 +00:00
rubidium 3d21fb44aa (svn r20436) -Codechange: use GRFFilePropsBase's spritegroup for stations. 2010-08-10 15:51:33 +00:00
rubidium ca7a067b7a (svn r20435) -Codechange: move spritegroup to GRFFilePropsBase and prepare it for more spritegroups 2010-08-10 15:49:35 +00:00
rubidium edbadde301 (svn r20406) -Codechange: make StationClass use the new generic class 2010-08-07 22:07:07 +00:00
rubidium 2b645d1b0d (svn r20404) -Codechange: remove the need for StationSpec::allocated 2010-08-07 21:39:30 +00:00
rubidium 2d3ee123af (svn r20402) -Codechange: rename the airport/station class id to something slightly more generic 2010-08-07 21:10:57 +00:00
rubidium b6a0806948 (svn r20400) -Codechange: let StationSpec use GRFFilePropsBase 2010-08-07 20:52:45 +00:00
alberth 5556955960 (svn r20318) -Doc: Doxygen additions. 2010-08-02 20:32:39 +00:00
frosch ed4f806f1d (svn r20283) -Codechange: Unify start of doygen comments. 2010-08-01 19:22:34 +00:00