Commit Graph

202 Commits

Author SHA1 Message Date
Rubidium 552d2f71a2 Codechange: use std::string for script library category 2023-05-14 22:54:10 +02:00
Rubidium 9f2fc860ad Codechange: use std::optional<std::string> for changing the script over char * 2023-05-14 22:54:10 +02:00
Rubidium 0fd9eb0faa Codechange: use std::string for script info/library finding 2023-05-14 22:54:10 +02:00
Rubidium 9b0123ab66 Codechange: use std::string for script API versions 2023-05-14 22:54:10 +02:00
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.
2023-05-12 21:45:32 +01:00
Peter Nelson 68782f951b Cleanup: Vector supports random access. 2023-05-11 07:58:55 +01:00
Rubidium 1ae7eb1594 Codechange: use std::map over SmallMap and std::string of stredup(char*) 2023-05-09 23:14:48 +02:00
Rubidium 12085d088c Cleanup: remove obsolete string_compare_type 2023-05-09 23:14:48 +02:00
Rubidium bc389a86c9 Codechange: use std::string as std::map key, instead of stredup string 2023-05-09 23:14:48 +02:00
Rubidium 72082aa7d3 Codechange: use std::string for getting a script's name 2023-05-09 23:14:48 +02:00
Rubidium 6e3d3c0e7c Codechange: introduce std::string variant of sq_pushstring 2023-05-09 23:14:48 +02:00
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.
2023-05-08 16:49:23 +02:00
Peter Nelson d2034d9c38 Codechange: Scrollbar methods now accept size_t.
This clears up a lot of casts from size_t to int.
2023-05-07 20:25:44 +01:00
Rubidium 877349c13d Codechange: use std::string for text file name resolution 2023-05-05 08:54:29 +02:00
Rubidium 86786a7af6 Codechange: introduce StrEqualsIgnoreCase/StrCompareIgnoreCase to replace strcasecmp 2023-04-29 10:25:25 +02:00
Rubidium dfe52da1ea Codechange: use string/fmt instead of print for strgen warnings/errors/fatals 2023-04-18 23:20:53 +02:00
PeterN e97bf271dc
Codechange: Make SpriteType, CargoSortType, SourceType and ScriptType enum classes. (#10663)
This avoids a (soft) namespace conflict between the four ST_* enums.
2023-04-16 20:00:55 +01:00
Patric Stout 1ba4dcc924 Codechange: migrate all Window-related timers to the new framework
This means we also say goodbye to GUITimers.
2023-04-15 13:58:55 +02:00
Peter Nelson e5af5907ec Change: Make all dropdown lists extend width if necessary.
This removes the auto_width parameter from ShowDropDown(At).
2023-04-13 20:57:47 +01:00
Loïc Guilloux e4c511d403
Fix #10578: Allow to select any version of AI/GS from GUI (#10604) 2023-04-07 19:33:07 +02:00
glx22 9a957f1d4b Change: [Script] Improve ScriptText validation error messages 2023-03-05 22:24:08 +01:00
glx22 af15dca316 Change: [Script] Extract params info from GS strings 2023-02-28 18:53:17 +01:00
dP c73b88ddca
Fix: Don't send unused tile field over the network (#10507) 2023-02-24 22:50:11 +01:00
SamuXarick 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
glx22 b080f24bd8 Codechange: move windows common to AI and GS out of ai_gui 2023-02-05 19:27:25 +01:00
glx22 cef9931e53 Cleanup: GS don't have "start_date" 2023-02-05 19:27:25 +01:00
Rubidium 90f1768006 Codechange: add non-nullptr asserts in cases where it should never be nullptr
Though where similar calls are checked for nullptr as in those instances of
the use of that function it can actually return nullptr. In other words, write
down the assumption that the function never returns nullptr in an assert.
2023-01-14 21:15:23 +01:00
Loïc Guilloux 91ca088065
Fix #10304, fe30f66: [Scripts] Don't start GS in intro (#10305) 2023-01-02 02:13:16 +01:00
Michael Lutz 150f05dc15
Change: Heading for 14 now. (#10302) 2023-01-01 22:52:23 +01:00
Loïc Guilloux fe30f66570
Fix #9720: Delay start of GS/AI to after loading of savegame (#9745) 2022-12-28 05:02:26 +01:00
Jonathan G Rennison d4c530904c Fix #10274: Use after free when rescanning scripts with GS selected 2022-12-22 21:23:48 +01:00
Peter Nelson 890b2666d3 Change: Use scaled WidgetDimensions. 2022-11-12 18:28:39 +00:00
Peter Nelson b6ed595176 Codechange: Prefer suggested widget padding. 2022-11-12 18:28:39 +00:00
Peter Nelson 6f95e04005 Change: Use Rect helpers for widget drawing.
This replaces repetitive and sometimes unwieldy use of constants.
2022-11-12 18:28:39 +00:00
Artin Alavi 5d6cdf4385
Feature: Allow AI/GS to be fully modified in scenario editor (#10152) 2022-11-11 23:48:07 +01:00
Artin Alavi cbac243216
Feature: [UI] Split AI/Game Script configuration windows and add them to world gen window (#10058) 2022-11-10 21:39:09 +01:00
Charles Pigott 9059215b3b Fix #10073: Stop truncating output of list_ai and friends commands 2022-10-10 13:42:07 +01:00
Michael Lutz 3e85e833a7 Codechange: Add support for additional command result values. 2021-12-16 22:28:32 +01:00
Michael Lutz 8503854655 Codechange: Pass unpacked command arguments to command callbacks (except Script). 2021-12-16 22:28:32 +01:00
Michael Lutz eab18f06a4 Codechange: Pass additional data as byte stream to command callbacks. 2021-12-16 22:28:32 +01:00
Michael Lutz 4fc055d6e9 Codechange: Align parameter order of command callbacks to command handlers. 2021-12-16 22:28:32 +01:00
Michael Lutz a38bbefe1b Codechange: Untangle command code, flags and error string for DoCommand*. 2021-12-16 22:28:32 +01:00
Patric Stout 394c749b6b
Change: Heading for 13 now (#9573) 2021-09-25 13:48:03 +02:00
Patric Stout eca73a810c Change: rebrand 1.12.0 to 12.0
One question that keeps popping up: "when do we release 2.0?".
NewGRF will force that at least 1.16 will be 2.0, but to not wait
for this, let's drop the "1." and be for ever done with that
conversation.

We are following in the footstep of giants here.
2021-08-15 12:28:51 +02:00
Rubidium 3237e97b35 Cleanup: [Script] Use nullptr instead of 0 or NULL 2021-06-17 16:18:30 +02:00
Rubidium d31a535c87 Cleanup: remove some unneeded c_str() calls 2021-06-15 06:13:00 +02:00
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 2021-06-13 12:45:45 +02:00
glx22 34215f7faa Codechange: Replace FOR_ALL_TARS with range-based for loops 2021-05-03 19:46:57 +02:00
Patric Stout 9bfa7198fd
Change: Heading for 1.12 now (#8862) 2021-03-14 20:47:31 +01:00
Michael Lutz b408fe77f7 Codechange: Use std::string in file scanners. 2020-12-27 13:19:25 +01:00
Michael Lutz 5cbb2da794 Codechange: Even more std::string usage in file IO. 2020-12-27 13:19:25 +01:00
Patric Stout f66baa444f
Codechange: use C++11 constructs for for-each loops (#8432) 2020-12-25 19:38:18 +01:00
Patric Stout 4319d31036 Fix #6468: don't store version of AIs-started-via-console in name
You can do: "startai myai.3", which starts version 3 of "myai".
This is very useful for testing save/load code between different
versions of your AI.

However, when using this syntax, the AI got saved as "myai.3" as
name of the AI, instead of "myai". This caused several problems,
like indicating to the user the AI could not be found, but still
load the AI. But in all cases, the AI never got the chance to
load the saved data, making the whole reason this exists pointless.

By splitting the name and version already in the console command,
the code becomes simpler and AIs started this way now follow the
normal flow after initialization.
2020-12-25 17:03:44 +01:00
glx 4079c47b6c Change: rewrote squirrel_export in CMake 2020-07-16 00:53:26 +02:00
Patric Stout 56d54cf60e Add: introduce CMake for project management
CMake works on all our supported platforms, like MSVC, Mingw, GCC,
Clang, and many more. It allows for a single way of doing things,
so no longer we need shell scripts and vbs scripts to work on all
our supported platforms.

Additionally, CMake allows to generate project files for like MSVC,
KDevelop, etc.

This heavily reduces the lines of code we need to support multiple
platforms from a project perspective.

Addtiionally, this heavily improves our detection of libraries, etc.
2020-06-05 19:36:05 +02:00
Michael Lutz 1c0ba07c3c Add: [Script] Native priority queue; useful e.g. for pathfinders. 2020-06-01 21:35:13 +02:00
Niels Martin Hansen 800ade7702
Feature: Push-buttons on storybook pages (#7896)
Allow more direct player-initiated interaction for Game Scripts, by letting the GS put push-buttons on storybook pages. These buttons can either trigger an immediate event, or require the player to first select a tile on the map, or a vehicle.

Additionally this reworks how the storybook pages are layouted and rendered, to allow for slightly more complex layouts, and maybe speeding drawing up a bit.
2020-05-22 22:22:55 +02:00
Michael Lutz 9b6f5e3bb8 Codechange: Store GS lang texts in std::strings. 2020-05-21 20:02:34 +02:00
glx 47790b09a4 Codechange: Simplify CheckAPIVersion() 2020-02-14 21:43:21 +01:00
glx 2f264f2c92 Change: Heading for 1.11 now 2020-02-08 23:38:49 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
glx22 b3fd787959 Fix #7188: check the validity of command callback for scripts (#7701) 2019-09-07 17:37:01 +01:00
Michael Lutz b73622a01c Fix #7600: Don't read uninitialised memory when parsing GS language files. 2019-05-23 00:08:39 +02:00
peter1138 3293f08e0b Add: New RoadType API functions. 2019-05-01 21:36:27 +02:00
glx22 76788a1eb3
Fix 2bb80d2: really increase the maximum number of GameScript texts to 64k (#7555) 2019-05-01 19:31:30 +02:00
Charles Pigott 5b34c8019f Codechange: Remove Company/OwnerByte types 2019-04-29 17:40:22 +01:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Michael Lutz e804173595 Codechange: If something is a vector of strings, use a vector of strings instead of an AutoFreeSmallVector. 2019-04-09 22:45:15 +02:00
Michael Lutz d3e113eb5f Codechange: Use std::vector instead of AutoDeleteSmallVector in GS text handling. 2019-04-09 22:45:15 +02:00
Michael Lutz d95c7083ea Fix: Don't crash if reading a GS string file from disk produces an error.
The raw_strings vector may not include NULLs as no consumer can deal with it.
2019-04-09 22:45:15 +02:00
Henry Wilson cc62f4163f Cleanup: Remove unused size template parameters from SmallMap and Auto[Free|Delete]SmallVector 2019-03-26 20:15:57 +00:00
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 2019-03-26 20:15:57 +00:00
Henry Wilson a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 2019-03-26 20:15:57 +00:00
Henry Wilson a690936ed7 Codechange: Replace SmallVector::Length() with std::vector::size() 2019-03-26 20:15:57 +00:00
Henry Wilson af7d9020a1 Codechange: Use override specifer for overriding member declarations
This is a C++11 feature that allows the compiler to check that a virtual
member declaration overrides a base-class member with the same signature.

Also src/blitter/32bpp_anim_sse4.hpp +38 is no longer erroneously marked
as virtual despite being a template.
2019-03-24 16:10:04 +01:00
Patric Stout e3c639a09f Remove: ENABLE_NETWORK switch
This switch has been a pain for years. Often disabling broke
compilation, as no developer compiles OpenTTD without, neither do
any of our official binaries.

Additionaly, it has grown so hugely in our codebase, that it
clearly shows that the current solution was a poor one. 350+
instances of "#ifdef ENABLE_NETWORK" were in the code, of which
only ~30 in the networking code itself. The rest were all around
the code to do the right thing, from GUI to NewGRF.

A more proper solution would be to stub all the functions, and
make sure the rest of the code can simply assume network is
available. This was also partially done, and most variables were
correct if networking was disabled. Despite that, often the #ifdefs
were still used.

With the recent removal of DOS, there is also no platform anymore
which we support where networking isn't working out-of-the-box.

All in all, it is time to remove the ENABLE_NETWORK switch. No
replacement is planned, but if you feel we really need this option,
we welcome any Pull Request which implements this in a way that
doesn't crawl through the code like this diff shows we used to.
2019-03-20 19:24:55 +01:00
frosch a67ee02529
Change: Heading for 1.10 now (#7319) 2019-03-03 20:51:57 +01:00
Niels Martin Hansen 7e1e2756d4 Add: Show performance of AI and GS in framerate window 2019-02-23 14:29:07 +01:00
glx c540d72445 Fix: [Win32] WIN32 may not be defined, always prefer the compiler predefined macro _WIN32 2018-12-27 18:09:16 +01:00
Charles Pigott f5b1115039 Doc: Lots and lots of doxymentation fixes 2018-10-31 12:35:54 +01:00
gdinit 34b63930f5 Fix: Typo in game.hpp
Just a typo fix in a code comment line.
2018-04-23 23:14:23 +02:00
Pavel Stupnikov 6ff81b908e Feature #6459: API for querying network clients from GS (#6736) 2018-04-22 15:42:29 +02:00
frosch 09d4735679 (svn r27993) -Change: Heading for 1.9 now 2018-03-14 19:36:41 +00:00
frosch b4b98e5165 (svn r27893) -Codechange: Use fallthrough attribute. (LordAro) 2017-08-13 18:38:42 +00:00
frosch afcef7faa6 (svn r27780) -Update: Numbers 2017-03-11 20:50:26 +00:00
frosch a56e2bccd0 (svn r27756) -Codechange: Add StringTab enum 2017-02-26 19:40:53 +00:00
frosch 0c7c0ada78 (svn r27518) -Update: Numbers 2016-03-01 20:00:22 +00:00
frosch 6477356dd2 (svn r27192) -Change: heading for 1.6 now 2015-03-17 20:33:44 +00:00
fonsinchen 2128f1e929 (svn r26893) -Feature: ScriptStationList_Cargo for sorting cargo by from and via 2014-09-21 16:20:48 +00:00
rubidium 33ab505567 (svn r26774) -Cleanup [Squirrel]: remove _SC macro 2014-09-06 17:46:56 +00:00
rubidium 7c4e9dd71d (svn r26771) -Cleanup: remove OTTD2SQ and SQ2OTTD 2014-09-06 17:30:33 +00:00
rubidium 5e90054f20 (svn r26511) -Codechange: use strecpy in game_text 2014-04-25 17:43:09 +00:00
rubidium 9ed12b0f07 (svn r26509) -Codechange: replace strdup with stredup (the latter ensures the return is not NULL) 2014-04-25 15:40:32 +00:00
rubidium e61fe21237 (svn r26506) -Codechange: replace most of vsnprintf with vseprintf 2014-04-24 19:51:45 +00:00
frosch fad2d3c709 (svn r26505) -Fix (r23634, r26493): Incorrect usage of strecpy/strecat 2014-04-24 19:09:17 +00:00
frosch d71cc434e4 (svn r26504) -Fix (r26499): Obiwan and his gang. 2014-04-24 18:58:47 +00:00
rubidium 8960939b22 (svn r26499) -Codechange: replace strndup with stredup 2014-04-24 18:37:39 +00:00
rubidium a5274117bd (svn r26487) -Codechange: use lastof instead of lengthof/sizeof for script names 2014-04-23 21:16:58 +00:00
rubidium 5b82822c12 (svn r26486) -Codechange: replace a number of snprintfs with seprintf 2014-04-23 21:12:09 +00:00
frosch ef4c2ce031 (svn r26485) -Codechange: Replace ttd_strlcpy and ttd_strlcat with strecpy and strecat. 2014-04-23 20:44:42 +00:00