From cd997925eba1a8918d494323d759cc507f1670f1 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 24 Mar 2016 21:27:54 +0000 Subject: [PATCH] cleanup all the "#if 1" macro blocks --- .../shared/controller/ServerController.cpp | 4 +- .../src/shared/object/BuildingObject.cpp | 6 +- .../sharedDebug/src/linux/DebugMonitor.cpp | 2 - .../src/shared/core/PlayerCreationManager.cpp | 2 - .../SharedTangibleObjectTemplate.cpp | 75 ------------------- .../src/shared/generator/AffectorShader.cpp | 15 ---- .../src/shared/generator/FloraGroup.cpp | 4 - .../src/shared/generator/HeightData.cpp | 3 - .../ChatAPI/utils/UdpLibrary/UdpMisc.h | 29 +------ 9 files changed, 5 insertions(+), 135 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/controller/ServerController.cpp b/engine/server/library/serverGame/src/shared/controller/ServerController.cpp index 535341e6..e5022b3e 100755 --- a/engine/server/library/serverGame/src/shared/controller/ServerController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/ServerController.cpp @@ -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 ); diff --git a/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp b/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp index cdc6289f..ab3d5d40 100755 --- a/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp @@ -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(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); } } diff --git a/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp b/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp index 8f4f0682..f1a52dae 100755 --- a/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp +++ b/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp @@ -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 diff --git a/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp b/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp index d089cc2c..200a2f9f 100755 --- a/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp @@ -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); } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp index 2809b366..2056fc23 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp @@ -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(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(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 diff --git a/engine/shared/library/sharedTerrain/src/shared/generator/AffectorShader.cpp b/engine/shared/library/sharedTerrain/src/shared/generator/AffectorShader.cpp index 2c8f2500..8c8ffb3e 100755 --- a/engine/shared/library/sharedTerrain/src/shared/generator/AffectorShader.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/generator/AffectorShader.cpp @@ -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 ()); diff --git a/engine/shared/library/sharedTerrain/src/shared/generator/FloraGroup.cpp b/engine/shared/library/sharedTerrain/src/shared/generator/FloraGroup.cpp index 2f69bb9e..9c9c620e 100755 --- a/engine/shared/library/sharedTerrain/src/shared/generator/FloraGroup.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/generator/FloraGroup.cpp @@ -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); } diff --git a/engine/shared/library/sharedTerrain/src/shared/generator/HeightData.cpp b/engine/shared/library/sharedTerrain/src/shared/generator/HeightData.cpp index 9075fa4a..169fe49e 100755 --- a/engine/shared/library/sharedTerrain/src/shared/generator/HeightData.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/generator/HeightData.cpp @@ -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; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h index f77380ca..af72d619 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h @@ -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);