Commit Graph

905 Commits (2fd9096070cf5af8548dadafdaf32e49909f6a8b)

Author SHA1 Message Date
Peter Nelson 2fd9096070
Change: Decouple and remove landscape-dependent cargo types. (#11719)
Cargo types of default engines, industries and houses are now specified in terms of label.
4 months ago
Peter Nelson 17d02ed45f
Feature: NewGRF properties to set town production effect and multiplier. (#11947)
Town production effect is modelled on town acceptance (growth) effect, and so takes an original cargo slot for behaviour instead of a direct value.

NewGRF feature 0x0B, property 0x1E, takes 1 byte.

Valid values are:
- 0x00 to behave like passengers
- 0x02 to behave like mail
- 0xFF to behave like other cargo (i.e. not produced.)

If not set, town production effect is set based on the cargo label ('PASS' or 'MAIL').

Town production multiplier allows adjusting the amount of cargo produces when Town Production Effect is set, without needing to use callbacks.

NewGRF feature 0x0B (cargo), property 0x1F, accepts a 2 byte (word) value, similar to the cargo capacity multiplier property. The default value is 256 which means 100%, i.e. normal rate.
4 months ago
frosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 4 months ago
Peter Nelson 8d69d0549d Codechange: Add town production effect type and assign to cargo types. 4 months ago
Peter Nelson 60dcf3b5e2 Codechange: Rename TownEffect to TownAcceptanceEffect.
This makes it clearer that TownEffect only affects acceptance behaviour.
4 months ago
Koen Bussemaker 5a55c4a934 Feature: [NewGRF] Allow higher max speeds for ships 5 months ago
Tyler Trahan 735abfe111
Codechange: Split dates and timers into Economy and Calendar time (#10700) 5 months ago
Peter Nelson c0ab436077
Codechange: Store Colours in Colours type. (#11625)
This reduces casts, some magic numbers, and introduces a bit of type-safety.
5 months ago
Peter Nelson 903119115b
Fix 9602de4: FinaliseCargoArray did nothing. (#11839)
`CargoSpec::Iterate()` deliberately skips invalid cargo types, but `FinaliseCargoCarry()` is only interested in them.
5 months ago
Peter Nelson 8f2266f0ed
Codechange: Use range-for when validating and finalising industries. (#11744) 5 months ago
Peter Nelson 97e2bc612c Codechange: Rename and move SpriteGroup-specific cargo types into a namespace.
These 'cargo types' have special defined uses and must not be used elsewhere. This makes it clearer that they are special.
5 months ago
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.
5 months ago
Peter Nelson 33ff64ef74
Codechange: Simplify ConvertDateToYMD by returning YearMonthDay instead of outputting to a pointer. (#11637) 6 months ago
Peter Nelson e5aed24395
Codechange: Use std::array for industry tile cargo acceptance. (#11498)
This avoids use of memcpy/memset to copy or fill.
7 months ago
Tyler Trahan 235ac0bceb
Codechange: Reword rail/road type label constants (#11451) 7 months ago
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.
7 months ago
Rubidium c6411168d8 Cleanup: missing spaces before continuation * in some comments 8 months ago
Rubidium 37f84b7372 Codechange: replace x.size() != 0 with !x.empty() 8 months ago
Rubidium f16399f4c9 Codechange: replace x.size() > 0 with !x.empty() 8 months ago
Rubidium c9276c2959 Codechange: replace x.size() == 0 with x.empty() 8 months ago
Peter Nelson bc8e26f4e7
Codechange: Simplify usage of GRFFile cargo_map. (#11349) 8 months ago
Peter Nelson 9602de474d Codechange: Use iterators and/or range-for on cargo related loops. 8 months ago
Peter Nelson 5869f790d8
Fix: Check for engine variant loops during NewGRF initialization. (#11343)
Invalid NewGRFs could set up an engine variant loop that never ends. This
was checked for in some places that evaluated variants, but not all. In
most cases this would result in the engines not appearing, but could
potentially cause an infinite loop and crash.

Instead, during NewGRF initialization detect loops and remove invalid
variants before setting display flags.
9 months ago
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 9 months ago
PeterN acd7d3c913
Codechange: Rename *Railtype* to *RailType* for consistency. (#11287) 9 months ago
Tyler Trahan 77173a6a10 Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes 9 months ago
Patric Stout 299570b2c1
Codechange: make TimerGameCalendar Date and Year types strongly typed (#10761) 10 months ago
Patric Stout b7acf9e50e
Codechange: use TimerGameCalendar::Year and friends when working with years (#11188) 10 months ago
Tyler Trahan c7b51a8c3a
Codechange: Use proper date types in various places (#11177) 10 months ago
Jonathan G Rennison f31a25cd59
Change: Do not allow mixing road/tram types in powered road type list (#11148)
Road/tram property 0F
11 months ago
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
11 months ago
rubidium42 9f6fec01cd
Codechange: rename cargo aging days to periods, as they are not really days (#11112) 11 months ago
Rubidium 18a31cca7c Codechange: do not make a string valid in place, to then copy it 12 months ago
PeterN 509471f7f8
Codechange: Use std::optional for GRFConfig::GRFError (#11066)
This changes the semantics from "object pointer ownership" to "optional object", and simplifies copies.
12 months ago
Peter Nelson 9dd9b8ec74 Fix #11054: Prevent translation of currency codes.
Most languages stick with the 3-letter latin currency codes in the name
string, however some translations are... clever... and use the currency
symbol instead. Whilst this may look nice, it can cause issues with fonts
as some scripts have a specific limited set of fonts which do not include
these symbols.

Instead, hard code the currency code list and add it when drawing the
currency name.
12 months ago
Rubidium d4c2043294 Codechange: remove a number of unneeded c_str() calls 1 year ago
PeterN 0b663f709d
Codechange: Sprite mapping for objects doesn't involve cargo types. (#10905)
Objects have a default sprite group and an optional purchase list sprite
group. There is no need to pretend that these are cargo IDs.
1 year ago
Peter Nelson 76516d7f70 Codechange: Use IsValidCargoID/IsValidCargoType.
IsValidCargoType() is used only for unmapped IDs.
1 year ago
Rubidium 3323402aaa Codechange: rename smallvec_type to container_func and use only when needed 1 year ago
Peter Nelson 6b87fe6540 Codechange: Use std::array for GRF(File|Config) parameters.
This simplifies comparison, copying and assignment operations.
1 year ago
Peter Nelson c23aae96a2 Codechange: Use std::array instead of C array for automatic deep-copies. 1 year ago
Peter Nelson f14479d27d Codechange: Use std::optional for GRF Parameter list. 1 year ago
Peter Nelson c38df2d589 Codechange: Use std::map instead of custom SmallMap. 1 year ago
Peter Nelson 83f2ad500e Codechange: stdarg.h include not needed as cstdarg is included. 1 year ago
Peter Nelson 56085be9bd Codechange: Move includes for common STL headers to stdafx. 1 year ago
Peter Nelson 0b72297d57 Feature: Increase number of stations/roadstops per NewGRF. 1 year ago
Peter Nelson bc7dfd7b46 Add: Station property 1C/1D to set name/classname.
These are an alternative to the original "generic" C4xx/C5xx method,
which can only assign strings to IDs up to 256.
1 year ago
Peter Nelson d6f35a9fd6 Change: Add placeholders for unimplemented NewGRF station properties. 1 year ago
Peter Nelson e5c9a3e527 Change: Read Action 3 IDs as extended-bytes for all features.
This can be done because previous the value 0xFF (which indicates an
extended byte) was reserved for this purpose. Other features which may
not have mentioned reserving 0xFF do not allow this many IDs anyway.

This makes Action 3 consistent across all features. The allowable limits
for each feature do not change.
1 year ago
Peter Nelson 10baecd81f Change: Make Action 3 debug messages more consistent. 1 year ago