Peter Nelson
9602de474d
Codechange: Use iterators and/or range-for on cargo related loops.
9 months ago
Peter Nelson
49dae08a3b
Codechange: Add missing override specifiers.
9 months ago
frosch
f40816503f
Codechange: Add enum items for dynmically created setting dropdowns.
10 months ago
frosch
b5885295f0
Codechange: Use parameters, which should be used.
10 months ago
frosch
b6c8f301be
Codechange: Silence warnings about intentionally unused parameters.
10 months ago
Rubidium
8ab0936491
Codechange: use parameter pack/folding instead of va_arg macros for widget states
10 months ago
Patric Stout
ba67f39db6
Codechange: vendor the nlohmann-json library ( #11290 )
10 months ago
PeterN
acd7d3c913
Codechange: Rename *Railtype* to *RailType* for consistency. ( #11287 )
10 months ago
Tyler Trahan
701a61c9af
Codechange: Delete date_type.h
10 months ago
Tyler Trahan
77173a6a10
Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes
10 months ago
Tyler Trahan
fca2b37726
Codechange: Move Ticks into their own class
10 months ago
Patric Stout
30172fc037
Codechange: cleanup CargoPacket in terms of variable/function names ( #11278 )
...
Over the years, things got reused and changed, making the current
names somewhat unclear in what they actually mean and do.
10 months ago
Patric Stout
00f13282a9
Codechange: keep how we convert string <-> JSON private ( #11269 )
10 months ago
Patric Stout
5f9b8aaa95
Codechange: [Script] use nlohmann for Squirrel <-> JSON conversion ( #11251 )
10 months ago
Peter Nelson
e8015e497d
Codechange: Use begin/end of nwidget parts of begin/length.
...
This simplifies processing nwidget parts as, unlike the remaining length, the pointer to the end of the list never changes. This is the same principle as we use(d) for tracking end instead of length for C-style strings.
And this removes 160~ instances of the lengthof() macro.
10 months ago
Michael Lutz
0089323542
Add: [Script] Custom news message text for industry SetProductionLevel.
10 months ago
Michael Lutz
1c56991213
Add: [Script] Game script control of industry production level.
10 months ago
Patric Stout
7afd686541
Codechange: add tests for GS <-> AdminPort JSON conversion ( #11252 )
...
While at it, fix a bug where booleans were made integers.
10 months ago
Patric Stout
993e7be707
Fix: [Script] GSAdmin.Send() could generate invalid JSON ( #11250 )
10 months ago
Joan Josep
5e6b5d981f
Codechange: Use existing functions in GetMonthlyInfrastructureCosts. ( #11237 )
10 months ago
Patric Stout
07730584d7
Codechange: make explicit when a TileIndex is cast to its basetype ( #11190 )
...
This prevents people accidentially assigning a TileIndex to a Date
or any other type they shouldn't.
11 months ago
Patric Stout
299570b2c1
Codechange: make TimerGameCalendar Date and Year types strongly typed ( #10761 )
11 months ago
Patric Stout
5fba47b0f7
Codechange: make no assumptions on how the internals of TileIndex work ( #11183 )
...
Basically, avoid ".value", and just cast it to its original type
if you want to retrieve this.
11 months ago
Andy
ce9305a5ee
Add: [Script] GSIndustry.GetConstructionDate() method ( #11145 )
12 months ago
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
12 months ago
Rubidium
18a31cca7c
Codechange: do not make a string valid in place, to then copy it
1 year ago
Rubidium
af9b9327af
Codechange: do not keep local variable for temporary string parameters
1 year ago
Rubidium
78f5d58dc6
Codechange: use std::string without const as return
...
Otherwise some compilers, e.g. MSVC, do not pick up that these are temporaries
and as such it will pass the temporaries to `const std::string &` instead of
the wanted `std::string &&`
1 year ago
PeterN
d42a78f3e8
Codechange: Make DropDownListStringItem preformat and remove other implementations. ( #11063 )
...
Having to choose between DropDownListStringItem, DropDownListCharStringItem, and DropDownListParamStringItem depending on whether to draw a StringID, a raw string, or a StringID with extra parameters was needlessly complex.
Instead, allow passing a StringID or raw string to DropDownListStringItem. This will preformat the StringID into a raw string, and can therefore accept parameters via the normal SetDParam mechanism.
This also means that strings no longer need to be formatted on every draw.
1 year ago
PeterN
2a2443dd01
Feature: Create group of vehicles from manage vehicle list button. ( #10890 )
1 year ago
Loïc Guilloux
1d9bc23525
Fix #10868 : [Script] Handle errors when loading savegame data on stack ( #11029 )
1 year ago
Rubidium
d4c2043294
Codechange: remove a number of unneeded c_str() calls
1 year ago
Loïc Guilloux
1cd49bf5e5
Fix ca1e34c: [Script] Wrong value printed for {RAW_STRING} ( #11011 )
1 year ago
Rubidium
7c37dcb8e3
Fix: do not use {STRING} when {STRING1} or {STRING2} is needed
1 year ago
mrmbernardi
35ef6c1723
Feature: [GS] Goal destination can be updated ( #10817 )
1 year ago
Rubidium
2ae7367024
Codechange: replace StrMakeValidInPlace with StrValid
1 year ago
Rubidium
ca1e34c121
Codechange: use std::string to build ScriptText's encoded text
1 year ago
Rubidium
fbd71a9d72
Codechange: replace C-style string processing with C++-style for the listing callbacks
1 year ago
Patric Stout
3b1407d240
Feature: allow to do a hostile takeover of an AI company (in singleplayer) ( #10914 )
...
With the removal of the share-system, you could no longer make an
AI disappear in a single player game. At least, not without going
into the console.
1 year ago
PeterN
f814c86389
Codechange: Reorganise hotkey initialisation. ( #10951 )
...
Hotkeys are now initialized inline, and use std::vector instead of
separate static C-arrays and std::string instead of char *. The list end
marker is no longer required.
1 year ago
Bernard Teo
2c667b1773
Doc: Fix spelling error in ScriptTileList::RemoveRectangle ( #10937 )
1 year ago
Patric Stout
6b1c38e303
Fix 3effb893: mention GSAsyncMode in changelog ( #10924 )
1 year ago
Jonathan G Rennison
3effb8931c
Add: [Script] GSAsyncMode to set async mode of gamescript commands ( #10913 )
...
In asynchronous mode, don't wait for result of executed command,
just fire-and-forget, and return estimated cost/result
1 year ago
Peter Nelson
2511649938
Codechange: Use window parent association for dropdowns.
...
This replaces the separate window class and number properties, and
allows the window system to close dropdowns automatically.
1 year ago
PeterN
d086f288cd
Codechange: Remove duplicated includes. ( #10888 )
...
These are now included by stdafx.h so don't need to be included again.
1 year ago
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.
1 year ago
Peter Nelson
09408e8e46
Codechange: Add IsCargoAccepted/Produced() helpers.
1 year ago
Peter Nelson
633f19419d
Codechange: Make more use of GetCargoAccepted/ProducedIndex().
1 year ago
Peter Nelson
76516d7f70
Codechange: Use IsValidCargoID/IsValidCargoType.
...
IsValidCargoType() is used only for unmapped IDs.
1 year ago
Rubidium
63d9bb93b8
Codechange: migrate from C-style GetString to C++-style GetString
1 year ago
Rubidium
275ebf4509
Codechange: replace fprintf(<FILE*> with fmt::print(<FILE*>
1 year ago
Rubidium
c518293135
Codechange: replace printf with fmt::print
1 year ago
Rubidium
07860e67e2
Codechange: use fmt::format_to to format the help message
1 year ago
Rubidium
d9a04ba446
Codechange: make the MD5 hash/digest/checksum variables a std::array
1 year ago
Peter Nelson
c38df2d589
Codechange: Use std::map instead of custom SmallMap.
1 year ago
Peter Nelson
83f2ad500e
Codechange: stdarg.h include not needed as cstdarg is included.
1 year ago
Peter Nelson
56085be9bd
Codechange: Move includes for common STL headers to stdafx.
1 year ago
Patric Stout
199e41c762
Codechange: use default dtor instead of empty ( #10826 )
1 year ago
Rubidium
62fda0f505
Codechange: remove manual allocation/free for SQ_instance
1 year ago
Rubidium
f9b5bc7ee6
Cleanup: the need for SQAutoFreePointers has gone
1 year ago
Rubidium
d9e93edc8b
Codechange: replace 'const char *' script API parameters with std::string
1 year ago
Rubidium
b1b578f988
Cleanup: stredup-ing string variant for calling scripts
1 year ago
Rubidium
ab51175db2
Codechange: use std::string for script config
1 year ago
Rubidium
bbcb55ebc9
Codechange: use std::string as script API return type
1 year ago
Rubidium
b24a6bb8f3
Codechange: use std::string for script log calls
1 year ago
Rubidium
77177f7e8b
Add: support for std::string parameters in the script API
1 year ago
Rubidium
98972a0748
Codechange: use C++ strings for constructing script file paths
1 year ago
Rubidium
20ff0bccd7
Codechange: use std::string to store script GUI's break string
1 year ago
Rubidium
48825e1a8e
Codechange: rewrite script string-to-settings conversion to C++
1 year ago
Rubidium
e035705239
Codechange: introduce and use std::string variant of sq_throwerror
1 year ago
Rubidium
3453c03a17
Codechange: use fmt::format to create dummy scripts
1 year ago
Rubidium
9f2fc860ad
Codechange: use std::optional<std::string> for changing the script over char *
1 year ago
Rubidium
0fd9eb0faa
Codechange: use std::string for script info/library finding
1 year ago
Rubidium
a30f7c83bd
Codechange: use std::string for script names to load
1 year ago
Rubidium
9b0123ab66
Codechange: use std::string for script API versions
1 year ago
Rubidium
3d8d99ba11
Add: method to call script functions with std::string
1 year ago
Peter Nelson
531d1ae8bc
Codechange: Use GetScrolled(Row/Item)FromWidget in more places.
...
In many instances the clicked row position is 'manually' calculated
instead of using the GetScrolledRowFromWidget helper function, with
variations on checks. Replace with the two helpers where possible.
1 year ago
Peter Nelson
726d05b22b
Fix: Don't list unavailable road types for game scripts.
1 year ago
Peter Nelson
e6740046ee
Codechange: Use range-for iteration.
1 year ago
Peter Nelson
a8c0d16371
Cleanup: Use std::advance instead of for-loop.
1 year ago
Peter Nelson
68782f951b
Cleanup: Vector supports random access.
1 year ago
Rubidium
1ae7eb1594
Codechange: use std::map over SmallMap and std::string of stredup(char*)
1 year ago
Rubidium
12085d088c
Cleanup: remove obsolete string_compare_type
1 year ago
Rubidium
bc389a86c9
Codechange: use std::string as std::map key, instead of stredup string
1 year ago
Rubidium
72082aa7d3
Codechange: use std::string for getting a script's name
1 year ago
Rubidium
6e3d3c0e7c
Codechange: introduce std::string variant of sq_pushstring
1 year ago
Peter Nelson
bf9caa425b
Change: Units-system can convert from N to kN, don't preconvert.
...
This allows force to passed as is and avoid premature rounding.
The AI function "GetMaxTractiveEffort" still needs to return kN to avoid breaking the API.
1 year ago
Rubidium
68ff3fd062
Change: include fmt.h C++ headers in stdafx.h
...
This to prevent compilation issues between runs with and without precompiled
headers. Also remove the headers from the rest of the code base as they are
not needed there anymore, although they do relatively little harm.
1 year ago
Peter Nelson
6202eae9d5
Codechange: Rely on Scrollbar::SetPosition to clamp.
...
Manually clamping scrollbar bounds before calling `SetPosition()` is doubling up work that the function already does.
1 year ago
Peter Nelson
d2034d9c38
Codechange: Scrollbar methods now accept size_t.
...
This clears up a lot of casts from size_t to int.
1 year ago
Rubidium
fb856e16c1
Codechange: replace some min/clamp constructs to ClampTo
1 year ago
Rubidium
19ec4e8beb
Codechange: replace ClampToI32/U16 with ClampTo<int32_t/uint16_t>
1 year ago
PeterN
b67cf7f94a
Change: Replace ScriptLog data array with std::deque. ( #10770 )
...
Due to cyclic header dependency this requires moving the data types used
by ScriptLog out of the ScriptLog class.
1 year ago
Rubidium
877349c13d
Codechange: use std::string for text file name resolution
1 year ago
Tyler Trahan
6501f84b4a
Codechange: Move calendar date functions inside TimerGameCalendar ( #10753 )
1 year ago
Rubidium
86786a7af6
Codechange: introduce StrEqualsIgnoreCase/StrCompareIgnoreCase to replace strcasecmp
1 year ago
Tyler Trahan
930f0a16d8
Codechange: Define Date/Year/Month/Day within TimerGameCalendar class
1 year ago
Patric Stout
7aa2b9ab0a
Codechange: move all date-related variables inside the timer ( #10706 )
1 year ago
Rubidium
8f24901843
Codechange: replace printf with PRINTF macros by fmt::format for scripts
1 year ago
Rubidium
8b93e45e22
Codechange: use string/fmt instead of printf for squirrel's PRINTFUNC
1 year ago