Merge: Codechange: Use null pointer literal instead of the NULL macro
This commit is contained in:
@@ -57,7 +57,7 @@ bool _network_available; ///< is network mode available?
|
||||
bool _network_dedicated; ///< are we a dedicated server?
|
||||
bool _is_network_server; ///< Does this client wants to be a network-server?
|
||||
NetworkServerGameInfo _network_game_info; ///< Information about our game.
|
||||
NetworkCompanyState *_network_company_states = NULL; ///< Statistics about some companies.
|
||||
NetworkCompanyState *_network_company_states = nullptr; ///< Statistics about some companies.
|
||||
ClientID _network_own_client_id; ///< Our client identifier.
|
||||
ClientID _redirect_console_to_client; ///< If not invalid, redirect the console output to a client.
|
||||
bool _network_need_advertise; ///< Whether we need to advertise.
|
||||
@@ -119,7 +119,7 @@ NetworkClientInfo::~NetworkClientInfo()
|
||||
/**
|
||||
* Return the CI given it's client-identifier
|
||||
* @param client_id the ClientID to search for
|
||||
* @return return a pointer to the corresponding NetworkClientInfo struct or NULL when not found
|
||||
* @return return a pointer to the corresponding NetworkClientInfo struct or nullptr when not found
|
||||
*/
|
||||
/* static */ NetworkClientInfo *NetworkClientInfo::GetByClientID(ClientID client_id)
|
||||
{
|
||||
@@ -129,13 +129,13 @@ NetworkClientInfo::~NetworkClientInfo()
|
||||
if (ci->client_id == client_id) return ci;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the client state given it's client-identifier
|
||||
* @param client_id the ClientID to search for
|
||||
* @return return a pointer to the corresponding NetworkClientSocket struct or NULL when not found
|
||||
* @return return a pointer to the corresponding NetworkClientSocket struct or nullptr when not found
|
||||
*/
|
||||
/* static */ ServerNetworkGameSocketHandler *ServerNetworkGameSocketHandler::GetByClientID(ClientID client_id)
|
||||
{
|
||||
@@ -145,7 +145,7 @@ NetworkClientInfo::~NetworkClientInfo()
|
||||
if (cs->client_id == client_id) return cs;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
byte NetworkSpectatorCount()
|
||||
@@ -397,7 +397,7 @@ void NetworkHandlePauseChange(PauseMode prev_mode, PauseMode changed_mode)
|
||||
|
||||
char buffer[DRAW_STRING_BUFFER];
|
||||
GetString(buffer, str, lastof(buffer));
|
||||
NetworkTextMessage(NETWORK_ACTION_SERVER_MESSAGE, CC_DEFAULT, false, NULL, buffer);
|
||||
NetworkTextMessage(NETWORK_ACTION_SERVER_MESSAGE, CC_DEFAULT, false, nullptr, buffer);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -560,7 +560,7 @@ void NetworkClose(bool close_admins)
|
||||
}
|
||||
ServerNetworkGameSocketHandler::CloseListeners();
|
||||
ServerNetworkAdminSocketHandler::CloseListeners();
|
||||
} else if (MyClient::my_client != NULL) {
|
||||
} else if (MyClient::my_client != nullptr) {
|
||||
MyClient::SendQuit();
|
||||
MyClient::my_client->CloseConnection(NETWORK_RECV_STATUS_CONN_LOST);
|
||||
}
|
||||
@@ -573,7 +573,7 @@ void NetworkClose(bool close_admins)
|
||||
NetworkFreeLocalCommandQueue();
|
||||
|
||||
free(_network_company_states);
|
||||
_network_company_states = NULL;
|
||||
_network_company_states = nullptr;
|
||||
|
||||
InitializeNetworkPools(close_admins);
|
||||
}
|
||||
@@ -627,8 +627,8 @@ void NetworkTCPQueryServer(NetworkAddress address)
|
||||
void NetworkAddServer(const char *b)
|
||||
{
|
||||
if (*b != '\0') {
|
||||
const char *port = NULL;
|
||||
const char *company = NULL;
|
||||
const char *port = nullptr;
|
||||
const char *company = nullptr;
|
||||
char host[NETWORK_HOSTNAME_LENGTH];
|
||||
uint16 rport;
|
||||
|
||||
@@ -638,7 +638,7 @@ void NetworkAddServer(const char *b)
|
||||
rport = NETWORK_DEFAULT_PORT;
|
||||
|
||||
ParseConnectionString(&company, &port, host);
|
||||
if (port != NULL) rport = atoi(port);
|
||||
if (port != nullptr) rport = atoi(port);
|
||||
|
||||
NetworkUDPQueryServer(NetworkAddress(host, rport), true);
|
||||
}
|
||||
@@ -668,7 +668,7 @@ void NetworkRebuildHostList()
|
||||
{
|
||||
_network_host_list.clear();
|
||||
|
||||
for (NetworkGameList *item = _network_game_list; item != NULL; item = item->next) {
|
||||
for (NetworkGameList *item = _network_game_list; item != nullptr; item = item->next) {
|
||||
if (item->manually) _network_host_list.emplace_back(item->address.GetAddressAsString(false));
|
||||
}
|
||||
}
|
||||
@@ -907,15 +907,15 @@ void NetworkGameLoop()
|
||||
static std::unique_ptr<CommandPacket> cp;
|
||||
static bool check_sync_state = false;
|
||||
static uint32 sync_state[2];
|
||||
if (f == NULL && next_date == 0) {
|
||||
if (f == nullptr && next_date == 0) {
|
||||
DEBUG(net, 0, "Cannot open commands.log");
|
||||
next_date = 1;
|
||||
}
|
||||
|
||||
while (f != NULL && !feof(f)) {
|
||||
while (f != nullptr && !feof(f)) {
|
||||
if (_date == next_date && _date_fract == next_date_fract) {
|
||||
if (cp != NULL) {
|
||||
NetworkSendCommand(cp->tile, cp->p1, cp->p2, cp->cmd & ~CMD_FLAGS_MASK, NULL, cp->text.c_str(), cp->company, cp->binary_length);
|
||||
if (cp != nullptr) {
|
||||
NetworkSendCommand(cp->tile, cp->p1, cp->p2, cp->cmd & ~CMD_FLAGS_MASK, nullptr, cp->text.c_str(), cp->company, cp->binary_length);
|
||||
DEBUG(net, 0, "injecting: date{%08x; %02x; %02x}; %02x; %06x; %08x; %08x; %08x; \"%s\" (%x) (%s)", _date, _date_fract, _tick_skip_counter, (int)_current_company, cp->tile, cp->p1, cp->p2, cp->cmd, cp->text.c_str(), cp->binary_length, GetCommandName(cp->cmd));
|
||||
cp.reset();
|
||||
}
|
||||
@@ -931,16 +931,16 @@ void NetworkGameLoop()
|
||||
}
|
||||
}
|
||||
|
||||
if (cp != NULL || check_sync_state) break;
|
||||
if (cp != nullptr || check_sync_state) break;
|
||||
|
||||
char buff[4096];
|
||||
if (fgets(buff, lengthof(buff), f) == NULL) break;
|
||||
if (fgets(buff, lengthof(buff), f) == nullptr) break;
|
||||
|
||||
char *p = buff;
|
||||
/* Ignore the "[date time] " part of the message */
|
||||
if (*p == '[') {
|
||||
p = strchr(p, ']');
|
||||
if (p == NULL) break;
|
||||
if (p == nullptr) break;
|
||||
p += 2;
|
||||
}
|
||||
|
||||
@@ -972,7 +972,7 @@ void NetworkGameLoop()
|
||||
cp->cmd = CMD_PAUSE;
|
||||
cp->p1 = PM_PAUSED_NORMAL;
|
||||
cp->p2 = 1;
|
||||
cp->callback = NULL;
|
||||
cp->callback = nullptr;
|
||||
cp->binary_length = 0;
|
||||
_ddc_fastforward = false;
|
||||
} else if (strncmp(p, "sync: ", 6) == 0) {
|
||||
@@ -992,10 +992,10 @@ void NetworkGameLoop()
|
||||
NOT_REACHED();
|
||||
}
|
||||
}
|
||||
if (f != NULL && feof(f)) {
|
||||
if (f != nullptr && feof(f)) {
|
||||
DEBUG(net, 0, "End of commands.log");
|
||||
fclose(f);
|
||||
f = NULL;
|
||||
f = nullptr;
|
||||
}
|
||||
#endif /* DEBUG_DUMP_COMMANDS */
|
||||
if (_frame_counter >= _frame_counter_max) {
|
||||
|
Reference in New Issue
Block a user