Commit Graph

47 Commits

Author SHA1 Message Date
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
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
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.
2023-08-11 14:53:51 +02:00
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
2023-07-19 19:30:14 +02:00
Rubidium f9b5bc7ee6 Cleanup: the need for SQAutoFreePointers has gone 2023-05-14 22:54:10 +02:00
Rubidium d9e93edc8b Codechange: replace 'const char *' script API parameters with std::string 2023-05-14 22:54:10 +02:00
Rubidium bbcb55ebc9 Codechange: use std::string as script API return type 2023-05-14 22:54:10 +02:00
Rubidium 77177f7e8b Add: support for std::string parameters in the script API 2023-05-14 22:54:10 +02:00
Charles Pigott 6fc28d649e Cleanup: Unused alloca definitions and includes 2023-04-15 16:57:00 +01:00
Michael Lutz 9b3326e3fd Codechange: [Script] Use std::vector instead of a hand-rolled alternative. 2023-02-24 21:46:27 +01:00
Michael Lutz ca3cb4d2ef Codechange: [Script] Use a class template instead of a function template for squirrel type conversion.
Class templates allow using partial template specialization, which is useful in
case one wants to have a type conversion on a type that is itself templated.
2023-02-24 21:46:27 +01:00
Michael Lutz 3fede15940 Codechange: [Script] Prettify squirrel call helpers by using C++17. 2021-12-20 19:25:10 +01:00
Michael Lutz b0990fcff7 Codechange: Make TileIndex a "strong" typedef to give it a distinct type.
This is accomplished by changing it to a single member struct with the
appropriate operator overloads to make it all work with not too much
source modifications.
2021-12-16 22:28:32 +01:00
Rubidium 3237e97b35 Cleanup: [Script] Use nullptr instead of 0 or NULL 2021-06-17 16:18:30 +02:00
Patric Stout ca9a7df752
Codechange: rename str_validate to StrMakeValid(InPlace) (#9304)
This to be more explicit the function changes the value, and not
returns yes/no.
2021-05-29 11:21:38 +02:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
glx 09004f3697 Codechange: catch script exceptions by reference 2019-05-15 21:59:57 +02:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Henry Wilson 03ca3190c9 Codechange: Use range-based for-loop in Auto[Free|Delete]SmallVector 2019-03-26 20:15:57 +00:00
Henry Wilson c01a2e2a81 Codechange: Removed SmallVector completely 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 4b349c0f90 Codechange: [core] Implement SmallVector using std::vector
The public and protected interface to SmallVector are unchanged
SmallVector now requires that items be default constructible
This isn't an issue since some contained items were previously created
uninitialized.

Temporary default constructors are added to the following structs
- SmallPair
- SmallStackItem
- GRFPresence

Where vector<bool> is required, transition immediately to std::vector
to avoid returning proxy object references.
2019-03-26 20:15:57 +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 691c22ac6a (svn r26585) -Fix/Feature [FS#5942]: don't truncate money to 32 bits 2014-05-11 20:25:26 +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 e40eb8177a (svn r23735) -Codechange: remove ~50 includes from headers that weren't needed 2012-01-03 20:26:05 +00:00
yexo 5988659eea (svn r23651) -Feature: [NoGo] GSText now accepts string arguments as parameters to the constructor 2011-12-21 14:55:28 +00:00
truebrain 3a535690d4 (svn r23623) -Add: allow bi-directional communication with the AdminPort and GameScript 2011-12-19 21:00:32 +00:00
truebrain e75153d8ac (svn r23597) -Codechange: fix up squirrel export script a bit 2011-12-19 20:44:31 +00:00
truebrain bff7c33aa9 (svn r23350) -Add: support different ScriptTypes in the helper functions for GetClassName (Rubidium) 2011-11-29 22:23:33 +00:00
truebrain d03bbdd4ac (svn r23295) -Codechange: put ImportLibrary in AIController (and document the parameters for NoAI docs) 2011-11-23 13:39:36 +00:00
truebrain 492c96d214 (svn r23294) -Codechange: sq_pop in native callback is just a waste of CPU cycles, as the top is reset in all cases 2011-11-23 13:38:35 +00:00
rubidium 3f7eb71b17 (svn r23210) -Codechange: generate the GetClassName function for the AI classes programmatically 2011-11-13 20:52:39 +00:00
michi_cc 65637d8941 (svn r22874) -Fix [FS#4747]: Check size of various buffers before allocation. (monoid) 2011-09-02 20:16:41 +00:00
rubidium 30f2afac9b (svn r20632) -Cleanup: remove "a few" unneeded includes, and add them to some headers 2010-08-26 22:01:16 +00:00
smatz 23041d9720 (svn r19509) -Codechange: remove superfluous semicolons after function definitions 2010-03-23 22:37:18 +00:00
rubidium b1bd106703 (svn r18862) -Fix [FS#3544]: don't pass AI strings through iconv 2010-01-18 15:41:38 +00:00
rubidium d79439fb3c (svn r17963) -Codechange: some documentation style 2009-11-03 17:30:08 +00:00
rubidium 7fbc33dae1 (svn r17248) -Fix: add GPL license notice where appropriate 2009-08-21 20:21:05 +00:00
yexo 5a863925ee (svn r17221) -Change [NoAI] [FS#3101]: when the API requests a string as parameter allow every squirrel type and convert to a string 2009-08-19 14:54:52 +00:00
rubidium 5186d1d4f6 (svn r17013) -Fix [FS#3074]: concatenating strings in Squirrel when non-ASCII strings were received from OpenTTD failed. The number of bytes in an UTF-8 encoded string isn't always the same as the number of characters in the decoded (into wchars) string 2009-07-31 23:13:53 +00:00
yexo b520d73285 (svn r15629) -Fix (r15027): Validate strings that are passed from squirrel to the API, not strings passed from the API to squirrel. 2009-03-06 14:21:26 +00:00
glx 6d6e2232ea (svn r15316) -Fix [NoAI]: ignore unprintable chars when returning a string to squirrel 2009-02-02 13:46:26 +00:00
truebrain a3dd7506d3 (svn r15027) -Merge: tomatos and bananas left to be, here is NoAI for all to see.
NoAI is an API (a framework) to build your own AIs in. See:
   http://wiki.openttd.org/wiki/index.php/AI:Main_Page
 With many thanks to:
  - glx and Rubidium for their syncing, feedback and hard work
  - Yexo for his feedback, patches, and AIs which tested the system very deep
  - Morloth for his feedback and patches
  - TJIP for hosting a challenge which kept NoAI on track
  - All AI authors for testing our AI API, and all other people who helped in one way or another
-Remove: all old AIs and their cheats/hacks
2009-01-12 17:11:45 +00:00