From c7a2040fdc5d8796e50cf3231c88a6cf7fb16a0f Mon Sep 17 00:00:00 2001 From: SoftCoder Date: Sat, 1 Feb 2014 10:27:11 -0800 Subject: [PATCH] - added more verbose info when tracking network CRC --- source/glest_game/type_instances/unit.cpp | 33 ++++++++++++++++++----- source/glest_game/type_instances/unit.h | 2 +- source/tests/CMakeLists.txt | 10 ++++++- 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index e99f715a6..cceac3eff 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -2241,10 +2241,31 @@ int64 Unit::getUpdatedProgress(int64 currentProgress, int64 updateFPS, int64 spe } if(isNetworkCRCEnabled() == true) { + float height = map->getCell(pos)->getHeight(); + float airHeight = game->getWorld()->getTileset()->getAirHeight(); + int cellUnitHeight = -1; + int cellObjectHeight = -1; + + Unit *unit = map->getCell(pos)->getUnit(fLand); + if(unit != NULL && unit->getType()->getHeight() > airHeight) { + cellUnitHeight = unit->getType()->getHeight(); + } + else { + SurfaceCell *sc = map->getSurfaceCell(map->toSurfCoords(pos)); + if(sc != NULL && sc->getObject() != NULL && sc->getObject()->getType() != NULL) { + if(sc->getObject()->getType()->getHeight() > airHeight) { + cellObjectHeight = sc->getObject()->getType()->getHeight(); + } + } + } + + char szBuf[8096]=""; - snprintf(szBuf,8095,"currentProgress = " MG_I64_SPECIFIER " updateFPS = " MG_I64_SPECIFIER " speed = " MG_I64_SPECIFIER " diagonalFactor = " MG_I64_SPECIFIER " heightFactor = " MG_I64_SPECIFIER " speedDenominator = " MG_I64_SPECIFIER " progressIncrease = " MG_I64_SPECIFIER " [" MG_I64_SPECIFIER "]", - currentProgress,updateFPS,speed,diagonalFactor,heightFactor,speedDenominator,progressIncrease,((speed * diagonalFactor * heightFactor) / speedDenominator)); + snprintf(szBuf,8095,"currentProgress = " MG_I64_SPECIFIER " updateFPS = " MG_I64_SPECIFIER " speed = " MG_I64_SPECIFIER " diagonalFactor = " MG_I64_SPECIFIER " heightFactor = " MG_I64_SPECIFIER " speedDenominator = " MG_I64_SPECIFIER " progressIncrease = " MG_I64_SPECIFIER " [" MG_I64_SPECIFIER "] height [%f] airHeight [%f] cellUnitHeight [%d] cellObjectHeight [%d]", + currentProgress,updateFPS,speed,diagonalFactor,heightFactor,speedDenominator,progressIncrease,((speed * diagonalFactor * heightFactor) / speedDenominator),height,airHeight,cellUnitHeight,cellObjectHeight); networkCRCLogInfo = szBuf; + + //printf("%s\n",szBuf); } newProgress += progressIncrease; @@ -4068,10 +4089,10 @@ void Unit::startDamageParticles() { checkCustomizedParticleTriggers(false); } -void Unit::setTargetVec(const Vec3f &targetVec) { - this->targetVec= targetVec; - logSynchData(extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__); -} +//void Unit::setTargetVec(const Vec3f &targetVec) { +// this->targetVec= targetVec; +// logSynchData(extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__); +//} void Unit::setMeetingPos(const Vec2i &meetingPos) { this->meetingPos= meetingPos; diff --git a/source/glest_game/type_instances/unit.h b/source/glest_game/type_instances/unit.h index 2adb9b71c..2eb639a79 100644 --- a/source/glest_game/type_instances/unit.h +++ b/source/glest_game/type_instances/unit.h @@ -627,7 +627,7 @@ public: void refreshPos(); void setTargetPos(const Vec2i &targetPos); void setTarget(const Unit *unit); - void setTargetVec(const Vec3f &targetVec); + //void setTargetVec(const Vec3f &targetVec); void setMeetingPos(const Vec2i &meetingPos); void setVisible(const bool visible); inline bool getVisible() const { return visible; } diff --git a/source/tests/CMakeLists.txt b/source/tests/CMakeLists.txt index 089bfbe9e..925c4c546 100644 --- a/source/tests/CMakeLists.txt +++ b/source/tests/CMakeLists.txt @@ -38,6 +38,7 @@ IF(BUILD_MEGAGLEST_TESTS) SET(DIRS_WITH_SRC ./ shared_lib/graphics + shared_lib/streflop shared_lib/util shared_lib/xml) @@ -60,7 +61,14 @@ IF(BUILD_MEGAGLEST_TESTS) ${GLEST_LIB_INCLUDE_ROOT}xml/rapidxml ${GLEST_LIB_INCLUDE_ROOT}glew ${GLEST_LIB_INCLUDE_ROOT}lua - ${GLEST_LIB_INCLUDE_ROOT}map) + ${GLEST_LIB_INCLUDE_ROOT}map + + ${PROJECT_SOURCE_DIR}/source/glest_game/graphics + ${PROJECT_SOURCE_DIR}/source/glest_game/world + ${PROJECT_SOURCE_DIR}/source/glest_game/sound + ${PROJECT_SOURCE_DIR}/source/glest_game/type_instances + ${PROJECT_SOURCE_DIR}/source/glest_game/types + ) IF(WANT_STREFLOP) SET(GLEST_LIB_INCLUDE_DIRS