Commit Graph

541 Commits

Author SHA1 Message Date
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.
2023-06-05 19:32:22 +02: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 633f19419d Codechange: Make more use of GetCargoAccepted/ProducedIndex(). 2023-05-24 17:34:11 +01:00
Peter Nelson f177ce7c9a Codechange: Base CargoArray off std::array.
This avoids needing to define array accessors and allows use of
default value initialization.
2023-05-23 19:07:36 +01:00
Rubidium 3323402aaa Codechange: rename smallvec_type to container_func and use only when needed 2023-05-20 16:53:10 +02:00
Peter Nelson e6740046ee Codechange: Use range-for iteration. 2023-05-11 07:58:55 +01:00
Rubidium fb856e16c1 Codechange: replace some min/clamp constructs to ClampTo 2023-05-06 21:26:13 +02:00
Patric Stout 36a0818bc5
Remove: buying/selling/owning company shares (#10709) 2023-04-29 10:16:49 +02:00
Patric Stout 7aa2b9ab0a
Codechange: move all date-related variables inside the timer (#10706) 2023-04-24 15:56:01 +00: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 3ebc7ad16e Codechange: migrate all game-time-related timers to the new framework 2023-04-15 13:58:55 +02:00
dP e2f1cd44dc
Change: Increase max cargo age and let min cargo payment approach zero. (#10596)
Co-authored-by: Michael Lutz <michi@icosahedron.de>
2023-04-10 12:34:28 +02:00
Jonathan G Rennison 4c1406a4b5 Add: NewGRF road stops 2023-02-26 21:28:30 +01:00
Rubidium b7b7c11b90 Change #10077: make maximum loan a positive multiple of the loan interval
And set the minimum maximum loan to the value of loan interval, so there is
always an amount of money to lend. Compared to being allowed to set max loan
to 0 and never be allowed to lend any money.
2023-02-01 21:41:18 +01:00
Rubidium fe2bcd2a58 Codechange: migrate size related functions to Map structure 2023-01-21 17:11:40 +01:00
Jonathan G Rennison 10e76b2788 Fix #10032: Capacities of articulated vehicles in build window
See also: #9954
2023-01-14 18:52:01 +01:00
SamuXarick b7abaa55a3
Codechange: Improve performance when calculating company value (#9901) 2022-11-08 11:11:24 +00:00
glx22 aeeee9f18e Fix #9909, 13528bf: Left-over unused parameter breaks overload resolution 2022-06-01 19:24:48 +02:00
benda 6540948ace
Fix: Company values do not properly account for shares (#9770)
Co-authored-by: Charles Pigott <charlespigott@googlemail.com>
2022-05-14 16:57:47 +02:00
Charles Pigott 146827c458
Fix #9877: GS could trigger 'Cost: 0' cost message (#9878) 2022-05-05 19:51:56 +01:00
Tyler Trahan f4ca94d3f6 Codechange: Revenue is not the same as Income
Income is revenue minus costs. Let's name things correctly (without breaking the script API).
2022-04-25 21:51:51 +02:00
Tyler Trahan d220debc6c
Change: Don't pay Property Maintenance on stations when Infrastructure Maintenance is disabled (#9828) 2022-03-10 22:34:03 +01:00
Rubidium 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 1c256a4be7 Fix: do not let shares in the company taking over another company disappear 2022-02-24 20:25:31 +01:00
dP 36bee83864
Change: Deliver cargo to the closest industry first (#9536) 2022-02-19 19:08:23 +01:00
Niels Martin Hansen e68bf58989 Codechange: Use anonymous union for vehicle orders/old orders list 2022-02-15 20:01:10 +01:00
Michael Lutz 2e39637db2 Codechange: Don't use a global for the 'not enough cash' message. 2021-12-16 22:28:32 +01:00
Michael Lutz 41fa16f325 Codechange: Don't use globals for return values from vehicle command procs. 2021-12-16 22:28:32 +01:00
Michael Lutz 13528bfcd0 Codechange: Un-bitstuff all remaining commands. 2021-12-16 22:28:32 +01:00
Michael Lutz 21675ec7e2 Codechange: Un-bitstuff vehicle/engine commands. 2021-12-16 22:28:32 +01:00
Michael Lutz 4f3ea3907e Codechange: Un-bitstuff commands taking a ClientID (i.e. CMD_CLIENT_ID). 2021-12-16 22:28:32 +01:00
Michael Lutz 0f64ee5ce1 Codechange: Template DoCommandP to automagically reflect the parameters of the command proc.
When finished, this will allow each command handler to take individually
different parameters, obliviating the need for bit-packing.
2021-12-16 22:28:32 +01:00
Michael Lutz e740c24eb7 Codechange: Template DoCommand to automagically reflect the parameters of the command proc.
When finished, this will allow each command handler to take individually
different parameters, obliviating the need for bit-packing.
2021-12-16 22:28:32 +01:00
Michael Lutz 7048e1522f Codechange: Move flags in CommandProc in front of the command arguments. 2021-12-16 22:28:32 +01:00
Michael Lutz 33ca4f2b99 Codechange: Let the compile generate the master command table out of templated command traits.
This is using a non-intrusive type-traits like templated system, which
allows compile-time validation that the command table and the command
enum match up.
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
Michael Lutz 549caca39c Codechange: Move command arguments to the back of the networked command function calls. 2021-12-16 22:28:32 +01:00
Michael Lutz b6933a2ebd Codechange: Move command arguments to the back of the DoCommand function call. 2021-12-16 22:28:32 +01:00
Rubidium 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
glx22 a543a4b7bb Codechange: Remove FOR_EACH_SET_CARGO_ID 2021-07-09 21:36:09 +02:00
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 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
Patric Stout ef25afd55a
Fix #9348, 4d74e51: don't try to sell shares of spectators (#9349)
"new_owner" can be INVALID_OWNER, and as INVALID_OWNER ==
COMPANY_SPECTATORS, we could end up trying to sell shares of
nobody.
2021-06-11 00:18:20 +02:00
glx22 5799402f7a Codechange: Rename window related DeleteXXX to match new behaviour 2021-05-29 21:08:25 +02:00
rubidium42 2e136285e1 Codechange: move from C-string to std::string for DoCommand 2021-05-29 19:02:18 +02:00
Patric Stout 4d74e51907
Fix #9281: acquire a company uses special bookkeeping to make you rich (#9300)
When you buy-out a company, you got your shares back. This is
based on company-value, which includes values for the vehicles etc.
In other words, you not only got the vehicles, but you also got
paid to get them back.

Additionally, you also got the loan of the company, but not the
money for the loan (as that is subtracted from the company-value).

Solve this by changing the rules of a buy-out: don't sell your
shares, get the loan AND the balance and get the infrastructure.
2021-05-29 11:21:30 +02:00
rubidium42 44ca7d9377 Change: Use gender-neutral pronouns 2021-05-15 10:16:48 +02:00
William Davis 881e1da51d
Change: Use gender-neutral pronouns in console command messages (and comments) (#9203) 2021-05-08 11:02:30 +01:00
glx22 9a8756d7ed Codechange: Replace FOR_ALL_CARGOSPECS with range-based for loops 2021-04-29 21:08:24 +02:00
glx22 6b8ad5a9b1 Change: Apply some consistency to singleplayer related comments 2021-01-22 22:19:55 +01:00