Commit Graph

837 Commits (97cfd40649abab832315f00e6a07e5b6b9a17e23)

Author SHA1 Message Date
PeterN 246ba6f00a
Fix 8361cf5a73: Missing bounds check for house specs. (#10625) 1 year ago
Peter Nelson 08977828cc Fix: Check ID for name is within bounds. 1 year ago
Peter Nelson cd6c04a663 Fix: Check station ID is within bounds when copying layouts. 1 year ago
Peter Nelson 8361cf5a73 Fix: Check sprite group mapping ID is within bounds of feature. 1 year ago
Peter Nelson 96f4eb3681 Codechange: Check NewGRF feature is defined before processing any sprite group mapping.
Previously this was checked after loading ids, or repeatedly checked for
each item.
1 year ago
Peter Nelson 04215afe3f Codechange: Replace roadstop spec limit magic number with constant. 1 year ago
Peter Nelson 93197f58b7 Codechange: Bind objectspecs to classes once all finalised. 1 year ago
Joan Josep d80f193e74
Fix: Improve grfmessage for ShipVehicleChangeInfo. (#10558) 1 year ago
Jonathan G Rennison 5d0ad5625b
Fix : [NewGRF] Object and road stop ignore property handlers (#10525)
* Fix: IgnoreObjectProperty did not handle object property 0x18

* Fix: IgnoreRoadStopProperty did not handle properties 0x0E - 0x12, 0x15
1 year ago
Jonathan G Rennison 4c1406a4b5 Add: NewGRF road stops 1 year ago
Michael Lutz 2d73076056 Add: [NewGRF] Second vehicle property for additional callback flags. 1 year ago
Michael Lutz f5394ed2ef Change: [NewGRF] Extend the D8xx (DCxx) string area up to FFFF.
This adds the Exxx and Fxxx blocks to the usable range for NewGRF
local strings. TTDPatch uses these ranges for internal strings, but as
we don't support any of them anyway, it is "free" real estate for us.
1 year ago
rubidium42 6ba55e663e Codechange: do not hide variables with other variables 1 year ago
Rubidium fe2bcd2a58 Codechange: migrate size related functions to Map structure 1 year ago
Francis Herne 01be423237 Fix #10362: NewGRF bridges without speed limits.
For bridges, a max speed of 0xFFFF (i.e. no effective limit)
 is no longer displayed as a limit in the UI.

A max speed of 0 is also considered unlimited, for similarity to the
 roadtype and railtype interface.
1 year ago
PeterN 2355882ec1
Codechange: Remove object `enabled` flag and shuffle members. (#10358)
`enabled` flag is replaced with IsEnabled() which checks if views is
non-zero.

ObjectSpec is shuffled to reduce its memory footprint.
1 year ago
PeterN 6a0d1c7c19
Fix: Link variants to parents when finalising engines. (#10346)
This ensures that definition-order of engines within the NewGRF does not matter.
1 year ago
PeterN 1b1aa682a6
Fix: Don't assume engclass 2 should be elrail. (#10315)
When disabling/enabling elrail, there is an assumption that `engclass` of 2
means the engine will run on elrail. While this holds for default engines,
NewGRFs can do other things.

To resolve this we store the intended railtype so that toggling elrail will
restore to the correct type.
2 years ago
Francis Herne 6caed5f15e
Add: Slope-aware and roadtype-specific one-way sprites. (#10282) 2 years ago
PeterN 4f26f6b8aa
Cleanup: Simplify GRFLabel linked-list with std::vector. (#10284) 2 years ago
Peter Nelson 3485709f53 Add: Additional vehicle flags to control variants. 2 years ago
Peter Nelson 85814b29d4 Feature: Vehicle add-ons can now group engines in purchase list.
Grouped engines are collapsed by default but can be expanded. This allows
similar engines to be grouped together to avoid cluttering the list.

Suggested uses for this are e.g.:
* Liveries; same stats but different paint job.
* Re-gearing; engine design is mostly the same but different stats.

... but avoiding complex hidden cargo subtype refit systems.

Grouped engines are otherwise separate, so can be independently
autoreplaced, even between variants.
2 years ago
peter1138 d7f561a400 Change: Add variant property to engines. 2 years ago
PeterN 7b5edba76c
Change: Support flipping shorter engines without NewGRF support. (#10262)
* Change: Support flipping shorter engines without NewGRF support.
* Cleanup: Remove write-only prop27_set temporary flag.
2 years ago
PeterN f24286a1ae
Fix: Ensure 31-bit shifts are unsigned. (#10128)
Shifting a signed 32-bit integer by 31 bits is undefined behaviour.
A few more than necessary are switched to unsigned for consistentency.
2 years ago
Michael Lutz bd357656ba Codechange: [NewGRF] Replace magic number for default object size by a constant. 2 years ago
frosch f4e2a462fe Cleanup: Remove unused flag sprites. 2 years ago
dP 548f0496a9
Change: Make _tick_counter 64bit to avoid wrapping (#10035) 2 years ago
frosch e2c46fda3f Fix: [NewGRF] Ensure that stations always have an even number of sprite layouts.
The drawing code has a special fallbacks for zero layouts, but fails hard for one layout.
(odd numbers >= 3 are weird, but do not fail as badly as 1)
2 years ago
Jonathan G Rennison 4acccc232a Fix #9925: Industry tile layout validation for layouts of only one tile 2 years ago
Niels Martin Hansen 5587e439a9 Fix: Industry layouts with zero regular tiles should be invalid 2 years ago
Michael Lutz 08a5478a93 Add: [NewGRF] Map seed as global variable.
This is useful to provide a feature-agnostic, stable random value that differs between games.
One of the possible uses is to e.g. use it to create pseudo-random regions for towns or industries.
2 years ago
Jonathan G Rennison fc58ed9987
Codechange: Remove CargoSpec::multipliertowngrowth which is unused (#9701)
This is set by cargo property 19.
This property is only implemented in TTDPatch.
3 years ago
Michael Lutz 95c8467670 Fix 65cbde4b: Writing to uninitialized string when loading a currency NewGRF. 3 years ago
PeterN 7e70ead396
Fix #9562: Handle case of invalid action2 with zero results. (#9564) 3 years ago
Charles Pigott 16dca0d7bc Codechange: Object non-zero dimension check was not logically correct 3 years ago
Vít Šefl 2183fd4dab
Feature: [NewGRF] Maximum curve speed modifier for rail vehicles (#9346) 3 years ago
Rubidium 178ea3196b Remove: includes to network/core/config.h from headers when only three cpp files need it 3 years ago
Patric Stout 6f0c6fb2ae Fix a4987233: NewGRFs could no longer be loaded from the NewGRF folder.
This statement was removed by accident, as it felt it could be removed.
But it is used to know if the NewGRF is from the baseset folder or
from the NewGRF folder.
3 years ago
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