Skip to content

Commit

Permalink
Merge pull request #10 from panel-attack/leaderboard
Browse files Browse the repository at this point in the history
show more players at a time on the leaderboard
  • Loading branch information
jon12156 authored May 27, 2018
2 parents 441c22a + 6b65df6 commit 2090690
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions mainloop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ function main_net_vs_lobby()
end
end
leaderboard_first_idx_to_show = math.max((my_rank or 1)-8,1)
leaderboard_last_idx_to_show = math.min((my_rank or 1)+8,#leaderboard_report)
leaderboard_last_idx_to_show = math.min(leaderboard_first_idx_to_show + 20,#leaderboard_report)
leaderboard_string = build_viewable_leaderboard_string(leaderboard_report, leaderboard_first_idx_to_show, leaderboard_last_idx_to_show)
end
end
Expand Down Expand Up @@ -694,18 +694,22 @@ function main_net_vs_lobby()

wait()
if menu_up(k) then
if showing_leaderboard and leaderboard_first_idx_to_show>1 then
leaderboard_first_idx_to_show = leaderboard_first_idx_to_show - 1
leaderboard_last_idx_to_show = leaderboard_last_idx_to_show - 1
leaderboard_string = build_viewable_leaderboard_string(leaderboard_report, leaderboard_first_idx_to_show, leaderboard_last_idx_to_show)
if showing_leaderboard then
if leaderboard_first_idx_to_show>1 then
leaderboard_first_idx_to_show = leaderboard_first_idx_to_show - 1
leaderboard_last_idx_to_show = leaderboard_last_idx_to_show - 1
leaderboard_string = build_viewable_leaderboard_string(leaderboard_report, leaderboard_first_idx_to_show, leaderboard_last_idx_to_show)
end
else
active_idx = wrap(1, active_idx-1, #items)
end
elseif menu_down(k) then
if showing_leaderboard and leaderboard_last_idx_to_show < #leaderboard_report then
leaderboard_first_idx_to_show = leaderboard_first_idx_to_show + 1
leaderboard_last_idx_to_show = leaderboard_last_idx_to_show + 1
leaderboard_string = build_viewable_leaderboard_string(leaderboard_report, leaderboard_first_idx_to_show, leaderboard_last_idx_to_show)
if showing_leaderboard then
if leaderboard_last_idx_to_show < #leaderboard_report then
leaderboard_first_idx_to_show = leaderboard_first_idx_to_show + 1
leaderboard_last_idx_to_show = leaderboard_last_idx_to_show + 1
leaderboard_string = build_viewable_leaderboard_string(leaderboard_report, leaderboard_first_idx_to_show, leaderboard_last_idx_to_show)
end
else
active_idx = wrap(1, active_idx+1, #items)
end
Expand Down

0 comments on commit 2090690

Please sign in to comment.