You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (map->get_obj(clk_pos) == Map::ObjectFlag) {
if (map->get_owner(clk_pos) == player->get_index()) {
interface->build_road_begin();
//move to 2nd button interface->open_popup(PopupBox::TypeTransportInfo);
}
player->temp_index = map->get_obj_index(clk_pos);
} else { /* Building */
...
viewport.h:
...
virtual bool handle_click_right(int x, int y);
...
gui.cc:
case Event::TypeClick:
if (event->button == Event::ButtonLeft) {
result = handle_click_left(event_x, event_y);
}
if (event->button == Event::ButtonRight) {
result = handle_click_right(event_x, event_y);
}
break;
add this to viewport.cc:
bool
Viewport::handle_click_right(int lx, int ly) {
set_redraw();
Player *player = interface->get_player();
MapPos clk_pos = map_pos_from_screen_pix(lx, ly);
if (interface->is_building_road()) {
return false;
} else {
if ((map->get_obj(clk_pos) == Map::ObjectFlag) && (map->get_owner(clk_pos) == player->get_index())) {
//flag popup
interface->update_map_cursor_pos(clk_pos);
player->temp_index = map->get_obj_index(clk_pos);
play_sound(Audio::TypeSfxClick);
interface->open_popup(PopupBox::TypeTransportInfo);
interface->update_map_cursor_pos(clk_pos);
return false;
}
}
return true;
}
...
bool
Viewport::handle_dbl_click(int lx, int ly, Event::Button button) {
...
} else {
//build dblclick fix
Log::Info["map:get_obj"] << "object: " << map->get_obj(clk_pos);
switch (interface->get_build_possibility()) {
case Interface::BuildPossibilityFlag:
if ((map->get_obj(clk_pos) == Map::ObjectNone) ||
(map->get_obj(clk_pos) == Map::ObjectFelledPine4) || (map->get_obj(clk_pos) == Map::ObjectFelledTree4) ||
(map->get_obj(clk_pos) >= Map::ObjectStub && map->get_obj(clk_pos) <= Map::ObjectCadaver1)) {
interface->get_game()->build_flag(interface->get_map_cursor_pos(),player);
interface->update_map_cursor_pos(clk_pos);
play_sound(Audio::TypeSfxClick);
return false;
}
break;
case Interface::BuildPossibilityCastle:
if ((map->get_obj(clk_pos) == Map::ObjectNone) ||
(map->get_obj(clk_pos) >= Map::ObjectStub && map->get_obj(clk_pos) <= Map::ObjectSandstone3)) {
interface->get_game()->build_castle(interface->get_map_cursor_pos(),player);
interface->update_map_cursor_pos(clk_pos);
play_sound(Audio::TypeSfxClick);
return false;
}
break;
case Interface::BuildPossibilityMine:
if ((map->get_obj(clk_pos) == Map::ObjectNone) ||
(map->get_obj(clk_pos) >= Map::ObjectSignLargeGold && map->get_obj(clk_pos) <= Map::ObjectSignEmpty)) {
interface->open_popup(PopupBox::TypeMineBuilding);
interface->update_map_cursor_pos(clk_pos);
play_sound(Audio::TypeSfxClick);
return false;
}
break;
case Interface::BuildPossibilitySmall:
if ((map->get_obj(clk_pos) == Map::ObjectNone) ||
(map->get_obj(clk_pos) == Map::ObjectFelledPine4) || (map->get_obj(clk_pos) == Map::ObjectFelledTree4) ||
(map->get_obj(clk_pos) >= Map::ObjectStub && map->get_obj(clk_pos) <= Map::ObjectSandstone3)) {
interface->open_popup(PopupBox::TypeBasicBld);
interface->update_map_cursor_pos(clk_pos);
play_sound(Audio::TypeSfxClick);
return false;
}
break;
case Interface::BuildPossibilityLarge:
if ((map->get_obj(clk_pos) == Map::ObjectNone) ||
(map->get_obj(clk_pos) == Map::ObjectFelledPine4) || (map->get_obj(clk_pos) == Map::ObjectFelledTree4) ||
(map->get_obj(clk_pos) >= Map::ObjectStub && map->get_obj(clk_pos) <= Map::ObjectSandstone3)) {
interface->open_popup(PopupBox::TypeBasicBldFlip);
interface->update_map_cursor_pos(clk_pos);
play_sound(Audio::TypeSfxClick);
return false;
}
break;
default:
break;
}
if (map->get_obj(clk_pos) > Map::ObjectCastle) {
return false;
}
...
viewport.h:
...
virtual bool handle_click_right(int x, int y);
...
gui.cc:
case Event::TypeClick:
if (event->button == Event::ButtonLeft) {
result = handle_click_left(event_x, event_y);
}
if (event->button == Event::ButtonRight) {
result = handle_click_right(event_x, event_y);
}
break;
gui.h:
virtual bool handle_click_right(int x, int y) { return false; }
The text was updated successfully, but these errors were encountered: