Merge branch 'master' into jgrpp
# Conflicts: # cmake/SourceList.cmake # src/build_vehicle_gui.cpp # src/company_gui.cpp # src/console_cmds.cpp # src/depot_base.h # src/elrail.cpp # src/network/core/udp.cpp # src/network/network_admin.cpp # src/network/network_chat_gui.cpp # src/network/network_gui.cpp # src/network/network_server.cpp # src/newgrf.cpp # src/newgrf_engine.cpp # src/newgrf_railtype.cpp # src/newgrf_railtype.h # src/newgrf_storage.h # src/os/unix/crashlog_unix.cpp # src/rail.h # src/rail_cmd.cpp # src/rail_gui.cpp # src/road_cmd.cpp # src/road_map.h # src/saveload/labelmaps_sl.cpp # src/settings_gui.cpp # src/settings_type.h # src/sl/oldloader_sl.cpp # src/station_cmd.cpp # src/station_gui.cpp # src/table/settings/world_settings.ini # src/tests/test_script_admin.cpp # src/textfile_gui.cpp # src/toolbar_gui.cpp # src/train_cmd.cpp # src/tunnelbridge_cmd.cpp # src/vehicle_gui.cpp # src/widget.cpp # src/window.cpp # src/window_gui.h # src/window_type.h
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
#include "../stdafx.h"
|
||||
#include "../strings_func.h"
|
||||
#include "../date_func.h"
|
||||
#include "core/game_info.h"
|
||||
#include "core/network_game_info.h"
|
||||
#include "network_admin.h"
|
||||
#include "network_base.h"
|
||||
#include "network_server.h"
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "../rev.h"
|
||||
#include "../game/game.hpp"
|
||||
|
||||
#include <numeric>
|
||||
|
||||
#include "../safeguards.h"
|
||||
|
||||
|
||||
@@ -382,10 +384,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyEconomy()
|
||||
{
|
||||
for (const Company *company : Company::Iterate()) {
|
||||
/* Get the income. */
|
||||
Money income = 0;
|
||||
for (uint i = 0; i < lengthof(company->yearly_expenses[0]); i++) {
|
||||
income -= company->yearly_expenses[0][i];
|
||||
}
|
||||
Money income = -std::reduce(std::begin(company->yearly_expenses[0]), std::end(company->yearly_expenses[0]));
|
||||
|
||||
Packet *p = new Packet(ADMIN_PACKET_SERVER_COMPANY_ECONOMY);
|
||||
|
||||
@@ -556,11 +555,6 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendConsole(const std::string
|
||||
*/
|
||||
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendGameScript(const std::string_view json)
|
||||
{
|
||||
/* At the moment we cannot transmit anything larger than MTU. So we limit
|
||||
* the maximum amount of json data that can be sent. Account also for
|
||||
* the trailing \0 of the string */
|
||||
if (json.size() + 1 >= NETWORK_GAMESCRIPT_JSON_LENGTH) return NETWORK_RECV_STATUS_OKAY;
|
||||
|
||||
Packet *p = new Packet(ADMIN_PACKET_SERVER_GAMESCRIPT);
|
||||
|
||||
p->Send_string(json);
|
||||
|
Reference in New Issue
Block a user