trying to track down network bugs

This commit is contained in:
Mark Vejvoda 2010-05-28 00:57:24 +00:00
parent ac34fc6d99
commit f0da609e7f
2 changed files with 13 additions and 1 deletions

View File

@ -332,6 +332,8 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const {
Command* command= buildCommand(networkCommand);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
unit->giveCommand(command, networkCommand->getWantQueue());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] found nctGiveCommand networkCommand->getUnitId() = %d\n",__FILE__,__FUNCTION__,__LINE__,networkCommand->getUnitId());
@ -362,6 +364,8 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const {
Command* Commander::buildCommand(const NetworkCommand* networkCommand) const{
assert(networkCommand->getNetworkCommandType()==nctGiveCommand);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
if(world == NULL) {
char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s Line: %d] world == NULL for unit with id: %d",__FILE__,__FUNCTION__,__LINE__,networkCommand->getUnitId());
@ -372,6 +376,8 @@ Command* Commander::buildCommand(const NetworkCommand* networkCommand) const{
const CommandType* ct= NULL;
const Unit* unit= world->findUnitById(networkCommand->getUnitId());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
//validate unit
if(unit == NULL) {
char szBuf[1024]="";
@ -405,6 +411,8 @@ Command* Commander::buildCommand(const NetworkCommand* networkCommand) const{
throw runtime_error(sError);
}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
CardinalDir facing;
// get facing/target ... the target might be dead due to lag, cope with it
if (ct->getClass() == ccBuild) {
@ -415,6 +423,8 @@ Command* Commander::buildCommand(const NetworkCommand* networkCommand) const{
target= world->findUnitById(networkCommand->getTargetId());
}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
//create command
Command *command= NULL;
if(unitType!=NULL){
@ -427,6 +437,8 @@ Command* Commander::buildCommand(const NetworkCommand* networkCommand) const{
command= new Command(ct, target);
}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
//issue command
return command;
}

View File

@ -32,7 +32,7 @@ namespace Glest{ namespace Game{
// class NetworkInterface
// =====================================================
const int NetworkInterface::readyWaitTimeout= 60000; //1 minute
const int NetworkInterface::readyWaitTimeout= 120000; // 2 minutes
bool NetworkInterface::allowGameDataSynchCheck = false;
bool NetworkInterface::allowDownloadDataSynch = false;