Peter Nelson
b55af05626
Codechange: Pass encoded script strings as EncodedString.
...
This removes the ambiguity of having std::strings that may or may not be encoded.
2025-03-04 21:40:39 +00:00
Peter Nelson
154896ce55
Codechange: Use GetString() with local parameters in script functions. ( #13585 )
2025-02-16 21:27:25 +00:00
Rubidium
fd4adc55e3
Codechange: replace INVALID_X with XID::Invalid() for PoolIDs
2025-02-16 20:23:00 +01:00
Rubidium
4cda9f900d
Codechange: [Script] Use helper function over direct casting CompanyID
...
In the script's API `COMPANY_INVALID` has a value of -1, whereas the internal
game's `INVALID_COMPANY` has a value of 255. Since the script's API also has
a `COMPANY_SPECTATOR` with a value of 255, these enumerations cannot be easily
reconciled by casting. As such, replace all casts in the script API with
either ScriptCompany::FromScriptCompanyID or ScriptCompany::ToScriptCompanyID.
Also make clear whether CompanyID is ::CompanyID or ScriptCompany::CompanyID
by using either one of those over CompanyID in the script's API.
2025-02-08 23:42:19 +01:00
Peter Nelson
50b384032d
Codechange: Use EnumBitSet for IndustryControlFlags.
2025-02-07 22:01:59 +00:00
Peter Nelson
2bb3f368e3
Codechange: Use EnumBitSet for IndustryBehaviours.
2025-02-07 12:30:06 +00:00
Rubidium
e894a5880c
Codechange: rename CargoID to CargoType and amend related variables/comments
2025-01-26 18:07:10 +01:00
Loïc Guilloux
46f181c8a6
Fix #13299 : Merge IT_INVALID and INVALID_INDUSTRYTYPE ( #13300 )
...
* Fix #13299 : Merge IT_INVALID and INVALID_INDUSTRYTYPE
* Codefix: Use NUM_INDUSTRYTILES where it's intended
2025-01-10 01:17:11 +01:00
Peter 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
Peter Nelson
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
Patric Stout
a3cfd23cf9
Codechange: rename byte to uint8_t ( #12308 )
2024-03-16 23:59:32 +01: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
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
299570b2c1
Codechange: make TimerGameCalendar Date and Year types strongly typed ( #10761 )
2023-08-12 18:14:21 +00:00
Andy
ce9305a5ee
Add: [Script] GSIndustry.GetConstructionDate() method ( #11145 )
2023-07-20 20:35:37 +02:00
PeterN
d086f288cd
Codechange: Remove duplicated includes. ( #10888 )
...
These are now included by stdafx.h so don't need to be included again.
2023-05-29 14:29:00 +01: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
633f19419d
Codechange: Make more use of GetCargoAccepted/ProducedIndex().
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
Rubidium
bbcb55ebc9
Codechange: use std::string as script API return type
2023-05-14 22:54:10 +02:00
Tyler Trahan
930f0a16d8
Codechange: Define Date/Year/Month/Day within TimerGameCalendar class
2023-04-26 07:14:03 -04:00
Rubidium
717f79ff22
Add: deity mode enforcement checks to functions with command or company access
...
Command functions are those that call ScriptObject::Command, and functions
with company access are any that call ScriptObject::GetCompany. This is a bit
over-protective, but having the check everywhere makes it easier to validate
that no check is missing automatically instead of by review.
2023-03-08 22:33:47 +01:00
Rubidium
83946ca31d
Codechange: use GSCompanyMode::IsValid, IsDeity, and the precondition helpers
...
Direct 1:1 replacements in the code, and comments now refer to either
GSCompanyMode::IsValid or GSCompanyMode::IsDeity instead of several variations
on "company mode active" or "no company mode active".
2023-03-06 22:34:09 +01:00
glx22
6671994655
Codechange: Use SQInteger for generic numbers in script_industry
2023-03-06 00:32:12 +01:00
glx22
3559576166
Codechange: [Script] Don't expose static buffers outside of ScriptText
2023-02-17 21:28:14 +01:00
dP
fe2c8a1240
Codechange: Decouple INDUSTRY_CTRL into separate commands ( #10475 )
2023-02-14 11:29:11 +01:00
Michael Lutz
58cff7b081
Codechange: Un-bitstuff the remaining on-map commands.
2021-12-16 22:28:32 +01:00
Michael Lutz
6691ee3b96
Codechange: Template script command calls.
2021-12-16 22:28:32 +01:00
glx22
38c97e1492
Codechange: Replace TILE_AREA_LOOP with range-based for loops
2021-05-13 00:13:54 +02:00
dP
bab7de6cf2
Feature: Allow GameScripts to add additional text to Industry view window
2021-01-22 09:50:53 +00:00
Pavel Stupnikov
9a45a0f535
Feature: Set exclusive access to industry from GS ( #8115 )
2020-12-22 14:29:48 +01:00
Niels Martin Hansen
b7751c483e
Feature: Influence industry production changes from GS ( #7912 )
2020-12-22 14:21:31 +01:00
S. D. Cloudt
13cc8a0cee
Cleanup: Removed SVN headers
2019-11-10 17:59:20 +00:00
Henry Wilson
7c8e7c6b6e
Codechange: Use null pointer literal instead of the NULL macro
2019-04-10 23:22:20 +02:00
Peter Nelson
8b1b3fd0f9
Feature: Non-rectangular sparse station catchment area.
2019-03-09 16:33:47 +00:00
peter1138
ed6084523d
Codechange: Convert StationList from SmallVector to std::set.
2019-03-09 16:33:47 +00:00
rubidium
0463dbdc9e
(svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values
2014-04-23 20:13:33 +00:00
rubidium
4479f90843
(svn r23777) -Codechange: refactor allocating memory and fetching strings into a single function for scripts
2012-01-08 21:48:05 +00:00
truebrain
98103121d4
(svn r23355) -Codechange: rename all AI* to Script* (Rubidium)
2011-11-29 23:15:35 +00:00
truebrain
afdb67a353
(svn r23354) -Codechange: move all src/ai/api/ai_*.[hc]pp files to src/script/api/script_* (Rubidium)
2011-11-29 23:07:38 +00:00