Rubidium and rubidium42
04d10b3d2d
Codechange: instead of global pointer to stack variable, just put variable in that global
...
Removes one indirection and a dangling pointer to a stack location
2023-01-28 17:23:30 +01:00
Rubidium and rubidium42
d51d08ddcb
Codechange: put stack variables in global variables for gamelog/crashlog
2023-01-28 17:23:30 +01:00
Rubidium and rubidium42
ed7685910d
Codechange: pass large objects by reference instead of value
...
Especially when they get passed on directly to the next function or via a
constructor into an instance variable
2023-01-28 13:43:21 +01:00
Rubidium and rubidium42
7e1d272397
Cleanup: remove unused static variables
2023-01-27 07:05:49 +01:00
Rubidium and rubidium42
00721787e1
Fix: wrong type for INVALID_LINK_GRAPH_JOB
2023-01-27 07:05:49 +01:00
Rubidium and rubidium42
755e41de9f
Codechange: make rounding code clearer
...
-O1 already optimizes it to the original hand optimized magic code
2023-01-26 23:47:55 +01:00
Rubidium and rubidium42
71b46db8d0
Cleanup: remove commented out code
2023-01-26 23:47:55 +01:00
Rubidium and rubidium42
5863d78cb4
Codechange: use commented out code, or guard by #ifdef
2023-01-26 23:47:55 +01:00
Rubidium and rubidium42
ae422be979
Cleanup: remove/replace trailing ; with . in comments
2023-01-26 23:47:55 +01:00
Rubidium and rubidium42
2fd99467ea
Fix: scripts are not aware of nullptr, they only know null
2023-01-26 16:07:14 +01:00
Rubidium and rubidium42
f9a473bef7
Fix: missing/duplicate documentation tags for scripts
2023-01-26 16:07:14 +01:00
Rubidium and rubidium42
3112b387e7
Fix: warnings about obsolete settings/setting values in Doxygen configurations
2023-01-26 16:07:14 +01:00
Rubidium and rubidium42
41fa94bc56
Fix: scripts cannot call constructors of ScriptEvents, so remove from the documentation
2023-01-25 22:28:30 +01:00
Rubidium and rubidium42
042f90a9dd
Fix: no ScriptEvent sub class should export constructors to scripts
2023-01-25 22:28:30 +01:00
Rubidium and rubidium42
8aeef665c7
Fix #10377 , Fix 94167df: bad sorting of rail vehicles when primary variant is missing
2023-01-22 21:13:17 +01:00
Rubidium and rubidium42
7cdc23fd64
Codechange: hide the map's size related fields in the Map structure
2023-01-21 17:11:40 +01:00
Rubidium and rubidium42
de6bc8e692
Codechange: move TILE_MASK to Map::WrapToMap
2023-01-21 17:11:40 +01:00
Rubidium and rubidium42
fe2bcd2a58
Codechange: migrate size related functions to Map structure
2023-01-21 17:11:40 +01:00
Rubidium and rubidium42
d481f78b24
Codechange: add map size related functions to Map structure
2023-01-21 17:11:40 +01:00
Rubidium and rubidium42
9c1a3b17e3
Codechange: use MapLogY() instead of FindFirstBit(MapSizeY()), MapSize() instead of MapSizeX() * MapSizeY()
2023-01-21 17:11:40 +01:00
Rubidium and rubidium42
22d3de8b67
Codechange: use ScriptMap size functions instead of global functions
2023-01-21 17:11:40 +01:00
Rubidium and rubidium42
953445a5ac
Codechange: use MakeSea/AllocateMap in the oldloader instead of MemSetT
2023-01-21 17:11:40 +01:00
Rubidium and rubidium42
8d8519c3f6
Fix #10368 , Fix 994bf19: server restarting game caused clients to hit assertion
...
Upon closing the EndGameWindow, triggered from UnInitWindowSystem, the
HighScoreWindow would be opened and _z_windows would not be empty.
2023-01-17 22:48:39 +01:00
Rubidium and rubidium42
a4a819c983
Fix #9865 : removing files with the console always failed
2023-01-15 14:47:05 +01:00
Rubidium and rubidium42
1ed0b35520
Fix #10009 : bad overflow protection when taking out loans
2023-01-15 12:04:50 +01:00
Rubidium and rubidium42
8f9a60893d
Fix #10177 : company list password padlock showed after switching to single player
2023-01-15 11:52:51 +01:00
Rubidium and rubidium42
c578917783
Fix #10057 : FallbackParagraphLayout fails to properly wrap
...
... during the first word after a new run has been started.
2023-01-15 11:43:22 +01:00
Rubidium and rubidium42
20a9e13272
Fix: inconsistent definition of copy constructor and assignment
2023-01-15 00:24:20 +01:00
Rubidium and rubidium42
6dfd2cad69
Fix: comparison result is always the same warnings
2023-01-15 00:24:20 +01:00
Rubidium and rubidium42
921c6591f9
Codechange: do not use interactive random anymore for script configuration
2023-01-14 22:00:11 +01:00
Rubidium and rubidium42
c5ff61c5f2
Add: script specific Randomizer instances
2023-01-14 22:00:11 +01:00
Rubidium and rubidium42
6abad681bd
Codechange: move choice for randomizer of scripts to a single location
2023-01-14 22:00:11 +01:00
Rubidium and rubidium42
3373128233
Codechange: pass the randomizer directly to the town name generation
2023-01-14 22:00:11 +01:00
Rubidium and rubidium42
b3b8c3fd2d
Codechange: pass the randomizer to use directly to the company face generation
2023-01-14 22:00:11 +01:00
Rubidium and rubidium42
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
Rubidium and rubidium42
bcfe0fb076
Codechange: introduce GetMainWindow() to properly account for nullptr checks
...
Some nullptr checks have been removed as they were not triggered with nullptr
with the null video driver and in dedicated server mode.
2023-01-14 21:15:23 +01:00
Rubidium and rubidium42
9c70c38c5e
Fix: check for the existence of shadow and rotor vehicles for aircraft
...
Instead of just assuming that it exists in the savegame that got loaded.
2023-01-14 21:15:23 +01:00
Rubidium and rubidium42
b951332def
Codechange: use smart pointers when creating StringIterators
2023-01-13 21:09:40 +01:00
Rubidium and rubidium42
b35c791d05
Codechange: use smart pointers when cloning iterators
2023-01-13 21:09:40 +01:00
Rubidium and rubidium42
f667a831a5
Codechange: unify creation of diagonal/orthogonal iterator using smart pointers
2023-01-13 21:09:40 +01:00
Rubidium and rubidium42
46dfb309bc
Fix #10309 : [SDL] Uninitialized width and height when turning off full screen
2023-01-07 15:46:00 +01:00
Rubidium and rubidium42
0251786f46
Fix: virtual call from constructor
...
That fills an instance variable that is only read from the Game Options window
and that is overwritten when the video driver is started. Since you cannot get
into the Game Options window without starting the video driver, it is just
pointless and wrong code that would never be noticed by the end user.
2023-01-06 19:34:35 +01:00
Rubidium and rubidium42
c1ff471c77
Fix: bad oddness checks
...
Modulo on a signed number returns negative values for negative values, so
i % 2 == 1 will only return true for positive odd numbers, whereas i % 2 != 0
returns true for both positive and negative odd numbers.
2023-01-06 19:34:35 +01:00
Rubidium and rubidium42
f7af9a299a
Codechange: prevent suspicious pointer scaling
2023-01-06 19:34:35 +01:00
Rubidium and rubidium42
170f37d07f
Codechange: silence some potentially uninitialized local variable errors
...
In these cases technically they are false positives, however dismissing the
alerts when the underlying code may make them true positives does not seem
like the safest solution.
2023-01-06 19:34:35 +01:00
Rubidium and rubidium42
496ec1f012
Fix: use reference and array indexing to prevent suspicious pointer scaling
2023-01-06 19:34:35 +01:00
Rubidium and rubidium42
fbd0f5ad7d
Fix: inconsistent allocation error handling
...
Mix-and-matching std::bad_alloc exception handling with nullptr checks
2023-01-06 19:34:35 +01:00
Rubidium and rubidium42
3c54344825
Fix: comparison of narrow type with wide type in loop condition
...
Technically this can't be triggered with the currently returned values though.
2023-01-06 19:34:35 +01:00
Rubidium and rubidium42
51049946d1
Fix: prevent corrupted GRF files to allocate stupid amounts of memory
2023-01-05 20:11:59 +01:00
Rubidium and rubidium42
752cd5c0da
Cleanup 84b71f7: remove G5 detector as it's not referenced anymore
...
The last supported Mac OS X for G5 is 10.5.8 and support for < 10.7 has already been removed.
2023-01-04 22:42:23 +01:00
Rubidium and rubidium42
375a5b8e3f
Codechange: refactor FindClosestDepot to not use pointers, but return a struct
2023-01-04 22:30:48 +01:00
Rubidium and rubidium42
a0694759a1
Fix: do not allow more palette colours than there are indices for the colours
...
Or: do not pass unchecked size from BMP file into memory allocation
2023-01-04 18:36:49 +01:00
Rubidium and rubidium42
648cd1076b
Update: other language files after string renames
2022-11-02 17:58:44 +01:00
Rubidium and rubidium42
d5aafaee15
Codechange: rename and move some strings to make them more consistent with the rest of the strings
2022-11-02 17:58:44 +01:00
Rubidium and rubidium42
c73f578e8c
Codechange: replace magic numbers and C-style arrays with C++-style array for share owners
2022-03-09 18:05:12 +01:00
Rubidium and rubidium42
1c256a4be7
Fix: do not let shares in the company taking over another company disappear
2022-02-24 20:25:31 +01:00
Rubidium and Michael Lutz
ad89601c49
Codechange: do not use all upper case enumerators in a scoped enum
2021-12-05 21:41:43 +01:00
Rubidium and rubidium42
92559e6f3a
Fix #9388 : thread unsafe use of NetworkAdminConsole/IConsolePrint
2021-09-01 22:40:44 +02:00
Rubidium and rubidium42
d83647f9a7
Fix #9440 : negative cargo payments not being handled right
...
Cargo payments were stored as unsigned integer, but cast to int64 during
application of inflation. However, then being multiplied with a uint64
making the result uint64. So in the end the payment that should have been
negative becomes hugely positive.
2021-08-02 20:44:53 +02:00
Rubidium and rubidium42
ba29edb0b3
Cleanup: remove some references to the old master-server
2021-07-21 22:28:51 +02:00
Rubidium and rubidium42
386ef4dac3
Feature: [Game Coordinator] Send NewGRF names to the client
2021-07-18 19:36:38 +02:00
rubidium42 and rubidium42
3eaa470632
Feature: [Network] Optionally send NewGRF names with NewGRFs in GameInfo
...
Before 8a2da49 the NewGRF names were synchronized using UDP packets, however
those have been removed. With this a new version of the GameInfo packet is
introduced that allows to specify the type of serialisation happens for
NewGRFs. Either only the GRF ID and checksum, or those two plus the name of
the NewGRF.
On this request for local servers will send the NewGRFs names.
The Game Coordinator will get the names on the first registration, and after
that only the GRF ID and checksum.
2021-07-18 19:36:38 +02:00
rubidium42 and rubidium42
5dd524139f
Fix c921f6d: [Network] Documentation of Game Info packet was not updated
2021-07-18 11:42:25 +02:00
rubidium42 and rubidium42
09a7825d1e
Remove: the concept of UnknownGRFs
...
These were filled with "<Unknown>" (before 8a2da49 ) and later their name would get filled via UDP requests to the server. These UDP packets do not exist anymore, so they will always remain "<Unknown>".
Remove that logic and just use the generic translated error GRF UNKNOWN string instead.
2021-07-18 11:42:25 +02:00
Rubidium and rubidium42
c71f06e59b
Feature: parse the console settings the same way as config settings
...
Now you can use things like `set server_game_type public` instead of having to
guess the number, which would not be written into the configuration file nor
would it be shown when doing `set server_game_type`.
2021-07-11 23:11:05 +02:00
Rubidium and rubidium42
178ea3196b
Remove: includes to network/core/config.h from headers when only three cpp files need it
2021-07-11 22:13:59 +02:00
Rubidium and rubidium42
f6955a304c
Fix: ensure no more than the allowed number of NewGRFs are loaded from the configuration
2021-07-11 11:20:07 +02:00
Rubidium and rubidium42
e99134654b
Feature: allow setting (game) coordinator and content server connection strings using environment variables
...
OTTD_COORDINATOR_CS for the game coordinator defaults to coordinator.openttd.org:3976
OTTD_CONTENT_SERVER_CS for the content server defaults to content.openttd.org:3978
OTTD_CONTENT_MIRROR_CS for the content mirror server defaults to binaries.openttd.org:80
2021-07-10 23:09:45 +02:00
Rubidium and rubidium42
3e4d327451
Codechange: use the C++ std::getenv over the POSIX/C getenv
...
The C++ std::getenv is guaranteed thread-safe by the C++11 specification,
whereas the POSIX/C getenv might not be thread-safe by the C11 specification.
2021-07-10 22:55:46 +02:00
Rubidium and rubidium42
85faa218ff
Remove: logically dead code in graph UI
2021-07-10 11:27:09 +02:00
Rubidium and rubidium42
0d0375c019
Remove: logically dead code from font cache
...
The outer if statement checks for 'aa' being false, so within the inner
statements anything checking aa will have a known result and the other
branch from there will be dead code.
2021-07-10 11:27:09 +02:00
Rubidium and rubidium42
1c0c4637d2
Fix 11ab3c4: [NewGRF] Overflow when determining cargo mask for string code 9A 1E
...
9A 1E: Print unsigned word as name of a cargo type (translated for GRF version >= 7).
2021-07-10 10:51:00 +02:00
Rubidium and rubidium42
ede3f79475
Codechange: use the name string in SaveLoad for the name of the Setting as well
2021-07-09 22:53:30 +02:00
Rubidium and rubidium42
01139d3368
Codechange: access the name of a setting via an accessor function
2021-07-09 22:53:30 +02:00
Rubidium and rubidium42
94881f5a34
Codechange: name a few unnamed settings as to not to have to check for that being empty
2021-07-09 22:53:30 +02:00
Rubidium and rubidium42
7e7a4aad72
Codechange: split off the settings saveload code from the main settings handling logic
2021-07-06 21:32:47 +02:00
rubidium42 and rubidium42
25ca6a75bc
Codechange: split off the settings table and all the callbacks from the main settings handling logic
2021-07-06 21:32:47 +02:00
rubidium42 and rubidium42
d38ad7d80c
Cleanup: remove declaration of undefined function
2021-07-03 11:26:13 +02:00
rubidium42 and rubidium42
979783f90e
Codechange: replace InjectDParam/ShiftParameters by setting the right parameter values in the first place
2021-07-03 11:26:13 +02:00
Rubidium and rubidium42
9c7a7b53a1
Codechange: use a contructor for NewsItem to set the values
...
And use std::unique_ptr to manage the memory of the allocated data
2021-07-01 19:04:38 +02:00
rubidium42 and rubidium42
9a7750f14e
Codechange: use the constructor for CompanyNewsItem to fill the data instead of a separate function
2021-07-01 19:04:38 +02:00
rubidium42 and rubidium42
aa9818db90
Codechange: create a type for the "free_data" of NewsItems and (de)allocate it with new and delete
2021-07-01 19:04:38 +02:00
rubidium42 and Patric Stout
98e653dacc
Fix #9386 : compilers failing to compile with LTO by using variants instead of new + unique_ptr
...
With std::variant all memory can be figured out at compile time, so the compiler needs to keep track of fewer elements. It also saves out a unique_ptr and its memory management, over a slight impact for resolving a setting.
2021-06-26 20:28:34 +02:00
rubidium42 and Patric Stout
f35e6c1c7f
Codechange: use C-style strings instread of std::string in the SettingDesc constructor
...
This as using std::string causes much more variables to be tracked, potentially causing problemes for certain compilers in certain situations
2021-06-26 20:28:34 +02:00
rubidium42 and Patric Stout
c93fcbcb28
Codechange: introduce helper to convert from the iterated type to the actual SettingDesc
2021-06-26 20:28:34 +02:00
rubidium42 and Patric Stout
f7f1d530b8
Codechange: instead of "naked" initializer lists, declare the type in the saveload macros
...
This to help variant's constructor to be able to resolve the constructor of the setting
2021-06-26 20:28:34 +02:00
rubidium42 and Patric Stout
f029fd0f3b
Codechange: remove overloading on UpdateServiceInterval
...
One UpdateServiceInterval has two parameters to update the service interval for a vehicle type, the other for all vehicle types at once. Rename the latter to help with function resolution for the introduction of variants.
2021-06-26 20:28:34 +02:00
rubidium42 and Patric Stout
cdf9caf8ea
Codechange: [Network] Remove overload on NetworkValidateClientName
...
Rename the zero-parameter NetworkValidateClientName to NetworkValidateOurClientName to make it clearer it is performed on our client name, and to make it a non-overloaded function to aid with the variant being added a few commits later
2021-06-26 20:28:34 +02:00
Rubidium and rubidium42
281a65b3e1
Cleanup: simplify some boolean expressions
2021-06-17 16:18:30 +02:00
Rubidium and rubidium42
357af686dc
Cleanup: use true/false instead of 1/0 where applicable
2021-06-17 16:18:30 +02:00
Rubidium and rubidium42
f904aef176
Cleanup: use nullptr instead of 0 or NULL
2021-06-17 16:18:30 +02:00
Rubidium and rubidium42
a9774f3e34
Cleanup: [Squirrel] Use nullptr instead of 0 or NULL
2021-06-17 16:18:30 +02:00
Rubidium and rubidium42
3237e97b35
Cleanup: [Script] Use nullptr instead of 0 or NULL
2021-06-17 16:18:30 +02:00
Rubidium and rubidium42
930bb22416
Cleanup: remove lines from station_base.h that are already included in includes base_station_base.h
2021-06-17 16:18:30 +02:00
Rubidium and rubidium42
d31a535c87
Cleanup: remove some unneeded c_str() calls
2021-06-15 06:13:00 +02:00
rubidium42 and rubidium42
05005dcdfa
Codechange: [Network] Use std::string instead of char[] for the name of the file that is downloading
2021-06-15 06:13:00 +02:00
rubidium42 and rubidium42
981cd0197a
Codechange: [Network] Use std::string for the client name in the network server
2021-06-15 06:13:00 +02:00
rubidium42 and rubidium42
a8b3afb236
Codechange: [Network] Use string_view for network compatability check
2021-06-15 06:13:00 +02:00
rubidium42 and rubidium42
49dcf0c772
Codechange: [Network] Simplify constructing the HTTP request with fmt
2021-06-15 06:13:00 +02:00
rubidium42 and rubidium42
53b4786037
Codechange: [Network] Let NetworkError return its std::string instead of a C-string
2021-06-15 06:13:00 +02:00