ShipObject and ShipObject_Components: silence annoying (probably innocuous, useless) warnings in release mode

This commit is contained in:
DarthArgus
2016-01-21 12:02:08 -06:00
parent 284ac30676
commit 5629e5add9
2 changed files with 14 additions and 2 deletions
@@ -1475,8 +1475,13 @@ void ShipObject::constructFromTemplate()
if (shipComponentData != NULL)
{
if (!installComponentFromData(i, *shipComponentData))
if (!installComponentFromData(i, *shipComponentData)) {
#ifdef _DEBUG
WARNING(true, ("ShipObject::constructFromTemplate() failed to install component at slot [%s]", ShipChassisSlotType::getNameFromType(static_cast<ShipChassisSlotType::Type>(i)).c_str()));
#else
continue; //gcc complains without something to do inside this if statement
#endif
}
}
}
}
@@ -1899,21 +1899,24 @@ bool ShipObject::installComponentFromData(int chassisSlot, ShipComponentData con
ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (getChassisType ());
if (shipChassis == NULL)
{
#ifdef _DEBUG
WARNING (true, ("Ship [%s] chassis [%d] is invalid for installing component [%s]",
getNetworkId().getValueString().c_str(),
static_cast<int>(getChassisType ()),
shipComponentData.getDescriptor().getName().getString()));
#endif
return false;
}
if (isSlotInstalled (chassisSlot))
{
#ifdef _DEBUG
WARNING (true, ("Ship [%s] chassis [%s] slot [%s] is already filled, cannot install [%s]",
getNetworkId().getValueString().c_str(),
shipChassis->getName().getString(),
ShipChassisSlotType::getNameFromType(static_cast<ShipChassisSlotType::Type>(chassisSlot)).c_str(),
shipComponentData.getDescriptor().getName().getString()));
#endif
return false;
}
@@ -1925,16 +1928,19 @@ bool ShipObject::installComponentFromData(int chassisSlot, ShipComponentData con
ShipChassisSlot const * const slot = shipChassis->getSlot (static_cast<ShipChassisSlotType::Type>(effectiveCompatibilitySlot));
if (slot == NULL)
{
#ifdef _DEBUG
WARNING (true, ("Ship [%s] chassis [%s] does not support slot [%s] for installing component [%s]",
getNetworkId().getValueString().c_str(),
shipChassis->getName().getString(),
ShipChassisSlotType::getNameFromType(static_cast<ShipChassisSlotType::Type>(chassisSlot)).c_str(),
shipComponentData.getDescriptor().getName().getString()));
return false;
#endif
}
if (!slot->canAcceptComponent(shipComponentData.getDescriptor()))
{
#ifdef _DEBUG
WARNING (true, ("Component [%s], compat [%s] cannot be installed in ship [%s] chassis [%s], slot [%s], compats [%s].",
shipComponentData.getDescriptor().getName().getString(),
shipComponentData.getDescriptor().getCompatibility().getString(),
@@ -1942,6 +1948,7 @@ bool ShipObject::installComponentFromData(int chassisSlot, ShipComponentData con
shipChassis->getName().getString(),
ShipChassisSlotType::getNameFromType(static_cast<ShipChassisSlotType::Type>(chassisSlot)).c_str(),
slot->getCompatibilityString().c_str()));
#endif
return false;
}