- added a VERY IMPORTANT synch check in order to find unit id mismatch
This commit is contained in:
parent
b31531db1f
commit
9159d44b7a
|
@ -395,6 +395,18 @@ Command* Commander::buildCommand(const NetworkCommand* networkCommand) const{
|
|||
throw runtime_error(szBuf);
|
||||
}
|
||||
|
||||
if(unit->getFaction()->getIndex() != networkCommand->getUnitFactionIndex()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d]\nUnit / Faction mismatch for network command = [%s]\n%s\nfor unit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nGame out of synch.",
|
||||
__FILE__,__FUNCTION__,__LINE__,networkCommand->toString().c_str(),unit->getType()->getCommandTypeListDesc().c_str(),unit->getId(), unit->getFullName().c_str(),unit->getDesc().c_str(),unit->getFaction()->getIndex());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s\n",szBuf);
|
||||
|
||||
std::string worldLog = world->DumpWorldToLog();
|
||||
std::string sError = "worldLog = " + worldLog + " " + string(szBuf);
|
||||
throw runtime_error(sError);
|
||||
}
|
||||
|
||||
const UnitType* unitType= world->findUnitTypeById(unit->getFaction()->getType(), networkCommand->getUnitTypeId());
|
||||
ct= unit->getType()->findCommandTypeById(networkCommand->getCommandTypeId());
|
||||
|
||||
|
|
|
@ -95,6 +95,8 @@ public:
|
|||
int getTargetId() const {return targetId;}
|
||||
int getWantQueue() const {return wantQueue;}
|
||||
int getFromFactionIndex() const {return fromFactionIndex;}
|
||||
int getUnitFactionUnitCount() const {return unitFactionUnitCount;}
|
||||
int getUnitFactionIndex() const {return unitFactionIndex;}
|
||||
|
||||
void preprocessNetworkCommand(World *world);
|
||||
string toString() const;
|
||||
|
|
Loading…
Reference in New Issue
Block a user