Changeset - r25407:b37c2c854ce5
[Not reviewed]
src/console_cmds.cpp
Show inline comments
 
@@ -482,13 +482,13 @@ static bool ConKickOrBan(const char *arg
 

	
 
		/* Don't kill the server, or the client doing the rcon. The latter can't be kicked because
 
		 * kicking frees closes and subsequently free the connection related instances, which we
 
		 * would be reading from and writing to after returning. So we would read or write data
 
		 * from freed memory up till the segfault triggers. */
 
		if (client_id == CLIENT_ID_SERVER || client_id == _redirect_console_to_client) {
 
			IConsolePrintF(CC_ERROR, "ERROR: Silly boy, you can not %s yourself!", ban ? "ban" : "kick");
 
			IConsolePrintF(CC_ERROR, "ERROR: You can not %s yourself!", ban ? "ban" : "kick");
 
			return true;
 
		}
 

	
 
		NetworkClientInfo *ci = NetworkClientInfo::GetByClientID(client_id);
 
		if (ci == nullptr) {
 
			IConsoleError("Invalid client");
 
@@ -541,13 +541,13 @@ DEF_CONSOLE_CMD(ConKick)
 

	
 
DEF_CONSOLE_CMD(ConBan)
 
{
 
	if (argc == 0) {
 
		IConsoleHelp("Ban a client from a network game. Usage: 'ban <ip | client-id> [<ban-reason>]'");
 
		IConsoleHelp("For client-id's, see the command 'clients'");
 
		IConsoleHelp("If the client is no longer online, you can still ban his/her IP");
 
		IConsoleHelp("If the client is no longer online, you can still ban their IP");
 
		return true;
 
	}
 

	
 
	if (argc != 2 && argc != 3) return false;
 

	
 
	/* No reason supplied for kicking */
 
@@ -803,18 +803,18 @@ DEF_CONSOLE_CMD(ConMoveClient)
 
	if (company_id != COMPANY_SPECTATOR && !Company::IsHumanID(company_id)) {
 
		IConsoleError("You cannot move clients to AI companies.");
 
		return true;
 
	}
 

	
 
	if (ci->client_id == CLIENT_ID_SERVER && _network_dedicated) {
 
		IConsoleError("Silly boy, you cannot move the server!");
 
		IConsoleError("You cannot move the server!");
 
		return true;
 
	}
 

	
 
	if (ci->client_playas == company_id) {
 
		IConsoleError("You cannot move someone to where he/she already is!");
 
		IConsoleError("You cannot move someone to where they already are!");
 
		return true;
 
	}
 

	
 
	/* we are the server, so force the update */
 
	NetworkServerDoMove(ci->client_id, company_id);
 

	
src/economy.cpp
Show inline comments
 
@@ -604,13 +604,13 @@ static void CompanyCheckBankrupt(Company
 
		 * after 9 months (if it still had value after 6 months) */
 
		default:
 
		case 10: {
 
			if (!_networking && _local_company == c->index) {
 
				/* If we are in singleplayer mode, leave the company playing. Eg. there
 
				 * is no THE-END, otherwise mark the client as spectator to make sure
 
				 * he/she is no long in control of this company. However... when you
 
				 * they are no longer in control of this company. However... when you
 
				 * join another company (cheat) the "unowned" company can bankrupt. */
 
				c->bankrupt_asked = MAX_UVALUE(CompanyMask);
 
				break;
 
			}
 

	
 
			/* Actually remove the company, but not when we're a network client.
src/industry_cmd.cpp
Show inline comments
 
@@ -2576,13 +2576,13 @@ static void CanCargoServiceIndustry(Carg
 
	}
 
}
 

	
 
/**
 
 * Compute who can service the industry.
 
 *
 
 * Here, 'can service' means that he/she has trains and stations close enough
 
 * Here, 'can service' means that they have trains and stations close enough
 
 * to the industry with the right cargo type and the right orders (ie has the
 
 * technical means).
 
 *
 
 * @param ind: Industry being investigated.
 
 *
 
 * @return: 0 if nobody can service the industry, 2 if the local company can
src/network/network_client.cpp
Show inline comments
 
@@ -191,14 +191,14 @@ NetworkRecvStatus ClientNetworkGameSocke
 
/**
 
 * Handle an error coming from the client side.
 
 * @param res The "error" that happened.
 
 */
 
void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res)
 
{
 
	/* First, send a CLIENT_ERROR to the server, so he knows we are
 
	 *  disconnection (and why!) */
 
	/* First, send a CLIENT_ERROR to the server, so it knows we are
 
	 *  disconnected (and why!) */
 
	NetworkErrorCode errorno;
 

	
 
	/* We just want to close the connection.. */
 
	if (res == NETWORK_RECV_STATUS_CLOSE_QUERY) {
 
		this->NetworkSocketHandler::CloseConnection();
 
		this->CloseConnection(res);
 
@@ -290,13 +290,13 @@ void ClientNetworkGameSocketHandler::Cli
 
				my_client->ClientError(NETWORK_RECV_STATUS_DESYNC);
 
				return false;
 
			}
 

	
 
			/* If this is the first time we have a sync-frame, we
 
			 *   need to let the server know that we are ready and at the same
 
			 *   frame as he is.. so we can start playing! */
 
			 *   frame as it is.. so we can start playing! */
 
			if (_network_first_time) {
 
				_network_first_time = false;
 
				SendAck();
 
			}
 

	
 
			_sync_frame = 0;
 
@@ -1396,13 +1396,13 @@ void NetworkClientSendChat(NetworkAction
 
void NetworkClientSetCompanyPassword(const char *password)
 
{
 
	MyClient::SendSetPassword(password);
 
}
 

	
 
/**
 
 * Tell whether the client has team members where he/she can chat to.
 
 * Tell whether the client has team members who they can chat to.
 
 * @param cio client to check members of.
 
 * @return true if there is at least one team member.
 
 */
 
bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio)
 
{
 
	/* Only companies actually playing can speak to team. Eg spectators cannot */
src/network/network_server.cpp
Show inline comments
 
@@ -1024,13 +1024,13 @@ NetworkRecvStatus ServerNetworkGameSocke
 
		this->GetClientName(client_name, lastof(client_name));
 

	
 
		NetworkTextMessage(NETWORK_ACTION_JOIN, CC_DEFAULT, false, client_name, nullptr, this->client_id);
 
		InvalidateWindowData(WC_CLIENT_LIST, 0);
 

	
 
		/* Mark the client as pre-active, and wait for an ACK
 
		 *  so we know he is done loading and in sync with us */
 
		 *  so we know it is done loading and in sync with us */
 
		this->status = STATUS_PRE_ACTIVE;
 
		NetworkHandleCommandQueue(this);
 
		this->SendFrame();
 
		this->SendSync();
 

	
 
		/* This is the frame the client receives
 
@@ -1196,13 +1196,13 @@ NetworkRecvStatus ServerNetworkGameSocke
 

	
 
	/* The client is trying to catch up with the server */
 
	if (this->status == STATUS_PRE_ACTIVE) {
 
		/* The client is not yet caught up? */
 
		if (frame + DAY_TICKS < _frame_counter) return NETWORK_RECV_STATUS_OKAY;
 

	
 
		/* Now he is! Unpause the game */
 
		/* Now it is! Unpause the game */
 
		this->status = STATUS_ACTIVE;
 
		this->last_token_frame = _frame_counter;
 

	
 
		/* Execute script for, e.g. MOTD */
 
		IConsoleCmdExec("exec scripts/on_server_connect.scr 0");
 
	}
 
@@ -1852,20 +1852,20 @@ void NetworkServer_Tick(bool send_frame)
 
					continue;
 
				}
 
				break;
 

	
 
			case NetworkClientSocket::STATUS_MAP_WAIT:
 
				/* Send every two seconds a packet to the client, to make sure
 
				 * he knows the server is still there; just someone else is
 
				 * it knows the server is still there; just someone else is
 
				 * still receiving the map. */
 
				if (std::chrono::steady_clock::now() > cs->last_packet + std::chrono::seconds(2)) {
 
					cs->SendWait();
 
					/* We need to reset the timer, as otherwise we will be
 
					 * spamming the client. Strictly speaking this variable
 
					 * tracks when we last received a packet from the client,
 
					 * but as he is waiting, he will not send us any till we
 
					 * but as it is waiting, it will not send us any till we
 
					 * start sending him data. */
 
					cs->last_packet = std::chrono::steady_clock::now();
 
				}
 
				break;
 

	
 
			case NetworkClientSocket::STATUS_MAP:
src/network/network_server.h
Show inline comments
 
@@ -69,13 +69,13 @@ public:
 
	uint32 last_token_frame;     ///< The last frame we received the right token
 
	ClientStatus status;         ///< Status of this client
 
	CommandQueue outgoing_queue; ///< The command-queue awaiting delivery
 
	size_t receive_limit;        ///< Amount of bytes that we can receive at this moment
 

	
 
	struct PacketWriter *savegame; ///< Writer used to write the savegame.
 
	NetworkAddress client_address; ///< IP-address of the client (so he can be banned)
 
	NetworkAddress client_address; ///< IP-address of the client (so they can be banned)
 

	
 
	ServerNetworkGameSocketHandler(SOCKET s);
 
	~ServerNetworkGameSocketHandler();
 

	
 
	virtual Packet *ReceivePacket() override;
 
	NetworkRecvStatus CloseConnection(NetworkRecvStatus status) override;
src/openttd.cpp
Show inline comments
 
@@ -649,13 +649,13 @@ int openttd_main(int argc, char *argv[])
 
			break;
 
		}
 
		if (i == -2) break;
 
	}
 

	
 
	if (i == -2 || mgo.numleft > 0) {
 
		/* Either the user typed '-h', he made an error, or he added unrecognized command line arguments.
 
		/* Either the user typed '-h', they made an error, or they added unrecognized command line arguments.
 
		 * In all cases, print the help, and exit.
 
		 *
 
		 * The next two functions are needed to list the graphics sets. We can't do them earlier
 
		 * because then we cannot show it on the debug console as that hasn't been configured yet. */
 
		DeterminePaths(argv[0]);
 
		TarScanner::DoScan(TarScanner::BASESET);
src/order_cmd.cpp
Show inline comments
 
@@ -657,13 +657,13 @@ static inline bool OrderGoesToStation(co
 
}
 

	
 
/**
 
 * Delete all news items regarding defective orders about a vehicle
 
 * This could kill still valid warnings (for example about void order when just
 
 * another order gets added), but assume the company will notice the problems,
 
 * when (s)he's changing the orders.
 
 * when they're changing the orders.
 
 */
 
static void DeleteOrderWarnings(const Vehicle *v)
 
{
 
	DeleteVehicleNews(v->index, STR_NEWS_VEHICLE_HAS_TOO_FEW_ORDERS);
 
	DeleteVehicleNews(v->index, STR_NEWS_VEHICLE_HAS_VOID_ORDER);
 
	DeleteVehicleNews(v->index, STR_NEWS_VEHICLE_HAS_DUPLICATE_ENTRY);
src/roadveh_cmd.cpp
Show inline comments
 
@@ -1254,13 +1254,13 @@ again:
 
					 * for 'big' corners. It furthermore does not go to the next tile,
 
					 * so that needs to be fixed too.
 
					 */
 
					tile = v->tile;
 
					start_frame = RVC_TURN_AROUND_START_FRAME_SHORT_TRAM;
 
				} else {
 
					/* The company can build on the next tile, so wait till (s)he does. */
 
					/* The company can build on the next tile, so wait till they do. */
 
					v->cur_speed = 0;
 
					return false;
 
				}
 
			} else if (IsNormalRoadTile(v->tile) && GetDisallowedRoadDirections(v->tile) != DRD_NONE) {
 
				v->cur_speed = 0;
 
				return false;
src/saveload/ai_sl.cpp
Show inline comments
 
@@ -95,13 +95,13 @@ static void Load_AIPL()
 
						DEBUG(script, 0, "A random available AI will be loaded now.");
 
					}
 
				} else {
 
					DEBUG(script, 0, "The savegame has an AI by the name '%s', version %d which is no longer available.", _ai_saveload_name, _ai_saveload_version);
 
					DEBUG(script, 0, "The latest version of that AI has been loaded instead, but it'll not get the savegame data as it's incompatible.");
 
				}
 
				/* Make sure the AI doesn't get the saveload data, as he was not the
 
				/* Make sure the AI doesn't get the saveload data, as it was not the
 
				 *  writer of the saveload data in the first place */
 
				_ai_saveload_version = -1;
 
			}
 
		}
 

	
 
		config->StringToSettings(_ai_saveload_settings);
src/saveload/game_sl.cpp
Show inline comments
 
@@ -87,13 +87,13 @@ static void Load_GSDT()
 
					DEBUG(script, 0, "This game will continue to run without GameScript.");
 
				}
 
			} else {
 
				DEBUG(script, 0, "The savegame has an GameScript by the name '%s', version %d which is no longer available.", _game_saveload_name, _game_saveload_version);
 
				DEBUG(script, 0, "The latest version of that GameScript has been loaded instead, but it'll not get the savegame data as it's incompatible.");
 
			}
 
			/* Make sure the GameScript doesn't get the saveload data, as he was not the
 
			/* Make sure the GameScript doesn't get the saveload data, as it was not the
 
			 *  writer of the saveload data in the first place */
 
			_game_saveload_version = -1;
 
		}
 
	}
 

	
 
	config->StringToSettings(_game_saveload_settings);
src/saveload/saveload.h
Show inline comments
 
@@ -310,13 +310,13 @@ enum SaveLoadVersion : uint16 {
 
	 * has been closing, up to the point we would start to reuse versions from
 
	 * their patchpacks. This is not a problem from our perspective: the
 
	 * savegame will simply fail to load because they all contain chunks we
 
	 * cannot digest. But, this gives for ugly errors. As we have plenty of
 
	 * versions anyway, we simply skip the versions we know belong to
 
	 * patchpacks. This way we can present the user with a clean error
 
	 * indicate he is loading a savegame from a patchpack.
 
	 * indicate they are loading a savegame from a patchpack.
 
	 * For future patchpack creators: please follow a system like JGRPP, where
 
	 * the version is masked with 0x8000, and the true version is stored in
 
	 * its own chunk with feature toggles.
 
	 */
 
	SLV_START_PATCHPACKS,                   ///< 220  First known patchpack to use a version just above ours.
 
	SLV_END_PATCHPACKS = 286,               ///< 286  Last known patchpack to use a version just above ours.
src/script/api/script_companymode.hpp
Show inline comments
 
@@ -34,13 +34,13 @@ private:
 

	
 
public:
 
	/**
 
	 * Creating instance of this class switches the company used for queries
 
	 *  and commands.
 
	 * @param company The new company to switch to.
 
	 * @note When the instance is destroyed, he restores the company that was
 
	 * @note When the instance is destroyed, it restores the company that was
 
	 *   current when the instance was created!
 
	 */
 
	ScriptCompanyMode(int company);
 

	
 
	/**
 
	 * Destroying this instance reset the company to that what it was
src/script/api/script_event_types.hpp
Show inline comments
 
@@ -965,13 +965,13 @@ public:
 
	 */
 
	ScriptGoal::QuestionButton GetButton() { return this->button; }
 

	
 
private:
 
	uint16 uniqueid;                   ///< The uniqueid of the question.
 
	ScriptCompany::CompanyID company;  ///< The company given the answer.
 
	ScriptGoal::QuestionButton button; ///< The button he pressed.
 
	ScriptGoal::QuestionButton button; ///< The button that was pressed.
 
};
 

	
 
/**
 
 * Base class for events involving a town and a company.
 
 * @api ai game
 
 */
src/script/api/script_execmode.hpp
Show inline comments
 
@@ -31,13 +31,13 @@ protected:
 
	 */
 
	static bool ModeProc();
 

	
 
public:
 
	/**
 
	 * Creating instance of this class switches the build mode to Execute.
 
	 * @note When the instance is destroyed, he restores the mode that was
 
	 * @note When the instance is destroyed, it restores the mode that was
 
	 *   current when the instance was created!
 
	 */
 
	ScriptExecMode();
 

	
 
	/**
 
	 * Destroying this instance reset the building mode to the mode it was
src/script/api/script_stationlist.hpp
Show inline comments
 
@@ -276,12 +276,12 @@ public:
 
 * @api ai game
 
 * @ingroup ScriptList
 
 */
 
class ScriptStationList_Vehicle : public ScriptList {
 
public:
 
	/**
 
	 * @param vehicle_id The vehicle to get the list of stations he has in its orders from.
 
	 * @param vehicle_id The vehicle to get the list of stations it has in its orders from.
 
	 */
 
	ScriptStationList_Vehicle(VehicleID vehicle_id);
 
};
 

	
 
#endif /* SCRIPT_STATIONLIST_HPP */
src/script/api/script_testmode.hpp
Show inline comments
 
@@ -33,13 +33,13 @@ protected:
 
	 */
 
	static bool ModeProc();
 

	
 
public:
 
	/**
 
	 * Creating instance of this class switches the build mode to Testing.
 
	 * @note When the instance is destroyed, he restores the mode that was
 
	 * @note When the instance is destroyed, it restores the mode that was
 
	 *   current when the instance was created!
 
	 */
 
	ScriptTestMode();
 

	
 
	/**
 
	 * Destroying this instance reset the building mode to the mode it was
src/script/squirrel_class.hpp
Show inline comments
 
@@ -45,13 +45,13 @@ public:
 
		using namespace SQConvert;
 
		engine->AddMethod(function_name, DefSQAdvancedNonStaticCallback<CL, Func, ST>, 0, nullptr, &function_proc, sizeof(function_proc));
 
	}
 

	
 
	/**
 
	 * This defines a method inside a class for Squirrel with defined params.
 
	 * @note If you define nparam, make sure that he first param is always 'x',
 
	 * @note If you define nparam, make sure that the first param is always 'x',
 
	 *  which is the 'this' inside the function. This is hidden from the rest
 
	 *  of the code, but without it calling your function will fail!
 
	 */
 
	template <typename Func>
 
	void DefSQMethod(Squirrel *engine, Func function_proc, const char *function_name, int nparam, const char *params)
 
	{
 
@@ -78,13 +78,13 @@ public:
 
		using namespace SQConvert;
 
		engine->AddMethod(function_name, DefSQAdvancedStaticCallback<CL, Func>, 0, nullptr, &function_proc, sizeof(function_proc));
 
	}
 

	
 
	/**
 
	 * This defines a static method inside a class for Squirrel with defined params.
 
	 * @note If you define nparam, make sure that he first param is always 'x',
 
	 * @note If you define nparam, make sure that the first param is always 'x',
 
	 *  which is the 'this' inside the function. This is hidden from the rest
 
	 *  of the code, but without it calling your function will fail!
 
	 */
 
	template <typename Func>
 
	void DefSQStaticMethod(Squirrel *engine, Func function_proc, const char *function_name, int nparam, const char *params)
 
	{
src/town_cmd.cpp
Show inline comments
 
@@ -3206,13 +3206,13 @@ static CommandCost TownActionFundBuildin
 

	
 
		/* Build a new house, but add a small delay to make sure
 
		 * that spamming funding doesn't let town grow any faster
 
		 * than 1 house per 2 * TOWN_GROWTH_TICKS ticks.
 
		 * Also emulate original behaviour when town was only growing in
 
		 * TOWN_GROWTH_TICKS intervals, to make sure that it's not too
 
		 * tick-perfect and gives player some time window where he can
 
		 * tick-perfect and gives player some time window where they can
 
		 * spam funding with the exact same efficiency.
 
		 */
 
		t->grow_counter = std::min<uint16>(t->grow_counter, 2 * TOWN_GROWTH_TICKS - (t->growth_rate - t->grow_counter) % TOWN_GROWTH_TICKS);
 

	
 
		SetWindowDirty(WC_TOWN_VIEW, t->index);
 
	}
0 comments (0 inline, 0 general)