diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/pool_func.hpp | 6 | ||||
-rw-r--r-- | src/network/network_server.cpp | 17 | ||||
-rw-r--r-- | src/script/api/script_object.hpp | 1 | ||||
-rw-r--r-- | src/script/api/script_vehiclelist.cpp | 2 | ||||
-rw-r--r-- | src/strings.cpp | 2 |
5 files changed, 20 insertions, 8 deletions
diff --git a/src/core/pool_func.hpp b/src/core/pool_func.hpp index 8f53c66f9..729f7d84a 100644 --- a/src/core/pool_func.hpp +++ b/src/core/pool_func.hpp @@ -107,7 +107,11 @@ DEFINE_POOL_METHOD(inline void *)::AllocateItem(size_t size, size_t index) assert(sizeof(Titem) == size); item = (Titem *)this->alloc_cache; this->alloc_cache = this->alloc_cache->next; - if (Tzero) MemSetT(item, 0); + if (Tzero) { + /* Explicitly casting to (void *) prevets a clang warning - + * we are actually memsetting a (not-yet-constructed) object */ + memset((void *)item, 0, sizeof(Titem)); + } } else if (Tzero) { item = (Titem *)CallocT<byte>(size); } else { diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index 42d5ed9d5..9e0c212ff 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -2100,11 +2100,18 @@ void NetworkPrintClients() { NetworkClientInfo *ci; FOR_ALL_CLIENT_INFOS(ci) { - IConsolePrintF(CC_INFO, _network_server ? "Client #%1d name: '%s' company: %1d IP: %s" : "Client #%1d name: '%s' company: %1d", - ci->client_id, - ci->client_name, - ci->client_playas + (Company::IsValidID(ci->client_playas) ? 1 : 0), - _network_server ? (ci->client_id == CLIENT_ID_SERVER ? "server" : NetworkClientSocket::GetByClientID(ci->client_id)->GetClientIP()) : ""); + if (_network_server) { + IConsolePrintF(CC_INFO, "Client #%1d name: '%s' company: %1d IP: %s", + ci->client_id, + ci->client_name, + ci->client_playas + (Company::IsValidID(ci->client_playas) ? 1 : 0), + ci->client_id == CLIENT_ID_SERVER ? "server" : NetworkClientSocket::GetByClientID(ci->client_id)->GetClientIP()); + } else { + IConsolePrintF(CC_INFO, "Client #%1d name: '%s' company: %1d", + ci->client_id, + ci->client_name, + ci->client_playas + (Company::IsValidID(ci->client_playas) ? 1 : 0)); + } } } diff --git a/src/script/api/script_object.hpp b/src/script/api/script_object.hpp index 4a39e618e..ba90f0c79 100644 --- a/src/script/api/script_object.hpp +++ b/src/script/api/script_object.hpp @@ -33,6 +33,7 @@ typedef bool (ScriptModeProc)(); */ class ScriptObject : public SimpleCountedObject { friend class ScriptInstance; +friend class ScriptController; protected: /** * A class that handles the current active instance. By instantiating it at diff --git a/src/script/api/script_vehiclelist.cpp b/src/script/api/script_vehiclelist.cpp index b8354acd3..3017266fa 100644 --- a/src/script/api/script_vehiclelist.cpp +++ b/src/script/api/script_vehiclelist.cpp @@ -123,7 +123,7 @@ ScriptVehicleList_DefaultGroup::ScriptVehicleList_DefaultGroup(ScriptVehicle::Ve const Vehicle *v; FOR_ALL_VEHICLES(v) { if (v->owner == ScriptObject::GetCompany() && v->IsPrimaryVehicle()) { - if (v->type == vehicle_type && v->group_id == ScriptGroup::GROUP_DEFAULT) this->AddItem(v->index); + if (v->type == (::VehicleType)vehicle_type && v->group_id == ScriptGroup::GROUP_DEFAULT) this->AddItem(v->index); } } } diff --git a/src/strings.cpp b/src/strings.cpp index 9358e6cba..40e31cea8 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -288,7 +288,7 @@ static char *FormatNumber(char *buff, int64 number, const char *last, const char quot = num / divisor; num = num % divisor; } - if (tot |= quot || i >= max_digits - zerofill) { + if ((tot |= quot) || i >= max_digits - zerofill) { buff += seprintf(buff, last, "%i", (int)quot); if ((i % 3) == thousands_offset && i < max_digits - 1 - fractional_digits) buff = strecpy(buff, separator, last); } |