diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp index 61b199f9..34514617 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp @@ -67,7 +67,7 @@ namespace CollisionWorldNamespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int const cs_nearWarpCollisionSegmentCount = 20; - int const cs_farWarpCollisionSegmentCount = 250; + int const cs_farWarpCollisionSegmentCount = 250; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -81,13 +81,13 @@ namespace CollisionWorldNamespace WarpWarningCallback s_nearWarpWarningCallback; WarpWarningCallback s_farWarpWarningCallback; - char const * ms_sptatialDatabaseNames[] = { + char const * ms_sptatialDatabaseNames[] = { "None", "Static", "Dynamic", "Barriers", "Doors" - }; + }; //---------------------------------------------------------------------- @@ -101,7 +101,7 @@ namespace CollisionWorldNamespace Vector deltaNormal = delta; deltaNormal.normalize(); - for ( ; distanceTraversed < totalDistance; ) + for (; distanceTraversed < totalDistance; ) { float distance = std::min(distanceTraversed + 2.0f, totalDistance); Vector const & endPos = startPos + (deltaNormal * distance); @@ -136,7 +136,6 @@ namespace CollisionWorldNamespace TerrainObject const *const terrainObject = TerrainObject::getConstInstance(); if (nullptr != terrainObject && terrainObject->hasPassableAffectors()) { - // pointA_w is *not* the previous world position, but actually the world // position for the previous position in the cell, in respect to the // current position of the previous cell. This has the effect that a @@ -184,7 +183,6 @@ namespace CollisionWorldNamespace CollisionWorld::NoCollisionDetectionThisFrameFunction ms_noCollisionDetectionThisFrameFunction = 0; CollisionWorld::CollisionDetectionOnHitFunction ms_collisionDetectionOnHitFunction = 0; CollisionWorld::DoCollisionWithTerrainFunction ms_doCollisionWithTerrainFunction = 0; - } using namespace CollisionWorldNamespace; @@ -222,11 +220,11 @@ std::string ms_reportString; // ---------- -void terrainChangedCallback ( Rectangle2d const & rect ) +void terrainChangedCallback(Rectangle2d const & rect) { - AxialBox box( Vector(rect.x0,-2000.0f,rect.y0), Vector(rect.x1,2000.0f,rect.y1) ); + AxialBox box(Vector(rect.x0, -2000.0f, rect.y0), Vector(rect.x1, 2000.0f, rect.y1)); - CollisionWorld::environmentChanged( MultiShape(box) ); + CollisionWorld::environmentChanged(MultiShape(box)); } // ====================================================================== @@ -237,16 +235,16 @@ void CollisionWorldNamespace::defaultNearWarpWarning(Object const &object, Vecto { WARNING(ConfigSharedCollision::getReportWarnings(), ("CollisionWorld::update() had %d segments for object id=[%s], template=[%s], start position=[%.2f,%.2f,%.2f], end position=[%.2f,%.2f,%.2f], object probably should have warped but collision system is not warping it.", - segmentCount, - object.getNetworkId().getValueString().c_str(), - object.getObjectTemplateName(), - oldPosition_w.x, - oldPosition_w.y, - oldPosition_w.z, - newPosition_w.x, - newPosition_w.y, - newPosition_w.z - )); + segmentCount, + object.getNetworkId().getValueString().c_str(), + object.getObjectTemplateName(), + oldPosition_w.x, + oldPosition_w.y, + oldPosition_w.z, + newPosition_w.x, + newPosition_w.y, + newPosition_w.z + )); } // ---------------------------------------------------------------------- @@ -255,16 +253,16 @@ void CollisionWorldNamespace::defaultFarWarpWarning(Object const &object, Vector { WARNING(ConfigSharedCollision::getReportWarnings(), ("CollisionWorld::update() had %d segments for object id=[%s], template=[%s], start position=[%.2f,%.2f,%.2f], end position=[%.2f,%.2f,%.2f], collision system will consider this a warp and adjust accordingly.", - segmentCount, - object.getNetworkId().getValueString().c_str(), - object.getObjectTemplateName(), - oldPosition_w.x, - oldPosition_w.y, - oldPosition_w.z, - newPosition_w.x, - newPosition_w.y, - newPosition_w.z - )); + segmentCount, + object.getNetworkId().getValueString().c_str(), + object.getObjectTemplateName(), + oldPosition_w.x, + oldPosition_w.y, + oldPosition_w.z, + newPosition_w.x, + newPosition_w.y, + newPosition_w.z + )); } // ---------------------------------------------------------------------- @@ -318,10 +316,10 @@ bool CollisionWorldNamespace::testFloorCollision(FloorLocator const &startFloorL // This most likely means that the pathWalkResult that was issued indicates a non-collision and should be caught in the // if statement above. WARNING(true, - ("testFloorCollision(): floor collision occurred while checking for floor collisions for floor of object id [%s] but collision floor location has no associated floor. Calling this a non-collision. PathWalkResult was [%d].", - floor->getOwner() ? floor->getOwner()->getNetworkId().getValueString().c_str() : "", - static_cast(pathWalkResult) - )); + ("testFloorCollision(): floor collision occurred while checking for floor collisions for floor of object id [%s] but collision floor location has no associated floor. Calling this a non-collision. PathWalkResult was [%d].", + floor->getOwner() ? floor->getOwner()->getNetworkId().getValueString().c_str() : "", + static_cast(pathWalkResult) + )); return false; } @@ -336,7 +334,6 @@ bool CollisionWorldNamespace::testFloorCollision(FloorLocator const &startFloorL return true; } - // ---------------------------------------------------------------------- void CollisionWorld::registerCanTestCollisionDetectionOnObjectThisFrame(CanTestCollisionDetectionOnObjectThisFrameFunction function) @@ -414,12 +411,12 @@ bool CollisionWorld::doCollisionWithTerrain(Object * const object) // class CollisionWorld: PUBLIC STATIC // ====================================================================== -void CollisionWorld::install ( bool serverSide ) +void CollisionWorld::install(bool serverSide) { - DEBUG_REPORT_LOG(true,("CollisionWorld::install()\n")); + DEBUG_REPORT_LOG(true, ("CollisionWorld::install()\n")); s_nearWarpWarningCallback = defaultNearWarpWarning; - s_farWarpWarningCallback = defaultFarWarpWarning; + s_farWarpWarningCallback = defaultFarWarpWarning; ConfigSharedCollision::install(); FloorMesh::install(); @@ -428,21 +425,21 @@ void CollisionWorld::install ( bool serverSide ) ms_serverSide = serverSide; - if(!serverSide) + if (!serverSide) { - TerrainObject::addTerrainChangedFunction( terrainChangedCallback ); + TerrainObject::addTerrainChangedFunction(terrainChangedCallback); } ms_database = new SpatialDatabase(); - ExitChain::add(CollisionWorld::remove,"CollisionWorld::remove()"); + ExitChain::add(CollisionWorld::remove, "CollisionWorld::remove()"); } // ---------- -void CollisionWorld::remove ( void ) +void CollisionWorld::remove(void) { - DEBUG_REPORT_LOG(true,("CollisionWorld::remove()\n")); + DEBUG_REPORT_LOG(true, ("CollisionWorld::remove()\n")); CollisionResolve::remove(); FloorMesh::remove(); @@ -456,7 +453,7 @@ void CollisionWorld::remove ( void ) // ---------------------------------------------------------------------- -void CollisionWorld::update ( float time ) +void CollisionWorld::update(float time) { CollisionNotification::purgeQueue(); @@ -492,7 +489,7 @@ void CollisionWorld::update ( float time ) CollisionProperty * cursor = CollisionProperty::getActiveHead(); - while(cursor) + while (cursor) { active.push_back(cursor); @@ -501,12 +498,12 @@ void CollisionWorld::update ( float time ) CollisionPropertyVector::size_type const count = active.size(); - if(count > 3000) + if (count > 3000) { - WARNING(true,("CollisionWorld::update - Updating more than 3000 objects this frame - something's probably wrong\n")); + WARNING(true, ("CollisionWorld::update - Updating more than 3000 objects this frame - something's probably wrong\n")); } - for(CollisionPropertyVector::size_type i = 0; i < count; i++) + for (CollisionPropertyVector::size_type i = 0; i < count; i++) { update(active[i], time); } @@ -515,7 +512,6 @@ void CollisionWorld::update ( float time ) // ---------- - #ifdef _MSC_VER FloatingPointUnit::setPrecision(oldPrecision); @@ -530,11 +526,11 @@ void CollisionWorld::update ( float time ) updateReportString(); - if(totalCollisionTime >= 0.1f && ConfigSharedCollision::getLogLongFrames()) + if (totalCollisionTime >= 0.1f && ConfigSharedCollision::getLogLongFrames()) { // Collision took more than 100 milliseconds - log the report - LOG("Collision",(ms_reportString.c_str())); + LOG("Collision", (ms_reportString.c_str())); } ms_updating = false; @@ -561,7 +557,7 @@ bool CollisionWorld::spatialSweepAndResolve(CollisionProperty * collider) int const potentialCount = static_cast(collidedWith.size()); - for(int i = 0; i < potentialCount; ++i) + for (int i = 0; i < potentialCount; ++i) { CollisionProperty * const toTestCollision = collidedWith.at(static_cast(i)); @@ -603,11 +599,11 @@ void CollisionWorld::update(CollisionProperty * collider, float time) Footprint * foot = collider->getFootprint(); - if(foot == nullptr) + if (foot == nullptr) { PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update: foot == nullptr"); - IGNORE_RETURN (CollisionWorld::spatialSweepAndResolve(collider)); + IGNORE_RETURN(CollisionWorld::spatialSweepAndResolve(collider)); collider->storePosition(); collider->updateIdle(); @@ -638,11 +634,11 @@ void CollisionWorld::update(CollisionProperty * collider, float time) int segments = static_cast(ceil(moveLength / 2.0f)); - if(segments <= 1) + if (segments <= 1) { PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update: segments <= 1"); - updateSegment(collider,time); + updateSegment(collider, time); } else { @@ -650,7 +646,7 @@ void CollisionWorld::update(CollisionProperty * collider, float time) // Break the move into pieces and resolve each separately - if(segments > cs_nearWarpCollisionSegmentCount) + if (segments > cs_nearWarpCollisionSegmentCount) { PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update: segments > cs_nearWarpCollisionSegmentCount"); @@ -659,7 +655,7 @@ void CollisionWorld::update(CollisionProperty * collider, float time) (*s_nearWarpWarningCallback)(collider->getOwner(), pointA_w, pointB_w, segments); } - if(segments > cs_farWarpCollisionSegmentCount) + if (segments > cs_farWarpCollisionSegmentCount) { PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update: segments > cs_farWarpCollisionSegmentCount"); @@ -676,25 +672,25 @@ void CollisionWorld::update(CollisionProperty * collider, float time) // This version just moves them, & hopefully they'll end up in the same cell as they were last frame - Vector pointA_B = CollisionUtils::transformFromWorld(pointA_w,cellB); + Vector pointA_B = CollisionUtils::transformFromWorld(pointA_w, cellB); NAN_CHECK(pointA_B); object->setPosition_p(pointA_B); - if(object->getParentCell() != cellA) + if (object->getParentCell() != cellA) { - REPORT_LOG(ConfigSharedCollision::getReportMessages(),("CollisionWorld::update - Tried to move the object back to where it was last frame, but it ended up in a different cell\n")); + REPORT_LOG(ConfigSharedCollision::getReportMessages(), ("CollisionWorld::update - Tried to move the object back to where it was last frame, but it ended up in a different cell\n")); } // ---------- float segmentTime = time / static_cast(segments); - Vector segmentDelta_w = (pointB_w-pointA_w) / static_cast(segments); + Vector segmentDelta_w = (pointB_w - pointA_w) / static_cast(segments); - for(int i = 0; i < segments; i++) + for (int i = 0; i < segments; i++) { - Vector segmentDelta_p = CollisionUtils::rotateToCell(CellProperty::getWorldCellProperty(),segmentDelta_w,object->getParentCell()); + Vector segmentDelta_p = CollisionUtils::rotateToCell(CellProperty::getWorldCellProperty(), segmentDelta_w, object->getParentCell()); Vector goal = object->getPosition_p() + segmentDelta_p; @@ -702,7 +698,7 @@ void CollisionWorld::update(CollisionProperty * collider, float time) object->setPosition_p(goal); - updateSegment(collider,segmentTime); + updateSegment(collider, segmentTime); } } @@ -710,9 +706,9 @@ void CollisionWorld::update(CollisionProperty * collider, float time) CellProperty const * finalCell = object->getParentCell(); - if(finalCell && (finalCell != CellProperty::getWorldCellProperty())) + if (finalCell && (finalCell != CellProperty::getWorldCellProperty())) { - if(!foot->isAttached()) + if (!foot->isAttached()) { PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update: !foot->isAttached()"); @@ -723,7 +719,7 @@ void CollisionWorld::update(CollisionProperty * collider, float time) // ---------------------------------------------------------------------- -void CollisionWorld::updateSegment ( CollisionProperty * collider, float time ) +void CollisionWorld::updateSegment(CollisionProperty * collider, float time) { PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::updateSegment"); @@ -738,18 +734,18 @@ void CollisionWorld::updateSegment ( CollisionProperty * collider, float time ) Vector delta = pointB_p - pointA_p; - if((delta.x != 0.0f) || (delta.y != 0.0f)) + if ((delta.x != 0.0f) || (delta.y != 0.0f)) { Vector footPos_p = foot->getPosition_p(); Vector groundNormal_p = foot->getGroundNormal_p(); - if(groundNormal_p.y != 0.0f) + if (groundNormal_p.y != 0.0f) { float dx = pointB_p.x - footPos_p.x; float dz = pointB_p.z - footPos_p.z; - float dydx = -(groundNormal_p.x/groundNormal_p.y); - float dydz = -(groundNormal_p.z/groundNormal_p.y); + float dydx = -(groundNormal_p.x / groundNormal_p.y); + float dydz = -(groundNormal_p.z / groundNormal_p.y); float groundOffset = (dx * dydx) + (dz * dydz); @@ -764,20 +760,20 @@ void CollisionWorld::updateSegment ( CollisionProperty * collider, float time ) // ---------- // do the actual collision resolution step - IGNORE_RETURN(updateStep(collider,time)); + IGNORE_RETURN(updateStep(collider, time)); // and now repeatedly snap the object and re-run collision resolution until // there's no collision or we give up int j; - for(j = 0; j < 10; j++) + for (j = 0; j < 10; j++) { IGNORE_RETURN(foot->snapObjectToGround()); - ResolutionResult result = updateStep(collider,0.0f); + ResolutionResult result = updateStep(collider, 0.0f); - if(result == RR_NoCollision) + if (result == RR_NoCollision) { break; } @@ -821,13 +817,12 @@ void CollisionWorld::shoveAway(CollisionProperty * const collisionProperty, Coll NAN_CHECK(newPos); obj->setPosition_p(newPos); - } // ---------------------------------------------------------------------- // returns true if any collisions were resolved -ResolutionResult CollisionWorld::updateStep ( CollisionProperty * collider, float time ) +ResolutionResult CollisionWorld::updateStep(CollisionProperty * collider, float time) { PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::updateStep"); @@ -837,7 +832,7 @@ ResolutionResult CollisionWorld::updateStep ( CollisionProperty * collider, floa NOT_NULL(foot); - if(foot->isFloating()) + if (foot->isFloating()) { Vector newPos = foot->m_addToWorldPos; @@ -850,7 +845,6 @@ ResolutionResult CollisionWorld::updateStep ( CollisionProperty * collider, floa return RR_NoCollision; } - //---------------------------------------------------------------------- handleTerrainImpassability(*collider, true); @@ -867,7 +861,7 @@ ResolutionResult CollisionWorld::updateStep ( CollisionProperty * collider, floa PROFILER_AUTO_BLOCK_DEFINE("update floor database"); timer.start(); - ms_database->updateFloorCollision(collider,false); + ms_database->updateFloorCollision(collider, false); timer.stop(); floorUpdateTime += timer.getElapsedTime(); @@ -926,27 +920,27 @@ ResolutionResult CollisionWorld::updateStep ( CollisionProperty * collider, floa // ---------------------------------------------------------------------- -bool CollisionWorld::isUpdating ( void ) +bool CollisionWorld::isUpdating(void) { return ms_updating; } // ---------------------------------------------------------------------- -void CollisionWorld::updateReportString ( void ) +void CollisionWorld::updateReportString(void) { ms_reportString.clear(); char buffer[256]; - sprintf(buffer,"CollsionWorld::update -\n"); + sprintf(buffer, "CollsionWorld::update -\n"); ms_reportString += buffer; const int staticObjectCount = ms_database->getObjectCount(SpatialDatabase::Q_Static); const int dynamicObjectCount = ms_database->getObjectCount(SpatialDatabase::Q_Dynamic); const int floorCount = ms_database->getFloorCount(); - sprintf(buffer,"Database : %d S / %d D / %d F\n",staticObjectCount,dynamicObjectCount,floorCount); + sprintf(buffer, "Database : %d S / %d D / %d F\n", staticObjectCount, dynamicObjectCount, floorCount); ms_reportString += buffer; @@ -955,7 +949,7 @@ void CollisionWorld::updateReportString ( void ) int collisionCount = CollisionResolve::getCollisionCount(); int bounceCount = CollisionResolve::getBounceCount(); - sprintf(buffer,"Resolution : %d colliders, %d obstacles, %d collisions, %d bounces\n",colliderCount,obstacleCount,collisionCount,bounceCount); + sprintf(buffer, "Resolution : %d colliders, %d obstacles, %d collisions, %d bounces\n", colliderCount, obstacleCount, collisionCount, bounceCount); ms_reportString += buffer; ms_reportString += "C E F P L T O\n"; @@ -964,62 +958,62 @@ void CollisionWorld::updateReportString ( void ) float behaviorAverage = behaviorTotalTime / static_cast(behaviorAlterCount); - sprintf(buffer,"Behavior : %d, %1.3f total, %1.3f avg, %1.3f max\n",behaviorAlterCount,behaviorTotalTime * 1000.0f,behaviorAverage * 1000.0f,behaviorMaxTime * 1000.0f); + sprintf(buffer, "Behavior : %d, %1.3f total, %1.3f avg, %1.3f max\n", behaviorAlterCount, behaviorTotalTime * 1000.0f, behaviorAverage * 1000.0f, behaviorMaxTime * 1000.0f); ms_reportString += buffer; float aiControllerAverage = aiControllerTotalTime / static_cast(aiControllerAlterCount); - sprintf(buffer,"AiController : %d, %1.3f total, %1.3f avg, %1.3f max\n",aiControllerAlterCount, aiControllerTotalTime * 1000.0f, aiControllerAverage * 1000.0f, aiControllerMaxTime * 1000.0f); + sprintf(buffer, "AiController : %d, %1.3f total, %1.3f avg, %1.3f max\n", aiControllerAlterCount, aiControllerTotalTime * 1000.0f, aiControllerAverage * 1000.0f, aiControllerMaxTime * 1000.0f); ms_reportString += buffer; float canMoveAverage = canMoveTime / static_cast(canMoveCount); - sprintf(buffer,"Can move : %d, %1.3f total, %1.3f avg, %1.3f max\n",canMoveCount, canMoveTime * 1000.0f, canMoveAverage * 1000.0f, maxCanMoveTime * 1000.0f); + sprintf(buffer, "Can move : %d, %1.3f total, %1.3f avg, %1.3f max\n", canMoveCount, canMoveTime * 1000.0f, canMoveAverage * 1000.0f, maxCanMoveTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Extent updates : %d\n",extentUpdateCount); + sprintf(buffer, "Extent updates : %d\n", extentUpdateCount); ms_reportString += buffer; - sprintf(buffer,"Path scrub time : %1.3f msec\n",pathScrubTime * 1000.0f); + sprintf(buffer, "Path scrub time : %1.3f msec\n", pathScrubTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Pathfinding time : %1.3f msec\n",pathfindingTime * 1000.0f); + sprintf(buffer, "Pathfinding time : %1.3f msec\n", pathfindingTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Path build time : %1.3f msec\n",pathBuildTime * 1000.0f); + sprintf(buffer, "Path build time : %1.3f msec\n", pathBuildTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Path search time : %1.3f msec\n",pathSearchTime * 1000.0f); + sprintf(buffer, "Path search time : %1.3f msec\n", pathSearchTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Path search alloc : %d allocs\n",pathAllocations); + sprintf(buffer, "Path search alloc : %d allocs\n", pathAllocations); ms_reportString += buffer; - sprintf(buffer,"Footprint updates : %d updates\n",footprintUpdateCounter); + sprintf(buffer, "Footprint updates : %d updates\n", footprintUpdateCounter); ms_reportString += buffer; - sprintf(buffer,"All collision : %1.3f msec\n",totalCollisionTime * 1000.0f); + sprintf(buffer, "All collision : %1.3f msec\n", totalCollisionTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Floor update : %1.3f msec\n",floorUpdateTime * 1000.0f); + sprintf(buffer, "Floor update : %1.3f msec\n", floorUpdateTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Footprint update : %1.3f msec\n",footprintUpdateTime * 1000.0f); + sprintf(buffer, "Footprint update : %1.3f msec\n", footprintUpdateTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Collision detection : %1.3f msec\n",collisionDetectTime * 1000.0f); + sprintf(buffer, "Collision detection : %1.3f msec\n", collisionDetectTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Collision resolution : %1.3f msec\n",resolveCollisionsTime * 1000.0f); + sprintf(buffer, "Collision resolution : %1.3f msec\n", resolveCollisionsTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Terrain height : %1.3f msec\n",terrainHeightTime * 1000.0f); + sprintf(buffer, "Terrain height : %1.3f msec\n", terrainHeightTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Get cell : %1.3f msec\n",getCellTime * 1000.0f); + sprintf(buffer, "Get cell : %1.3f msec\n", getCellTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Post-update : %1.3f msec\n",postUpdateTime * 1000.0f); + sprintf(buffer, "Post-update : %1.3f msec\n", postUpdateTime * 1000.0f); ms_reportString += buffer; extentUpdateCount = 0; @@ -1041,13 +1035,13 @@ void CollisionWorld::updateReportString ( void ) // ---------------------------------------------------------------------- -void CollisionWorld::reportCallback( void ) +void CollisionWorld::reportCallback(void) { #if _DEBUG - if(!ConfigSharedCollision::getReportStatus()) return; + if (!ConfigSharedCollision::getReportStatus()) return; - DEBUG_REPORT_PRINT(true,(ms_reportString.c_str())); + DEBUG_REPORT_PRINT(true, (ms_reportString.c_str())); #endif } @@ -1074,15 +1068,15 @@ void CollisionWorld::setFarWarpWarningCallback(WarpWarningCallback callback) // ---------------------------------------------------------------------- -void CollisionWorld::addObject ( Object * object ) +void CollisionWorld::addObject(Object * object) { - if(object == nullptr) return; + if (object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if((collision == nullptr) || collision->getDisableCollisionWorldAddRemove()) return; + if ((collision == nullptr) || collision->getDisableCollisionWorldAddRemove()) return; - if(collision->isInCollisionWorld()) return; + if (collision->isInCollisionWorld()) return; // ---------- @@ -1091,7 +1085,7 @@ void CollisionWorld::addObject ( Object * object ) SpatialDatabase::Query query = collision->getSpatialDatabaseStorageType(); bool added = false; - if(collision->isMobile()) + if (collision->isMobile()) { added = ms_database->addObject(query, object); } @@ -1099,12 +1093,12 @@ void CollisionWorld::addObject ( Object * object ) { Floor * pFloor = collision->getFloor(); - if(pFloor && !pFloor->isCellFloor()) + if (pFloor && !pFloor->isCellFloor()) { added = ms_database->addFloor(pFloor); } - if(collision->getExtent_l()) + if (collision->getExtent_l()) { if (dynamic_cast(object) != 0) { @@ -1121,15 +1115,15 @@ void CollisionWorld::addObject ( Object * object ) environmentChanged(MultiShape(collision->getBoundingSphere_w())); } - if(added) + if (added) { char const * name = object->getObjectTemplateName(); - if(name == nullptr) + if (name == nullptr) { Appearance const * appearance = object->getAppearance(); - if(appearance) + if (appearance) { name = appearance->getAppearanceTemplateName(); } @@ -1138,43 +1132,43 @@ void CollisionWorld::addObject ( Object * object ) int index = 0; switch (query) { - case SpatialDatabase::Q_Static: - index = 1; - break; - case SpatialDatabase::Q_Dynamic: - index = 2; - break; - case SpatialDatabase::Q_Barriers: - index = 3; - break; - case SpatialDatabase::Q_Doors: - index = 4; - break; - default: - break; + case SpatialDatabase::Q_Static: + index = 1; + break; + case SpatialDatabase::Q_Dynamic: + index = 2; + break; + case SpatialDatabase::Q_Barriers: + index = 3; + break; + case SpatialDatabase::Q_Doors: + index = 4; + break; + default: + break; } - DEBUG_REPORT_LOG(ConfigSharedCollision::getReportChanges(),("Added object %s to collision world [%s] at (%f,%f,%f)\n",name, ms_sptatialDatabaseNames[index], object->getPosition_w().x,object->getPosition_w().y,object->getPosition_w().z)); + DEBUG_REPORT_LOG(ConfigSharedCollision::getReportChanges(), ("Added object %s to collision world [%s] at (%f,%f,%f)\n", name, ms_sptatialDatabaseNames[index], object->getPosition_w().x, object->getPosition_w().y, object->getPosition_w().z)); } } // ---------- -void CollisionWorld::removeObject ( Object * object ) +void CollisionWorld::removeObject(Object * object) { - if(object == nullptr) return; + if (object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if((collision == nullptr) || collision->getDisableCollisionWorldAddRemove()) return; + if ((collision == nullptr) || collision->getDisableCollisionWorldAddRemove()) return; - if(!collision->isInCollisionWorld()) return; + if (!collision->isInCollisionWorld()) return; // ---------- bool removed = false; - if(collision->isMobile()) + if (collision->isMobile()) { removed = ms_database->removeObject(SpatialDatabase::Q_Dynamic, object); } @@ -1182,12 +1176,12 @@ void CollisionWorld::removeObject ( Object * object ) { Floor * pFloor = collision->getFloor(); - if(pFloor && !pFloor->isCellFloor()) + if (pFloor && !pFloor->isCellFloor()) { removed = ms_database->removeFloor(pFloor); } - if(collision->getExtent_l()) + if (collision->getExtent_l()) { SpatialDatabase::Query query = SpatialDatabase::Q_Static; @@ -1206,9 +1200,9 @@ void CollisionWorld::removeObject ( Object * object ) environmentChanged(MultiShape(collision->getBoundingSphere_w())); } - if(removed) + if (removed) { - DEBUG_REPORT_LOG(ConfigSharedCollision::getReportChanges(),("Removed object %s from collision world\n",object->getObjectTemplateName())); + DEBUG_REPORT_LOG(ConfigSharedCollision::getReportChanges(), ("Removed object %s from collision world\n", object->getObjectTemplateName())); } collision->removeFromCollisionWorld(); @@ -1216,19 +1210,19 @@ void CollisionWorld::removeObject ( Object * object ) // ---------- -void CollisionWorld::moveObject (Object * object) +void CollisionWorld::moveObject(Object * object) { - if(object == nullptr) return; + if (object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == nullptr) return; + if (collision == nullptr) return; - if(!collision->isInCollisionWorld()) return; + if (!collision->isInCollisionWorld()) return; // ---------- - if(object->getTransform_o2w() == collision->getLastTransform_w()) + if (object->getTransform_o2w() == collision->getLastTransform_w()) { return; } @@ -1238,7 +1232,7 @@ void CollisionWorld::moveObject (Object * object) IGNORE_RETURN(ms_database->moveObject(collision)); - if(!collision->isMobile()) + if (!collision->isMobile()) { environmentChanged(MultiShape(collision->getBoundingSphere_w())); } @@ -1246,15 +1240,15 @@ void CollisionWorld::moveObject (Object * object) // ---------- -void CollisionWorld::cellChanged ( Object * object ) +void CollisionWorld::cellChanged(Object * object) { - if(object == nullptr) return; + if (object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == nullptr) return; + if (collision == nullptr) return; - if(!collision->isInCollisionWorld()) return; + if (!collision->isInCollisionWorld()) return; // ---------- @@ -1264,19 +1258,19 @@ void CollisionWorld::cellChanged ( Object * object ) // ---------- -void CollisionWorld::appearanceChanged ( Object * object ) +void CollisionWorld::appearanceChanged(Object * object) { - if(object == nullptr) return; + if (object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == nullptr) return; + if (collision == nullptr) return; - if(!collision->isInCollisionWorld()) return; + if (!collision->isInCollisionWorld()) return; // ---------- - if(!collision->isMobile()) + if (!collision->isMobile()) { IGNORE_RETURN(ms_database->moveObject(collision)); @@ -1288,27 +1282,27 @@ void CollisionWorld::appearanceChanged ( Object * object ) // Something about the environment (terrain, static objects) has changed. // Wake up all collision properties in the changed area. -void CollisionWorld::environmentChanged ( MultiShape const & shape ) +void CollisionWorld::environmentChanged(MultiShape const & shape) { static ObjectVec mobs; mobs.clear(); - IGNORE_RETURN(ms_database->queryDynamics(shape,&mobs)); + IGNORE_RETURN(ms_database->queryDynamics(shape, &mobs)); ObjectVec::size_type const count = mobs.size(); - if(count > 500) + if (count > 500) { Vector c = shape.getCenter(); float x = shape.getExtentX() * 2.0f; float y = shape.getExtentY() * 2.0f; float z = shape.getExtentZ() * 2.0f; - WARNING(true,("CollisionWorld::environmentChanged - Changing environment wakes up over 500 AIs. This is probably bad. (%f,%f,%f), (%f,%f,%f)\n",c.x,c.y,c.z,x,y,z)); + WARNING(true, ("CollisionWorld::environmentChanged - Changing environment wakes up over 500 AIs. This is probably bad. (%f,%f,%f), (%f,%f,%f)\n", c.x, c.y, c.z, x, y, z)); } - for(ObjectVec::size_type i = 0; i < count; i++) + for (ObjectVec::size_type i = 0; i < count; i++) { Object * mob = mobs[i]; @@ -1324,21 +1318,21 @@ void CollisionWorld::environmentChanged ( MultiShape const & shape ) // ---------------------------------------------------------------------- -SpatialDatabase * CollisionWorld::getDatabase ( void ) +SpatialDatabase * CollisionWorld::getDatabase(void) { return ms_database; } // ---------------------------------------------------------------------- -void CollisionWorld::objectWarped ( Object * object ) +void CollisionWorld::objectWarped(Object * object) { - if(object == nullptr) return; + if (object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); // object does not have a CollisionProperty - if(collision == nullptr) return; + if (collision == nullptr) return; // object is not in CollisionWorld if (!collision->isInCollisionWorld()) return; @@ -1356,37 +1350,37 @@ void CollisionWorld::objectWarped ( Object * object ) // range of the 2 objects before terrain LOS is done (only valid // if useTerrainLos is true) -QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * cellA, Vector const & pointA, - CellProperty const * cellB, Vector const & pointB, - Object const * ignoreObject, - bool const useTerrainLos, - bool const generateTerrainLos, - float const terrainLosMinDistance, - float const terrainLosMaxDistance, - float & outHitTime, Object const * & outHitObject ) +QueryInteractionResult CollisionWorld::queryInteraction(CellProperty const * cellA, Vector const & pointA, + CellProperty const * cellB, Vector const & pointB, + Object const * ignoreObject, + bool const useTerrainLos, + bool const generateTerrainLos, + float const terrainLosMinDistance, + float const terrainLosMaxDistance, + float & outHitTime, Object const * & outHitObject) { PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::queryInteraction"); - Vector localB = CollisionUtils::transformToCell(cellB,pointB,cellA); + Vector localB = CollisionUtils::transformToCell(cellB, pointB, cellA); - Segment3d inSeg(pointA,localB); + Segment3d inSeg(pointA, localB); // ---------- // Test portals first. If the query line hits a portal, we'll ignore any collision after that hit. float hitPortalTime = REAL_MAX; - CellProperty const * nextCell = cellA->getDestinationCell(pointA,localB,hitPortalTime); + CellProperty const * nextCell = cellA->getDestinationCell(pointA, localB, hitPortalTime); // ---------- // Test all extents first BaseExtent const * cellExtent = cellA->getCollisionExtent(); - if(cellExtent) + if (cellExtent) { Range hitRange = cellExtent->rangedIntersect(inSeg); - if(!hitRange.isEmpty() && (hitRange.getMin() < hitPortalTime)) + if (!hitRange.isEmpty() && (hitRange.getMin() < hitPortalTime)) { outHitTime = hitRange.getMin(); outHitObject = &cellA->getOwner(); @@ -1401,9 +1395,9 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c Object const * hitObject; float hitTime = 0.0f; - if(ms_database->queryInteraction(cellA,inSeg,ignoreObject,hitObject,hitTime)) + if (ms_database->queryInteraction(cellA, inSeg, ignoreObject, hitObject, hitTime)) { - if(hitTime < hitPortalTime) + if (hitTime < hitPortalTime) { outHitTime = hitTime; outHitObject = hitObject; @@ -1419,7 +1413,7 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c { if ((inSeg.getLength() >= terrainLosMinDistance) && (inSeg.getLength() <= terrainLosMaxDistance)) { - if(cellA == CellProperty::getWorldCellProperty()) + if (cellA == CellProperty::getWorldCellProperty()) { PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::queryInteraction::Terrain"); @@ -1434,12 +1428,12 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c if (generateTerrainLos) { // do terrain LOS check, generating any missing terrain between the 2 points - terrainCollide = terrain->collideForceChunkCreation(pointA,localB,info); + terrainCollide = terrain->collideForceChunkCreation(pointA, localB, info); } else { // do terrain LOS check, using only the generated terrain between the 2 points - terrainCollide = terrain->collide(pointA,localB,info); + terrainCollide = terrain->collide(pointA, localB, info); } } @@ -1453,9 +1447,9 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c Vector delta = localB - pointA; - float hitTime = Collision3d::ComponentAlong(hitDelta,delta); + float hitTime = Collision3d::ComponentAlong(hitDelta, delta); - if(hitTime < hitPortalTime) + if (hitTime < hitPortalTime) { outHitTime = hitTime; outHitObject = nullptr; @@ -1467,14 +1461,13 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c } } - // ---------- // If we did not hit a portal, the query ends in this cell. // If this cell is not the goal cell, then the query fails. - if(nextCell == nullptr) + if (nextCell == nullptr) { - if(cellA != cellB) + if (cellA != cellB) { outHitTime = 1.0f; outHitObject = nullptr; @@ -1496,19 +1489,19 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c // Don't bother recursing if the segment we'd test in the next cell is tiny - if(clipPoint.magnitudeBetween(localB) <= 0.01f) + if (clipPoint.magnitudeBetween(localB) <= 0.01f) { return QIR_None; } - Vector nextPoint = CollisionUtils::transformToCell(cellA,clipPoint,nextCell); + Vector nextPoint = CollisionUtils::transformToCell(cellA, clipPoint, nextCell); // ---------- // infinite recursion sentinel static int recursed = 0; - if(recursed >= 10) + if (recursed >= 10) { return QIR_None; } @@ -1518,16 +1511,16 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c recursed++; QueryInteractionResult recurseResult = queryInteraction(nextCell, - nextPoint, - cellB, - pointB, - ignoreObject, - useTerrainLos, - generateTerrainLos, - terrainLosMinDistance, - terrainLosMaxDistance, - outHitTime, - outHitObject); + nextPoint, + cellB, + pointB, + ignoreObject, + useTerrainLos, + generateTerrainLos, + terrainLosMinDistance, + terrainLosMaxDistance, + outHitTime, + outHitObject); recursed--; @@ -1540,61 +1533,60 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c return recurseResult; } - } // ---------------------------------------------------------------------- -bool CollisionWorld::query( Line3d const & line, ObjectVec * outList ) +bool CollisionWorld::query(Line3d const & line, ObjectVec * outList) { - return ms_database->queryStatics(line,outList); + return ms_database->queryStatics(line, outList); } // ---------- -bool CollisionWorld::query( Sphere const & sphere, ObjectVec * outList ) +bool CollisionWorld::query(Sphere const & sphere, ObjectVec * outList) { - return ms_database->queryStatics(sphere,outList); + return ms_database->queryStatics(sphere, outList); } // ---------------------------------------------------------------------- // Given startLoc and goalLoc in the same cell, determine if startLoc // can reach goalLoc -CanMoveResult CollisionWorld::canMoveInCell ( Object const * object, - CellProperty const * startCell, - FloorLocator const & startLoc, - Vector const & goalPos, - bool checkY, - bool checkFlora, - bool checkFauna, - FloorLocator & outLoc, - int & outHitPortalId ) +CanMoveResult CollisionWorld::canMoveInCell(Object const * object, + CellProperty const * startCell, + FloorLocator const & startLoc, + Vector const & goalPos, + bool checkY, + bool checkFlora, + bool checkFauna, + FloorLocator & outLoc, + int & outHitPortalId) { FloorLocator goalLoc; - if(checkY) + if (checkY) { - makeLocator(startCell,goalPos,goalLoc); + makeLocator(startCell, goalPos, goalLoc); } else { - goalLoc.setFloor( startCell->getFloor() ); - goalLoc.setPosition_p( goalPos ); + goalLoc.setFloor(startCell->getFloor()); + goalLoc.setPosition_p(goalPos); } - return canMoveInCell(object, startCell,startLoc,goalLoc,checkY,checkFlora,checkFauna,outLoc,outHitPortalId ); + return canMoveInCell(object, startCell, startLoc, goalLoc, checkY, checkFlora, checkFauna, outLoc, outHitPortalId); } -CanMoveResult CollisionWorld::canMoveInCell ( Object const * object, - CellProperty const * startCell, - FloorLocator const & startLoc, - FloorLocator const & goalLoc, - bool checkY, - bool checkFlora, - bool checkFauna, - FloorLocator & outLoc, - int & outHitPortalId ) +CanMoveResult CollisionWorld::canMoveInCell(Object const * object, + CellProperty const * startCell, + FloorLocator const & startLoc, + FloorLocator const & goalLoc, + bool checkY, + bool checkFlora, + bool checkFauna, + FloorLocator & outLoc, + int & outHitPortalId) { // ---------- // Test collision extents @@ -1602,13 +1594,13 @@ CanMoveResult CollisionWorld::canMoveInCell ( Object const * object, Vector startPos = startLoc.getPosition_p(); Vector goalPos = goalLoc.getPosition_p(); - Segment3d querySeg(startPos,goalPos); + Segment3d querySeg(startPos, goalPos); - if(startCell == CellProperty::getWorldCellProperty()) + if (startCell == CellProperty::getWorldCellProperty()) { float radius = startLoc.getRadius(); - Sphere sphere(startPos + Vector(0.0f,radius,0.0f),radius); + Sphere sphere(startPos + Vector(0.0f, radius, 0.0f), radius); Vector delta = goalPos - startPos; float collisionTime = 0.0f; @@ -1618,11 +1610,11 @@ CanMoveResult CollisionWorld::canMoveInCell ( Object const * object, return CMR_HitObstacle; } - if(ms_database->queryMaterial(startCell,sphere,delta,MT_Solid,checkFlora,checkFauna,object,collisionTime)) + if (ms_database && ms_database->queryMaterial(startCell, sphere, delta, MT_Solid, checkFlora, checkFauna, object, collisionTime)) { float epsilon = 0.05f / delta.magnitude(); - if(collisionTime > -epsilon) + if (collisionTime > -epsilon) { return CMR_HitObstacle; } @@ -1640,23 +1632,23 @@ CanMoveResult CollisionWorld::canMoveInCell ( Object const * object, bool hasOutLoc = false; - if(startCell == CellProperty::getWorldCellProperty()) + if (startCell == CellProperty::getWorldCellProperty()) { - if(ms_database) + if (ms_database) { FloorVec floors; - IGNORE_RETURN(ms_database->queryFloors(startCell,querySeg,&floors)); + IGNORE_RETURN(ms_database->queryFloors(startCell, querySeg, &floors)); - for(uint i = 0; i < floors.size(); i++) + for (uint i = 0; i < floors.size(); i++) { Floor const * floor = floors[i]; - CanMoveResult result = canMoveOnFloor(object,startLoc,floor,goalLoc,checkY,checkFlora,checkFauna,outLoc,outHitPortalId); + CanMoveResult result = canMoveOnFloor(object, startLoc, floor, goalLoc, checkY, checkFlora, checkFauna, outLoc, outHitPortalId); - if(result == CMR_MoveOK) + if (result == CMR_MoveOK) { - if(outHitPortalId != -1) + if (outHitPortalId != -1) { hasOutLoc = true; } @@ -1674,13 +1666,13 @@ CanMoveResult CollisionWorld::canMoveInCell ( Object const * object, Floor const * cellFloor = startCell->getFloor(); - if(cellFloor) + if (cellFloor) { - return canMoveOnFloor(object,startLoc,cellFloor,goalLoc,checkY,checkFlora,checkFauna,outLoc,outHitPortalId); + return canMoveOnFloor(object, startLoc, cellFloor, goalLoc, checkY, checkFlora, checkFauna, outLoc, outHitPortalId); } else { - if(!hasOutLoc) outLoc = goalLoc; + if (!hasOutLoc) outLoc = goalLoc; return CMR_MoveOK; } @@ -1688,33 +1680,33 @@ CanMoveResult CollisionWorld::canMoveInCell ( Object const * object, // ---------------------------------------------------------------------- -CanMoveResult CollisionWorld::canMove ( CellProperty const * startCell, - Vector const & startPos, - Vector const & goalPos, - float moveRadius, - bool checkY, - bool checkFlora, - bool checkFauna ) +CanMoveResult CollisionWorld::canMove(CellProperty const * startCell, + Vector const & startPos, + Vector const & goalPos, + float moveRadius, + bool checkY, + bool checkFlora, + bool checkFauna) { canMoveCount++; - FloorLocator startLoc(startPos,moveRadius); + FloorLocator startLoc(startPos, moveRadius); FloorLocator dummy; - return canMove( nullptr, startCell, startLoc, goalPos, checkY, checkFlora, checkFauna, dummy ); + return canMove(nullptr, startCell, startLoc, goalPos, checkY, checkFlora, checkFauna, dummy); } // ---------- -CanMoveResult CollisionWorld::canMove ( Object const * object, - Vector const & goalPos, - float moveRadius, - bool checkY, - bool checkFlora, - bool checkFauna ) +CanMoveResult CollisionWorld::canMove(Object const * object, + Vector const & goalPos, + float moveRadius, + bool checkY, + bool checkFlora, + bool checkFauna) { - if(object == nullptr) + if (object == nullptr) { return CMR_Error; } @@ -1722,19 +1714,19 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, { CollisionProperty const * collision = object->getCollisionProperty(); - if(collision) + if (collision) { Footprint const * foot = collision->getFootprint(); - if(foot && foot->isObjectInSync()) + if (foot && foot->isObjectInSync()) { FloorLocator const * footLoc = foot->getAnyContact(); - if(footLoc && footLoc->isAttached()) + if (footLoc && footLoc->isAttached()) { FloorLocator objectLoc = *footLoc; - objectLoc.setPosition_p( object->getPosition_p() ); + objectLoc.setPosition_p(object->getPosition_p()); objectLoc.setRadius(moveRadius); @@ -1742,31 +1734,31 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, FloorLocator dummy; - return canMove( object, startCell, objectLoc, goalPos, checkY, checkFlora, checkFauna, dummy ); + return canMove(object, startCell, objectLoc, goalPos, checkY, checkFlora, checkFauna, dummy); } } } } - FloorLocator startLoc(object->getPosition_p(),moveRadius); + FloorLocator startLoc(object->getPosition_p(), moveRadius); FloorLocator dummy; - return canMove( object, object->getParentCell(), startLoc, goalPos, checkY, checkFlora, checkFauna, dummy ); + return canMove(object, object->getParentCell(), startLoc, goalPos, checkY, checkFlora, checkFauna, dummy); } // ---------------------------------------------------------------------- -CanMoveResult CollisionWorld::canMove ( Object const * object, - CellProperty const * startCell, - FloorLocator const & startLoc, - Vector const & goalPos, - bool checkY, - bool checkFlora, - bool checkFauna, - FloorLocator & endLoc ) +CanMoveResult CollisionWorld::canMove(Object const * object, + CellProperty const * startCell, + FloorLocator const & startLoc, + Vector const & goalPos, + bool checkY, + bool checkFlora, + bool checkFauna, + FloorLocator & endLoc) { - if(startCell == nullptr) + if (startCell == nullptr) { startCell = CellProperty::getWorldCellProperty(); } @@ -1775,16 +1767,16 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, int hitPortalId = -1; - CanMoveResult cellResult = canMoveInCell(object,startCell,startLoc,goalPos,checkY,checkFlora,checkFauna,endLoc,hitPortalId); + CanMoveResult cellResult = canMoveInCell(object, startCell, startLoc, goalPos, checkY, checkFlora, checkFauna, endLoc, hitPortalId); - if(cellResult != CMR_MoveOK) + if (cellResult != CMR_MoveOK) { // We hit something in this cell return cellResult; } - if(hitPortalId == -1) + if (hitPortalId == -1) { // We made it to the goal without hitting a portal - the move // succeeds @@ -1797,21 +1789,21 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, Floor const * floor = endLoc.getFloor(); - if(!floor) + if (!floor) { return CMR_Error; } Object const * owner = floor->getOwner(); - if(!owner) + if (!owner) { return CMR_Error; } - CellProperty * newCell = startCell->getDestinationCell(owner,hitPortalId); + CellProperty * newCell = startCell->getDestinationCell(owner, hitPortalId); - if(!newCell) + if (!newCell) { return CMR_Error; } @@ -1821,15 +1813,15 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, Vector hitPortalPos = endLoc.getPosition_p(); - Vector newStartPos = CollisionUtils::transformToCell(startCell,hitPortalPos,newCell); + Vector newStartPos = CollisionUtils::transformToCell(startCell, hitPortalPos, newCell); - FloorLocator newStartLoc(newStartPos,startLoc.getRadius()); + FloorLocator newStartLoc(newStartPos, startLoc.getRadius()); - Vector newGoalPos = CollisionUtils::transformToCell(startCell,goalPos,newCell); + Vector newGoalPos = CollisionUtils::transformToCell(startCell, goalPos, newCell); float dist2 = newStartPos.magnitudeBetweenSquared(newGoalPos); - if(dist2 < 0.0000000001f) + if (dist2 < 0.0000000001f) { return CMR_MoveOK; } @@ -1837,11 +1829,11 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, { static int recursionCounter = 0; - if(recursionCounter == 10) + if (recursionCounter == 10) { Vector s = startLoc.getPosition_w(); - WARNING_STRICT_FATAL(ConfigSharedCollision::getReportWarnings(),("CollisionWorld::canMove - infinite recursion detected (%f,%f,%f)",s.x,s.y,s.z)); + WARNING_STRICT_FATAL(ConfigSharedCollision::getReportWarnings(), ("CollisionWorld::canMove - infinite recursion detected (%f,%f,%f)", s.x, s.y, s.z)); endLoc = FloorLocator::invalid; return CMR_Error; @@ -1849,7 +1841,7 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, recursionCounter++; - CanMoveResult result = canMove(object,newCell,newStartLoc,newGoalPos,checkY,checkFlora,checkFauna,endLoc); + CanMoveResult result = canMove(object, newCell, newStartLoc, newGoalPos, checkY, checkFlora, checkFauna, endLoc); recursionCounter--; @@ -1860,27 +1852,27 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, // ---------- // A nullptr goal cell means we don't care what cell we end up in as long as we make it to the goal -CanMoveResult CollisionWorld::canMove ( Object const * object, - CellProperty const * startCell, - FloorLocator const & startLoc, - CellProperty const * goalCell, - FloorLocator const & goalLoc, - bool checkY, - bool checkFlora, - bool checkFauna ) +CanMoveResult CollisionWorld::canMove(Object const * object, + CellProperty const * startCell, + FloorLocator const & startLoc, + CellProperty const * goalCell, + FloorLocator const & goalLoc, + bool checkY, + bool checkFlora, + bool checkFauna) { // ---------- - if(startCell == nullptr) + if (startCell == nullptr) { startCell = CellProperty::getWorldCellProperty(); } - if(goalCell == nullptr) + if (goalCell == nullptr) { FloorLocator dummy; - return canMove(object,startCell,startLoc,goalLoc.getPosition_p(),checkY,checkFlora,checkFauna,dummy); + return canMove(object, startCell, startLoc, goalLoc.getPosition_p(), checkY, checkFlora, checkFauna, dummy); } // ---------- @@ -1888,14 +1880,14 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, int hitPortalId = -1; FloorLocator endLoc; - if(startCell == goalCell) + if (startCell == goalCell) { // We're in the right cell. The move succeeds if it makes it to the goal // without hitting a portal on the way there. - CanMoveResult cellResult = canMoveInCell(object,startCell,startLoc,goalLoc,checkY,checkFlora,checkFauna,endLoc,hitPortalId); + CanMoveResult cellResult = canMoveInCell(object, startCell, startLoc, goalLoc, checkY, checkFlora, checkFauna, endLoc, hitPortalId); - if((cellResult == CMR_MoveOK) && (hitPortalId != -1)) + if ((cellResult == CMR_MoveOK) && (hitPortalId != -1)) { return CMR_MissedGoal; } @@ -1912,18 +1904,18 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, Vector const & goalPos = goalLoc.getPosition_p(); - Vector localGoalPos = CollisionUtils::transformToCell(goalCell,goalPos,startCell); + Vector localGoalPos = CollisionUtils::transformToCell(goalCell, goalPos, startCell); - CanMoveResult cellResult = canMoveInCell(object,startCell,startLoc,localGoalPos,checkY,checkFlora,checkFauna,endLoc,hitPortalId); + CanMoveResult cellResult = canMoveInCell(object, startCell, startLoc, localGoalPos, checkY, checkFlora, checkFauna, endLoc, hitPortalId); - if(cellResult != CMR_MoveOK) + if (cellResult != CMR_MoveOK) { // We hit something while trying to get out of this cell - the move fails. return cellResult; } - if(hitPortalId == -1) + if (hitPortalId == -1) { // We can move towards the goal from the current cell, but we don't exit the cell via a portal-adjacent // floor edge and we're not in the right goal cell - we can never get to the goal cell, @@ -1936,52 +1928,52 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, Floor const * floor = endLoc.getFloor(); - if(!floor) + if (!floor) { return CMR_Error; } Object const * owner = floor->getOwner(); - if(!owner) + if (!owner) { return CMR_Error; } - CellProperty * newCell = startCell->getDestinationCell(owner,hitPortalId); + CellProperty * newCell = startCell->getDestinationCell(owner, hitPortalId); - if(!newCell) + if (!newCell) { return CMR_Error; } Vector hitPortalPos = endLoc.getPosition_p(); - Vector newStartPos = CollisionUtils::transformToCell(startCell,hitPortalPos,newCell); + Vector newStartPos = CollisionUtils::transformToCell(startCell, hitPortalPos, newCell); - FloorLocator newStartLoc(newStartPos,startLoc.getRadius()); + FloorLocator newStartLoc(newStartPos, startLoc.getRadius()); newStartLoc.setRadius(startLoc.getRadius()); - return canMove(object,newCell,newStartLoc,goalCell,goalLoc,checkY,checkFlora,checkFauna); + return canMove(object, newCell, newStartLoc, goalCell, goalLoc, checkY, checkFlora, checkFauna); } // ---------------------------------------------------------------------- -CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, - FloorLocator const & startLoc, - Floor const * floor, - FloorLocator const & goalLoc, - bool checkY, - bool checkFlora, - bool checkFauna, - FloorLocator & outLoc, - int & outHitPortalId ) +CanMoveResult CollisionWorld::canMoveOnFloor(Object const * object, + FloorLocator const & startLoc, + Floor const * floor, + FloorLocator const & goalLoc, + bool checkY, + bool checkFlora, + bool checkFauna, + FloorLocator & outLoc, + int & outHitPortalId) { FloorMesh const * floorMesh = floor->getFloorMesh(); - Vector const & startPos = startLoc.getPosition_p() + Vector(0.0f,startLoc.getOffset(),0.0f); - Vector const & goalPos = goalLoc.getPosition_p() + Vector(0.0f,goalLoc.getOffset(),0.0f); + Vector const & startPos = startLoc.getPosition_p() + Vector(0.0f, startLoc.getOffset(), 0.0f); + Vector const & goalPos = goalLoc.getPosition_p() + Vector(0.0f, goalLoc.getOffset(), 0.0f); Vector localGoalPos = goalPos; @@ -1991,25 +1983,25 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, delta.y = 0.0f; - if(!startLoc.isAttachedTo(floor)) + if (!startLoc.isAttachedTo(floor)) { // Starting location isn't on this floor, run the canMoveOnFloor version that does an // attachment test instead - return canMoveOnFloor(object,startPos,radius,floor,goalLoc,checkY,checkFlora,checkFauna,outLoc,outHitPortalId); + return canMoveOnFloor(object, startPos, radius, floor, goalLoc, checkY, checkFlora, checkFauna, outLoc, outHitPortalId); } // ---------- FloorLocator result; - PathWalkResult walkResult = floor->canMove(startLoc,delta,-1,-1,result); + PathWalkResult walkResult = floor->canMove(startLoc, delta, -1, -1, result); outLoc = result; outHitPortalId = -1; - if((result.getTriId() >= 0) && (result.getEdgeId() >= 0)) + if ((result.getTriId() >= 0) && (result.getEdgeId() >= 0)) { int const exitTriId = result.getTriId(); @@ -2018,7 +2010,6 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, outHitPortalId = exitTri.getPortalId(result.getEdgeId()); } - // ---------- // The move has clipped to a crossable edge of the floor. // Check to see if the move re-enters this floor, and if it does @@ -2026,15 +2017,15 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, // Since this is a recursive call, it'll catch an arbitrary number of reentrances - if(walkResult == PWR_HitPortalEdge) + if (walkResult == PWR_HitPortalEdge) { // Exiting the mesh along a portal-adjacent edge is always a successful move. return CMR_MoveOK; } - else if(walkResult == PWR_ExitedMesh) + else if (walkResult == PWR_ExitedMesh) { - if(floor->isCellFloor()) + if (floor->isCellFloor()) { // Trying to walk off a ledge inside a cell isn't allowed at the moment. @@ -2045,9 +2036,9 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, FloorLocator reenterLoc; - if(floor->findEntryPoint(result,reenterDelta,false,reenterLoc)) + if (floor->findEntryPoint(result, reenterDelta, false, reenterLoc)) { - if(reenterLoc.getTime() > 0.0f) + if (reenterLoc.getTime() > 0.0f) { Vector reenterPos = reenterLoc.getPosition_p(); @@ -2057,18 +2048,18 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, static int recursionCounter = 0; - if(recursionCounter == 5) + if (recursionCounter == 5) { Vector s = startLoc.getPosition_w(); - WARNING_STRICT_FATAL(ConfigSharedCollision::getReportWarnings(),("CollisionWorld::canMoveOnFloor - infinite recursion detected (%f,%f,%f)",s.x,s.y,s.z)); + WARNING_STRICT_FATAL(ConfigSharedCollision::getReportWarnings(), ("CollisionWorld::canMoveOnFloor - infinite recursion detected (%f,%f,%f)", s.x, s.y, s.z)); outLoc = FloorLocator::invalid; outHitPortalId = -1; return CMR_Error; } recursionCounter++; - CanMoveResult floorResult = canMoveOnFloor(object,reenterLoc,floor,goalLoc,checkY,checkFlora,checkFauna,outLoc,outHitPortalId); + CanMoveResult floorResult = canMoveOnFloor(object, reenterLoc, floor, goalLoc, checkY, checkFlora, checkFauna, outLoc, outHitPortalId); recursionCounter--; @@ -2081,11 +2072,11 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, return CMR_MoveOK; } - else if(walkResult == PWR_WalkOk) + else if (walkResult == PWR_WalkOk) { - if((floor->getCell() == CellProperty::getWorldCellProperty())) + if ((floor->getCell() == CellProperty::getWorldCellProperty())) { - if(result.isFallthrough()) + if (result.isFallthrough()) { return CMR_MoveOK; } @@ -2099,7 +2090,7 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, // The start and goal locs are on this floor - if the move didn't get to // the goal tri, the move failed. - if(checkY && (goalLoc.getId() != -1) && (result.getId() != goalLoc.getId())) + if (checkY && (goalLoc.getId() != -1) && (result.getId() != goalLoc.getId())) { return CMR_MissedGoal; } @@ -2110,11 +2101,11 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, } else { - if(result.getFloor() == floor) + if (result.getFloor() == floor) { Vector resultPos = result.getPosition_p(); - if((resultPos.y - goalPos.y) > 3.0f) + if ((resultPos.y - goalPos.y) > 3.0f) { return CMR_MissedGoal; } @@ -2137,29 +2128,29 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, // ---------------------------------------------------------------------- -CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, - Vector const & inPos, - float moveRadius, - Floor const * floor, - FloorLocator const & inGoalLoc, - bool checkY, - bool checkFlora, - bool checkFauna, - FloorLocator & outLoc, - int & outHitPortalId ) +CanMoveResult CollisionWorld::canMoveOnFloor(Object const * object, + Vector const & inPos, + float moveRadius, + Floor const * floor, + FloorLocator const & inGoalLoc, + bool checkY, + bool checkFlora, + bool checkFauna, + FloorLocator & outLoc, + int & outHitPortalId) { bool hasStartLoc = false; FloorLocator startLoc; FloorLocator goalLoc = inGoalLoc; - if(goalLoc.getFloor() != floor) + if (goalLoc.getFloor() != floor) { - Vector goalPos_p = goalLoc.getPosition_p( floor->getCell() ); + Vector goalPos_p = goalLoc.getPosition_p(floor->getCell()); FloorLocator tempLoc; - if(floor->dropTest( goalPos_p, tempLoc )) + if (floor->dropTest(goalPos_p, tempLoc)) { goalLoc = tempLoc; } @@ -2172,7 +2163,7 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, // If the start point is already above the floor, the floor move will begin // at the floor point under the start point - if(floor->dropTest(inPos,startLoc)) + if (floor->dropTest(inPos, startLoc)) { Vector startPos_w = startLoc.getPosition_w(); @@ -2187,13 +2178,13 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, Vector delta = goalLoc.getPosition_p() - inPos; - FloorLocator tempLoc(inPos,moveRadius); + FloorLocator tempLoc(inPos, moveRadius); - if(floor->findEntryPoint(tempLoc,delta,false,startLoc)) + if (floor->findEntryPoint(tempLoc, delta, false, startLoc)) { bool edgeCrossable = floor->getFloorMesh()->getFloorTri(startLoc.getId()).isCrossable(startLoc.getEdgeId()); - if(!edgeCrossable) + if (!edgeCrossable) { return CMR_HitFloorEdge; } @@ -2205,11 +2196,11 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, // ---------- // If we found a starting point for the floor move, run the floor move - if(hasStartLoc) + if (hasStartLoc) { startLoc.setRadius(moveRadius); - return canMoveOnFloor(object,startLoc,floor,goalLoc,checkY,checkFlora,checkFauna,outLoc,outHitPortalId); + return canMoveOnFloor(object, startLoc, floor, goalLoc, checkY, checkFlora, checkFauna, outLoc, outHitPortalId); } else { @@ -2224,7 +2215,7 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, // do a temporal collision test against each of them, return true if // the creature hit one and a pointer to the first one hit. -bool CollisionWorld::findFirstObstacle ( Object const * creature, float creatureRadius, Vector const & testPos, Vector const & goalPos, bool testStatics, bool testCreatures, Object const * & outObject ) +bool CollisionWorld::findFirstObstacle(Object const * creature, float creatureRadius, Vector const & testPos, Vector const & goalPos, bool testStatics, bool testCreatures, Object const * & outObject) { UNREF(goalPos); UNREF(creatureRadius); @@ -2233,21 +2224,21 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature Vector delta = testPos - startPos; - if(creature == nullptr) return false; + if (creature == nullptr) return false; CollisionProperty const * collision = creature->getCollisionProperty(); - if(collision == nullptr) return false; + if (collision == nullptr) return false; BaseExtent const * baseExtent = collision->getExtent_p(); SimpleExtent const * simpleExtent = dynamic_cast(baseExtent); - if(simpleExtent == nullptr) return false; + if (simpleExtent == nullptr) return false; MultiShape const & shape = simpleExtent->getShape(); - if(shape.getShapeType() != MultiShape::MST_Sphere) return false; + if (shape.getShapeType() != MultiShape::MST_Sphere) return false; // ---------- // Test collision extents @@ -2262,24 +2253,24 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature statics.clear(); creatures.clear(); - if(ms_database->queryObjects(creature->getParentCell(), shape, delta, (testStatics ? &statics : nullptr), (testCreatures ? &creatures : nullptr))) + if (ms_database->queryObjects(creature->getParentCell(), shape, delta, (testStatics ? &statics : nullptr), (testCreatures ? &creatures : nullptr))) { ObjectVector::size_type const nStatics = statics.size(); ObjectVector::size_type i; - for(i = 0; i < nStatics; i++) + for (i = 0; i < nStatics; i++) { Object const * obstacle = statics[i]; - if(obstacle == nullptr) continue; + if (obstacle == nullptr) continue; - if(obstacle == creature) continue; + if (obstacle == creature) continue; - if(Distance2d::Distance2(obstacle->getPosition_w(),goalPos) < 0.000001) continue; + if (Distance2d::Distance2(obstacle->getPosition_w(), goalPos) < 0.000001) continue; - DetectResult result = CollisionDetect::testObjects(creature,delta,obstacle); + DetectResult result = CollisionDetect::testObjects(creature, delta, obstacle); - if(result.collided && (result.collisionTime < minResult.collisionTime)) + if (result.collided && (result.collisionTime < minResult.collisionTime)) { minResult = result; minObject = obstacle; @@ -2288,19 +2279,19 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature ObjectVector::size_type const nCreatures = creatures.size(); - for(i = 0; i < nCreatures; i++) + for (i = 0; i < nCreatures; i++) { Object const * obstacle = creatures[i]; - if(obstacle == nullptr) continue; + if (obstacle == nullptr) continue; - if(obstacle == creature) continue; + if (obstacle == creature) continue; - if(Distance2d::Distance2(obstacle->getPosition_w(),goalPos) < 0.000001) continue; + if (Distance2d::Distance2(obstacle->getPosition_w(), goalPos) < 0.000001) continue; - DetectResult result = CollisionDetect::testObjects(creature,delta,obstacle); + DetectResult result = CollisionDetect::testObjects(creature, delta, obstacle); - if(result.collided && (result.collisionTime < minResult.collisionTime)) + if (result.collided && (result.collisionTime < minResult.collisionTime)) { minResult = result; minObject = obstacle; @@ -2323,7 +2314,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature // We collided with a floor. Check if we collide with the floor sooner than anything else. bool useFloorCollision; - if(!minResult.collided) // don't return a floor as a collision object if nothing was collided with earlier + if (!minResult.collided) // don't return a floor as a collision object if nothing was collided with earlier { useFloorCollision = false; } @@ -2332,7 +2323,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature // Figure out if collided object is closer than floor. Collided object looks like its // extent is assumed to be in the same parent space as creature. That might be a bug. float const minResultMagnitudeSquared = (creature->getPosition_p() - minResult.extentB->getCenter()).magnitudeSquared(); - float const floorMagnitudeSquared = (creature->getPosition_w() - collisionLocation_w).magnitudeSquared(); + float const floorMagnitudeSquared = (creature->getPosition_w() - collisionLocation_w).magnitudeSquared(); useFloorCollision = floorMagnitudeSquared < minResultMagnitudeSquared; } @@ -2346,7 +2337,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature } } - if(minResult.collided) + if (minResult.collided) { outObject = minObject; @@ -2360,7 +2351,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature // ---------------------------------------------------------------------- -bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & goalPos, bool testStatics, bool testCreatures, Object const * & outObject ) +bool CollisionWorld::findFirstObstacle(Sphere const & sphere, Vector const & goalPos, bool testStatics, bool testCreatures, Object const * & outObject) { Vector startPos = sphere.getCenter(); @@ -2380,20 +2371,20 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g statics.clear(); creatures.clear(); - if(ms_database->queryObjects(CellProperty::getWorldCellProperty(), shape, delta, (testStatics ? &statics : nullptr), (testCreatures ? &creatures : nullptr))) + if (ms_database->queryObjects(CellProperty::getWorldCellProperty(), shape, delta, (testStatics ? &statics : nullptr), (testCreatures ? &creatures : nullptr))) { size_t const nStatics = statics.size(); size_t i; - for(i = 0; i < nStatics; i++) + for (i = 0; i < nStatics; i++) { Object const * obstacle = statics[i]; - if(obstacle == nullptr) continue; + if (obstacle == nullptr) continue; - DetectResult result = CollisionDetect::testSphereObject(sphere,delta,obstacle); + DetectResult result = CollisionDetect::testSphereObject(sphere, delta, obstacle); - if(result.collided && (result.collisionTime < minResult.collisionTime)) + if (result.collided && (result.collisionTime < minResult.collisionTime)) { minResult = result; minObject = obstacle; @@ -2402,17 +2393,17 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g size_t const nCreatures = creatures.size(); - for(i = 0; i < nCreatures; i++) + for (i = 0; i < nCreatures; i++) { Object const * obstacle = creatures[i]; - if(obstacle == nullptr) continue; + if (obstacle == nullptr) continue; - if(Distance2d::Distance2(obstacle->getPosition_w(),goalPos) < 0.000001) continue; + if (Distance2d::Distance2(obstacle->getPosition_w(), goalPos) < 0.000001) continue; - DetectResult result = CollisionDetect::testSphereObject(sphere,delta,obstacle); + DetectResult result = CollisionDetect::testSphereObject(sphere, delta, obstacle); - if(result.collided && (result.collisionTime < minResult.collisionTime)) + if (result.collided && (result.collisionTime < minResult.collisionTime)) { minResult = result; minObject = obstacle; @@ -2420,7 +2411,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g } } - if(minResult.collided) + if (minResult.collided) { outObject = minObject; @@ -2435,14 +2426,14 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g // ---------------------------------------------------------------------- // Compute the radius of the largest sphere that can fit around the given point without hitting anything -bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & point_p, float maxDistance, float & outRadius ) +bool CollisionWorld::calcBubble(CellProperty const * cell, Vector const & point_p, float maxDistance, float & outRadius) { - return calcBubble(cell,point_p,nullptr,maxDistance,outRadius); + return calcBubble(cell, point_p, nullptr, maxDistance, outRadius); } -bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & point_p, Object const * ignoreObject, float maxDistance, float & outRadius ) +bool CollisionWorld::calcBubble(CellProperty const * cell, Vector const & point_p, Object const * ignoreObject, float maxDistance, float & outRadius) { - Vector point_w = CollisionUtils::transformToWorld(cell,point_p); + Vector point_w = CollisionUtils::transformToWorld(cell, point_p); float minDistance = maxDistance; @@ -2451,17 +2442,17 @@ bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & poin results.clear(); - if(ms_database->queryCloseStatics(point_w,minDistance,&results)) + if (ms_database->queryCloseStatics(point_w, minDistance, &results)) { ObjectVec::size_type const count = results.size(); - for(ObjectVec::size_type i = 0; i < count; i++) + for (ObjectVec::size_type i = 0; i < count; i++) { Object const * object = results[i]; NOT_NULL(object); - if(object == ignoreObject) continue; + if (object == ignoreObject) continue; CollisionProperty const * collision = object->getCollisionProperty(); @@ -2469,9 +2460,9 @@ bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & poin float distance = REAL_MAX; - if(collision->getDistance(point_w,minDistance,distance)) + if (collision->getDistance(point_w, minDistance, distance)) { - if(distance < minDistance) minDistance = distance; + if (distance < minDistance) minDistance = distance; } } } @@ -2484,25 +2475,25 @@ bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & poin results.clear(); - if(ms_database->queryCloseFloors(point_w,minDistance,&results)) + if (ms_database->queryCloseFloors(point_w, minDistance, &results)) { FloorVec::size_type const count = results.size(); - for(FloorVec::size_type i = 0; i < count; i++) + for (FloorVec::size_type i = 0; i < count; i++) { Floor const * floor = results[i]; NOT_NULL(floor); - if(floor->getOwner() == ignoreObject) continue; + if (floor->getOwner() == ignoreObject) continue; float distance = REAL_MAX; FloorEdgeId dummyId; - if(floor->getDistanceUncrossable2d(point_w,minDistance,distance,dummyId)) + if (floor->getDistanceUncrossable2d(point_w, minDistance, distance, dummyId)) { - if(distance < minDistance) minDistance = distance; + if (distance < minDistance) minDistance = distance; } } } @@ -2510,26 +2501,26 @@ bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & poin // ---------- - if(cell && (cell != CellProperty::getWorldCellProperty())) + if (cell && (cell != CellProperty::getWorldCellProperty())) { Floor const * floor = cell->getFloor(); - if(floor) + if (floor) { float distance = REAL_MAX; FloorEdgeId dummyId; - if(floor->getDistanceUncrossable2d(point_w,minDistance,distance,dummyId)) + if (floor->getDistanceUncrossable2d(point_w, minDistance, distance, dummyId)) { - if(distance < minDistance) minDistance = distance; + if (distance < minDistance) minDistance = distance; } } } // ---------- - if(minDistance < maxDistance) + if (minDistance < maxDistance) { outRadius = minDistance; return true; @@ -2542,27 +2533,27 @@ bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & poin // ---------------------------------------------------------------------- -bool CollisionWorld::testClear ( CellProperty const * cell, Sphere const & sphere_p ) +bool CollisionWorld::testClear(CellProperty const * cell, Sphere const & sphere_p) { - bool hitStatic = ms_database->queryMaterial(cell,sphere_p,MT_Solid); + bool hitStatic = ms_database->queryMaterial(cell, sphere_p, MT_Solid); - if(hitStatic) return false; + if (hitStatic) return false; return true; } // ---------------------------------------------------------------------- -bool CollisionWorld::canMoveInSpace( Object const * object, Sphere const & sphere, Vector const & goalPos ) +bool CollisionWorld::canMoveInSpace(Object const * object, Sphere const & sphere, Vector const & goalPos) { Vector delta = goalPos - sphere.getCenter(); float collisionTime = 0.0f; - if(ms_database->queryMaterial(CellProperty::getWorldCellProperty(),sphere,delta,MT_Solid,false,false,object,collisionTime)) + if (ms_database->queryMaterial(CellProperty::getWorldCellProperty(), sphere, delta, MT_Solid, false, false, object, collisionTime)) { float epsilon = 0.05f / delta.magnitude(); - if(collisionTime > -epsilon) + if (collisionTime > -epsilon) { return false; } @@ -2573,20 +2564,20 @@ bool CollisionWorld::canMoveInSpace( Object const * object, Sphere const & spher // ---------------------------------------------------------------------- -bool CollisionWorld::findLocators ( CellProperty const * cell, Vector const & point, std::vector & outLocs ) +bool CollisionWorld::findLocators(CellProperty const * cell, Vector const & point, std::vector & outLocs) { outLocs.clear(); // ---------- // If the point is in a cell, its only locator is the one on the cell floor - if(cell && (cell != CellProperty::getWorldCellProperty())) + if (cell && (cell != CellProperty::getWorldCellProperty())) { Floor const * floor = cell->getFloor(); FloorLocator tempLoc; - if( floor && floor->dropTest(point,tempLoc) ) + if (floor && floor->dropTest(point, tempLoc)) { outLocs.push_back(tempLoc); @@ -2602,21 +2593,21 @@ bool CollisionWorld::findLocators ( CellProperty const * cell, Vector const & po // ---------- // Otherwise we need to find all object floors and see if the point falls on any of them - if(ms_database) + if (ms_database) { FloorVec floors; - Segment3d querySeg( point, point - (Vector::unitY * 10.0f) ); + Segment3d querySeg(point, point - (Vector::unitY * 10.0f)); - IGNORE_RETURN(ms_database->queryFloors(cell,querySeg,&floors)); + IGNORE_RETURN(ms_database->queryFloors(cell, querySeg, &floors)); - for(uint i = 0; i < floors.size(); i++) + for (uint i = 0; i < floors.size(); i++) { Floor * floor = floors[i]; FloorLocator tempLoc; - if(floor && floor->dropTest(point,tempLoc)) + if (floor && floor->dropTest(point, tempLoc)) { outLocs.push_back(tempLoc); } @@ -2631,29 +2622,29 @@ bool CollisionWorld::findLocators ( CellProperty const * cell, Vector const & po // This should work OK, but if the point drops onto multiple floors it will make a locator for only // the topmost floor -bool CollisionWorld::makeLocator ( CellProperty const * cell, Vector const & point, FloorLocator & outLoc ) +bool CollisionWorld::makeLocator(CellProperty const * cell, Vector const & point, FloorLocator & outLoc) { static FloorLocatorVec tempLocs; tempLocs.clear(); - if(findLocators(cell,point,tempLocs)) + if (findLocators(cell, point, tempLocs)) { float maxHeight = -REAL_MAX; int highestLoc = -1; - for(uint i = 0; i < tempLocs.size(); i++) + for (uint i = 0; i < tempLocs.size(); i++) { float height = tempLocs[i].getPosition_p().y; - if(height > maxHeight) + if (height > maxHeight) { maxHeight = height; highestLoc = static_cast(i); } } - if(highestLoc != -1) + if (highestLoc != -1) { outLoc = tempLocs[static_cast(highestLoc)]; return true; @@ -2673,12 +2664,12 @@ bool CollisionWorld::makeLocator ( CellProperty const * cell, Vector const & poi // ---------------------------------------------------------------------- -bool CollisionWorld::isServerSide ( void ) +bool CollisionWorld::isServerSide(void) { return ms_serverSide; } -void CollisionWorld::setServerSide ( bool serverSide ) +void CollisionWorld::setServerSide(bool serverSide) { ms_serverSide = serverSide; } @@ -2711,22 +2702,22 @@ Floor const * CollisionWorld::getFloorStandingOn(Object const & object) float resultDistanceBelowObject = 0.0f; float dropTestHeight = std::numeric_limits::min(); - for(MultiListConstDataIterator it(floorList); it; ++it) + for (MultiListConstDataIterator it(floorList); it; ++it) { FloorContactShape const * const contact = *it; FloorLocator const & loc = contact->m_contact; Floor const * const f = loc.getFloor(); FloorLocator tempLoc; - if(f->dropTest(object.getPosition_p(),tempLoc)) + if (f->dropTest(object.getPosition_p(), tempLoc)) { //if we might be standing on it (it's below us), give 1/2 meter buffer space - if((tempLoc.getPosition_w().y - 0.5) <= objectHeight) + if ((tempLoc.getPosition_w().y - 0.5) <= objectHeight) { float const distanceBelowObject = std::max(0.0f, objectHeight - tempLoc.getPosition_w().y); //if none found yet, use it - if(!resultFloor) + if (!resultFloor) { resultFloor = f; resultDistanceBelowObject = distanceBelowObject; @@ -2735,7 +2726,7 @@ Floor const * CollisionWorld::getFloorStandingOn(Object const & object) else { //if it's less below us than the current, use it - if(distanceBelowObject < resultDistanceBelowObject) + if (distanceBelowObject < resultDistanceBelowObject) { resultFloor = f; resultDistanceBelowObject = distanceBelowObject; @@ -2753,7 +2744,7 @@ Floor const * CollisionWorld::getFloorStandingOn(Object const & object) if (terrainObject != nullptr) { CellProperty const * const parentCell = object.getParentCell(); - + if (parentCell->isWorldCell()) { float terrainHeight; @@ -2785,4 +2776,4 @@ Floor const * CollisionWorld::getFloorStandingOn(Object const & object) return resultFloor; } -// ---------------------------------------------------------------------- +// ---------------------------------------------------------------------- \ No newline at end of file diff --git a/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp b/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp index ae508f4a..80c3cead 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp @@ -69,33 +69,34 @@ float gs_hopTolerance = 0.3f; float gs_clearTolerance = 0.001f; float gs_hitPastTolerance = 0.2f; // how far (meters) in the past a hit can occur and still be considered a hit -const Tag TAG_VERT = TAG(V,E,R,T); -const Tag TAG_TRIS = TAG(T,R,I,S); -const Tag TAG_FLOR = TAG(F,L,O,R); -const Tag TAG_PNOD = TAG(P,N,O,D); -const Tag TAG_PEDG = TAG(P,E,D,G); -const Tag TAG_BTRE = TAG(B,T,R,E); -const Tag TAG_BEDG = TAG(B,E,D,G); -const Tag TAG_PGRF = TAG(P,G,R,F); +const Tag TAG_VERT = TAG(V, E, R, T); +const Tag TAG_TRIS = TAG(T, R, I, S); +const Tag TAG_FLOR = TAG(F, L, O, R); +const Tag TAG_PNOD = TAG(P, N, O, D); +const Tag TAG_PEDG = TAG(P, E, D, G); +const Tag TAG_BTRE = TAG(B, T, R, E); +const Tag TAG_BEDG = TAG(B, E, D, G); +const Tag TAG_PGRF = TAG(P, G, R, F); template <> FloorMeshList::CreateDataResourceMap *FloorMeshList::ms_bindings = nullptr; template <> FloorMeshList::LoadedDataResourceMap *FloorMeshList::ms_loaded = nullptr; // ---------------------------------------------------------------------- -FloorMesh::FloorMesh(const std::string & filename) -: CollisionMesh(), - DataResource(filename.c_str ()), - m_vertices( new VectorVector() ), - m_floorTris( new FloorTriVec() ), - m_crossableEdges( new FloorEdgeIdVec() ), - m_uncrossableEdges( new FloorEdgeIdVec() ), - m_wallBaseEdges( new FloorEdgeIdVec() ), - m_wallTopEdges( new FloorEdgeIdVec() ), - m_pathGraph(nullptr), - m_appearance(nullptr), - m_triMarkCounter(1000), // just some random number - m_objectFloor(false) +FloorMesh::FloorMesh(const std::string & filename) + : CollisionMesh(), + DataResource(filename.c_str()), + m_vertices(new VectorVector()), + m_floorTris(new FloorTriVec()), + m_crossableEdges(new FloorEdgeIdVec()), + m_uncrossableEdges(new FloorEdgeIdVec()), + m_wallBaseEdges(new FloorEdgeIdVec()), + m_wallTopEdges(new FloorEdgeIdVec()), + m_pathGraph(nullptr), + m_appearance(nullptr), + m_triMarkCounter(1000), // just some random number + m_objectFloor(false), + m_pathLines() { #ifdef _DEBUG @@ -112,21 +113,21 @@ FloorMesh::FloorMesh(const std::string & filename) // ---------- -FloorMesh::FloorMesh( VectorVector const & vertices, IntVector const & indices ) -: CollisionMesh(), - DataResource(""), - m_vertices( new VectorVector() ), - m_floorTris( new FloorTriVec() ), - m_crossableEdges( new FloorEdgeIdVec() ), - m_uncrossableEdges( new FloorEdgeIdVec() ), - m_wallBaseEdges( new FloorEdgeIdVec() ), - m_wallTopEdges( new FloorEdgeIdVec() ), - m_pathGraph(nullptr), - m_appearance(nullptr), - m_triMarkCounter(1000), - m_objectFloor(false) +FloorMesh::FloorMesh(VectorVector const & vertices, IntVector const & indices) + : CollisionMesh(), + DataResource(""), + m_vertices(new VectorVector()), + m_floorTris(new FloorTriVec()), + m_crossableEdges(new FloorEdgeIdVec()), + m_uncrossableEdges(new FloorEdgeIdVec()), + m_wallBaseEdges(new FloorEdgeIdVec()), + m_wallTopEdges(new FloorEdgeIdVec()), + m_pathGraph(nullptr), + m_appearance(nullptr), + m_triMarkCounter(1000), + m_objectFloor(false) { - build(vertices,indices); + build(vertices, indices); #ifdef _DEBUG @@ -196,25 +197,25 @@ FloorMesh::~FloorMesh() // ---------------------------------------------------------------------- -void FloorMesh::calcBounds ( void ) const +void FloorMesh::calcBounds(void) const { AxialBox bounds; - for(int i = 0; i < getVertexCount(); i++) + for (int i = 0; i < getVertexCount(); i++) { - bounds.add( getVertex(i) ); + bounds.add(getVertex(i)); } // ---------- // floor collision will catch when a player is over/under a floor // mesh - bounds.setMax( bounds.getMax() + Vector(0.0f,2.0f,0.0f) ); - bounds.setMin( bounds.getMin() - Vector(0.0f,1.0f,0.0f) ); + bounds.setMax(bounds.getMax() + Vector(0.0f, 2.0f, 0.0f)); + bounds.setMin(bounds.getMin() - Vector(0.0f, 1.0f, 0.0f)); // ---------- - if(m_appearance) + if (m_appearance) { Extent const * extent = m_appearance->getExtent(); @@ -222,7 +223,7 @@ void FloorMesh::calcBounds ( void ) const AxialBox const & box = boxExtent->getBox(); - if(boxExtent) + if (boxExtent) { bounds.add(box.getCorner(0)); bounds.add(box.getCorner(1)); @@ -233,7 +234,7 @@ void FloorMesh::calcBounds ( void ) const // ---------- - m_extent->setShape( MultiShape(bounds) ); + m_extent->setShape(MultiShape(bounds)); setBoundsDirty(false); } @@ -241,122 +242,122 @@ void FloorMesh::calcBounds ( void ) const // ====================================================================== // Basic interface inherited from CollisionMesh - accessors -int FloorMesh::getVertexCount ( void ) const +int FloorMesh::getVertexCount(void) const { return m_vertices->size(); } -Vector const & FloorMesh::getVertex ( int whichVertex ) const +Vector const & FloorMesh::getVertex(int whichVertex) const { return m_vertices->at(whichVertex); } -void FloorMesh::setVertex ( int whichVertex, Vector const & newPoint ) +void FloorMesh::setVertex(int whichVertex, Vector const & newPoint) { m_vertices->at(whichVertex) = newPoint; } // ---------- -int FloorMesh::getTriCount ( void ) const +int FloorMesh::getTriCount(void) const { return m_floorTris->size(); } -IndexedTri const & FloorMesh::getIndexedTri ( int whichTri ) const +IndexedTri const & FloorMesh::getIndexedTri(int whichTri) const { return m_floorTris->at(whichTri); } -void FloorMesh::setIndexedTri ( int whichTri, IndexedTri const & newTri ) +void FloorMesh::setIndexedTri(int whichTri, IndexedTri const & newTri) { IndexedTri & I = m_floorTris->at(whichTri); - + I = newTri; } // ---------- -Triangle3d FloorMesh::getTriangle ( int whichTri ) const +Triangle3d FloorMesh::getTriangle(int whichTri) const { FloorTri const & F = getFloorTri(whichTri); - Vector const & A = getVertex( F.getCornerIndex(0) ); - Vector const & B = getVertex( F.getCornerIndex(1) ); - Vector const & C = getVertex( F.getCornerIndex(2) ); + Vector const & A = getVertex(F.getCornerIndex(0)); + Vector const & B = getVertex(F.getCornerIndex(1)); + Vector const & C = getVertex(F.getCornerIndex(2)); - return Triangle3d(A,B,C); + return Triangle3d(A, B, C); } // ---------------------------------------------------------------------- -Transform const & FloorMesh::getTransform_o2p ( void ) const +Transform const & FloorMesh::getTransform_o2p(void) const { return Transform::identity; } // ---------------------------------------------------------------------- -void FloorMesh::addTriangle ( Triangle3d const & t ) +void FloorMesh::addTriangle(Triangle3d const & t) { - int index = static_cast( m_vertices->size() ); + int index = static_cast(m_vertices->size()); m_vertices->push_back(t.getCornerA()); m_vertices->push_back(t.getCornerB()); m_vertices->push_back(t.getCornerC()); - addTriangle( index + 0, index + 1, index + 2 ); + addTriangle(index + 0, index + 1, index + 2); } // ---------- -void FloorMesh::addTriangle ( int iA, int iB, int iC ) +void FloorMesh::addTriangle(int iA, int iB, int iC) { FloorTri F; - F.setCornerIndex( 0, iA ); - F.setCornerIndex( 1, iB ); - F.setCornerIndex( 2, iC ); - - F.setNeighborIndex( 0, -1 ); - F.setNeighborIndex( 1, -1 ); - F.setNeighborIndex( 2, -1 ); + F.setCornerIndex(0, iA); + F.setCornerIndex(1, iB); + F.setCornerIndex(2, iC); - Vector A = getVertex( iA ); - Vector B = getVertex( iB ); - Vector C = getVertex( iC ); + F.setNeighborIndex(0, -1); + F.setNeighborIndex(1, -1); + F.setNeighborIndex(2, -1); - Vector temp = (C-A).cross(B-A); - IGNORE_RETURN( temp.normalize() ); + Vector A = getVertex(iA); + Vector B = getVertex(iB); + Vector C = getVertex(iC); - F.setNormal( temp ); + Vector temp = (C - A).cross(B - A); + IGNORE_RETURN(temp.normalize()); - F.setIndex( static_cast( getTriCount() ) ); + F.setNormal(temp); + + F.setIndex(static_cast(getTriCount())); m_floorTris->push_back(F); } // ---------------------------------------------------------------------- -void FloorMesh::deleteVertex ( int whichVertex ) +void FloorMesh::deleteVertex(int whichVertex) { UNREF(whichVertex); - FATAL(true,("can't delete floor vertices yet...")); + FATAL(true, ("can't delete floor vertices yet...")); } -void FloorMesh::deleteVertices ( IntVector const & vertIndices ) +void FloorMesh::deleteVertices(IntVector const & vertIndices) { UNREF(vertIndices); - FATAL(true,("can't delete floor vertices yet...")); + FATAL(true, ("can't delete floor vertices yet...")); } // ---------------------------------------------------------------------- -void FloorMesh::deleteTri ( int whichTriangle ) +void FloorMesh::deleteTri(int whichTriangle) { - IGNORE_RETURN( m_floorTris->erase( m_floorTris->begin() + whichTriangle ) ); + IGNORE_RETURN(m_floorTris->erase(m_floorTris->begin() + whichTriangle)); //@todo - This really doesn't need to be called after every erase, // it ought to be called after all the erasing is done. @@ -367,9 +368,9 @@ void FloorMesh::deleteTri ( int whichTriangle ) // ---------- // Mark-n-sweep delete -void FloorMesh::deleteTris ( IntVector const & triIndices ) +void FloorMesh::deleteTris(IntVector const & triIndices) { - if(triIndices.empty()) return; + if (triIndices.empty()) return; // ---------- @@ -379,27 +380,27 @@ void FloorMesh::deleteTris ( IntVector const & triIndices ) int indexCount = triIndices.size(); - for(int iBad = 0; iBad < indexCount; iBad++) + for (int iBad = 0; iBad < indexCount; iBad++) { - getFloorTri( triIndices[iBad] ).setMark(1); + getFloorTri(triIndices[iBad]).setMark(1); } // ---------- FloorTriVec * pGoodTris = new FloorTriVec; - for(int iTri = 0; iTri < getTriCount(); iTri++) + for (int iTri = 0; iTri < getTriCount(); iTri++) { FloorTri const & F = getFloorTri(iTri); - if(F.getMark() != 1) + if (F.getMark() != 1) { pGoodTris->push_back(F); } } // ---------- - + FloorTriVec * pOldTris = m_floorTris; m_floorTris = pGoodTris; @@ -411,7 +412,7 @@ void FloorMesh::deleteTris ( IntVector const & triIndices ) // ---------------------------------------------------------------------- -void FloorMesh::clear ( void ) +void FloorMesh::clear(void) { CollisionMesh::clear(); @@ -426,56 +427,56 @@ void FloorMesh::clear ( void ) // ---------------------------------------------------------------------- -void FloorMesh::assignIndices ( void ) +void FloorMesh::assignIndices(void) { - for(int i = 0; i < getTriCount(); i++) + for (int i = 0; i < getTriCount(); i++) { - getFloorTri(i).setIndex( static_cast(i) ); + getFloorTri(i).setIndex(static_cast(i)); } } // ---------------------------------------------------------------------- -void FloorMesh::clearMarks ( int clearMarkValue ) +void FloorMesh::clearMarks(int clearMarkValue) { - for(int i = 0; i < getTriCount(); i++) + for (int i = 0; i < getTriCount(); i++) { FloorTri & F = getFloorTri(i); F.setMark(clearMarkValue); - F.setEdgeMark(0,clearMarkValue); - F.setEdgeMark(1,clearMarkValue); - F.setEdgeMark(2,clearMarkValue); + F.setEdgeMark(0, clearMarkValue); + F.setEdgeMark(1, clearMarkValue); + F.setEdgeMark(2, clearMarkValue); } } // ---------------------------------------------------------------------- -void FloorMesh::clearPortalEdges ( void ) +void FloorMesh::clearPortalEdges(void) { - for(int i = 0; i < getTriCount(); i++) + for (int i = 0; i < getTriCount(); i++) { FloorTri & F = getFloorTri(i); - F.setPortalId(0,-1); - F.setPortalId(1,-1); - F.setPortalId(2,-1); + F.setPortalId(0, -1); + F.setPortalId(1, -1); + F.setPortalId(2, -1); } } // ---------------------------------------------------------------------- -void FloorMesh::setAppearance ( Appearance const * appearance ) +void FloorMesh::setAppearance(Appearance const * appearance) { m_appearance = appearance; - if(m_appearance && m_extent) + if (m_appearance && m_extent) { Extent const * extent = appearance->getExtent(); BoxExtent const * boxExtent = dynamic_cast(extent); - if(boxExtent) + if (boxExtent) { AxialBox bounds = m_extent->getShape().getAxialBox(); @@ -486,14 +487,14 @@ void FloorMesh::setAppearance ( Appearance const * appearance ) bounds.add(box.getCorner(2)); bounds.add(box.getCorner(3)); - m_extent->setShape( MultiShape(bounds) ); + m_extent->setShape(MultiShape(bounds)); } } } // ---------------------------------------------------------------------- -void FloorMesh::build ( VectorVector const & verts, IntVector const & indices ) +void FloorMesh::build(VectorVector const & verts, IntVector const & indices) { (*m_vertices) = verts; m_floorTris->clear(); @@ -502,13 +503,13 @@ void FloorMesh::build ( VectorVector const & verts, IntVector const & indices ) int nTris = indices.size() / 3; - for(int i = 0; i < nTris; i++) + for (int i = 0; i < nTris; i++) { int A = indices[i * 3 + 0]; int B = indices[i * 3 + 1]; int C = indices[i * 3 + 2]; - addTriangle(A,B,C); + addTriangle(A, B, C); } } @@ -517,26 +518,26 @@ void FloorMesh::build ( VectorVector const & verts, IntVector const & indices ) //@todo - Uses brute-force search, may be slow for big meshes. -void FloorMesh::addCrossableEdges ( IntVector const & edgePairs ) +void FloorMesh::addCrossableEdges(IntVector const & edgePairs) { - for(int iTri = 0; iTri < getTriCount(); iTri++) + for (int iTri = 0; iTri < getTriCount(); iTri++) { FloorTri & F = getFloorTri(iTri); // ---------- - + int nPairs = edgePairs.size() / 2; - for(int iPair = 0; iPair < nPairs; iPair++) + for (int iPair = 0; iPair < nPairs; iPair++) { int A = edgePairs[iPair * 2 + 0]; int B = edgePairs[iPair * 2 + 1]; - int whichEdge = FindEdgeUndirected(F,A,B); + int whichEdge = FindEdgeUndirected(F, A, B); - if(whichEdge != -1) + if (whichEdge != -1) { - F.setEdgeType(whichEdge,FET_Crossable); + F.setEdgeType(whichEdge, FET_Crossable); } } } @@ -547,67 +548,67 @@ void FloorMesh::addCrossableEdges ( IntVector const & edgePairs ) //@todo - Uses brute-force search, may be slow for big meshes. -void FloorMesh::addRampEdges ( IntVector const & edgePairs ) +void FloorMesh::addRampEdges(IntVector const & edgePairs) { - for(int iTri = 0; iTri < getTriCount(); iTri++) + for (int iTri = 0; iTri < getTriCount(); iTri++) { FloorTri & F = getFloorTri(iTri); // ---------- - + int nPairs = edgePairs.size() / 2; - for(int iPair = 0; iPair < nPairs; iPair++) + for (int iPair = 0; iPair < nPairs; iPair++) { int A = edgePairs[iPair * 2 + 0]; int B = edgePairs[iPair * 2 + 1]; - int whichEdge = FindEdgeUndirected(F,A,B); + int whichEdge = FindEdgeUndirected(F, A, B); - if(whichEdge != -1) + if (whichEdge != -1) { - F.setEdgeType(whichEdge,FET_WallBase); + F.setEdgeType(whichEdge, FET_WallBase); } } } } // ---------------------------------------------------------------------- -// Flag the tris in the floor we want to be able to fall through as +// Flag the tris in the floor we want to be able to fall through as // fall-through-able -void FloorMesh::addFallthroughTris ( IntVector const & triIDs ) +void FloorMesh::addFallthroughTris(IntVector const & triIDs) { int idCount = triIDs.size(); - for(int iTri = 0; iTri < idCount; iTri++) + for (int iTri = 0; iTri < idCount; iTri++) { int index = triIDs[iTri]; - FloorTri & F = getFloorTri( index ); + FloorTri & F = getFloorTri(index); F.setFallthrough(true); } } // ---------------------------------------------------------------------- -// All edges of all floor tris start out unlinked and non-crossable. -// Once we've linked all the tris up, go through and flag any edges that +// All edges of all floor tris start out unlinked and non-crossable. +// Once we've linked all the tris up, go through and flag any edges that // now have neighbors as crossable. -void FloorMesh::flagCrossableEdges ( void ) +void FloorMesh::flagCrossableEdges(void) { - for(int iTri = 0; iTri < getTriCount(); iTri++) + for (int iTri = 0; iTri < getTriCount(); iTri++) { FloorTri & F = getFloorTri(iTri); // ---------- - - for(int iEdge = 0; iEdge < 3; iEdge++) + + for (int iEdge = 0; iEdge < 3; iEdge++) { - if(F.hasNeighbor(iEdge)) + if (F.hasNeighbor(iEdge)) { - F.setEdgeType(iEdge,FET_Crossable); + F.setEdgeType(iEdge, FET_Crossable); } } } @@ -615,55 +616,55 @@ void FloorMesh::flagCrossableEdges ( void ) // ---------------------------------------------------------------------- -FloorTri & FloorMesh::getFloorTri ( int whichTri ) +FloorTri & FloorMesh::getFloorTri(int whichTri) { FATAL(whichTri < 0, ("FloorMesh::getFloorTri - tried to get an invalid tri")); FATAL(whichTri >= getTriCount(), ("FloorMesh::getFloorTri - tried to get an invalid tri")); - return m_floorTris->at( whichTri ); + return m_floorTris->at(whichTri); } -FloorTri const & FloorMesh::getFloorTri ( int whichTri ) const +FloorTri const & FloorMesh::getFloorTri(int whichTri) const { FATAL(whichTri < 0, ("FloorMesh::getFloorTri - tried to get an invalid tri")); FATAL(whichTri >= getTriCount(), ("FloorMesh::getFloorTri - tried to get an invalid tri")); - return m_floorTris->at( whichTri ); + return m_floorTris->at(whichTri); } // ---------- -FloorEdgeIdVec const & FloorMesh::getEdgeList ( FloorEdgeType edgeType ) const +FloorEdgeIdVec const & FloorMesh::getEdgeList(FloorEdgeType edgeType) const { - switch(edgeType) + switch (edgeType) { case FET_Crossable: return *m_crossableEdges; case FET_Uncrossable: return *m_uncrossableEdges; case FET_WallBase: return *m_wallBaseEdges; case FET_WallTop: return *m_wallTopEdges; - default: { - DEBUG_FATAL(true,("FloorMesh::getEdgeList - requesting invalid list $d\n",edgeType)); - static FloorEdgeIdVec dummy; - return dummy; - } + default: { + DEBUG_FATAL(true, ("FloorMesh::getEdgeList - requesting invalid list $d\n", edgeType)); + static FloorEdgeIdVec dummy; + return dummy; + } } } // ---------------------------------------------------------------------- -BaseClass * FloorMesh::getPathGraph ( void ) +BaseClass * FloorMesh::getPathGraph(void) { return m_pathGraph; } -BaseClass const * FloorMesh::getPathGraph ( void ) const +BaseClass const * FloorMesh::getPathGraph(void) const { return m_pathGraph; } -void FloorMesh::attachPathGraph ( BaseClass * newGraph ) +void FloorMesh::attachPathGraph(BaseClass * newGraph) { - if(m_pathGraph != newGraph) + if (m_pathGraph != newGraph) { delete m_pathGraph; m_pathGraph = newGraph; @@ -674,7 +675,7 @@ void FloorMesh::attachPathGraph ( BaseClass * newGraph ) // Clean out any unused vertices and update the vertex indices in the // floor tris to match -void FloorMesh::sweep ( void ) +void FloorMesh::sweep(void) { int nVerts = getVertexCount(); int nTris = getTriCount(); @@ -682,9 +683,9 @@ void FloorMesh::sweep ( void ) // ---------- // Build our vertex reference count table - IntVector vertRefcount(nVerts,0); + IntVector vertRefcount(nVerts, 0); - for(int iTri = 0; iTri < nTris; iTri++) + for (int iTri = 0; iTri < nTris; iTri++) { IndexedTri const & tri = getIndexedTri(iTri); @@ -706,9 +707,9 @@ void FloorMesh::sweep ( void ) int nUsedVerts = 0; int cursor = 0; - for(int iRemap = 0; iRemap < nVerts; iRemap++) + for (int iRemap = 0; iRemap < nVerts; iRemap++) { - if(vertRefcount[iRemap] != 0) + if (vertRefcount[iRemap] != 0) { nUsedVerts++; @@ -725,36 +726,36 @@ void FloorMesh::sweep ( void ) // ---------- // Use the remap table to pack all vertex data at the beginning of the array - for(int iVert = 0; iVert < nVerts; iVert++) + for (int iVert = 0; iVert < nVerts; iVert++) { int newIndex = vertRemap[iVert]; // Skip unused vertices & vertices that aren't moving - if(newIndex == -1) continue; - if(newIndex == static_cast(iVert)) continue; + if (newIndex == -1) continue; + if (newIndex == static_cast(iVert)) continue; // Move the used vertices to their new place in the array - setVertex( newIndex, getVertex(iVert) ); + setVertex(newIndex, getVertex(iVert)); } // ---------- // Use the remap table to update the floor tri's vertex indices - for(int iTri2 = 0; iTri2 < nTris; iTri2++) + for (int iTri2 = 0; iTri2 < nTris; iTri2++) { IndexedTri temp = getIndexedTri(iTri2); - int iA = vertRemap[ temp.getCornerIndex(0) ]; - int iB = vertRemap[ temp.getCornerIndex(1) ]; - int iC = vertRemap[ temp.getCornerIndex(2) ]; + int iA = vertRemap[temp.getCornerIndex(0)]; + int iB = vertRemap[temp.getCornerIndex(1)]; + int iC = vertRemap[temp.getCornerIndex(2)]; - temp.setCornerIndex( 0, iA ); - temp.setCornerIndex( 1, iB ); - temp.setCornerIndex( 2, iC ); + temp.setCornerIndex(0, iA); + temp.setCornerIndex(1, iB); + temp.setCornerIndex(2, iC); - setIndexedTri( iTri2, temp ); + setIndexedTri(iTri2, temp); } // ---------- @@ -767,24 +768,24 @@ void FloorMesh::sweep ( void ) // Brute-force, ON^2 adjacency calc - try and link every tri with every // other tri -void FloorMesh::link ( void ) +void FloorMesh::link(void) { int nTris = getTriCount(); - for(int A = 0; A < nTris-1; A++) + for (int A = 0; A < nTris - 1; A++) { - for(int B = A+1; B < nTris; B++) + for (int B = A + 1; B < nTris; B++) { - LinkTris( getFloorTri(A), getFloorTri(B) ); + LinkTris(getFloorTri(A), getFloorTri(B)); } } } // ---------------------------------------------------------------------- -void FloorMesh::compile ( void ) +void FloorMesh::compile(void) { - IGNORE_RETURN( scrub() ); // get rid of any degenerate triangles + IGNORE_RETURN(scrub()); // get rid of any degenerate triangles merge(); // merge the vertices for the triangles sweep(); // sweep out any unused vertices link(); // build adjacency information for the triangles @@ -796,7 +797,7 @@ void FloorMesh::compile ( void ) // ---------------------------------------------------------------------- -void FloorMesh::write ( Iff & iff ) +void FloorMesh::write(Iff & iff) { iff.insertForm(TAG_FLOR); iff.insertForm(TAG_0006); @@ -811,7 +812,7 @@ void FloorMesh::write ( Iff & iff ) for (int i = 0; i < vertCount; i++) { - iff.insertChunkFloatVector( getVertex(i) ); + iff.insertChunkFloatVector(getVertex(i)); } } iff.exitChunk(TAG_VERT); @@ -833,14 +834,14 @@ void FloorMesh::write ( Iff & iff ) // ---------- - if(m_boxTree != nullptr) + if (m_boxTree != nullptr) { m_boxTree->write(iff); } // ---------- - if(!m_crossableEdges->empty() || !m_uncrossableEdges->empty() || !m_wallBaseEdges->empty()) + if (!m_crossableEdges->empty() || !m_uncrossableEdges->empty() || !m_wallBaseEdges->empty()) { iff.insertChunk(TAG_BEDG); { @@ -851,7 +852,7 @@ void FloorMesh::write ( Iff & iff ) { int edgeCount = m_crossableEdges->size(); - for(int i = 0; i < edgeCount; i++) + for (int i = 0; i < edgeCount; i++) { FloorEdgeId & id = m_crossableEdges->at(i); @@ -859,14 +860,14 @@ void FloorMesh::write ( Iff & iff ) iff.insertChunkData(id.triId); iff.insertChunkData(id.edgeId); - iff.insertChunkData(crossable); + iff.insertChunkData(crossable); } } { int edgeCount = m_uncrossableEdges->size(); - for(int i = 0; i < edgeCount; i++) + for (int i = 0; i < edgeCount; i++) { FloorEdgeId & id = m_uncrossableEdges->at(i); @@ -874,14 +875,14 @@ void FloorMesh::write ( Iff & iff ) iff.insertChunkData(id.triId); iff.insertChunkData(id.edgeId); - iff.insertChunkData(crossable); + iff.insertChunkData(crossable); } } - + { int edgeCount = m_wallBaseEdges->size(); - for(int i = 0; i < edgeCount; i++) + for (int i = 0; i < edgeCount; i++) { FloorEdgeId & id = m_wallBaseEdges->at(i); @@ -889,7 +890,7 @@ void FloorMesh::write ( Iff & iff ) iff.insertChunkData(id.triId); iff.insertChunkData(id.edgeId); - iff.insertChunkData(crossable); + iff.insertChunkData(crossable); } } } @@ -897,23 +898,23 @@ void FloorMesh::write ( Iff & iff ) } // ---------- - + ObjectWriter graphWriter = FloorManager::getPathGraphWriter(); - if(m_pathGraph && graphWriter) + if (m_pathGraph && graphWriter) { - graphWriter(m_pathGraph,iff); + graphWriter(m_pathGraph, iff); } // ---------- - + iff.exitForm(TAG_0006); iff.exitForm(TAG_FLOR); } // ---------------------------------------------------------------------- -void FloorMesh::read ( Iff & iff ) +void FloorMesh::read(Iff & iff) { clear(); @@ -925,45 +926,45 @@ void FloorMesh::read ( Iff & iff ) switch (iff.getCurrentName()) { - case TAG_0000: - version = 0; - read_0000(iff); - break; + case TAG_0000: + version = 0; + read_0000(iff); + break; - case TAG_0001: - version = 1; - read_0001(iff); - break; + case TAG_0001: + version = 1; + read_0001(iff); + break; - case TAG_0002: - version = 2; - read_0002(iff); - break; + case TAG_0002: + version = 2; + read_0002(iff); + break; - case TAG_0003: - version = 3; - read_0003(iff); - break; + case TAG_0003: + version = 3; + read_0003(iff); + break; - case TAG_0004: - version = 4; - read_0004(iff); - break; + case TAG_0004: + version = 4; + read_0004(iff); + break; - case TAG_0005: - version = 5; - read_0005(iff); - break; + case TAG_0005: + version = 5; + read_0005(iff); + break; - case TAG_0006: - version = 6; - read_0006(iff); - break; + case TAG_0006: + version = 6; + read_0006(iff); + break; - default: - version = -1; - FATAL(true,("FloorMesh::Invalid version")); - break; + default: + version = -1; + FATAL(true, ("FloorMesh::Invalid version")); + break; } iff.exitForm(TAG_FLOR); @@ -973,31 +974,31 @@ void FloorMesh::read ( Iff & iff ) // floor versions 6 and earlier calculate their floor tri normals upside down. fix that here. - if(version <= 6) + if (version <= 6) { int triCount = getTriCount(); - for(int i = 0; i < triCount; i++) + for (int i = 0; i < triCount; i++) { FloorTri & T = getFloorTri(i); - T.setNormal( -T.getNormal() ); + T.setNormal(-T.getNormal()); } } // Check for inverted floor tris - if(DataLint::isInstalled()) + if (DataLint::isInstalled()) { int triCount = getTriCount(); - for(int i = 0; i < triCount; i++) + for (int i = 0; i < triCount; i++) { FloorTri & T = getFloorTri(i); - if(T.getNormal().y <= 0.0f) + if (T.getNormal().y <= 0.0f) { - DEBUG_WARNING(true,("FloorMesh::read - Floor %s contains a triangle that's not facing up (art error) [%1.2f, %1.2f, %1.2f]",iff.getFileName(), T.getNormal().x, T.getNormal().y, T.getNormal().z)); + DEBUG_WARNING(true, ("FloorMesh::read - Floor %s contains a triangle that's not facing up (art error) [%1.2f, %1.2f, %1.2f]", iff.getFileName(), T.getNormal().x, T.getNormal().y, T.getNormal().z)); break; } } @@ -1007,11 +1008,11 @@ void FloorMesh::read ( Iff & iff ) calcHeightFuncs(); - if(version < 5) buildBoundaryEdgeList(); + if (version < 5) buildBoundaryEdgeList(); #ifdef _DEBUG - if(ConfigSharedCollision::getBuildDebugData()) + if (ConfigSharedCollision::getBuildDebugData()) { buildDebugData(); } @@ -1021,7 +1022,7 @@ void FloorMesh::read ( Iff & iff ) // ---------------------------------------------------------------------- -void FloorMesh::read_0000 ( Iff & iff ) +void FloorMesh::read_0000(Iff & iff) { iff.enterForm(TAG_0000); @@ -1029,7 +1030,7 @@ void FloorMesh::read_0000 ( Iff & iff ) iff.enterChunk(TAG_VERT); { - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) { Vector V = iff.read_floatVector(); @@ -1042,27 +1043,27 @@ void FloorMesh::read_0000 ( Iff & iff ) iff.enterChunk(TAG_TRIS); { - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) { FloorTri F; - F.setIndex( iff.read_int32() ); + F.setIndex(iff.read_int32()); - F.setCornerIndex( 0, iff.read_int32() ); - F.setCornerIndex( 1, iff.read_int32() ); - F.setCornerIndex( 2, iff.read_int32() ); + F.setCornerIndex(0, iff.read_int32()); + F.setCornerIndex(1, iff.read_int32()); + F.setCornerIndex(2, iff.read_int32()); - F.setNeighborIndex( 0, iff.read_int32() ); - F.setNeighborIndex( 1, iff.read_int32() ); - F.setNeighborIndex( 2, iff.read_int32() ); + F.setNeighborIndex(0, iff.read_int32()); + F.setNeighborIndex(1, iff.read_int32()); + F.setNeighborIndex(2, iff.read_int32()); - F.setNormal( iff.read_floatVector() ); + F.setNormal(iff.read_floatVector()); - F.setEdgeType( 0, FET_Uncrossable ); - F.setEdgeType( 1, FET_Uncrossable ); - F.setEdgeType( 2, FET_Uncrossable ); + F.setEdgeType(0, FET_Uncrossable); + F.setEdgeType(1, FET_Uncrossable); + F.setEdgeType(2, FET_Uncrossable); - F.setFallthrough( false ); + F.setFallthrough(false); m_floorTris->push_back(F); } @@ -1080,7 +1081,7 @@ void FloorMesh::read_0000 ( Iff & iff ) // ---------------------------------------------------------------------- -void FloorMesh::read_0001 ( Iff & iff ) +void FloorMesh::read_0001(Iff & iff) { iff.enterForm(TAG_0001); @@ -1088,7 +1089,7 @@ void FloorMesh::read_0001 ( Iff & iff ) iff.enterChunk(TAG_VERT); { - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) { Vector V = iff.read_floatVector(); @@ -1101,27 +1102,27 @@ void FloorMesh::read_0001 ( Iff & iff ) iff.enterChunk(TAG_TRIS); { - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) { FloorTri F; - F.setIndex( iff.read_int32() ); + F.setIndex(iff.read_int32()); - F.setCornerIndex( 0, iff.read_int32() ); - F.setCornerIndex( 1, iff.read_int32() ); - F.setCornerIndex( 2, iff.read_int32() ); + F.setCornerIndex(0, iff.read_int32()); + F.setCornerIndex(1, iff.read_int32()); + F.setCornerIndex(2, iff.read_int32()); - F.setNeighborIndex( 0, iff.read_int32() ); - F.setNeighborIndex( 1, iff.read_int32() ); - F.setNeighborIndex( 2, iff.read_int32() ); + F.setNeighborIndex(0, iff.read_int32()); + F.setNeighborIndex(1, iff.read_int32()); + F.setNeighborIndex(2, iff.read_int32()); - F.setNormal( iff.read_floatVector() ); + F.setNormal(iff.read_floatVector()); - F.setCrossable( 0, iff.read_bool8() ); - F.setCrossable( 1, iff.read_bool8() ); - F.setCrossable( 2, iff.read_bool8() ); + F.setCrossable(0, iff.read_bool8()); + F.setCrossable(1, iff.read_bool8()); + F.setCrossable(2, iff.read_bool8()); - F.setFallthrough( iff.read_bool8() ); + F.setFallthrough(iff.read_bool8()); m_floorTris->push_back(F); } @@ -1135,7 +1136,7 @@ void FloorMesh::read_0001 ( Iff & iff ) // ---------------------------------------------------------------------- -void FloorMesh::read_0002 ( Iff & iff ) +void FloorMesh::read_0002(Iff & iff) { iff.enterForm(TAG_0002); @@ -1143,7 +1144,7 @@ void FloorMesh::read_0002 ( Iff & iff ) iff.enterChunk(TAG_VERT); { - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) { Vector V = iff.read_floatVector(); @@ -1156,7 +1157,7 @@ void FloorMesh::read_0002 ( Iff & iff ) iff.enterChunk(TAG_TRIS); { - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) { FloorTri F; @@ -1168,13 +1169,13 @@ void FloorMesh::read_0002 ( Iff & iff ) iff.exitChunk(TAG_TRIS); // ---------- - + iff.exitForm(TAG_0002); } // ---------------------------------------------------------------------- -void FloorMesh::read_0003 ( Iff & iff ) +void FloorMesh::read_0003(Iff & iff) { iff.enterForm(TAG_0003); @@ -1182,46 +1183,7 @@ void FloorMesh::read_0003 ( Iff & iff ) iff.enterChunk(TAG_VERT); { - while(iff.getChunkLengthLeft()) - { - Vector V = iff.read_floatVector(); - - m_vertices->push_back(V); - } - } - iff.exitChunk(TAG_VERT); - - // ---------- - - iff.enterChunk(TAG_TRIS); - { - FloorTri F; - - while(iff.getChunkLengthLeft()) - { - F.read_0001(iff); - - m_floorTris->push_back(F); - } - } - iff.exitChunk(TAG_TRIS); - - // ---------- - - iff.exitForm(TAG_0003); -} - -// ---------------------------------------------------------------------- - -void FloorMesh::read_0004 ( Iff & iff ) -{ - iff.enterForm(TAG_0004); - - // ---------- - - iff.enterChunk(TAG_VERT); - { - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) { Vector V = iff.read_floatVector(); @@ -1236,7 +1198,46 @@ void FloorMesh::read_0004 ( Iff & iff ) { FloorTri F; - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) + { + F.read_0001(iff); + + m_floorTris->push_back(F); + } + } + iff.exitChunk(TAG_TRIS); + + // ---------- + + iff.exitForm(TAG_0003); +} + +// ---------------------------------------------------------------------- + +void FloorMesh::read_0004(Iff & iff) +{ + iff.enterForm(TAG_0004); + + // ---------- + + iff.enterChunk(TAG_VERT); + { + while (iff.getChunkLengthLeft()) + { + Vector V = iff.read_floatVector(); + + m_vertices->push_back(V); + } + } + iff.exitChunk(TAG_VERT); + + // ---------- + + iff.enterChunk(TAG_TRIS); + { + FloorTri F; + + while (iff.getChunkLengthLeft()) { F.read_0001(iff); @@ -1251,7 +1252,7 @@ void FloorMesh::read_0004 ( Iff & iff ) ObjectFactory pathGraphFactory = FloorManager::getPathGraphFactory(); - if(pathGraphFactory) + if (pathGraphFactory) { // The factory knows how to build a path graph from the old // data format. @@ -1262,24 +1263,24 @@ void FloorMesh::read_0004 ( Iff & iff ) } else { - // We have a path graph to load but no factory to load it + // We have a path graph to load but no factory to load it // with, so skip the form iff.enterChunk(TAG_PNOD); - iff.exitChunk(TAG_PNOD,true); + iff.exitChunk(TAG_PNOD, true); iff.enterChunk(TAG_PEDG); - iff.exitChunk(TAG_PEDG,true); + iff.exitChunk(TAG_PEDG, true); } // ---------- - + iff.exitForm(TAG_0004); } // ---------------------------------------------------------------------- -void FloorMesh::read_0005 ( Iff & iff ) +void FloorMesh::read_0005(Iff & iff) { iff.enterForm(TAG_0005); @@ -1292,7 +1293,7 @@ void FloorMesh::read_0005 ( Iff & iff ) m_vertices->clear(); m_vertices->reserve(vertexCount); - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) { Vector V = iff.read_floatVector(); @@ -1312,7 +1313,7 @@ void FloorMesh::read_0005 ( Iff & iff ) FloorTri F; - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) { F.read_0001(iff); @@ -1323,7 +1324,7 @@ void FloorMesh::read_0005 ( Iff & iff ) // ---------- - if(iff.getCurrentName() == TAG_BTRE) + if (iff.getCurrentName() == TAG_BTRE) { m_boxTree = new BoxTree(); @@ -1332,29 +1333,29 @@ void FloorMesh::read_0005 ( Iff & iff ) // ---------- - if(iff.getCurrentName() == TAG_BEDG) + if (iff.getCurrentName() == TAG_BEDG) { iff.enterChunk(TAG_BEDG); { int edgeCount = iff.read_int32(); - for(int i = 0; i < edgeCount; i++) + for (int i = 0; i < edgeCount; i++) { int triId = iff.read_int32(); int edgeId = iff.read_int32(); - FloorEdgeId id(triId,edgeId); + FloorEdgeId id(triId, edgeId); bool crossable = iff.read_bool8(); UNREF(crossable); // redundant now that we've got an edge type - switch(getFloorTri(id.triId).getEdgeType(id.edgeId)) + switch (getFloorTri(id.triId).getEdgeType(id.edgeId)) { - case FET_Crossable: { m_crossableEdges->push_back(id); break; } + case FET_Crossable: { m_crossableEdges->push_back(id); break; } case FET_Uncrossable: { m_uncrossableEdges->push_back(id); break; } - case FET_WallBase: { m_wallBaseEdges->push_back(id); break; } - default: { break; } + case FET_WallBase: { m_wallBaseEdges->push_back(id); break; } + default: { break; } } } } @@ -1367,7 +1368,7 @@ void FloorMesh::read_0005 ( Iff & iff ) { ObjectFactory pathGraphFactory = FloorManager::getPathGraphFactory(); - if(pathGraphFactory && CollisionWorld::isServerSide()) + if (pathGraphFactory && CollisionWorld::isServerSide()) { BaseClass * pathGraph = pathGraphFactory(iff); @@ -1375,22 +1376,22 @@ void FloorMesh::read_0005 ( Iff & iff ) } else { - // We have a path graph to load but no factory to load it + // We have a path graph to load but no factory to load it // with, so skip the form iff.enterForm(); iff.exitForm(true); } } - + // ---------- - + iff.exitForm(TAG_0005); } // ---------------------------------------------------------------------- -void FloorMesh::read_0006 ( Iff & iff ) +void FloorMesh::read_0006(Iff & iff) { iff.enterForm(TAG_0006); @@ -1403,7 +1404,7 @@ void FloorMesh::read_0006 ( Iff & iff ) m_vertices->clear(); m_vertices->reserve(vertexCount); - for(int i = 0; i < vertexCount; i++) + for (int i = 0; i < vertexCount; i++) { Vector V = iff.read_floatVector(); @@ -1423,7 +1424,7 @@ void FloorMesh::read_0006 ( Iff & iff ) FloorTri F; - for(int i = 0; i < triCount; i++) + for (int i = 0; i < triCount; i++) { F.read_0002(iff); @@ -1434,7 +1435,7 @@ void FloorMesh::read_0006 ( Iff & iff ) // ---------- - if(iff.getCurrentName() == TAG_BTRE) + if (iff.getCurrentName() == TAG_BTRE) { m_boxTree = new BoxTree(); @@ -1443,29 +1444,29 @@ void FloorMesh::read_0006 ( Iff & iff ) // ---------- - if(iff.getCurrentName() == TAG_BEDG) + if (iff.getCurrentName() == TAG_BEDG) { iff.enterChunk(TAG_BEDG); { int edgeCount = iff.read_int32(); - for(int i = 0; i < edgeCount; i++) + for (int i = 0; i < edgeCount; i++) { int triId = iff.read_int32(); int edgeId = iff.read_int32(); - FloorEdgeId id(triId,edgeId); + FloorEdgeId id(triId, edgeId); bool crossable = iff.read_bool8(); UNREF(crossable); // redundant now that we've got an edge type - switch(getFloorTri(id.triId).getEdgeType(id.edgeId)) + switch (getFloorTri(id.triId).getEdgeType(id.edgeId)) { - case FET_Crossable: { m_crossableEdges->push_back(id); break; } + case FET_Crossable: { m_crossableEdges->push_back(id); break; } case FET_Uncrossable: { m_uncrossableEdges->push_back(id); break; } - case FET_WallBase: { m_wallBaseEdges->push_back(id); break; } - default: { break; } + case FET_WallBase: { m_wallBaseEdges->push_back(id); break; } + default: { break; } } } } @@ -1478,7 +1479,7 @@ void FloorMesh::read_0006 ( Iff & iff ) { ObjectFactory pathGraphFactory = FloorManager::getPathGraphFactory(); - if(pathGraphFactory && CollisionWorld::isServerSide()) + if (pathGraphFactory && CollisionWorld::isServerSide()) { BaseClass * pathGraph = pathGraphFactory(iff); @@ -1486,68 +1487,66 @@ void FloorMesh::read_0006 ( Iff & iff ) } else { - // We have a path graph to load but no factory to load it + // We have a path graph to load but no factory to load it // with, so skip the form iff.enterForm(); iff.exitForm(true); } } - + // ---------- - + iff.exitForm(TAG_0006); } // ====================================================================== // DataResource implementation -void FloorMesh::load ( Iff & iff ) +void FloorMesh::load(Iff & iff) { read(iff); } // ---------- -Tag FloorMesh::getId ( void ) const +Tag FloorMesh::getId(void) const { return TAG_FLOR; } - // ---------------------------------------------------------------------- -FloorMesh * FloorMesh::create ( const std::string & filename ) +FloorMesh * FloorMesh::create(const std::string & filename) { return new FloorMesh(filename); } // ---------- -void FloorMesh::release ( void ) const +void FloorMesh::release(void) const { FloorMeshList::release(*this); } - // ---------------------------------------------------------------------- -void FloorMesh::install ( void ) +void FloorMesh::install(void) { - FloorMeshList::registerTemplate(TAG_FLOR,FloorMesh::create); + FloorMeshList::registerTemplate(TAG_FLOR, FloorMesh::create); } -void FloorMesh::remove ( void ) +void FloorMesh::remove(void) { FloorMeshList::remove(); } // ---------------------------------------------------------------------- -bool FloorMesh::findFloorTri ( FloorLocator const & testLoc, - float heightTolerance, - bool bAllowJump, - FloorLocator & outLoc ) const +bool FloorMesh::findFloorTri(FloorLocator const & testLoc, + float heightTolerance, + bool bAllowJump, + FloorLocator & outLoc) const { Vector testPoint = testLoc.getPosition_l(); @@ -1555,11 +1554,11 @@ bool FloorMesh::findFloorTri ( FloorLocator const & testLoc, // If the line through the test point doesn't intersect the floor's bounding box, // the point can't land on the floor - Line3d line(testPoint,-Vector::unitY); + Line3d line(testPoint, -Vector::unitY); - bool bHitsBounds = Overlap3d::TestLineABox( line, getBoundingABox() ); + bool bHitsBounds = Overlap3d::TestLineABox(line, getBoundingABox()); - if(!bHitsBounds) + if (!bHitsBounds) { outLoc = FloorLocator::invalid; return false; @@ -1570,11 +1569,11 @@ bool FloorMesh::findFloorTri ( FloorLocator const & testLoc, FloorLocator closest; - bool bFound = intersectClosest(line,closest); + bool bFound = intersectClosest(line, closest); // ---------- - if(!bFound || (closest.getId() == -1)) + if (!bFound || (closest.getId() == -1)) { outLoc = FloorLocator::invalid; return false; @@ -1584,7 +1583,7 @@ bool FloorMesh::findFloorTri ( FloorLocator const & testLoc, float dist = closest.getOffset(); - if(dist > heightTolerance) + if (dist > heightTolerance) { // Floor tri is too far below the test point @@ -1592,7 +1591,7 @@ bool FloorMesh::findFloorTri ( FloorLocator const & testLoc, return false; } - if(dist > 0.0f) + if (dist > 0.0f) { // Floor tri is below the test point, we don't need a jump // or hop to get on it @@ -1603,7 +1602,7 @@ bool FloorMesh::findFloorTri ( FloorLocator const & testLoc, // ---------- - if(bAllowJump) + if (bAllowJump) { // Floor tri is above the test point, but we dont' care // since we're allowing jumps @@ -1614,24 +1613,24 @@ bool FloorMesh::findFloorTri ( FloorLocator const & testLoc, // ---------- - if(std::abs(dist) < gs_hopTolerance) + if (std::abs(dist) < gs_hopTolerance) { // Floor tri is above the test point but within the hop // tolerance and we're allowing hops - we can hop up onto it. - DEBUG_REPORT_LOG_PRINT(ConfigSharedCollision::getReportMessages(),("FloorMesh::findFloorTri - Found triangle we can hop onto\n")); + DEBUG_REPORT_LOG_PRINT(ConfigSharedCollision::getReportMessages(), ("FloorMesh::findFloorTri - Found triangle we can hop onto\n")); outLoc = closest; return true; } // ---------- - if(getFloorTri( closest.getId() ).isFallthrough()) + if (getFloorTri(closest.getId()).isFallthrough()) { // Floor tri is above the test point, out of hop range, and we're not allowing jumps // BUT, since it's marked as fallthrough we can be on it anyway. - DEBUG_REPORT_LOG_PRINT(ConfigSharedCollision::getReportMessages(),("FloorMesh::findFloorTri - Found fallthrough triangle we can jump onto\n")); + DEBUG_REPORT_LOG_PRINT(ConfigSharedCollision::getReportMessages(), ("FloorMesh::findFloorTri - Found fallthrough triangle we can jump onto\n")); outLoc = closest; return true; } @@ -1645,16 +1644,16 @@ bool FloorMesh::findFloorTri ( FloorLocator const & testLoc, // ---------- -bool FloorMesh::findFloorTri ( FloorLocator const & testLoc, - bool bAllowJump, - FloorLocator & outLoc ) const +bool FloorMesh::findFloorTri(FloorLocator const & testLoc, + bool bAllowJump, + FloorLocator & outLoc) const { - return findFloorTri(testLoc,REAL_MAX,bAllowJump,outLoc); + return findFloorTri(testLoc, REAL_MAX, bAllowJump, outLoc); } // ---------------------------------------------------------------------- -void FloorMesh::makeHitResult ( Vector const & begin, Vector const & delta, int hitTriId, int hitEdgeId, float hitTime, FloorLocator & result ) const +void FloorMesh::makeHitResult(Vector const & begin, Vector const & delta, int hitTriId, int hitEdgeId, float hitTime, FloorLocator & result) const { Vector endPoint = begin + delta * hitTime; @@ -1666,11 +1665,11 @@ void FloorMesh::makeHitResult ( Vector const & begin, Vector const & delta, int // ---------- - result = FloorLocator(this,endPoint); + result = FloorLocator(this, endPoint); result.setTriId(hitTriId); result.setEdgeId(hitEdgeId); - + result.setHitTriId(hitTriId); result.setHitEdgeId(hitEdgeId); @@ -1682,13 +1681,13 @@ void FloorMesh::makeHitResult ( Vector const & begin, Vector const & delta, int // ---------- -void FloorMesh::makeHitResult2 ( Vector const & begin, Vector const & delta, int centerTriId, int hitTriId, int hitEdgeId, float hitTime, FloorLocator & result ) const +void FloorMesh::makeHitResult2(Vector const & begin, Vector const & delta, int centerTriId, int hitTriId, int hitEdgeId, float hitTime, FloorLocator & result) const { Segment3d edge = getTriangle(hitTriId).getEdgeSegment(hitEdgeId); Vector endPoint = begin + delta * hitTime; - Vector contactPoint = Distance2d::ClosestPointSeg(endPoint,edge); + Vector contactPoint = Distance2d::ClosestPointSeg(endPoint, edge); Vector contactNormal = endPoint - contactPoint; contactNormal.y = 0.0f; @@ -1697,7 +1696,7 @@ void FloorMesh::makeHitResult2 ( Vector const & begin, Vector const & delta, int // ---------- - result = FloorLocator(this,endPoint); + result = FloorLocator(this, endPoint); result.setTriId(centerTriId); result.setEdgeId(-1); @@ -1713,13 +1712,13 @@ void FloorMesh::makeHitResult2 ( Vector const & begin, Vector const & delta, int // ---------- -void FloorMesh::makeExitResult ( Vector const & begin, Vector const & delta, int hitTriId, int hitEdgeId, float hitTime, FloorLocator & result ) const +void FloorMesh::makeExitResult(Vector const & begin, Vector const & delta, int hitTriId, int hitEdgeId, float hitTime, FloorLocator & result) const { Segment3d edge = getTriangle(hitTriId).getEdgeSegment(hitEdgeId); Vector endPoint = begin + delta * hitTime; - Vector contactPoint = Distance2d::ClosestPointSeg(endPoint,edge); + Vector contactPoint = Distance2d::ClosestPointSeg(endPoint, edge); Vector contactNormal = endPoint - contactPoint; contactNormal.y = 0.0f; @@ -1728,7 +1727,7 @@ void FloorMesh::makeExitResult ( Vector const & begin, Vector const & delta, int // ---------- - result = FloorLocator(this,endPoint); + result = FloorLocator(this, endPoint); result.setTriId(hitTriId); result.setEdgeId(hitEdgeId); @@ -1744,7 +1743,7 @@ void FloorMesh::makeExitResult ( Vector const & begin, Vector const & delta, int // ---------- -void FloorMesh::makeSuccessResult ( FloorLocator const & loc, FloorLocator & result ) const +void FloorMesh::makeSuccessResult(FloorLocator const & loc, FloorLocator & result) const { result = loc; @@ -1754,7 +1753,7 @@ void FloorMesh::makeSuccessResult ( FloorLocator const & loc, FloorLocator & res // ---------- -void FloorMesh::makeFailureResult ( FloorLocator & result ) const +void FloorMesh::makeFailureResult(FloorLocator & result) const { result = FloorLocator::invalid; } @@ -1763,20 +1762,20 @@ void FloorMesh::makeFailureResult ( FloorLocator & result ) const // Triangles facing down cannot be entered // Crossable edges of fallthrough tris can be entered from anywhere -// uncrossable edges cannot be entered +// uncrossable edges cannot be entered // Crossable edges of non-fallthrough tris can be entered from above // Ramp edges can be entered from above -bool FloorMesh::canEnterEdge ( FloorLocator const & enterLoc ) const +bool FloorMesh::canEnterEdge(FloorLocator const & enterLoc) const { - if(enterLoc.getEdgeId() == -1) return false; - if(enterLoc.getTriId() == -1) return false; - if(enterLoc.getFloorMesh() == nullptr) return false; + if (enterLoc.getEdgeId() == -1) return false; + if (enterLoc.getTriId() == -1) return false; + if (enterLoc.getFloorMesh() == nullptr) return false; // Can't enter the tri if it's facing down - if(getTriangle(enterLoc.getTriId()).getNormal().y < 0.0f) + if (getTriangle(enterLoc.getTriId()).getNormal().y < 0.0f) { return false; } @@ -1787,13 +1786,13 @@ bool FloorMesh::canEnterEdge ( FloorLocator const & enterLoc ) const FloorEdgeType edgeType = F.getEdgeType(enterLoc.getEdgeId()); - if(edgeType == FET_Uncrossable) + if (edgeType == FET_Uncrossable) { return false; } - else if(edgeType == FET_Crossable) + else if (edgeType == FET_Crossable) { - if(F.isFallthrough()) + if (F.isFallthrough()) { return true; } @@ -1802,22 +1801,22 @@ bool FloorMesh::canEnterEdge ( FloorLocator const & enterLoc ) const return enterLoc.getOffset() >= -1.0f; } } - else if(edgeType == FET_WallBase) + else if (edgeType == FET_WallBase) { return enterLoc.getOffset() >= 0.0f; } else { - DEBUG_WARNING(true,("FloorMesh::canEnterEdge - bad edge type")); + DEBUG_WARNING(true, ("FloorMesh::canEnterEdge - bad edge type")); return false; } } -bool FloorMesh::canEnterEdge ( FloorLocator const & startLoc, Vector const & delta, FloorEdgeId const & id, bool useRadius ) const +bool FloorMesh::canEnterEdge(FloorLocator const & startLoc, Vector const & delta, FloorEdgeId const & id, bool useRadius) const { FloorLocator entryLoc; - if(intersectEdge(startLoc,delta,id,useRadius,false,entryLoc)) + if (intersectEdge(startLoc, delta, id, useRadius, false, entryLoc)) { return canEnterEdge(entryLoc); } @@ -1833,11 +1832,11 @@ bool FloorMesh::canEnterEdge ( FloorLocator const & startLoc, Vector const & del // Ramp edges can be exited only if doing so causes a valid reentrance -bool FloorMesh::canExitEdge ( FloorLocator const & exitLoc, Vector const & delta, bool useRadius ) const +bool FloorMesh::canExitEdge(FloorLocator const & exitLoc, Vector const & delta, bool useRadius) const { - if(exitLoc.getTriId() == -1) return false; - if(exitLoc.getEdgeId() == -1) return false; - if(exitLoc.getFloorMesh() == nullptr) return false; + if (exitLoc.getTriId() == -1) return false; + if (exitLoc.getEdgeId() == -1) return false; + if (exitLoc.getFloorMesh() == nullptr) return false; FloorEdgeType edgeType = exitLoc.getFloorTri().getEdgeType(exitLoc.getEdgeId()); @@ -1845,15 +1844,15 @@ bool FloorMesh::canExitEdge ( FloorLocator const & exitLoc, Vector const & delta UNREF(exitPos); - if(edgeType == FET_Uncrossable) + if (edgeType == FET_Uncrossable) { return false; } - else if(edgeType == FET_Crossable) + else if (edgeType == FET_Crossable) { return true; } - else if(edgeType == FET_WallBase) + else if (edgeType == FET_WallBase) { // Can only enter through a non-fallthrough tri if the path crosses over // the boundary @@ -1866,14 +1865,14 @@ bool FloorMesh::canExitEdge ( FloorLocator const & exitLoc, Vector const & delta Vector testDelta = delta; - if(testDelta.magnitudeSquared() > 0.01f) + if (testDelta.magnitudeSquared() > 0.01f) { testDelta.normalize(); testDelta *= 0.1f; } - if(findEntrance(exitLoc,testDelta,useRadius,entryLoc)) + if (findEntrance(exitLoc, testDelta, useRadius, entryLoc)) { Vector enterPos = entryLoc.getPosition_p(); @@ -1888,9 +1887,9 @@ bool FloorMesh::canExitEdge ( FloorLocator const & exitLoc, Vector const & delta Vector edgeDir = getTriangle(exitLoc.getTriId()).getEdgeDir(exitLoc.getEdgeId()); - Vector edgeNormal(edgeDir.z,0.0f,-edgeDir.x); + Vector edgeNormal(edgeDir.z, 0.0f, -edgeDir.x); - if(delta.dot(edgeNormal) > 0.0f) + if (delta.dot(edgeNormal) > 0.0f) { return true; } @@ -1902,7 +1901,7 @@ bool FloorMesh::canExitEdge ( FloorLocator const & exitLoc, Vector const & delta } else { - DEBUG_WARNING(true,("FloorMesh::canExitEdge - bad edge type")); + DEBUG_WARNING(true, ("FloorMesh::canExitEdge - bad edge type")); return false; } @@ -1910,18 +1909,18 @@ bool FloorMesh::canExitEdge ( FloorLocator const & exitLoc, Vector const & delta // ---------- -bool FloorMesh::canExitEdge ( FloorLocator const & startLoc, Vector const & delta, FloorEdgeId const & id, bool useRadius ) const +bool FloorMesh::canExitEdge(FloorLocator const & startLoc, Vector const & delta, FloorEdgeId const & id, bool useRadius) const { - if(id.triId == -1) return false; - if(id.edgeId == -1) return false; + if (id.triId == -1) return false; + if (id.edgeId == -1) return false; FloorEdgeType edgeType = getFloorTri(id.triId).getEdgeType(id.edgeId); - if(edgeType == FET_Uncrossable) + if (edgeType == FET_Uncrossable) { return false; } - else if(edgeType == FET_Crossable) + else if (edgeType == FET_Crossable) { return true; } @@ -1929,11 +1928,11 @@ bool FloorMesh::canExitEdge ( FloorLocator const & startLoc, Vector const & delt { FloorLocator exitLoc; - if(intersectEdge(startLoc,delta,id,useRadius,true,exitLoc)) + if (intersectEdge(startLoc, delta, id, useRadius, true, exitLoc)) { Vector newDelta = delta - (delta * exitLoc.getTime()); - return canExitEdge(exitLoc,newDelta,useRadius); + return canExitEdge(exitLoc, newDelta, useRadius); } else { @@ -1944,11 +1943,11 @@ bool FloorMesh::canExitEdge ( FloorLocator const & startLoc, Vector const & delt // ---------------------------------------------------------------------- -PathWalkResult FloorMesh::findStartingTri ( FloorLocator const & startLoc, Vector const & delta, bool useRadius, int & outTriId ) const +PathWalkResult FloorMesh::findStartingTri(FloorLocator const & startLoc, Vector const & delta, bool useRadius, int & outTriId) const { FloorLocator entryLoc; - if(findEntrance(startLoc,delta,useRadius,entryLoc)) + if (findEntrance(startLoc, delta, useRadius, entryLoc)) { outTriId = entryLoc.getId(); @@ -1962,7 +1961,7 @@ PathWalkResult FloorMesh::findStartingTri ( FloorLocator const & startLoc, Vecto // ---------------------------------------------------------------------- -bool FloorMesh::findClosestLocation ( FloorLocator const & testLoc, FloorLocator & result ) const +bool FloorMesh::findClosestLocation(FloorLocator const & testLoc, FloorLocator & result) const { Vector point = testLoc.getPosition_l(); @@ -1972,29 +1971,29 @@ bool FloorMesh::findClosestLocation ( FloorLocator const & testLoc, FloorLocator Vector minPoint = Vector::zero; int minId = -1; - for(int i = 0; i < getTriCount(); i++) + for (int i = 0; i < getTriCount(); i++) { Triangle3d T = getTriangle(i); - Vector triPoint = Distance3d::ClosestPointTri(point,T); + Vector triPoint = Distance3d::ClosestPointTri(point, T); real dist = (point - triPoint).magnitudeSquared(); - if(dist < minDist) + if (dist < minDist) { - if(T.getNormal().y < 0.0f) + if (T.getNormal().y < 0.0f) { // Triangle's facing down, skip it. continue; } - + minDist = dist; minPoint = triPoint; minId = i; } } - if(minId == -1) + if (minId == -1) { result = FloorLocator::invalid; @@ -2003,16 +2002,16 @@ bool FloorMesh::findClosestLocation ( FloorLocator const & testLoc, FloorLocator // ---------- - Vector scooted = Collision3d::MoveIntoTriangle(minPoint,getTriangle(minId),ConfigSharedCollision::getWallEpsilon()); + Vector scooted = Collision3d::MoveIntoTriangle(minPoint, getTriangle(minId), ConfigSharedCollision::getWallEpsilon()); - result = FloorLocator(this,scooted,minId,0.0f,0.0f); + result = FloorLocator(this, scooted, minId, 0.0f, 0.0f); return true; } // ---------------------------------------------------------------------- -bool FloorMesh::calcHitTime ( Segment3d const & moveSeg, int triId, int edgeId, float & outHitTime ) const +bool FloorMesh::calcHitTime(Segment3d const & moveSeg, int triId, int edgeId, float & outHitTime) const { Line3d moveLine = moveSeg.getLine(); @@ -2022,9 +2021,9 @@ bool FloorMesh::calcHitTime ( Segment3d const & moveSeg, int triId, int edgeId, float param; - bool hit = Intersect2d::IntersectLineSeg( moveLine, edge, hitTime, param ); + bool hit = Intersect2d::IntersectLineSeg(moveLine, edge, hitTime, param); - if(hit) + if (hit) { outHitTime = hitTime; @@ -2038,17 +2037,17 @@ bool FloorMesh::calcHitTime ( Segment3d const & moveSeg, int triId, int edgeId, // ---------------------------------------------------------------------- -bool FloorMesh::attach ( FloorLocator & loc ) const +bool FloorMesh::attach(FloorLocator & loc) const { - if(loc.getFloorMesh() != this) + if (loc.getFloorMesh() != this) { loc.setFloorMesh(this); FloorLocator tempLoc; - bool dropOK = dropTest(loc,tempLoc); + bool dropOK = dropTest(loc, tempLoc); - if(dropOK) loc = tempLoc; + if (dropOK) loc = tempLoc; return dropOK; } @@ -2060,14 +2059,14 @@ bool FloorMesh::attach ( FloorLocator & loc ) const // ---------------------------------------------------------------------- -PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector const & delta, - int & outHitTriId, int & outHitEdge, float & outHitTime ) const +PathWalkResult FloorMesh::pathWalkPoint(FloorLocator const & startLoc, Vector const & delta, + int & outHitTriId, int & outHitEdge, float & outHitTime) const { Vector begin = startLoc.getPosition_l(); Vector end = begin + delta; - Segment3d pathSegment(begin,end); - Ribbon3d pathRibbon(pathSegment,-Vector::unitY); + Segment3d pathSegment(begin, end); + Ribbon3d pathRibbon(pathSegment, -Vector::unitY); outHitTriId = -1; outHitEdge = -1; @@ -2078,15 +2077,15 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector int startTriId = startLoc.getId(); - if(startTriId == -1) + if (startTriId == -1) { - PathWalkResult entryResult = findStartingTri(startLoc,delta,false,startTriId); + PathWalkResult entryResult = findStartingTri(startLoc, delta, false, startTriId); - if(entryResult == PWR_DoesntEnter) + if (entryResult == PWR_DoesntEnter) { return PWR_DoesntEnter; } - else if(entryResult == PWR_CantEnter) + else if (entryResult == PWR_CantEnter) { return PWR_CantEnter; } @@ -2095,19 +2094,19 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector { Triangle3d startTri = getTriangle(startTriId); - if( !Overlap2d::TestPointTri(begin,startTri) ) + if (!Overlap2d::TestPointTri(begin, startTri)) { - int enterTriEdge = Collision3d::TestEntranceTri(pathRibbon,startTri); + int enterTriEdge = Collision3d::TestEntranceTri(pathRibbon, startTri); - if(enterTriEdge == -1) + if (enterTriEdge == -1) { return PWR_DoesntEnter; } else { - FloorEdgeId id(startTriId,enterTriEdge); + FloorEdgeId id(startTriId, enterTriEdge); - if(!canEnterEdge(startLoc,delta,id,false)) + if (!canEnterEdge(startLoc, delta, id, false)) { return PWR_CantEnter; } @@ -2119,16 +2118,16 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector int currentTriId = startTriId; - // trap for an infinite loop - fan + // trap for an infinite loop - fan int numIterations = 0; const int maxIterations = 100; - while(currentTriId != -1 && numIterations < maxIterations) + while (currentTriId != -1 && numIterations < maxIterations) { Triangle3d currentTri = getTriangle(currentTriId); - - if( Overlap2d::TestPointTri(end,currentTri) ) + + if (Overlap2d::TestPointTri(end, currentTri)) { outHitTriId = currentTriId; outHitEdge = -1; @@ -2140,8 +2139,8 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector // ---------- int hitEdgeId = Collision3d::TestExitTri(pathRibbon, currentTri); - - if(hitEdgeId == -1) + + if (hitEdgeId == -1) { outHitTriId = currentTriId; outHitEdge = -1; @@ -2152,9 +2151,9 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector float tempHitTime = 0.0f; - bool calcHitOK = calcHitTime( pathSegment, currentTriId, hitEdgeId, tempHitTime ); + bool calcHitOK = calcHitTime(pathSegment, currentTriId, hitEdgeId, tempHitTime); - if(!calcHitOK) + if (!calcHitOK) { FLOOR_WARNING("FloorMesh::pathWalkPoint - Couldn't calc exit time"); @@ -2162,15 +2161,15 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector } else { - FloorEdgeId id(currentTriId,hitEdgeId); + FloorEdgeId id(currentTriId, hitEdgeId); - if(!canExitEdge(startLoc,delta,id,false)) + if (!canExitEdge(startLoc, delta, id, false)) { Vector contactDelta = delta * tempHitTime; float contactDist = contactDelta.magnitude(); - if(contactDist <= wallEpsilon) + if (contactDist <= wallEpsilon) { // The starting point is extremely close to the contact point, close enough that // the starting point can be considered to be in contact with its hit edge @@ -2196,13 +2195,13 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector int neighborTriId = getFloorTri(currentTriId).getNeighborIndex(hitEdgeId); - if(neighborTriId == -1) + if (neighborTriId == -1) { float tempHitTime(0); - bool calcHitOK = calcHitTime( pathSegment, currentTriId, hitEdgeId, tempHitTime ); + bool calcHitOK = calcHitTime(pathSegment, currentTriId, hitEdgeId, tempHitTime); - if(!calcHitOK) + if (!calcHitOK) { FLOOR_WARNING("FloorMesh::pathWalkPoint - Couldn't calc exit time"); @@ -2214,7 +2213,7 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector int portalId = floorTri.getPortalId(hitEdgeId); - if(portalId == -1) + if (portalId == -1) { outHitTriId = currentTriId; outHitEdge = hitEdgeId; @@ -2233,7 +2232,7 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector } } - if(neighborTriId == currentTriId) + if (neighborTriId == currentTriId) { outHitTriId = currentTriId; outHitEdge = hitEdgeId; @@ -2242,7 +2241,6 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector return PWR_WalkFailed; } - // ---------- // Path didn't clip against this tri, step to the adjacent tri @@ -2251,7 +2249,7 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector } // Should never get here, but... - if(numIterations >= maxIterations) + if (numIterations >= maxIterations) FLOOR_WARNING("FloorMesh::pathWalkPoint - numInterations exceeded maxInterations"); else FLOOR_WARNING("FloorMesh::pathWalkPoint - couldn't find a neighbortTriId"); @@ -2265,11 +2263,11 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector // ---------------------------------------------------------------------- -void FloorMesh::setPartTags ( void ) +void FloorMesh::setPartTags(void) { FloorTriStack unprocessed; - for(int i = 0; i < getTriCount(); i++) + for (int i = 0; i < getTriCount(); i++) { FloorTri * tri = &getFloorTri(i); @@ -2282,21 +2280,21 @@ void FloorMesh::setPartTags ( void ) int currentTag = 0; - while(!unprocessed.empty()) + while (!unprocessed.empty()) { FloorTri * currentTri = unprocessed.top(); unprocessed.pop(); - if(currentTri->getPartTag() != -1) continue; + if (currentTri->getPartTag() != -1) continue; processing.push(currentTri); - while(!processing.empty()) + while (!processing.empty()) { FloorTri * tri = processing.top(); processing.pop(); - if(tri->getPartTag() != -1) continue; + if (tri->getPartTag() != -1) continue; tri->setPartTag(currentTag); @@ -2304,9 +2302,9 @@ void FloorMesh::setPartTags ( void ) int neighborB = tri->getNeighborIndex(1); int neighborC = tri->getNeighborIndex(2); - if(neighborA != -1) processing.push(&getFloorTri( neighborA) ); - if(neighborB != -1) processing.push(&getFloorTri( neighborB) ); - if(neighborC != -1) processing.push(&getFloorTri( neighborC) ); + if (neighborA != -1) processing.push(&getFloorTri(neighborA)); + if (neighborB != -1) processing.push(&getFloorTri(neighborB)); + if (neighborC != -1) processing.push(&getFloorTri(neighborC)); } currentTag++; @@ -2315,15 +2313,15 @@ void FloorMesh::setPartTags ( void ) // ---------- -int FloorMesh::getPartCount ( void ) const +int FloorMesh::getPartCount(void) const { int temp = 0; - for(int i = 0; i < getTriCount(); i++) + for (int i = 0; i < getTriCount(); i++) { int tag = getFloorTri(i).getPartTag(); - if(tag > temp) temp = tag; + if (tag > temp) temp = tag; } return temp + 1; @@ -2332,11 +2330,11 @@ int FloorMesh::getPartCount ( void ) const // ---------------------------------------------------------------------- // compute the height functions for each tri in the floor -void FloorMesh::calcHeightFuncs ( void ) +void FloorMesh::calcHeightFuncs(void) { int triCount = getTriCount(); - for(int i = 0; i < triCount; i++) + for (int i = 0; i < triCount; i++) { FloorTri & T = getFloorTri(i); @@ -2344,15 +2342,15 @@ void FloorMesh::calcHeightFuncs ( void ) Vector N = T.getNormal(); - if(N.y == 0.0f) continue; + if (N.y == 0.0f) continue; float da = A.dot(N); - float dydx = -(N.x/N.y); - float dydz = -(N.z/N.y); - float c = (da/N.y); + float dydx = -(N.x / N.y); + float dydz = -(N.z / N.y); + float c = (da / N.y); - Vector heightFunc(dydx,c,dydz); + Vector heightFunc(dydx, c, dydz); T.setHeightFunc(heightFunc); } @@ -2363,26 +2361,26 @@ void FloorMesh::calcHeightFuncs ( void ) // floor mesh adjacent to the portal as being connected to it. Returns // true if the portal was matched to any edge of the floor -bool FloorMesh::matchSegmentToPoly ( Vector const & a, Vector const & b, VectorVector const & polyVerts ) +bool FloorMesh::matchSegmentToPoly(Vector const & a, Vector const & b, VectorVector const & polyVerts) { - Plane3d polyPlane( polyVerts[0], polyVerts[1], polyVerts[2] ); + Plane3d polyPlane(polyVerts[0], polyVerts[1], polyVerts[2]); // ---------- // Test 1 - Match the segment to the poly if it projects onto the interior // of the poly and is less than 10 centimeters away from the poly's plane. //ClosestPointPlane can't handle a zero length normal vector - if(polyPlane.getNormal().magnitudeSquared() > Vector::NORMALIZE_THRESHOLD) + if (polyPlane.getNormal().magnitudeSquared() > Vector::NORMALIZE_THRESHOLD) { - Vector a2 = Distance3d::ClosestPointPlane(a,polyPlane); - Vector b2 = Distance3d::ClosestPointPlane(b,polyPlane); + Vector a2 = Distance3d::ClosestPointPlane(a, polyPlane); + Vector b2 = Distance3d::ClosestPointPlane(b, polyPlane); - if(a2.inPolygon(polyVerts) && b2.inPolygon(polyVerts)) + if (a2.inPolygon(polyVerts) && b2.inPolygon(polyVerts)) { real distA = (a2 - a).magnitude(); real distB = (b2 - b).magnitude(); - if((distA < 0.1f) && (distB < 0.1f)) return true; + if ((distA < 0.1f) && (distB < 0.1f)) return true; } } @@ -2392,15 +2390,15 @@ bool FloorMesh::matchSegmentToPoly ( Vector const & a, Vector const & b, VectorV int vertCount = polyVerts.size(); - for(int i = 0; i < vertCount; i++) + for (int i = 0; i < vertCount; i++) { - Vector pa = polyVerts[i + 0]; + Vector pa = polyVerts[i + 0]; Vector pb = polyVerts[(i + 1) % vertCount]; - Segment3d S(pa,pb); + Segment3d S(pa, pb); - Vector a2 = Distance3d::ClosestPointSeg(a,S); - Vector b2 = Distance3d::ClosestPointSeg(b,S); + Vector a2 = Distance3d::ClosestPointSeg(a, S); + Vector b2 = Distance3d::ClosestPointSeg(b, S); // See if the distance between the verts is less than 5 centimeters for // both ends @@ -2408,7 +2406,7 @@ bool FloorMesh::matchSegmentToPoly ( Vector const & a, Vector const & b, VectorV real distA = (a2 - a).magnitude(); real distB = (b2 - b).magnitude(); - if((distA < 0.05f) && (distB < 0.05f)) return true; + if ((distA < 0.05f) && (distB < 0.05f)) return true; } // ---------- @@ -2416,13 +2414,13 @@ bool FloorMesh::matchSegmentToPoly ( Vector const & a, Vector const & b, VectorV // to the poly { - Vector a2 = Distance3d::ClosestPointPoly(a,polyVerts); - Vector b2 = Distance3d::ClosestPointPoly(b,polyVerts); + Vector a2 = Distance3d::ClosestPointPoly(a, polyVerts); + Vector b2 = Distance3d::ClosestPointPoly(b, polyVerts); real distA = (a2 - a).magnitude(); real distB = (b2 - b).magnitude(); - if((distA < 0.01f) && (distB < 0.01f)) return true; + if ((distA < 0.01f) && (distB < 0.01f)) return true; } return false; @@ -2430,20 +2428,20 @@ bool FloorMesh::matchSegmentToPoly ( Vector const & a, Vector const & b, VectorV // ---------------------------------------------------------------------- -void FloorMesh::findAdjacentBoundaryEdges ( VectorVector const & polyVerts, EdgeIdVec & outIds ) const +void FloorMesh::findAdjacentBoundaryEdges(VectorVector const & polyVerts, EdgeIdVec & outIds) const { - if(polyVerts.size() < 3) return; + if (polyVerts.size() < 3) return; - for(int currentTri = 0; currentTri < getTriCount(); currentTri++ ) + for (int currentTri = 0; currentTri < getTriCount(); currentTri++) { FloorTri const & F = getFloorTri(currentTri); Triangle3d T = getTriangle(currentTri); - for(int currentEdge = 0; currentEdge < 3; currentEdge++ ) + for (int currentEdge = 0; currentEdge < 3; currentEdge++) { // don't try and match internal edges - if(F.getNeighborIndex(currentEdge) != -1) + if (F.getNeighborIndex(currentEdge) != -1) { continue; } @@ -2451,9 +2449,9 @@ void FloorMesh::findAdjacentBoundaryEdges ( VectorVector const & polyVerts, Edge Vector a = T.getCorner(currentEdge); Vector b = T.getCorner(currentEdge + 1); - if(matchSegmentToPoly(a,b,polyVerts)) + if (matchSegmentToPoly(a, b, polyVerts)) { - outIds.push_back( EdgeId(currentTri,currentEdge) ); + outIds.push_back(EdgeId(currentTri, currentEdge)); } } } @@ -2461,19 +2459,19 @@ void FloorMesh::findAdjacentBoundaryEdges ( VectorVector const & polyVerts, Edge // ---------------------------------------------------------------------- -bool FloorMesh::flagPortalEdges( VectorVector const & portalVerts, int portalId ) +bool FloorMesh::flagPortalEdges(VectorVector const & portalVerts, int portalId) { EdgeIdVec tempIds; - findAdjacentBoundaryEdges(portalVerts,tempIds); + findAdjacentBoundaryEdges(portalVerts, tempIds); int idCount = tempIds.size(); - for(int i = 0; i < idCount; i++) + for (int i = 0; i < idCount; i++) { EdgeId const & id = tempIds[i]; - getFloorTri(id.first).setPortalId( id.second, portalId ); + getFloorTri(id.first).setPortalId(id.second, portalId); } return !tempIds.empty(); @@ -2481,16 +2479,16 @@ bool FloorMesh::flagPortalEdges( VectorVector const & portalVerts, int portalId // ---------------------------------------------------------------------- -bool FloorMesh::validate ( FloorLocator const & loc ) const +bool FloorMesh::validate(FloorLocator const & loc) const { - if(loc.getId() == -1) + if (loc.getId() == -1) { return true; } FloorLocator temp; - if( !testIntersect( Line3d(loc.getPosition_l(),-Vector::unitY), loc.getId(), temp) ) + if (!testIntersect(Line3d(loc.getPosition_l(), -Vector::unitY), loc.getId(), temp)) { FLOOR_WARNING("FloorMesh::validate - Validate locator failed"); return false; @@ -2503,11 +2501,11 @@ bool FloorMesh::validate ( FloorLocator const & loc ) const // ---------------------------------------------------------------------- -PathWalkResult FloorMesh::pathWalkCircle ( FloorLocator const & startLoc, - Vector const & delta, - int ignoreTriId, - int ignoreEdge, - FloorLocator & result ) const +PathWalkResult FloorMesh::pathWalkCircle(FloorLocator const & startLoc, + Vector const & delta, + int ignoreTriId, + int ignoreEdge, + FloorLocator & result) const { float radius = startLoc.getRadius(); @@ -2521,28 +2519,28 @@ PathWalkResult FloorMesh::pathWalkCircle ( FloorLocator const & startLoc, int hitEdgeId = -1; int centerTriId = -1; - PathWalkResult walkResult = pathWalkCircleGetIds( startLoc, delta, ignoreTriId, ignoreEdge, hitTime, hitId, hitEdgeId, centerTriId ); + PathWalkResult walkResult = pathWalkCircleGetIds(startLoc, delta, ignoreTriId, ignoreEdge, hitTime, hitId, hitEdgeId, centerTriId); // ---------- // use the results to build a FloorLocator - if(walkResult == PWR_DoesntEnter) + if (walkResult == PWR_DoesntEnter) { - FloorLocator endLoc(this,begin+delta,-1,0.0f,radius); + FloorLocator endLoc(this, begin + delta, -1, 0.0f, radius); - makeSuccessResult(endLoc,result); + makeSuccessResult(endLoc, result); return walkResult; } - else if(walkResult == PWR_HitBeforeEnter) + else if (walkResult == PWR_HitBeforeEnter) { - makeHitResult2( begin, delta, centerTriId, hitId, hitEdgeId, hitTime, result ); + makeHitResult2(begin, delta, centerTriId, hitId, hitEdgeId, hitTime, result); result.setRadius(radius); return walkResult; } - else if((walkResult == PWR_MissedStartTri) || (walkResult == PWR_CantEnter) || (walkResult == PWR_StartLocInvalid) || (walkResult == PWR_WalkFailed) || (walkResult == PWR_HitPast)) + else if ((walkResult == PWR_MissedStartTri) || (walkResult == PWR_CantEnter) || (walkResult == PWR_StartLocInvalid) || (walkResult == PWR_WalkFailed) || (walkResult == PWR_HitPast)) { makeFailureResult(result); @@ -2550,46 +2548,46 @@ PathWalkResult FloorMesh::pathWalkCircle ( FloorLocator const & startLoc, return walkResult; } - else if((walkResult == PWR_HitEdge) || (walkResult == PWR_InContact)) + else if ((walkResult == PWR_HitEdge) || (walkResult == PWR_InContact)) { - makeHitResult2( begin, delta, centerTriId, hitId, hitEdgeId, hitTime, result ); + makeHitResult2(begin, delta, centerTriId, hitId, hitEdgeId, hitTime, result); result.setRadius(radius); return walkResult; } - else if((walkResult == PWR_CenterHitEdge) || (walkResult == PWR_CenterInContact)) + else if ((walkResult == PWR_CenterHitEdge) || (walkResult == PWR_CenterInContact)) { - makeHitResult( begin, delta, hitId, hitEdgeId, hitTime, result ); + makeHitResult(begin, delta, hitId, hitEdgeId, hitTime, result); result.setRadius(radius); return walkResult; } - else if(walkResult == PWR_ExitedMesh) + else if (walkResult == PWR_ExitedMesh) { - makeExitResult( begin, delta, hitId, hitEdgeId, hitTime, result ); + makeExitResult(begin, delta, hitId, hitEdgeId, hitTime, result); result.setRadius(radius); return walkResult; } - else if(walkResult == PWR_HitPortalEdge) + else if (walkResult == PWR_HitPortalEdge) { - makeExitResult( begin, delta, hitId, hitEdgeId, hitTime, result ); + makeExitResult(begin, delta, hitId, hitEdgeId, hitTime, result); result.setRadius(radius); return walkResult; } - else if(walkResult == PWR_WalkOk) + else if (walkResult == PWR_WalkOk) { - Line3d endLine(begin+delta,-Vector::unitY); + Line3d endLine(begin + delta, -Vector::unitY); FloorLocator dropLoc; - if(centerTriId != -1) + if (centerTriId != -1) { - if(!testIntersect(endLine, centerTriId, dropLoc)) + if (!testIntersect(endLine, centerTriId, dropLoc)) { FLOOR_WARNING("FloorMesh::pathWalkCircle - Walk was OK, but end point isn't in the end triangle"); @@ -2603,7 +2601,7 @@ PathWalkResult FloorMesh::pathWalkCircle ( FloorLocator const & startLoc, dropLoc.setRadius(radius); - makeSuccessResult(dropLoc,result); + makeSuccessResult(dropLoc, result); return walkResult; } @@ -2635,20 +2633,20 @@ PathWalkResult FloorMesh::pathWalkCircle ( FloorLocator const & startLoc, struct EdgeQueueEntry { - EdgeQueueEntry( int id, float time ) - : triId(id), hitTime(time) + EdgeQueueEntry(int id, float time) + : triId(id), hitTime(time) { } // This compare returns A.hitTime > B.hitTime so that the queue // will be ordered earliest-to-latest - static bool compare ( EdgeQueueEntry const & A, EdgeQueueEntry const & B ) + static bool compare(EdgeQueueEntry const & A, EdgeQueueEntry const & B) { return A.hitTime > B.hitTime; } - bool operator < ( EdgeQueueEntry const & A ) const + bool operator < (EdgeQueueEntry const & A) const { return hitTime > A.hitTime; } @@ -2658,22 +2656,22 @@ struct EdgeQueueEntry }; typedef std::priority_queue< EdgeQueueEntry > FloorEdgeQueue; -typedef std::stack FloorTriIdStack; +typedef std::stack FloorTriIdStack; // ---------- -PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc, Vector const & delta, - int ignoreTriId, int ignoreEdge, - float & outHitTime, int & outHitTriId, int & outHitEdge, int & outCenterTriId ) const +PathWalkResult FloorMesh::pathWalkCircleGetIds(FloorLocator const & inStartLoc, Vector const & delta, + int ignoreTriId, int ignoreEdge, + float & outHitTime, int & outHitTriId, int & outHitEdge, int & outCenterTriId) const { FloorLocator startLoc = inStartLoc; Vector begin = startLoc.getPosition_l(); Vector end = begin + delta; - Line3d beginLine(begin,-Vector::unitY); - Ribbon3d pathRibbon(begin,end,-Vector::unitY); + Line3d beginLine(begin, -Vector::unitY); + Ribbon3d pathRibbon(begin, end, -Vector::unitY); - Circle circle( begin, startLoc.getRadius() ); + Circle circle(begin, startLoc.getRadius()); outHitTime = REAL_MAX; outHitTriId = -1; @@ -2685,15 +2683,15 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc int startTriId = startLoc.getId(); - if(startTriId == -1) + if (startTriId == -1) { - PathWalkResult entryResult = findStartingTri(startLoc,delta,true,startTriId); + PathWalkResult entryResult = findStartingTri(startLoc, delta, true, startTriId); - if(entryResult == PWR_DoesntEnter) + if (entryResult == PWR_DoesntEnter) { return PWR_DoesntEnter; } - else if(entryResult == PWR_CantEnter) + else if (entryResult == PWR_CantEnter) { return PWR_CantEnter; } @@ -2704,19 +2702,19 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc { Triangle3d startTri = getTriangle(startTriId); - if( !Overlap3d::TestLineTriSided(beginLine,startTri) ) + if (!Overlap3d::TestLineTriSided(beginLine, startTri)) { - int enterTriEdge = Collision3d::TestEntranceTri(pathRibbon,startTri); + int enterTriEdge = Collision3d::TestEntranceTri(pathRibbon, startTri); - if(enterTriEdge == -1) + if (enterTriEdge == -1) { return PWR_DoesntEnter; } else { - FloorEdgeId id(startTriId,enterTriEdge); + FloorEdgeId id(startTriId, enterTriEdge); - if(!canEnterEdge(startLoc,delta,id,true)) + if (!canEnterEdge(startLoc, delta, id, true)) { return PWR_CantEnter; } @@ -2725,7 +2723,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc } // ---------- - // First things first - Find out if and when the center of the circle will + // First things first - Find out if and when the center of the circle will // exit the floor during this timestep PathWalkResult centerWalkResult; @@ -2734,16 +2732,16 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc int centerHitEdge = -1; { - centerWalkResult = pathWalkPoint( startLoc, delta, centerHitTriId, centerHitEdge, centerHitTime ); + centerWalkResult = pathWalkPoint(startLoc, delta, centerHitTriId, centerHitEdge, centerHitTime); - if( (centerWalkResult == PWR_MissedStartTri) - || (centerWalkResult == PWR_CantEnter) - || (centerWalkResult == PWR_WalkFailed) - || (centerWalkResult == PWR_StartLocInvalid) ) + if ((centerWalkResult == PWR_MissedStartTri) + || (centerWalkResult == PWR_CantEnter) + || (centerWalkResult == PWR_WalkFailed) + || (centerWalkResult == PWR_StartLocInvalid)) { return centerWalkResult; } - else if( centerWalkResult == PWR_InContact ) + else if (centerWalkResult == PWR_InContact) { // The center of the circle is in contact with an edge and will stay in contact during this timestep. @@ -2754,7 +2752,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc return PWR_CenterInContact; } - else if( (centerWalkResult == PWR_ExitedMesh) || (centerWalkResult == PWR_HitEdge) || (centerWalkResult == PWR_HitPortalEdge) ) + else if ((centerWalkResult == PWR_ExitedMesh) || (centerWalkResult == PWR_HitEdge) || (centerWalkResult == PWR_HitPortalEdge)) { // The center of the circle will hit an edge during this timestep } @@ -2764,7 +2762,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc } // ---------- - + bool hitAnything = false; float circleHitTime = 1.0f; int circleHitTriId = -1; @@ -2774,27 +2772,27 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc FloorEdgeQueue unprocessed; - unprocessed.push( EdgeQueueEntry(startTriId,0.0f) ); + unprocessed.push(EdgeQueueEntry(startTriId, 0.0f)); - while(!unprocessed.empty()) + while (!unprocessed.empty()) { int currentTriId = unprocessed.top().triId; unprocessed.pop(); - FloorTri const & currentTri = getFloorTri( currentTriId ); - - if(currentTri.getMark() == markValue) continue; + FloorTri const & currentTri = getFloorTri(currentTriId); + + if (currentTri.getMark() == markValue) continue; currentTri.setMark(markValue); // ---------- // Test for hits with each edge of the tri - for(int i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { // See if it's even possible to hit this edge - if((ignoreTriId == currentTriId) && (ignoreEdge == i)) + if ((ignoreTriId == currentTriId) && (ignoreEdge == i)) { continue; } @@ -2803,11 +2801,11 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc Vector edgeDir = edge.getDelta(); - Vector edgeNormal(edgeDir.z,0.0f,-edgeDir.x); + Vector edgeNormal(edgeDir.z, 0.0f, -edgeDir.x); - Vector V(delta.x,0.0f,delta.z); + Vector V(delta.x, 0.0f, delta.z); - if(edgeNormal.dot(V) > 0.0f) + if (edgeNormal.dot(V) > 0.0f) { // circle is moving away from the edge @@ -2815,7 +2813,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc FloorEdgeType edgeType = getFloorTri(currentTriId).getEdgeType(i); - if(edgeType == FET_WallBase) + if (edgeType == FET_WallBase) { continue; } @@ -2823,33 +2821,33 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc // Compute the time of intersection between the circle and the edge - Range hitRange = Intersect2d::IntersectCircleSeg(circle,V,edge); + Range hitRange = Intersect2d::IntersectCircleSeg(circle, V, edge); - // Ignore the hit if it ended in the past, starts further in the future than our + // Ignore the hit if it ended in the past, starts further in the future than our // earliest hit, or starts after the circle has already left the floor - if( hitRange.isEmpty() ) continue; - if( hitRange.getMax() < 0.0f ) continue; - if( hitRange.getMin() > circleHitTime ) continue; + if (hitRange.isEmpty()) continue; + if (hitRange.getMax() < 0.0f) continue; + if (hitRange.getMin() > circleHitTime) continue; - if( (centerWalkResult == PWR_ExitedMesh) || (centerWalkResult == PWR_HitPortalEdge) || (centerWalkResult == PWR_HitEdge) ) + if ((centerWalkResult == PWR_ExitedMesh) || (centerWalkResult == PWR_HitPortalEdge) || (centerWalkResult == PWR_HitEdge)) { - if(hitRange.getMin() > centerHitTime) continue; + if (hitRange.getMin() > centerHitTime) continue; } // This hit needs processing. - FloorEdgeId id(currentTriId,i); + FloorEdgeId id(currentTriId, i); - if(canExitEdge(startLoc,delta,id,true)) + if (canExitEdge(startLoc, delta, id, true)) { // Crossable edge hit - push the adjacent triangle onto the stack int neighbor = currentTri.getNeighborIndex(i); - if(neighbor != -1) + if (neighbor != -1) { - unprocessed.push( EdgeQueueEntry(neighbor,hitRange.getMin()) ); + unprocessed.push(EdgeQueueEntry(neighbor, hitRange.getMin())); } } else @@ -2858,29 +2856,29 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc Vector endPoint = begin + V * hitRange.getMin(); - Vector contactPoint = Distance2d::ClosestPointSeg(endPoint,edge); + Vector contactPoint = Distance2d::ClosestPointSeg(endPoint, edge); Vector contactNormal = endPoint - contactPoint; contactNormal.y = 0.0f; - if(contactNormal.dot(V) >= 0.0f) + if (contactNormal.dot(V) >= 0.0f) { continue; } - if(hitRange.getMin() == hitRange.getMax()) + if (hitRange.getMin() == hitRange.getMax()) { // Degenerate hit - circle grazes one end of the segment. Ignore the hit. - + continue; } - else if(hitRange.getMin() < 0.0f) + else if (hitRange.getMin() < 0.0f) { float stepDistance = delta.magnitude(); float contactDistance = stepDistance * -hitRange.getMin(); - if(contactDistance < wallEpsilon) + if (contactDistance < wallEpsilon) { circleHitTime = hitRange.getMin(); circleHitTriId = currentTriId; @@ -2907,13 +2905,13 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc // ---------- - if(hitAnything) + if (hitAnything) { float stepDistance = delta.magnitude(); float contactDist = std::abs(stepDistance * circleHitTime); - if((circleHitTime < 0) && (contactDist > wallEpsilon)) + if ((circleHitTime < 0) && (contactDist > wallEpsilon)) { // The circle hit an edge some time in the past. @@ -2926,7 +2924,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc } else { - if(contactDist <= wallEpsilon) + if (contactDist <= wallEpsilon) { // The circle is currently in contact with an edge @@ -2939,7 +2937,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc } else { - // The circle hits an edge during this timestep. + // The circle hits an edge during this timestep. // Walk the center of the circle to where it will be at the contact time Vector newDelta = delta * circleHitTime; @@ -2948,9 +2946,9 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc int newCenterHitEdge = -1; float newCenterHitTime = REAL_MAX; - PathWalkResult result = pathWalkPoint( startLoc, newDelta, newCenterTriId, newCenterHitEdge, newCenterHitTime ); + PathWalkResult result = pathWalkPoint(startLoc, newDelta, newCenterTriId, newCenterHitEdge, newCenterHitTime); - if(result == PWR_HitEdge) + if (result == PWR_HitEdge) { outHitTime = newCenterHitTime; outHitTriId = newCenterTriId; @@ -2959,7 +2957,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc return PWR_CenterHitEdge; } - else if(result == PWR_InContact) + else if (result == PWR_InContact) { outHitTime = newCenterHitTime; outHitTriId = newCenterTriId; @@ -2968,7 +2966,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc return PWR_CenterInContact; } - else if(result == PWR_DoesntEnter) + else if (result == PWR_DoesntEnter) { outHitTime = circleHitTime; outHitTriId = circleHitTriId; @@ -2977,7 +2975,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc return PWR_HitBeforeEnter; } - else if(result != PWR_WalkOk) + else if (result != PWR_WalkOk) { FLOOR_WARNING("FloorMeshpathWalkCircleGetIds - Walking the center to the time of the circle's contact failed"); return PWR_WalkFailed; @@ -2994,7 +2992,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc } else { - if(centerWalkResult == PWR_HitEdge) + if (centerWalkResult == PWR_HitEdge) { outHitTime = centerHitTime; outHitTriId = centerHitTriId; @@ -3003,7 +3001,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc return PWR_CenterHitEdge; } - else if(centerWalkResult == PWR_InContact) + else if (centerWalkResult == PWR_InContact) { outHitTime = centerHitTime; outHitTriId = centerHitTriId; @@ -3012,7 +3010,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc return PWR_CenterInContact; } - else if(centerWalkResult == PWR_ExitedMesh) + else if (centerWalkResult == PWR_ExitedMesh) { outHitTime = centerHitTime; outHitTriId = centerHitTriId; @@ -3021,7 +3019,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc return PWR_ExitedMesh; } - else if(centerWalkResult == PWR_HitPortalEdge) + else if (centerWalkResult == PWR_HitPortalEdge) { outHitTime = centerHitTime; outHitTriId = centerHitTriId; @@ -3042,35 +3040,35 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc return PWR_WalkOk; } } - + WARNING_STRICT_FATAL(true, ("pathWalkCircleGetIds failed to compute a result. Return PWR_WalkOk")); outHitTime = REAL_MAX; outHitTriId = -1; outHitEdge = -1; outCenterTriId = centerHitTriId; - + return PWR_WalkOk; } // ---------------------------------------------------------------------- -bool FloorMesh::testAboveCrossables ( FloorLocator const & testLoc ) const +bool FloorMesh::testAboveCrossables(FloorLocator const & testLoc) const { - Vector offset(0.0f,gs_hopTolerance,0.0f); + Vector offset(0.0f, gs_hopTolerance, 0.0f); - Circle circle( testLoc.getOffsetPosition_l() + offset, testLoc.getRadius() - gs_clearTolerance ); + Circle circle(testLoc.getOffsetPosition_l() + offset, testLoc.getRadius() - gs_clearTolerance); int edgeCount = m_crossableEdges->size(); - for(int i = 0; i < edgeCount; i++) + for (int i = 0; i < edgeCount; i++) { FloorEdgeId id = m_crossableEdges->at(i); - if(getFloorTri(id.triId).isFallthrough()) continue; + if (getFloorTri(id.triId).isFallthrough()) continue; Segment3d edge = getTriangle(id.triId).getEdgeSegment(id.edgeId); - if( Overlap3d::TestSegCircle_Below(edge,circle) ) + if (Overlap3d::TestSegCircle_Below(edge, circle)) { return false; } @@ -3081,31 +3079,31 @@ bool FloorMesh::testAboveCrossables ( FloorLocator const & testLoc ) const // ---------------------------------------------------------------------- -bool FloorMesh::testAboveCrossables ( FloorLocator const & testLoc, Vector const & inDelta ) const +bool FloorMesh::testAboveCrossables(FloorLocator const & testLoc, Vector const & inDelta) const { - DEBUG_FATAL(inDelta.y != 0.0f,("FloorMesh::testCrossables - can't handle Y movement yet\n")); + DEBUG_FATAL(inDelta.y != 0.0f, ("FloorMesh::testCrossables - can't handle Y movement yet\n")); - Vector delta(inDelta.x,0.0f,inDelta.z); + Vector delta(inDelta.x, 0.0f, inDelta.z); - Vector offset(0.0f,gs_hopTolerance,0.0f); + Vector offset(0.0f, gs_hopTolerance, 0.0f); - Circle circle( testLoc.getOffsetPosition_l() + offset, testLoc.getRadius() - gs_clearTolerance ); + Circle circle(testLoc.getOffsetPosition_l() + offset, testLoc.getRadius() - gs_clearTolerance); int edgeCount = m_crossableEdges->size(); - for(int i = 0; i < edgeCount; i++) + for (int i = 0; i < edgeCount; i++) { FloorEdgeId id = m_crossableEdges->at(i); - if(getFloorTri(id.triId).isFallthrough()) continue; + if (getFloorTri(id.triId).isFallthrough()) continue; Segment3d edge = getTriangle(id.triId).getEdgeSegment(id.edgeId); - Range hitRange = Intersect3d::IntersectCircleSeg_Below(circle,delta,edge); + Range hitRange = Intersect3d::IntersectCircleSeg_Below(circle, delta, edge); - if(hitRange.isEmpty()) continue; - - if((hitRange.getMin() <= 1.0f) && (hitRange.getMax() >= 0.0f)) return false; + if (hitRange.isEmpty()) continue; + + if ((hitRange.getMin() <= 1.0f) && (hitRange.getMax() >= 0.0f)) return false; } return true; @@ -3113,7 +3111,7 @@ bool FloorMesh::testAboveCrossables ( FloorLocator const & testLoc, Vector const // ---------------------------------------------------------------------- -bool FloorMesh::testClear ( FloorLocator const & inTestLoc ) const +bool FloorMesh::testClear(FloorLocator const & inTestLoc) const { FloorLocator testLoc = inTestLoc; @@ -3121,12 +3119,12 @@ bool FloorMesh::testClear ( FloorLocator const & inTestLoc ) const int startTriId = testLoc.getId(); - if(startTriId == -1) + if (startTriId == -1) { return true; } - Circle testCircle( testLoc.getOffsetPosition_l(), testLoc.getRadius() ); + Circle testCircle(testLoc.getOffsetPosition_l(), testLoc.getRadius()); // ---------- @@ -3135,60 +3133,60 @@ bool FloorMesh::testClear ( FloorLocator const & inTestLoc ) const static FloorTriIdQueue unprocessed; unprocessed.clear(); - unprocessed.push_back( startTriId ); + unprocessed.push_back(startTriId); bool testedAboveCrossables = false; - while(!unprocessed.empty()) + while (!unprocessed.empty()) { int currentTriId = unprocessed.front(); unprocessed.pop_front(); - FloorTri const & currentTri = getFloorTri( currentTriId ); - - if(currentTri.getMark() == markValue) continue; + FloorTri const & currentTri = getFloorTri(currentTriId); + + if (currentTri.getMark() == markValue) continue; currentTri.setMark(markValue); // ---------- - - for(int i = 0; i < 3; i++) + + for (int i = 0; i < 3; i++) { Segment3d edge = getTriangle(currentTriId).getEdgeSegment(i); - if(!Overlap2d::TestSegCircle(edge,testCircle)) continue; + if (!Overlap2d::TestSegCircle(edge, testCircle)) continue; // ---------- FloorEdgeType type = currentTri.getEdgeType(i); - if(type == FET_Crossable) + if (type == FET_Crossable) { // circle overlaps a crossable edge, push the neighbor onto the stack int neighbor = currentTri.getNeighborIndex(i); - if(neighbor != -1) + if (neighbor != -1) { - unprocessed.push_back( neighbor ); + unprocessed.push_back(neighbor); } continue; } - else if(type == FET_Uncrossable) + else if (type == FET_Uncrossable) { // circle overlaps an uncrossable edge, circle is not clear return false; } - else if(type == FET_WallBase) + else if (type == FET_WallBase) { // circle overlaps a wall base. circle is not clear if it's under a crossable // edge of a solid tri. we only need to run this test once. - if(testedAboveCrossables) continue; + if (testedAboveCrossables) continue; - if(!testAboveCrossables(testLoc)) + if (!testAboveCrossables(testLoc)) { return false; } @@ -3207,7 +3205,7 @@ bool FloorMesh::testClear ( FloorLocator const & inTestLoc ) const // ---------------------------------------------------------------------- -bool FloorMesh::getClosestCollidableEdge ( FloorLocator const & loc, int & outTriId, int & outEdgeId, float & outDist ) const +bool FloorMesh::getClosestCollidableEdge(FloorLocator const & loc, int & outTriId, int & outEdgeId, float & outDist) const { FloorLocator testLoc = loc; @@ -3215,12 +3213,12 @@ bool FloorMesh::getClosestCollidableEdge ( FloorLocator const & loc, int & outTr int startTriId = testLoc.getId(); - if(startTriId == -1) + if (startTriId == -1) { return false; } - Circle testCircle( testLoc.getPosition_l(), testLoc.getRadius() ); + Circle testCircle(testLoc.getPosition_l(), testLoc.getRadius()); int minTriId = -1; int minEdgeId = -1; @@ -3232,63 +3230,63 @@ bool FloorMesh::getClosestCollidableEdge ( FloorLocator const & loc, int & outTr static FloorTriIdQueue unprocessed; unprocessed.clear(); - unprocessed.push_back( startTriId ); + unprocessed.push_back(startTriId); bool testedAboveCrossables = false; bool isAboveCrossables = false; - while(!unprocessed.empty()) + while (!unprocessed.empty()) { int currentTriId = unprocessed.front(); unprocessed.pop_front(); - FloorTri const & currentTri = getFloorTri( currentTriId ); - - if(currentTri.getMark() == markValue) continue; + FloorTri const & currentTri = getFloorTri(currentTriId); + + if (currentTri.getMark() == markValue) continue; currentTri.setMark(markValue); // ---------- - - for(int i = 0; i < 3; i++) + + for (int i = 0; i < 3; i++) { Segment3d edge = getTriangle(currentTriId).getEdgeSegment(i); - float dist = Distance2d::DistancePointSeg( testCircle.getCenter(), edge ); + float dist = Distance2d::DistancePointSeg(testCircle.getCenter(), edge); - if(dist >= testCircle.getRadius()) continue; + if (dist >= testCircle.getRadius()) continue; // ---------- FloorEdgeType type = currentTri.getEdgeType(i); - if(type == FET_Crossable) + if (type == FET_Crossable) { int neighbor = currentTri.getNeighborIndex(i); - if(neighbor != -1) + if (neighbor != -1) { - unprocessed.push_back( neighbor ); + unprocessed.push_back(neighbor); } } - else if(type == FET_Uncrossable) + else if (type == FET_Uncrossable) { testCircle.setRadius(dist); minTriId = currentTriId; minEdgeId = i; } - else if(type == FET_WallBase) + else if (type == FET_WallBase) { // circle overlaps a wall base. circle is not clear if it's under a crossable // edge of a solid tri. we only need to run this test once. - if(testedAboveCrossables) continue; + if (testedAboveCrossables) continue; isAboveCrossables = testAboveCrossables(testLoc); testedAboveCrossables = true; - if(!isAboveCrossables) + if (!isAboveCrossables) { testCircle.setRadius(dist); @@ -3303,7 +3301,7 @@ bool FloorMesh::getClosestCollidableEdge ( FloorLocator const & loc, int & outTr } } - if(minTriId != -1) + if (minTriId != -1) { outTriId = minTriId; outEdgeId = minEdgeId; @@ -3319,7 +3317,7 @@ bool FloorMesh::getClosestCollidableEdge ( FloorLocator const & loc, int & outTr // ---------------------------------------------------------------------- -bool FloorMesh::testConnectable ( FloorLocator const & locA, FloorLocator const & locB ) const +bool FloorMesh::testConnectable(FloorLocator const & locA, FloorLocator const & locB) const { Vector posA = locA.getPosition_l(); Vector posB = locB.getPosition_l(); @@ -3330,43 +3328,43 @@ bool FloorMesh::testConnectable ( FloorLocator const & locA, FloorLocator const FloorLocator moveResultA; FloorLocator moveResultB; - PathWalkResult resultA = pathWalkCircle(locA,deltaA,-1,-1,moveResultA); - PathWalkResult resultB = pathWalkCircle(locB,deltaB,-1,-1,moveResultB); + PathWalkResult resultA = pathWalkCircle(locA, deltaA, -1, -1, moveResultA); + PathWalkResult resultB = pathWalkCircle(locB, deltaB, -1, -1, moveResultB); - if((resultA == PWR_ExitedMesh) || (resultA == PWR_HitPortalEdge)) + if ((resultA == PWR_ExitedMesh) || (resultA == PWR_HitPortalEdge)) { // If the move from A didn't exit the floor at B, we can't connect the locators - if(moveResultA.getTriId() != locB.getTriId()) + if (moveResultA.getTriId() != locB.getTriId()) { return false; } } - if((resultB == PWR_ExitedMesh) || (resultB == PWR_HitPortalEdge)) + if ((resultB == PWR_ExitedMesh) || (resultB == PWR_HitPortalEdge)) { // If the move from B didn't exit the floor at A, we can't connect the locators - if(moveResultB.getTriId() != locA.getTriId()) + if (moveResultB.getTriId() != locA.getTriId()) { return false; } } - if((resultA != PWR_WalkOk) && (resultA != PWR_ExitedMesh) && (resultA != PWR_HitPortalEdge)) return false; - if((resultB != PWR_WalkOk) && (resultB != PWR_ExitedMesh) && (resultB != PWR_HitPortalEdge)) return false; + if ((resultA != PWR_WalkOk) && (resultA != PWR_ExitedMesh) && (resultA != PWR_HitPortalEdge)) return false; + if ((resultB != PWR_WalkOk) && (resultB != PWR_ExitedMesh) && (resultB != PWR_HitPortalEdge)) return false; - if(resultA == PWR_WalkOk) + if (resultA == PWR_WalkOk) { - if(moveResultA.getId() != locB.getId()) + if (moveResultA.getId() != locB.getId()) { return false; } } - if(resultB == PWR_WalkOk) + if (resultB == PWR_WalkOk) { - if(moveResultB.getId() != locA.getId()) + if (moveResultB.getId() != locA.getId()) { return false; } @@ -3379,26 +3377,26 @@ bool FloorMesh::testConnectable ( FloorLocator const & locA, FloorLocator const // The points returned by getGoodLocation won't be evenly distributed over // the floor, but I don't think that's a problem. -bool FloorMesh::getGoodLocation ( float radius, Vector & outLoc ) const +bool FloorMesh::getGoodLocation(float radius, Vector & outLoc) const { int triCount = getTriCount(); int attempts = 10; - while(attempts) + while (attempts) { // Pick a random triangle in the floor - int triIndex = Random::random(triCount-1); + int triIndex = Random::random(triCount - 1); Triangle3d const & tri = getTriangle(triIndex); // Pick a random barycentric coordinate - float baryX = Random::randomReal(0.0f,1.0f); - float baryY = Random::randomReal(0.0f,1.0f); + float baryX = Random::randomReal(0.0f, 1.0f); + float baryY = Random::randomReal(0.0f, 1.0f); - if((baryX + baryY) > 1.0f) + if ((baryX + baryY) > 1.0f) { baryX = 1.0f - baryX; baryY = 1.0f - baryY; @@ -3411,11 +3409,11 @@ bool FloorMesh::getGoodLocation ( float radius, Vector & outLoc ) const Vector const & B = tri.getCornerB(); Vector const & C = tri.getCornerC(); - Vector point = A + (B-A) * baryX + (C-A) * baryY; - - FloorLocator testLoc(this,point,-1,0.0f,radius); + Vector point = A + (B - A) * baryX + (C - A) * baryY; - if(testClear(testLoc)) + FloorLocator testLoc(this, point, -1, 0.0f, radius); + + if (testClear(testLoc)) { outLoc = point; @@ -3432,36 +3430,36 @@ bool FloorMesh::getGoodLocation ( float radius, Vector & outLoc ) const // ---------------------------------------------------------------------- -int FloorMesh::getTriMarkValue ( void ) const +int FloorMesh::getTriMarkValue(void) const { return m_triMarkCounter++; } // ---------------------------------------------------------------------- -void FloorMesh::buildBoundaryEdgeList ( void ) +void FloorMesh::buildBoundaryEdgeList(void) { m_crossableEdges->clear(); m_uncrossableEdges->clear(); m_wallBaseEdges->clear(); m_wallTopEdges->clear(); - for(int i = 0; i < getTriCount(); i++) + for (int i = 0; i < getTriCount(); i++) { FloorTri const & F = getFloorTri(i); - for(int j = 0; j < 3; j++) + for (int j = 0; j < 3; j++) { - if(F.getNeighborIndex(j) == -1) + if (F.getNeighborIndex(j) == -1) { - FloorEdgeId id(i,j); + FloorEdgeId id(i, j); - switch(F.getEdgeType(j)) + switch (F.getEdgeType(j)) { - case FET_Crossable: { m_crossableEdges->push_back(id); break; } + case FET_Crossable: { m_crossableEdges->push_back(id); break; } case FET_Uncrossable: { m_uncrossableEdges->push_back(id); break; } - case FET_WallBase: { m_wallBaseEdges->push_back(id); break; } - default: { break; } + case FET_WallBase: { m_wallBaseEdges->push_back(id); break; } + default: { break; } } } } @@ -3470,7 +3468,7 @@ void FloorMesh::buildBoundaryEdgeList ( void ) // ---------------------------------------------------------------------- -bool FloorMesh::intersectEdge ( FloorLocator const & startLoc, Vector const & delta, FloorEdgeId const & id, bool useRadius, bool testFront, FloorLocator & outLoc ) const +bool FloorMesh::intersectEdge(FloorLocator const & startLoc, Vector const & delta, FloorEdgeId const & id, bool useRadius, bool testFront, FloorLocator & outLoc) const { Vector point = startLoc.getPosition_l(); @@ -3479,15 +3477,15 @@ bool FloorMesh::intersectEdge ( FloorLocator const & startLoc, Vector const & de float hitTime; - if(useRadius) + if (useRadius) { - Circle circle(point,startLoc.getRadius()); + Circle circle(point, startLoc.getRadius()); - Range hitRange = Intersect2d::IntersectCircleSeg(circle,delta,edge); + Range hitRange = Intersect2d::IntersectCircleSeg(circle, delta, edge); - if( hitRange.isEmpty() ) return false; - if( hitRange.getMax() < 0.0f ) return false; - if( hitRange.getMin() > 1.0f ) return false; + if (hitRange.isEmpty()) return false; + if (hitRange.getMax() < 0.0f) return false; + if (hitRange.getMin() > 1.0f) return false; hitTime = hitRange.getMin(); } @@ -3495,18 +3493,18 @@ bool FloorMesh::intersectEdge ( FloorLocator const & startLoc, Vector const & de { float param; - Line3d moveLine(point,delta); + Line3d moveLine(point, delta); - bool hitSeg = Intersect2d::IntersectLineSeg( moveLine, edge, hitTime, param ); + bool hitSeg = Intersect2d::IntersectLineSeg(moveLine, edge, hitTime, param); - if(!hitSeg) return false; - if(hitTime > 1.0f) return false; + if (!hitSeg) return false; + if (hitTime > 1.0f) return false; - if(hitTime < 0.0f) + if (hitTime < 0.0f) { float dist = -delta.magnitude() * hitTime; - if(dist > 0.2f) + if (dist > 0.2f) { return false; } @@ -3523,17 +3521,17 @@ bool FloorMesh::intersectEdge ( FloorLocator const & startLoc, Vector const & de Vector cross = delta.cross(edge.getDelta()); - if(testFront) + if (testFront) { - if(cross.y < 0.0f) return false; + if (cross.y < 0.0f) return false; } else { - if(cross.y > 0.0f) return false; + if (cross.y > 0.0f) return false; } Vector centerHitPos = point + delta * hitTime; - Vector crossPoint = Distance3d::ClosestPointYLine(edge,centerHitPos); + Vector crossPoint = Distance3d::ClosestPointYLine(edge, centerHitPos); float offset = centerHitPos.y - crossPoint.y + startLoc.getOffset(); @@ -3552,37 +3550,37 @@ bool FloorMesh::intersectEdge ( FloorLocator const & startLoc, Vector const & de // ---------------------------------------------------------------------- -bool FloorMesh::intersectBoundary ( FloorLocator const & startLoc, Vector const & delta, bool useRadius, FloorLocatorVec & results ) const +bool FloorMesh::intersectBoundary(FloorLocator const & startLoc, Vector const & delta, bool useRadius, FloorLocatorVec & results) const { results.clear(); bool result = false; - result |= intersectBoundary( m_crossableEdges, startLoc, delta, useRadius, results ); - result |= intersectBoundary( m_wallBaseEdges, startLoc, delta, useRadius, results ); + result |= intersectBoundary(m_crossableEdges, startLoc, delta, useRadius, results); + result |= intersectBoundary(m_wallBaseEdges, startLoc, delta, useRadius, results); return result; } // ---------- -bool FloorMesh::intersectBoundary ( FloorEdgeIdVec * edgeList, FloorLocator const & startLoc, Vector const & delta, bool useRadius, FloorLocatorVec & results ) const +bool FloorMesh::intersectBoundary(FloorEdgeIdVec * edgeList, FloorLocator const & startLoc, Vector const & delta, bool useRadius, FloorLocatorVec & results) const { bool hit = false; int edgeCount = edgeList->size(); - for( int i = 0; i < edgeCount; i++) + for (int i = 0; i < edgeCount; i++) { FloorEdgeId & id = edgeList->at(i); - Vector V(delta.x,0.0f,delta.z); + Vector V(delta.x, 0.0f, delta.z); FloorLocator hitLoc; - bool hitEdgeId = intersectEdge(startLoc,V,id,useRadius,false,hitLoc); + bool hitEdgeId = intersectEdge(startLoc, V, id, useRadius, false, hitLoc); - if(hitEdgeId) + if (hitEdgeId) { hit = true; @@ -3593,21 +3591,20 @@ bool FloorMesh::intersectBoundary ( FloorEdgeIdVec * edgeList, FloorLocator cons return hit; } - // ---------------------------------------------------------------------- -bool FloorMesh::dropTest ( FloorLocator const & testLoc, FloorLocator & outLoc ) const +bool FloorMesh::dropTest(FloorLocator const & testLoc, FloorLocator & outLoc) const { - return dropTest(testLoc,ConfigSharedCollision::getHopHeight(),outLoc); + return dropTest(testLoc, ConfigSharedCollision::getHopHeight(), outLoc); } // ---------- -bool FloorMesh::dropTest ( FloorLocator const & testLoc, float hopHeight, FloorLocator & outLoc ) const +bool FloorMesh::dropTest(FloorLocator const & testLoc, float hopHeight, FloorLocator & outLoc) const { Vector point = testLoc.getPosition_l(); - Line3d line(point,-Vector::unitY); + Line3d line(point, -Vector::unitY); FloorLocator closestAbove; FloorLocator closestBelow; @@ -3617,7 +3614,7 @@ bool FloorMesh::dropTest ( FloorLocator const & testLoc, float hopHeight, FloorL // Our drop dir points down, so the closestBelow locator is in 'front' of the line, // and the closestAbove locator is 'behind' it. - if( findClosestPair(line,-1,closestBelow,closestAbove) ) + if (findClosestPair(line, -1, closestBelow, closestAbove)) { float distBelow = std::abs(closestBelow.getOffset()); float distAbove = std::abs(closestAbove.getOffset()); @@ -3625,11 +3622,11 @@ bool FloorMesh::dropTest ( FloorLocator const & testLoc, float hopHeight, FloorL closestAbove.setSurface(this); closestBelow.setSurface(this); - if(closestAbove.isAttached() && closestBelow.isAttached()) + if (closestAbove.isAttached() && closestBelow.isAttached()) { // Handle test points on or slightly below the floor correctly - if((distAbove < distBelow) && (distAbove < 1.0f)) + if ((distAbove < distBelow) && (distAbove < 1.0f)) { outLoc = closestAbove; } @@ -3638,15 +3635,15 @@ bool FloorMesh::dropTest ( FloorLocator const & testLoc, float hopHeight, FloorL outLoc = closestBelow; } } - else if(closestBelow.isAttached()) + else if (closestBelow.isAttached()) { - if(distBelow <= fallHeight) + if (distBelow <= fallHeight) { outLoc = closestBelow; } else { - if(closestBelow.getFloorTri().isFallthrough()) + if (closestBelow.getFloorTri().isFallthrough()) { outLoc = closestBelow; } @@ -3656,15 +3653,15 @@ bool FloorMesh::dropTest ( FloorLocator const & testLoc, float hopHeight, FloorL } } } - else if(closestAbove.isAttached()) + else if (closestAbove.isAttached()) { - if(distAbove <= hopHeight) + if (distAbove <= hopHeight) { outLoc = closestAbove; } else { - if(closestAbove.getFloorTri().isFallthrough()) + if (closestAbove.getFloorTri().isFallthrough()) { outLoc = closestAbove; } @@ -3691,19 +3688,19 @@ bool FloorMesh::dropTest ( FloorLocator const & testLoc, float hopHeight, FloorL // ---------------------------------------------------------------------- -bool FloorMesh::dropTest ( FloorLocator const & testLoc, int triID, FloorLocator & outLoc ) const +bool FloorMesh::dropTest(FloorLocator const & testLoc, int triID, FloorLocator & outLoc) const { Vector point = testLoc.getPosition_l(); - Line3d line(point,-Vector::unitY); + Line3d line(point, -Vector::unitY); FloorLocator tempLoc; - if(testIntersect(line,triID,tempLoc)) + if (testIntersect(line, triID, tempLoc)) { float absDist = std::abs(tempLoc.getOffset()); - if(absDist <= ConfigSharedCollision::getHopHeight()) + if (absDist <= ConfigSharedCollision::getHopHeight()) { outLoc = tempLoc; return true; @@ -3715,15 +3712,15 @@ bool FloorMesh::dropTest ( FloorLocator const & testLoc, int triID, FloorLocator // ---------------------------------------------------------------------- -bool FloorMesh::findEntrance ( FloorLocator const & startLoc, Vector const & delta, bool useRadius, FloorLocator & outLoc ) const +bool FloorMesh::findEntrance(FloorLocator const & startLoc, Vector const & delta, bool useRadius, FloorLocator & outLoc) const { static FloorLocatorVec results; results.clear(); - bool intersected = intersectBoundary(startLoc,delta,useRadius,results); + bool intersected = intersectBoundary(startLoc, delta, useRadius, results); - if(!intersected) return false; + if (!intersected) return false; // ---------- @@ -3742,7 +3739,7 @@ bool FloorMesh::findEntrance ( FloorLocator const & startLoc, Vector const & del Vector startOffsetPoint = startLoc.getOffsetPosition_l(); Vector hitPoint = entryLoc.getPosition_l(); - + Vector crossOffsetPoint = startOffsetPoint + delta * hitTime; Vector temp = hitPoint - startOffsetPoint; @@ -3751,12 +3748,12 @@ bool FloorMesh::findEntrance ( FloorLocator const & startLoc, Vector const & del float distA = temp.magnitude(); float distB = hitPoint.magnitudeBetween(crossOffsetPoint); - // For a crossing to be considered an entrance, it has to be within half a meter + // For a crossing to be considered an entrance, it has to be within half a meter // (fudge factor) of the earliest crossing, and it has to be closer to the move // segment than the earliest crossing. - if(distA >= (minDistA + 0.5f)) continue; - if(distB >= minDistB) continue; + if (distA >= (minDistA + 0.5f)) continue; + if (distB >= minDistB) continue; float offset = entryLoc.getOffset(); @@ -3765,21 +3762,21 @@ bool FloorMesh::findEntrance ( FloorLocator const & startLoc, Vector const & del bool fallthrough = entryLoc.getFloorTri().isFallthrough(); - if((offset < hopHeight) && (!fallthrough)) + if ((offset < hopHeight) && (!fallthrough)) { // crosses too far below solid tri - - continue; + + continue; } - if((offset > fallHeight) && (!fallthrough)) + if ((offset > fallHeight) && (!fallthrough)) { // crosses too far above solid tri continue; } - if(canEnterEdge(entryLoc)) + if (canEnterEdge(entryLoc)) { minDistA = distA; minDistB = distB; @@ -3787,7 +3784,7 @@ bool FloorMesh::findEntrance ( FloorLocator const & startLoc, Vector const & del } } - if(minIndex != -1) + if (minIndex != -1) { outLoc = results[minIndex]; @@ -3801,42 +3798,42 @@ bool FloorMesh::findEntrance ( FloorLocator const & startLoc, Vector const & del // ---------------------------------------------------------------------- -void FloorMesh::drawDebugShapes ( DebugShapeRenderer * renderer, bool drawExtent ) const +void FloorMesh::drawDebugShapes(DebugShapeRenderer * renderer, bool drawExtent) const { UNREF(renderer); UNREF(drawExtent); #ifdef _DEBUG - if(renderer == nullptr) return; + if (renderer == nullptr) return; - if(ConfigSharedCollision::getDrawFloors()) + if (ConfigSharedCollision::getDrawFloors()) { - if( m_crossableLines ) renderer->drawLineList( *m_crossableLines, VectorArgb::solidGreen ); - if( m_uncrossableLines ) renderer->drawLineList( *m_uncrossableLines, VectorArgb::solidRed ); - if( m_interiorLines ) renderer->drawLineList( *m_interiorLines, VectorArgb::solidWhite); - if( m_portalLines ) renderer->drawLineList( *m_portalLines, PackedArgb(255,220,255,0) ); - if( m_rampLines ) renderer->drawLineList( *m_rampLines, PackedArgb(255,255,175,0) ); - if( m_fallthroughTriLines ) renderer->drawLineList( *m_fallthroughTriLines, VectorArgb::solidRed ); - if( m_solidTriLines ) renderer->drawLineList( *m_solidTriLines, VectorArgb::solidWhite ); + if (m_crossableLines) renderer->drawLineList(*m_crossableLines, VectorArgb::solidGreen); + if (m_uncrossableLines) renderer->drawLineList(*m_uncrossableLines, VectorArgb::solidRed); + if (m_interiorLines) renderer->drawLineList(*m_interiorLines, VectorArgb::solidWhite); + if (m_portalLines) renderer->drawLineList(*m_portalLines, PackedArgb(255, 220, 255, 0)); + if (m_rampLines) renderer->drawLineList(*m_rampLines, PackedArgb(255, 255, 175, 0)); + if (m_fallthroughTriLines) renderer->drawLineList(*m_fallthroughTriLines, VectorArgb::solidRed); + if (m_solidTriLines) renderer->drawLineList(*m_solidTriLines, VectorArgb::solidWhite); - if(drawExtent) + if (drawExtent) { getExtent_l()->drawDebugShapes(renderer); } } - if(ConfigSharedCollision::getDrawPathNodes()) + if (ConfigSharedCollision::getDrawPathNodes()) { ObjectRenderer pathRenderer = FloorManager::getPathGraphRenderer(); - if(m_pathGraph && pathRenderer) + if (m_pathGraph && pathRenderer) { - pathRenderer(m_pathGraph,renderer); + pathRenderer(m_pathGraph, renderer); } } - if(m_boxTree && ConfigSharedCollision::getDrawBoxTrees()) + if (m_boxTree && ConfigSharedCollision::getDrawBoxTrees()) { m_boxTree->drawDebugShapes(renderer); } @@ -3848,9 +3845,9 @@ void FloorMesh::drawDebugShapes ( DebugShapeRenderer * renderer, bool drawExtent #ifdef _DEBUG -void FloorMesh::buildDebugData ( void ) +void FloorMesh::buildDebugData(void) { - Vector scootUp(0.0f,0.04f,0.0f); + Vector scootUp(0.0f, 0.04f, 0.0f); // ---------- // Create our line arrays for the debug info @@ -3873,18 +3870,18 @@ void FloorMesh::buildDebugData ( void ) // ---------- - for(int i = 0; i < getTriCount(); i++) + for (int i = 0; i < getTriCount(); i++) { FloorTri const & F = getFloorTri(i); // Create border edges for the tri - for(int j = 0; j < 3; j++) + for (int j = 0; j < 3; j++) { Vector a = getVertex(F.getCornerIndex(j)) + scootUp; - Vector b = getVertex(F.getCornerIndex(j+1)) + scootUp; + Vector b = getVertex(F.getCornerIndex(j + 1)) + scootUp; - if(F.getNeighborIndex(j) != -1) + if (F.getNeighborIndex(j) != -1) { m_interiorLines->push_back(a); m_interiorLines->push_back(b); @@ -3898,18 +3895,18 @@ void FloorMesh::buildDebugData ( void ) VectorVector * container = m_uncrossableLines; - if(edgeType == FET_Crossable) container = m_crossableLines; + if (edgeType == FET_Crossable) container = m_crossableLines; - if(edgeType == FET_WallBase) container = m_rampLines; + if (edgeType == FET_WallBase) container = m_rampLines; - if(F.getPortalId(j) != -1) container = m_portalLines; + if (F.getPortalId(j) != -1) container = m_portalLines; // Edge indicators are duplicated 3 times to make them more visible - for(int i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { - container->push_back( a + scootUp * float(i) ); - container->push_back( b + scootUp * float(i) ); + container->push_back(a + scootUp * float(i)); + container->push_back(b + scootUp * float(i)); } } @@ -3942,9 +3939,9 @@ void FloorMesh::buildDebugData ( void ) // ---------------------------------------------------------------------- -bool FloorMesh::getDistanceUncrossable2d ( Vector const & V, float maxDistance, float & outDistance, FloorEdgeId & outEdgeId ) const +bool FloorMesh::getDistanceUncrossable2d(Vector const & V, float maxDistance, float & outDistance, FloorEdgeId & outEdgeId) const { - if(!m_uncrossableEdges) return false; + if (!m_uncrossableEdges) return false; // ---------- @@ -3952,24 +3949,24 @@ bool FloorMesh::getDistanceUncrossable2d ( Vector const & V, float maxDistance, float minDistance = maxDistance; - FloorEdgeId minId(-1,-1); + FloorEdgeId minId(-1, -1); - for(int i = 0; i < count; i++) + for (int i = 0; i < count; i++) { FloorEdgeId const & id = m_uncrossableEdges->at(i); Segment3d edge = getTriangle(id.triId).getEdgeSegment(id.edgeId); - float dist = Distance2d::DistancePointSeg(V,edge); + float dist = Distance2d::DistancePointSeg(V, edge); - if(dist < minDistance) + if (dist < minDistance) { minDistance = dist; minId = id; } } - if(minDistance != maxDistance) + if (minDistance != maxDistance) { outDistance = minDistance; outEdgeId = minId; @@ -3982,4 +3979,4 @@ bool FloorMesh::getDistanceUncrossable2d ( Vector const & V, float maxDistance, } } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp index 5219f6c2..ee7609f5 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp @@ -24,20 +24,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedBattlefieldMarkerObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedBattlefieldMarkerObjectTemplate::SharedBattlefieldMarkerObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedBattlefieldMarkerObjectTemplate::SharedBattlefieldMarkerObjectTemplate @@ -46,8 +46,8 @@ SharedBattlefieldMarkerObjectTemplate::SharedBattlefieldMarkerObjectTemplate(con */ SharedBattlefieldMarkerObjectTemplate::~SharedBattlefieldMarkerObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedBattlefieldMarkerObjectTemplate::~SharedBattlefieldMarkerObjectTemplate /** @@ -106,8 +106,6 @@ Tag SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const //@BEGIN TFD int SharedBattlefieldMarkerObjectTemplate::getNumberOfPoles() const { - - const SharedBattlefieldMarkerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -157,8 +155,6 @@ int SharedBattlefieldMarkerObjectTemplate::getNumberOfPoles() const int SharedBattlefieldMarkerObjectTemplate::getNumberOfPolesMin() const { - - const SharedBattlefieldMarkerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -208,8 +204,6 @@ int SharedBattlefieldMarkerObjectTemplate::getNumberOfPolesMin() const int SharedBattlefieldMarkerObjectTemplate::getNumberOfPolesMax() const { - - const SharedBattlefieldMarkerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -259,8 +253,6 @@ int SharedBattlefieldMarkerObjectTemplate::getNumberOfPolesMax() const float SharedBattlefieldMarkerObjectTemplate::getRadius() const { - - const SharedBattlefieldMarkerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -310,8 +302,6 @@ float SharedBattlefieldMarkerObjectTemplate::getRadius() const float SharedBattlefieldMarkerObjectTemplate::getRadiusMin() const { - - const SharedBattlefieldMarkerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -361,8 +351,6 @@ float SharedBattlefieldMarkerObjectTemplate::getRadiusMin() const float SharedBattlefieldMarkerObjectTemplate::getRadiusMax() const { - - const SharedBattlefieldMarkerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -410,7 +398,6 @@ float SharedBattlefieldMarkerObjectTemplate::getRadiusMax() const return value; } // SharedBattlefieldMarkerObjectTemplate::getRadiusMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -419,8 +406,8 @@ float SharedBattlefieldMarkerObjectTemplate::getRadiusMax() const */ void SharedBattlefieldMarkerObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedBattlefieldMarkerObjectTemplate_tag) { @@ -430,7 +417,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -450,10 +437,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,1)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 1)) { - - m_versionOk = false; } @@ -479,4 +464,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedBattlefieldMarkerObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp index b666e7d3..04da57c3 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedBuildingObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedBuildingObjectTemplate::SharedBuildingObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedBuildingObjectTemplate::SharedBuildingObjectTemplate @@ -45,8 +45,8 @@ SharedBuildingObjectTemplate::SharedBuildingObjectTemplate(const std::string & f */ SharedBuildingObjectTemplate::~SharedBuildingObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedBuildingObjectTemplate::~SharedBuildingObjectTemplate /** @@ -105,8 +105,6 @@ Tag SharedBuildingObjectTemplate::getHighestTemplateVersion(void) const //@BEGIN TFD const std::string & SharedBuildingObjectTemplate::getTerrainModificationFileName() const { - - const SharedBuildingObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -134,8 +132,6 @@ const std::string & SharedBuildingObjectTemplate::getTerrainModificationFileName const std::string & SharedBuildingObjectTemplate::getInteriorLayoutFileName() const { - - const SharedBuildingObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -161,7 +157,6 @@ const std::string & SharedBuildingObjectTemplate::getInteriorLayoutFileName() co return value; } // SharedBuildingObjectTemplate::getInteriorLayoutFileName - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -170,8 +165,8 @@ const std::string & SharedBuildingObjectTemplate::getInteriorLayoutFileName() co */ void SharedBuildingObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedBuildingObjectTemplate_tag) { @@ -181,7 +176,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -201,10 +196,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,1)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 1)) { - - m_versionOk = false; } @@ -230,4 +223,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedBuildingObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp index adee55bf..5b19458e 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedCellObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedCellObjectTemplate::SharedCellObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedCellObjectTemplate::SharedCellObjectTemplate @@ -45,8 +45,8 @@ SharedCellObjectTemplate::SharedCellObjectTemplate(const std::string & filename) */ SharedCellObjectTemplate::~SharedCellObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedCellObjectTemplate::~SharedCellObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedCellObjectTemplate::getHighestTemplateVersion(void) const */ void SharedCellObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedCellObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedCellObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp index 8f6a8531..b47a62d9 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedConstructionContractObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedConstructionContractObjectTemplate::SharedConstructionContractObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedIntangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedConstructionContractObjectTemplate::SharedConstructionContractObjectTemplate @@ -45,8 +45,8 @@ SharedConstructionContractObjectTemplate::SharedConstructionContractObjectTempla */ SharedConstructionContractObjectTemplate::~SharedConstructionContractObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedConstructionContractObjectTemplate::~SharedConstructionContractObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedConstructionContractObjectTemplate::getHighestTemplateVersion(void) co */ void SharedConstructionContractObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedConstructionContractObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedConstructionContractObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp index a6f21c63..9a451895 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp @@ -29,7 +29,7 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedCreatureObjectTemplate::ms_allowDefaultTemplateParams = true; @@ -42,8 +42,9 @@ typedef ::RangedIntCustomizationVariable GlobalRangedIntCustomizationVariableTyp SharedCreatureObjectTemplate::SharedCreatureObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { m_movementTable = 0; } // SharedCreatureObjectTemplate::SharedCreatureObjectTemplate @@ -53,8 +54,8 @@ SharedCreatureObjectTemplate::SharedCreatureObjectTemplate(const std::string & f */ SharedCreatureObjectTemplate::~SharedCreatureObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP delete m_movementTable; m_movementTable = 0; } // SharedCreatureObjectTemplate::~SharedCreatureObjectTemplate @@ -122,7 +123,7 @@ void SharedCreatureObjectTemplate::postLoad() void SharedCreatureObjectTemplate::createCustomizationDataPropertyAsNeeded(Object &object, bool /* forceCreation */) const { - //-- Properties cannot be added while an object is in the world. Some callers may be in the world, + //-- 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) @@ -147,18 +148,18 @@ void SharedCreatureObjectTemplate::createCustomizationDataPropertyAsNeeded(Objec AssetCustomizationManager::addCustomizationVariablesForAsset(TemporaryCrcString(getAppearanceFilename().c_str(), true), *customizationData, skipSharedOwnerVariables); //-- set up mappings for any variables which need dependent mappings - int numVariableMappings = getCustomizationVariableMappingCount(); + int numVariableMappings = getCustomizationVariableMappingCount(); for (int i = 0; i < numVariableMappings; ++i) { CustomizationVariableMapping localVariableMapping; - getCustomizationVariableMapping(localVariableMapping, i); + getCustomizationVariableMapping(localVariableMapping, i); GlobalRangedIntCustomizationVariableType *source = safe_cast(customizationData->findVariable(localVariableMapping.sourceVariable)); - if(source) - { - source->setDependentVariable(localVariableMapping.dependentVariable); - } - } - + if (source) + { + source->setDependentVariable(localVariableMapping.dependentVariable); + } + } + //-- release local reference to the CustomizationData instance customizationData->release(); } @@ -169,8 +170,6 @@ void SharedCreatureObjectTemplate::createCustomizationDataPropertyAsNeeded(Objec //@BEGIN TFD SharedCreatureObjectTemplate::Gender SharedCreatureObjectTemplate::getGender() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -198,8 +197,6 @@ SharedCreatureObjectTemplate::Gender SharedCreatureObjectTemplate::getGender() c SharedCreatureObjectTemplate::Niche SharedCreatureObjectTemplate::getNiche() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -227,8 +224,6 @@ SharedCreatureObjectTemplate::Niche SharedCreatureObjectTemplate::getNiche() con SharedCreatureObjectTemplate::Species SharedCreatureObjectTemplate::getSpecies() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -256,8 +251,6 @@ SharedCreatureObjectTemplate::Species SharedCreatureObjectTemplate::getSpecies() SharedCreatureObjectTemplate::Race SharedCreatureObjectTemplate::getRace() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -726,8 +719,6 @@ float SharedCreatureObjectTemplate::getTurnRateMax(MovementTypes index) const const std::string & SharedCreatureObjectTemplate::getAnimationMapFilename() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -755,8 +746,6 @@ const std::string & SharedCreatureObjectTemplate::getAnimationMapFilename() cons float SharedCreatureObjectTemplate::getSlopeModAngle() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -806,8 +795,6 @@ float SharedCreatureObjectTemplate::getSlopeModAngle() const float SharedCreatureObjectTemplate::getSlopeModAngleMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -857,8 +844,6 @@ float SharedCreatureObjectTemplate::getSlopeModAngleMin() const float SharedCreatureObjectTemplate::getSlopeModAngleMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -908,8 +893,6 @@ float SharedCreatureObjectTemplate::getSlopeModAngleMax() const float SharedCreatureObjectTemplate::getSlopeModPercent() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -959,8 +942,6 @@ float SharedCreatureObjectTemplate::getSlopeModPercent() const float SharedCreatureObjectTemplate::getSlopeModPercentMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1010,8 +991,6 @@ float SharedCreatureObjectTemplate::getSlopeModPercentMin() const float SharedCreatureObjectTemplate::getSlopeModPercentMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1061,8 +1040,6 @@ float SharedCreatureObjectTemplate::getSlopeModPercentMax() const float SharedCreatureObjectTemplate::getWaterModPercent() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1112,8 +1089,6 @@ float SharedCreatureObjectTemplate::getWaterModPercent() const float SharedCreatureObjectTemplate::getWaterModPercentMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1163,8 +1138,6 @@ float SharedCreatureObjectTemplate::getWaterModPercentMin() const float SharedCreatureObjectTemplate::getWaterModPercentMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1214,8 +1187,6 @@ float SharedCreatureObjectTemplate::getWaterModPercentMax() const float SharedCreatureObjectTemplate::getStepHeight() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1265,8 +1236,6 @@ float SharedCreatureObjectTemplate::getStepHeight() const float SharedCreatureObjectTemplate::getStepHeightMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1316,8 +1285,6 @@ float SharedCreatureObjectTemplate::getStepHeightMin() const float SharedCreatureObjectTemplate::getStepHeightMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1367,8 +1334,6 @@ float SharedCreatureObjectTemplate::getStepHeightMax() const float SharedCreatureObjectTemplate::getCollisionHeight() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1418,8 +1383,6 @@ float SharedCreatureObjectTemplate::getCollisionHeight() const float SharedCreatureObjectTemplate::getCollisionHeightMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1469,8 +1432,6 @@ float SharedCreatureObjectTemplate::getCollisionHeightMin() const float SharedCreatureObjectTemplate::getCollisionHeightMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1520,8 +1481,6 @@ float SharedCreatureObjectTemplate::getCollisionHeightMax() const float SharedCreatureObjectTemplate::getCollisionRadius() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1571,8 +1530,6 @@ float SharedCreatureObjectTemplate::getCollisionRadius() const float SharedCreatureObjectTemplate::getCollisionRadiusMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1622,8 +1579,6 @@ float SharedCreatureObjectTemplate::getCollisionRadiusMin() const float SharedCreatureObjectTemplate::getCollisionRadiusMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1673,8 +1628,6 @@ float SharedCreatureObjectTemplate::getCollisionRadiusMax() const const std::string & SharedCreatureObjectTemplate::getMovementDatatable() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1729,8 +1682,6 @@ bool SharedCreatureObjectTemplate::getPostureAlignToTerrain(Postures index) cons float SharedCreatureObjectTemplate::getSwimHeight() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1780,8 +1731,6 @@ float SharedCreatureObjectTemplate::getSwimHeight() const float SharedCreatureObjectTemplate::getSwimHeightMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1831,8 +1780,6 @@ float SharedCreatureObjectTemplate::getSwimHeightMin() const float SharedCreatureObjectTemplate::getSwimHeightMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1882,8 +1829,6 @@ float SharedCreatureObjectTemplate::getSwimHeightMax() const float SharedCreatureObjectTemplate::getWarpTolerance() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1933,8 +1878,6 @@ float SharedCreatureObjectTemplate::getWarpTolerance() const float SharedCreatureObjectTemplate::getWarpToleranceMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1984,8 +1927,6 @@ float SharedCreatureObjectTemplate::getWarpToleranceMin() const float SharedCreatureObjectTemplate::getWarpToleranceMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2035,8 +1976,6 @@ float SharedCreatureObjectTemplate::getWarpToleranceMax() const float SharedCreatureObjectTemplate::getCollisionOffsetX() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2086,8 +2025,6 @@ float SharedCreatureObjectTemplate::getCollisionOffsetX() const float SharedCreatureObjectTemplate::getCollisionOffsetXMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2137,8 +2074,6 @@ float SharedCreatureObjectTemplate::getCollisionOffsetXMin() const float SharedCreatureObjectTemplate::getCollisionOffsetXMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2188,8 +2123,6 @@ float SharedCreatureObjectTemplate::getCollisionOffsetXMax() const float SharedCreatureObjectTemplate::getCollisionOffsetZ() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2239,8 +2172,6 @@ float SharedCreatureObjectTemplate::getCollisionOffsetZ() const float SharedCreatureObjectTemplate::getCollisionOffsetZMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2290,8 +2221,6 @@ float SharedCreatureObjectTemplate::getCollisionOffsetZMin() const float SharedCreatureObjectTemplate::getCollisionOffsetZMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2341,8 +2270,6 @@ float SharedCreatureObjectTemplate::getCollisionOffsetZMax() const float SharedCreatureObjectTemplate::getCollisionLength() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2392,8 +2319,6 @@ float SharedCreatureObjectTemplate::getCollisionLength() const float SharedCreatureObjectTemplate::getCollisionLengthMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2443,8 +2368,6 @@ float SharedCreatureObjectTemplate::getCollisionLengthMin() const float SharedCreatureObjectTemplate::getCollisionLengthMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2494,8 +2417,6 @@ float SharedCreatureObjectTemplate::getCollisionLengthMax() const float SharedCreatureObjectTemplate::getCameraHeight() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2545,8 +2466,6 @@ float SharedCreatureObjectTemplate::getCameraHeight() const float SharedCreatureObjectTemplate::getCameraHeightMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2596,8 +2515,6 @@ float SharedCreatureObjectTemplate::getCameraHeightMin() const float SharedCreatureObjectTemplate::getCameraHeightMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2645,7 +2562,6 @@ float SharedCreatureObjectTemplate::getCameraHeightMax() const return value; } // SharedCreatureObjectTemplate::getCameraHeightMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -2654,8 +2570,8 @@ float SharedCreatureObjectTemplate::getCameraHeightMax() const */ void SharedCreatureObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedCreatureObjectTemplate_tag) { @@ -2665,7 +2581,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -2685,10 +2601,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,1,3)) + if (getHighestTemplateVersion() != TAG(0, 0, 1, 3)) { - - m_versionOk = false; } @@ -2802,5 +2716,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedCreatureObjectTemplate::load -//@END TFD - +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp index 658899be..d20a240a 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp @@ -23,24 +23,24 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedDraftSchematicObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedDraftSchematicObjectTemplate::SharedDraftSchematicObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedIntangibleObjectTemplate(filename) - ,m_slotsLoaded(false) - ,m_slotsAppend(false) - ,m_attributesLoaded(false) - ,m_attributesAppend(false) - ,m_versionOk(true) -//@END TFD INIT + , m_slotsLoaded(false) + , m_slotsAppend(false) + , m_attributesLoaded(false) + , m_attributesAppend(false) + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedDraftSchematicObjectTemplate::SharedDraftSchematicObjectTemplate @@ -49,7 +49,7 @@ SharedDraftSchematicObjectTemplate::SharedDraftSchematicObjectTemplate(const std */ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) @@ -68,7 +68,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() } m_attributes.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate /** @@ -138,7 +138,7 @@ void SharedDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int inde if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); - return ; + return; } else { @@ -152,10 +152,10 @@ void SharedDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int inde { int baseCount = base->getSlotsCount(); if (index < baseCount) - { - base->getSlots(data, index); - return; - } + { + base->getSlots(data, index); + return; + } index -= baseCount; } @@ -181,7 +181,7 @@ void SharedDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int i if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); - return ; + return; } else { @@ -195,10 +195,10 @@ void SharedDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int i { int baseCount = base->getSlotsCount(); if (index < baseCount) - { - base->getSlotsMin(data, index); - return; - } + { + base->getSlotsMin(data, index); + return; + } index -= baseCount; } @@ -224,7 +224,7 @@ void SharedDraftSchematicObjectTemplate::getSlotsMax(IngredientSlot &data, int i if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); - return ; + return; } else { @@ -238,10 +238,10 @@ void SharedDraftSchematicObjectTemplate::getSlotsMax(IngredientSlot &data, int i { int baseCount = base->getSlotsCount(); if (index < baseCount) - { - base->getSlotsMax(data, index); - return; - } + { + base->getSlotsMax(data, index); + return; + } index -= baseCount; } @@ -291,7 +291,7 @@ void SharedDraftSchematicObjectTemplate::getAttributes(SchematicAttribute &data, if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); - return ; + return; } else { @@ -305,10 +305,10 @@ void SharedDraftSchematicObjectTemplate::getAttributes(SchematicAttribute &data, { int baseCount = base->getAttributesCount(); if (index < baseCount) - { - base->getAttributes(data, index); - return; - } + { + base->getAttributes(data, index); + return; + } index -= baseCount; } @@ -335,7 +335,7 @@ void SharedDraftSchematicObjectTemplate::getAttributesMin(SchematicAttribute &da if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); - return ; + return; } else { @@ -349,10 +349,10 @@ void SharedDraftSchematicObjectTemplate::getAttributesMin(SchematicAttribute &da { int baseCount = base->getAttributesCount(); if (index < baseCount) - { - base->getAttributesMin(data, index); - return; - } + { + base->getAttributesMin(data, index); + return; + } index -= baseCount; } @@ -379,7 +379,7 @@ void SharedDraftSchematicObjectTemplate::getAttributesMax(SchematicAttribute &da if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); - return ; + return; } else { @@ -393,10 +393,10 @@ void SharedDraftSchematicObjectTemplate::getAttributesMax(SchematicAttribute &da { int baseCount = base->getAttributesCount(); if (index < baseCount) - { - base->getAttributesMax(data, index); - return; - } + { + base->getAttributesMax(data, index); + return; + } index -= baseCount; } @@ -436,8 +436,6 @@ size_t SharedDraftSchematicObjectTemplate::getAttributesCount(void) const const std::string & SharedDraftSchematicObjectTemplate::getCraftedSharedTemplate() const { - - const SharedDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -463,7 +461,6 @@ const std::string & SharedDraftSchematicObjectTemplate::getCraftedSharedTemplate return value; } // SharedDraftSchematicObjectTemplate::getCraftedSharedTemplate - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -472,8 +469,8 @@ const std::string & SharedDraftSchematicObjectTemplate::getCraftedSharedTemplate */ void SharedDraftSchematicObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedDraftSchematicObjectTemplate_tag) { @@ -483,7 +480,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -503,10 +500,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,3)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 3)) { - - m_versionOk = false; } @@ -568,7 +563,6 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedDraftSchematicObjectTemplate::load - //============================================================================= // class SharedDraftSchematicObjectTemplate::_IngredientSlot @@ -617,8 +611,6 @@ Tag SharedDraftSchematicObjectTemplate::_IngredientSlot::getId(void) const const StringId SharedDraftSchematicObjectTemplate::_IngredientSlot::getName(bool versionOk) const { - - const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { @@ -646,8 +638,6 @@ const StringId SharedDraftSchematicObjectTemplate::_IngredientSlot::getName(bool const std::string & SharedDraftSchematicObjectTemplate::_IngredientSlot::getHardpoint(bool versionOk) const { - - const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { @@ -673,7 +663,6 @@ const std::string & SharedDraftSchematicObjectTemplate::_IngredientSlot::getHard return value; } // SharedDraftSchematicObjectTemplate::_IngredientSlot::getHardpoint - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -682,8 +671,8 @@ const std::string & SharedDraftSchematicObjectTemplate::_IngredientSlot::getHard */ void SharedDraftSchematicObjectTemplate::_IngredientSlot::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -705,7 +694,6 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // SharedDraftSchematicObjectTemplate::_IngredientSlot::load - //============================================================================= // class SharedDraftSchematicObjectTemplate::_SchematicAttribute @@ -754,8 +742,6 @@ Tag SharedDraftSchematicObjectTemplate::_SchematicAttribute::getId(void) const const StringId SharedDraftSchematicObjectTemplate::_SchematicAttribute::getName(bool versionOk) const { - - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { @@ -783,8 +769,6 @@ const StringId SharedDraftSchematicObjectTemplate::_SchematicAttribute::getName( const StringId SharedDraftSchematicObjectTemplate::_SchematicAttribute::getExperiment(bool versionOk) const { - - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { @@ -812,8 +796,6 @@ const StringId SharedDraftSchematicObjectTemplate::_SchematicAttribute::getExper int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValue(bool versionOk) const { - - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { @@ -863,8 +845,6 @@ int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValue(bool versi int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMin(bool versionOk) const { - - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { @@ -914,8 +894,6 @@ int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMin(bool ve int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMax(bool versionOk) const { - - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { @@ -963,7 +941,6 @@ int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMax(bool ve return value; } // SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -972,8 +949,8 @@ int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMax(bool ve */ void SharedDraftSchematicObjectTemplate::_SchematicAttribute::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1001,17 +978,17 @@ char paramName[MAX_NAME_SIZE]; //---------------------------------------------------------------------- -const StringId SharedDraftSchematicObjectTemplate::getCraftedName () const +const StringId SharedDraftSchematicObjectTemplate::getCraftedName() const { - StringId sid = getObjectName (); + StringId sid = getObjectName(); - if (sid.isInvalid ()) + if (sid.isInvalid()) { - const SharedObjectTemplate * const sot = fetchCraftedSharedObjectTemplate (); + const SharedObjectTemplate * const sot = fetchCraftedSharedObjectTemplate(); if (sot) { - sid = sot->getObjectName (); - sot->releaseReference (); + sid = sot->getObjectName(); + sot->releaseReference(); } } @@ -1020,17 +997,17 @@ const StringId SharedDraftSchematicObjectTemplate::getCraftedName //---------------------------------------------------------------------- -const StringId SharedDraftSchematicObjectTemplate::getCraftedDetailedDescription () const +const StringId SharedDraftSchematicObjectTemplate::getCraftedDetailedDescription() const { - StringId sid = getDetailedDescription (); + StringId sid = getDetailedDescription(); - if (sid.isInvalid ()) + if (sid.isInvalid()) { - const SharedObjectTemplate * const sot = fetchCraftedSharedObjectTemplate (); + const SharedObjectTemplate * const sot = fetchCraftedSharedObjectTemplate(); if (sot) { - sid = sot->getDetailedDescription (); - sot->releaseReference (); + sid = sot->getDetailedDescription(); + sot->releaseReference(); } } @@ -1039,17 +1016,17 @@ const StringId SharedDraftSchematicObjectTemplate::getCraftedDetailedDescription //---------------------------------------------------------------------- -const StringId SharedDraftSchematicObjectTemplate::getCraftedLookAtText () const +const StringId SharedDraftSchematicObjectTemplate::getCraftedLookAtText() const { - StringId sid = getLookAtText (); + StringId sid = getLookAtText(); - if (sid.isInvalid ()) + if (sid.isInvalid()) { - const SharedObjectTemplate * const sot = fetchCraftedSharedObjectTemplate (); + const SharedObjectTemplate * const sot = fetchCraftedSharedObjectTemplate(); if (sot) { - sid = sot->getLookAtText (); - sot->releaseReference (); + sid = sot->getLookAtText(); + sot->releaseReference(); } } @@ -1058,17 +1035,17 @@ const StringId SharedDraftSchematicObjectTemplate::getCraftedLookAtText //---------------------------------------------------------------------- -const std::string SharedDraftSchematicObjectTemplate::getCraftedAppearanceFilename () const +const std::string SharedDraftSchematicObjectTemplate::getCraftedAppearanceFilename() const { - const std::string & app = getAppearanceFilename (); + const std::string & app = getAppearanceFilename(); - if (app.empty ()) + if (app.empty()) { - const SharedObjectTemplate * const sot = fetchCraftedSharedObjectTemplate (); + const SharedObjectTemplate * const sot = fetchCraftedSharedObjectTemplate(); if (sot) { - const std::string capp = sot->getAppearanceFilename (); - sot->releaseReference (); + const std::string capp = sot->getAppearanceFilename(); + sot->releaseReference(); return capp; } } @@ -1078,19 +1055,18 @@ const std::string SharedDraftSchematicObjectTemplate::getCraftedAppearanceFilena //---------------------------------------------------------------------- -const SharedObjectTemplate * SharedDraftSchematicObjectTemplate::fetchCraftedSharedObjectTemplate () const +const SharedObjectTemplate * SharedDraftSchematicObjectTemplate::fetchCraftedSharedObjectTemplate() const { - const std::string & sotName = getCraftedSharedTemplate (); - const SharedObjectTemplate * const sot = safe_cast(ObjectTemplateList::fetch (sotName.c_str ())); + const std::string & sotName = getCraftedSharedTemplate(); + const SharedObjectTemplate * const sot = safe_cast(ObjectTemplateList::fetch(sotName.c_str())); if (!sot) { - const char * const draftName = this->DataResource::getName (); - WARNING (true, ("SharedDraftSchematicObjectTemplate [%s] could not load craftedSharedTemplate [%s]", draftName ? draftName : "", sotName.c_str ())); + const char * const draftName = this->DataResource::getName(); + WARNING(true, ("SharedDraftSchematicObjectTemplate [%s] could not load craftedSharedTemplate [%s]", draftName ? draftName : "", sotName.c_str())); } return sot; } -//---------------------------------------------------------------------- - +//---------------------------------------------------------------------- \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp index 75390ff3..e7d9e1f7 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedFactoryObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedFactoryObjectTemplate::SharedFactoryObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedFactoryObjectTemplate::SharedFactoryObjectTemplate @@ -45,8 +45,8 @@ SharedFactoryObjectTemplate::SharedFactoryObjectTemplate(const std::string & fil */ SharedFactoryObjectTemplate::~SharedFactoryObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedFactoryObjectTemplate::~SharedFactoryObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedFactoryObjectTemplate::getHighestTemplateVersion(void) const */ void SharedFactoryObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedFactoryObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedFactoryObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp index 3605fec1..87dc2c57 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedGroupObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedGroupObjectTemplate::SharedGroupObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedUniverseObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedGroupObjectTemplate::SharedGroupObjectTemplate @@ -45,8 +45,8 @@ SharedGroupObjectTemplate::SharedGroupObjectTemplate(const std::string & filenam */ SharedGroupObjectTemplate::~SharedGroupObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedGroupObjectTemplate::~SharedGroupObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedGroupObjectTemplate::getHighestTemplateVersion(void) const */ void SharedGroupObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedGroupObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedGroupObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp index 6a07324b..03650c6b 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedGuildObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedGuildObjectTemplate::SharedGuildObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedUniverseObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedGuildObjectTemplate::SharedGuildObjectTemplate @@ -45,8 +45,8 @@ SharedGuildObjectTemplate::SharedGuildObjectTemplate(const std::string & filenam */ SharedGuildObjectTemplate::~SharedGuildObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedGuildObjectTemplate::~SharedGuildObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedGuildObjectTemplate::getHighestTemplateVersion(void) const */ void SharedGuildObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedGuildObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedGuildObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp index 64db45c4..4e0e5c1b 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedInstallationObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedInstallationObjectTemplate::SharedInstallationObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedInstallationObjectTemplate::SharedInstallationObjectTemplate @@ -45,8 +45,8 @@ SharedInstallationObjectTemplate::SharedInstallationObjectTemplate(const std::st */ SharedInstallationObjectTemplate::~SharedInstallationObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedInstallationObjectTemplate::~SharedInstallationObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedInstallationObjectTemplate::getHighestTemplateVersion(void) const */ void SharedInstallationObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedInstallationObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedInstallationObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp index ef0e1df9..ba2ef96f 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedIntangibleObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedIntangibleObjectTemplate::SharedIntangibleObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedIntangibleObjectTemplate::SharedIntangibleObjectTemplate @@ -45,8 +45,8 @@ SharedIntangibleObjectTemplate::SharedIntangibleObjectTemplate(const std::string */ SharedIntangibleObjectTemplate::~SharedIntangibleObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedIntangibleObjectTemplate::~SharedIntangibleObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedIntangibleObjectTemplate::getHighestTemplateVersion(void) const */ void SharedIntangibleObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedIntangibleObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedIntangibleObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp index 9ee18be7..3d1387bc 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp @@ -24,20 +24,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedJediManagerObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedJediManagerObjectTemplate::SharedJediManagerObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedUniverseObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedJediManagerObjectTemplate::SharedJediManagerObjectTemplate @@ -46,8 +46,8 @@ SharedJediManagerObjectTemplate::SharedJediManagerObjectTemplate(const std::stri */ SharedJediManagerObjectTemplate::~SharedJediManagerObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedJediManagerObjectTemplate::~SharedJediManagerObjectTemplate /** @@ -113,8 +113,8 @@ Tag SharedJediManagerObjectTemplate::getHighestTemplateVersion(void) const */ void SharedJediManagerObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedJediManagerObjectTemplate_tag) { @@ -124,7 +124,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -144,10 +144,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -165,4 +163,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedJediManagerObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp index 40779694..2f637eae 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedManufactureSchematicObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedManufactureSchematicObjectTemplate::SharedManufactureSchematicObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedIntangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedManufactureSchematicObjectTemplate::SharedManufactureSchematicObjectTemplate @@ -45,8 +45,8 @@ SharedManufactureSchematicObjectTemplate::SharedManufactureSchematicObjectTempla */ SharedManufactureSchematicObjectTemplate::~SharedManufactureSchematicObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedManufactureSchematicObjectTemplate::~SharedManufactureSchematicObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) co */ void SharedManufactureSchematicObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedManufactureSchematicObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedManufactureSchematicObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp index 67ef6517..29fbcc08 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedMissionObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedMissionObjectTemplate::SharedMissionObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedIntangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedMissionObjectTemplate::SharedMissionObjectTemplate @@ -45,8 +45,8 @@ SharedMissionObjectTemplate::SharedMissionObjectTemplate(const std::string & fil */ SharedMissionObjectTemplate::~SharedMissionObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedMissionObjectTemplate::~SharedMissionObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedMissionObjectTemplate::getHighestTemplateVersion(void) const */ void SharedMissionObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedMissionObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedMissionObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp index f23cc1e5..4fa1374b 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp @@ -33,7 +33,7 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedObjectTemplate::ms_allowDefaultTemplateParams = true; @@ -46,13 +46,13 @@ class SharedObjectTemplate::PreloadManager { public: - explicit PreloadManager (const SharedObjectTemplate* sharedObjectTemplate); - ~PreloadManager (); + explicit PreloadManager(const SharedObjectTemplate* sharedObjectTemplate); + ~PreloadManager(); private: - - PreloadManager (); - PreloadManager (const PreloadManager&); + + PreloadManager(); + PreloadManager(const PreloadManager&); PreloadManager& operator= (const PreloadManager&); private: @@ -63,40 +63,40 @@ private: // ---------------------------------------------------------------------- -SharedObjectTemplate::PreloadManager::PreloadManager (const SharedObjectTemplate* const sharedObjectTemplate) : -m_preloadAppearanceTemplate (0), -m_preloadPortalPropertyTemplate (0) +SharedObjectTemplate::PreloadManager::PreloadManager(const SharedObjectTemplate* const sharedObjectTemplate) : + m_preloadAppearanceTemplate(0), + m_preloadPortalPropertyTemplate(0) { NOT_NULL(sharedObjectTemplate); - const std::string& appearanceFileName = sharedObjectTemplate->getAppearanceFilename (); - if (!appearanceFileName.empty ()) + const std::string& appearanceFileName = sharedObjectTemplate->getAppearanceFilename(); + if (!appearanceFileName.empty()) { bool found = false; - m_preloadAppearanceTemplate = AppearanceTemplateList::fetch (appearanceFileName.c_str (), found); + m_preloadAppearanceTemplate = AppearanceTemplateList::fetch(appearanceFileName.c_str(), found); WARNING(!found, ("SharedObjectTemplate [%s] unable to load appearance [%s]", sharedObjectTemplate->getName(), appearanceFileName.c_str())); - m_preloadAppearanceTemplate->preloadAssets (); + m_preloadAppearanceTemplate->preloadAssets(); } - const std::string& portalLayoutFilename = sharedObjectTemplate->getPortalLayoutFilename (); - if (!portalLayoutFilename.empty ()) + const std::string& portalLayoutFilename = sharedObjectTemplate->getPortalLayoutFilename(); + if (!portalLayoutFilename.empty()) { - m_preloadPortalPropertyTemplate = PortalPropertyTemplateList::fetch (TemporaryCrcString (portalLayoutFilename.c_str (), true)); - m_preloadPortalPropertyTemplate->preloadAssets (); + m_preloadPortalPropertyTemplate = PortalPropertyTemplateList::fetch(TemporaryCrcString(portalLayoutFilename.c_str(), true)); + m_preloadPortalPropertyTemplate->preloadAssets(); } if (sharedObjectTemplate->m_clientData) - sharedObjectTemplate->m_clientData->preloadAssets (); + sharedObjectTemplate->m_clientData->preloadAssets(); } // ---------------------------------------------------------------------- -SharedObjectTemplate::PreloadManager::~PreloadManager () +SharedObjectTemplate::PreloadManager::~PreloadManager() { if (m_preloadAppearanceTemplate) - AppearanceTemplateList::release (m_preloadAppearanceTemplate); + AppearanceTemplateList::release(m_preloadAppearanceTemplate); if (m_preloadPortalPropertyTemplate) - m_preloadPortalPropertyTemplate->release (); + m_preloadPortalPropertyTemplate->release(); } // ====================================================================== @@ -107,12 +107,13 @@ SharedObjectTemplate::PreloadManager::~PreloadManager () SharedObjectTemplate::SharedObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT , m_slotDescriptor(nullptr) , m_arrangementDescriptor(nullptr) - , m_clientData (0) - , m_preloadManager (0) + , m_clientData(0) + , m_preloadManager(0) { } // SharedObjectTemplate::SharedObjectTemplate @@ -121,10 +122,10 @@ SharedObjectTemplate::SharedObjectTemplate(const std::string & filename) */ SharedObjectTemplate::~SharedObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP - //-- Release ArrangementDescriptor resource. + //-- Release ArrangementDescriptor resource. if (m_arrangementDescriptor) { m_arrangementDescriptor->release(); @@ -140,7 +141,7 @@ SharedObjectTemplate::~SharedObjectTemplate() //-- delete client data if (m_clientData) - m_clientData->releaseReference (); + m_clientData->releaseReference(); //-- delete preloadmanager if (m_preloadManager) @@ -184,18 +185,17 @@ ObjectTemplate * SharedObjectTemplate::create(const std::string & filename) return new SharedObjectTemplate(filename); } // SharedObjectTemplate::create - -void SharedObjectTemplate::preloadAssets () const +void SharedObjectTemplate::preloadAssets() const { - ObjectTemplate::preloadAssets (); + ObjectTemplate::preloadAssets(); if (!m_preloadManager) - m_preloadManager = new PreloadManager (this); + m_preloadManager = new PreloadManager(this); } -void SharedObjectTemplate::garbageCollect () const +void SharedObjectTemplate::garbageCollect() const { - ObjectTemplate::garbageCollect (); + ObjectTemplate::garbageCollect(); if (m_preloadManager) { @@ -204,7 +204,6 @@ void SharedObjectTemplate::garbageCollect () const } } - /** * Returns the template id. * @@ -258,18 +257,16 @@ void SharedObjectTemplate::postLoad(void) //-- load the client data file if (ms_createClientDataFunction) { - const std::string& clientDataFile = getClientDataFile (); + const std::string& clientDataFile = getClientDataFile(); - if (!clientDataFile.empty ()) - m_clientData = ms_createClientDataFunction (clientDataFile.c_str ()); + if (!clientDataFile.empty()) + m_clientData = ms_createClientDataFunction(clientDataFile.c_str()); } } // SharedObjectTemplate::postLoad //@BEGIN TFD const StringId SharedObjectTemplate::getObjectName() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -297,8 +294,6 @@ const StringId SharedObjectTemplate::getObjectName() const const StringId SharedObjectTemplate::getDetailedDescription() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -326,8 +321,6 @@ const StringId SharedObjectTemplate::getDetailedDescription() const const StringId SharedObjectTemplate::getLookAtText() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -355,8 +348,6 @@ const StringId SharedObjectTemplate::getLookAtText() const bool SharedObjectTemplate::getSnapToTerrain() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -384,8 +375,6 @@ bool SharedObjectTemplate::getSnapToTerrain() const SharedObjectTemplate::ContainerType SharedObjectTemplate::getContainerType() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -413,8 +402,6 @@ SharedObjectTemplate::ContainerType SharedObjectTemplate::getContainerType() con int SharedObjectTemplate::getContainerVolumeLimit() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -464,8 +451,6 @@ int SharedObjectTemplate::getContainerVolumeLimit() const int SharedObjectTemplate::getContainerVolumeLimitMin() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -515,8 +500,6 @@ int SharedObjectTemplate::getContainerVolumeLimitMin() const int SharedObjectTemplate::getContainerVolumeLimitMax() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -566,8 +549,6 @@ int SharedObjectTemplate::getContainerVolumeLimitMax() const const std::string & SharedObjectTemplate::getTintPalette() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -595,8 +576,6 @@ const std::string & SharedObjectTemplate::getTintPalette() const const std::string & SharedObjectTemplate::getSlotDescriptorFilename() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -624,8 +603,6 @@ const std::string & SharedObjectTemplate::getSlotDescriptorFilename() const const std::string & SharedObjectTemplate::getArrangementDescriptorFilename() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -653,8 +630,6 @@ const std::string & SharedObjectTemplate::getArrangementDescriptorFilename() con const std::string & SharedObjectTemplate::getAppearanceFilename() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -682,8 +657,6 @@ const std::string & SharedObjectTemplate::getAppearanceFilename() const const std::string & SharedObjectTemplate::getPortalLayoutFilename() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -711,8 +684,6 @@ const std::string & SharedObjectTemplate::getPortalLayoutFilename() const const std::string & SharedObjectTemplate::getClientDataFile() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -740,8 +711,6 @@ const std::string & SharedObjectTemplate::getClientDataFile() const float SharedObjectTemplate::getScale() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -791,8 +760,6 @@ float SharedObjectTemplate::getScale() const float SharedObjectTemplate::getScaleMin() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -842,8 +809,6 @@ float SharedObjectTemplate::getScaleMin() const float SharedObjectTemplate::getScaleMax() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -893,8 +858,6 @@ float SharedObjectTemplate::getScaleMax() const SharedObjectTemplate::GameObjectType SharedObjectTemplate::getGameObjectType() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -922,8 +885,6 @@ SharedObjectTemplate::GameObjectType SharedObjectTemplate::getGameObjectType() c bool SharedObjectTemplate::getSendToClient() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -951,8 +912,6 @@ bool SharedObjectTemplate::getSendToClient() const float SharedObjectTemplate::getScaleThresholdBeforeExtentTest() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1002,8 +961,6 @@ float SharedObjectTemplate::getScaleThresholdBeforeExtentTest() const float SharedObjectTemplate::getScaleThresholdBeforeExtentTestMin() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1053,8 +1010,6 @@ float SharedObjectTemplate::getScaleThresholdBeforeExtentTestMin() const float SharedObjectTemplate::getScaleThresholdBeforeExtentTestMax() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1104,8 +1059,6 @@ float SharedObjectTemplate::getScaleThresholdBeforeExtentTestMax() const float SharedObjectTemplate::getClearFloraRadius() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1155,8 +1108,6 @@ float SharedObjectTemplate::getClearFloraRadius() const float SharedObjectTemplate::getClearFloraRadiusMin() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1206,8 +1157,6 @@ float SharedObjectTemplate::getClearFloraRadiusMin() const float SharedObjectTemplate::getClearFloraRadiusMax() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1257,8 +1206,6 @@ float SharedObjectTemplate::getClearFloraRadiusMax() const SharedObjectTemplate::SurfaceType SharedObjectTemplate::getSurfaceType() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1286,8 +1233,6 @@ SharedObjectTemplate::SurfaceType SharedObjectTemplate::getSurfaceType() const float SharedObjectTemplate::getNoBuildRadius() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1337,8 +1282,6 @@ float SharedObjectTemplate::getNoBuildRadius() const float SharedObjectTemplate::getNoBuildRadiusMin() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1388,8 +1331,6 @@ float SharedObjectTemplate::getNoBuildRadiusMin() const float SharedObjectTemplate::getNoBuildRadiusMax() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1439,8 +1380,6 @@ float SharedObjectTemplate::getNoBuildRadiusMax() const bool SharedObjectTemplate::getOnlyVisibleInTools() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1468,8 +1407,6 @@ bool SharedObjectTemplate::getOnlyVisibleInTools() const float SharedObjectTemplate::getLocationReservationRadius() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1519,8 +1456,6 @@ float SharedObjectTemplate::getLocationReservationRadius() const float SharedObjectTemplate::getLocationReservationRadiusMin() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1570,8 +1505,6 @@ float SharedObjectTemplate::getLocationReservationRadiusMin() const float SharedObjectTemplate::getLocationReservationRadiusMax() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1621,8 +1554,6 @@ float SharedObjectTemplate::getLocationReservationRadiusMax() const bool SharedObjectTemplate::getForceNoCollision() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1648,7 +1579,6 @@ bool SharedObjectTemplate::getForceNoCollision() const return value; } // SharedObjectTemplate::getForceNoCollision - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1657,8 +1587,8 @@ bool SharedObjectTemplate::getForceNoCollision() const */ void SharedObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedObjectTemplate_tag) { @@ -1667,7 +1597,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -1687,10 +1617,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,1,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 1, 0)) { - - m_versionOk = false; } @@ -1760,7 +1688,7 @@ char paramName[MAX_NAME_SIZE]; // PUBLIC STATIC SharedObjectTemplate //=================================================================== -void SharedObjectTemplate::setCreateClientDataFunction (SharedObjectTemplate::CreateClientDataFunction createClientDataFunction) +void SharedObjectTemplate::setCreateClientDataFunction(SharedObjectTemplate::CreateClientDataFunction createClientDataFunction) { ms_createClientDataFunction = createClientDataFunction; } @@ -1769,7 +1697,7 @@ void SharedObjectTemplate::setCreateClientDataFunction (SharedObjectTemplate::Cr // PUBLIC SharedObjectTemplate //=================================================================== -const SharedObjectTemplateClientData* SharedObjectTemplate::getClientData () const +const SharedObjectTemplateClientData* SharedObjectTemplate::getClientData() const { return m_clientData; } @@ -1780,4 +1708,4 @@ const SharedObjectTemplateClientData* SharedObjectTemplate::getClientData () con SharedObjectTemplate::CreateClientDataFunction SharedObjectTemplate::ms_createClientDataFunction; -//=================================================================== +//=================================================================== \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp index 4a744f52..0d49d170 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp @@ -24,20 +24,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedPlayerObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedPlayerObjectTemplate::SharedPlayerObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedIntangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedPlayerObjectTemplate::SharedPlayerObjectTemplate @@ -46,8 +46,8 @@ SharedPlayerObjectTemplate::SharedPlayerObjectTemplate(const std::string & filen */ SharedPlayerObjectTemplate::~SharedPlayerObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedPlayerObjectTemplate::~SharedPlayerObjectTemplate /** @@ -113,8 +113,8 @@ Tag SharedPlayerObjectTemplate::getHighestTemplateVersion(void) const */ void SharedPlayerObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedPlayerObjectTemplate_tag) { @@ -124,7 +124,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -144,10 +144,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -165,4 +163,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedPlayerObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp index a68fab70..9f7b24d9 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp @@ -24,20 +24,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedPlayerQuestObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedPlayerQuestObjectTemplate::SharedPlayerQuestObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedPlayerQuestObjectTemplate::SharedPlayerQuestObjectTemplate @@ -46,8 +46,8 @@ SharedPlayerQuestObjectTemplate::SharedPlayerQuestObjectTemplate(const std::stri */ SharedPlayerQuestObjectTemplate::~SharedPlayerQuestObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedPlayerQuestObjectTemplate::~SharedPlayerQuestObjectTemplate /** @@ -113,8 +113,8 @@ Tag SharedPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const */ void SharedPlayerQuestObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedPlayerQuestObjectTemplate_tag) { @@ -124,7 +124,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -144,10 +144,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -165,4 +163,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedPlayerQuestObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp index 224c3c26..70dde24a 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedResourceContainerObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedResourceContainerObjectTemplate::SharedResourceContainerObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedResourceContainerObjectTemplate::SharedResourceContainerObjectTemplate @@ -45,8 +45,8 @@ SharedResourceContainerObjectTemplate::SharedResourceContainerObjectTemplate(con */ SharedResourceContainerObjectTemplate::~SharedResourceContainerObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedResourceContainerObjectTemplate::~SharedResourceContainerObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedResourceContainerObjectTemplate::getHighestTemplateVersion(void) const */ void SharedResourceContainerObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedResourceContainerObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedResourceContainerObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp index c4ef1930..7a22a942 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp @@ -13,7 +13,6 @@ #include "sharedGame/FirstSharedGame.h" #include "sharedGame/SharedShipObjectTemplate.h" - #include "sharedFile/Iff.h" #include "sharedGame/AssetCustomizationManager.h" #include "sharedMath/Vector.h" @@ -30,20 +29,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedShipObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedShipObjectTemplate::SharedShipObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedShipObjectTemplate::SharedShipObjectTemplate @@ -52,8 +51,8 @@ SharedShipObjectTemplate::SharedShipObjectTemplate(const std::string & filename) */ SharedShipObjectTemplate::~SharedShipObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedShipObjectTemplate::~SharedShipObjectTemplate /** @@ -129,16 +128,16 @@ void SharedShipObjectTemplate::createCustomizationDataPropertyAsNeeded(Object &o // variables since we are a creature. The SharedTangibleObjectTemplate version of // this function sets it to true. bool const skipSharedOwnerVariables = false; - const std::string & appearanceFilename = getAppearanceFilename(); - if(!appearanceFilename.empty()) - { + const std::string & appearanceFilename = getAppearanceFilename(); + if (!appearanceFilename.empty()) + { AssetCustomizationManager::addCustomizationVariablesForAsset(TemporaryCrcString(appearanceFilename.c_str(), true), *customizationData, skipSharedOwnerVariables); } else { //Perhaps it's a POB ship, check the portalLayoutFilename const std::string & portalLayoutFilename = getPortalLayoutFilename(); - AssetCustomizationManager::addCustomizationVariablesForAsset(TemporaryCrcString(portalLayoutFilename.c_str(), true), *customizationData, skipSharedOwnerVariables); + AssetCustomizationManager::addCustomizationVariablesForAsset(TemporaryCrcString(portalLayoutFilename.c_str(), true), *customizationData, skipSharedOwnerVariables); } //-- release local reference to the CustomizationData instance @@ -149,8 +148,6 @@ void SharedShipObjectTemplate::createCustomizationDataPropertyAsNeeded(Object &o //@BEGIN TFD const std::string & SharedShipObjectTemplate::getCockpitFilename() const { - - const SharedShipObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -178,8 +175,6 @@ const std::string & SharedShipObjectTemplate::getCockpitFilename() const bool SharedShipObjectTemplate::getHasWings() const { - - const SharedShipObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -207,8 +202,6 @@ bool SharedShipObjectTemplate::getHasWings() const bool SharedShipObjectTemplate::getPlayerControlled() const { - - const SharedShipObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -236,8 +229,6 @@ bool SharedShipObjectTemplate::getPlayerControlled() const const std::string & SharedShipObjectTemplate::getInteriorLayoutFileName() const { - - const SharedShipObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -263,7 +254,6 @@ const std::string & SharedShipObjectTemplate::getInteriorLayoutFileName() const return value; } // SharedShipObjectTemplate::getInteriorLayoutFileName - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -272,8 +262,8 @@ const std::string & SharedShipObjectTemplate::getInteriorLayoutFileName() const */ void SharedShipObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedShipObjectTemplate_tag) { @@ -283,7 +273,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -303,10 +293,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,4)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 4)) { - - m_versionOk = false; } @@ -336,4 +324,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedShipObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp index d1b4ebea..b00c7729 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedStaticObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedStaticObjectTemplate::SharedStaticObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedStaticObjectTemplate::SharedStaticObjectTemplate @@ -45,8 +45,8 @@ SharedStaticObjectTemplate::SharedStaticObjectTemplate(const std::string & filen */ SharedStaticObjectTemplate::~SharedStaticObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedStaticObjectTemplate::~SharedStaticObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedStaticObjectTemplate::getHighestTemplateVersion(void) const */ void SharedStaticObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedStaticObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedStaticObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp index 2056fc23..e0cae7f5 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp @@ -32,33 +32,33 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedTangibleObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedTangibleObjectTemplate::SharedTangibleObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedObjectTemplate(filename) - ,m_paletteColorCustomizationVariablesLoaded(false) - ,m_paletteColorCustomizationVariablesAppend(false) - ,m_rangedIntCustomizationVariablesLoaded(false) - ,m_rangedIntCustomizationVariablesAppend(false) - ,m_constStringCustomizationVariablesLoaded(false) - ,m_constStringCustomizationVariablesAppend(false) - ,m_socketDestinationsLoaded(false) - ,m_socketDestinationsAppend(false) - ,m_certificationsRequiredLoaded(false) - ,m_certificationsRequiredAppend(false) - ,m_customizationVariableMappingLoaded(false) - ,m_customizationVariableMappingAppend(false) - ,m_versionOk(true) -//@END TFD INIT - ,m_structureFootprint (0) + , m_paletteColorCustomizationVariablesLoaded(false) + , m_paletteColorCustomizationVariablesAppend(false) + , m_rangedIntCustomizationVariablesLoaded(false) + , m_rangedIntCustomizationVariablesAppend(false) + , m_constStringCustomizationVariablesLoaded(false) + , m_constStringCustomizationVariablesAppend(false) + , m_socketDestinationsLoaded(false) + , m_socketDestinationsAppend(false) + , m_certificationsRequiredLoaded(false) + , m_certificationsRequiredAppend(false) + , m_customizationVariableMappingLoaded(false) + , m_customizationVariableMappingAppend(false) + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT + , m_structureFootprint(0) { } // SharedTangibleObjectTemplate::SharedTangibleObjectTemplate @@ -67,7 +67,7 @@ SharedTangibleObjectTemplate::SharedTangibleObjectTemplate(const std::string & f */ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) @@ -122,8 +122,8 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() } m_customizationVariableMapping.clear(); } -//@END TFD CLEANUP - + //@END TFD CLEANUP + if (m_structureFootprint) { delete m_structureFootprint; @@ -189,13 +189,13 @@ Tag SharedTangibleObjectTemplate::getHighestTemplateVersion(void) const */ void SharedTangibleObjectTemplate::postLoad() { - SharedObjectTemplate::postLoad (); + SharedObjectTemplate::postLoad(); //-- load the structure footprint - if (getStructureFootprintFileName ().length () != 0) + if (getStructureFootprintFileName().length() != 0) { - m_structureFootprint = new StructureFootprint (); - m_structureFootprint->load (getStructureFootprintFileName ().c_str ()); + m_structureFootprint = new StructureFootprint(); + m_structureFootprint->load(getStructureFootprintFileName().c_str()); } } @@ -204,7 +204,7 @@ void SharedTangibleObjectTemplate::postLoad() * * @return the structure footprint */ -const StructureFootprint* SharedTangibleObjectTemplate::getStructureFootprint () const +const StructureFootprint* SharedTangibleObjectTemplate::getStructureFootprint() const { return m_structureFootprint; } @@ -236,7 +236,7 @@ const StructureFootprint* SharedTangibleObjectTemplate::getStructureFootprint () */ void SharedTangibleObjectTemplate::createCustomizationDataPropertyAsNeeded(Object &object, bool /* forceCreation */) const { - //-- Properties cannot be added while an object is in the world. Some callers may be in the world, + //-- 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) @@ -260,8 +260,6 @@ void SharedTangibleObjectTemplate::createCustomizationDataPropertyAsNeeded(Objec bool const skipSharedOwnerVariables = true; AssetCustomizationManager::addCustomizationVariablesForAsset(TemporaryCrcString(getAppearanceFilename().c_str(), true), *customizationData, skipSharedOwnerVariables); - - //-- release local reference to the CustomizationData instance customizationData->release(); } @@ -281,7 +279,7 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariables(Palette if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter paletteColorCustomizationVariables in template %s", DataResource::getName())); - return ; + return; } else { @@ -295,10 +293,10 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariables(Palette { int baseCount = base->getPaletteColorCustomizationVariablesCount(); if (index < baseCount) - { - base->getPaletteColorCustomizationVariables(data, index); - return; - } + { + base->getPaletteColorCustomizationVariables(data, index); + return; + } index -= baseCount; } @@ -325,7 +323,7 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMin(Pale if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter paletteColorCustomizationVariables in template %s", DataResource::getName())); - return ; + return; } else { @@ -339,10 +337,10 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMin(Pale { int baseCount = base->getPaletteColorCustomizationVariablesCount(); if (index < baseCount) - { - base->getPaletteColorCustomizationVariablesMin(data, index); - return; - } + { + base->getPaletteColorCustomizationVariablesMin(data, index); + return; + } index -= baseCount; } @@ -369,7 +367,7 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMax(Pale if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter paletteColorCustomizationVariables in template %s", DataResource::getName())); - return ; + return; } else { @@ -383,10 +381,10 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMax(Pale { int baseCount = base->getPaletteColorCustomizationVariablesCount(); if (index < baseCount) - { - base->getPaletteColorCustomizationVariablesMax(data, index); - return; - } + { + base->getPaletteColorCustomizationVariablesMax(data, index); + return; + } index -= baseCount; } @@ -437,7 +435,7 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariables(RangedIntC if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter rangedIntCustomizationVariables in template %s", DataResource::getName())); - return ; + return; } else { @@ -451,10 +449,10 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariables(RangedIntC { int baseCount = base->getRangedIntCustomizationVariablesCount(); if (index < baseCount) - { - base->getRangedIntCustomizationVariables(data, index); - return; - } + { + base->getRangedIntCustomizationVariables(data, index); + return; + } index -= baseCount; } @@ -482,7 +480,7 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMin(RangedI if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter rangedIntCustomizationVariables in template %s", DataResource::getName())); - return ; + return; } else { @@ -496,10 +494,10 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMin(RangedI { int baseCount = base->getRangedIntCustomizationVariablesCount(); if (index < baseCount) - { - base->getRangedIntCustomizationVariablesMin(data, index); - return; - } + { + base->getRangedIntCustomizationVariablesMin(data, index); + return; + } index -= baseCount; } @@ -527,7 +525,7 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMax(RangedI if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter rangedIntCustomizationVariables in template %s", DataResource::getName())); - return ; + return; } else { @@ -541,10 +539,10 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMax(RangedI { int baseCount = base->getRangedIntCustomizationVariablesCount(); if (index < baseCount) - { - base->getRangedIntCustomizationVariablesMax(data, index); - return; - } + { + base->getRangedIntCustomizationVariablesMax(data, index); + return; + } index -= baseCount; } @@ -596,7 +594,7 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariables(ConstStr if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter constStringCustomizationVariables in template %s", DataResource::getName())); - return ; + return; } else { @@ -610,10 +608,10 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariables(ConstStr { int baseCount = base->getConstStringCustomizationVariablesCount(); if (index < baseCount) - { - base->getConstStringCustomizationVariables(data, index); - return; - } + { + base->getConstStringCustomizationVariables(data, index); + return; + } index -= baseCount; } @@ -639,7 +637,7 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMin(Const if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter constStringCustomizationVariables in template %s", DataResource::getName())); - return ; + return; } else { @@ -653,10 +651,10 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMin(Const { int baseCount = base->getConstStringCustomizationVariablesCount(); if (index < baseCount) - { - base->getConstStringCustomizationVariablesMin(data, index); - return; - } + { + base->getConstStringCustomizationVariablesMin(data, index); + return; + } index -= baseCount; } @@ -682,7 +680,7 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMax(Const if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter constStringCustomizationVariables in template %s", DataResource::getName())); - return ; + return; } else { @@ -696,10 +694,10 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMax(Const { int baseCount = base->getConstStringCustomizationVariablesCount(); if (index < baseCount) - { - base->getConstStringCustomizationVariablesMax(data, index); - return; - } + { + base->getConstStringCustomizationVariablesMax(data, index); + return; + } index -= baseCount; } @@ -796,8 +794,6 @@ size_t SharedTangibleObjectTemplate::getSocketDestinationsCount(void) const const std::string & SharedTangibleObjectTemplate::getStructureFootprintFileName() const { - - const SharedTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -825,8 +821,6 @@ const std::string & SharedTangibleObjectTemplate::getStructureFootprintFileName( bool SharedTangibleObjectTemplate::getUseStructureFootprintOutline() const { - - const SharedTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -854,8 +848,6 @@ bool SharedTangibleObjectTemplate::getUseStructureFootprintOutline() const bool SharedTangibleObjectTemplate::getTargetable() const { - - const SharedTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -953,7 +945,7 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMapping(Customization if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter customizationVariableMapping in template %s", DataResource::getName())); - return ; + return; } else { @@ -967,10 +959,10 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMapping(Customization { int baseCount = base->getCustomizationVariableMappingCount(); if (index < baseCount) - { - base->getCustomizationVariableMapping(data, index); - return; - } + { + base->getCustomizationVariableMapping(data, index); + return; + } index -= baseCount; } @@ -996,7 +988,7 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMappingMin(Customizat if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter customizationVariableMapping in template %s", DataResource::getName())); - return ; + return; } else { @@ -1010,10 +1002,10 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMappingMin(Customizat { int baseCount = base->getCustomizationVariableMappingCount(); if (index < baseCount) - { - base->getCustomizationVariableMappingMin(data, index); - return; - } + { + base->getCustomizationVariableMappingMin(data, index); + return; + } index -= baseCount; } @@ -1039,7 +1031,7 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMappingMax(Customizat if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter customizationVariableMapping in template %s", DataResource::getName())); - return ; + return; } else { @@ -1053,10 +1045,10 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMappingMax(Customizat { int baseCount = base->getCustomizationVariableMappingCount(); if (index < baseCount) - { - base->getCustomizationVariableMappingMax(data, index); - return; - } + { + base->getCustomizationVariableMappingMax(data, index); + return; + } index -= baseCount; } @@ -1095,8 +1087,6 @@ size_t SharedTangibleObjectTemplate::getCustomizationVariableMappingCount(void) SharedTangibleObjectTemplate::ClientVisabilityFlags SharedTangibleObjectTemplate::getClientVisabilityFlag() const { - - const SharedTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1122,7 +1112,6 @@ SharedTangibleObjectTemplate::ClientVisabilityFlags SharedTangibleObjectTemplate return value; } // SharedTangibleObjectTemplate::getClientVisabilityFlag - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1131,8 +1120,8 @@ SharedTangibleObjectTemplate::ClientVisabilityFlags SharedTangibleObjectTemplate */ void SharedTangibleObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedTangibleObjectTemplate_tag) { @@ -1142,7 +1131,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -1162,10 +1151,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,1,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 1, 0)) { - - m_versionOk = false; } @@ -1309,7 +1296,6 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedTangibleObjectTemplate::load - //============================================================================= // class SharedTangibleObjectTemplate::_ConstStringCustomizationVariable @@ -1358,8 +1344,6 @@ Tag SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getId(void) const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getVariableName(bool versionOk) const { - - const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -1387,8 +1371,6 @@ const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVaria const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getConstValue(bool versionOk) const { - - const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -1414,7 +1396,6 @@ const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVaria return value; } // SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getConstValue - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1423,8 +1404,8 @@ const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVaria */ void SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1446,7 +1427,6 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::load - //============================================================================= // class SharedTangibleObjectTemplate::_CustomizationVariableMapping @@ -1495,8 +1475,6 @@ Tag SharedTangibleObjectTemplate::_CustomizationVariableMapping::getId(void) con const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSourceVariable(bool versionOk) const { - - const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = nullptr; if (m_baseData != nullptr) { @@ -1524,8 +1502,6 @@ const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping: const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping::getDependentVariable(bool versionOk) const { - - const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = nullptr; if (m_baseData != nullptr) { @@ -1551,7 +1527,6 @@ const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping: return value; } // SharedTangibleObjectTemplate::_CustomizationVariableMapping::getDependentVariable - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1560,8 +1535,8 @@ const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping: */ void SharedTangibleObjectTemplate::_CustomizationVariableMapping::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1583,7 +1558,6 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // SharedTangibleObjectTemplate::_CustomizationVariableMapping::load - //============================================================================= // class SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable @@ -1632,8 +1606,6 @@ Tag SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getId(void const std::string & SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getVariableName(bool versionOk) const { - - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -1661,8 +1633,6 @@ const std::string & SharedTangibleObjectTemplate::_PaletteColorCustomizationVari const std::string & SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getPalettePathName(bool versionOk) const { - - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -1690,8 +1660,6 @@ const std::string & SharedTangibleObjectTemplate::_PaletteColorCustomizationVari int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndex(bool versionOk) const { - - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -1741,8 +1709,6 @@ int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefault int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndexMin(bool versionOk) const { - - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -1792,8 +1758,6 @@ int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefault int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndexMax(bool versionOk) const { - - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -1841,7 +1805,6 @@ int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefault return value; } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndexMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1850,8 +1813,8 @@ int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefault */ void SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1875,7 +1838,6 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::load - //============================================================================= // class SharedTangibleObjectTemplate::_RangedIntCustomizationVariable @@ -1924,8 +1886,6 @@ Tag SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getId(void) c const std::string & SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getVariableName(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -1953,8 +1913,6 @@ const std::string & SharedTangibleObjectTemplate::_RangedIntCustomizationVariabl int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusive(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -2004,8 +1962,6 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueIn int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusiveMin(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -2055,8 +2011,6 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueIn int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusiveMax(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -2106,8 +2060,6 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueIn int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValue(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -2157,8 +2109,6 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultVal int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValueMin(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -2208,8 +2158,6 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultVal int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValueMax(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -2259,8 +2207,6 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultVal int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusive(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -2310,8 +2256,6 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueEx int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusiveMin(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -2361,8 +2305,6 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueEx int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusiveMax(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -2410,7 +2352,6 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueEx return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusiveMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -2419,8 +2360,8 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueEx */ void SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -2446,4 +2387,4 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp index b0724d3a..b2b26568 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedTerrainSurfaceObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedTerrainSurfaceObjectTemplate::SharedTerrainSurfaceObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedTerrainSurfaceObjectTemplate::SharedTerrainSurfaceObjectTemplate @@ -45,8 +45,8 @@ SharedTerrainSurfaceObjectTemplate::SharedTerrainSurfaceObjectTemplate(const std */ SharedTerrainSurfaceObjectTemplate::~SharedTerrainSurfaceObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedTerrainSurfaceObjectTemplate::~SharedTerrainSurfaceObjectTemplate /** @@ -105,8 +105,6 @@ Tag SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion(void) const //@BEGIN TFD float SharedTerrainSurfaceObjectTemplate::getCover() const { - - const SharedTerrainSurfaceObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -156,8 +154,6 @@ float SharedTerrainSurfaceObjectTemplate::getCover() const float SharedTerrainSurfaceObjectTemplate::getCoverMin() const { - - const SharedTerrainSurfaceObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -207,8 +203,6 @@ float SharedTerrainSurfaceObjectTemplate::getCoverMin() const float SharedTerrainSurfaceObjectTemplate::getCoverMax() const { - - const SharedTerrainSurfaceObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -258,8 +252,6 @@ float SharedTerrainSurfaceObjectTemplate::getCoverMax() const const std::string & SharedTerrainSurfaceObjectTemplate::getSurfaceType() const { - - const SharedTerrainSurfaceObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -285,7 +277,6 @@ const std::string & SharedTerrainSurfaceObjectTemplate::getSurfaceType() const return value; } // SharedTerrainSurfaceObjectTemplate::getSurfaceType - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -294,8 +285,8 @@ const std::string & SharedTerrainSurfaceObjectTemplate::getSurfaceType() const */ void SharedTerrainSurfaceObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedTerrainSurfaceObjectTemplate_tag) { @@ -304,7 +295,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -324,10 +315,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -351,4 +340,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedTerrainSurfaceObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp index bb5fbff4..e1ced8e6 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp @@ -24,20 +24,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedUniverseObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedUniverseObjectTemplate::SharedUniverseObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedUniverseObjectTemplate::SharedUniverseObjectTemplate @@ -46,8 +46,8 @@ SharedUniverseObjectTemplate::SharedUniverseObjectTemplate(const std::string & f */ SharedUniverseObjectTemplate::~SharedUniverseObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedUniverseObjectTemplate::~SharedUniverseObjectTemplate /** @@ -113,8 +113,8 @@ Tag SharedUniverseObjectTemplate::getHighestTemplateVersion(void) const */ void SharedUniverseObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedUniverseObjectTemplate_tag) { @@ -124,7 +124,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -144,10 +144,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -165,4 +163,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedUniverseObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp index b48e6d42..514e9511 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedVehicleObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedVehicleObjectTemplate::SharedVehicleObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedVehicleObjectTemplate::SharedVehicleObjectTemplate @@ -45,8 +45,8 @@ SharedVehicleObjectTemplate::SharedVehicleObjectTemplate(const std::string & fil */ SharedVehicleObjectTemplate::~SharedVehicleObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedVehicleObjectTemplate::~SharedVehicleObjectTemplate /** @@ -252,8 +252,6 @@ float SharedVehicleObjectTemplate::getSpeedMax(MovementTypes index) const float SharedVehicleObjectTemplate::getSlopeAversion() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -303,8 +301,6 @@ float SharedVehicleObjectTemplate::getSlopeAversion() const float SharedVehicleObjectTemplate::getSlopeAversionMin() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -354,8 +350,6 @@ float SharedVehicleObjectTemplate::getSlopeAversionMin() const float SharedVehicleObjectTemplate::getSlopeAversionMax() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -405,8 +399,6 @@ float SharedVehicleObjectTemplate::getSlopeAversionMax() const float SharedVehicleObjectTemplate::getHoverValue() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -456,8 +448,6 @@ float SharedVehicleObjectTemplate::getHoverValue() const float SharedVehicleObjectTemplate::getHoverValueMin() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -507,8 +497,6 @@ float SharedVehicleObjectTemplate::getHoverValueMin() const float SharedVehicleObjectTemplate::getHoverValueMax() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -558,8 +546,6 @@ float SharedVehicleObjectTemplate::getHoverValueMax() const float SharedVehicleObjectTemplate::getTurnRate() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -609,8 +595,6 @@ float SharedVehicleObjectTemplate::getTurnRate() const float SharedVehicleObjectTemplate::getTurnRateMin() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -660,8 +644,6 @@ float SharedVehicleObjectTemplate::getTurnRateMin() const float SharedVehicleObjectTemplate::getTurnRateMax() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -711,8 +693,6 @@ float SharedVehicleObjectTemplate::getTurnRateMax() const float SharedVehicleObjectTemplate::getMaxVelocity() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -762,8 +742,6 @@ float SharedVehicleObjectTemplate::getMaxVelocity() const float SharedVehicleObjectTemplate::getMaxVelocityMin() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -813,8 +791,6 @@ float SharedVehicleObjectTemplate::getMaxVelocityMin() const float SharedVehicleObjectTemplate::getMaxVelocityMax() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -864,8 +840,6 @@ float SharedVehicleObjectTemplate::getMaxVelocityMax() const float SharedVehicleObjectTemplate::getAcceleration() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -915,8 +889,6 @@ float SharedVehicleObjectTemplate::getAcceleration() const float SharedVehicleObjectTemplate::getAccelerationMin() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -966,8 +938,6 @@ float SharedVehicleObjectTemplate::getAccelerationMin() const float SharedVehicleObjectTemplate::getAccelerationMax() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1017,8 +987,6 @@ float SharedVehicleObjectTemplate::getAccelerationMax() const float SharedVehicleObjectTemplate::getBraking() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1068,8 +1036,6 @@ float SharedVehicleObjectTemplate::getBraking() const float SharedVehicleObjectTemplate::getBrakingMin() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1119,8 +1085,6 @@ float SharedVehicleObjectTemplate::getBrakingMin() const float SharedVehicleObjectTemplate::getBrakingMax() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1168,7 +1132,6 @@ float SharedVehicleObjectTemplate::getBrakingMax() const return value; } // SharedVehicleObjectTemplate::getBrakingMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1177,8 +1140,8 @@ float SharedVehicleObjectTemplate::getBrakingMax() const */ void SharedVehicleObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedVehicleObjectTemplate_tag) { @@ -1188,7 +1151,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -1208,10 +1171,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -1259,4 +1220,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedVehicleObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp index a5f730a2..d5c089f9 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedWaypointObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedWaypointObjectTemplate::SharedWaypointObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedIntangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedWaypointObjectTemplate::SharedWaypointObjectTemplate @@ -45,8 +45,8 @@ SharedWaypointObjectTemplate::SharedWaypointObjectTemplate(const std::string & f */ SharedWaypointObjectTemplate::~SharedWaypointObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedWaypointObjectTemplate::~SharedWaypointObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedWaypointObjectTemplate::getHighestTemplateVersion(void) const */ void SharedWaypointObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedWaypointObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedWaypointObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp index 4b8d05b7..8190a334 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedWeaponObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedWeaponObjectTemplate::SharedWeaponObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedWeaponObjectTemplate::SharedWeaponObjectTemplate @@ -45,8 +45,8 @@ SharedWeaponObjectTemplate::SharedWeaponObjectTemplate(const std::string & filen */ SharedWeaponObjectTemplate::~SharedWeaponObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedWeaponObjectTemplate::~SharedWeaponObjectTemplate /** @@ -105,8 +105,6 @@ Tag SharedWeaponObjectTemplate::getHighestTemplateVersion(void) const //@BEGIN TFD const std::string & SharedWeaponObjectTemplate::getWeaponEffect() const { - - const SharedWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -134,8 +132,6 @@ const std::string & SharedWeaponObjectTemplate::getWeaponEffect() const int SharedWeaponObjectTemplate::getWeaponEffectIndex() const { - - const SharedWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -185,8 +181,6 @@ int SharedWeaponObjectTemplate::getWeaponEffectIndex() const int SharedWeaponObjectTemplate::getWeaponEffectIndexMin() const { - - const SharedWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -236,8 +230,6 @@ int SharedWeaponObjectTemplate::getWeaponEffectIndexMin() const int SharedWeaponObjectTemplate::getWeaponEffectIndexMax() const { - - const SharedWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -287,8 +279,6 @@ int SharedWeaponObjectTemplate::getWeaponEffectIndexMax() const SharedWeaponObjectTemplate::AttackType SharedWeaponObjectTemplate::getAttackType() const { - - const SharedWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -314,7 +304,6 @@ SharedWeaponObjectTemplate::AttackType SharedWeaponObjectTemplate::getAttackType return value; } // SharedWeaponObjectTemplate::getAttackType - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -323,8 +312,8 @@ SharedWeaponObjectTemplate::AttackType SharedWeaponObjectTemplate::getAttackType */ void SharedWeaponObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedWeaponObjectTemplate_tag) { @@ -334,7 +323,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -354,10 +343,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,4)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 4)) { - - m_versionOk = false; } @@ -385,4 +372,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedWeaponObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedMath/src/shared/Volume.cpp b/engine/shared/library/sharedMath/src/shared/Volume.cpp index 65a8c69f..2ab0d658 100755 --- a/engine/shared/library/sharedMath/src/shared/Volume.cpp +++ b/engine/shared/library/sharedMath/src/shared/Volume.cpp @@ -25,9 +25,9 @@ // @param vertexList Co-planar set of points describing the siloutte edges of the volume. Volume::Volume(const Vector &originPoint, const int numberOfVertices, const Vector * const vertexList) -: + : m_numberOfPlanes(numberOfVertices + 1), - m_plane(new Plane[ static_cast(m_numberOfPlanes) ]) + m_plane(new Plane[static_cast(m_numberOfPlanes)]) { NOT_NULL(vertexList); DEBUG_FATAL(numberOfVertices < 3, ("At least 3 vertices are necessary")); @@ -37,58 +37,58 @@ Volume::Volume(const Vector &originPoint, const int numberOfVertices, const Vect // build the sides for (int i = 1; i < numberOfVertices; ++i) - m_plane[i].set(originPoint, vertexList[i-1], vertexList[i]); - m_plane[numberOfVertices].set(originPoint, vertexList[numberOfVertices-1], vertexList[0]); + m_plane[i].set(originPoint, vertexList[i - 1], vertexList[i]); + m_plane[numberOfVertices].set(originPoint, vertexList[numberOfVertices - 1], vertexList[0]); } // ---------------------------------------------------------------------- /** * Create an undefined volume - * + * * This constructor creates a volume consisting of the specified number of planes, * but does not set up the plane data. - * + * * @param numberOfPlanes Number of planes in the volume. */ Volume::Volume(const int numberOfPlanes) -: + : m_numberOfPlanes(numberOfPlanes), - m_plane(new Plane[ static_cast(m_numberOfPlanes) ]) + m_plane(new Plane[static_cast(m_numberOfPlanes)]) { } // ---------------------------------------------------------------------- /** * Construct a new volume from another, transformed by the specified transformation. - * + * * @param other The other volume * @param trans The transform to be applied. */ -Volume::Volume (const Volume &rhs, const Transform &newTransform) -: +Volume::Volume(const Volume &rhs, const Transform &newTransform) + : m_numberOfPlanes(rhs.m_numberOfPlanes), - m_plane(new Plane[ static_cast(m_numberOfPlanes) ]) + m_plane(new Plane[static_cast(m_numberOfPlanes)]) { for (int i = 0; i < m_numberOfPlanes; ++i) - m_plane [i].set(rhs.m_plane[i], newTransform); + m_plane[i].set(rhs.m_plane[i], newTransform); } // ---------------------------------------------------------------------- Volume::~Volume() { - delete [] m_plane; + delete[] m_plane; } // ---------------------------------------------------------------------- /** * Set a specific plane in the volume - * + * * This routine can be used to build up a volume after having used the * constructor that takes a number of planes. - * + * * @param index The plane to modify. * @param plane The new value for the plane data. */ @@ -102,10 +102,10 @@ void Volume::setPlane(const int index, const Plane &plane) // ---------------------------------------------------------------------- /** * Set a specific plane in the volume - * + * * This routine can be used to build up a volume after having used the * constructor that takes a number of planes. - * + * * @param index The plane to modify. * @param plane The new value for the plane data. */ @@ -119,7 +119,7 @@ const Plane &Volume::getPlane(const int index) const // ---------------------------------------------------------------------- /** * Test a point against a volume - * + * * @param point Point to test. * @return True if the point is within the volume. */ @@ -136,7 +136,7 @@ bool Volume::contains(const Vector &point) const // ---------------------------------------------------------------------- /** * See if the volume completely contains the sphere - * + * * @param sphere The sphere to check. * @return True if the entire sphere is within the volume, otherwise false. */ @@ -156,7 +156,7 @@ bool Volume::contains(const Sphere &sphere) const // ---------------------------------------------------------------------- /** * Test a point cloud against a volume - * + * * @param pointCloud Point cloud to test. * @param numberOfPoints Number of points in the point cloud. * @return True if the point is within the volume. @@ -168,7 +168,7 @@ bool Volume::contains(const Vector *pointCloud, int numberOfPoints) const DEBUG_FATAL(numberOfPoints <= 0, ("numberOfPoints is less than 1")); for (int i = 0; i < m_numberOfPlanes; ++i) - for (int j = 0; i < numberOfPoints; ++j) + for (int j = 0; j < numberOfPoints; ++j) if (m_plane[i].computeDistanceTo(pointCloud[j]) > 0) return false; @@ -178,9 +178,9 @@ bool Volume::contains(const Vector *pointCloud, int numberOfPoints) const // ---------------------------------------------------------------------- /** * See if the volume intersects a sphere. - * + * * The sphere is in the volume if any portion of it is within the volume. - * + * * @param sphere The sphere to check. * @return True if the any portion of the sphere is within the volume, otherwise false. */ @@ -200,9 +200,9 @@ bool Volume::intersects(const Sphere &sphere) const // ---------------------------------------------------------------------- /** * See if the volume intersects the segment. - * + * * The segment is considered to be in the volume if both points test on the negative side of any plane - * + * * @param start Start point of segment. * @param end End point of segment. * @return False if any segment is on the negative side of any plane @@ -223,12 +223,12 @@ bool Volume::intersects(Vector const & start, Vector const & end) const // ---------------------------------------------------------------------- /** * Fast Conservative check of a point cloud against the volume - * + * * This routine will return true if the point could is completely outside any one * plane of the volume. If the routine returns true, the point cloud is definitely * outside the volume. However, a false result does not guarentee that the point * cloud intersects the volume. - * + * * @param pointCloud Point cloud to test. * @param numberOfPoints Number of points in the point cloud. * @return See remarks for more information. @@ -255,7 +255,7 @@ bool Volume::fastConservativeExcludes(const Vector *pointCloud, int numberOfPoin // ---------------------------------------------------------------------- /** * Transform the volume by the specified transformation. - * + * * @param transform The transform to be applied. */ @@ -268,7 +268,7 @@ void Volume::transform(const Transform &newTransform) // ---------------------------------------------------------------------- /** * Transform the specified volume by the specified transformation. - * + * * @param source The source volume to transform. * @param transform The transform to be applied. */ @@ -277,13 +277,13 @@ void Volume::transform(const Volume &source, const Transform &newTransform) { if (m_numberOfPlanes != source.m_numberOfPlanes) { - delete [] m_plane; + delete[] m_plane; m_numberOfPlanes = source.m_numberOfPlanes; - m_plane = new Plane[ static_cast(m_numberOfPlanes) ]; + m_plane = new Plane[static_cast(m_numberOfPlanes)]; } for (int i = 0; i < m_numberOfPlanes; ++i) m_plane[i].set(source.m_plane[i], newTransform); } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp index c162ae34..4ca36d87 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp @@ -21,16 +21,17 @@ #include #include - /** * Class constructor. */ ServerArmorTemplate::ServerArmorTemplate(const std::string & filename) //@BEGIN TFD INIT : TpfTemplate(filename) - ,m_specialProtectionLoaded(false) - ,m_specialProtectionAppend(false) -//@END TFD INIT + , m_specialProtectionLoaded(false) + , m_specialProtectionAppend(false) + , m_templateVersion(0) + , m_versionOk(false) + //@END TFD INIT { } // ServerArmorTemplate::ServerArmorTemplate @@ -39,7 +40,7 @@ ServerArmorTemplate::ServerArmorTemplate(const std::string & filename) */ ServerArmorTemplate::~ServerArmorTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) @@ -49,7 +50,7 @@ ServerArmorTemplate::~ServerArmorTemplate() } m_specialProtection.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerArmorTemplate::~ServerArmorTemplate /** @@ -274,7 +275,6 @@ bool ServerArmorTemplate::isAppend(const char *name) const return TpfTemplate::isAppend(name); } // ServerArmorTemplate::isAppend - int ServerArmorTemplate::getListLength(const char *name) const { if (strcmp(name, "specialProtection") == 0) @@ -297,8 +297,8 @@ int ServerArmorTemplate::getListLength(const char *name) const */ void ServerArmorTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerArmorTemplate_tag) { @@ -308,7 +308,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -328,7 +328,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,1)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 1)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -401,18 +401,18 @@ char paramName[MAX_NAME_SIZE]; */ void ServerArmorTemplate::save(Iff &file) { -int count; + int count; file.insertForm(ServerArmorTemplate_tag); if (m_baseTemplateName.size() != 0) { - file.insertForm(TAG(D,E,R,V)); + file.insertForm(TAG(D, E, R, V)); file.insertChunk(TAG(X, X, X, X)); file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1); file.exitChunk(); file.exitForm(); } - file.insertForm(TAG(0,0,0,1)); + file.insertForm(TAG(0, 0, 0, 1)); file.allowNonlinearFunctions(); int paramCount = 0; @@ -447,7 +447,7 @@ int count; count = m_specialProtection.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_specialProtection[i]->saveToIff(file);} + m_specialProtection[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save vulnerability @@ -462,7 +462,7 @@ int count; count = 3; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 3; ++i) - m_encumbrance[i].saveToIff(file);} + m_encumbrance[i].saveToIff(file); } file.exitChunk(); ++paramCount; @@ -477,7 +477,6 @@ int count; file.exitForm(); } // ServerArmorTemplate::save - //============================================================================= // class ServerArmorTemplate::_SpecialProtection @@ -621,7 +620,6 @@ bool ServerArmorTemplate::_SpecialProtection::isAppend(const char *name) const return TpfTemplate::isAppend(name); } // ServerArmorTemplate::_SpecialProtection::isAppend - int ServerArmorTemplate::_SpecialProtection::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -635,8 +633,8 @@ int ServerArmorTemplate::_SpecialProtection::getListLength(const char *name) con */ void ServerArmorTemplate::_SpecialProtection::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -666,7 +664,7 @@ char paramName[MAX_NAME_SIZE]; */ void ServerArmorTemplate::_SpecialProtection::save(Iff &file) { -int count; + int count; file.insertForm(_SpecialProtection_tag); @@ -695,4 +693,4 @@ int count; UNREF(count); } // ServerArmorTemplate::_SpecialProtection::save -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp index f63f0d43..f70b5fd7 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp @@ -20,17 +20,17 @@ #include #include - - /** * Class constructor. */ ServerCreatureObjectTemplate::ServerCreatureObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerTangibleObjectTemplate(filename) - ,m_attribModsLoaded(false) - ,m_attribModsAppend(false) -//@END TFD INIT + , m_attribModsLoaded(false) + , m_attribModsAppend(false) + , m_templateVersion(0) + , m_versionOk(false) + //@END TFD INIT { } // ServerCreatureObjectTemplate::ServerCreatureObjectTemplate @@ -39,7 +39,7 @@ ServerCreatureObjectTemplate::ServerCreatureObjectTemplate(const std::string & f */ ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) @@ -49,7 +49,7 @@ ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate() } m_attribMods.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate /** @@ -406,7 +406,6 @@ bool ServerCreatureObjectTemplate::isAppend(const char *name) const return ServerTangibleObjectTemplate::isAppend(name); } // ServerCreatureObjectTemplate::isAppend - int ServerCreatureObjectTemplate::getListLength(const char *name) const { if (strcmp(name, "attributes") == 0) @@ -445,8 +444,8 @@ int ServerCreatureObjectTemplate::getListLength(const char *name) const */ void ServerCreatureObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerCreatureObjectTemplate_tag) { @@ -456,7 +455,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -476,7 +475,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,5)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 5)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -615,18 +614,18 @@ char paramName[MAX_NAME_SIZE]; */ void ServerCreatureObjectTemplate::save(Iff &file) { -int count; + int count; file.insertForm(ServerCreatureObjectTemplate_tag); if (m_baseTemplateName.size() != 0) { - file.insertForm(TAG(D,E,R,V)); + file.insertForm(TAG(D, E, R, V)); file.insertChunk(TAG(X, X, X, X)); file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1); file.exitChunk(); file.exitForm(); } - file.insertForm(TAG(0,0,0,5)); + file.insertForm(TAG(0, 0, 0, 5)); file.allowNonlinearFunctions(); int paramCount = 0; @@ -643,7 +642,7 @@ int count; count = 6; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 6; ++i) - m_attributes[i].saveToIff(file);} + m_attributes[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save minAttributes @@ -652,7 +651,7 @@ int count; count = 6; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 6; ++i) - m_minAttributes[i].saveToIff(file);} + m_minAttributes[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save maxAttributes @@ -661,7 +660,7 @@ int count; count = 6; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 6; ++i) - m_maxAttributes[i].saveToIff(file);} + m_maxAttributes[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save minDrainModifier @@ -700,7 +699,7 @@ int count; count = m_attribMods.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_attribMods[i]->saveToIff(file);} + m_attribMods[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save shockWounds @@ -733,7 +732,7 @@ int count; count = 4; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 4; ++i) - m_maxMentalStates[i].saveToIff(file);} + m_maxMentalStates[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save mentalStatesDecay @@ -742,7 +741,7 @@ int count; count = 4; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 4; ++i) - m_mentalStatesDecay[i].saveToIff(file);} + m_mentalStatesDecay[i].saveToIff(file); } file.exitChunk(); ++paramCount; @@ -757,4 +756,4 @@ int count; file.exitForm(); } // ServerCreatureObjectTemplate::save -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp index 53c05125..e86547a9 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp @@ -20,21 +20,21 @@ #include #include - - /** * Class constructor. */ ServerDraftSchematicObjectTemplate::ServerDraftSchematicObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerIntangibleObjectTemplate(filename) - ,m_slotsLoaded(false) - ,m_slotsAppend(false) - ,m_skillCommandsLoaded(false) - ,m_skillCommandsAppend(false) - ,m_manufactureScriptsLoaded(false) - ,m_manufactureScriptsAppend(false) -//@END TFD INIT + , m_slotsLoaded(false) + , m_slotsAppend(false) + , m_skillCommandsLoaded(false) + , m_skillCommandsAppend(false) + , m_manufactureScriptsLoaded(false) + , m_manufactureScriptsAppend(false) + , m_templateVersion(0) + , m_versionOk(false) + //@END TFD INIT { } // ServerDraftSchematicObjectTemplate::ServerDraftSchematicObjectTemplate @@ -43,7 +43,7 @@ ServerDraftSchematicObjectTemplate::ServerDraftSchematicObjectTemplate(const std */ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) @@ -71,7 +71,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() } m_manufactureScripts.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate /** @@ -372,7 +372,6 @@ bool ServerDraftSchematicObjectTemplate::isAppend(const char *name) const return ServerIntangibleObjectTemplate::isAppend(name); } // ServerDraftSchematicObjectTemplate::isAppend - int ServerDraftSchematicObjectTemplate::getListLength(const char *name) const { if (strcmp(name, "slots") == 0) @@ -399,8 +398,8 @@ int ServerDraftSchematicObjectTemplate::getListLength(const char *name) const */ void ServerDraftSchematicObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerDraftSchematicObjectTemplate_tag) { @@ -410,7 +409,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -430,7 +429,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,7)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 7)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -533,18 +532,18 @@ char paramName[MAX_NAME_SIZE]; */ void ServerDraftSchematicObjectTemplate::save(Iff &file) { -int count; + int count; file.insertForm(ServerDraftSchematicObjectTemplate_tag); if (m_baseTemplateName.size() != 0) { - file.insertForm(TAG(D,E,R,V)); + file.insertForm(TAG(D, E, R, V)); file.insertChunk(TAG(X, X, X, X)); file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1); file.exitChunk(); file.exitForm(); } - file.insertForm(TAG(0,0,0,7)); + file.insertForm(TAG(0, 0, 0, 7)); file.allowNonlinearFunctions(); int paramCount = 0; @@ -579,7 +578,7 @@ int count; count = m_slots.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_slots[i]->saveToIff(file);} + m_slots[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_skillCommandsLoaded) @@ -594,7 +593,7 @@ int count; count = m_skillCommands.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_skillCommands[i]->saveToIff(file);} + m_skillCommands[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save destroyIngredients @@ -615,7 +614,7 @@ int count; count = m_manufactureScripts.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_manufactureScripts[i]->saveToIff(file);} + m_manufactureScripts[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save itemsPerContainer @@ -648,7 +647,6 @@ int count; file.exitForm(); } // ServerDraftSchematicObjectTemplate::save - //============================================================================= // class ServerDraftSchematicObjectTemplate::_IngredientSlot @@ -657,8 +655,8 @@ int count; */ ServerDraftSchematicObjectTemplate::_IngredientSlot::_IngredientSlot(const std::string & filename) : TpfTemplate(filename) - ,m_optionsLoaded(false) - ,m_optionsAppend(false) + , m_optionsLoaded(false) + , m_optionsAppend(false) { } // ServerDraftSchematicObjectTemplate::_IngredientSlot::_IngredientSlot @@ -880,7 +878,6 @@ bool ServerDraftSchematicObjectTemplate::_IngredientSlot::isAppend(const char *n return TpfTemplate::isAppend(name); } // ServerDraftSchematicObjectTemplate::_IngredientSlot::isAppend - int ServerDraftSchematicObjectTemplate::_IngredientSlot::getListLength(const char *name) const { if (strcmp(name, "options") == 0) @@ -899,8 +896,8 @@ int ServerDraftSchematicObjectTemplate::_IngredientSlot::getListLength(const cha */ void ServerDraftSchematicObjectTemplate::_IngredientSlot::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -955,7 +952,7 @@ char paramName[MAX_NAME_SIZE]; */ void ServerDraftSchematicObjectTemplate::_IngredientSlot::save(Iff &file) { -int count; + int count; file.insertForm(_IngredientSlot_tag); @@ -985,7 +982,7 @@ int count; count = m_options.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_options[i]->saveToIff(file);} + m_options[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save optionalSkillCommand @@ -1016,4 +1013,4 @@ int count; file.exitForm(true); } // ServerDraftSchematicObjectTemplate::_IngredientSlot::save -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp index 73735880..63d2033e 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp @@ -20,19 +20,19 @@ #include #include - - /** * Class constructor. */ ServerManufactureSchematicObjectTemplate::ServerManufactureSchematicObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerIntangibleObjectTemplate(filename) - ,m_ingredientsLoaded(false) - ,m_ingredientsAppend(false) - ,m_attributesLoaded(false) - ,m_attributesAppend(false) -//@END TFD INIT + , m_ingredientsLoaded(false) + , m_ingredientsAppend(false) + , m_attributesLoaded(false) + , m_attributesAppend(false) + , m_templateVersion(0) + , m_versionOk(false) + //@END TFD INIT { } // ServerManufactureSchematicObjectTemplate::ServerManufactureSchematicObjectTemplate @@ -41,7 +41,7 @@ ServerManufactureSchematicObjectTemplate::ServerManufactureSchematicObjectTempla */ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) @@ -60,7 +60,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl } m_attributes.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTemplate /** @@ -282,7 +282,6 @@ bool ServerManufactureSchematicObjectTemplate::isAppend(const char *name) const return ServerIntangibleObjectTemplate::isAppend(name); } // ServerManufactureSchematicObjectTemplate::isAppend - int ServerManufactureSchematicObjectTemplate::getListLength(const char *name) const { if (strcmp(name, "ingredients") == 0) @@ -305,8 +304,8 @@ int ServerManufactureSchematicObjectTemplate::getListLength(const char *name) co */ void ServerManufactureSchematicObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerManufactureSchematicObjectTemplate_tag) { @@ -316,7 +315,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -336,7 +335,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -412,18 +411,18 @@ char paramName[MAX_NAME_SIZE]; */ void ServerManufactureSchematicObjectTemplate::save(Iff &file) { -int count; + int count; file.insertForm(ServerManufactureSchematicObjectTemplate_tag); if (m_baseTemplateName.size() != 0) { - file.insertForm(TAG(D,E,R,V)); + file.insertForm(TAG(D, E, R, V)); file.insertChunk(TAG(X, X, X, X)); file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1); file.exitChunk(); file.exitForm(); } - file.insertForm(TAG(0,0,0,0)); + file.insertForm(TAG(0, 0, 0, 0)); file.allowNonlinearFunctions(); int paramCount = 0; @@ -452,7 +451,7 @@ int count; count = m_ingredients.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_ingredients[i]->saveToIff(file);} + m_ingredients[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save itemCount @@ -473,7 +472,7 @@ int count; count = m_attributes.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_attributes[i]->saveToIff(file);} + m_attributes[i]->saveToIff(file); } file.exitChunk(); ++paramCount; @@ -488,7 +487,6 @@ int count; file.exitForm(); } // ServerManufactureSchematicObjectTemplate::save - //============================================================================= // class ServerManufactureSchematicObjectTemplate::_IngredientSlot @@ -637,7 +635,6 @@ bool ServerManufactureSchematicObjectTemplate::_IngredientSlot::isAppend(const c return TpfTemplate::isAppend(name); } // ServerManufactureSchematicObjectTemplate::_IngredientSlot::isAppend - int ServerManufactureSchematicObjectTemplate::_IngredientSlot::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -651,8 +648,8 @@ int ServerManufactureSchematicObjectTemplate::_IngredientSlot::getListLength(con */ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -682,7 +679,7 @@ char paramName[MAX_NAME_SIZE]; */ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::save(Iff &file) { -int count; + int count; file.insertForm(_IngredientSlot_tag); @@ -711,4 +708,4 @@ int count; UNREF(count); } // ServerManufactureSchematicObjectTemplate::_IngredientSlot::save -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp index 5df8660b..257b1f02 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp @@ -20,27 +20,27 @@ #include #include - - /** * Class constructor. */ ServerObjectTemplate::ServerObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : TpfTemplate(filename) - ,m_scriptsLoaded(false) - ,m_scriptsAppend(false) - ,m_visibleFlagsLoaded(false) - ,m_visibleFlagsAppend(false) - ,m_deleteFlagsLoaded(false) - ,m_deleteFlagsAppend(false) - ,m_moveFlagsLoaded(false) - ,m_moveFlagsAppend(false) - ,m_contentsLoaded(false) - ,m_contentsAppend(false) - ,m_xpPointsLoaded(false) - ,m_xpPointsAppend(false) -//@END TFD INIT + , m_scriptsLoaded(false) + , m_scriptsAppend(false) + , m_visibleFlagsLoaded(false) + , m_visibleFlagsAppend(false) + , m_deleteFlagsLoaded(false) + , m_deleteFlagsAppend(false) + , m_moveFlagsLoaded(false) + , m_moveFlagsAppend(false) + , m_contentsLoaded(false) + , m_contentsAppend(false) + , m_xpPointsLoaded(false) + , m_xpPointsAppend(false) + , m_templateVersion(0) + , m_versionOk(false) + //@END TFD INIT { } // ServerObjectTemplate::ServerObjectTemplate @@ -49,7 +49,7 @@ ServerObjectTemplate::ServerObjectTemplate(const std::string & filename) */ ServerObjectTemplate::~ServerObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) @@ -104,7 +104,7 @@ ServerObjectTemplate::~ServerObjectTemplate() } m_xpPoints.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerObjectTemplate::~ServerObjectTemplate /** @@ -500,7 +500,6 @@ bool ServerObjectTemplate::isAppend(const char *name) const return TpfTemplate::isAppend(name); } // ServerObjectTemplate::isAppend - int ServerObjectTemplate::getListLength(const char *name) const { if (strcmp(name, "scripts") == 0) @@ -543,8 +542,8 @@ int ServerObjectTemplate::getListLength(const char *name) const */ void ServerObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerObjectTemplate_tag) { @@ -554,7 +553,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -574,7 +573,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,1,1)) + if (getHighestTemplateVersion() != TAG(0, 0, 1, 1)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -750,18 +749,18 @@ char paramName[MAX_NAME_SIZE]; */ void ServerObjectTemplate::save(Iff &file) { -int count; + int count; file.insertForm(ServerObjectTemplate_tag); if (m_baseTemplateName.size() != 0) { - file.insertForm(TAG(D,E,R,V)); + file.insertForm(TAG(D, E, R, V)); file.insertChunk(TAG(X, X, X, X)); file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1); file.exitChunk(); file.exitForm(); } - file.insertForm(TAG(0,0,1,1)); + file.insertForm(TAG(0, 0, 1, 1)); file.allowNonlinearFunctions(); int paramCount = 0; @@ -784,7 +783,7 @@ int count; count = m_scripts.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_scripts[i]->saveToIff(file);} + m_scripts[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save objvars @@ -811,7 +810,7 @@ int count; count = m_visibleFlags.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_visibleFlags[i]->saveToIff(file);} + m_visibleFlags[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_deleteFlagsLoaded) @@ -826,7 +825,7 @@ int count; count = m_deleteFlags.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_deleteFlags[i]->saveToIff(file);} + m_deleteFlags[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_moveFlagsLoaded) @@ -841,7 +840,7 @@ int count; count = m_moveFlags.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_moveFlags[i]->saveToIff(file);} + m_moveFlags[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save invulnerable @@ -868,7 +867,7 @@ int count; count = 3; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 3; ++i) - m_updateRanges[i].saveToIff(file);} + m_updateRanges[i].saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_contentsLoaded) @@ -883,7 +882,7 @@ int count; count = m_contents.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_contents[i]->saveToIff(file);} + m_contents[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_xpPointsLoaded) @@ -898,7 +897,7 @@ int count; count = m_xpPoints.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_xpPoints[i]->saveToIff(file);} + m_xpPoints[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save persistByDefault @@ -925,7 +924,6 @@ int count; file.exitForm(); } // ServerObjectTemplate::save - //============================================================================= // class ServerObjectTemplate::_AttribMod @@ -1113,7 +1111,6 @@ bool ServerObjectTemplate::_AttribMod::isAppend(const char *name) const return TpfTemplate::isAppend(name); } // ServerObjectTemplate::_AttribMod::isAppend - int ServerObjectTemplate::_AttribMod::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -1127,8 +1124,8 @@ int ServerObjectTemplate::_AttribMod::getListLength(const char *name) const */ void ServerObjectTemplate::_AttribMod::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1164,7 +1161,7 @@ char paramName[MAX_NAME_SIZE]; */ void ServerObjectTemplate::_AttribMod::save(Iff &file) { -int count; + int count; file.insertForm(_AttribMod_tag); @@ -1211,7 +1208,6 @@ int count; UNREF(count); } // ServerObjectTemplate::_AttribMod::save - //============================================================================= // class ServerObjectTemplate::_Contents @@ -1371,7 +1367,6 @@ bool ServerObjectTemplate::_Contents::isAppend(const char *name) const return TpfTemplate::isAppend(name); } // ServerObjectTemplate::_Contents::isAppend - int ServerObjectTemplate::_Contents::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -1385,8 +1380,8 @@ int ServerObjectTemplate::_Contents::getListLength(const char *name) const */ void ServerObjectTemplate::_Contents::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1418,7 +1413,7 @@ char paramName[MAX_NAME_SIZE]; */ void ServerObjectTemplate::_Contents::save(Iff &file) { -int count; + int count; file.insertForm(_Contents_tag); @@ -1453,7 +1448,6 @@ int count; UNREF(count); } // ServerObjectTemplate::_Contents::save - //============================================================================= // class ServerObjectTemplate::_MentalStateMod @@ -1641,7 +1635,6 @@ bool ServerObjectTemplate::_MentalStateMod::isAppend(const char *name) const return TpfTemplate::isAppend(name); } // ServerObjectTemplate::_MentalStateMod::isAppend - int ServerObjectTemplate::_MentalStateMod::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -1655,8 +1648,8 @@ int ServerObjectTemplate::_MentalStateMod::getListLength(const char *name) const */ void ServerObjectTemplate::_MentalStateMod::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1692,7 +1685,7 @@ char paramName[MAX_NAME_SIZE]; */ void ServerObjectTemplate::_MentalStateMod::save(Iff &file) { -int count; + int count; file.insertForm(_MentalStateMod_tag); @@ -1739,7 +1732,6 @@ int count; UNREF(count); } // ServerObjectTemplate::_MentalStateMod::save - //============================================================================= // class ServerObjectTemplate::_Xp @@ -1897,7 +1889,6 @@ bool ServerObjectTemplate::_Xp::isAppend(const char *name) const return TpfTemplate::isAppend(name); } // ServerObjectTemplate::_Xp::isAppend - int ServerObjectTemplate::_Xp::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -1911,8 +1902,8 @@ int ServerObjectTemplate::_Xp::getListLength(const char *name) const */ void ServerObjectTemplate::_Xp::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1944,7 +1935,7 @@ char paramName[MAX_NAME_SIZE]; */ void ServerObjectTemplate::_Xp::save(Iff &file) { -int count; + int count; file.insertForm(_Xp_tag); @@ -1979,4 +1970,4 @@ int count; UNREF(count); } // ServerObjectTemplate::_Xp::save -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp index 52fd36b3..980b1547 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp @@ -20,17 +20,17 @@ #include #include - - /** * Class constructor. */ ServerTangibleObjectTemplate::ServerTangibleObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerObjectTemplate(filename) - ,m_triggerVolumesLoaded(false) - ,m_triggerVolumesAppend(false) -//@END TFD INIT + , m_triggerVolumesLoaded(false) + , m_triggerVolumesAppend(false) + , m_templateVersion(0) + , m_versionOk(false) + //@END TFD INIT { } // ServerTangibleObjectTemplate::ServerTangibleObjectTemplate @@ -39,7 +39,7 @@ ServerTangibleObjectTemplate::ServerTangibleObjectTemplate(const std::string & f */ ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) @@ -49,7 +49,7 @@ ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate() } m_triggerVolumes.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate /** @@ -303,7 +303,6 @@ bool ServerTangibleObjectTemplate::isAppend(const char *name) const return ServerObjectTemplate::isAppend(name); } // ServerTangibleObjectTemplate::isAppend - int ServerTangibleObjectTemplate::getListLength(const char *name) const { if (strcmp(name, "triggerVolumes") == 0) @@ -322,8 +321,8 @@ int ServerTangibleObjectTemplate::getListLength(const char *name) const */ void ServerTangibleObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerTangibleObjectTemplate_tag) { @@ -333,7 +332,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -353,7 +352,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,4)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 4)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -418,18 +417,18 @@ char paramName[MAX_NAME_SIZE]; */ void ServerTangibleObjectTemplate::save(Iff &file) { -int count; + int count; file.insertForm(ServerTangibleObjectTemplate_tag); if (m_baseTemplateName.size() != 0) { - file.insertForm(TAG(D,E,R,V)); + file.insertForm(TAG(D, E, R, V)); file.insertChunk(TAG(X, X, X, X)); file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1); file.exitChunk(); file.exitForm(); } - file.insertForm(TAG(0,0,0,4)); + file.insertForm(TAG(0, 0, 0, 4)); file.allowNonlinearFunctions(); int paramCount = 0; @@ -446,7 +445,7 @@ int count; count = m_triggerVolumes.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_triggerVolumes[i]->saveToIff(file);} + m_triggerVolumes[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save combatSkeleton @@ -503,4 +502,4 @@ int count; file.exitForm(); } // ServerTangibleObjectTemplate::save -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp index 6aba5832..16239668 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp @@ -20,59 +20,59 @@ #include #include - - /** * Class constructor. */ ServerUberObjectTemplate::ServerUberObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : TpfTemplate(filename) - ,m_intListSimpleLoaded(false) - ,m_intListSimpleAppend(false) - ,m_intListWeightedListLoaded(false) - ,m_intListWeightedListAppend(false) - ,m_intListRandomRangeLoaded(false) - ,m_intListRandomRangeAppend(false) - ,m_intListDiceRollLoaded(false) - ,m_intListDiceRollAppend(false) - ,m_floatListSimpleLoaded(false) - ,m_floatListSimpleAppend(false) - ,m_floatListWeightedListLoaded(false) - ,m_floatListWeightedListAppend(false) - ,m_floatListRandomRangeLoaded(false) - ,m_floatListRandomRangeAppend(false) - ,m_enumListIndexedLoaded(false) - ,m_enumListIndexedAppend(false) - ,m_enumListWeightedListLoaded(false) - ,m_enumListWeightedListAppend(false) - ,m_stringIdListSimpleLoaded(false) - ,m_stringIdListSimpleAppend(false) - ,m_stringIdListWeightedListLoaded(false) - ,m_stringIdListWeightedListAppend(false) - ,m_stringListSimpleLoaded(false) - ,m_stringListSimpleAppend(false) - ,m_stringListWeightedListLoaded(false) - ,m_stringListWeightedListAppend(false) - ,m_triggerVolumeListLoaded(false) - ,m_triggerVolumeListAppend(false) - ,m_triggerVolumesListWeightedListLoaded(false) - ,m_triggerVolumesListWeightedListAppend(false) - ,m_boolListDerivedLoaded(false) - ,m_boolListDerivedAppend(false) - ,m_boolListSimpleLoaded(false) - ,m_boolListSimpleAppend(false) - ,m_boolListWeightedListLoaded(false) - ,m_boolListWeightedListAppend(false) - ,m_vectorListSimpleLoaded(false) - ,m_vectorListSimpleAppend(false) - ,m_filenameListSimpleLoaded(false) - ,m_filenameListSimpleAppend(false) - ,m_templateListSimpleLoaded(false) - ,m_templateListSimpleAppend(false) - ,m_structListSimpleLoaded(false) - ,m_structListSimpleAppend(false) -//@END TFD INIT + , m_intListSimpleLoaded(false) + , m_intListSimpleAppend(false) + , m_intListWeightedListLoaded(false) + , m_intListWeightedListAppend(false) + , m_intListRandomRangeLoaded(false) + , m_intListRandomRangeAppend(false) + , m_intListDiceRollLoaded(false) + , m_intListDiceRollAppend(false) + , m_floatListSimpleLoaded(false) + , m_floatListSimpleAppend(false) + , m_floatListWeightedListLoaded(false) + , m_floatListWeightedListAppend(false) + , m_floatListRandomRangeLoaded(false) + , m_floatListRandomRangeAppend(false) + , m_enumListIndexedLoaded(false) + , m_enumListIndexedAppend(false) + , m_enumListWeightedListLoaded(false) + , m_enumListWeightedListAppend(false) + , m_stringIdListSimpleLoaded(false) + , m_stringIdListSimpleAppend(false) + , m_stringIdListWeightedListLoaded(false) + , m_stringIdListWeightedListAppend(false) + , m_stringListSimpleLoaded(false) + , m_stringListSimpleAppend(false) + , m_stringListWeightedListLoaded(false) + , m_stringListWeightedListAppend(false) + , m_triggerVolumeListLoaded(false) + , m_triggerVolumeListAppend(false) + , m_triggerVolumesListWeightedListLoaded(false) + , m_triggerVolumesListWeightedListAppend(false) + , m_boolListDerivedLoaded(false) + , m_boolListDerivedAppend(false) + , m_boolListSimpleLoaded(false) + , m_boolListSimpleAppend(false) + , m_boolListWeightedListLoaded(false) + , m_boolListWeightedListAppend(false) + , m_vectorListSimpleLoaded(false) + , m_vectorListSimpleAppend(false) + , m_filenameListSimpleLoaded(false) + , m_filenameListSimpleAppend(false) + , m_templateListSimpleLoaded(false) + , m_templateListSimpleAppend(false) + , m_structListSimpleLoaded(false) + , m_structListSimpleAppend(false) + , m_templateVersion(0) + , m_versionOk(false) + //@END TFD INIT { } // ServerUberObjectTemplate::ServerUberObjectTemplate @@ -81,7 +81,7 @@ ServerUberObjectTemplate::ServerUberObjectTemplate(const std::string & filename) */ ServerUberObjectTemplate::~ServerUberObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_intListSimple.begin(); iter != m_intListSimple.end(); ++iter) @@ -258,7 +258,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() *iter = nullptr; } } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerUberObjectTemplate::~ServerUberObjectTemplate /** @@ -1772,7 +1772,6 @@ bool ServerUberObjectTemplate::isAppend(const char *name) const return TpfTemplate::isAppend(name); } // ServerUberObjectTemplate::isAppend - int ServerUberObjectTemplate::getListLength(const char *name) const { if (strcmp(name, "intListSimple") == 0) @@ -1923,8 +1922,8 @@ int ServerUberObjectTemplate::getListLength(const char *name) const */ void ServerUberObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerUberObjectTemplate_tag) { @@ -1934,7 +1933,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -1954,7 +1953,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -2654,18 +2653,18 @@ char paramName[MAX_NAME_SIZE]; */ void ServerUberObjectTemplate::save(Iff &file) { -int count; + int count; file.insertForm(ServerUberObjectTemplate_tag); if (m_baseTemplateName.size() != 0) { - file.insertForm(TAG(D,E,R,V)); + file.insertForm(TAG(D, E, R, V)); file.insertChunk(TAG(X, X, X, X)); file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1); file.exitChunk(); file.exitForm(); } - file.insertForm(TAG(0,0,0,0)); + file.insertForm(TAG(0, 0, 0, 0)); file.allowNonlinearFunctions(); int paramCount = 0; @@ -2784,7 +2783,7 @@ int count; count = m_intListSimple.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_intListSimple[i]->saveToIff(file);} + m_intListSimple[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_intListWeightedListLoaded) @@ -2799,7 +2798,7 @@ int count; count = m_intListWeightedList.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_intListWeightedList[i]->saveToIff(file);} + m_intListWeightedList[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_intListRandomRangeLoaded) @@ -2814,7 +2813,7 @@ int count; count = m_intListRandomRange.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_intListRandomRange[i]->saveToIff(file);} + m_intListRandomRange[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_intListDiceRollLoaded) @@ -2829,7 +2828,7 @@ int count; count = m_intListDiceRoll.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_intListDiceRoll[i]->saveToIff(file);} + m_intListDiceRoll[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save floatAtDerived @@ -2910,7 +2909,7 @@ int count; count = m_floatListSimple.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_floatListSimple[i]->saveToIff(file);} + m_floatListSimple[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_floatListWeightedListLoaded) @@ -2925,7 +2924,7 @@ int count; count = m_floatListWeightedList.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_floatListWeightedList[i]->saveToIff(file);} + m_floatListWeightedList[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_floatListRandomRangeLoaded) @@ -2940,7 +2939,7 @@ int count; count = m_floatListRandomRange.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_floatListRandomRange[i]->saveToIff(file);} + m_floatListRandomRange[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save enumIndexedByEnumSingle @@ -2949,7 +2948,7 @@ int count; count = 3; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 3; ++i) - m_enumIndexedByEnumSingle[i].saveToIff(file);} + m_enumIndexedByEnumSingle[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save enumIndexedByEnumWeightedList @@ -2958,7 +2957,7 @@ int count; count = 3; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 3; ++i) - m_enumIndexedByEnumWeightedList[i].saveToIff(file);} + m_enumIndexedByEnumWeightedList[i].saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_enumListIndexedLoaded) @@ -2973,7 +2972,7 @@ int count; count = m_enumListIndexed.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_enumListIndexed[i]->saveToIff(file);} + m_enumListIndexed[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_enumListWeightedListLoaded) @@ -2988,7 +2987,7 @@ int count; count = m_enumListWeightedList.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_enumListWeightedList[i]->saveToIff(file);} + m_enumListWeightedList[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save stringIdDerived @@ -3021,7 +3020,7 @@ int count; count = m_stringIdListSimple.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_stringIdListSimple[i]->saveToIff(file);} + m_stringIdListSimple[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_stringIdListWeightedListLoaded) @@ -3036,7 +3035,7 @@ int count; count = m_stringIdListWeightedList.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_stringIdListWeightedList[i]->saveToIff(file);} + m_stringIdListWeightedList[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save stringDerived @@ -3069,7 +3068,7 @@ int count; count = m_stringListSimple.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_stringListSimple[i]->saveToIff(file);} + m_stringListSimple[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_stringListWeightedListLoaded) @@ -3084,7 +3083,7 @@ int count; count = m_stringListWeightedList.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_stringListWeightedList[i]->saveToIff(file);} + m_stringListWeightedList[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save triggerVolumeDerived @@ -3117,7 +3116,7 @@ int count; count = m_triggerVolumeList.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_triggerVolumeList[i]->saveToIff(file);} + m_triggerVolumeList[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_triggerVolumesListWeightedListLoaded) @@ -3132,7 +3131,7 @@ int count; count = m_triggerVolumesListWeightedList.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_triggerVolumesListWeightedList[i]->saveToIff(file);} + m_triggerVolumesListWeightedList[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save boolDerived @@ -3165,7 +3164,7 @@ int count; count = m_boolListDerived.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_boolListDerived[i]->saveToIff(file);} + m_boolListDerived[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_boolListSimpleLoaded) @@ -3180,7 +3179,7 @@ int count; count = m_boolListSimple.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_boolListSimple[i]->saveToIff(file);} + m_boolListSimple[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_boolListWeightedListLoaded) @@ -3195,7 +3194,7 @@ int count; count = m_boolListWeightedList.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_boolListWeightedList[i]->saveToIff(file);} + m_boolListWeightedList[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save vectorAtDerived @@ -3222,7 +3221,7 @@ int count; count = m_vectorListSimple.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_vectorListSimple[i]->saveToIff(file);} + m_vectorListSimple[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save filenameAtDerived @@ -3255,7 +3254,7 @@ int count; count = m_filenameListSimple.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_filenameListSimple[i]->saveToIff(file);} + m_filenameListSimple[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save objvarDerived @@ -3300,7 +3299,7 @@ int count; count = m_templateListSimple.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_templateListSimple[i]->saveToIff(file);} + m_templateListSimple[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save structAtDerived @@ -3327,7 +3326,7 @@ int count; count = m_structListSimple.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_structListSimple[i]->saveToIff(file);} + m_structListSimple[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save structArrayEnum @@ -3336,7 +3335,7 @@ int count; count = 3; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 3; ++i) - m_structArrayEnum[i].saveToIff(file);} + m_structArrayEnum[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save structArrayInteger @@ -3345,7 +3344,7 @@ int count; count = 2; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 2; ++i) - m_structArrayInteger[i].saveToIff(file);} + m_structArrayInteger[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save integerArray @@ -3354,7 +3353,7 @@ int count; count = 2; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 2; ++i) - m_integerArray[i].saveToIff(file);} + m_integerArray[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save floatArray @@ -3363,7 +3362,7 @@ int count; count = 2; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 2; ++i) - m_floatArray[i].saveToIff(file);} + m_floatArray[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save stringArray @@ -3372,7 +3371,7 @@ int count; count = 2; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 2; ++i) - m_stringArray[i].saveToIff(file);} + m_stringArray[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save boolArray @@ -3381,7 +3380,7 @@ int count; count = 2; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 2; ++i) - m_boolArray[i].saveToIff(file);} + m_boolArray[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save stringIdArray @@ -3390,7 +3389,7 @@ int count; count = 2; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 2; ++i) - m_stringIdArray[i].saveToIff(file);} + m_stringIdArray[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save triggerArray @@ -3399,7 +3398,7 @@ int count; count = 2; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 2; ++i) - m_triggerArray[i].saveToIff(file);} + m_triggerArray[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save vectorArray @@ -3408,7 +3407,7 @@ int count; count = 2; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 2; ++i) - m_vectorArray[i].saveToIff(file);} + m_vectorArray[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save fileNameArray @@ -3417,7 +3416,7 @@ int count; count = 2; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 2; ++i) - m_fileNameArray[i].saveToIff(file);} + m_fileNameArray[i].saveToIff(file); } file.exitChunk(); ++paramCount; @@ -3432,7 +3431,6 @@ int count; file.exitForm(); } // ServerUberObjectTemplate::save - //============================================================================= // class ServerUberObjectTemplate::_Foo @@ -3594,7 +3592,6 @@ bool ServerUberObjectTemplate::_Foo::isAppend(const char *name) const return TpfTemplate::isAppend(name); } // ServerUberObjectTemplate::_Foo::isAppend - int ServerUberObjectTemplate::_Foo::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -3608,8 +3605,8 @@ int ServerUberObjectTemplate::_Foo::getListLength(const char *name) const */ void ServerUberObjectTemplate::_Foo::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -3641,7 +3638,7 @@ char paramName[MAX_NAME_SIZE]; */ void ServerUberObjectTemplate::_Foo::save(Iff &file) { -int count; + int count; file.insertForm(_Foo_tag); @@ -3676,4 +3673,4 @@ int count; UNREF(count); } // ServerUberObjectTemplate::_Foo::save -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp index 9c18023d..30332171 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp @@ -20,19 +20,19 @@ #include #include - - /** * Class constructor. */ SharedDraftSchematicObjectTemplate::SharedDraftSchematicObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedIntangibleObjectTemplate(filename) - ,m_slotsLoaded(false) - ,m_slotsAppend(false) - ,m_attributesLoaded(false) - ,m_attributesAppend(false) -//@END TFD INIT + , m_slotsLoaded(false) + , m_slotsAppend(false) + , m_attributesLoaded(false) + , m_attributesAppend(false) + , m_templateVersion(0) + , m_versionOk(false) + //@END TFD INIT { } // SharedDraftSchematicObjectTemplate::SharedDraftSchematicObjectTemplate @@ -41,7 +41,7 @@ SharedDraftSchematicObjectTemplate::SharedDraftSchematicObjectTemplate(const std */ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) @@ -60,7 +60,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() } m_attributes.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate /** @@ -252,7 +252,6 @@ bool SharedDraftSchematicObjectTemplate::isAppend(const char *name) const return SharedIntangibleObjectTemplate::isAppend(name); } // SharedDraftSchematicObjectTemplate::isAppend - int SharedDraftSchematicObjectTemplate::getListLength(const char *name) const { if (strcmp(name, "slots") == 0) @@ -275,8 +274,8 @@ int SharedDraftSchematicObjectTemplate::getListLength(const char *name) const */ void SharedDraftSchematicObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedDraftSchematicObjectTemplate_tag) { @@ -286,7 +285,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -306,7 +305,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,3)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 3)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -378,18 +377,18 @@ char paramName[MAX_NAME_SIZE]; */ void SharedDraftSchematicObjectTemplate::save(Iff &file) { -int count; + int count; file.insertForm(SharedDraftSchematicObjectTemplate_tag); if (m_baseTemplateName.size() != 0) { - file.insertForm(TAG(D,E,R,V)); + file.insertForm(TAG(D, E, R, V)); file.insertChunk(TAG(X, X, X, X)); file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1); file.exitChunk(); file.exitForm(); } - file.insertForm(TAG(0,0,0,3)); + file.insertForm(TAG(0, 0, 0, 3)); file.allowNonlinearFunctions(); int paramCount = 0; @@ -406,7 +405,7 @@ int count; count = m_slots.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_slots[i]->saveToIff(file);} + m_slots[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_attributesLoaded) @@ -421,7 +420,7 @@ int count; count = m_attributes.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_attributes[i]->saveToIff(file);} + m_attributes[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save craftedSharedTemplate @@ -442,7 +441,6 @@ int count; file.exitForm(); } // SharedDraftSchematicObjectTemplate::save - //============================================================================= // class SharedDraftSchematicObjectTemplate::_IngredientSlot @@ -588,7 +586,6 @@ bool SharedDraftSchematicObjectTemplate::_IngredientSlot::isAppend(const char *n return TpfTemplate::isAppend(name); } // SharedDraftSchematicObjectTemplate::_IngredientSlot::isAppend - int SharedDraftSchematicObjectTemplate::_IngredientSlot::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -602,8 +599,8 @@ int SharedDraftSchematicObjectTemplate::_IngredientSlot::getListLength(const cha */ void SharedDraftSchematicObjectTemplate::_IngredientSlot::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -633,7 +630,7 @@ char paramName[MAX_NAME_SIZE]; */ void SharedDraftSchematicObjectTemplate::_IngredientSlot::save(Iff &file) { -int count; + int count; file.insertForm(_IngredientSlot_tag); @@ -662,7 +659,6 @@ int count; UNREF(count); } // SharedDraftSchematicObjectTemplate::_IngredientSlot::save - //============================================================================= // class SharedDraftSchematicObjectTemplate::_SchematicAttribute @@ -822,7 +818,6 @@ bool SharedDraftSchematicObjectTemplate::_SchematicAttribute::isAppend(const cha return TpfTemplate::isAppend(name); } // SharedDraftSchematicObjectTemplate::_SchematicAttribute::isAppend - int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -836,8 +831,8 @@ int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getListLength(const */ void SharedDraftSchematicObjectTemplate::_SchematicAttribute::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -869,7 +864,7 @@ char paramName[MAX_NAME_SIZE]; */ void SharedDraftSchematicObjectTemplate::_SchematicAttribute::save(Iff &file) { -int count; + int count; file.insertForm(_SchematicAttribute_tag); @@ -904,4 +899,4 @@ int count; UNREF(count); } // SharedDraftSchematicObjectTemplate::_SchematicAttribute::save -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp index 10a66071..4d25f625 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp @@ -20,27 +20,27 @@ #include #include - - /** * Class constructor. */ SharedTangibleObjectTemplate::SharedTangibleObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedObjectTemplate(filename) - ,m_paletteColorCustomizationVariablesLoaded(false) - ,m_paletteColorCustomizationVariablesAppend(false) - ,m_rangedIntCustomizationVariablesLoaded(false) - ,m_rangedIntCustomizationVariablesAppend(false) - ,m_constStringCustomizationVariablesLoaded(false) - ,m_constStringCustomizationVariablesAppend(false) - ,m_socketDestinationsLoaded(false) - ,m_socketDestinationsAppend(false) - ,m_certificationsRequiredLoaded(false) - ,m_certificationsRequiredAppend(false) - ,m_customizationVariableMappingLoaded(false) - ,m_customizationVariableMappingAppend(false) -//@END TFD INIT + , m_paletteColorCustomizationVariablesLoaded(false) + , m_paletteColorCustomizationVariablesAppend(false) + , m_rangedIntCustomizationVariablesLoaded(false) + , m_rangedIntCustomizationVariablesAppend(false) + , m_constStringCustomizationVariablesLoaded(false) + , m_constStringCustomizationVariablesAppend(false) + , m_socketDestinationsLoaded(false) + , m_socketDestinationsAppend(false) + , m_certificationsRequiredLoaded(false) + , m_certificationsRequiredAppend(false) + , m_customizationVariableMappingLoaded(false) + , m_customizationVariableMappingAppend(false) + , m_templateVersion(0) + , m_versionOk(false) + //@END TFD INIT { } // SharedTangibleObjectTemplate::SharedTangibleObjectTemplate @@ -49,7 +49,7 @@ SharedTangibleObjectTemplate::SharedTangibleObjectTemplate(const std::string & f */ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) @@ -104,7 +104,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() } m_customizationVariableMapping.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate /** @@ -430,7 +430,6 @@ bool SharedTangibleObjectTemplate::isAppend(const char *name) const return SharedObjectTemplate::isAppend(name); } // SharedTangibleObjectTemplate::isAppend - int SharedTangibleObjectTemplate::getListLength(const char *name) const { if (strcmp(name, "paletteColorCustomizationVariables") == 0) @@ -469,8 +468,8 @@ int SharedTangibleObjectTemplate::getListLength(const char *name) const */ void SharedTangibleObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedTangibleObjectTemplate_tag) { @@ -480,7 +479,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -500,7 +499,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,1,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 1, 0)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -654,18 +653,18 @@ char paramName[MAX_NAME_SIZE]; */ void SharedTangibleObjectTemplate::save(Iff &file) { -int count; + int count; file.insertForm(SharedTangibleObjectTemplate_tag); if (m_baseTemplateName.size() != 0) { - file.insertForm(TAG(D,E,R,V)); + file.insertForm(TAG(D, E, R, V)); file.insertChunk(TAG(X, X, X, X)); file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1); file.exitChunk(); file.exitForm(); } - file.insertForm(TAG(0,0,1,0)); + file.insertForm(TAG(0, 0, 1, 0)); file.allowNonlinearFunctions(); int paramCount = 0; @@ -682,7 +681,7 @@ int count; count = m_paletteColorCustomizationVariables.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_paletteColorCustomizationVariables[i]->saveToIff(file);} + m_paletteColorCustomizationVariables[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_rangedIntCustomizationVariablesLoaded) @@ -697,7 +696,7 @@ int count; count = m_rangedIntCustomizationVariables.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_rangedIntCustomizationVariables[i]->saveToIff(file);} + m_rangedIntCustomizationVariables[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_constStringCustomizationVariablesLoaded) @@ -712,7 +711,7 @@ int count; count = m_constStringCustomizationVariables.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_constStringCustomizationVariables[i]->saveToIff(file);} + m_constStringCustomizationVariables[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_socketDestinationsLoaded) @@ -727,7 +726,7 @@ int count; count = m_socketDestinations.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_socketDestinations[i]->saveToIff(file);} + m_socketDestinations[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save structureFootprintFileName @@ -760,7 +759,7 @@ int count; count = m_certificationsRequired.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_certificationsRequired[i]->saveToIff(file);} + m_certificationsRequired[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_customizationVariableMappingLoaded) @@ -775,7 +774,7 @@ int count; count = m_customizationVariableMapping.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_customizationVariableMapping[i]->saveToIff(file);} + m_customizationVariableMapping[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save clientVisabilityFlag @@ -796,7 +795,6 @@ int count; file.exitForm(); } // SharedTangibleObjectTemplate::save - //============================================================================= // class SharedTangibleObjectTemplate::_ConstStringCustomizationVariable @@ -940,7 +938,6 @@ bool SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::isAppend(c return TpfTemplate::isAppend(name); } // SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::isAppend - int SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -954,8 +951,8 @@ int SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getListLeng */ void SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -985,7 +982,7 @@ char paramName[MAX_NAME_SIZE]; */ void SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::save(Iff &file) { -int count; + int count; file.insertForm(_ConstStringCustomizationVariable_tag); @@ -1014,7 +1011,6 @@ int count; UNREF(count); } // SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::save - //============================================================================= // class SharedTangibleObjectTemplate::_CustomizationVariableMapping @@ -1158,7 +1154,6 @@ bool SharedTangibleObjectTemplate::_CustomizationVariableMapping::isAppend(const return TpfTemplate::isAppend(name); } // SharedTangibleObjectTemplate::_CustomizationVariableMapping::isAppend - int SharedTangibleObjectTemplate::_CustomizationVariableMapping::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -1172,8 +1167,8 @@ int SharedTangibleObjectTemplate::_CustomizationVariableMapping::getListLength(c */ void SharedTangibleObjectTemplate::_CustomizationVariableMapping::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1203,7 +1198,7 @@ char paramName[MAX_NAME_SIZE]; */ void SharedTangibleObjectTemplate::_CustomizationVariableMapping::save(Iff &file) { -int count; + int count; file.insertForm(_CustomizationVariableMapping_tag); @@ -1232,7 +1227,6 @@ int count; UNREF(count); } // SharedTangibleObjectTemplate::_CustomizationVariableMapping::save - //============================================================================= // class SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable @@ -1392,7 +1386,6 @@ bool SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::isAppend( return TpfTemplate::isAppend(name); } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::isAppend - int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -1406,8 +1399,8 @@ int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getListLen */ void SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1439,7 +1432,7 @@ char paramName[MAX_NAME_SIZE]; */ void SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::save(Iff &file) { -int count; + int count; file.insertForm(_PaletteColorCustomizationVariable_tag); @@ -1474,7 +1467,6 @@ int count; UNREF(count); } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::save - //============================================================================= // class SharedTangibleObjectTemplate::_RangedIntCustomizationVariable @@ -1648,7 +1640,6 @@ bool SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::isAppend(con return TpfTemplate::isAppend(name); } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::isAppend - int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -1662,8 +1653,8 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getListLength */ void SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1697,7 +1688,7 @@ char paramName[MAX_NAME_SIZE]; */ void SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::save(Iff &file) { -int count; + int count; file.insertForm(_RangedIntCustomizationVariable_tag); @@ -1738,4 +1729,4 @@ int count; UNREF(count); } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::save -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedUtility/src/shared/OptionManager.cpp b/engine/shared/library/sharedUtility/src/shared/OptionManager.cpp index 2ba423ed..abeed4c3 100755 --- a/engine/shared/library/sharedUtility/src/shared/OptionManager.cpp +++ b/engine/shared/library/sharedUtility/src/shared/OptionManager.cpp @@ -27,12 +27,12 @@ namespace OptionManagerNamespace { - const Tag TAG_BOOL = TAG (B,O,O,L); - const Tag TAG_FLT = TAG3 (F,L,T); - const Tag TAG_INT = TAG3 (I,N,T); - const Tag TAG_OPTN = TAG (O,P,T,N); - const Tag TAG_STDS = TAG (S,T,D,S); - const Tag TAG_UNIS = TAG (U,N,I,S); + const Tag TAG_BOOL = TAG(B, O, O, L); + const Tag TAG_FLT = TAG3(F, L, T); + const Tag TAG_INT = TAG3(I, N, T); + const Tag TAG_OPTN = TAG(O, P, T, N); + const Tag TAG_STDS = TAG(S, T, D, S); + const Tag TAG_UNIS = TAG(U, N, I, S); bool ms_optionManagersEnabled = true; } @@ -43,29 +43,29 @@ using namespace OptionManagerNamespace; // PUBLIC Option //=================================================================== -OptionManager::Option::Option (Option::Type const type) : - m_version (0), - m_name (0), - m_section (0), - m_void (0), - m_type (type) +OptionManager::Option::Option(Option::Type const type) : + m_version(0), + m_name(0), + m_section(0), + m_void(0), + m_type(type) { } //------------------------------------------------------------------- -OptionManager::Option::~Option () +OptionManager::Option::~Option() { } //------------------------------------------------------------------- -OptionManager::Option::Option (Option const & rhs) : - m_version (rhs.m_version), - m_name (rhs.m_name), - m_section (rhs.m_section), - m_void (rhs.m_void), - m_type (rhs.m_type) +OptionManager::Option::Option(Option const & rhs) : + m_version(rhs.m_version), + m_name(rhs.m_name), + m_section(rhs.m_section), + m_void(rhs.m_void), + m_type(rhs.m_type) { } @@ -73,48 +73,48 @@ OptionManager::Option::Option (Option const & rhs) : OptionManager::Option & OptionManager::Option::operator= (Option const & rhs) { - m_version = rhs.m_version; - m_name = rhs.m_name; - m_section = rhs.m_section; - m_void = rhs.m_void; - m_type = rhs.m_type; + m_version = rhs.m_version; + m_name = rhs.m_name; + m_section = rhs.m_section; + m_void = rhs.m_void; + m_type = rhs.m_type; return *this; } //------------------------------------------------------------------- -OptionManager::Option::Type OptionManager::Option::getType () const +OptionManager::Option::Type OptionManager::Option::getType() const { return m_type; } //------------------------------------------------------------------- -void OptionManager::Option::debugDump (char const * operation) const +void OptionManager::Option::debugDump(char const * operation) const { UNREF(operation); switch (m_type) { case T_bool: - DEBUG_REPORT_LOG (true, ("OptionManager::Option %s (ver %d) [%s] %s=%s\n", operation, m_version, m_section, m_name, *m_bool ? "true" : "false")); + DEBUG_REPORT_LOG(true, ("OptionManager::Option %s (ver %d) [%s] %s=%s\n", operation, m_version, m_section, m_name, *m_bool ? "true" : "false")); break; case T_float: - DEBUG_REPORT_LOG (true, ("OptionManager::Option %s (ver %d) [%s] %s=%1.5f\n", operation, m_version, m_section, m_name, *m_float)); + DEBUG_REPORT_LOG(true, ("OptionManager::Option %s (ver %d) [%s] %s=%1.5f\n", operation, m_version, m_section, m_name, *m_float)); break; case T_int: - DEBUG_REPORT_LOG (true, ("OptionManager::Option %s (ver %d) [%s] %s=%i\n", operation, m_version, m_section, m_name, *m_int)); + DEBUG_REPORT_LOG(true, ("OptionManager::Option %s (ver %d) [%s] %s=%i\n", operation, m_version, m_section, m_name, *m_int)); break; case T_stdString: - DEBUG_REPORT_LOG (true, ("OptionManager::Option %s (ver %d) [%s] %s=%s\n", operation, m_version, m_section, m_name, m_stdString->c_str ())); + DEBUG_REPORT_LOG(true, ("OptionManager::Option %s (ver %d) [%s] %s=%s\n", operation, m_version, m_section, m_name, m_stdString->c_str())); break; case T_unicodeString: - DEBUG_REPORT_LOG (true, ("OptionManager::Option %s (ver %d) [%s] %s=%s\n", operation, m_version, m_section, m_name, Unicode::wideToNarrow(*m_unicodeString).c_str ())); + DEBUG_REPORT_LOG(true, ("OptionManager::Option %s (ver %d) [%s] %s=%s\n", operation, m_version, m_section, m_name, Unicode::wideToNarrow(*m_unicodeString).c_str())); break; default: @@ -133,24 +133,23 @@ void OptionManager::setOptionManagersEnabled(bool enabled) //---------------------------------------------------------------------- - -OptionManager::OptionManager () : - m_registeredOptionList (new OptionList), - m_savedOptionList (new OptionList), - m_stringList (new StringList), - m_boolList (new BoolList), - m_floatList (new FloatList), - m_intList (new IntList), - m_stdStringList (new StdStringList), - m_unicodeStringList (new UnicodeStringList) +OptionManager::OptionManager() : + m_registeredOptionList(new OptionList), + m_savedOptionList(new OptionList), + m_stringList(new StringList), + m_boolList(new BoolList), + m_floatList(new FloatList), + m_intList(new IntList), + m_stdStringList(new StdStringList), + m_unicodeStringList(new UnicodeStringList) { } //------------------------------------------------------------------- -OptionManager::~OptionManager () +OptionManager::~OptionManager() { - clearSavedLists (); + clearSavedLists(); delete m_registeredOptionList; delete m_savedOptionList; @@ -164,7 +163,7 @@ OptionManager::~OptionManager () //------------------------------------------------------------------- -void OptionManager::load (char const * const fileName) +void OptionManager::load(char const * const fileName) { if (!ms_optionManagersEnabled) return; @@ -174,246 +173,245 @@ void OptionManager::load (char const * const fileName) if (Iff::isValid(fileName)) { Iff iff; - if (iff.open (fileName, true)) + if (iff.open(fileName, true)) { if (iff.getCurrentName() == TAG_OPTN) { - load (iff); + load(iff); } else { - REPORT_LOG (true, ("OptionManager::load: %s not a valid options Iff\n", fileName)); + REPORT_LOG(true, ("OptionManager::load: %s not a valid options Iff\n", fileName)); } } } else { - REPORT_LOG (true, ("OptionManager::load: %s not a valid Iff\n", fileName)); + REPORT_LOG(true, ("OptionManager::load: %s not a valid Iff\n", fileName)); } } else { - REPORT_LOG (true, ("OptionManager::load: %s not found\n", fileName)); + REPORT_LOG(true, ("OptionManager::load: %s not found\n", fileName)); } if (ConfigSharedUtility::getLogOptionManager()) { - OptionList::iterator iter = m_savedOptionList->begin (); - for (; iter != m_savedOptionList->end (); ++iter) - iter->debugDump ("load"); + OptionList::iterator iter = m_savedOptionList->begin(); + for (; iter != m_savedOptionList->end(); ++iter) + iter->debugDump("load"); } } //------------------------------------------------------------------- -void OptionManager::save (char const * const fileName) +void OptionManager::save(char const * const fileName) { if (!ms_optionManagersEnabled) return; - Iff iff (1024); - save (iff); - if (!iff.write (fileName, true)) - DEBUG_REPORT_LOG (true, ("OptionManager::save: could not write %s\n", fileName)); + Iff iff(1024); + save(iff); + if (!iff.write(fileName, true)) + DEBUG_REPORT_LOG(true, ("OptionManager::save: could not write %s\n", fileName)); if (ConfigSharedUtility::getLogOptionManager()) { - OptionList::iterator iter = m_registeredOptionList->begin (); - for (; iter != m_registeredOptionList->end (); ++iter) - iter->debugDump ("save"); + OptionList::iterator iter = m_registeredOptionList->begin(); + for (; iter != m_registeredOptionList->end(); ++iter) + iter->debugDump("save"); } } //---------------------------------------------------------------------- -void OptionManager::clearSavedLists () +void OptionManager::clearSavedLists() { - m_savedOptionList->clear (); + m_savedOptionList->clear(); - std::for_each (m_stringList->begin (), m_stringList->end (), ArrayPointerDeleter ()); - m_stringList->clear (); + std::for_each(m_stringList->begin(), m_stringList->end(), ArrayPointerDeleter()); + m_stringList->clear(); - std::for_each (m_boolList->begin (), m_boolList->end (), PointerDeleter ()); - m_boolList->clear (); + std::for_each(m_boolList->begin(), m_boolList->end(), PointerDeleter()); + m_boolList->clear(); - std::for_each (m_floatList->begin (), m_floatList->end (), PointerDeleter ()); - m_floatList->clear (); + std::for_each(m_floatList->begin(), m_floatList->end(), PointerDeleter()); + m_floatList->clear(); - std::for_each (m_intList->begin (), m_intList->end (), PointerDeleter ()); - m_intList->clear (); + std::for_each(m_intList->begin(), m_intList->end(), PointerDeleter()); + m_intList->clear(); - std::for_each (m_stdStringList->begin (), m_stdStringList->end (), PointerDeleter ()); - m_stdStringList->clear (); + std::for_each(m_stdStringList->begin(), m_stdStringList->end(), PointerDeleter()); + m_stdStringList->clear(); - std::for_each (m_unicodeStringList->begin (), m_unicodeStringList->end (), PointerDeleter ()); - m_unicodeStringList->clear (); + std::for_each(m_unicodeStringList->begin(), m_unicodeStringList->end(), PointerDeleter()); + m_unicodeStringList->clear(); } //------------------------------------------------------------------- -void OptionManager::registerOption (bool & variable, char const * const section, char const * const name, const int version) +void OptionManager::registerOption(bool & variable, char const * const section, char const * const name, const int version) { - Option option (Option::T_bool); - option.m_bool = &variable; + Option option(Option::T_bool); + option.m_bool = &variable; option.m_section = section; - option.m_name = name; + option.m_name = name; option.m_version = version; - m_registeredOptionList->push_back (option); + m_registeredOptionList->push_back(option); - variable = findBool (section, name, variable, version); + variable = findBool(section, name, variable, version); } //------------------------------------------------------------------- -void OptionManager::registerOption (float & variable, char const * const section, char const * const name, const int version) +void OptionManager::registerOption(float & variable, char const * const section, char const * const name, const int version) { - Option option (Option::T_float); - option.m_float = &variable; + Option option(Option::T_float); + option.m_float = &variable; option.m_section = section; - option.m_name = name; + option.m_name = name; option.m_version = version; - m_registeredOptionList->push_back (option); + m_registeredOptionList->push_back(option); - variable = findFloat (section, name, variable, version); + variable = findFloat(section, name, variable, version); } //------------------------------------------------------------------- -void OptionManager::registerOption (int & variable, char const * const section, char const * const name, const int version) +void OptionManager::registerOption(int & variable, char const * const section, char const * const name, const int version) { - Option option (Option::T_int); - option.m_int = &variable; + Option option(Option::T_int); + option.m_int = &variable; option.m_section = section; - option.m_name = name; + option.m_name = name; option.m_version = version; - m_registeredOptionList->push_back (option); + m_registeredOptionList->push_back(option); - variable = findInt (section, name, variable, version); + variable = findInt(section, name, variable, version); } //---------------------------------------------------------------------- -void OptionManager::registerOption (std::string & variable, char const * const section, char const * const name, const int version) +void OptionManager::registerOption(std::string & variable, char const * const section, char const * const name, const int version) { - Option option (Option::T_stdString); - option.m_stdString = &variable; - option.m_section = section; - option.m_name = name; - option.m_version = version; - m_registeredOptionList->push_back (option); + Option option(Option::T_stdString); + option.m_stdString = &variable; + option.m_section = section; + option.m_name = name; + option.m_version = version; + m_registeredOptionList->push_back(option); - variable = findStdString (section, name, variable, version); + variable = findStdString(section, name, variable, version); } - //---------------------------------------------------------------------- -void OptionManager::registerOption (Unicode::String & variable, char const * const section, char const * const name, const int version) +void OptionManager::registerOption(Unicode::String & variable, char const * const section, char const * const name, const int version) { - Option option (Option::T_unicodeString); + Option option(Option::T_unicodeString); option.m_unicodeString = &variable; - option.m_section = section; - option.m_name = name; - option.m_version = version; - m_registeredOptionList->push_back (option); + option.m_section = section; + option.m_name = name; + option.m_version = version; + m_registeredOptionList->push_back(option); - variable = findUnicodeString (section, name, variable, version); + variable = findUnicodeString(section, name, variable, version); } //=================================================================== // STATIC PRIVATE OptionManager //=================================================================== -bool OptionManager::findBool (char const * const section, char const * const name, bool const defaultValue, const int version) +bool OptionManager::findBool(char const * const section, char const * const name, bool const defaultValue, const int version) { bool value = defaultValue; - OptionList::iterator iter = m_savedOptionList->begin (); - for (; iter != m_savedOptionList->end (); ++iter) + OptionList::iterator iter = m_savedOptionList->begin(); + for (; iter != m_savedOptionList->end(); ++iter) { const Option& option = *iter; - if (option.getType () == Option::T_bool && strcmp (section, option.m_section) == 0 && strcmp (name, option.m_name) == 0 && option.m_version == version) + if (section && (option.getType() == Option::T_bool && strcmp(section, option.m_section) == 0 && strcmp(name, option.m_name) == 0 && option.m_version == version)) { value = *option.m_bool; break; } } - if (section && name && ConfigFile::isInstalled ()) - return ConfigFile::getKeyBool (section, name, value, true); + if (section && name && ConfigFile::isInstalled()) + return ConfigFile::getKeyBool(section, name, value, true); return value; } //---------------------------------------------------------------------- -float OptionManager::findFloat (char const * const section, char const * const name, float const defaultValue, const int version) +float OptionManager::findFloat(char const * const section, char const * const name, float const defaultValue, const int version) { float value = defaultValue; - OptionList::iterator iter = m_savedOptionList->begin (); - for (; iter != m_savedOptionList->end (); ++iter) + OptionList::iterator iter = m_savedOptionList->begin(); + for (; iter != m_savedOptionList->end(); ++iter) { const Option& option = *iter; - if (option.getType () == Option::T_float && strcmp (section, option.m_section) == 0 && strcmp (name, option.m_name) == 0 && option.m_version == version) + if (section && (option.getType() == Option::T_float && strcmp(section, option.m_section) == 0 && strcmp(name, option.m_name) == 0 && option.m_version == version)) { value = *option.m_float; break; } } - if (section && name && ConfigFile::isInstalled ()) - return ConfigFile::getKeyFloat (section, name, value, true); + if (section && name && ConfigFile::isInstalled()) + return ConfigFile::getKeyFloat(section, name, value, true); return value; } //---------------------------------------------------------------------- -int OptionManager::findInt (char const * const section, char const * const name, int const defaultValue, const int version) +int OptionManager::findInt(char const * const section, char const * const name, int const defaultValue, const int version) { int value = defaultValue; - OptionList::iterator iter = m_savedOptionList->begin (); - for (; iter != m_savedOptionList->end (); ++iter) + OptionList::iterator iter = m_savedOptionList->begin(); + for (; iter != m_savedOptionList->end(); ++iter) { const Option& option = *iter; - if (option.getType () == Option::T_int && strcmp (section, option.m_section) == 0 && strcmp (name, option.m_name) == 0 && option.m_version == version) + if (section && (option.getType() == Option::T_int && strcmp(section, option.m_section) == 0 && strcmp(name, option.m_name) == 0 && option.m_version == version)) { value = *option.m_int; break; } } - if (section && name && ConfigFile::isInstalled ()) - return ConfigFile::getKeyInt (section, name, value, true); + if (section && name && ConfigFile::isInstalled()) + return ConfigFile::getKeyInt(section, name, value, true); return value; } //---------------------------------------------------------------------- -std::string OptionManager::findStdString (char const * const section, char const * const name, std::string const & defaultValue, const int version) +std::string OptionManager::findStdString(char const * const section, char const * const name, std::string const & defaultValue, const int version) { std::string value = defaultValue; - OptionList::iterator iter = m_savedOptionList->begin (); - for (; iter != m_savedOptionList->end (); ++iter) + OptionList::iterator iter = m_savedOptionList->begin(); + for (; iter != m_savedOptionList->end(); ++iter) { const Option& option = *iter; - if (option.getType () == Option::T_stdString && strcmp (section, option.m_section) == 0 && strcmp (name, option.m_name) == 0 && option.m_version == version) + if (section && (option.getType() == Option::T_stdString && strcmp(section, option.m_section) == 0 && strcmp(name, option.m_name) == 0 && option.m_version == version)) { - NOT_NULL (option.m_stdString); + NOT_NULL(option.m_stdString); value = *option.m_stdString; break; } } - if (section && name && ConfigFile::isInstalled ()) + if (section && name && ConfigFile::isInstalled()) { - const char * const str = ConfigFile::getKeyString (section, name, value.c_str (), true); + const char * const str = ConfigFile::getKeyString(section, name, value.c_str(), true); if (str) - return std::string (str); + return std::string(str); } return value; @@ -421,17 +419,17 @@ std::string OptionManager::findStdString (char const * const section, char const //---------------------------------------------------------------------- -Unicode::String OptionManager::findUnicodeString (char const * const section, char const * const name, Unicode::String const & defaultValue, const int version) +Unicode::String OptionManager::findUnicodeString(char const * const section, char const * const name, Unicode::String const & defaultValue, const int version) { Unicode::String value = defaultValue; - OptionList::iterator iter = m_savedOptionList->begin (); - for (; iter != m_savedOptionList->end (); ++iter) + OptionList::iterator iter = m_savedOptionList->begin(); + for (; iter != m_savedOptionList->end(); ++iter) { const Option& option = *iter; - if (option.getType () == Option::T_unicodeString && strcmp (section, option.m_section) == 0 && strcmp (name, option.m_name) == 0 && option.m_version == version) + if (option.getType() == Option::T_unicodeString && strcmp(section, option.m_section) == 0 && strcmp(name, option.m_name) == 0 && option.m_version == version) { - NOT_NULL (option.m_unicodeString); + NOT_NULL(option.m_unicodeString); value = *option.m_unicodeString; break; } @@ -444,285 +442,285 @@ Unicode::String OptionManager::findUnicodeString (char const * const section, ch //---------------------------------------------------------------------- -void OptionManager::load (Iff & iff) +void OptionManager::load(Iff & iff) { - iff.enterForm (TAG_OPTN); + iff.enterForm(TAG_OPTN); - int version = 0; + int version = 0; - switch (iff.getCurrentName ()) - { - case TAG_0000: - case TAG_0001: - WARNING (true, ("OptionManager::load: detected old version (below 0002), skipping load...")); - break; + switch (iff.getCurrentName()) + { + case TAG_0000: + case TAG_0001: + WARNING(true, ("OptionManager::load: detected old version (below 0002), skipping load...")); + break; // loading of version 0002 still supported in order to convert to version 0003 on save - case TAG_0002: - version = 2; - break; + case TAG_0002: + version = 2; + break; - case TAG_0003: - version = 3; - break; + case TAG_0003: + version = 3; + break; - default: - { - char tagBuffer [5]; - ConvertTagToString (iff.getCurrentName (), tagBuffer); + default: + { + char tagBuffer[5]; + ConvertTagToString(iff.getCurrentName(), tagBuffer); - char buffer [128]; - iff.formatLocation (buffer, sizeof (buffer)); - DEBUG_FATAL (true, ("OptionManager::load - invalid version %s/%s", buffer, tagBuffer)); - } - break; - } + char buffer[128]; + iff.formatLocation(buffer, sizeof(buffer)); + DEBUG_FATAL(true, ("OptionManager::load - invalid version %s/%s", buffer, tagBuffer)); + } + break; + } - if (version >= 2) - { - loadVersion(iff, version); - } + if (version >= 2) + { + loadVersion(iff, version); + } - iff.exitForm (TAG_OPTN, true); + iff.exitForm(TAG_OPTN, true); } //------------------------------------------------------------------- -void OptionManager::save (Iff & iff) +void OptionManager::save(Iff & iff) { - iff.insertForm (TAG_OPTN); + iff.insertForm(TAG_OPTN); - iff.insertForm (TAG_0003); + iff.insertForm(TAG_0003); - OptionList::iterator iter = m_registeredOptionList->begin (); - for (; iter != m_registeredOptionList->end (); ++iter) - { - const Option& option = *iter; + OptionList::iterator iter = m_registeredOptionList->begin(); + for (; iter != m_registeredOptionList->end(); ++iter) + { + const Option& option = *iter; - switch (option.getType ()) - { - case Option::T_bool: - { - iff.insertChunk (TAG_BOOL); + switch (option.getType()) + { + case Option::T_bool: + { + iff.insertChunk(TAG_BOOL); - iff.insertChunkData (static_cast (*option.m_bool ? 1 : 0)); - iff.insertChunkString (option.m_section); - iff.insertChunkString (option.m_name); - iff.insertChunkData (option.m_version); + iff.insertChunkData(static_cast (*option.m_bool ? 1 : 0)); + iff.insertChunkString(option.m_section); + iff.insertChunkString(option.m_name); + iff.insertChunkData(option.m_version); - iff.exitChunk (TAG_BOOL); - } - break; + iff.exitChunk(TAG_BOOL); + } + break; - case Option::T_float: - { - iff.insertChunk (TAG_FLT); + case Option::T_float: + { + iff.insertChunk(TAG_FLT); - iff.insertChunkData (*option.m_float); - iff.insertChunkString (option.m_section); - iff.insertChunkString (option.m_name); - iff.insertChunkData (option.m_version); + iff.insertChunkData(*option.m_float); + iff.insertChunkString(option.m_section); + iff.insertChunkString(option.m_name); + iff.insertChunkData(option.m_version); - iff.exitChunk (TAG_FLT); - } - break; + iff.exitChunk(TAG_FLT); + } + break; - case Option::T_int: - { - iff.insertChunk (TAG_INT); + case Option::T_int: + { + iff.insertChunk(TAG_INT); - iff.insertChunkData (*option.m_int); - iff.insertChunkString (option.m_section); - iff.insertChunkString (option.m_name); - iff.insertChunkData (option.m_version); + iff.insertChunkData(*option.m_int); + iff.insertChunkString(option.m_section); + iff.insertChunkString(option.m_name); + iff.insertChunkData(option.m_version); - iff.exitChunk (TAG_INT); - } - break; + iff.exitChunk(TAG_INT); + } + break; - case Option::T_stdString: - { - iff.insertChunk (TAG_STDS); + case Option::T_stdString: + { + iff.insertChunk(TAG_STDS); - iff.insertChunkString (option.m_stdString->c_str ()); - iff.insertChunkString (option.m_section); - iff.insertChunkString (option.m_name); - iff.insertChunkData (option.m_version); + iff.insertChunkString(option.m_stdString->c_str()); + iff.insertChunkString(option.m_section); + iff.insertChunkString(option.m_name); + iff.insertChunkData(option.m_version); - iff.exitChunk (TAG_STDS); - } - break; + iff.exitChunk(TAG_STDS); + } + break; - case Option::T_unicodeString: - { - iff.insertChunk (TAG_UNIS); + case Option::T_unicodeString: + { + iff.insertChunk(TAG_UNIS); - iff.insertChunkString (*option.m_unicodeString); - iff.insertChunkString (option.m_section); - iff.insertChunkString (option.m_name); - iff.insertChunkData (option.m_version); + iff.insertChunkString(*option.m_unicodeString); + iff.insertChunkString(option.m_section); + iff.insertChunkString(option.m_name); + iff.insertChunkData(option.m_version); - iff.exitChunk (TAG_UNIS); - } - break; + iff.exitChunk(TAG_UNIS); + } + break; - default: - break; - } - } + default: + break; + } + } - iff.exitForm (TAG_0003); + iff.exitForm(TAG_0003); - iff.exitForm (TAG_OPTN); + iff.exitForm(TAG_OPTN); } //------------------------------------------------------------------- void OptionManager::loadVersion(Iff & iff, const int version) { - clearSavedLists (); + clearSavedLists(); Tag versionTag = iff.getCurrentName(); - iff.enterForm (versionTag); + iff.enterForm(versionTag); - while (iff.getNumberOfBlocksLeft ()) + while (iff.getNumberOfBlocksLeft()) + { + switch (iff.getCurrentName()) { - switch (iff.getCurrentName ()) + case TAG_BOOL: + { + iff.enterChunk(TAG_BOOL); + + Option option(Option::T_bool); + option.m_bool = new bool; + *option.m_bool = iff.read_bool8(); + option.m_section = iff.read_string(); + option.m_name = iff.read_string(); + if (version > 2) { - case TAG_BOOL: - { - iff.enterChunk (TAG_BOOL); - - Option option (Option::T_bool); - option.m_bool = new bool; - *option.m_bool = iff.read_bool8 (); - option.m_section = iff.read_string (); - option.m_name = iff.read_string (); - if (version > 2) - { - option.m_version = iff.read_int32 (); - } - m_savedOptionList->push_back (option); - - //-- save these for deleting later - m_stringList->push_back (const_cast (option.m_section)); - m_stringList->push_back (const_cast (option.m_name)); - m_boolList->push_back (option.m_bool); - - iff.exitChunk (TAG_BOOL); - } - break; - - case TAG_FLT: - { - iff.enterChunk (TAG_FLT); - - Option option (Option::T_float); - option.m_float = new float; - *option.m_float = iff.read_float (); - option.m_section = iff.read_string (); - option.m_name = iff.read_string (); - if (version > 2) - { - option.m_version = iff.read_int32 (); - } - m_savedOptionList->push_back (option); - - //-- save these for deleting later - m_stringList->push_back (const_cast (option.m_section)); - m_stringList->push_back (const_cast (option.m_name)); - m_floatList->push_back (option.m_float); - - iff.exitChunk (TAG_FLT); - } - break; - - case TAG_INT: - { - iff.enterChunk (TAG_INT); - - Option option (Option::T_int); - option.m_int = new int; - *option.m_int = iff.read_int32 (); - option.m_section = iff.read_string (); - option.m_name = iff.read_string (); - if (version > 2) - { - option.m_version = iff.read_int32 (); - } - m_savedOptionList->push_back (option); - - //-- save these for deleting later - m_stringList->push_back (const_cast (option.m_section)); - m_stringList->push_back (const_cast (option.m_name)); - m_intList->push_back (option.m_int); - - iff.exitChunk (TAG_INT); - } - break; - - case TAG_STDS: - { - iff.enterChunk (TAG_STDS); - - Option option (Option::T_stdString); - option.m_stdString = new std::string; - *option.m_stdString = iff.read_stdstring (); - option.m_section = iff.read_string (); - option.m_name = iff.read_string (); - if (version > 2) - { - option.m_version = iff.read_int32 (); - } - m_savedOptionList->push_back (option); - - //-- save these for deleting later - m_stringList->push_back (const_cast (option.m_section)); - m_stringList->push_back (const_cast (option.m_name)); - m_stdStringList->push_back (option.m_stdString); - - iff.exitChunk (TAG_STDS); - } - break; - - case TAG_UNIS: - { - iff.enterChunk (TAG_UNIS); - - Option option (Option::T_unicodeString); - option.m_unicodeString = new Unicode::String; - *option.m_unicodeString = iff.read_unicodeString (); - option.m_section = iff.read_string (); - option.m_name = iff.read_string (); - if (version > 2) - { - option.m_version = iff.read_int32 (); - } - m_savedOptionList->push_back (option); - - //-- save these for deleting later - m_stringList->push_back (const_cast (option.m_section)); - m_stringList->push_back (const_cast (option.m_name)); - m_unicodeStringList->push_back (option.m_unicodeString); - - iff.exitChunk (TAG_UNIS); - } - break; - - default: - { - iff.enterChunk (); - iff.exitChunk (true); - } + option.m_version = iff.read_int32(); } + m_savedOptionList->push_back(option); + + //-- save these for deleting later + m_stringList->push_back(const_cast (option.m_section)); + m_stringList->push_back(const_cast (option.m_name)); + m_boolList->push_back(option.m_bool); + + iff.exitChunk(TAG_BOOL); } - - iff.exitForm (versionTag); + break; + + case TAG_FLT: + { + iff.enterChunk(TAG_FLT); + + Option option(Option::T_float); + option.m_float = new float; + *option.m_float = iff.read_float(); + option.m_section = iff.read_string(); + option.m_name = iff.read_string(); + if (version > 2) + { + option.m_version = iff.read_int32(); + } + m_savedOptionList->push_back(option); + + //-- save these for deleting later + m_stringList->push_back(const_cast (option.m_section)); + m_stringList->push_back(const_cast (option.m_name)); + m_floatList->push_back(option.m_float); + + iff.exitChunk(TAG_FLT); + } + break; + + case TAG_INT: + { + iff.enterChunk(TAG_INT); + + Option option(Option::T_int); + option.m_int = new int; + *option.m_int = iff.read_int32(); + option.m_section = iff.read_string(); + option.m_name = iff.read_string(); + if (version > 2) + { + option.m_version = iff.read_int32(); + } + m_savedOptionList->push_back(option); + + //-- save these for deleting later + m_stringList->push_back(const_cast (option.m_section)); + m_stringList->push_back(const_cast (option.m_name)); + m_intList->push_back(option.m_int); + + iff.exitChunk(TAG_INT); + } + break; + + case TAG_STDS: + { + iff.enterChunk(TAG_STDS); + + Option option(Option::T_stdString); + option.m_stdString = new std::string; + *option.m_stdString = iff.read_stdstring(); + option.m_section = iff.read_string(); + option.m_name = iff.read_string(); + if (version > 2) + { + option.m_version = iff.read_int32(); + } + m_savedOptionList->push_back(option); + + //-- save these for deleting later + m_stringList->push_back(const_cast (option.m_section)); + m_stringList->push_back(const_cast (option.m_name)); + m_stdStringList->push_back(option.m_stdString); + + iff.exitChunk(TAG_STDS); + } + break; + + case TAG_UNIS: + { + iff.enterChunk(TAG_UNIS); + + Option option(Option::T_unicodeString); + option.m_unicodeString = new Unicode::String; + *option.m_unicodeString = iff.read_unicodeString(); + option.m_section = iff.read_string(); + option.m_name = iff.read_string(); + if (version > 2) + { + option.m_version = iff.read_int32(); + } + m_savedOptionList->push_back(option); + + //-- save these for deleting later + m_stringList->push_back(const_cast (option.m_section)); + m_stringList->push_back(const_cast (option.m_name)); + m_unicodeStringList->push_back(option.m_unicodeString); + + iff.exitChunk(TAG_UNIS); + } + break; + + default: + { + iff.enterChunk(); + iff.exitChunk(true); + } + } + } + + iff.exitForm(versionTag); //-- copy the loaded values into any registered values - copyOptionListIntersection (*m_savedOptionList, *m_registeredOptionList); + copyOptionListIntersection(*m_savedOptionList, *m_registeredOptionList); } //---------------------------------------------------------------------- @@ -732,51 +730,51 @@ void OptionManager::loadVersion(Iff & iff, const int version) * The size of dst is unchanged. */ - void OptionManager::copyOptionListIntersection (const OptionList & src, OptionList & dst) +void OptionManager::copyOptionListIntersection(const OptionList & src, OptionList & dst) +{ + for (OptionList::const_iterator it = src.begin(); it != src.end(); ++it) { - for (OptionList::const_iterator it = src.begin (); it != src.end (); ++it) + const Option & sopt = *it; + + for (OptionList::iterator rit = dst.begin(); rit != dst.end(); ++rit) { - const Option & sopt = *it; + const Option & dopt = *rit; - for (OptionList::iterator rit = dst.begin (); rit != dst.end (); ++rit) + if (dopt.m_name && sopt.m_name && !strcmp(dopt.m_name, sopt.m_name) && + dopt.m_section && sopt.m_section && !strcmp(dopt.m_section, sopt.m_section) && + dopt.m_type == sopt.m_type && + dopt.m_version == sopt.m_version) // default value takes precedence when version changes { - const Option & dopt = *rit; - - if (dopt.m_name && sopt.m_name && !strcmp (dopt.m_name, sopt.m_name) && - dopt.m_section && sopt.m_section && !strcmp (dopt.m_section, sopt.m_section) && - dopt.m_type == sopt.m_type && - dopt.m_version == sopt.m_version) // default value takes precedence when version changes + switch (dopt.m_type) { - switch (dopt.m_type) - { - case Option::T_bool: - NOT_NULL (dopt.m_bool); - NOT_NULL (sopt.m_bool); - *dopt.m_bool = *sopt.m_bool; - break; - case Option::T_float: - NOT_NULL (dopt.m_float); - NOT_NULL (sopt.m_float); - *dopt.m_float = *sopt.m_float; - break; - case Option::T_int: - NOT_NULL (dopt.m_int); - NOT_NULL (sopt.m_int); - *dopt.m_int = *sopt.m_int; - break; - case Option::T_stdString: - NOT_NULL (dopt.m_stdString); - NOT_NULL (sopt.m_stdString); - *dopt.m_stdString = *sopt.m_stdString; - break; - case Option::T_unicodeString: - NOT_NULL (dopt.m_unicodeString); - NOT_NULL (sopt.m_unicodeString); - *dopt.m_unicodeString = *sopt.m_unicodeString; - break; - } + case Option::T_bool: + NOT_NULL(dopt.m_bool); + NOT_NULL(sopt.m_bool); + *dopt.m_bool = *sopt.m_bool; + break; + case Option::T_float: + NOT_NULL(dopt.m_float); + NOT_NULL(sopt.m_float); + *dopt.m_float = *sopt.m_float; + break; + case Option::T_int: + NOT_NULL(dopt.m_int); + NOT_NULL(sopt.m_int); + *dopt.m_int = *sopt.m_int; + break; + case Option::T_stdString: + NOT_NULL(dopt.m_stdString); + NOT_NULL(sopt.m_stdString); + *dopt.m_stdString = *sopt.m_stdString; + break; + case Option::T_unicodeString: + NOT_NULL(dopt.m_unicodeString); + NOT_NULL(sopt.m_unicodeString); + *dopt.m_unicodeString = *sopt.m_unicodeString; + break; } } } } -//=================================================================== +} +//=================================================================== \ No newline at end of file diff --git a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskLocateStructure.cpp b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskLocateStructure.cpp index 1bafa34a..8fae32e4 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskLocateStructure.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskLocateStructure.cpp @@ -19,12 +19,15 @@ // ====================================================================== TaskLocateStructure::TaskLocateStructure(const NetworkId &itemId, const std::string &whoRequested) : - TaskRequest(), - m_itemId(itemId), - m_whoRequested(whoRequested) + TaskRequest(), + m_itemId(itemId), + m_whoRequested(whoRequested), + m_x(0), + m_z(0), + m_found(false) { } - + //----------------------------------------------------------------------- TaskLocateStructure::~TaskLocateStructure() @@ -38,7 +41,7 @@ bool TaskLocateStructure::process(DB::Session *session) LocateStructureQuery query; query.item_id = m_itemId; - if (! (session->exec(&query))) + if (!(session->exec(&query))) return false; query.done(); @@ -49,8 +52,8 @@ bool TaskLocateStructure::process(DB::Session *session) m_z = query.z.getValue(); m_sceneId = query.sceneId.getValueASCII(); } - - LOG("CustomerService", ("playerStructure: Locate structure (%s): result %s", m_itemId.getValueString().c_str(), (m_found? "found": "not found"))); + + LOG("CustomerService", ("playerStructure: Locate structure (%s): result %s", m_itemId.getValueString().c_str(), (m_found ? "found" : "not found"))); return true; } @@ -77,7 +80,7 @@ void TaskLocateStructure::onComplete() void TaskLocateStructure::LocateStructureQuery::getSQL(std::string &sql) { - sql=std::string("begin ") + DatabaseProcess::getInstance().getSchemaQualifier()+"loader.locate_structure(:item_id, :x, :z, :scene_id, :found); end;"; + sql = std::string("begin ") + DatabaseProcess::getInstance().getSchemaQualifier() + "loader.locate_structure(:item_id, :x, :z, :scene_id, :found); end;"; } // ---------------------------------------------------------------------- @@ -89,7 +92,7 @@ bool TaskLocateStructure::LocateStructureQuery::bindParameters() if (!bindParameter(z)) return false; if (!bindParameter(sceneId)) return false; if (!bindParameter(found)) return false; - + return true; } @@ -113,4 +116,4 @@ TaskLocateStructure::LocateStructureQuery::LocateStructureQuery() { } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskMoveToPlayer.cpp b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskMoveToPlayer.cpp index 529feb79..294bd378 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskMoveToPlayer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskMoveToPlayer.cpp @@ -18,13 +18,14 @@ // ====================================================================== TaskMoveToPlayer::TaskMoveToPlayer(const NetworkId &oid, const NetworkId &player, const std::string &whoRequested) : - TaskRequest(), - m_oid(oid), - m_player(player), - m_whoRequested(whoRequested) + TaskRequest(), + m_oid(oid), + m_player(player), + m_whoRequested(whoRequested), + m_result(0) { } - + //----------------------------------------------------------------------- TaskMoveToPlayer::~TaskMoveToPlayer() @@ -38,13 +39,13 @@ bool TaskMoveToPlayer::process(DB::Session *session) MoveToPlayerQuery query; query.oid = m_oid; query.player = m_player; - - if (! (session->exec(&query))) + + if (!(session->exec(&query))) return false; query.done(); m_result = query.result.getValue(); - + LOG("DatabaseRestore", ("Move Item (%s) to Player (%s): result %i", m_oid.getValueString().c_str(), m_player.getValueString().c_str(), m_result)); return true; } @@ -56,81 +57,81 @@ void TaskMoveToPlayer::onComplete() std::string message; switch (m_result) { - case 1: - message = "Item moved. (It may not reappear until the next server restart.)"; - break; + case 1: + message = "Item moved. (It may not reappear until the next server restart.)"; + break; - case 2: - message = "Could not find player's inventory"; - break; + case 2: + message = "Could not find player's inventory"; + break; - case 3: - message = "Object id does not exist"; - break; + case 3: + message = "Object id does not exist"; + break; - case 4: - message = "The database returned an unknown error code"; - break; + case 4: + message = "The database returned an unknown error code"; + break; - case 5: - message = "Object id cannot be a player"; - break; + case 5: + message = "Object id cannot be a player"; + break; - case 6: - message = "Object id cannot be object/tangible/inventory/character_inventory.iff"; - break; + case 6: + message = "Object id cannot be object/tangible/inventory/character_inventory.iff"; + break; - case 7: - message = "Object id cannot be object/tangible/mission_bag/mission_bag.iff"; - break; + case 7: + message = "Object id cannot be object/tangible/mission_bag/mission_bag.iff"; + break; - case 8: - message = "Object id cannot be object/tangible/datapad/character_datapad.iff"; - break; + case 8: + message = "Object id cannot be object/tangible/datapad/character_datapad.iff"; + break; - case 9: - message = "Object id cannot be object/tangible/bank/character_bank.iff"; - break; + case 9: + message = "Object id cannot be object/tangible/bank/character_bank.iff"; + break; - case 10: - message = "Object id cannot be object/weapon/melee/unarmed/unarmed_default_player.iff"; - break; + case 10: + message = "Object id cannot be object/weapon/melee/unarmed/unarmed_default_player.iff"; + break; - case 11: - message = "Object id cannot be object/player/player.iff"; - break; + case 11: + message = "Object id cannot be object/player/player.iff"; + break; - case 12: - message = "Object id cannot be object/cell/cell.iff"; - break; + case 12: + message = "Object id cannot be object/cell/cell.iff"; + break; - case 13: - message = "Object id cannot be object/tangible/inventory/vendor_inventory.iff"; - break; + case 13: + message = "Object id cannot be object/tangible/inventory/vendor_inventory.iff"; + break; - case 14: - message = "Object cannot be contained directly by a datapad"; - break; - - case 15: - message = "Object cannot be a building"; - break; - - case 16: - message = "Object cannot be an installation"; - break; - - case 17: - message = "Object cannot be a ship"; - break; - - default: - message = "admin.move_item_to_player() returned an unknown error code"; - break; + case 14: + message = "Object cannot be contained directly by a datapad"; + break; + + case 15: + message = "Object cannot be a building"; + break; + + case 16: + message = "Object cannot be an installation"; + break; + + case 17: + message = "Object cannot be a ship"; + break; + + default: + message = "admin.move_item_to_player() returned an unknown error code"; + break; } - + GenericValueTypeMessage > reply("DatabaseConsoleReplyMessage", - std::make_pair(m_whoRequested, message)); + std::make_pair(m_whoRequested, message)); DatabaseProcess::getInstance().sendToAnyGameServer(reply); } @@ -138,7 +139,7 @@ void TaskMoveToPlayer::onComplete() void TaskMoveToPlayer::MoveToPlayerQuery::getSQL(std::string &sql) { - sql=std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier()+"admin.move_item_to_player (:item_id, :player_id); end;"; + sql = std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier() + "admin.move_item_to_player (:item_id, :player_id); end;"; } // ---------------------------------------------------------------------- @@ -148,7 +149,7 @@ bool TaskMoveToPlayer::MoveToPlayerQuery::bindParameters() if (!bindParameter(result)) return false; if (!bindParameter(oid)) return false; if (!bindParameter(player)) return false; - + return true; } @@ -172,4 +173,4 @@ TaskMoveToPlayer::MoveToPlayerQuery::MoveToPlayerQuery() { } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreCharacter.cpp b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreCharacter.cpp index 863c7004..ae975a1e 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreCharacter.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreCharacter.cpp @@ -18,12 +18,15 @@ // ====================================================================== TaskRestoreCharacter::TaskRestoreCharacter(const NetworkId &characterId, const std::string &whoRequested) : - TaskRequest(), - m_characterId(characterId), - m_whoRequested(whoRequested) + TaskRequest(), + m_characterId(characterId), + m_whoRequested(whoRequested), + m_result(0), + m_account(0), + m_templateId(0) { } - + //----------------------------------------------------------------------- TaskRestoreCharacter::~TaskRestoreCharacter() @@ -36,8 +39,8 @@ bool TaskRestoreCharacter::process(DB::Session *session) { RestoreCharacterQuery query; query.character_id = m_characterId; - - if (! (session->exec(&query))) + + if (!(session->exec(&query))) return false; query.done(); @@ -45,7 +48,7 @@ bool TaskRestoreCharacter::process(DB::Session *session) query.character_name.getValue(m_characterName); query.account.getValue(m_account); query.template_id.getValue(m_templateId); - + LOG("DatabaseRestore", ("Restore Character (%s): result %i", m_characterId.getValueString().c_str(), m_result)); return true; } @@ -54,7 +57,7 @@ bool TaskRestoreCharacter::process(DB::Session *session) void TaskRestoreCharacter::onComplete() { - if (m_result==1) + if (m_result == 1) { LoginRestoreCharacterMessage msg(m_whoRequested, m_characterId, m_account, m_characterName, m_templateId, false); //TODO: "/restoreJedi" command DatabaseProcess::getInstance().sendToCentralServer(msg, true); @@ -64,21 +67,21 @@ void TaskRestoreCharacter::onComplete() std::string message; switch (m_result) { - case 2: - message = "Object id was incorrect or character was not deleted"; - break; + case 2: + message = "Object id was incorrect or character was not deleted"; + break; - case 3: - message = "There was an error in the database while attempting to restore the character."; - break; + case 3: + message = "There was an error in the database while attempting to restore the character."; + break; - default: - message = "The database returned an unknown code in response to the request to restore the character."; - break; + default: + message = "The database returned an unknown code in response to the request to restore the character."; + break; } - + GenericValueTypeMessage > reply("DatabaseConsoleReplyMessage", - std::make_pair(m_whoRequested, message)); + std::make_pair(m_whoRequested, message)); DatabaseProcess::getInstance().sendToAnyGameServer(reply); } } @@ -87,7 +90,7 @@ void TaskRestoreCharacter::onComplete() void TaskRestoreCharacter::RestoreCharacterQuery::getSQL(std::string &sql) { - sql=std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier()+"admin.restore_character (:character_id, :character_name, :account, :template_id); end;"; + sql = std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier() + "admin.restore_character (:character_id, :character_name, :account, :template_id); end;"; } // ---------------------------------------------------------------------- @@ -99,7 +102,7 @@ bool TaskRestoreCharacter::RestoreCharacterQuery::bindParameters() if (!bindParameter(character_name)) return false; if (!bindParameter(account)) return false; if (!bindParameter(template_id)) return false; - + return true; } @@ -123,4 +126,4 @@ TaskRestoreCharacter::RestoreCharacterQuery::RestoreCharacterQuery() { } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreHouse.cpp b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreHouse.cpp index 21457af1..adf76c6d 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreHouse.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreHouse.cpp @@ -18,12 +18,13 @@ // ====================================================================== TaskRestoreHouse::TaskRestoreHouse(const NetworkId &houseId, const std::string &whoRequested) : - TaskRequest(), - m_houseId(houseId), - m_whoRequested(whoRequested) + TaskRequest(), + m_houseId(houseId), + m_whoRequested(whoRequested), + m_result(0) { } - + //----------------------------------------------------------------------- TaskRestoreHouse::~TaskRestoreHouse() @@ -36,13 +37,13 @@ bool TaskRestoreHouse::process(DB::Session *session) { RestoreHouseQuery query; query.house_id = m_houseId; - - if (! (session->exec(&query))) + + if (!(session->exec(&query))) return false; query.done(); m_result = query.result.getValue(); - + LOG("DatabaseRestore", ("Restore house (%s): result %i", m_houseId.getValueString().c_str(), m_result)); return true; } @@ -54,25 +55,25 @@ void TaskRestoreHouse::onComplete() std::string message; switch (m_result) { - case 1: - message = "House restored. (It may not reappear until the next server restart.)"; - break; + case 1: + message = "House restored. (It may not reappear until the next server restart.)"; + break; - case 2: - message = "Object id was incorrect or house was not deleted"; - break; + case 2: + message = "Object id was incorrect or house was not deleted"; + break; - case 3: - message = "There was an error in the database while attempting to restore the house."; - break; + case 3: + message = "There was an error in the database while attempting to restore the house."; + break; - default: - message = "The database returned an unknown code in response to the request to restore the house."; - break; + default: + message = "The database returned an unknown code in response to the request to restore the house."; + break; } - + GenericValueTypeMessage > reply("DatabaseConsoleReplyMessage", - std::make_pair(m_whoRequested, message)); + std::make_pair(m_whoRequested, message)); DatabaseProcess::getInstance().sendToAnyGameServer(reply); } @@ -80,7 +81,7 @@ void TaskRestoreHouse::onComplete() void TaskRestoreHouse::RestoreHouseQuery::getSQL(std::string &sql) { - sql=std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier()+"admin.restore_house (:house_id); end;"; + sql = std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier() + "admin.restore_house (:house_id); end;"; } // ---------------------------------------------------------------------- @@ -89,7 +90,7 @@ bool TaskRestoreHouse::RestoreHouseQuery::bindParameters() { if (!bindParameter(result)) return false; if (!bindParameter(house_id)) return false; - + return true; } @@ -113,4 +114,4 @@ TaskRestoreHouse::RestoreHouseQuery::RestoreHouseQuery() { } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskUndeleteItem.cpp b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskUndeleteItem.cpp index b81b3243..c74f302d 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskUndeleteItem.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskUndeleteItem.cpp @@ -18,12 +18,13 @@ // ====================================================================== TaskUndeleteItem::TaskUndeleteItem(const NetworkId &itemId, const std::string &whoRequested) : - TaskRequest(), - m_itemId(itemId), - m_whoRequested(whoRequested) + TaskRequest(), + m_itemId(itemId), + m_whoRequested(whoRequested), + m_result(0) { } - + //----------------------------------------------------------------------- TaskUndeleteItem::~TaskUndeleteItem() @@ -37,12 +38,12 @@ bool TaskUndeleteItem::process(DB::Session *session) UndeleteItemQuery query; query.item_id = m_itemId; - if (! (session->exec(&query))) + if (!(session->exec(&query))) return false; query.done(); m_result = query.result.getValue(); - + LOG("DatabaseRestore", ("Undelete Item (%s): result %i", m_itemId.getValueString().c_str(), m_result)); return true; } @@ -54,29 +55,29 @@ void TaskUndeleteItem::onComplete() std::string message; switch (m_result) { - case 1: - message = "Item restored."; - break; + case 1: + message = "Item restored."; + break; - case 2: - message = "Object id was incorrect or item was not deleted"; - break; + case 2: + message = "Object id was incorrect or item was not deleted"; + break; - case 3: - message = "There was an error in the database while attempting to undelete the item."; - break; - case 4: - message = "Item restored. Loading this item from database..."; - Loader::getInstance().locateStructure(m_itemId, m_whoRequested); - break; + case 3: + message = "There was an error in the database while attempting to undelete the item."; + break; + case 4: + message = "Item restored. Loading this item from database..."; + Loader::getInstance().locateStructure(m_itemId, m_whoRequested); + break; - default: - message = "The database returned an unknown code in response to the request to undelete the item."; - break; + default: + message = "The database returned an unknown code in response to the request to undelete the item."; + break; } - + GenericValueTypeMessage > reply("DatabaseConsoleReplyMessage", - std::make_pair(m_whoRequested, message)); + std::make_pair(m_whoRequested, message)); DatabaseProcess::getInstance().sendToAnyGameServer(reply); } @@ -84,7 +85,7 @@ void TaskUndeleteItem::onComplete() void TaskUndeleteItem::UndeleteItemQuery::getSQL(std::string &sql) { - sql=std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier()+"admin.undelete_item (:item_id); end;"; + sql = std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier() + "admin.undelete_item (:item_id); end;"; } // ---------------------------------------------------------------------- @@ -93,7 +94,7 @@ bool TaskUndeleteItem::UndeleteItemQuery::bindParameters() { if (!bindParameter(result)) return false; if (!bindParameter(item_id)) return false; - + return true; } @@ -117,4 +118,4 @@ TaskUndeleteItem::UndeleteItemQuery::UndeleteItemQuery() { } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp b/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp index aaf9f5a9..734633e2 100755 --- a/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp +++ b/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerJediManagerObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerJediManagerObjectTemplate::ServerJediManagerObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerUniverseObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerJediManagerObjectTemplate::ServerJediManagerObjectTemplate @@ -45,8 +45,8 @@ ServerJediManagerObjectTemplate::ServerJediManagerObjectTemplate(const std::stri */ ServerJediManagerObjectTemplate::~ServerJediManagerObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerJediManagerObjectTemplate::~ServerJediManagerObjectTemplate /** @@ -131,8 +131,8 @@ void ServerJediManagerObjectTemplate::testValues(void) const */ void ServerJediManagerObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerJediManagerObjectTemplate_tag) { @@ -142,7 +142,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -162,7 +162,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -183,4 +183,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerJediManagerObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h b/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h index 118e2167..c6dbe0da 100755 --- a/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h +++ b/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h @@ -6,7 +6,6 @@ // //======================================================================== - #ifndef _INCLUDED_CombatEngineData_H #define _INCLUDED_CombatEngineData_H @@ -67,19 +66,19 @@ namespace CombatEngineData enum DamageType { - DT_none = 0x00000000, - DT_kinetic = 0x00000001, - DT_energy = 0x00000002, - DT_blast = 0x00000004, - DT_stun = 0x00000008, - DT_restraint = 0x00000010, - DT_elemental_heat = 0x00000020, - DT_elemental_cold = 0x00000040, - DT_elemental_acid = 0x00000080, - DT_elemental_eletrical = 0x00000100, - DT_environmental_heat = 0x00000200, - DT_environmental_cold = 0x00000400, - DT_environmental_acid = 0x00000800, + DT_none = 0x00000000, + DT_kinetic = 0x00000001, + DT_energy = 0x00000002, + DT_blast = 0x00000004, + DT_stun = 0x00000008, + DT_restraint = 0x00000010, + DT_elemental_heat = 0x00000020, + DT_elemental_cold = 0x00000040, + DT_elemental_acid = 0x00000080, + DT_elemental_eletrical = 0x00000100, + DT_environmental_heat = 0x00000200, + DT_environmental_cold = 0x00000400, + DT_environmental_acid = 0x00000800, DT_environmental_electrical = 0x00001000 }; @@ -109,14 +108,14 @@ namespace CombatEngineData NetworkId::NetworkIdType target; // if only one target is given NetworkId::NetworkIdType *targets; // for multiple targets } targetData; - + struct { //@todo make this a NetworkId NetworkId::NetworkIdType weapon; // if 0, use attacker's primary weapon int mode; // 0 = primary, 1 = secondary, etc } attackData; - + int attitudeData; Postures::Enumerator postureData; } actionData; @@ -137,23 +136,23 @@ namespace CombatEngineData { DamageData(void); - std::vector damage;// list of attribute modifiers this damage - // caused, pre armor effectiveness - CachedNetworkId attackerId; // who caused the damage (nullptr for - // environmental effects, etc) + std::vector damage;// list of attribute modifiers this damage + // caused, pre armor effectiveness + CachedNetworkId attackerId; // who caused the damage (nullptr for + // environmental effects, etc) NetworkId weaponId; // id of the weapon used DamageType damageType; uint16 hitLocationIndex; uint16 actionId; bool wounded; bool ignoreInvulnerable; -// MessageQueueCombatAction * combatActionMessage; + // MessageQueueCombatAction * combatActionMessage; }; struct DefenseData { - std::vector damage; // list of damage I have taken this - // timeslice + std::vector damage; // list of damage I have taken this + // timeslice }; struct CombatData @@ -162,7 +161,6 @@ namespace CombatEngineData DefenseData defenseData; }; - //-------------------------------------------------- // CombatEngineData inline functions @@ -171,6 +169,7 @@ namespace CombatEngineData type = none; memset(&actionData, 0, sizeof(actionData)); sequenceId = 0; + targetSelf = 0; } // ActionItem::ActionItem inline ActionItem::~ActionItem(void) @@ -195,13 +194,11 @@ namespace CombatEngineData actionId(0), wounded(false), ignoreInvulnerable(false) -// combatActionMessage(nullptr) - { - } - + // combatActionMessage(nullptr) + { + } const char *const getCombatDefenseName(CombatDefense combatDefense); }; - #endif // _INCLUDED_CombatEngineData_H