|
@@ -863,6 +863,7 @@ void CCastleBuildings::enterCastleGate()
|
|
|
return;//only visiting hero can use castle gates
|
|
|
}
|
|
|
std::vector <int> availableTowns;
|
|
|
+ std::vector<std::shared_ptr<IImage>> images;
|
|
|
std::vector <const CGTownInstance*> Towns = LOCPLINT->localState->getOwnedTowns();
|
|
|
for(auto & Town : Towns)
|
|
|
{
|
|
@@ -872,23 +873,19 @@ void CCastleBuildings::enterCastleGate()
|
|
|
t->hasBuilt(BuildingSubID::CASTLE_GATE)) //and the town has a castle gate
|
|
|
{
|
|
|
availableTowns.push_back(t->id.getNum());//add to the list
|
|
|
+ if(settings["general"]["enableUiEnhancements"].Bool())
|
|
|
+ {
|
|
|
+ std::shared_ptr<CAnimation> a = GH.renderHandler().loadAnimation(AnimationPath::builtin("ITPA"));
|
|
|
+ a->preload();
|
|
|
+ images.push_back(a->getImage(t->town->clientInfo.icons[t->hasFort()][false] + 2)->scaleFast(Point(35, 23)));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- std::vector<std::shared_ptr<IImage>> images;
|
|
|
- for(auto & t : Towns)
|
|
|
- {
|
|
|
- if(!settings["general"]["enableUiEnhancements"].Bool())
|
|
|
- break;
|
|
|
- std::shared_ptr<CAnimation> a = GH.renderHandler().loadAnimation(AnimationPath::builtin("ITPA"));
|
|
|
- a->preload();
|
|
|
- images.push_back(a->getImage(t->town->clientInfo.icons[t->hasFort()][false] + 2)->scaleFast(Point(35, 23)));
|
|
|
- }
|
|
|
-
|
|
|
auto gateIcon = std::make_shared<CAnimImage>(town->town->clientInfo.buildingsIcons, BuildingID::CASTLE_GATE);//will be deleted by selection window
|
|
|
auto wnd = std::make_shared<CObjectListWindow>(availableTowns, gateIcon, CGI->generaltexth->jktexts[40],
|
|
|
CGI->generaltexth->jktexts[41], std::bind (&CCastleInterface::castleTeleport, LOCPLINT->castleInt, _1), 0, images);
|
|
|
- wnd->onPopup = [Towns](int index) { CRClickPopup::createAndPush(Towns[index], GH.getCursorPosition()); };
|
|
|
+ wnd->onPopup = [availableTowns](int index) { CRClickPopup::createAndPush(LOCPLINT->cb->getObjInstance(ObjectInstanceID(availableTowns[index])), GH.getCursorPosition()); };
|
|
|
GH.windows().pushWindow(wnd);
|
|
|
}
|
|
|
|