cleanup all the "#if 1" macro blocks

This commit is contained in:
DarthArgus
2016-03-24 21:27:54 +00:00
parent 01cdf52bc0
commit cd997925eb
9 changed files with 5 additions and 135 deletions
@@ -562,12 +562,12 @@ void ServerController::handleNetUpdateTransformWithParent(const MessageQueueData
if(!cellObject)
{
WARNING_STRICT_FATAL(true, ("WARNING: db or authoritative player says to depersist %s into a cell %s but we cannot because cell does not exist.", getOwner()->getNetworkId().getValueString().c_str(), cellNetworkId.getValueString().c_str()));
//@todo big demo hack. If depersisting into a cell, set the transform to start lcoation
#if 1
Transform start = Transform::identity;
start.setPosition_p(ConfigServerGame::getStartingPosition());
setGoal( start, nullptr );
#endif
return;
}
setGoal( message.getTransform(), serverCellObject );
@@ -611,8 +611,7 @@ bool BuildingObject::isAllowed(CreatureObject const &who) const
// allow vendor-creatures to be placed in the building
if (who.hasCondition(static_cast<int>(ServerTangibleObjectTemplate::C_vendor)))
return true;
// JU_TODO: test
#if 1
// allow non-player-controlled creatures in private buildings if the *creature* has no owner
if (!who.isPlayerControlled()
&& who.getMasterId() == NetworkId::cms_invalid
@@ -621,8 +620,7 @@ bool BuildingObject::isAllowed(CreatureObject const &who) const
{
return true;
}
#endif
// JU_TODO: end test
return CellPermissions::isOnList(m_allowed.get(), who);
}
}
@@ -115,7 +115,6 @@ void DebugMonitor::install(void)
return;
}
#if 1
// NOTE: -TRF- I would not expect this chunk of termios setup
// code to be necessary. My expectation is that it should
// be handled by the curs_inopts (see man page) options I have
@@ -152,7 +151,6 @@ void DebugMonitor::install(void)
fclose(s_ttyInputFile);
return;
}
#endif
//-- Create a curses screen to represent the DebugMonitor output tty.
// NOTE: for now the curses input is hooked up to the application's
@@ -121,7 +121,6 @@ namespace PlayerCreationManagerNamespace
for (; iff.enterForm (Tags::PTMP, true); ++ptmp_count)
{
#if 1
std::string playerTemplateStr;
if (iff.enterChunk (TAG_NAME, true))
{
@@ -148,7 +147,6 @@ namespace PlayerCreationManagerNamespace
}
eq.insert (std::make_pair (playerTemplateStr, v));
#endif
iff.exitForm (true);
}
@@ -236,7 +236,6 @@ const StructureFootprint* SharedTangibleObjectTemplate::getStructureFootprint ()
*/
void SharedTangibleObjectTemplate::createCustomizationDataPropertyAsNeeded(Object &object, bool /* forceCreation */) const
{
#if 1
//-- Properties cannot be added while an object is in the world. Some callers may be in the world,
// so temporarily remove the object from the world if necessary.
bool shouldBeInWorld = object.isInWorld();
@@ -266,80 +265,6 @@ void SharedTangibleObjectTemplate::createCustomizationDataPropertyAsNeeded(Objec
//-- release local reference to the CustomizationData instance
customizationData->release();
}
#else
// @todo -TRF- remove this code as soon as asset customization manager is working properly.
const size_t paletteColorCount = getPaletteColorCustomizationVariablesCount();
const size_t rangedIntCount = getRangedIntCustomizationVariablesCount();
//-- Return if caller isn't forcing customization data creation and no customization variables are declared for the ObjectTemplate.
const bool makeCustomizationData = forceCreation || (paletteColorCount > 0) || (rangedIntCount > 0);
if (!makeCustomizationData)
return;
//-- Properties cannot be added while an object is in the world. Some callers may be in the world,
// so temporarily remove the object from the world if necessary.
bool shouldBeInWorld = object.isInWorld();
if (shouldBeInWorld)
object.removeFromWorld();
//-- create the CustomizationDataProperty, add to Object property collection
CustomizationDataProperty *const cdProperty = new CustomizationDataProperty(object);
object.addProperty(*cdProperty);
//-- Put object back in world if it was originally there.
if (shouldBeInWorld)
object.addToWorld();
//-- fetch the CustomizationData instance
CustomizationData *const customizationData = cdProperty->fetchCustomizationData();
//-- create PaletteColorCustomizationVariable variables as specified
{
SharedTangibleObjectTemplate::PaletteColorCustomizationVariable variableData;
for (int i = 0; i < static_cast<int>(paletteColorCount); ++i)
{
//-- get the palette variable data
getPaletteColorCustomizationVariables(variableData, i);
//-- fetch the palette
const PaletteArgb *const palette = PaletteArgbList::fetch(TemporaryCrcString(variableData.palettePathName.c_str(), true));
if (!palette)
{
DEBUG_WARNING(true, ("failed to retrieve color palette [%s] for [%s], skipping variable [%s].\n", variableData.palettePathName.c_str(), getName (), variableData.variableName.c_str()));
continue;
}
//-- create the variable, add to CustomizationData
::PaletteColorCustomizationVariable * const palColorVar = new ::PaletteColorCustomizationVariable(palette, variableData.defaultPaletteIndex);
if (variableData.defaultPaletteIndex != palColorVar->getValue ())
DEBUG_WARNING (true, ("Error loading PaletteColorCustomizationVariable [%s] for [%s]", variableData.variableName.c_str(), getName ()));
customizationData->addVariableTakeOwnership(variableData.variableName, palColorVar);
//-- release local palette reference
palette->release();
}
}
//-- create BasicRangedIntCustomizationVariable variables as specified
{
SharedTangibleObjectTemplate::RangedIntCustomizationVariable variableData;
for (int i = 0; i < static_cast<int>(rangedIntCount); ++i)
{
//-- get the palette variable data
getRangedIntCustomizationVariables(variableData, i);
//-- create the variable, add to CustomizationData
customizationData->addVariableTakeOwnership(variableData.variableName, new ::BasicRangedIntCustomizationVariable(variableData.minValueInclusive, variableData.defaultValue, variableData.maxValueExclusive));
}
}
//-- release local reference to the CustomizationData instance
customizationData->release();
#endif
}
//@BEGIN TFD
@@ -100,12 +100,7 @@ void AffectorShaderConstant::affect (const float worldX, const float worldZ, con
FastRandomGenerator randomGenerator(CoordinateHash::hashTuple(worldX, worldZ));
#if 1
if (amount >= featherClamp)
#else
//-- this causes better looking terrain, but more shader blends
if (randomGenerator.randomFloat() <= amount * featherClamp)
#endif
{
ShaderGroup::Info sgi = m_cachedSgi;
sgi.setChildChoice(randomGenerator.randomFloat());
@@ -128,12 +123,7 @@ void AffectorShaderConstant::_legacyAffect (const float /*worldX*/, const float
const float featherClamp = m_useFeatherClampOverride ? m_featherClampOverride : m_cachedFeatherClamp;
#if 1
if (amount >= featherClamp)
#else
//-- this causes better looking terrain, but more shader blends
if (generatorChunkData.randomGenerator.randomReal (0.f, 1.f) <= amount * featherClamp)
#endif
{
ShaderGroup::Info sgi = m_cachedSgi;
sgi.setChildChoice (generatorChunkData.m_legacyRandomGenerator->randomReal (0.0f, 1.0f));
@@ -321,12 +311,7 @@ void AffectorShaderReplace::affect (const float /*worldX*/, const float /*worldZ
const float featherClamp = m_useFeatherClampOverride ? m_featherClampOverride : m_cachedFeatherClamp;
#if 1
if (amount >= featherClamp)
#else
//-- this causes better looking terrain, but more shader blends
if (generatorChunkData.randomGenerator.randomReal (0.f, 1.f) <= amount * featherClamp)
#endif
{
m_cachedSgi.setChildChoice (sgi.getChildChoice ());
@@ -250,7 +250,6 @@ void FloraGroup::Family::addChild (const FamilyChildData& familyChildData)
FamilyChildData child = familyChildData;
child.familyId = familyId;
#if 1
//-- fixup fubar'ed names for a version
FileName baseName (FileName::P_none, familyChildData.appearanceTemplateName);
baseName.stripPathAndExt ();
@@ -281,9 +280,6 @@ void FloraGroup::Family::addChild (const FamilyChildData& familyChildData)
child.appearanceTemplateName = DuplicateString (familyChildData.appearanceTemplateName);
}
}
#else
child.appearanceTemplateName = DuplicateString (familyChildData.appearanceTemplateName);
#endif
childList.add (child);
}
@@ -100,17 +100,14 @@ bool HeightData::Segment::find (const Vector2d& oposition, float& result) const
{
Vector2d position = oposition;
#if 1
{
const float x0 = std::min (m_pointList.begin ()->x, m_pointList.back ().x);
const float z0 = std::min (m_pointList.begin ()->z, m_pointList.back ().z);
const float x1 = std::max (m_pointList.begin ()->x, m_pointList.back ().x);
const float z1 = std::max (m_pointList.begin ()->z, m_pointList.back ().z);
// DEBUG_FATAL (position.x < x0 || position.x > x1 || position.y < z0 || position.y > z1, ("position out of range"));
position.x = clamp (x0, position.x, x1);
position.y = clamp (z0, position.y, z1);
}
#endif
const float width = m_pointList.back ().x - m_pointList.begin ()->x;
const float height = m_pointList.back ().z - m_pointList.begin ()->z;
@@ -21,20 +21,6 @@ class UdpMisc
// they are stuck into this class so as to avoid conflicts with the application
////////////////////////////////////////////////////////////////////////////////////////////
public:
#if 1 // DEPRECATED (here for backwards compatibility only. Not used by UdpLibrary, it uses the UdpPlatformDriver version)
// Internally these create a static UdpPlatformDriver and chain the call through. If you have a UdpManager, I recommend
// simply call UdpManager::Clock and UdpManager::ClockElapsed, which chain on through to the driver created by the UdpManager
// values returned by this clock function should not be compared to values return from the UdpManager clock function as
// they go through two different drivers to get the answer and may not return the same number (though in practice it
// likely always will).
typedef UdpClockStamp ClockStamp;
static ClockStamp Clock(); // returns a timestamp (most likely in milliseconds)
static int ClockElapsed(ClockStamp stamp); // returns a elapsed time since stamp in milliseconds (if elapsed is over 23 days, it returns 23 days)
#endif
static int ClockDiff(UdpClockStamp start, UdpClockStamp stop); // returns a time difference in milliseconds (if difference is over 23 days, it returns 23 days)
static unsigned long int Crc32(const void *buffer, int bufferLen, int encryptValue = 0); // calculate a 32-bit crc for a buffer (encrypt value simple scrambles the crc at the beginning so the same packet doesn't produce the same crc on different connections)
static int Random(int *seed); // random number generator
@@ -95,20 +81,7 @@ class UdpMisc
// inline implementations
////////////////////////////////////////////////////////////////////////////
// UdpMisc
#if 1 // DEPRECATED (see declaration)
inline UdpMisc::ClockStamp UdpMisc::Clock()
{
static UdpPlatformDriver sClockDriver;
return(sClockDriver.Clock());
}
inline int UdpMisc::ClockElapsed(ClockStamp stamp)
{
return(UdpMisc::ClockDiff(stamp, Clock()));
}
#endif
// UdpMisc
inline int UdpMisc::ClockDiff(UdpClockStamp start, UdpClockStamp stop)
{
UdpClockStamp t = (stop - start);