Skip to content

Commit

Permalink
Merge pull request #382 from kvilhaugsvik/act_sel
Browse files Browse the repository at this point in the history
Unit action decision wanted marker
  • Loading branch information
andreasrosdal authored Apr 20, 2021
2 parents e0779a4 + c663ce6 commit a9c1313
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions freeciv-web/src/main/webapp/javascript/2dcanvas/tilespec.js
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,14 @@ function fill_unit_sprite_array(punit, stacked, backdrop)
result.push(activities);
}

if (should_ask_server_for_actions(punit)) {
result.push({
"key" : "unit.action_decision_want",
"offset_x" : unit_activity_offset_x + unit_offset['x'],
"offset_y" : -unit_activity_offset_y + unit_offset['y'],
});
}

result.push(get_unit_hp_sprite(punit));
if (stacked) result.push(get_unit_stack_sprite());
if (punit['veteran'] > 0) result.push(get_unit_veteran_sprite(punit));
Expand Down
13 changes: 13 additions & 0 deletions freeciv-web/src/main/webapp/javascript/control.js
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,19 @@ function check_text_input(event,chatboxtextarea) {



/**********************************************************************//**
Returns TRUE iff the client should ask the server about what actions a
unit can perform.
**************************************************************************/
function should_ask_server_for_actions(punit)
{
return (punit['action_decision_want'] === ACT_DEC_ACTIVE
/* The player is interested in getting a pop up for a mere
* arrival. */
|| (punit['action_decision_want'] === ACT_DEC_PASSIVE
&& popup_actor_arrival));
}

/**********************************************************************//**
Ask the server about what actions punit may be able to perform against
it's stored target tile.
Expand Down

0 comments on commit a9c1313

Please sign in to comment.