(svn r23941) -Add: support for clang

This commit is contained in:
smatz
2012-02-12 21:17:32 +00:00
parent f4de9b8a37
commit b5525fd33d
7 changed files with 78 additions and 12 deletions

View File

@@ -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 {

View File

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

View File

@@ -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

View File

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

View File

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