Commit Graph

562 Commits

Author SHA1 Message Date
Rubidium bab5a8a787 Codechange: use std::source_location over __FILE__ and __LINE__ for Backup 2024-03-10 10:14:20 +01:00
Peter Nelson 58ed38be03 Change: Avoid adjacent fence fields.
This restores pre-r23168 behaviour of only a single fence between adjacent fields.
2024-02-11 22:10:46 +01: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
Tyler Trahan 41f2eed425
Feature: Settings to scale cargo production of towns and industries (#10606) 2024-01-30 15:11:46 -05:00
Tyler Trahan 735abfe111
Codechange: Split dates and timers into Economy and Calendar time (#10700) 2024-01-22 09:04:34 -05:00
Peter Nelson c0ab436077
Codechange: Store Colours in Colours type. (#11625)
This reduces casts, some magic numbers, and introduces a bit of type-safety.
2024-01-21 13:23:04 +00: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
Rubidium e3f49ee7a0 Codechange: coding style fixes 2024-01-04 16:23:54 +01:00
Peter Nelson e5aed24395
Codechange: Use std::array for industry tile cargo acceptance. (#11498)
This avoids use of memcpy/memset to copy or fill.
2023-11-27 23:17:55 +00:00
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.
2023-11-06 20:29:35 +00:00
Rubidium c9276c2959 Codechange: replace x.size() == 0 with x.empty() 2023-10-20 23:05:43 +02:00
frosch 5733145c59 Cleanup: Remove unneeded parameters. 2023-09-19 22:49:59 +02:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
PeterN 18e75dbc88
Fix: Don't produce invalid cargo. (#11314)
Production for secondary industries did not always check that the produced cargo type isn't valid.
2023-09-18 22:43:03 +01:00
Tyler Trahan fca2b37726 Codechange: Move Ticks into their own class 2023-09-10 08:40:25 -04:00
Michael Lutz 0089323542 Add: [Script] Custom news message text for industry SetProductionLevel. 2023-09-02 16:20:59 +02:00
Michael Lutz 1c56991213 Add: [Script] Game script control of industry production level. 2023-09-02 16:20:59 +02:00
Patric Stout 07730584d7
Codechange: make explicit when a TileIndex is cast to its basetype (#11190)
This prevents people accidentially assigning a TileIndex to a Date
or any other type they shouldn't.
2023-08-15 18:12:05 +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
Rubidium 3e8f8c55c2 Codechange: make creating temporary StringParameters easier 2023-06-20 17:37:24 +02:00
Rubidium 1d902a97ce Codechange: move StringParameters to strings_internal.h 2023-06-17 12:14:11 +02:00
Rubidium 0a5e58451b Codechange: pass string parameters by reference 2023-06-14 06:14:08 +02:00
Rubidium f86500df92 Codechange: remove need for SetDParamX 2023-06-12 09:12:11 +02:00
Rubidium 36aaa9d683 Codechange: let GetStringWithArgs use StringBuilder 2023-06-04 18:00:23 +02:00
PeterN 584faaf064
Change: Reorganise industry accept/produce arrays. (#10853)
Use a array of struct for each cargo instead of an array for each statistic.
This makes iterating for acceptance and production much simpler.
pct_transported is now calculated when needed.
2023-05-25 21:25:46 +01:00
Peter Nelson 09408e8e46 Codechange: Add IsCargoAccepted/Produced() helpers. 2023-05-24 17:34:11 +01:00
Peter Nelson 76516d7f70 Codechange: Use IsValidCargoID/IsValidCargoType.
IsValidCargoType() is used only for unmapped IDs.
2023-05-22 20:43:40 +01:00
Henry Wilson 3a03a12a9c Feature: Show the number of industries already built in the Fund New Industry window. 2023-05-12 20:48:11 +02:00
Rubidium fb856e16c1 Codechange: replace some min/clamp constructs to ClampTo 2023-05-06 21:26:13 +02:00
Tyler Trahan 6501f84b4a
Codechange: Move calendar date functions inside TimerGameCalendar (#10753) 2023-05-04 13:14:12 +00:00
Tyler Trahan 6830e5f5f7
Cleanup: Don't use a magic number when closing processing industries (#10710) 2023-04-24 19:58:48 +00:00
Patric Stout 31ad990831
Codechange: move tick-counter into TimerGameTick (#10712) 2023-04-24 16:55:40 +00:00
Patric Stout 7aa2b9ab0a
Codechange: move all date-related variables inside the timer (#10706) 2023-04-24 15:56:01 +00:00
Peter Nelson 087654501b Codechange: Initialise specs with std::fill/std::copy instead of memset/memcpy. 2023-04-23 15:58:27 +01:00
PeterN e97bf271dc
Codechange: Make SpriteType, CargoSortType, SourceType and ScriptType enum classes. (#10663)
This avoids a (soft) namespace conflict between the four ST_* enums.
2023-04-16 20:00:55 +01:00
Patric Stout 3ebc7ad16e Codechange: migrate all game-time-related timers to the new framework 2023-04-15 13:58:55 +02:00
Rubidium e8af8daa68 Codechange: pass "ground vehicle" to GetTileSlopeZ since for tunnel/bridges there are two states
Previously it checked the position in non-driving direction to "guess" whether
a ground vehicle was using the function, so on tunnels/bridges it could either
return the Z of the (virtual) ground compared to the Z of the path the vehicle
would take.
2023-04-09 19:00:26 +02:00
Rubidium 580d0a6343 Codechange: make use of Tile in for all direct map accesses 2023-02-28 07:11:48 +01:00
Rubidium 8cbf1be9d6 Codechange: split large function into smaller functions with self-explanatory names 2023-02-25 23:57:36 +01:00
dP fe2c8a1240
Codechange: Decouple INDUSTRY_CTRL into separate commands (#10475) 2023-02-14 11:29:11 +01:00
rubidium42 6ba55e663e Codechange: do not hide variables with other variables 2023-01-29 07:21:34 +01:00
Rubidium de6bc8e692 Codechange: move TILE_MASK to Map::WrapToMap 2023-01-21 17:11:40 +01:00
Rubidium fe2bcd2a58 Codechange: migrate size related functions to Map structure 2023-01-21 17:11:40 +01:00
PeterN 5801442780
Fix: Switch to OWNER_TOWN prevented OWNER_DEITY test during industry prospecting. (#10360) 2023-01-17 17:33:03 -05:00
Tyler Trahan 2206c73156
Feature: Set a custom number of industries in map generation window (#10340) 2023-01-14 05:12:29 -05:00
Tyler Trahan dced2d8c30
Fix #10333, c53f29d: Only show industry prospecting errors to local company (#10338) 2023-01-12 14:03:39 -05:00
Daniel Robinson c53f29df53
Fix #10181: Show error message on failed industry prospecting (#10202) 2022-12-25 23:12:06 +01:00
frosch 9529703cab
Codechange: When checking industry placement conditions, perform cheap checks first. (#9987)
1. Built-in checks on industry level.
2. Built-in checks on industry tiles.
3. NewGRF-defined checks on industry level.
4. NewGRF-defined checks on industry tiles.
2022-09-01 18:13:43 +02:00
Jonathan G Rennison b3893878bb Fix #9867: Industry::stations_near not filled at industry creation 2022-04-25 19:32:22 +02:00
dP 36bee83864
Change: Deliver cargo to the closest industry first (#9536) 2022-02-19 19:08:23 +01:00