void iwMilitaryBuilding::Msg_ButtonClick(const unsigned int ctrl_id) { switch(ctrl_id) { case 4: // Hilfe { WindowManager::inst().Show(new iwHelp(GUI_ID(CGI_HELPBUILDING+building->GetBuildingType()),_(BUILDING_NAMES[building->GetBuildingType()]), _(BUILDING_HELP_STRINGS[building->GetBuildingType()]))); } break; case 5: // Gebäude abbrennen { // Darf das Gebäude abgerissen werden? if(!building->IsDemolitionAllowed()) { // Messagebox anzeigen DemolitionNotAllowed(); } else { // Abreißen? Close(); WindowManager::inst().Show(new iwDemolishBuilding(gwv, building)); } } break; case 6: // Gold einstellen/erlauben { if(!GameClient::inst().IsReplayModeOn() && !GameClient::inst().IsPaused()) { // visuell anzeigen building->StopGoldVirtual(); // NC senden GAMECLIENT.AddGC(new gc::StopGold(building->GetX(), building->GetY())); // anderes Bild auf dem Button if(building->IsGoldDisabledVirtual()) GetCtrl<ctrlImageButton>(6)->SetImage(LOADER.GetImageN("io", 226)); else GetCtrl<ctrlImageButton>(6)->SetImage(LOADER.GetImageN("io", 227)); } } break; case 7: // "Gehe Zu Ort" { gwv->MoveToMapObject(building->GetX(), building->GetY()); } break; } }
void iwMilitaryBuilding::Msg_ButtonClick(const unsigned int ctrl_id) { switch(ctrl_id) { case 4: // Hilfe { WINDOWMANAGER.Show(new iwHelp(GUI_ID(CGI_HELPBUILDING + building->GetBuildingType()), _(BUILDING_NAMES[building->GetBuildingType()]), _(BUILDING_HELP_STRINGS[building->GetBuildingType()]))); } break; case 5: // Gebäude abbrennen { // Darf das Gebäude abgerissen werden? if(!building->IsDemolitionAllowed()) { // Messagebox anzeigen DemolitionNotAllowed(); } else { // Abreißen? Close(); WINDOWMANAGER.Show(new iwDemolishBuilding(gwv, building)); } } break; case 6: // Gold einstellen/erlauben { if(!GAMECLIENT.IsReplayModeOn() && !GAMECLIENT.IsPaused()) { // visuell anzeigen building->ToggleCoinsVirtual(); // NC senden GAMECLIENT.ToggleCoins(building->GetPos()); // anderes Bild auf dem Button if(building->IsGoldDisabledVirtual()) GetCtrl<ctrlImageButton>(6)->SetImage(LOADER.GetImageN("io", 226)); else GetCtrl<ctrlImageButton>(6)->SetImage(LOADER.GetImageN("io", 227)); } } break; case 7: // "Gehe Zu Ort" { gwv->MoveToMapObject(building->GetPos()); } break; case 9: //go to next of same type { //is there at least 1 other building of the same type? if(GAMECLIENT.GetPlayer(building->GetPlayer())->GetMilitaryBuildings().size()>1) { //go through list once we get to current building -> open window for the next one and go to next location for(std::list<nobMilitary*>::const_iterator it=GAMECLIENT.GetPlayer(building->GetPlayer())->GetMilitaryBuildings().begin(); it != GAMECLIENT.GetPlayer(building->GetPlayer())->GetMilitaryBuildings().end(); it++) { if((*it)->GetX()==building->GetX() && (*it)->GetY()==building->GetY()) //got to current building in the list? { //close old window, open new window (todo: only open if it isnt already open), move to location of next building Close(); it++; if(it == GAMECLIENT.GetPlayer(building->GetPlayer())->GetMilitaryBuildings().end()) //was last entry in list -> goto first { it=GAMECLIENT.GetPlayer(building->GetPlayer())->GetMilitaryBuildings().begin(); gwv->MoveToMapObject((*it)->GetPos()); iwMilitaryBuilding* nextscrn=new iwMilitaryBuilding(gwv, gi, (*it)); nextscrn->Move(x,y); WINDOWMANAGER.Show(nextscrn); break; } } } } break; case 10: //send home button (addon) { GAMECLIENT.SendSoldiersHome(building->GetPos()); } break; } }