- reverted win64 to sse2
- added some debug info for win64 testing
This commit is contained in:
parent
eb6466889f
commit
493981e8b3
|
@ -150,7 +150,7 @@
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
|
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
|
|
@ -192,7 +192,7 @@
|
||||||
<StringPooling>true</StringPooling>
|
<StringPooling>true</StringPooling>
|
||||||
<ExceptionHandling>Async</ExceptionHandling>
|
<ExceptionHandling>Async</ExceptionHandling>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
|
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>
|
||||||
|
|
|
@ -191,7 +191,7 @@
|
||||||
<StringPooling>true</StringPooling>
|
<StringPooling>true</StringPooling>
|
||||||
<ExceptionHandling>Async</ExceptionHandling>
|
<ExceptionHandling>Async</ExceptionHandling>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
|
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>
|
||||||
|
|
|
@ -259,7 +259,7 @@
|
||||||
<ExceptionHandling>Async</ExceptionHandling>
|
<ExceptionHandling>Async</ExceptionHandling>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
|
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||||
<FloatingPointModel>Precise</FloatingPointModel>
|
<FloatingPointModel>Precise</FloatingPointModel>
|
||||||
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
|
|
@ -168,7 +168,7 @@
|
||||||
<AdditionalIncludeDirectories>../../../source/shared_lib/include/graphics;../../../source/shared_lib/include/graphics/gl;../../../source/shared_lib/include/platform;../../../source/shared_lib/include/platform/win32;../../../source/shared_lib/include/sound;../../../source/shared_lib/include/util;../../../source/shared_lib/include/lua;../../../source/shared_lib/include/xml;../../../source/shared_lib/include/xml/rapidxml;../../../source/glest_game/ai;../../../source/glest_game/facilities;../../../source/glest_game/game;../../../source/glest_game/global;../../../source/glest_game/graphics;../../../source/glest_game/gui;../../../source/glest_game/main;../../../source/glest_game/menu;../../../source/glest_game/network;../../../source/glest_game/sound;../../../source/glest_game/type_instances;../../../source/glest_game/types;../../../source/glest_game/world;../../../source/windows_deps_2012/include;../../../source/windows_deps_2012/xerces-c-3.1.1/src;../../../source/windows_deps_2012/SDL-1.2.15/include;../../../source/shared_lib/include/platform/sdl;../../../source/shared_lib/include/sound/openal;../../../source/windows_deps_2012/openal-soft-1.14/include;../../../source/shared_lib/include/platform/posix;../../../source/shared_lib/include/platform/common;../../../source/windows_deps_2012/curl-7.21.3/include;../../../source/shared_lib/include/map;../../../source/windows_deps_2012/libircclient/include;../../../source/windows_deps_2012/glew-1.7.0/include;../../../source/windows_deps_2012/cppunit/include</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>../../../source/shared_lib/include/graphics;../../../source/shared_lib/include/graphics/gl;../../../source/shared_lib/include/platform;../../../source/shared_lib/include/platform/win32;../../../source/shared_lib/include/sound;../../../source/shared_lib/include/util;../../../source/shared_lib/include/lua;../../../source/shared_lib/include/xml;../../../source/shared_lib/include/xml/rapidxml;../../../source/glest_game/ai;../../../source/glest_game/facilities;../../../source/glest_game/game;../../../source/glest_game/global;../../../source/glest_game/graphics;../../../source/glest_game/gui;../../../source/glest_game/main;../../../source/glest_game/menu;../../../source/glest_game/network;../../../source/glest_game/sound;../../../source/glest_game/type_instances;../../../source/glest_game/types;../../../source/glest_game/world;../../../source/windows_deps_2012/include;../../../source/windows_deps_2012/xerces-c-3.1.1/src;../../../source/windows_deps_2012/SDL-1.2.15/include;../../../source/shared_lib/include/platform/sdl;../../../source/shared_lib/include/sound/openal;../../../source/windows_deps_2012/openal-soft-1.14/include;../../../source/shared_lib/include/platform/posix;../../../source/shared_lib/include/platform/common;../../../source/windows_deps_2012/curl-7.21.3/include;../../../source/shared_lib/include/map;../../../source/windows_deps_2012/libircclient/include;../../../source/windows_deps_2012/glew-1.7.0/include;../../../source/windows_deps_2012/cppunit/include</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<FloatingPointModel>Fast</FloatingPointModel>
|
<FloatingPointModel>Fast</FloatingPointModel>
|
||||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
|
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
|
|
|
@ -205,7 +205,7 @@
|
||||||
<ExceptionHandling>Async</ExceptionHandling>
|
<ExceptionHandling>Async</ExceptionHandling>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
|
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||||
<FloatingPointModel>Precise</FloatingPointModel>
|
<FloatingPointModel>Precise</FloatingPointModel>
|
||||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||||
<ProgramDataBaseFileName>$(OutDir)$(ProjectName).pdb</ProgramDataBaseFileName>
|
<ProgramDataBaseFileName>$(OutDir)$(ProjectName).pdb</ProgramDataBaseFileName>
|
||||||
|
|
|
@ -160,7 +160,7 @@
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
|
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>wsock32.lib;libxml2_a.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>wsock32.lib;libxml2_a.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
|
|
@ -287,6 +287,7 @@ bool FactionThread::isSignalPathfinderCompleted(int frameIndex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FactionThread::execute() {
|
void FactionThread::execute() {
|
||||||
|
string codeLocation = "1";
|
||||||
RunningStatusSafeWrapper runningStatus(this);
|
RunningStatusSafeWrapper runningStatus(this);
|
||||||
try {
|
try {
|
||||||
//setRunningStatus(true);
|
//setRunningStatus(true);
|
||||||
|
@ -296,6 +297,7 @@ void FactionThread::execute() {
|
||||||
bool minorDebugPerformance = false;
|
bool minorDebugPerformance = false;
|
||||||
Chrono chrono;
|
Chrono chrono;
|
||||||
|
|
||||||
|
codeLocation = "2";
|
||||||
//unsigned int idx = 0;
|
//unsigned int idx = 0;
|
||||||
for(;this->faction != NULL;) {
|
for(;this->faction != NULL;) {
|
||||||
if(getQuitStatus() == true) {
|
if(getQuitStatus() == true) {
|
||||||
|
@ -305,6 +307,7 @@ void FactionThread::execute() {
|
||||||
|
|
||||||
semTaskSignalled.waitTillSignalled();
|
semTaskSignalled.waitTillSignalled();
|
||||||
|
|
||||||
|
codeLocation = "3";
|
||||||
//printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
static string masterSlaveOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
|
static string masterSlaveOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
|
||||||
MasterSlaveThreadControllerSafeWrapper safeMasterController(masterController,20000,masterSlaveOwnerId);
|
MasterSlaveThreadControllerSafeWrapper safeMasterController(masterController,20000,masterSlaveOwnerId);
|
||||||
|
@ -315,6 +318,7 @@ void FactionThread::execute() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
codeLocation = "4";
|
||||||
static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
|
static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
|
||||||
MutexSafeWrapper safeMutex(triggerIdMutex,mutexOwnerId);
|
MutexSafeWrapper safeMutex(triggerIdMutex,mutexOwnerId);
|
||||||
bool executeTask = (this->frameIndex.first >= 0);
|
bool executeTask = (this->frameIndex.first >= 0);
|
||||||
|
@ -324,9 +328,11 @@ void FactionThread::execute() {
|
||||||
|
|
||||||
safeMutex.ReleaseLock();
|
safeMutex.ReleaseLock();
|
||||||
|
|
||||||
|
codeLocation = "5";
|
||||||
//printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(executeTask == true) {
|
if(executeTask == true) {
|
||||||
|
codeLocation = "6";
|
||||||
ExecutingTaskSafeWrapper safeExecutingTaskMutex(this);
|
ExecutingTaskSafeWrapper safeExecutingTaskMutex(this);
|
||||||
|
|
||||||
if(this->faction == NULL) {
|
if(this->faction == NULL) {
|
||||||
|
@ -337,6 +343,7 @@ void FactionThread::execute() {
|
||||||
throw megaglest_runtime_error("world == NULL");
|
throw megaglest_runtime_error("world == NULL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
codeLocation = "7";
|
||||||
//Config &config= Config::getInstance();
|
//Config &config= Config::getInstance();
|
||||||
//bool sortedUnitsAllowed = config.getBool("AllowGroupedUnitCommands","true");
|
//bool sortedUnitsAllowed = config.getBool("AllowGroupedUnitCommands","true");
|
||||||
bool sortedUnitsAllowed = false;
|
bool sortedUnitsAllowed = false;
|
||||||
|
@ -344,6 +351,7 @@ void FactionThread::execute() {
|
||||||
this->faction->sortUnitsByCommandGroups();
|
this->faction->sortUnitsByCommandGroups();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
codeLocation = "8";
|
||||||
static string mutexOwnerId2 = string(__FILE__) + string("_") + intToStr(__LINE__);
|
static string mutexOwnerId2 = string(__FILE__) + string("_") + intToStr(__LINE__);
|
||||||
MutexSafeWrapper safeMutex(faction->getUnitMutex(),mutexOwnerId2);
|
MutexSafeWrapper safeMutex(faction->getUnitMutex(),mutexOwnerId2);
|
||||||
|
|
||||||
|
@ -352,22 +360,28 @@ void FactionThread::execute() {
|
||||||
|
|
||||||
//printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
codeLocation = "9";
|
||||||
int unitCount = this->faction->getUnitCount();
|
int unitCount = this->faction->getUnitCount();
|
||||||
for(int j = 0; j < unitCount; ++j) {
|
for(int j = 0; j < unitCount; ++j) {
|
||||||
|
codeLocation = "10";
|
||||||
Unit *unit = this->faction->getUnit(j);
|
Unit *unit = this->faction->getUnit(j);
|
||||||
if(unit == NULL) {
|
if(unit == NULL) {
|
||||||
throw megaglest_runtime_error("unit == NULL");
|
throw megaglest_runtime_error("unit == NULL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
codeLocation = "11";
|
||||||
int64 elapsed1 = 0;
|
int64 elapsed1 = 0;
|
||||||
if(minorDebugPerformance) elapsed1 = chrono.getMillis();
|
if(minorDebugPerformance) elapsed1 = chrono.getMillis();
|
||||||
|
|
||||||
bool update = unit->needToUpdate();
|
bool update = unit->needToUpdate();
|
||||||
|
|
||||||
|
codeLocation = "12";
|
||||||
if(minorDebugPerformance && (chrono.getMillis() - elapsed1) >= 1) printf("Faction [%d - %s] #1-unit threaded updates on frame: %d for [%d] unit # %d, unitCount = %d, took [%lld] msecs\n",faction->getStartLocationIndex(),faction->getType()->getName(false).c_str(),currentTriggeredFrameIndex,faction->getUnitPathfindingListCount(),j,unitCount,(long long int)chrono.getMillis() - elapsed1);
|
if(minorDebugPerformance && (chrono.getMillis() - elapsed1) >= 1) printf("Faction [%d - %s] #1-unit threaded updates on frame: %d for [%d] unit # %d, unitCount = %d, took [%lld] msecs\n",faction->getStartLocationIndex(),faction->getType()->getName(false).c_str(),currentTriggeredFrameIndex,faction->getUnitPathfindingListCount(),j,unitCount,(long long int)chrono.getMillis() - elapsed1);
|
||||||
|
|
||||||
//update = true;
|
//update = true;
|
||||||
if(update == true) {
|
if(update == true)
|
||||||
|
{
|
||||||
|
codeLocation = "13";
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) {
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) {
|
||||||
int64 updateProgressValue = unit->getUpdateProgress();
|
int64 updateProgressValue = unit->getUpdateProgress();
|
||||||
int64 speed = unit->getCurrSkill()->getTotalSpeed(unit->getTotalUpgrade());
|
int64 speed = unit->getCurrSkill()->getTotalSpeed(unit->getTotalUpgrade());
|
||||||
|
@ -386,12 +400,14 @@ void FactionThread::execute() {
|
||||||
if(world->getUnitUpdater() == NULL) {
|
if(world->getUnitUpdater() == NULL) {
|
||||||
throw megaglest_runtime_error("world->getUnitUpdater() == NULL");
|
throw megaglest_runtime_error("world->getUnitUpdater() == NULL");
|
||||||
}
|
}
|
||||||
|
codeLocation = "14";
|
||||||
world->getUnitUpdater()->updateUnitCommand(unit,currentTriggeredFrameIndex);
|
world->getUnitUpdater()->updateUnitCommand(unit,currentTriggeredFrameIndex);
|
||||||
|
|
||||||
|
codeLocation = "15";
|
||||||
if(minorDebugPerformance && (chrono.getMillis() - elapsed2) >= 1) printf("Faction [%d - %s] #2-unit threaded updates on frame: %d for [%d] unit # %d, unitCount = %d, took [%lld] msecs\n",faction->getStartLocationIndex(),faction->getType()->getName(false).c_str(),currentTriggeredFrameIndex,faction->getUnitPathfindingListCount(),j,unitCount,(long long int)chrono.getMillis() - elapsed2);
|
if(minorDebugPerformance && (chrono.getMillis() - elapsed2) >= 1) printf("Faction [%d - %s] #2-unit threaded updates on frame: %d for [%d] unit # %d, unitCount = %d, took [%lld] msecs\n",faction->getStartLocationIndex(),faction->getType()->getName(false).c_str(),currentTriggeredFrameIndex,faction->getUnitPathfindingListCount(),j,unitCount,(long long int)chrono.getMillis() - elapsed2);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
codeLocation = "16";
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) {
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) {
|
||||||
int64 updateProgressValue = unit->getUpdateProgress();
|
int64 updateProgressValue = unit->getUpdateProgress();
|
||||||
int64 speed = unit->getCurrSkill()->getTotalSpeed(unit->getTotalUpgrade());
|
int64 speed = unit->getCurrSkill()->getTotalSpeed(unit->getTotalUpgrade());
|
||||||
|
@ -406,12 +422,14 @@ void FactionThread::execute() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
codeLocation = "17";
|
||||||
if(minorDebugPerformance && chrono.getMillis() >= 1) printf("Faction [%d - %s] threaded updates on frame: %d for [%d] units took [%lld] msecs\n",faction->getStartLocationIndex(),faction->getType()->getName(false).c_str(),currentTriggeredFrameIndex,faction->getUnitPathfindingListCount(),(long long int)chrono.getMillis());
|
if(minorDebugPerformance && chrono.getMillis() >= 1) printf("Faction [%d - %s] threaded updates on frame: %d for [%d] units took [%lld] msecs\n",faction->getStartLocationIndex(),faction->getType()->getName(false).c_str(),currentTriggeredFrameIndex,faction->getUnitPathfindingListCount(),(long long int)chrono.getMillis());
|
||||||
|
|
||||||
//printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
safeMutex.ReleaseLock();
|
safeMutex.ReleaseLock();
|
||||||
|
|
||||||
|
codeLocation = "18";
|
||||||
//printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
setTaskCompleted(currentTriggeredFrameIndex);
|
setTaskCompleted(currentTriggeredFrameIndex);
|
||||||
|
@ -421,6 +439,7 @@ void FactionThread::execute() {
|
||||||
|
|
||||||
//printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
codeLocation = "19";
|
||||||
if(getQuitStatus() == true) {
|
if(getQuitStatus() == true) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
break;
|
break;
|
||||||
|
@ -433,14 +452,14 @@ void FactionThread::execute() {
|
||||||
catch(const exception &ex) {
|
catch(const exception &ex) {
|
||||||
//setRunningStatus(false);
|
//setRunningStatus(false);
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Loc [%s] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,codeLocation.c_str(),ex.what());
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
throw megaglest_runtime_error(ex.what());
|
throw megaglest_runtime_error(ex.what());
|
||||||
}
|
}
|
||||||
catch(...) {
|
catch(...) {
|
||||||
char szBuf[8096]="";
|
char szBuf[8096]="";
|
||||||
snprintf(szBuf,8096,"In [%s::%s %d] UNKNOWN error\n",__FILE__,__FUNCTION__,__LINE__);
|
snprintf(szBuf,8096,"In [%s::%s %d] UNKNOWN error Loc [%s]\n",__FILE__,__FUNCTION__,__LINE__,codeLocation.c_str());
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||||
throw megaglest_runtime_error(szBuf);
|
throw megaglest_runtime_error(szBuf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -302,6 +302,8 @@ bool UnitUpdater::updateUnit(Unit *unit) {
|
||||||
|
|
||||||
//VERY IMPORTANT: compute next state depending on the first order of the list
|
//VERY IMPORTANT: compute next state depending on the first order of the list
|
||||||
void UnitUpdater::updateUnitCommand(Unit *unit, int frameIndex) {
|
void UnitUpdater::updateUnitCommand(Unit *unit, int frameIndex) {
|
||||||
|
string codeLocation = "1";
|
||||||
|
try {
|
||||||
bool minorDebugPerformance = false;
|
bool minorDebugPerformance = false;
|
||||||
Chrono chrono;
|
Chrono chrono;
|
||||||
if((minorDebugPerformance == true && frameIndex > 0) || SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled) chrono.start();
|
if((minorDebugPerformance == true && frameIndex > 0) || SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled) chrono.start();
|
||||||
|
@ -309,31 +311,40 @@ void UnitUpdater::updateUnitCommand(Unit *unit, int frameIndex) {
|
||||||
//if unit has command process it
|
//if unit has command process it
|
||||||
bool hasCommand = (unit->anyCommand());
|
bool hasCommand = (unit->anyCommand());
|
||||||
|
|
||||||
|
codeLocation = "2";
|
||||||
if((minorDebugPerformance && frameIndex > 0) && chrono.getMillis() >= 1) printf("UnitUpdate [%d - %s] #1-unit threaded updates on frame: %d took [%lld] msecs\n",unit->getId(),unit->getType()->getName(false).c_str(),frameIndex,(long long int)chrono.getMillis());
|
if((minorDebugPerformance && frameIndex > 0) && chrono.getMillis() >= 1) printf("UnitUpdate [%d - %s] #1-unit threaded updates on frame: %d took [%lld] msecs\n",unit->getId(),unit->getType()->getName(false).c_str(),frameIndex,(long long int)chrono.getMillis());
|
||||||
|
|
||||||
int64 elapsed1 = 0;
|
int64 elapsed1 = 0;
|
||||||
if(minorDebugPerformance && frameIndex > 0) elapsed1 = chrono.getMillis();
|
if(minorDebugPerformance && frameIndex > 0) elapsed1 = chrono.getMillis();
|
||||||
|
|
||||||
if(hasCommand == true) {
|
if(hasCommand == true) {
|
||||||
|
codeLocation = "3";
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] unit [%s] has command [%s]\n",__FILE__,__FUNCTION__,__LINE__,unit->toString(false).c_str(), unit->getCurrCommand()->toString(false).c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] unit [%s] has command [%s]\n",__FILE__,__FUNCTION__,__LINE__,unit->toString(false).c_str(), unit->getCurrCommand()->toString(false).c_str());
|
||||||
|
|
||||||
bool commandUsesPathFinder = (frameIndex < 0);
|
bool commandUsesPathFinder = (frameIndex < 0);
|
||||||
if(frameIndex > 0) {
|
if(frameIndex > 0) {
|
||||||
|
codeLocation = "3a";
|
||||||
if(unit->getCurrCommand() != NULL && unit->getCurrCommand()->getCommandType() != NULL) {
|
if(unit->getCurrCommand() != NULL && unit->getCurrCommand()->getCommandType() != NULL) {
|
||||||
|
codeLocation = "3b";
|
||||||
commandUsesPathFinder = unit->getCurrCommand()->getCommandType()->usesPathfinder();
|
commandUsesPathFinder = unit->getCurrCommand()->getCommandType()->usesPathfinder();
|
||||||
|
|
||||||
// Clear previous cached unit data
|
// Clear previous cached unit data
|
||||||
if(commandUsesPathFinder == true) {
|
if(commandUsesPathFinder == true) {
|
||||||
|
codeLocation = "3c";
|
||||||
clearUnitPrecache(unit);
|
clearUnitPrecache(unit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
codeLocation = "4";
|
||||||
if(commandUsesPathFinder == true) {
|
if(commandUsesPathFinder == true) {
|
||||||
|
codeLocation = "4a";
|
||||||
if(unit->getCurrCommand() != NULL && unit->getCurrCommand()->getCommandType() != NULL) {
|
if(unit->getCurrCommand() != NULL && unit->getCurrCommand()->getCommandType() != NULL) {
|
||||||
|
codeLocation = "4b";
|
||||||
unit->getCurrCommand()->getCommandType()->update(this, unit, frameIndex);
|
unit->getCurrCommand()->getCommandType()->update(this, unit, frameIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
codeLocation = "5";
|
||||||
if((minorDebugPerformance && frameIndex > 0) && (chrono.getMillis() - elapsed1) >= 1) {
|
if((minorDebugPerformance && frameIndex > 0) && (chrono.getMillis() - elapsed1) >= 1) {
|
||||||
//CommandClass cc = unit->getCurrCommand()->getCommandType()->commandTypeClass;
|
//CommandClass cc = unit->getCurrCommand()->getCommandType()->commandTypeClass;
|
||||||
printf("UnitUpdate [%d - %s] #2-unit threaded updates on frame: %d commandUsesPathFinder = %d took [%lld] msecs\nCommand: %s\n",unit->getId(),unit->getType()->getName(false).c_str(),frameIndex,commandUsesPathFinder,(long long int)chrono.getMillis() - elapsed1,unit->getCurrCommand()->toString(false).c_str());
|
printf("UnitUpdate [%d - %s] #2-unit threaded updates on frame: %d commandUsesPathFinder = %d took [%lld] msecs\nCommand: %s\n",unit->getId(),unit->getType()->getName(false).c_str(),frameIndex,commandUsesPathFinder,(long long int)chrono.getMillis() - elapsed1,unit->getCurrCommand()->toString(false).c_str());
|
||||||
|
@ -343,21 +354,40 @@ void UnitUpdater::updateUnitCommand(Unit *unit, int frameIndex) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
|
||||||
if(frameIndex < 0) {
|
if(frameIndex < 0) {
|
||||||
|
codeLocation = "6";
|
||||||
//if no commands stop and add stop command
|
//if no commands stop and add stop command
|
||||||
if(unit->anyCommand() == false && unit->isOperative()) {
|
if(unit->anyCommand() == false && unit->isOperative()) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
codeLocation = "6a";
|
||||||
if(unit->getType()->hasSkillClass(scStop)) {
|
if(unit->getType()->hasSkillClass(scStop)) {
|
||||||
unit->setCurrSkill(scStop);
|
unit->setCurrSkill(scStop);
|
||||||
}
|
}
|
||||||
|
codeLocation = "6b";
|
||||||
if(unit->getType()->hasCommandClass(ccStop)) {
|
if(unit->getType()->hasCommandClass(ccStop)) {
|
||||||
unit->giveCommand(new Command(unit->getType()->getFirstCtOfClass(ccStop)));
|
unit->giveCommand(new Command(unit->getType()->getFirstCtOfClass(ccStop)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
codeLocation = "7";
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld --------------------------- [END OF METHOD] ---------------------------\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld --------------------------- [END OF METHOD] ---------------------------\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
if((minorDebugPerformance && frameIndex > 0) && chrono.getMillis() >= 1) printf("UnitUpdate [%d - %s] #3-unit threaded updates on frame: %d took [%lld] msecs\n",unit->getId(),unit->getType()->getName(false).c_str(),frameIndex,(long long int)chrono.getMillis());
|
if((minorDebugPerformance && frameIndex > 0) && chrono.getMillis() >= 1) printf("UnitUpdate [%d - %s] #3-unit threaded updates on frame: %d took [%lld] msecs\n",unit->getId(),unit->getType()->getName(false).c_str(),frameIndex,(long long int)chrono.getMillis());
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(const exception &ex) {
|
||||||
|
//setRunningStatus(false);
|
||||||
|
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Loc [%s] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,codeLocation.c_str(),ex.what());
|
||||||
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
throw megaglest_runtime_error(ex.what());
|
||||||
|
}
|
||||||
|
catch(...) {
|
||||||
|
char szBuf[8096]="";
|
||||||
|
snprintf(szBuf,8096,"In [%s::%s %d] UNKNOWN error Loc [%s]\n",__FILE__,__FUNCTION__,__LINE__,codeLocation.c_str());
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||||
|
throw megaglest_runtime_error(szBuf);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== updateStop ====================
|
// ==================== updateStop ====================
|
||||||
|
|
Loading…
Reference in New Issue