- bugfix for server controlled AI mode

This commit is contained in:
Mark Vejvoda 2010-06-03 00:13:58 +00:00
parent 64070ca69c
commit 3dc9c2c623
1 changed files with 6 additions and 1 deletions

View File

@ -174,16 +174,21 @@ CommandResult AiInterface::giveCommand(int unitIndex, const CommandType *command
CommandResult AiInterface::giveCommand(int unitIndex, const CommandType *commandType, Unit *u){
assert(this->gameSettings != NULL);
assert(this->commander != NULL);
//assert(u != NULL);
//assert(u->getType() != NULL);
if(enableServerControlledAI == true &&
this->gameSettings->isNetworkGame() == true &&
NetworkManager::getInstance().getNetworkRole() == nrServer) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
assert(u != NULL);
//assert(u != NULL);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
if(u == NULL) {
u = world->getFaction(factionIndex)->getUnit(unitIndex);
}
CommandResult result = commander->tryGiveCommand(u, commandType, Vec2i(0), u->getType(),CardinalDir::NORTH);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);