Commit Graph
100 Commits
Author SHA1 Message Date
SamuXarickandGitHub 4310d7c7f5 Fix: [Script] Only run the Game::GameLoop() in-game (#13896) 2025-04-04 17:29:48 +02:00
SamuXarickandGitHub f6b0f7848b Add: [Script] Newer Cargo Classes (#13779) 2025-03-15 16:51:56 +01:00
SamuXarickandGitHub 05ce0828c0 Change: Use max of calculated and minimal heights in ScriptLeagueWindow (#13720) 2025-03-13 08:39:26 +00:00
SamuXarickandGitHub af32ce3710 Cleanup: Remove unused member in ScriptDebugWindow (#13664) 2025-02-27 14:17:31 +01:00
SamuXarickandGitHub 718a45b845 Fix 11a8b71: Set direction and rotation of ships upon building (#13625) 2025-02-22 23:33:25 +00:00
SamuXarickandGitHub 847fbe3348 Fix: [Script] Set DummyAI Api version to last available (#13610) 2025-02-22 12:58:29 +01:00
SamuXarickandGitHub adc79aca09 Codechange: Refactor AllocHeightMap to return void since it always returns true (#13379) 2025-02-04 18:52:52 +00:00
SamuXarickandrubidium42 f5d43ffdf8 Change: [Script] GetWaypointID to return the StationID of any waypoint
Modified ScriptWaypoint::GetWaypointID to also return the StationID of any waypoint (including road waypoint).
2025-02-03 08:41:59 +01:00
SamuXarickandGitHub a4d23c072d Fix 95df7ea: Incorrect WindowClasses for deduplicated window descs. (#13412) 2025-01-30 18:51:09 +00:00
SamuXarickandGitHub 05b9b8765c Codefix 60d0d7b: Incorrect variable in TGP noise calculation (#13350) 2025-01-21 16:41:38 +00:00
SamuXarickandrubidium42 60d0d7b8b2 Codechange: Lowercase variable names and use _ separator 2025-01-20 21:41:03 +01:00
SamuXarickandrubidium42 62002c6eae Doc: Standardize map size notation and multiply operator 2025-01-20 21:40:49 +01:00
SamuXarickandrubidium42 9bf882b3f7 Doc: Change MapSize to Map::Size 2025-01-20 21:40:49 +01:00
SamuXarickandGitHub 9a3b656a62 Codechange: Capitalise static consts (#13342) 2025-01-19 23:58:21 +00:00
SamuXarickandGitHub 40a29a71fb Cleanup: Remove pointless DiagDirection array (#13338) 2025-01-19 21:38:32 +00:00
SamuXarickandrubidium42 b0ec3d6959 Cleanup: Missing TileDiffXY conversion in GenerateTerrain 2025-01-19 19:14:44 +01:00
SamuXarickandKuhnovic 610026ef17 Fix: Missing water region invalidation after flooding a half tile with rail in the highest corner
Invalidate water region when any flood occurs.
Convert a few magic numbers to their names.
2025-01-17 18:13:51 +01:00
SamuXarickandGitHub 4018179d7b Cleanup: Remove unused includes and function (#13321) 2025-01-15 14:50:14 +01:00
SamuXarickandGitHub d74255a3ec Codechange: Optimize FlowsDown (#13262) 2025-01-10 11:18:54 -05:00
SamuXarickandrubidium42 bf02cb014b Codefix: Replace C style cast with C++ style static_cast for type safety 2025-01-05 15:17:40 +01:00
SamuXarickandGitHub e543768570 Cleanup: Tidy up variables in River_FoundEndNode (#13276) 2025-01-04 21:39:07 +01:00
SamuXarickandGitHub 59a45cc852 Codefix 6222ced: Rename variables to adhere to codestyle (#13255) 2025-01-03 12:20:09 -05:00
SamuXarickandGitHub b91f8c13b8 Codechange: Remove macros and use direct methods instead (#13257) 2025-01-03 17:13:41 +00:00
SamuXarickandrubidium42 6222cedcc1 Codefix: Rename variables to adhere codestyle 2025-01-03 13:54:46 +01:00
SamuXarickandKuhnovic ee860a5c8e Doc: Update some yapf inline comments 2024-12-24 20:43:46 +01:00
SamuXarickandGitHub 90a8d7a953 Doc: Missing closing span tags in landscape_grid (#13056) 2024-12-23 17:39:55 +01:00
SamuXarickandrubidium42 8e948af3bc Codefix: Ensure assertions are properly encapsulated within WITH_ASSERT directive 2024-12-22 14:02:13 +01:00
SamuXarickandrubidium42 de908e08b2 Codefix: Remove duplicated include 2024-12-22 14:01:40 +01:00
SamuXarickandGitHub 1e259b7f47 Codefix: Missing this-> in Kdtree (#13095) 2024-12-10 17:30:55 +00:00
SamuXarickandrubidium42 005c47c322 Codechange: Use Map::Iterate() on CreateDesertOrRainForest routine 2024-12-06 10:33:11 +10:00
SamuXarickandrubidium42 913d6eceb0 Codechange: Use Map::Iterate() on waypoint conversion
Still maintains the same logic as before when determining valid and invalid waypoints.
2024-12-06 10:33:11 +10:00
SamuXarickandrubidium42 7d0b1cd002 Codechange: Replace while loop with Map::Iterate() 2024-12-06 10:33:11 +10:00
SamuXarickandrubidium42 10e2d1ca36 Codechange: Use Map::Iterate() to iterate tiles 2024-12-06 10:33:11 +10:00
SamuXarickandGitHub cf7710fb61 Codechange 8e9603b: Replace int32_t with AyStarStatus (#13127) 2024-11-27 23:26:07 +00:00
SamuXarickandGitHub 8e9603bd33 Codechange: Rename and return AyStarStatus instead of int (#13125)
- Rename enum AystarStatus to AyStarStatus.
- Return AyStarStatus instead of int for AyStar::Main and AyStar::Loop functions.
2024-11-27 00:10:06 +01:00
SamuXarickandGitHub 85e9f5745a Codefix: Replace magic number in Kdtree (#13098) 2024-11-19 20:34:25 +00:00
SamuXarickandGitHub 60ae50e016 Codechange: Make kdtree member functions const for const-correctness (#13099) 2024-11-19 12:36:56 +00:00
SamuXarickandGitHub a96a83e330 Codechange: Code style issues in water regions (#13019) 2024-10-28 10:29:26 -04:00
SamuXarickandGitHub a86f9dba0f Codefix: Correct handling of GetDepotOrderType() comparison (#13023)
In the function where we check the depot order type, using `!=` with GetDepotOrderType() is not ideal because the function can return flag bits.
2024-10-27 18:47:22 +01:00
SamuXarickandGitHub d5a13fb9f4 Codechange: Use TileOffsByAxis(...) in more places (#13026) 2024-10-24 15:58:15 -04:00
SamuXarickandGitHub f845b4bbc3 Fix: Changing NPF max search nodes while in-game had no effect (#12194) 2024-03-25 17:28:16 +01:00
SamuXarickandKuhnovic d7c5e9e8ab Codechange: Where the ship comes from is already known
This simplifies the handling of variables.

`ChooseShipTrack` is called upon entering `tile`, and looking further back to the caller, it can be deduced that `v->tile` matches `src_tile`. With that said, `enterdir` can also be removed, as it's not used anywhere else.

`CreateRandomPath` and `GetRandomFollowUpTrackdir` is being fed `src_tile` as it's 2nd parameter. This could be eliminated, as `v` is also being passed to it. Just use `v->tile` in those functions.
2024-03-16 17:02:19 +01:00
SamuXarickandKuhnovic a7625b8ae0 Fix #12280: Allow ships 90 degree turns if only choice
If there is no path found, a random path is created which forbids 90 degrees.
Allow 90 degrees if they're the only choice.
2024-03-15 08:04:08 +01:00
SamuXarickandGitHub 14d95ef1c9 Fix #12279: Update random path each step (#12286) 2024-03-13 11:22:52 -04:00
SamuXarickandPatric Stout 0c432bdc4d Fix 3947453: GetNextDecisionNode ignored go to nearest depot when combined with stop at depot 2024-03-08 14:31:35 +01:00
SamuXarickandPatric Stout ab52f7eecf Fix ccb4c37: Aircraft could route to hangars outside their range when stopping at them 2024-03-08 14:31:35 +01:00
SamuXarickandGitHub b22fb43cea Fix #10490: Allow ships to exit depots if another is not moving at the exit point (#12161) 2024-02-23 08:08:16 -05:00
SamuXarickandGitHub 8584d1b5bb Add: [Script] GetAirportNumHelipads (#12085)
Adds a function for Scripts to get the number of helipads of an airport type.
2024-02-14 21:38:32 +01:00
SamuXarickandGitHub fa64fff4a5 Fix #10405, a3dd750: [Script] Test engine and vehicle type validity for ScriptGroup::GetNumEngines (#11887) 2024-02-11 22:09:23 +01:00
SamuXarickandGitHub 0c4e509b60 Fix #10439: [GS] Validate story page button colour, flags, cursor and vehicle type (#11892)
Adds GSStoryPage::IsValidStoryPageButtonColour, GSStoryPage::IsValidStoryPageButtonFlags and GSStoryPage::IsValidStoryPageButtonCursor to the API.

Add missing enforced preconditions to validate parameters passed to MakePushButtonReference, MakeTileButtonReference and MakeVehicleButtonReference.
2024-01-28 00:29:10 +01:00
SamuXarickandGitHub 76f0f9e386 Fix #10438: [GS] Validate story page element type for ScriptStoryPage::NewElement (#11888)
Fixes a crash that happens if an invalid StoryPageElementType is passed to ScriptStoryPage::NewElement.

Adds an enforced precondition that tests the validity of StoryPageElementType.

Adds GSStoryPage::IsValidStoryPageElementType to the API.
2024-01-27 22:11:02 +01:00
SamuXarickandrubidium42 6588680ccc Revert #6923: start_date parameter is no longer in use
There was an issue with the start_date parameter for AIs. It did not let Random AIs to have their configure button clickable once the game has started, and this was due to the start_date not being pushed into the config.

But now that start_date is no longer in use since #10653, this workaround can be safely removed.
2024-01-21 18:49:08 +01:00
SamuXarickandGitHub 847f3f660d Fix #10511: Delay 'go to nearest depot' orders (#11548)
Delay the nearest depot order search for a day if the vehicle can't find its destination, which happens when it has already attempted to do so and failed to find a valid destination.
2024-01-05 21:23:01 +00:00
SamuXarickandGitHub 947e77267a Doc 0ca4b4e: Script debug window numbers are now ascending (#11623) 2023-12-25 18:42:29 +01:00
SamuXarickandrubidium42 fddcaef74a Codechange: Use town zone constants instead of magic numbers 2023-12-18 22:12:43 +01:00
SamuXarickandGitHub c05ffb22bd Fix #10452: Don't let AyStar max_search_nodes unattended when initializing (#11544)
Add a constant with the default value of 10000 and have the pathfinding settings refer to it.

Add a preventative method to AyStar when it's initializing, to limit the number of max_search_nodes if left unattended.
2023-12-17 22:50:53 +01:00
SamuXarickandGitHub a3d56e2c6e Fix: Prevent overflow when calculating max town noise (#11564)
Max town noise could overflow if the population was high enough. The value is now clamped.
2023-12-10 15:42:55 +00:00
SamuXarickandrubidium42 f8b5661d28 Change: Allow GS access to ScriptGroup functions 2023-04-17 17:59:16 +02:00
SamuXarickandrubidium42 f225f36c3d Change: Allow GS access to ScriptGameSettings.IsDisabledVehicleType 2023-04-17 17:59:16 +02:00
SamuXarickandrubidium42 fd26a44c9e Change: Allow GS access to more ScriptCompany functions 2023-04-17 17:59:16 +02:00
SamuXarickandrubidium42 6eabbaa751 Fix #10469, 5e14a20: [Script] League Table rating element is a int64 everywhere else 2023-02-26 22:25:13 +01:00
SamuXarickandrubidium42 b52b29b1a4 Change: Avoid crashing to the side of a train
When a road vehicle is already running on a multi level crossing, and a train shows up ahead, don't make the road vehicle crash on the side of the train.
2023-02-22 20:09:02 +01:00
SamuXarickandLoïc Guilloux 8351b97f52 Add: [Script] Labels for negative values of a setting 2023-02-21 00:28:21 +01:00
SamuXarickandLoïc Guilloux 376820c0b6 Doc: [Script] Update info descriptions 2023-02-21 00:28:21 +01:00
SamuXarickandLoïc Guilloux bb2ac8b3c4 Fix: [Script] Save config item values up to 10 digits + 1 for sign + 1 for termination, enough to fit min and max int 2023-02-21 00:28:21 +01:00
SamuXarickandLoïc Guilloux fde7028a95 Fix #10059: [Script] Let custom values on a config item be up to 10 digits + 1 for sign 2023-02-21 00:28:21 +01:00
SamuXarickandLoïc Guilloux 7b1fd3e37f Fix #10059: [Script] Clamp config item values to int32
Also prevent random_deviation to be below 0.
2023-02-21 00:28:21 +01:00
SamuXarickandrubidium42 3df9321a65 Fix: Some Script::IsValidVehicle checks need to be complemented with IsPrimaryVehicle
Add: [Script] ScriptVehicle.IsPrimaryVehicle
2023-02-18 09:58:02 +01:00
SamuXarickandrubidium42 231935fccd Change: Show buy company dialog window even when playing in the AI company 2023-02-11 09:43:47 +01:00
SamuXarickandrubidium42 43ce73db86 Fix: [Script] Use Money instead of int32 for presenting the value of a company to AIs 2023-02-11 09:43:47 +01:00
SamuXarickandGitHub 1f194eb94e Fix: [Script] Incorrect value for GOAL_INVALID (#10436)
* Fix: [Script] Incorrect value for GOAL_INVALID

* Cleanup: Remove unused static variable
2023-02-01 23:35:51 +01:00
SamuXarickandrubidium42 d0639cdc28 Fix: [Script] Incorrect subsidy SourceID value used 2023-02-01 21:17:16 +01:00
SamuXarickandrubidium42 4fc4874a30 Add: [Script] Let random road layout be a choice 2023-02-01 21:15:13 +01:00
SamuXarickandGitHub 184ff92057 Cleanup: [Script] Pass new_rating directly to CmdTownRating (#10441) 2023-02-01 13:48:39 -05:00
SamuXarickandGitHub df89c34e03 Fix 7e1e275: Measure AI Collect Garbage performance (#9924) 2023-01-28 20:18:28 +01:00
SamuXarickandGitHub 46dc6da270 Codechange: Make void tiles flood edge tiles, instead of edge tiles flooding themselves (#8517) 2023-01-26 21:57:25 +01:00
SamuXarickandGitHub b2a5ebcfc4 Fix 3c047b1: AIGroup.GetProfitLastYear could get values different than those displayed in GUI (#10227)
* Change: Store "all time" and "since minimum age" last year profits on groups

* Fix: Update last year profit for groups when copying vehicle statistics on autoreplace

* Codechange: Refactor profit last year

* Change: Rename some group related items for clarity

* Change: Reorder the fields in GroupStatistics

That way less memory gets wasted.
2023-01-22 08:14:02 -05:00
SamuXarickandGitHub 96ec9908a0 Codechange: refactor removal of desert around river tiles 2023-01-15 00:43:41 +01:00
SamuXarickandGitHub a8a7f95665 Change: Allow to build dock on clearable watered object tiles (#8514) 2022-11-08 21:04:14 +01:00
SamuXarickandGitHub 60ccab3c52 Fix #9908: Close company windows only after all its infrastructure is removed (#9912) 2022-11-08 09:44:17 -05:00
SamuXarickandGitHub b7abaa55a3 Codechange: Improve performance when calculating company value (#9901) 2022-11-08 11:11:24 +00:00
SamuXarickandGitHub 8c4a70e05e Fix: Refresh company window when switching companies (#9910) 2022-11-07 17:54:04 -05:00
SamuXarickandMichael Lutz 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
SamuXarickandMichael Lutz be7db78767 Add: ScriptCargo::GetWeight regression tests 2022-10-16 18:28:28 +02:00
SamuXarickandMichael Lutz 8d0d45c431 Add: ScriptCargo::GetWeight to get cargo weights 2022-10-16 18:28:28 +02:00
SamuXarickandMichael Lutz e604b76d18 Fix: List a max of four share owners instead of three
An AI company may have four different share owners, but the company information window is limited to display a max of three. This commit increases that limit.
2022-10-16 18:27:54 +02:00
SamuXarickandMichael Lutz 3dda8c9bad Fix: ScriptRoad::HasRoadType really check for RoadType
Script::HasRoadType was only checking if the tile had the same RoadTramType as that of the RoadType provided.
Now it really checks RoadType against RoadType.
2022-10-16 18:27:23 +02:00
SamuXarickandMichael Lutz 374f0c7d11 Fix 6fe445e: Removing rail station parts without ctrl pressed was also removing tracks
The behaviour of holding ctrl key is swapped
2022-08-07 10:58:43 +02:00
SamuXarickandGitHub e404d16929 Fix #9591: Update station docking tiles upon placing a water object on a docking tile (#9594) 2021-10-03 12:54:19 +02:00
SamuXarickandGitHub 45edd9f326 Fix: Incorrect error messages on placing water on scenario editor (#9560)
Additionally changes the behaviour of placing sea on sea/river/canal and placing canal/river on canal to (over)build, instead of disallowing it
2021-09-19 23:14:07 +02:00
SamuXarickandGitHub 18247bb3b8 Fix #9521: Don't load at just removed docks that were part of a multi-dock station (#9524) 2021-09-18 13:25:07 +02:00
SamuXarickandPatric Stout b335b0501c Fix: wrong error message when building canals over ship depots / locks
IsTileType() also considers ship depots and locks water. IsWaterTile() does the right thing.
2021-09-18 13:24:49 +02:00
SamuXarickandPatric Stout 6ce74b2a1b Fix: reduce cost of building canals over objects on sea
It is not like we will drain the sea first, to put water back in it after.
Besides, the cost for draining the sea isn't calculated for all other cases either.
2021-09-18 13:24:49 +02:00
SamuXarickandGitHub a57c2b073a Feature: Display icon/text whether vehicle is lost in vehicle (list) window (#9543) 2021-09-14 22:10:00 +02:00
SamuXarickandGitHub 37de878129 Feature: [AI/GS] Missing water related functions and objects (#8390) 2021-09-14 22:06:55 +02:00
SamuXarickandGitHub 120d216b0b Add: [AI] Get the number of vehicles in a given group (#9462) 2021-08-12 21:29:03 +02:00
SamuXarickandGitHub 26f7f592cd Fix #8316: Make sort industries by production and transported with a cargo filter possible (#8468) 2021-08-11 19:25:59 +02:00
SamuXarickandGitHub 76b8343777 Fix #9392: Return a valid value with GetBuildWithRefitCapacity when AIs are maxed out in vehicles (#9393) 2021-08-11 19:21:34 +02:00
SamuXarickandGitHub 003b6a0c85 Fix ea9715d: not all setting values were clamped properly (#9401) 2021-06-28 00:58:54 +02:00
SamuXarickandGitHub 1e6a2163a5 Fix #9358: Don't skip empty files in tar (#9367) 2021-06-18 00:08:49 +02:00