Add friction to mindless clicking by disabling default action preselection in Monopoly menus
This commit is contained in:
@@ -51,7 +51,7 @@ void MonopolyGame::init() {
|
||||
has_rolled = false;
|
||||
double_rolls = 0;
|
||||
just_sent_to_jail = false;
|
||||
selected_action = 0;
|
||||
selected_action = -1;
|
||||
srand(time(NULL));
|
||||
shuffle_chance_deck();
|
||||
shuffle_community_deck();
|
||||
@@ -147,6 +147,7 @@ bool MonopolyGame::update(const InputEvent& event) {
|
||||
// We'll apply the effect when CommunityChestModal is dismissed
|
||||
}
|
||||
if (active_modal) active_modal->init();
|
||||
else selected_action = -1;
|
||||
return needs_redraw;
|
||||
} else if (chance_modal && chance_modal->is_dismissed()) {
|
||||
const ChanceCard* card = &CHANCE_DECK[last_drawn_chance_idx];
|
||||
@@ -234,9 +235,9 @@ bool MonopolyGame::update(const InputEvent& event) {
|
||||
}
|
||||
bool can_afford = (p->balance >= landed->cost);
|
||||
active_modal = new PropertyModalGame(width, height, renderer, gui, input_manager, landed, is_owned, owner_name, owner_id, can_afford, players, players_count, current_player_idx);
|
||||
if (active_modal) active_modal->init();
|
||||
}
|
||||
}
|
||||
return needs_redraw;
|
||||
} else if (community_modal && community_modal->is_dismissed()) {
|
||||
const CommunityCard* card = &COMMUNITY_DECK[last_drawn_community_idx];
|
||||
last_drawn_community_idx = -1;
|
||||
@@ -299,9 +300,9 @@ bool MonopolyGame::update(const InputEvent& event) {
|
||||
}
|
||||
bool can_afford = (p->balance >= landed->cost);
|
||||
active_modal = new PropertyModalGame(width, height, renderer, gui, input_manager, landed, is_owned, owner_name, owner_id, can_afford, players, players_count, current_player_idx);
|
||||
if (active_modal) active_modal->init();
|
||||
}
|
||||
}
|
||||
return needs_redraw;
|
||||
} else if (prop_modal && prop_modal->is_dismissed()) {
|
||||
if (prop_modal->wants_to_buy()) {
|
||||
const BoardTile* tile = &MONOPOLY_BOARD[p->position];
|
||||
@@ -383,6 +384,10 @@ bool MonopolyGame::update(const InputEvent& event) {
|
||||
needs_redraw = true;
|
||||
ModalButtonHelper::set_monopoly_regions(input_manager, width, height);
|
||||
}
|
||||
|
||||
if (active_modal == nullptr && needs_redraw) {
|
||||
selected_action = -1;
|
||||
}
|
||||
return needs_redraw;
|
||||
}
|
||||
|
||||
@@ -392,11 +397,13 @@ bool MonopolyGame::update(const InputEvent& event) {
|
||||
needs_redraw = true;
|
||||
break;
|
||||
case INPUT_BUTTON_1:
|
||||
if (selected_action == -1) return false;
|
||||
|
||||
if (p->is_in_jail && !has_rolled && selected_action == 1) {
|
||||
p->balance -= 50;
|
||||
p->is_in_jail = false;
|
||||
p->jail_turns = 0;
|
||||
selected_action = 0;
|
||||
selected_action = -1;
|
||||
needs_redraw = true;
|
||||
return true;
|
||||
}
|
||||
@@ -466,7 +473,7 @@ roll_dice_logic:
|
||||
needs_redraw = true;
|
||||
} else {
|
||||
current_player_idx = (current_player_idx + 1) % players_count;
|
||||
has_rolled = false; double_rolls = 0; just_sent_to_jail = false; selected_action = 0;
|
||||
has_rolled = false; double_rolls = 0; just_sent_to_jail = false; selected_action = -1;
|
||||
active_modal = new TurnModalGame(width, height, renderer, gui, input_manager, &players[current_player_idx]);
|
||||
needs_redraw = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user