Changeset - r25407:b37c2c854ce5
[Not reviewed]
src/console_cmds.cpp
Show inline comments
 
@@ -476,25 +476,25 @@ DEF_CONSOLE_CMD(ConClearBuffer)
 
static bool ConKickOrBan(const char *argv, bool ban, const char *reason)
 
{
 
	uint n;
 

	
 
	if (strchr(argv, '.') == nullptr && strchr(argv, ':') == nullptr) { // banning with ID
 
		ClientID client_id = (ClientID)atoi(argv);
 

	
 
		/* 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");
 
			return true;
 
		}
 

	
 
		if (!ban) {
 
			/* Kick only this client, not all clients with that IP */
 
			NetworkServerKickClient(client_id, reason);
 
@@ -535,25 +535,25 @@ DEF_CONSOLE_CMD(ConKick)
 
		IConsolePrintF(CC_ERROR, "ERROR: Maximum kick message length is 254 characters. You entered " PRINTF_SIZE " characters.", kick_message_length);
 
		return false;
 
	} else {
 
		return ConKickOrBan(argv[1], false, argv[2]);
 
	}
 
}
 

	
 
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 */
 
	if (argc == 2) return ConKickOrBan(argv[1], true, nullptr);
 

	
 
	/* Reason for kicking supplied */
 
	size_t kick_message_length = strlen(argv[2]);
 
	if (kick_message_length >= 255) {
 
		IConsolePrintF(CC_ERROR, "ERROR: Maximum kick message length is 254 characters. You entered " PRINTF_SIZE " characters.", kick_message_length);
 
@@ -797,30 +797,30 @@ DEF_CONSOLE_CMD(ConMoveClient)
 

	
 
	if (!Company::IsValidID(company_id) && company_id != COMPANY_SPECTATOR) {
 
		IConsolePrintF(CC_ERROR, "Company does not exist. Company-id must be between 1 and %d.", MAX_COMPANIES);
 
		return true;
 
	}
 

	
 
	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);
 

	
 
	return true;
 
}
 

	
 
DEF_CONSOLE_CMD(ConResetCompany)
 
{
 
	if (argc == 0) {
src/economy.cpp
Show inline comments
 
@@ -598,25 +598,25 @@ static void CompanyCheckBankrupt(Company
 
			/* The company assets should always have some value */
 
			assert(c->bankrupt_value > 0);
 
			break;
 
		}
 

	
 
		/* Bankrupt company after 6 months (if the company has no value) or latest
 
		 * 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.
 
			 * In case of network clients we will be getting a command from the
 
			 * server. It is done in this way as we are called from the
 
			 * StateGameLoop which can't change the current company, and thus
 
			 * updating the local company triggers an assert later on. In the
 
			 * case of a network game the command will be processed at a time
 
			 * that changing the current company is okay. In case of single
src/industry_cmd.cpp
Show inline comments
 
@@ -2570,25 +2570,25 @@ static void CanCargoServiceIndustry(Carg
 
	/* Check for produced cargo */
 
	for (byte j = 0; j < lengthof(ind->produced_cargo); j++) {
 
		if (cargo == ind->produced_cargo[j]) {
 
			*c_produces = true;
 
			break;
 
		}
 
	}
 
}
 

	
 
/**
 
 * 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
 
 * service the industry, and 1 otherwise (only competitors can service the
 
 * industry)
 
 */
 
static int WhoCanServiceIndustry(Industry *ind)
 
{
 
	if (ind->stations_near.size() == 0) return 0; // No stations found at all => nobody services
src/network/network_client.cpp
Show inline comments
 
@@ -185,26 +185,26 @@ NetworkRecvStatus ClientNetworkGameSocke
 
	delete this->GetInfo();
 
	delete this;
 

	
 
	return status;
 
}
 

	
 
/**
 
 * 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);
 
		_networking = false;
 

	
 
		DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
 
		return;
 
	}
 

	
 
@@ -284,25 +284,25 @@ void ClientNetworkGameSocketHandler::Cli
 
#else
 
			if (_sync_seed_1 != _random.state[0]) {
 
#endif
 
				ShowNetworkError(STR_NETWORK_ERROR_DESYNC);
 
				DEBUG(desync, 1, "sync_err: %08x; %02x", _date, _date_fract);
 
				DEBUG(net, 0, "Sync error detected!");
 
				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;
 
		} else if (_sync_frame < _frame_counter) {
 
			DEBUG(net, 1, "Missed frame for sync-test (%d / %d)", _sync_frame, _frame_counter);
 
			_sync_frame = 0;
 
		}
 
	}
 

	
 
@@ -1390,25 +1390,25 @@ void NetworkClientSendChat(NetworkAction
 
}
 

	
 
/**
 
 * Set/Reset company password on the client side.
 
 * @param password Password to be set.
 
 */
 
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 */
 
	if (!_settings_client.gui.prefer_teamchat || !Company::IsValidID(cio->client_playas)) return false;
 

	
 
	for (const NetworkClientInfo *ci : NetworkClientInfo::Iterate()) {
 
		if (ci->client_playas == cio->client_playas && ci != cio) return true;
 
	}
 

	
src/network/network_server.cpp
Show inline comments
 
@@ -1018,25 +1018,25 @@ NetworkRecvStatus ServerNetworkGameSocke
 
NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_MAP_OK(Packet *p)
 
{
 
	/* Client has the map, now start syncing */
 
	if (this->status == STATUS_DONE_MAP && !this->HasClientQuit()) {
 
		char client_name[NETWORK_CLIENT_NAME_LENGTH];
 

	
 
		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
 
		 *  we need it later on to make sure the client is not too slow */
 
		this->last_frame = _frame_counter;
 
		this->last_frame_server = _frame_counter;
 

	
 
		for (NetworkClientSocket *new_cs : NetworkClientSocket::Iterate()) {
 
			if (new_cs->status >= STATUS_AUTHORIZED) {
 
@@ -1190,25 +1190,25 @@ NetworkRecvStatus ServerNetworkGameSocke
 
	if (this->status < STATUS_AUTHORIZED) {
 
		/* Illegal call, return error and ignore the packet */
 
		return this->SendError(NETWORK_ERROR_NOT_AUTHORIZED);
 
	}
 

	
 
	uint32 frame = p->Recv_uint32();
 

	
 
	/* 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");
 
	}
 

	
 
	/* Get, and validate the token. */
 
	uint8 token = p->Recv_uint8();
 
	if (token == this->last_token) {
 
		/* We differentiate between last_token_frame and last_frame so the lag
 
		 * test uses the actual lag of the client instead of the lag for getting
 
@@ -1846,32 +1846,32 @@ void NetworkServer_Tick(bool send_frame)
 
			case NetworkClientSocket::STATUS_AUTHORIZED:
 
				/* NewGRF check and authorized states should be handled almost instantly.
 
				 * So give them some lee-way, likewise for the query with inactive. */
 
				if (lag > _settings_client.network.max_init_time) {
 
					IConsolePrintF(CC_ERROR, "Client #%d is dropped because it took longer than %d ticks to start the joining process", cs->client_id, _settings_client.network.max_init_time);
 
					cs->SendError(NETWORK_ERROR_TIMEOUT_COMPUTER);
 
					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:
 
				/* Downloading the map... this is the amount of time since starting the saving. */
 
				if (lag > _settings_client.network.max_download_time) {
 
					IConsolePrintF(CC_ERROR, "Client #%d is dropped because it took longer than %d ticks to download the map", cs->client_id, _settings_client.network.max_download_time);
 
					cs->SendError(NETWORK_ERROR_TIMEOUT_MAP);
 
					continue;
 
				}
src/network/network_server.h
Show inline comments
 
@@ -63,25 +63,25 @@ public:
 
		STATUS_ACTIVE,        ///< The client is active within in the game.
 
		STATUS_END,           ///< Must ALWAYS be on the end of this list!! (period).
 
	};
 

	
 
	byte lag_test;               ///< Byte used for lag-testing the client
 
	byte last_token;             ///< The last random token we did send to verify the client is listening
 
	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;
 
	void GetClientName(char *client_name, const char *last) const;
 

	
 
	void CheckNextClientToSendMap(NetworkClientSocket *ignore_cs = nullptr);
 

	
 
	NetworkRecvStatus SendWait();
 
	NetworkRecvStatus SendMap();
src/openttd.cpp
Show inline comments
 
@@ -643,25 +643,25 @@ int openttd_main(int argc, char *argv[])
 
		}
 
		case 'G': scanner->generation_seed = strtoul(mgo.opt, nullptr, 10); break;
 
		case 'c': _config_file = mgo.opt; break;
 
		case 'x': scanner->save_config = false; break;
 
		case 'h':
 
			i = -2; // Force printing of help.
 
			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);
 
		BaseGraphics::FindSets();
 
		BaseSounds::FindSets();
 
		BaseMusic::FindSets();
 
		ShowHelp();
 
		return ret;
 
	}
src/order_cmd.cpp
Show inline comments
 
@@ -651,25 +651,25 @@ void OrderList::DebugCheckSanity() const
 
 * @return true if the destination is a station
 
 */
 
static inline bool OrderGoesToStation(const Vehicle *v, const Order *o)
 
{
 
	return o->IsType(OT_GOTO_STATION) ||
 
			(v->type == VEH_AIRCRAFT && o->IsType(OT_GOTO_DEPOT) && !(o->GetDepotActionType() & ODATFB_NEAREST_DEPOT));
 
}
 

	
 
/**
 
 * 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);
 
	DeleteVehicleNews(v->index, STR_NEWS_VEHICLE_HAS_INVALID_ENTRY);
 
	DeleteVehicleNews(v->index, STR_NEWS_PLANE_USES_TOO_SHORT_RUNWAY);
 
}
 

	
 
/**
 
 * Returns a tile somewhat representing the order destination (not suitable for pathfinding).
src/roadveh_cmd.cpp
Show inline comments
 
@@ -1248,25 +1248,25 @@ again:
 
					 * - We are not the from vehicle of an articulated tram.
 
					 * - Or when the company cannot build on the next tile.
 
					 *
 
					 * The 'small' corner means that the vehicle is on the end of a
 
					 * tram track and needs to start turning there. To do this properly
 
					 * the tram needs to start at an offset in the tram turning 'code'
 
					 * 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;
 
			} else {
 
				tile = v->tile;
 
			}
 
		}
 

	
 
		/* Get position data for first frame on the new tile */
src/saveload/ai_sl.cpp
Show inline comments
 
@@ -89,25 +89,25 @@ static void Load_AIPL()
 
				if (!config->HasScript()) {
 
					if (strcmp(_ai_saveload_name, "%_dummy") != 0) {
 
						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, "A random other AI will be loaded in its place.");
 
					} else {
 
						DEBUG(script, 0, "The savegame had no AIs available at the time of saving.");
 
						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);
 

	
 
		/* Start the AI directly if it was active in the savegame */
 
		if (Company::IsValidAiID(index)) {
 
			AI::StartNew(index, false);
 
			AI::Load(index, _ai_saveload_version);
 
		}
src/saveload/game_sl.cpp
Show inline comments
 
@@ -81,25 +81,25 @@ static void Load_GSDT()
 
			if (!config->HasScript()) {
 
				if (strcmp(_game_saveload_name, "%_dummy") != 0) {
 
					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, "This game will continue to run without GameScript.");
 
				} else {
 
					DEBUG(script, 0, "The savegame had no GameScript available at the time of saving.");
 
					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);
 

	
 
	/* Start the GameScript directly if it was active in the savegame */
 
	Game::StartNew();
 
	Game::Load(_game_saveload_version);
 

	
 
	if ((CompanyID)SlIterateArray() != (CompanyID)-1) SlErrorCorrupt("Too many GameScript configs");
src/saveload/saveload.h
Show inline comments
 
@@ -304,25 +304,25 @@ enum SaveLoadVersion : uint16 {
 
	SLV_TRADING_AGE,                        ///< 217  PR#7780 Configurable company trading age.
 
	SLV_ENDING_YEAR,                        ///< 218  PR#7747 v1.10  Configurable ending year.
 
	SLV_REMOVE_TOWN_CARGO_CACHE,            ///< 219  PR#8258 Remove town cargo acceptance and production caches.
 

	
 
	/* Patchpacks for a while considered it a good idea to jump a few versions
 
	 * above our version for their savegames. But as time continued, this gap
 
	 * 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.
 

	
 
	SLV_GS_INDUSTRY_CONTROL,                ///< 287  PR#7912 and PR#8115 GS industry control.
 
	SLV_VEH_MOTION_COUNTER,                 ///< 288  PR#8591 Desync safe motion counter
 
	SLV_INDUSTRY_TEXT,                      ///< 289  PR#8576 v1.11.0-RC1  Additional GS text for industries.
 
	SLV_MAPGEN_SETTINGS_REVAMP,             ///< 290  PR#8891 v1.11  Revamp of some mapgen settings (snow coverage, desert coverage, heightmap height, custom terrain type).
 
	SLV_GROUP_REPLACE_WAGON_REMOVAL,        ///< 291  PR#7441 Per-group wagon removal flag.
src/script/api/script_companymode.hpp
Show inline comments
 
@@ -28,25 +28,25 @@
 
 *  are switched to it.
 
 * @api game
 
 */
 
class ScriptCompanyMode : public ScriptObject {
 
private:
 
	CompanyID last_company; ///< The previous company we were in.
 

	
 
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
 
	 *   in when the instance was created.
 
	 */
 
	~ScriptCompanyMode();
 
};
 

	
 
#endif /* SCRIPT_COMPANYMODE_HPP */
src/script/api/script_event_types.hpp
Show inline comments
 
@@ -959,25 +959,25 @@ public:
 
	 * Get the company that pressed a button.
 
	 */
 
	ScriptCompany::CompanyID GetCompany() { return this->company; }
 

	
 
	/**
 
	 * Get the button that got pressed.
 
	 */
 
	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
 
 */
 
class ScriptEventCompanyTown : public ScriptEvent {
 
public:
 
	/**
 
	 * @param event The eventtype.
 
	 * @param company The company.
 
	 * @param town The town.
src/script/api/script_execmode.hpp
Show inline comments
 
@@ -25,25 +25,25 @@ private:
 
	ScriptModeProc *last_mode;   ///< The previous mode we were in.
 
	ScriptObject *last_instance; ///< The previous instance of the mode.
 

	
 
protected:
 
	/**
 
	 * The callback proc for Execute mode.
 
	 */
 
	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
 
	 *   in when the instance was created.
 
	 */
 
	~ScriptExecMode();
 

	
 
	/**
 
	 * @api -all
src/script/api/script_stationlist.hpp
Show inline comments
 
@@ -270,18 +270,18 @@ public:
 
	 */
 
	ScriptStationList_CargoPlannedFromByVia(StationID station_id, CargoID cargo, StationID from);
 
};
 

	
 
/**
 
 * Creates a list of stations which the vehicle has in its orders.
 
 * @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
 
@@ -27,25 +27,25 @@ private:
 
	ScriptModeProc *last_mode;   ///< The previous mode we were in.
 
	ScriptObject *last_instance; ///< The previous instance of the mode.
 

	
 
protected:
 
	/**
 
	 * The callback proc for Testing mode.
 
	 */
 
	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
 
	 *   in when the instance was created.
 
	 */
 
	~ScriptTestMode();
 

	
 
	/**
 
	 * @api -all
src/script/squirrel_class.hpp
Show inline comments
 
@@ -39,25 +39,25 @@ public:
 
	/**
 
	 * This defines a method inside a class for Squirrel, which has access to the 'engine' (experts only!).
 
	 */
 
	template <typename Func>
 
	void DefSQAdvancedMethod(Squirrel *engine, Func function_proc, const char *function_name)
 
	{
 
		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)
 
	{
 
		using namespace SQConvert;
 
		engine->AddMethod(function_name, DefSQNonStaticCallback<CL, Func, ST>, nparam, params, &function_proc, sizeof(function_proc));
 
	}
 

	
 
	/**
 
	 * This defines a static method inside a class for Squirrel.
 
@@ -72,25 +72,25 @@ public:
 
	/**
 
	 * This defines a static method inside a class for Squirrel, which has access to the 'engine' (experts only!).
 
	 */
 
	template <typename Func>
 
	void DefSQAdvancedStaticMethod(Squirrel *engine, Func function_proc, const char *function_name)
 
	{
 
		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)
 
	{
 
		using namespace SQConvert;
 
		engine->AddMethod(function_name, DefSQStaticCallback<CL, Func>, nparam, params, &function_proc, sizeof(function_proc));
 
	}
 

	
 
	template <typename Var>
 
	void DefSQConst(Squirrel *engine, Var value, const char *var_name)
src/town_cmd.cpp
Show inline comments
 
@@ -3200,25 +3200,25 @@ static CommandCost TownActionFundBuildin
 
	if (flags & DC_EXEC) {
 
		/* And grow for 3 months */
 
		t->fund_buildings_months = 3;
 

	
 
		/* Enable growth (also checking GameScript's opinion) */
 
		UpdateTownGrowth(t);
 

	
 
		/* 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);
 
	}
 
	return CommandCost();
 
}
 

	
 
static CommandCost TownActionBuyRights(Town *t, DoCommandFlag flags)
 
{
 
	/* Check if it's allowed to buy the rights */
0 comments (0 inline, 0 general)