- bugfix for team switching validation should be skipped

- commented printf for tween debugging
This commit is contained in:
Mark Vejvoda 2011-09-22 05:14:20 +00:00
parent d52924f214
commit 7e16873efd
2 changed files with 16 additions and 12 deletions

View File

@ -489,20 +489,24 @@ CommandResult Commander::computeResult(const CommandResultContainer &results) co
CommandResult Commander::pushNetworkCommand(const NetworkCommand* networkCommand) const {
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
const Unit* unit= world->findUnitById(networkCommand->getUnitId());
CommandResult cr= crSuccess;
//validate unit
if(unit == NULL) {
char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s - %d] Command refers to non existent unit id = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,networkCommand->getUnitId());
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
if(gameNetworkInterface != NULL) {
char szMsg[1024]="";
sprintf(szMsg,"Player detected an error: Command refers to non existent unit id = %d. Game out of synch.",networkCommand->getUnitId());
gameNetworkInterface->sendTextMessage(szMsg,-1, true, "");
}
throw runtime_error(szBuf);
const Unit* unit = NULL;
if( networkCommand->getNetworkCommandType() != nctSwitchTeam &&
networkCommand->getNetworkCommandType() != nctSwitchTeamVote) {
unit= world->findUnitById(networkCommand->getUnitId());
if(unit == NULL) {
char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s - %d] Command refers to non existent unit id = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,networkCommand->getUnitId());
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
if(gameNetworkInterface != NULL) {
char szMsg[1024]="";
sprintf(szMsg,"Player detected an error: Command refers to non existent unit id = %d. Game out of synch.",networkCommand->getUnitId());
gameNetworkInterface->sendTextMessage(szMsg,-1, true, "");
}
throw runtime_error(szBuf);
}
}
//add the command to the interface

View File

@ -508,7 +508,7 @@ void GameParticleSystem::setTween(float relative,float absolute) {
truncateDecimal<float>(tween);
if(tween < 0.0f || tween > 1.0f) {
printf("In [%s::%s Line: %d] WARNING setting tween to [%f] clamping tween, modelCycle [%f] absolute [%f] relative [%f]\n",__FILE__,__FUNCTION__,__LINE__,tween,modelCycle,absolute,relative);
//printf("In [%s::%s Line: %d] WARNING setting tween to [%f] clamping tween, modelCycle [%f] absolute [%f] relative [%f]\n",__FILE__,__FUNCTION__,__LINE__,tween,modelCycle,absolute,relative);
//assert(tween >= 0.0f && tween <= 1.0f);
}