- added a new skill to toggle fog of war for any command.
This commit is contained in:
parent
4ea22920bf
commit
69a15d4544
|
@ -981,15 +981,21 @@ void Unit::setCurrSkill(const SkillType *currSkill) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Command *cmd = getCurrrentCommandThreadSafe();
|
Command *cmd = getCurrrentCommandThreadSafe();
|
||||||
// Remove old fog of war skill type if need be
|
|
||||||
game->getWorld()->removeFogOfWarSkillType(this);
|
|
||||||
|
|
||||||
// Set mew fog of war skill type if need be
|
// Set mew fog of war skill type if need be
|
||||||
if(cmd != NULL && cmd->getCommandType() != NULL &&
|
if(cmd != NULL && cmd->getCommandType() != NULL &&
|
||||||
cmd->getCommandType()->hasFogOfWarSkillType(currSkill->getName())) {
|
cmd->getCommandType()->hasFogOfWarSkillType(currSkill->getName())) {
|
||||||
const FogOfWarSkillType *fowst = cmd->getCommandType()->getFogOfWarSkillType();
|
const FogOfWarSkillType *fowst = cmd->getCommandType()->getFogOfWarSkillType();
|
||||||
|
|
||||||
|
// Remove old fog of war skill type if need be
|
||||||
|
game->getWorld()->removeFogOfWarSkillTypeFromList(this);
|
||||||
|
|
||||||
game->getWorld()->addFogOfWarSkillType(this,fowst);
|
game->getWorld()->addFogOfWarSkillType(this,fowst);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// Remove old fog of war skill type if need be
|
||||||
|
game->getWorld()->removeFogOfWarSkillType(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(showUnitParticles == true &&
|
if(showUnitParticles == true &&
|
||||||
currSkill->unitParticleSystemTypes.empty() == false &&
|
currSkill->unitParticleSystemTypes.empty() == false &&
|
||||||
|
|
|
@ -83,7 +83,7 @@ void CommandType::load(int id, const XmlNode *n, const string &dir,
|
||||||
string skillName= n->getChild("fog-of-war-skill")->getAttribute("value")->getRestrictedValue();
|
string skillName= n->getChild("fog-of-war-skill")->getAttribute("value")->getRestrictedValue();
|
||||||
fogOfWarSkillType = static_cast<const FogOfWarSkillType*>(ut.getSkillType(skillName, scFogOfWar));
|
fogOfWarSkillType = static_cast<const FogOfWarSkillType*>(ut.getSkillType(skillName, scFogOfWar));
|
||||||
|
|
||||||
string skillAttachmentNames = n->getChild("fog-of-war-skill")->getAttribute("skill-attachments")->getRestrictedValue();
|
string skillAttachmentNames = n->getChild("fog-of-war-skill")->getAttribute("skill-attachments")->getValue();
|
||||||
|
|
||||||
std::vector<std::string> skillList;
|
std::vector<std::string> skillList;
|
||||||
Tokenize(skillAttachmentNames,skillList,",");
|
Tokenize(skillAttachmentNames,skillList,",");
|
||||||
|
|
|
@ -214,10 +214,19 @@ void World::addFogOfWarSkillType(const Unit *unit,const FogOfWarSkillType *fowst
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void World::removeFogOfWarSkillType(const Unit *unit) {
|
|
||||||
|
bool World::removeFogOfWarSkillTypeFromList(const Unit *unit) {
|
||||||
|
bool result = false;
|
||||||
if(mapFogOfWarUnitList.find(unit->getId()) != mapFogOfWarUnitList.end()) {
|
if(mapFogOfWarUnitList.find(unit->getId()) != mapFogOfWarUnitList.end()) {
|
||||||
mapFogOfWarUnitList.erase(unit->getId());
|
mapFogOfWarUnitList.erase(unit->getId());
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void World::removeFogOfWarSkillType(const Unit *unit) {
|
||||||
|
bool removedFromList = removeFogOfWarSkillTypeFromList(unit);
|
||||||
|
if(removedFromList == true) {
|
||||||
if(mapFogOfWarUnitList.empty() == true) {
|
if(mapFogOfWarUnitList.empty() == true) {
|
||||||
|
|
||||||
//printf("In [%s::%s Line: %d] current = %d new = %d\n",__FILE__,__FUNCTION__,__LINE__,fogOfWar,originalGameFogOfWar);
|
//printf("In [%s::%s Line: %d] current = %d new = %d\n",__FILE__,__FUNCTION__,__LINE__,fogOfWar,originalGameFogOfWar);
|
||||||
|
|
|
@ -159,6 +159,7 @@ public:
|
||||||
|
|
||||||
void addFogOfWarSkillType(const Unit *unit,const FogOfWarSkillType *fowst);
|
void addFogOfWarSkillType(const Unit *unit,const FogOfWarSkillType *fowst);
|
||||||
void removeFogOfWarSkillType(const Unit *unit);
|
void removeFogOfWarSkillType(const Unit *unit);
|
||||||
|
bool removeFogOfWarSkillTypeFromList(const Unit *unit);
|
||||||
|
|
||||||
//get
|
//get
|
||||||
inline int getMaxPlayers() const {return map.getMaxPlayers();}
|
inline int getMaxPlayers() const {return map.getMaxPlayers();}
|
||||||
|
|
Loading…
Reference in New Issue