Commit Graph

429 Commits (5b7db9d849df52c7144434ed57ff5664572d6eac)

Author SHA1 Message Date
Jonathan G Rennison 5b7db9d849 Merge branch 'master' into jgrpp
# Conflicts:
#	.github/workflows/ci-build.yml
#	.github/workflows/commit-checker.yml
#	src/command.cpp
#	src/company_cmd.cpp
#	src/company_gui.cpp
#	src/crashlog.cpp
#	src/economy.cpp
#	src/lang/english.txt
#	src/lang/german.txt
#	src/lang/korean.txt
#	src/misc_gui.cpp
#	src/newgrf_config.cpp
#	src/openttd.cpp
#	src/settings_gui.cpp
#	src/ship_cmd.cpp
#	src/table/settings/gui_settings.ini
2 years ago
Tyler Trahan ec90fb4c99 Fix #6544: Don't join AI company when loading network game in singleplayer 2 years ago
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).
2 years ago
Rubidium c73f578e8c Codechange: replace magic numbers and C-style arrays with C++-style array for share owners 2 years ago
J0anJosep d9a37c915f Cleanup #9725: Replace cmd_helper related functions and remove cmd_helper.h. 2 years ago
Michael Lutz 13528bfcd0 Codechange: Un-bitstuff all remaining commands. 2 years ago
Michael Lutz 4f3ea3907e Codechange: Un-bitstuff commands taking a ClientID (i.e. CMD_CLIENT_ID). 2 years ago
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.
2 years ago
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.
2 years ago
Michael Lutz 7048e1522f Codechange: Move flags in CommandProc in front of the command arguments. 2 years ago
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.
2 years ago
Michael Lutz 549caca39c Codechange: Move command arguments to the back of the networked command function calls. 2 years ago
Michael Lutz b6933a2ebd Codechange: Move command arguments to the back of the DoCommand function call. 2 years ago
Jonathan G Rennison 62afd94b47 Merge branch 'master' into jgrpp-beta
# Conflicts:
#	src/company_cmd.cpp
#	src/economy.cpp
#	src/lang/swedish.txt
#	src/network/network_command.cpp
#	src/news_gui.cpp
#	src/saveload/saveload.h
#	src/script/api/script_list.cpp
#	src/video/cocoa/cocoa_v.mm
#	src/video/sdl2_v.cpp
3 years ago
Jonathan G Rennison 61cc60099a Merge branch 'jgrpp' into jgrpp-beta
# Conflicts:
#	src/network/core/packet.cpp
#	src/network/core/udp.cpp
3 years ago
Jonathan G Rennison 28fd549808 Decline company takeover offer on company's behalf if company has no client 3 years ago
Jonathan G Rennison 296987153b Add console command to offer a company for sale 3 years ago
Jonathan G Rennison ec8512e2ea When declining to buy a company, ask the next company immediately 3 years ago
Jonathan G Rennison 4042480806 Merge branch 'jgrpp' into jgrpp-beta
# Conflicts:
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/settings_internal.h
#	src/table/company_settings.ini
#	src/table/currency_settings.ini
#	src/table/gameopt_settings.ini
#	src/table/misc_settings.ini
#	src/table/settings.h.preamble
#	src/table/settings.ini
#	src/table/win32_settings.ini
#	src/table/window_settings.ini
3 years ago
Jonathan G Rennison 24fdc8331b Add CheckCaches mode to emit a log/save/screenshot on detected issue 3 years ago
Jonathan G Rennison 5ed7aee8d3 Add flags field to CheckCaches for which checks to run
Add header file for CheckCaches
3 years ago
Jonathan G Rennison fd605e3cf3 Merge branch 'master' into jgrpp-beta
# Conflicts:
#	.github/workflows/commit-checker.yml
#	src/company_cmd.cpp
#	src/console_cmds.cpp
#	src/crashlog.cpp
#	src/lang/english.txt
#	src/lang/german.txt
#	src/lang/indonesian.txt
#	src/lang/japanese.txt
#	src/lang/korean.txt
#	src/lang/swedish.txt
#	src/linkgraph/linkgraphjob.cpp
#	src/linkgraph/mcf.cpp
#	src/network/core/tcp.cpp
#	src/network/core/tcp.h
#	src/network/core/tcp_game.h
#	src/network/core/udp.h
#	src/network/network.cpp
#	src/network/network_admin.cpp
#	src/network/network_admin.h
#	src/network/network_chat_gui.cpp
#	src/network/network_client.cpp
#	src/network/network_client.h
#	src/network/network_func.h
#	src/network/network_internal.h
#	src/network/network_server.cpp
#	src/network/network_server.h
#	src/newgrf.cpp
#	src/newgrf_station.cpp
#	src/order_gui.cpp
#	src/rail_cmd.cpp
#	src/saveload/saveload.cpp
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/settings_internal.h
#	src/settings_type.h
#	src/station_cmd.cpp
#	src/stdafx.h
#	src/table/currency_settings.ini
#	src/table/misc_settings.ini
#	src/table/settings.h.preamble
#	src/table/settings.ini
#	src/terraform_cmd.cpp
#	src/timetable_gui.cpp
#	src/train_cmd.cpp
#	src/tree_cmd.cpp
#	src/water_cmd.cpp
3 years ago
rubidium42 9a7750f14e Codechange: use the constructor for CompanyNewsItem to fill the data instead of a separate function 3 years ago
rubidium42 aa9818db90 Codechange: create a type for the "free_data" of NewsItems and (de)allocate it with new and delete 3 years ago
Patric Stout 5b50ae72f8 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.

(cherry picked from commit ef25afd55a)
3 years ago
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.
3 years ago
glx22 5799402f7a Codechange: Rename window related DeleteXXX to match new behaviour 3 years ago
rubidium42 2e136285e1 Codechange: move from C-string to std::string for DoCommand 3 years ago
rubidium42 661728558e Codechange: let IsUnique.* functions accept std::string 3 years ago
rubidium42 ae85af98eb Codechange: Use std::string GetString where convenient 3 years ago
rubidium42 297d6e20bf Codechange: [Network] Pass passwords as std::string to the network code 3 years ago
rubidium42 c73d64adf9 Codechange: move passwords in settings to std::string 3 years ago
Jonathan G Rennison 8eb27e1ac7 Merge branch 'master' into jgrpp
# Conflicts:
#	src/company_cmd.cpp
#	src/lang/japanese.txt
#	src/network/core/config.h
#	src/network/core/packet.cpp
#	src/network/core/tcp.cpp
#	src/network/network_content.cpp
#	src/network/network_server.cpp
#	src/network/network_udp.cpp
#	src/toolbar_gui.cpp
#	src/vehicle_gui_base.h
3 years ago
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)
3 years ago
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.
3 years ago
Jonathan G Rennison 5e14b54a0c Merge branch 'master' into jgrpp 3 years ago
dP 56911a86ea Add: Buttons to open global goals from company goals and vice versa 3 years ago
Jonathan G Rennison 84a7ab180e Merge branch 'master' into jgrpp
# Conflicts:
#	src/company_cmd.cpp
#	src/lang/greek.txt
#	src/table/settings.ini
3 years ago
Patric Stout 729df75d3e 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.

(cherry picked from commit 2d9062bfc1)
3 years ago
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.
3 years ago
Patric Stout 25e5a92286 Fix 9b800a96: (a << 16) is unsigned, so don't remove the cast 3 years ago
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.
3 years ago
Jonathan G Rennison e95216b59d Merge branch 'master' into jgrpp
# Conflicts:
#	src/company_cmd.cpp
#	src/core/geometry_func.cpp
#	src/date.cpp
#	src/genworld_gui.cpp
#	src/gfx.cpp
#	src/object_gui.cpp
#	src/openttd.cpp
#	src/settings_type.h
#	src/video/allegro_v.cpp
#	src/video/dedicated_v.cpp
#	src/video/null_v.cpp
#	src/video/sdl2_v.cpp
#	src/video/sdl_v.cpp
#	src/video/win32_v.cpp
3 years ago
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
3 years ago
Jonathan G Rennison 650d5e014e Merge branch 'master' into jgrpp
# Conflicts:
#	src/ai/ai_gui.cpp
#	src/company_cmd.cpp
#	src/lang/estonian.txt
#	src/lang/german.txt
#	src/lang/hungarian.txt
#	src/lang/korean.txt
#	src/lang/slovak.txt
#	src/main_gui.cpp
#	src/video/sdl2_v.cpp
3 years ago
Jonathan G Rennison b7ddd486cf Merge branch 'master' into jgrpp
# Conflicts:
#	cmake/CompileFlags.cmake
#	src/aircraft_cmd.cpp
#	src/blitter/32bpp_anim.cpp
#	src/cargopacket.cpp
#	src/cheat_gui.cpp
#	src/company_cmd.cpp
#	src/company_gui.cpp
#	src/core/pool_func.hpp
#	src/date.cpp
#	src/economy.cpp
#	src/error_gui.cpp
#	src/ground_vehicle.cpp
#	src/ground_vehicle.hpp
#	src/group_gui.cpp
#	src/industry_cmd.cpp
#	src/lang/dutch.txt
#	src/lang/french.txt
#	src/lang/german.txt
#	src/linkgraph/linkgraph_gui.cpp
#	src/linkgraph/mcf.cpp
#	src/network/network_content.cpp
#	src/network/network_server.cpp
#	src/network/network_udp.cpp
#	src/newgrf_engine.cpp
#	src/newgrf_station.cpp
#	src/order_cmd.cpp
#	src/order_gui.cpp
#	src/pathfinder/follow_track.hpp
#	src/pathfinder/yapf/yapf_common.hpp
#	src/saveload/saveload.cpp
#	src/settings_gui.cpp
#	src/station_cmd.cpp
#	src/station_kdtree.h
#	src/string_func.h
#	src/table/settings.ini
#	src/tgp.cpp
#	src/timetable_cmd.cpp
#	src/timetable_gui.cpp
#	src/toolbar_gui.cpp
#	src/town_cmd.cpp
#	src/train_cmd.cpp
#	src/train_gui.cpp
#	src/tree_gui.cpp
#	src/tunnelbridge_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_gui.cpp
#	src/video/sdl2_v.cpp
#	src/video/sdl_v.cpp
#	src/video/win32_v.cpp
#	src/viewport.cpp
#	src/viewport_sprite_sorter_sse4.cpp
#	src/window.cpp
3 years ago
glx22 6b8ad5a9b1 Change: Apply some consistency to singleplayer related comments 3 years ago
glx22 485aafc1b7 Fix: Never delete the last existing company in singleplayer mode 3 years ago
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 3 years ago
Patric Stout 62cdadb582 Change: move "give money" from client-list to company window
This is a much better location for this button, as you send
money from one company to another company, not from player
to player.

This is based on work done by JGRPP in:
f820543391
and surrounding commits, which took the work from estys:
https://www.tt-forums.net/viewtopic.php?p=1183311#p1183311

We did modify it to fix several bugs and clean up the code while
here anyway.

The callback was removed, as it meant a modified client could
prevent anyone from seeing money was transfered. The message
is now generated in the command itself, making that impossible.
3 years ago