Commit Graph

898 Commits (c0ab436077d2e2f425d8b3969de392a640256b88)

Author SHA1 Message Date
rubidium42 a498723345
Remove: arbitrary limit on number of statically loaded NewGRFs (#9431) 3 years ago
glx22 a543a4b7bb Codechange: Remove FOR_EACH_SET_CARGO_ID 3 years ago
glx22 89ab8b79a5 Codechange: Remove FOR_EACH_SET_BIT 3 years ago
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 3 years ago
Peter Nelson 40cec34836 Change: Skip creating a RealSpriteGroup when there is only one result.
This avoids checking RSG for empty sets every time they are evaluated.
This might alter behaviour in cases of a malformed NewGRF file.
3 years ago
Patric Stout ca9a7df752
Codechange: rename str_validate to StrMakeValid(InPlace) (#9304)
This to be more explicit the function changes the value, and not
returns yes/no.
3 years ago
rubidium42 ae85af98eb Codechange: Use std::string GetString where convenient 3 years ago
rubidium42 44ca7d9377 Change: Use gender-neutral pronouns 3 years ago
Rubidium e6f0d63e25 Codechange: comparison result is always the same due to earlier check
Practically the length of the handlers not being equal to the number of
features is the problem as it means something was forgotten when adding
a new feature, so static assert to that and let the existing check on
the feature number take care of invalid data from the NewGRFs.
3 years ago
frosch 1da0ba95b2 Feature: Define refittability of default vehicles using cargo classes.
This ensures that default vehicles can transport any NewGRF defined cargos, albeit with weird graphics and vehicle names.
This also changes the refittability of default vehicles with default industries.
3 years ago
frosch 9f8d0b1bee Fix: Resolve cargo-types of default vehicles via their cargo label.
Default vehicles now behave as if they had a cargo translation table. This fixes default vehicles carrying seemingly random cargos, if NewGRF industry sets are present.
This behavior is disabled, when a NewGRF touches any of the cargo-type or refitting properties. In that case it's up to the NewGRF to define its own cargo translation table.
3 years ago
rubidium42 65cbde4b30 Codechange: move currency settings to std::string 3 years ago
Rubidium 296194ad36 Fix: memory leak due to assigning result of strdup to a std::string 3 years ago
Rubidium 10e35ca8e4 Codechange: let NewGRF make use of SpriteFile instead of most of the FIO slot functions 3 years ago
Rubidium fdc11a9f94 Codechange: introduce SpriteFile to be used by the sprite loader instead of the global FIO slot functionality 3 years ago
Rubidium c097bc9d7d Codechange: let NewGRF sounds make use of RandomAccessFile instead of the FIO slot functions 3 years ago
Peter Nelson 756034fa27 Codechange: Validate custom station platform layout tiles are permitted values only. 3 years ago
Peter Nelson a3e49178d1 Codechange: Use std::vector for NewGRF station tile sprite layouts. 3 years ago
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.
3 years ago
Peter Nelson 18fb1c3866 Codechange: Warn if randomaction2 group count is not a power of 2.
Previously noted by a comment, this does not need to be guarded against as non-powers of 2 will not cause issues beyond the choice of results being reduced.
3 years ago
Peter Nelson 913d8a7f28 Cleanup: Use std::vector in RandomSpriteGroup. 3 years ago
Peter Nelson 1aeaf39954 Cleanup: Use std::vector in DeterministicSpriteGroup. 3 years ago
Peter Nelson f785a70a2b Cleanup: Use std::vector in RealSpriteGroup. 3 years ago
glx22 9a8756d7ed Codechange: Replace FOR_ALL_CARGOSPECS with range-based for loops 3 years ago
Jonathan G Rennison 83ac5aa27a
Fix: Memory leak of airport tile layout in AirportChangeInfo (prop 0A) (#8928) 3 years ago
Patric Stout 1a1049bc0d Change: rename setting "max_heightlevel" to "map_height_limit"
This better reflects what it is, and hopefully removes a bit of
the confusion people are having what this setting actually does.

Additionally, update the text on the setting to better inform
users what it is doing exactly, so they can make an educated
decision on how to change it.

Next commit will introduce an "auto" value, which should be the
new default. The rename has as added benefit that everyone will
start out on the "auto" value.
3 years ago
Charles Pigott 8157af6d68 Fix #8276: Crash when a NewGRF object's size was not set 3 years ago
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 3 years ago
Charles Pigott 860c270c73 Codechange: Replace assert_compile macro with static_assert 4 years ago
Michael Lutz 1478fa93b3 Add: [NewGRF] Patch flag to test if inflation is on or off. 4 years ago
frosch d5f05fb781
Fix: [NewGRF] Action 7/9 conditions 0x0F to 0x12 failed, if 'param' was 0x88. (#8382)
Fix: [NewGRF] Action 7/9 conditions 0x0B to 0x12 failed, if 'param' was 0x85.
These conditions are supposed to ignore 'param' entirely.
4 years ago
Michael Lutz 79240eab1e Codechange: Make use of the improved C++17 emplace_back function. 4 years ago
Yexo 1507902d00 Codechange: remove has_newindustries global 4 years ago
Yexo a82572d0f5 Codechange: remove has_newhouses global 4 years ago
Yexo f827bc8c1a Fix #8166: don't crash on loading an invalid roadtype newgrf
Initialization code for GRFFile::roadtype_map was copied from
railtype_map. But while RailType is a byte-sized enum and could thus
be initialized via memset, RoadType doesn't have a defined size.
4 years ago
Michael Lutz 9c2e47d03c Codechange: Use std::string for storing GRF error messages. 4 years ago
Michael Lutz c082f570ce Codechange: Use std::string when translating TTDP NewGRF string codes. 4 years ago
Michael Lutz 43cd892e0c Codechange: Replace custom linked list for GRF texts with STL vectors and strings. 4 years ago
Michael Lutz f2b40f40aa Codechange: Replace SmallPair with std::pair.
std::pair is already the smallest possible pair, and it already handles non-POD types correctly.
4 years ago
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.
4 years ago
frosch 7f351fd7c1 Fix: Action7/9 conditions 0F..12 reported roadtypes as valid tramtypes and vice versa. 5 years ago
frosch e5dd19b0de Cleanup: Properties 12 and 15 do not exist for road/tramtypes. 5 years ago
glx 1f6b3a37f9 Codechange: Replace FOR_ALL_ENGINES with range-based for loops 5 years ago
glx22 d865916a07 Fix #7836: Check coherency of NewGRF parameter min/max (#7840) 5 years ago
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 5 years ago
Niels Martin Hansen 53f8d0b815 Codechange: Use std::vector for industry tile layouts 5 years ago
JMcKiern 04f659e768 Fix: Some typos found using codespell 5 years ago
peter1138 c02ef3e456 Feature: Add NotRoadTypes (NRT) 5 years ago
Charles Pigott 69a6c494bf Codechange: Set VehicleType's base type to byte instead of using VehicleTypeByte 5 years ago
PeterN be073b46da
Fix: Bounds check access to railtype_map. (#7529) 5 years ago
peter1138 4f052fc2a4 Cleanup: Fix alignment after NULL -> nullptr change. 5 years ago
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 5 years ago
frosch 0cf25e84df Fix #7447, 3357cac847: Action 4 has feature 48 'original strings'. (#7449) 5 years ago
glx22 66dd7c3879
Fix: MSVC warnings (#7423) 5 years ago
Henry Wilson c01a2e2a81 Codechange: Removed SmallVector completely 5 years ago
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 5 years ago
Henry Wilson 2bc2de9034 Codechange: Replaced SmallVector::Find() with std::find() 5 years ago
Henry Wilson a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 5 years ago
Henry Wilson aa7ca7fe64 Codechange: Replaced SmallVector::Get(n) non-const with std::vector::data() + n 5 years ago
Henry Wilson a690936ed7 Codechange: Replace SmallVector::Length() with std::vector::size() 5 years ago
Henry Wilson bfd79e59dc Codechange: Replace SmallVector::Clear() with std::vector::clear() 5 years ago
Peter Nelson 3357cac847 Fix: Bounds check NewGRF feature. 5 years ago
Peter Nelson 054d05b132 Codechange: NewGRF features are documented in hex, so display as hex. 5 years ago
peter1138 fc5f67123a Fix e66cec8f86: Permit loading of industry production callback with invalid cargo type.
It is only an error if the invalid result is actually used. This will be silently ignored at the moment.
It is still an error if a duplicate cargo type is returned.
5 years ago
Eddi-z 1447661d20 Cleanup: spurious TODOs in newgrf.cpp (#7297) 5 years ago
Peter Nelson 21dc725762 Fix: Don't consider engines not in the current climate towards used livery classes. 5 years ago
Niels Martin Hansen 48b334cf97 Add: Houses can accept up to 16 different cargo types via NewGRF.
New Action0 property 23 for feature 07, variable length, format B n*(B B). Initial byte is number of structures following. First byte in structure is cargo id, second is acceptance level in 1/8 units.
5 years ago
Niels Martin Hansen e66cec8f86 Add: NewGRF support for 16-in-16-out industries 6 years ago
Charles Pigott e0c0394e37 Fix: Remove various dead or unnecessary assignments 6 years ago
Charles Pigott f5b1115039 Doc: Lots and lots of doxymentation fixes 6 years ago
Michael Lutz 4b0b4e0643 Feature: [NewGRF] Increase size of persistent storage to 256. 6 years ago
frosch 6391d49277 Fix: Variable 0x85 had no bounds checks. 6 years ago
Niels Martin Hansen 836d25e738 Codechange: Address some MSVC compiler warnings 6 years ago
PeterN 4cebebcf68
Change: Add CargoTypes type for cargo masks. (#6790) 6 years ago
Patric Stout 88be2413ce
Codechange #6729: mute bogus GCC 7 warning (#6733)
We do a memset of (byte - byte), which strictly seen ranges from -254 .. 255, for which GCC warns.
But just before this memset is an if() which says the first byte has to be bigger than the second.
So this is a bogus warning.
6 years ago
frosch 55a503e6f2 (svn r27989) -Fix (r27985): VA2 optimisation failed in various special cases:
- nvar=0 is meant to return the calculated result.
  - Missing references resolve to NULL and got identified with the default result.
  - Missing 'break' broke overlapping cases.
  - Splitting into non-overlapping cases could result in more than 256 cases.
6 years ago
frosch 07d841d0ef (svn r27985) -Codechange: Convert VA2 switches into ones with non-overlapping ranges, sort them and resolve them using binary search. Speedup sprite resolving by about 7 percent. 6 years ago
peter1138 dacd8d87ef (svn r27974) -Fix (r27907) [FS#6627]: free() called on static airport rotation data (JGR) 6 years ago
adf88 6dec889306 (svn r27908) -Codechange: Mark airport tile tables and FTAs "const" to be sure that they are really constant 7 years ago
adf88 b56453f93b (svn r27907) -Fix: AirportSpec::rotation was memleaking 7 years ago
frosch b4b98e5165 (svn r27893) -Codechange: Use fallthrough attribute. (LordAro) 7 years ago
frosch fa8d85b632 (svn r27769) -Change: [NewGRF] Extend the DCxx range to D800-DFFF. 7 years ago
frosch 5846aa5bfc (svn r27768) -Codechange: Use if and IsInsideMM instead of switch-case sequences to test for consecutive values. 7 years ago
frosch b5d1e58b0e (svn r27767) -Codechange: Industries and houses should just use the default-case in Action 4. 7 years ago
frosch 1a9e1c5e91 (svn r27766) -Fix: Obiwan opposed translations for text id D3FF and DCFF in Action 13. 7 years ago
frosch 7b553d255e (svn r27732) -Change: Turn the message about 'missing baseset sprites' from a popup into a static message that only shows in non-release versions, just like the 'missing translations' message. 8 years ago
frosch 1aedadb49b (svn r27730) -Change: Split openttd.grf into openttd.grf and orig_extra.grf
openttd.grf is now always loaded and provides all extra graphics in case the (possibly outdated) baseset does not.
  orig_extra.grf contains graphics specific to the original baseset only.
8 years ago
frosch ec9a920aab (svn r27729) -Codechange: Do not count static NewGRF when checking for the maximum number of NewGRFs in a game.
-Codechange: Remove LAST_GRF_SLOT and MAX_NEWGRFS. Now NETWORK_MAX_GRF_COUNT is the only constant to specify the maximum number of non-static NewGRF.
-Codechange: Increase the number of file slots, effectively increasing the maximum number of static NewGRF and baseset GRFs.
8 years ago
frosch a3b356e057 (svn r27725) -Codechange: Remove IsOpenTTDBaseGRF and test for GCF_CONFIG instead, which does the same in all use-cases. 8 years ago
frosch 5267b60027 (svn r27722) -Fix (r7490): GCF_SYSTEM was never set correctly. 8 years ago
frosch d9bfe88261 (svn r27676) -Codechange: Rename catenary functions, so that they refer unambiguously to either RoadCatenary or RailCatenary. 8 years ago
matthijs 53982003ee (svn r27560) -Fix: typos in comments and string 8 years ago
frosch f6577b6ad7 (svn r27507) -Add: [NewGRF] Allow custom sound IDs in RV property 0x12, ship property 0x10 and aircraft property 0x12. 8 years ago
frosch df82dcdf35 (svn r27497) -Change: [NewGRF] Allow static NewGRF to enable the second rocky tile set. 9 years ago
frosch c655847235 (svn r27138) -Fix: [NewGRF] Negative positions in industry layouts were interpreted incorrectly; however since the wrong behaviour is saner, define as the correct behaviour for GRFv8. 9 years ago
frosch f79ead7125 (svn r27119) -Fix: Action 7/9 condition 0A failed for present, but disabled, NewGRF. 10 years ago
peter1138 253c91b17d (svn r26990) -Feature: Add option to choose normal, double or quad-size interface. 10 years ago
rubidium ddfc8372ee (svn r26884) -Change: scale the NewGRF's snow line level according to the configured maximum map height 10 years ago
rubidium 2361aaf601 (svn r26869) -Add: support for an all black palette to prevent the need of having a black tile of all different slopes (ic111) 10 years ago
rubidium 9ed12b0f07 (svn r26509) -Codechange: replace strdup with stredup (the latter ensures the return is not NULL) 10 years ago
rubidium e61fe21237 (svn r26506) -Codechange: replace most of vsnprintf with vseprintf 10 years ago
rubidium 0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 10 years ago
rubidium bbed2ff956 (svn r26475) -Fix: potentially undefined shifts in NewGRF code 10 years ago
planetmaker ba42bcdf49 (svn r26458) -Doc: Correct a few spelling mistakes (__ln__) 10 years ago
frosch ee5c115950 (svn r26245) -Codechange: No need for a map, if a vector suffices. 11 years ago
frosch 00e7ceeca4 (svn r26243) -Cleanup: Move TTDPStringIDToOTTDStringIDMapping to newgrf.cpp, it's only used there. 11 years ago
rubidium d2ba772f6a (svn r26130) -Codechange: add some guards against using invalid image indices 11 years ago
rubidium cf130ce9d8 (svn r26069) -Fix: missing break in NewGRF object handling 11 years ago
rubidium c035a9531b (svn r26067) -Fix: possible NULL dereference when getting NewGRF version 11 years ago
rubidium ca7dce1fc2 (svn r25961) -Fix [FS#5779]: [NewGRF] A powered rail type implies it is compatible as well, but some NewGRF didn't state that causing the path reservation code to bail out in some cases because there wasn't a compatible path 11 years ago
planetmaker ed54d39201 (svn r25878) -Feature: [NewGRF] Object property 0x18 to allow specifying the number of objects of that type being placed upon map creation 11 years ago
frosch 1b6ceef086 (svn r25842) -Codechange: Rename MAX_STATIONS to NUM_STATIONS_PER_GRF. 11 years ago
frosch 48d22700ad (svn r25841) -Codechange: Use NUM_AIRPORTTILES_PER_GRF instead of NUM_AIRPORTTILES to properly distinguish limits per NewGRF and limits of the pool.
-Change: [NewGRF] Lower the limit of airport tile types per NewGRF from 256 to 255 to prevent usage of ID 0xFF in Action3, and thus allowing it to become an extended byte somewhen.
11 years ago
frosch a92b698525 (svn r25840) -Codechange: Use NUM_AIRPORTS_PER_GRF instead of NUM_AIRPORTS to properly distinguish limits per NewGRF and limits of the pool. 11 years ago
frosch cfaa9457a6 (svn r25839) -Codechange: Use NUM_HOUSES_PER_GRF instead of NUM_HOUSES to properly distinguish limits per NewGRF and limits of the pool.
-Change: [NewGRF] Lower the limit of house types per NewGRF from 256 to 255 to prevent usage of ID 0xFF in Action3, and thus allowing it to become an extended byte somewhen.
11 years ago
frosch 6a0439a789 (svn r25838) -Codechange: Rename HOUSE_MAX to NUM_HOUSES. 11 years ago
frosch ad8b387f9e (svn r25837) -Codechange: Use NUM_INDUSTRYTILES_PER_GRF instead of NUM_INDUSTRYTILES to properly distinguish limits per NewGRF and limits of the pool.
-Change: [NewGRF] Lower the limit of industry tile types per NewGRF from 256 to 255 to prevent usage of ID 0xFF in Action3, and thus allowing it to become an extended byte somewhen.
11 years ago
frosch a521af8cf8 (svn r25836) -Codechange: Use NUM_INDUSTRYTYPES_PER_GRF instead of NUM_INDUSTRYTYPES to properly distinguish limits per NewGRF and limits of the pool. 11 years ago
frosch 60f483822f (svn r25834) -Codechange: Use NUM_OBJECTS_PER_GRF instead of NUM_OBJECTS to properly distinguish limits per NewGRF and limits of the pool.
-Change: [NewGRF] Lower the limit of object types per NewGRF from 256 to 255 to prevent usage of ID 0xFF in Action3, and thus allowing it to become an extended byte somewhen.
11 years ago
rubidium 13855f0a09 (svn r25705) -Fix: a number of typos (inspired by 90c920601c84975acb694f3673e2beb08b013753) 11 years ago
rubidium f292a87dc4 (svn r25312) -Fix-ish: missing spaces after comma + realignment of tables; quite boring with -x -w 11 years ago
rubidium 163dfdd34a (svn r25262) -Feature: linkgraph overlay for smallmap 11 years ago
frosch 71cfe3d474 (svn r25230) -Feature: [NewGRF] Expose sprite base of foundation and shore sprites via Action D Game Variables. 11 years ago
frosch 30f601d685 (svn r25115) -Fix (r8973) [FS#5492-ish]: [NewGRF] Acceleration of NewGRF aircraft was too fast, while acceleration of default aircraft was way too slow. I.e. choose wisely who to let write the software for your orbiter. 11 years ago
frosch cf4a2702f8 (svn r25099) -Fix [FS#5492]: Limit aircraft property 0D to 19, since the conversion result to km-ish/h needs to fit into a byte. 11 years ago
planetmaker c22bbf5293 (svn r25072) -Codechange: Don't require the custom currency to be the last defined one 11 years ago
peter1138 506132c051 (svn r24919) -Codechange: Remove useless noisy grf debug messages. 12 years ago
peter1138 c00a400cc7 (svn r24905) -Feature(ish): Implement station randomisation triggers. 12 years ago
planetmaker c24374f99c (svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by Eagle_rainbow) 12 years ago
frosch d7e9c8efed (svn r24821) -Add: When using a non-release version of OpenTTD and the basegraphics are missing some sprites, also suggest to use a non-release version of the basegraphics. 12 years ago
frosch d1ab0f03bc (svn r24790) -Remove: Classic difficulty profiles. 12 years ago
alberth 0849fb8d36 (svn r24535) -Doc: Two additions, lots of small spelling fixes, and some Doxygen improvements. 12 years ago
frosch 13bfb09cbb (svn r24438) -Fix [FS#5256-ish]: Make (non-refittable) vehicles with invalid default cargo unavailable. 12 years ago
alberth 2ab7c82b31 (svn r24395) -Doc: Fixed argument references in @param descriptions. 12 years ago
frosch d56b5783d1 (svn r24369) -Fix (r24361): Unused stuff is unused. 12 years ago
frosch 37d41d4448 (svn r24361) -Fix [FS#5227] (r22926): Apparently ext. A1 did not work at all. (Hirundo) 12 years ago
frosch 5e8151e245 (svn r24278) -Codechange: Deduplicate code to read translation tables. 12 years ago
frosch 522e5ec86b (svn r24277) -Codechange: Store cargo and railtype translation tables in a SmallVector. 12 years ago
frosch b8f6b300d6 (svn r24276) -Codechange: Enhance GRFFile with constructor and destructor. 12 years ago
frosch 9522dbb1a9 (svn r24272) -Fix: [NewGRF] Load cargo- and railtype-translation during both reservation and activation stage. That way they can be selected using Action7 depending on present cargo- or railtypes. 12 years ago
frosch e1fda49027 (svn r24194) -Change: Rename the 'signal_side' setting to 'train_signal_side', and add a third option while doing so. 12 years ago
frosch 6f4d2160c2 (svn r24162) -Codechange: Remove NewGRFClass::GetName() and SetName() in favour of using Get() and direct member access (which is needed anyway for GRF string resolving). 12 years ago
rubidium 02d9ecde6d (svn r24063) -Fix [FS#5125]: with certain versions of GCC and compiler flags the compiler could reorder some code badly causing the 32bpp depot flag not working 12 years ago
frosch 0643a69764 (svn r24052) -Fix (r23883) [FS#5107]: Imported GRF sounds were inserted into the wrong slots. 12 years ago
frosch 2007f7affd (svn r24051) -Fix: Comment. 12 years ago
frosch ee03cda858 (svn r24050) -Fix: Realsprites inside the action 11 block were not skipped correctly. 12 years ago
frosch ed3a9fa239 (svn r23960) -Fix/Change: [NewGRF] Make the properties for always/never refittable cargo types not behave incremental, but reset them on reassignment. 13 years ago
michi_cc 9101d2e2d2 (svn r23952) -Feature: [NewGRF] Customisable tunnel portals for rail types (sprites by Snail). 13 years ago
frosch d5bc5ddd00 (svn r23916) -Fix (r23145): When determining the first refittable cargotype according to CTT order, do not rely on the GRF assigning the refit_mask property. Also check for GRFs setting the default_cargo or refittable-cargo-classes or -types properties. 13 years ago
frosch a16389ab06 (svn r23915) -Codechange: Translate refitmask directly after reading it from the GRF. 13 years ago