Commit Graph
688 Commits
Author SHA1 Message Date
Peter NelsonandPeter Nelson 2ede94bc40 Codechange: Adapt functions to get accepted cargo of prototype house. 2024-12-02 00:48:46 +00:00
Peter NelsonandGitHub b730f8783e Fix d450d4743: Division by zero when larger_towns is set to 0. (#13104)
Universe ended.
2024-11-20 00:09:02 +00:00
Peter NelsonandGitHub fc8685d618 Codechange: Use functor for Kdtree's XYFunc. (#13074)
Kdtree uses a function pointer and incorrectly calls it a functor. The function pointer needs to be passed on instantiaton.

Instead, use an actual functor. This simplifies instantiation.
2024-11-19 20:29:56 +00:00
Loïc GuillouxandGitHub 9dae626237 Codefix: restore _generating_world and nearest town cache when failing to fund a random town (#13042) 2024-10-29 19:56:15 +01:00
Rubidiumandrubidium42 c9819f8957 Codechange: split GetRoadDir as bays have DiagDir and drive throughs have Axis 2024-10-24 20:40:32 +02:00
Rubidiumandrubidium42 a6b7593a52 Codechange: use TileDiffXY(0, 0) over magic 0 2024-10-20 15:49:32 +02:00
Rubidiumandrubidium42 3b0fcf442f Codefix: use actual type instead of int for TileIndexDiff 2024-10-20 15:49:32 +02:00
Peter NelsonandGitHub 446db2c826 Codechange: Remove redundant NewsStringData data. (#12983)
Since SetDParamStr() always owns a copy of the string, there is no need to make another copy of it to keep it around while the news item exists.

This also fixes a leak in `CmdIndustrySetProduction` as the allocated data wasn't passed to AddIndustryNewsItem.
2024-10-08 19:48:55 +01:00
Peter NelsonandGitHub d450d4743e Fix #12957: 1-in-X proportion of towns being cities is unnecessarily random. (#12960)
Using an actual random chance to generate cities means that there may be far less or far more than 'expected' towns being made as cities.

While this is the point of randomness, the wording of the setting is "Proporation of towns that will become cities: 1 in X" and does not mention randomness at all.
2024-09-22 14:42:01 +01:00
Tyler TrahanandGitHub ad020759c7 Feature: Import town data from JSON file (#10409) 2024-09-16 09:29:10 -04:00
Peter NelsonandGitHub 0f0f3d74ca Codefix: Delete PersistentStorage when a town is deleted. (#12903) 2024-08-19 08:18:01 +01:00
Peter NelsonandPeter Nelson 8754846901 Codechange: Allow adding to animated tile list without marking dirty.
This avoids redundant tile refreshes when the caller has already marked a tile dirty, or knows it does not need refreshing.

Loosely backported from JGRPP.
2024-08-13 20:04:44 +01:00
Peter NelsonandGitHub 93eb27d8df Codechange: Use reference for always_accepted output parameter of AddAcceptedCargo. (#12854)
This parameter should always present (see tile_cmd.h:186), so use a reference to ensure it is.
2024-07-10 12:30:14 +01:00
Tyler Trahan 5ed2fcfb53 Change: Don't use house construction states in Scenario Editor 2024-06-26 16:27:02 -04:00
Tyler Trahan 06bd47af4f Revert d8771b3: Construction stage wrong for all houses 2024-06-26 16:27:02 -04:00
Jonathan G Rennisonandrubidium42 9c84e5df3f Add: Road waypoint functionality 2024-06-24 22:12:08 +02:00
Björn WärmedalandGitHub e0bcb54a4b Change: Allow bribing local authority when other company has exclusive rights (#12763) 2024-06-22 07:51:03 -04:00
Tyler TrahanandGitHub d8771b3f68 Change: Don't use house construction states in Scenario Editor (#12730) 2024-06-15 17:11:00 -04:00
Peter NelsonandGitHub 6d2424c0ef Codechange: Update each town label dimensions once during map gen. (#12742)
This avoids re-layouting the label for each change in population as the town is grown.
2024-06-01 16:57:17 +01:00
Peter NelsonandGitHub d1b7619822 Change: Ignore min/max years for manual house placer. (#12687) 2024-05-15 23:17:58 +01:00
Peter NelsonandPeter Nelson ed67aedabf Feature: Allow manually placing town buildings in scenario editor.
House picker is accessed from the Landscaping toolbar as there is no town toolbar.

Once placed these houses behave like any other and can be removed by players and towns.

Uses the unified picker system, so also supports used/saved favourites. As town building don't have class labels, town zones are use to imitate them.
2024-05-14 21:11:48 +01:00
Peter NelsonandPeter Nelson d99c1337a2 Add: Command to build an individual house on a specific tile. 2024-05-14 21:11:48 +01:00
Peter NelsonandPeter Nelson f901722066 Codechange: Rename BuildTownHouse to TryBuildTownHouse. 2024-05-14 21:11:48 +01:00
Peter NelsonandPeter Nelson 40fa45a76a Codechange: Emplace std::pair into vectors.
This creates the pair in the vector, instead of creating it then copying it in.
2024-04-20 10:25:20 +01:00
Peter NelsonandPeter Nelson fe7bd3a266 Codechange: Use std::array for cached town zone radius. 2024-04-18 22:13:55 +01:00
Peter NelsonandGitHub 48eb9b8bc9 Add: Check that towns can build roads before generating map. (#12503) 2024-04-16 15:25:07 +00:00
Rubidiumandrubidium42 4e6d4fcf32 Codechange: replace for loops with endof with range-based for loops 2024-04-08 07:00:55 +02:00
Peter NelsonandPeter Nelson 9854553e10 Codechange: ZOOM_LVL_SHIFT/BASE are not actually ZOOM_LVLs.
Rename to ZOOM_BASE_SHIFT and ZOOM_BASE respectively, and derive from ZOOM_LVL instead of numeric value.
2024-04-04 22:27:03 +01:00
Peter NelsonandMichael Lutz e16b982b6a Codechange: Use iteration when dealing with all HouseSpecs. 2024-03-28 23:23:00 +01:00
Peter NelsonandMichael Lutz 3e83dcedfd Codechange: Allocate houses dynamically instead of from a fixed array.
This uses vectors for HouseSpecs and global/town building counts.
2024-03-28 23:23:00 +01:00
Patric StoutandGitHub a3cfd23cf9 Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Rubidiumandrubidium42 27eadc13ec Codechange: rename TILE_ADD(XY) to TileAdd(XY) 2024-03-10 15:50:24 +01:00
Rubidiumandrubidium42 bab5a8a787 Codechange: use std::source_location over __FILE__ and __LINE__ for Backup 2024-03-10 10:14:20 +01:00
Michael Lutz 8dda387f82 Codechange: Use std::tuple for slope functions with two return values 2024-03-08 18:08:55 +01:00
Peter NelsonandGitHub 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 NelsonandGitHub 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.
2024-02-03 13:58:31 +00:00
froschandfrosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
Peter NelsonandPeter Nelson 6d93fa649c Change: Towns generate cargo based on town production effect.
This replaces the fixed handling of passengers and mail.
2024-02-02 20:37:49 +00:00
Peter NelsonandPeter Nelson 60dcf3b5e2 Codechange: Rename TownEffect to TownAcceptanceEffect.
This makes it clearer that TownEffect only affects acceptance behaviour.
2024-02-02 20:37:49 +00:00
merni-nsandGitHub ccaa383e85 Fix #11938: Check infinite money setting in cases where it was missed (#11939) 2024-01-31 20:11:48 +01:00
Tyler TrahanandGitHub 41f2eed425 Feature: Settings to scale cargo production of towns and industries (#10606) 2024-01-30 15:11:46 -05:00
merni-nsandGitHub 5a88027a19 Feature: Infinite money mode (#11902) 2024-01-30 18:01:02 +00:00
Peter NelsonandGitHub bf013097a7 Fix #11918: Houses should build only next to road stops, not any station type. (#11919) 2024-01-29 01:27:34 +00:00
froschandfrosch 68c64d2511 Codechange: Remove TKM string codes by duplicating strings. 2024-01-28 14:44:24 +01:00
Tyler TrahanandGitHub 735abfe111 Codechange: Split dates and timers into Economy and Calendar time (#10700) 2024-01-22 09:04:34 -05:00
SamuXarickandrubidium42 fddcaef74a Codechange: Use town zone constants instead of magic numbers 2023-12-18 22:12:43 +01:00
Jonathan G Rennisonandrubidium42 8437b20fed Fix: Deleting towns did not check for waypoints referencing the town 2023-11-29 00:27:16 +01:00
Tyler Trahan 4181d3c1ff Codechange: Don't use a magic number for the number of DiagDirections 2023-11-28 14:24:33 -05:00
Tyler Trahan 2dad9263d7 Doc: Add, fix, and clean up documentation inside town_cmd.cpp 2023-11-28 14:24:33 -05:00
Tyler Trahan 745945c4d3 Codechange: Be consistent with how we name common parameters
TileIndex is always tile and Town is always *t. Don't use t and *town.
2023-11-28 14:24:33 -05:00