- check if unit is dead when loading game and do NOT set cell map for dead unit
This commit is contained in:
parent
d4ca1c36cb
commit
4481151c5b
|
@ -1922,6 +1922,25 @@ void Faction::loadGame(const XmlNode *rootNode, int factionIndex,GameSettings *s
|
|||
}
|
||||
|
||||
upgradeManager.loadGame(factionNode,this);
|
||||
|
||||
// ControlType control;
|
||||
control = static_cast<ControlType>(factionNode->getAttribute("control")->getIntValue());
|
||||
// Texture2D *texture;
|
||||
// FactionType *factionType;
|
||||
//factionNode->addAttribute("factiontype",factionType->getName(), mapTagReplacements);
|
||||
// int index;
|
||||
//factionNode->addAttribute("index",intToStr(index), mapTagReplacements);
|
||||
// int teamIndex;
|
||||
//factionNode->addAttribute("teamIndex",intToStr(teamIndex), mapTagReplacements);
|
||||
teamIndex = factionNode->getAttribute("teamIndex")->getIntValue();
|
||||
// int startLocationIndex;
|
||||
startLocationIndex = factionNode->getAttribute("startLocationIndex")->getIntValue();
|
||||
// bool thisFaction;
|
||||
thisFaction = factionNode->getAttribute("thisFaction")->getIntValue();
|
||||
// bool factionDisconnectHandled;
|
||||
|
||||
// RandomGen random;
|
||||
random.setLastNumber(factionNode->getAttribute("random")->getIntValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3661,8 +3661,10 @@ void Unit::saveGame(XmlNode *rootNode) {
|
|||
// std::vector<UnitAttackBoostEffect *> currentAttackBoostEffects;
|
||||
for(unsigned int i = 0; i < currentAttackBoostEffects.size(); ++i) {
|
||||
UnitAttackBoostEffect *uabe= currentAttackBoostEffects[i];
|
||||
if(uabe != NULL) {
|
||||
uabe->saveGame(unitNode);
|
||||
}
|
||||
}
|
||||
|
||||
// Mutex *mutexCommands;
|
||||
//
|
||||
|
@ -3707,9 +3709,6 @@ Unit * Unit::loadGame(const XmlNode *rootNode, GameSettings *settings, Faction *
|
|||
//Unit(int id, UnitPathInterface *path, const Vec2i &pos, const UnitType *type, Faction *faction, Map *map, CardinalDir placeFacing);
|
||||
Unit *result = new Unit(newUnitId, newpath, newUnitPos, ut, faction, world->getMapPtr(), newModelFacing);
|
||||
|
||||
world->getMapPtr()->putUnitCells(result, newUnitPos);
|
||||
//result->born();
|
||||
|
||||
result->lastRotation = unitNode->getAttribute("lastRotation")->getFloatValue();
|
||||
result->targetRotation = unitNode->getAttribute("targetRotation")->getFloatValue();
|
||||
result->rotation = unitNode->getAttribute("rotation")->getFloatValue();
|
||||
|
@ -3964,6 +3963,11 @@ Unit * Unit::loadGame(const XmlNode *rootNode, GameSettings *settings, Faction *
|
|||
// CauseOfDeathType causeOfDeath;
|
||||
result->causeOfDeath = static_cast<CauseOfDeathType>(unitNode->getAttribute("causeOfDeath")->getIntValue());
|
||||
|
||||
if(result->alive) {
|
||||
world->getMapPtr()->putUnitCells(result, newUnitPos);
|
||||
//result->born();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -2028,6 +2028,9 @@ void UnitUpdater::damage(Unit *attacker, const AttackSkillType* ast, Unit *attac
|
|||
if(ast == NULL) {
|
||||
throw runtime_error("ast == NULL");
|
||||
}
|
||||
if(attacked == NULL) {
|
||||
throw runtime_error("attacked == NULL");
|
||||
}
|
||||
|
||||
//get vars
|
||||
float damage = ast->getTotalAttackStrength(attacker->getTotalUpgrade());
|
||||
|
|
Loading…
Reference in New Issue