Commit Graph
772 Commits
Author SHA1 Message Date
Loïc GuillouxandGitHub d840152cb7 Codefix: [Script] incorrect end of class detection for doxygen (#13204) 2024-12-28 18:15:09 +00:00
Yakov LipkovichandGitHub be02b54744 Doc: fix typo in script_vehicle.hpp (#13177) 2024-12-20 08:42:57 -05:00
rubidium42andrubidium42 ef76f0e758 Codechange: use default virtual destructors over empty destructors 2024-12-06 22:30:19 +10:00
Peter NelsonandPeter Nelson 3be0166801 Codechange: Use std::ranges::find where possible.
Replace `std::find(range.begin(), range.end(), ...)` with `std::ranges::find(range, ...)`.
2024-11-24 10:36:03 +00:00
Loïc GuillouxandGitHub 681b1928b4 Fix #13110: [Script] convert table keys to string when generating JSON (#13113) 2024-11-23 13:46:33 +01:00
Peter NelsonandPeter Nelson 653e5e8b63 Codechange: Use std::visit for formatting script strings. 2024-11-23 10:55:41 +00:00
Peter NelsonandPeter Nelson d875ac8947 Add: const operator->() for ScirptObjectRef. 2024-11-23 10:55:41 +00:00
Peter NelsonandGitHub 6d3adc6169 Codechange: Remove ZeroedMemoryAllocator from ScriptText. (#13108)
ScriptText is much simplified from its original design. Use member initialisation instead.
2024-11-20 22:16:14 +00:00
Rubidiumandrubidium42 ea6aa4653a Codechange: replace magic numbers with enumeration 2024-10-25 18:37:11 +02:00
Rubidiumandrubidium42 4a4c77ff04 Codechange: use functions described in documentation, instead of related other functions 2024-10-25 18:37:11 +02:00
Rubidiumandrubidium42 c9819f8957 Codechange: split GetRoadDir as bays have DiagDir and drive throughs have Axis 2024-10-24 20:40:32 +02:00
Peter NelsonandGitHub 147ac56f11 Fix: ScriptTile::PlantTreeRectangle does not check that the end tile is in bounds. (#13004)
If the starting tile is near the edge of the map, the width and height could overflow the map boundary.

In some cases this might result in a different area being planted than expected.
2024-10-19 20:52:02 +01:00
Peter NelsonandPeter Nelson 8360fab18a Codechange: Remove CCountedPtr.
This was originally generic and used by YAPF, but now it is used only by script objects.

CCountedPtr provided much more (untested) functionality than used.

ScriptObjectRef already exists for script objects and does the same thing, so use this instead.
2024-10-16 21:52:00 +01:00
Loïc GuillouxandGitHub d67963e616 Add: [Script] Include number of victims in ScriptEventVehicleCrashed (#12861) 2024-07-16 21:28:29 +02:00
Jonathan G Rennisonandrubidium42 9c84e5df3f Add: Road waypoint functionality 2024-06-24 22:12:08 +02:00
Peter NelsonandGitHub 731c56d116 Codefix: Add missing const inside script functions. (#12794)
Scripts do not modify items directly, marking them const enforces this.
2024-06-17 07:19:56 +01:00
Peter NelsonandPeter Nelson d5671030b1 Codechange: Add NewGRFSpecsBase class to hold class/index information.
Standardises how the class index is stored in the spec, instead of relying ot the Spec structs having the same members.

This allows retrieving class_index and index without searching or using pointer arithmetic.

'cls_id' is renamed to 'class_index' to make it clearer that it is an index rather than the multichar label of the class.
2024-05-11 02:12:41 +01:00
froschandPeter Nelson dc22edc556 Doc: [Script] Extend API documentation on calendar- vs economy-time 2024-05-10 13:17:19 +01:00
froschandPeter Nelson 04cc0c8125 Codechange: [Script] Document relation between ScriptErrorType and ErrorMessages enums 2024-05-10 13:17:19 +01:00
froschandPeter Nelson 40e6230900 Codechange: Add main page to script API documentation 2024-05-10 13:17:19 +01:00
froschandPeter Nelson dfa2622153 Codechange: Unify naming of squirrel built-in types in Script API docs 2024-05-10 13:17:19 +01:00
froschandPeter Nelson e436e2ef40 Codefix: broken links and syntax issues in script API documentation 2024-05-10 13:17:19 +01:00
froschandPeter Nelson 64e1f1d4d9 Codefix: Script API documentation about IDs was incomplete 2024-05-10 13:17:19 +01:00
froschandPeter Nelson 4bf2dc3148 Codefix: Script API did not link simple types correctly 2024-05-10 13:17:19 +01:00
froschandPeter Nelson c1375cecf8 Codefix: [Script] script_types was excluded from API documentation 2024-05-10 13:17:19 +01:00
froschandPeter Nelson ffe76a0133 Update: Doxyfiles to doxygen 1.9.4 2024-05-10 13:17:19 +01:00
Peter NelsonandGitHub cf96d49ced Codechange: Use vector for airport tile layouts. (#12607)
Simplify AirportSpec data by storing layout information together in a vector, instead of separate arrays.

This removes manual memory management and separate count members.

The default layouts will be copied instead of always referring to the originals.
2024-05-02 11:37:54 +00:00
a28ab8cac2 Codechange: Replace C-style casts to size_t with static_cast. (#12455)
* Codechange: Replace C-style casts to size_t with static_cast.

This touches only simple value-type casts.

* Codechange: Replace static_cast<size_t>(-1) with SIZE_MAX

Co-authored-by: Rubidium <rubidium@openttd.org>
2024-04-19 20:34:36 +01:00
froschandGitHub 907cb4fc53 Fix: [Script] ScriptSubsidy::GetExpireDate should return an economy-date (#12372) 2024-03-28 23:21:20 +01:00
glx22andLoïc Guilloux 02c00f3e3e Change: [Script] Use economy time for ScriptDate 2024-03-23 21:17:40 +01:00
glx22andLoïc Guilloux 704e871a0e Revert bbdbf9a: ScriptTimeMode was not the best solution for economy/calendar support 2024-03-23 21:17:40 +01:00
Peter NelsonandGitHub ea74ca0a76 Fix #12347: Crash attempting to find catchment tiles of a station with no catchment area. (#12348) 2024-03-23 13:03:59 +01:00
Patric StoutandGitHub a3cfd23cf9 Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
glx22andLoïc Guilloux 3a71f36393 Change: [Script] Match FormatString behaviour more closely 2024-03-09 12:15:03 +01:00
glx22andLoïc Guilloux ae27ce12a7 Fix 0858377: [Script] Don't output parameters more than once 2024-03-09 12:15:03 +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 GuillouxandGitHub 845b894fd8 Remove: [Script] random_deviation from setting description table (#12221) 2024-03-05 12:41:04 +01:00
Loïc GuillouxandGitHub f612bc6ee2 Fix bf4b6696: [Script] Broken ScriptText circular reference detection (#12187) 2024-02-27 18:16:21 +01:00
Rubidiumandrubidium42 a4d4301a0c Codechange: We are heading to 15 2024-02-18 21:48:54 +01: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
Loïc GuillouxandGitHub b0f3417025 Add: [Script] ScriptTileList_StationCoverage (#12015) 2024-02-06 20:22:18 +01:00
Loïc GuillouxandGitHub 0858377e9e Fix: [Script] Don't kill GS misusing GSText (#12009) 2024-02-06 19:58:30 +01:00
merni-nsandGitHub 34b05465d5 Fix 5a88027: [Script] Avoid overflow in scripts when infinite money is enabled (#12016) 2024-02-06 19:54:38 +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
Patric StoutandGitHub 849fd5ae03 Change: [Script] replace easy/medium/hard values with default value (#11959) 2024-02-03 09:15:03 +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 60dcf3b5e2 Codechange: Rename TownEffect to TownAcceptanceEffect.
This makes it clearer that TownEffect only affects acceptance behaviour.
2024-02-02 20:37:49 +00:00
Loïc GuillouxandGitHub 4e26e33805 Change: Improve ScriptSettings windows (#11958) 2024-02-02 18:08:05 +00:00
Loïc GuillouxandGitHub 3545decf2d Cleanup e28edf6945: [Script] Left over CONFIG_RANDOM reference in documentation (#11954) 2024-02-02 14:28:02 +00:00