Commit Graph

210 Commits

Author SHA1 Message Date
merni-ns c3ee5e58a3 Cleanup: Move remaining NPF files into pathfinder directory 2024-05-10 10:38:44 +02:00
Rubidium 8fe5fdf122 Codechange: use std::none_of to express clearer what the code does 2024-04-20 11:30:46 +02:00
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Rubidium 27eadc13ec Codechange: rename TILE_ADD(XY) to TileAdd(XY) 2024-03-10 15:50:24 +01:00
Michael Lutz 8b9f59d320 Codechange: Use references for non-optional in/out values of slope functions 2024-03-08 18:08:55 +01:00
Michael Lutz 8dda387f82 Codechange: Use std::tuple for slope functions with two return values 2024-03-08 18:08:55 +01:00
Loïc Guilloux b68d263d5f
Fix #12014: Remove water when area clearing ship depot (#12030) 2024-02-09 18:17:08 +01:00
Patric Stout 090616b4c9
Add: allow loading heightmaps from command-line (#11870)
If you want to load a file from tar, you have to give the file
inside the tar in order for it to work:

<tar-file>/<dir-in-tar>/<file>.png
2024-01-22 22:35:25 +00:00
Kuhnovic b38d3c2208
Change: simplified water region evaluation, removed savegame data (#11750) 2024-01-21 20:56:50 +00:00
Peter Nelson 33ff64ef74
Codechange: Simplify ConvertDateToYMD by returning YearMonthDay instead of outputting to a pointer. (#11637) 2023-12-28 21:34:08 +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
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Patric Stout 9624017fc2
Codechange: be more type-specific about types in NPFs queue (#11192) 2023-08-12 18:18:22 +00:00
Patric Stout 299570b2c1
Codechange: make TimerGameCalendar Date and Year types strongly typed (#10761) 2023-08-12 18:14:21 +00: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 56085be9bd Codechange: Move includes for common STL headers to stdafx. 2023-05-17 10:14:41 +01:00
Peter Nelson a8c0d16371 Cleanup: Use std::advance instead of for-loop. 2023-05-11 07:58:55 +01:00
Tyler Trahan 6501f84b4a
Codechange: Move calendar date functions inside TimerGameCalendar (#10753) 2023-05-04 13:14:12 +00:00
Rubidium f74e26ca7e Codechange: replace error/usererror printf variant with fmt variant and rename 2023-04-25 17:55:09 +02: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
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
Rubidium 43a7e54067 Add: unit test functionality using catch2 2023-04-16 18:58:21 +02:00
Rubidium c6ff7dad68 Add: compile time "unit tests" for GetPartialZ consistent 2023-04-09 19:00:26 +02:00
Rubidium 9d2a0f3d0b Change: make GetPartialZ consistent, meaning Z of adjacent slopes continue
Previously, on a straight line of a one corner up slope with the adjacent
steep sloop the Z would increase one step every two sub pixels, except for one
case where one sub pixel is skipped. Similarly, a steep slope with two
adjacent one corner up slopes, would have a bump in the height line along the
diagonal whenever it enters/leaves the steep slope tile.
2023-04-09 19:00:26 +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 a409e4b026 Add: documention to large functions that have too little documentation according to CodeQL 2023-02-25 23:57:36 +01:00
Rubidium fe2bcd2a58 Codechange: migrate size related functions to Map structure 2023-01-21 17:11:40 +01:00
Rubidium 9c1a3b17e3 Codechange: use MapLogY() instead of FindFirstBit(MapSizeY()), MapSize() instead of MapSizeX() * MapSizeY() 2023-01-21 17:11:40 +01:00
SamuXarick 96ec9908a0
Codechange: refactor removal of desert around river tiles 2023-01-15 00:43:41 +01:00
Tyler Trahan 07fba75238
Fix: Various Wide River issues (#10348) 2023-01-14 08:20:19 -05:00
Rubidium f667a831a5 Codechange: unify creation of diagonal/orthogonal iterator using smart pointers 2023-01-13 21:09:40 +01:00
Peter Nelson a971eee2e0 Cleanup: Replace foundation drawing magic numbers.
Use TILE_SIZE or TILE_HEIGHT as appropriate instead.
2022-12-23 15:43:11 +00:00
Peter Nelson 138198e971 Change: Separate ground sprite from foundation sprite offsets. 2022-12-23 15:43:11 +00:00
2TallTyler 0116a422ea Cleanup: Refactor Wide Rivers code slightly 2022-12-16 17:43:33 -05:00
2TallTyler d67259334a Fix #10218: Sloped river tiles need water both up and downstream 2022-12-16 17:43:33 -05:00
Tyler Trahan 4daad7f348 Change: Don't make wide rivers using original landscape generator 2022-10-22 12:16:56 +02:00
Tyler Trahan 664771d085 Feature: Wide rivers 2022-10-20 21:17:35 +02:00
SamuXarick c7505539af Fix #9869: remove docking tile when doing a clear square
Terraforming through objects placed on water didn't properly remove docking tiles as expected.

By moving some logic regarding removal of docking tiles into DoClearSquare, the issue is solved, while also simplifying code, avoiding repetition elsewhere.
2022-10-16 18:29:03 +02:00
Michael Lutz 2e39637db2 Codechange: Don't use a global for the 'not enough cash' message. 2021-12-16 22:28:32 +01:00
Michael Lutz c6d7b98808 Codechange: Un-bitstuff landscape commands. 2021-12-16 22:28:32 +01:00
Michael Lutz e740c24eb7 Codechange: Template DoCommand to automagically reflect the parameters of the command proc.
When finished, this will allow each command handler to take individually
different parameters, obliviating the need for bit-packing.
2021-12-16 22:28:32 +01:00
Michael Lutz 7048e1522f Codechange: Move flags in CommandProc in front of the command arguments. 2021-12-16 22:28:32 +01:00
Michael Lutz 33ca4f2b99 Codechange: Let the compile generate the master command table out of templated command traits.
This is using a non-intrusive type-traits like templated system, which
allows compile-time validation that the command table and the command
enum match up.
2021-12-16 22:28:32 +01:00
Michael Lutz b6933a2ebd Codechange: Move command arguments to the back of the DoCommand function call. 2021-12-16 22:28:32 +01:00
rubidium42 2e136285e1 Codechange: move from C-string to std::string for DoCommand 2021-05-29 19:02:18 +02:00
Patric Stout ff6924f122
Fix 70bc55cfd6e: snow line height was set while calculating desert line (#8989)
Seems I liked copy/pasting just a tiny bit too much.
2021-04-10 10:14:55 +01:00
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.
2021-03-26 12:22:32 +01:00
Patric Stout 70bc55cfd6 Feature: setting to indicate desert coverage for tropic climate
This is an indication value; the game tries to get as close as it
can, but due to the complex tropic rules, that is unlikely to be
exact.

In the end, it picks a height-level to base the desert/tropic
line on. This is strictly seen not needed, as we can convert any
tile to either. But it is the simplest way to get started with
this without redoing all related functions.
2021-03-26 12:22:32 +01:00
Patric Stout cafe4eed6e Feature: setting to indicate snow coverage for arctic climate (replaces snow line height)
Setting the snow coverage (in % of the map) makes a lot more sense
to the human, while still allowing the niche player to set (by
finding the correct %) a snow line height they like. This makes for
easier defaults, as it decoupled terrain height from amount of snow.

Maps can never be 100% snow, as we do not have sprites for coastal
tiles.

Internally, this calculates the best snow line height to approach
this coverage as close as possible.
2021-03-26 12:22:32 +01:00