Commit Graph

58 Commits

Author SHA1 Message Date
Peter Nelson ed2db80990 Codechange: Use map.emplace() instead of map.insert(std::pair).
This avoids a copy of the pair into the map.
2024-04-20 10:25:20 +01:00
Peter Nelson ff35288ddf
Fix: Don't let CT_INVALID map to valid cargo type. (#12364) 2024-03-23 20:18:31 +00:00
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.
2024-02-04 10:16:08 +00:00
Peter Nelson 8d69d0549d Codechange: Add town production effect type and assign to cargo types. 2024-02-02 20:37:49 +00:00
Patric Stout fd073a2810 Remove: replace custom span with std::span 2024-01-17 00:25:08 +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
Peter Nelson 76701c4622 Add: Function to get largest cargo icon size. 2023-12-02 15:23:05 +00:00
Peter Nelson 6fb89b189f Fix #11315: Sort industries and cargoes by name* in industry chain window.
*Cargo types are sorted by the normal method so it's not strictly alphabetical.
2023-09-19 12:25:20 +01:00
Peter Nelson fd2dd4397f Codechange: Use range-for and iterator to populate default cargo table. 2023-09-17 21:26:01 +01:00
Peter Nelson e8cbc3c2c7 Codechange: Simplify initialization of default cargoes. 2023-09-17 21:26:01 +01:00
Peter Nelson 14bcfff6f5 Codechange: Rename INVALID_CARGO to INVALID_CARGO_BITNUM
... to avoid future ambiguity.
2023-09-17 16:56:07 +01: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 c829930440 Codechange: replace strnatcmp with C++ string capable version 2023-04-29 12:07:45 +02:00
Henry Wilson 89cf0d5da8 Codechange: Factor cargotype weight conversion magic numbers 2022-11-08 21:02:08 +01:00
glx22 5844027eb8 Codechange: Remove FOR_ALL_SORTED_STANDARD_CARGOSPECS 2021-07-09 21:36:09 +02:00
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.
2021-05-13 23:28:43 +02:00
glx22 9a8756d7ed Codechange: Replace FOR_ALL_CARGOSPECS with range-based for loops 2021-04-29 21:08:24 +02:00
Peter Nelson 20ac0b4148 Cleanup: Replace FOR_ALL_SORTED_CARGOSPECS macro with range iterator. 2021-04-28 23:54:31 +01:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Charles Pigott 224acb78b0 Fix: Compiler warnings about memsetting non-trivial classes 2020-06-27 14:51:14 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
glx 0797de06be Codechange: use std::vector for _sorted_cargo_specs 2019-04-18 21:49:34 +02:00
PeterN 4cebebcf68
Change: Add CargoTypes type for cargo masks. (#6790) 2018-05-21 22:08:39 +01:00
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 2014-04-23 20:13:33 +00:00
frosch 59951051a0 (svn r24848) -Fix [FS#5386]: Consider regearing-like cargos as no-cargo in cargo filters. 2012-12-23 22:12:52 +00:00
frosch 90c53046c7 (svn r23860) -Feature: [NewGRF] Add cargo property 1D to set the capacity multipliers when refitting vehicles, which do not use callback 15. 2012-01-28 12:08:03 +00:00
rubidium 6d6be50ae0 (svn r23740) -Codechange: remove some 300 unneeded includes from the .cpp files 2012-01-03 21:32:51 +00:00
rubidium 3d88c74389 (svn r23526) -Codechange: unify cargos vs cargoes 2011-12-15 21:56:00 +00:00
rubidium 46c242b1dc (svn r22385) -Fix [FS#4603]: strnatcmp is in string.cpp, so it ought to be declared in string_func.h. 2011-04-30 14:24:23 +00:00
terkhen 75f86a7a21 (svn r21344) -Feature [FS#4214]: Natural sorting of strings using ICU. 2010-11-27 22:52:12 +00:00
frosch ed4f806f1d (svn r20283) -Codechange: Unify start of doygen comments. 2010-08-01 19:22:34 +00:00
terkhen 869fac9964 (svn r19573) -Fix (r19541): Special cargos did not appear at the refit list. 2010-04-07 14:17:29 +00:00
terkhen 4ec8fed1da (svn r19534) -Add: Keep a list of cargo specifications sorted by cargo class / name. 2010-04-01 19:48:28 +00:00
alberth 41d2214e7e (svn r18413) -Doc: Added doxygen strings for cargo-type related enums, structs, and functions. 2009-12-05 21:39:28 +00:00
alberth c38f3ce380 (svn r18410) -Codechange: Move GetCargoSprite() to CargoSpec::GetCargoIcon(). 2009-12-05 16:00:58 +00:00
frosch 79627b4f89 (svn r17976) -Codechange: Move CargoClass to cargotype.h and clean up including of newgrf_cargo.h 2009-11-05 19:46:17 +00:00
rubidium 7fbc33dae1 (svn r17248) -Fix: add GPL license notice where appropriate 2009-08-21 20:21:05 +00:00
smatz f16314d0cc (svn r16853) -Codechange: make CargoSpec const at two places 2009-07-16 21:37:59 +00:00
smatz 77d13eae61 (svn r16852) -Codechange: use FOR_ALL_CARGOSPECS for iterating over all valid CargoSpecs 2009-07-16 20:40:06 +00:00
smatz 1f29e38b83 (svn r16849) -Codechange: replace GetCargo() by CargoSpec::Get() 2009-07-16 19:00:13 +00:00
smatz f2e55319dd (svn r16661) -Codechange: move definition of few very short functions to header files 2009-06-25 23:49:59 +00:00
smatz 0d3f5e6e74 (svn r15299) -Cleanup: remove many redundant includes 2009-01-31 20:16:06 +00:00
rubidium d03994098b (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description. 2008-05-06 15:11:33 +00:00
rubidium d4e6a6bf57 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h. 2008-01-13 01:21:35 +00:00
peter1138 6a13067931 (svn r11758) -Fix(ette): Populate 'void' cargo slots (unused slots in temperate and arctic) with default data as per pre-newcargo support. These slots are still disabled by default, but some NewGRFs (erroneously?) expect the default data. 2008-01-04 17:25:53 +00:00
rubidium 01e20c9140 (svn r11674) -Codechange: refactor some functions out of macros.h into more logical locations. 2007-12-21 19:21:21 +00:00
skidd13 eeaa348f8b (svn r11484) -Codechange: Remove the doubled function SetBitT and rename the remaining to fit with the naming style 2007-11-20 13:35:54 +00:00
peter1138 b8a82dcb05 (svn r9871) -Fix (r8826): Some cargo costs were wrong for different climates. Multiple definitions of the same cargo type are sometimes required. 2007-05-18 21:50:32 +00:00
peter1138 59399480b3 (svn r9620) -Codechange: apply cargo translation table to newstation variables 0x60..0x65 2007-04-13 19:32:18 +00:00