Author: sapient
Date: Mon Jul  2 02:24:58 2007
New Revision: 18610

URL: http://svn.gna.org/viewcvs/wesnoth?rev=18610&view=rev
Log:
tightening the loop; same logic, just looks better

Modified:
    trunk/src/widgets/menu.cpp

Modified: trunk/src/widgets/menu.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/widgets/menu.cpp?rev=18610&r1=18609&r2=18610&view=diff
==============================================================================
--- trunk/src/widgets/menu.cpp (original)
+++ trunk/src/widgets/menu.cpp Mon Jul  2 02:24:58 2007
@@ -1005,16 +1005,12 @@
 {
        std::vector<int> const &widths = column_widths();
        x -= location().x;
-       int j = -1, j_end = widths.size();
-       while(true) {
-               if (x < 0) {
-                       return j;
-               }
+       for(int j = -1, j_end = widths.size(); x >= 0; x -= widths[j]) {
                if(++j == j_end) {
                        return -1;
                }
-               x -= widths[j];
-       }
+       }
+       return j;
 }
 
 std::pair<int,int> menu::hit_cell(int x, int y) const


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to