Commit Graph

233 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
Rubidium 63d9bb93b8 Codechange: migrate from C-style GetString to C++-style GetString 2023-05-21 21:17:12 +02:00
Rubidium e33b2afd87 Codechange: pass (uint) money as Money for CmdGiveMoney 2023-05-06 21:26:13 +02:00
Rubidium 4a5a9f57c4 Fix: conversion to smaller type warnings 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
Patric Stout ed83c4b0da
Change: replace per-AI "start_date" with a global "competitors_interval" (#10653)
The per-AI "start_date" is a lot of custom code, and was rarely
used in the way it was meant.

While at it, also ported this part over to the new timer system.
2023-04-16 20:14:22 +02:00
Patric Stout 3ebc7ad16e Codechange: migrate all game-time-related timers to the new framework 2023-04-15 13:58:55 +02:00
SamuXarick 231935fccd Change: Show buy company dialog window even when playing in the AI company 2023-02-11 09:43:47 +01:00
SamuXarick 43ce73db86 Fix: [Script] Use Money instead of int32 for presenting the value of a company to AIs 2023-02-11 09:43:47 +01:00
glx22 b080f24bd8 Codechange: move windows common to AI and GS out of ai_gui 2023-02-05 19:27:25 +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 4e65ec1dc4 Codechange: do not declare functions in blocks 2023-01-29 20:28:45 +01:00
Rubidium b3b8c3fd2d Codechange: pass the randomizer to use directly to the company face generation 2023-01-14 22:00:11 +01:00
Tyler Trahan 89a2d0a605
Fix #10154: Don't inconsistently set random company face in network games (#10157) 2022-11-13 11:30:46 -05:00
SamuXarick 60ccab3c52
Fix #9908: Close company windows only after all its infrastructure is removed (#9912) 2022-11-08 09:44:17 -05:00
SamuXarick 8c4a70e05e
Fix: Refresh company window when switching companies (#9910) 2022-11-07 17:54:04 -05:00
Tyler Trahan 3d45bc4abe Feature: Build objects by area 2022-10-16 18:28:08 +02:00
Tyler Trahan 07443969f9 Fix ca19a0d: Network hosts also use favorite face 2022-09-21 12:39:07 +02:00
Tyler Trahan 6d84b1e108 Fix ca19a0d: Send the proper network command when loading favorite face 2022-09-21 12:39:07 +02:00
Tyler Trahan 788b06fe0f
Change: New player companies use favorite manager face, if saved (#9895) 2022-08-30 16:26:02 +02:00
Tyler Trahan ec90fb4c99 Fix #6544: Don't join AI company when loading network game in singleplayer 2022-04-30 19:36:09 +02: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
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
J0anJosep d9a37c915f Cleanup #9725: Replace cmd_helper related functions and remove cmd_helper.h. 2022-02-02 21:30:15 +01:00
Michael Lutz 13528bfcd0 Codechange: Un-bitstuff all remaining 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 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
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
rubidium42 661728558e Codechange: let IsUnique.* functions accept std::string 2021-05-29 19:02:18 +02:00
rubidium42 ae85af98eb Codechange: Use std::string GetString where convenient 2021-05-15 10:20:50 +02:00
rubidium42 297d6e20bf Codechange: [Network] Pass passwords as std::string to the network code 2021-05-14 23:22:04 +02:00
rubidium42 c73d64adf9 Codechange: move passwords in settings to std::string 2021-05-13 23:13:17 +02:00
Patric Stout ff708c2c65 Add: admin menu for companies in multiplayer games
You can now easily do:
- a password reset (unlock)
- remove an empty company (reset company)
2021-04-24 21:43:58 +02:00
Patric Stout 5266359424 Feature: rework in-game Online Players GUI
The GUI now more clearly shows some basic information about the
server you joined, your client name (and the ability to change it),
and what players are in which company.

It also contains useful buttons to press to join companies, chat
with other people, and for admins to kick/ban people.

Additionally, renamed "advertised" to "visibility"; this has to
do with future additions, but also because it is more clear in
wording.
2021-04-24 21:43:58 +02:00
dP 56911a86ea Add: Buttons to open global goals from company goals and vice versa 2021-03-08 18:18:47 +00:00
Patric Stout 40505e645a Fix: terraform limit acted random when maxing out per_64k_frames setting
uint32 + uint32 can overflow, so cast it to uint64 first.
2021-03-01 16:35:16 +01:00
Patric Stout 25e5a92286 Fix 9b800a96: (a << 16) is unsigned, so don't remove the cast 2021-03-01 16:35:16 +01:00
Patric Stout 2d9062bfc1 Fix: [Network] don't desync if client leaves before you finish downloading map
When you are downloading a map, all the commands are queued up
for you. Clients joining/leaving is done by the network protocol,
and as such are processed immediately. This means that by the
time you are processing the commands, a client that triggered
it, might already have left.

So, all commands that do something with ClientID, shouldn't
error on an invalid ClientID when DC_EXEC is set, but
gracefully handle the command anyway, to make sure the
game-state is kept in sync with all the clients that did
execute the DoCommand while the now-gone client was still
there.

Additionally, in the small chance a client disconnects between
the server validating a DoCommand and the command being
executed, also just process the command as if the client was
still there. Otherwise, lag or latency can cause clients that
did not receive the disconnect yet to desync.
2021-02-28 12:27:04 +01:00
Jonathan G Rennison 15b99f2e7a
Fix: Whole status bar instead of money widget refreshed on money change (#8692)
This could result in the rest of the status bar being
redrawn unnecessarily frequently
2021-02-18 12:29:30 +01:00
glx22 6b8ad5a9b1 Change: Apply some consistency to singleplayer related comments 2021-01-22 22:19:55 +01:00