Skip to content

Commit

Permalink
show info for clicked city
Browse files Browse the repository at this point in the history
  • Loading branch information
rooklift committed Sep 2, 2021
1 parent 28a4aa4 commit 5b46c55
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
10 changes: 8 additions & 2 deletions modules/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,15 @@ function draw_info(replay, index, infodiv, selection) {

if (house) {

cell_line += ` - <span class="team_${house.team}">house (${house.id})</span>,
cell_line += ` - <span class="team_${house.team}">house</span>,
cd: <span class="team_${house.team}">${house.cd}</span>,
cmd: <span class="team_${house.team}">${replay.get_orders_for_house(index, house.x, house.y)}</span>`;
cmd: <span class="team_${house.team}">${replay.get_orders_for_house(index, house.x, house.y)}</span><br>`;

let city = replay.get_city_by_id(index, house.id);

cell_line += `- city <span class="team_${house.team}">${city.id}</span>,
fuel: <span class="team_${house.team}">${city.fuel}</span>,
upkeep: <span class="team_${house.team}">${city.upkeep}</span><br>`;

} else if (cell.type) {

Expand Down
4 changes: 4 additions & 0 deletions modules/replay_kaggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ let kaggle_replay_props = {
get_unit_by_id(i, id) {
return this.get_units(i).filter(u => u.id === id)[0];
},

get_city_by_id(i, id) {
return this.get_cities(i).filter(u => u.id === id)[0];
},
};

// ------------------------------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions modules/replay_stateful.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ let stateful_replay_props = {
return this.get_units(i).filter(u => u.id === id)[0];
},

get_city_by_id(i, id) {
return this.get_cities(i).filter(u => u.id === id)[0];
},
};

// ------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit 5b46c55

Please sign in to comment.