From: terencehill Date: Wed, 30 Dec 2020 22:29:22 +0000 (+0100) Subject: Map vote: cycle through all the maps by pressing uparrow/downarrow key rather than... X-Git-Tag: xonotic-v0.8.5~615 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7a27cb5d80edfa6ea8accafa2d38eb30a5d474ce;p=xonotic%2Fxonotic-data.pk3dir.git Map vote: cycle through all the maps by pressing uparrow/downarrow key rather than cycling only through maps in the same column; it also fixes a crash due to inifinite recursion when all maps in a column are faded out --- diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index 5be42cda9..40d8e0d07 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -770,9 +770,11 @@ int MapVote_MoveUp(int pos) imp = pos - mv_columns; if ( imp < 0 ) { - imp = floor(mv_num_maps/mv_columns)*mv_columns + pos % mv_columns; - if ( imp >= mv_num_maps ) - imp -= mv_columns; + int mv_rows = ceil(mv_num_maps / mv_columns); + if (imp == -mv_columns) // pos == 0 + imp = mv_columns * mv_rows - 1; + else + imp = imp + mv_columns * mv_rows - 1; } } if ( !(mv_flags[imp] & GTV_AVAILABLE) && imp != mv_ownvote ) @@ -789,7 +791,12 @@ int MapVote_MoveDown(int pos) { imp = pos + mv_columns; if ( imp >= mv_num_maps ) - imp = imp % mv_columns; + { + if ((imp % mv_columns) == mv_columns - 1) + imp = 0; + else + imp = imp % mv_columns + 1; + } } if ( !(mv_flags[imp] & GTV_AVAILABLE) && imp != mv_ownvote ) imp = MapVote_MoveDown(imp);