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()));
|
display.setInfoText(ct->getDesc(unit->getTotalUpgrade(),game->showTranslatedTechTree()));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
display.setInfoText(ct->getReqDesc(game->showTranslatedTechTree()));
|
||||||
if(ct->getClass()==ccUpgrade){
|
if(ct->getClass()==ccUpgrade){
|
||||||
string text="";
|
string text="";
|
||||||
const UpgradeCommandType *uct= static_cast<const UpgradeCommandType*>(ct);
|
const UpgradeCommandType *uct= static_cast<const UpgradeCommandType*>(ct);
|
||||||
|
@ -779,8 +780,19 @@ void Gui::computeInfoString(int posDisplay){
|
||||||
}
|
}
|
||||||
display.setInfoText(text+ct->getReqDesc(game->showTranslatedTechTree()));
|
display.setInfoText(text+ct->getReqDesc(game->showTranslatedTechTree()));
|
||||||
}
|
}
|
||||||
else{
|
//locked by scenario
|
||||||
display.setInfoText(ct->getReqDesc(game->showTranslatedTechTree()));
|
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{
|
else{
|
||||||
if(activeCommandType!=NULL && activeCommandType->getClass()==ccBuild){
|
if(activeCommandType!=NULL && activeCommandType->getClass()==ccBuild){
|
||||||
|
//locked by scenario
|
||||||
const BuildCommandType *bct= static_cast<const BuildCommandType*>(activeCommandType);
|
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) {
|
void Faction::setLockedUnitForFaction(const UnitType *ut, bool lock) {
|
||||||
if (lock) {
|
if (lock) {
|
||||||
LockedUnits.insert(ut);
|
lockedUnits.insert(ut);
|
||||||
} else {
|
} else {
|
||||||
std::set<const UnitType*>::iterator it;
|
std::set<const UnitType*>::iterator it;
|
||||||
it=LockedUnits.find(ut);
|
it=lockedUnits.find(ut);
|
||||||
if(it!=LockedUnits.end()) {
|
if(it!=lockedUnits.end()) {
|
||||||
LockedUnits.erase(it);
|
lockedUnits.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ private:
|
||||||
std::map<int,int> unitsMovingList;
|
std::map<int,int> unitsMovingList;
|
||||||
std::map<int,int> unitsPathfindingList;
|
std::map<int,int> unitsPathfindingList;
|
||||||
|
|
||||||
std::set<const UnitType*> LockedUnits;
|
std::set<const UnitType*> lockedUnits;
|
||||||
|
|
||||||
TechTree *techTree;
|
TechTree *techTree;
|
||||||
const XmlNode *loadWorldNode;
|
const XmlNode *loadWorldNode;
|
||||||
|
@ -247,7 +247,7 @@ public:
|
||||||
bool canUnitsPathfind();
|
bool canUnitsPathfind();
|
||||||
|
|
||||||
void setLockedUnitForFaction(const UnitType *ut, bool lock);
|
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(
|
void init(
|
||||||
FactionType *factionType, ControlType control, TechTree *techTree, Game *game,
|
FactionType *factionType, ControlType control, TechTree *techTree, Game *game,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user