setLockedUnitForFaction
*Showing an info in the info string ( above the requirements of the unit ) if locked
This commit is contained in:
parent
bcb3288d74
commit
ea04a2bb58
|
@ -768,6 +768,7 @@ void Gui::computeInfoString(int posDisplay){
|
|||
display.setInfoText(ct->getDesc(unit->getTotalUpgrade(),game->showTranslatedTechTree()));
|
||||
}
|
||||
else{
|
||||
display.setInfoText(ct->getReqDesc(game->showTranslatedTechTree()));
|
||||
if(ct->getClass()==ccUpgrade){
|
||||
string text="";
|
||||
const UpgradeCommandType *uct= static_cast<const UpgradeCommandType*>(ct);
|
||||
|
@ -779,8 +780,19 @@ void Gui::computeInfoString(int posDisplay){
|
|||
}
|
||||
display.setInfoText(text+ct->getReqDesc(game->showTranslatedTechTree()));
|
||||
}
|
||||
else{
|
||||
display.setInfoText(ct->getReqDesc(game->showTranslatedTechTree()));
|
||||
//locked by scenario
|
||||
else if(ct->getClass()==ccProduce){
|
||||
string text="";
|
||||
const ProduceCommandType *pct= static_cast<const ProduceCommandType*>(ct);
|
||||
if(unit->getFaction()->isUnitLocked(pct->getProducedUnit())){
|
||||
display.setInfoText(lang.getString("LockedByScenario")+"\n\n"+ct->getReqDesc(game->showTranslatedTechTree()));
|
||||
}
|
||||
}
|
||||
else if(ct->getClass()==ccMorph){
|
||||
const MorphCommandType *mct= static_cast<const MorphCommandType*>(ct);
|
||||
if(unit->getFaction()->isUnitLocked(mct->getMorphUnit())){
|
||||
display.setInfoText(lang.getString("LockedByScenario")+"\n\n"+ct->getReqDesc(game->showTranslatedTechTree()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -802,8 +814,16 @@ void Gui::computeInfoString(int posDisplay){
|
|||
}
|
||||
else{
|
||||
if(activeCommandType!=NULL && activeCommandType->getClass()==ccBuild){
|
||||
//locked by scenario
|
||||
const BuildCommandType *bct= static_cast<const BuildCommandType*>(activeCommandType);
|
||||
display.setInfoText(bct->getBuilding(posDisplay)->getReqDesc(game->showTranslatedTechTree()));
|
||||
const Unit *unit= selection.getFrontUnit();
|
||||
printf("opfaaa\n");
|
||||
if(unit->getFaction()->isUnitLocked(bct->getBuilding(posDisplay))){
|
||||
printf("OpfaUnitNameDiggaaaa:%s",bct->getBuilding(posDisplay)->getName(false).c_str());
|
||||
display.setInfoText(lang.getString("LockedByScenario")+"\n\n"+bct->getBuilding(posDisplay)->getReqDesc(game->showTranslatedTechTree()));
|
||||
} else {
|
||||
display.setInfoText(bct->getBuilding(posDisplay)->getReqDesc(game->showTranslatedTechTree()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -675,12 +675,12 @@ bool Faction::canUnitsPathfind() {
|
|||
|
||||
void Faction::setLockedUnitForFaction(const UnitType *ut, bool lock) {
|
||||
if (lock) {
|
||||
LockedUnits.insert(ut);
|
||||
lockedUnits.insert(ut);
|
||||
} else {
|
||||
std::set<const UnitType*>::iterator it;
|
||||
it=LockedUnits.find(ut);
|
||||
if(it!=LockedUnits.end()) {
|
||||
LockedUnits.erase(it);
|
||||
it=lockedUnits.find(ut);
|
||||
if(it!=lockedUnits.end()) {
|
||||
lockedUnits.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ private:
|
|||
std::map<int,int> unitsMovingList;
|
||||
std::map<int,int> unitsPathfindingList;
|
||||
|
||||
std::set<const UnitType*> LockedUnits;
|
||||
std::set<const UnitType*> lockedUnits;
|
||||
|
||||
TechTree *techTree;
|
||||
const XmlNode *loadWorldNode;
|
||||
|
@ -247,7 +247,7 @@ public:
|
|||
bool canUnitsPathfind();
|
||||
|
||||
void setLockedUnitForFaction(const UnitType *ut, bool lock);
|
||||
bool isUnitLocked(const UnitType *ut) const { return LockedUnits.find(ut)!=LockedUnits.end(); }
|
||||
bool isUnitLocked(const UnitType *ut) const { return lockedUnits.find(ut)!=lockedUnits.end(); }
|
||||
|
||||
void init(
|
||||
FactionType *factionType, ControlType control, TechTree *techTree, Game *game,
|
||||
|
|
Loading…
Reference in New Issue