Author: mordante
Date: Sat Nov  1 17:43:12 2008
New Revision: 30498

URL: http://svn.gna.org/viewcvs/wesnoth?rev=30498&view=rev
Log:
Add the get_screen_size_variables function.

A small refactoring, other places will need the same object soon. Also
changed to only place where this was used.

Modified:
    trunk/src/gui/widgets/helper.cpp
    trunk/src/gui/widgets/helper.hpp
    trunk/src/gui/widgets/window.cpp

Modified: trunk/src/gui/widgets/helper.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/helper.cpp?rev=30498&r1=30497&r2=30498&view=diff
==============================================================================
--- trunk/src/gui/widgets/helper.cpp (original)
+++ trunk/src/gui/widgets/helper.cpp Sat Nov  1 17:43:12 2008
@@ -14,6 +14,7 @@
 
 #include "gui/widgets/helper.hpp"
 
+#include "formula_callable.hpp"
 #include "gettext.hpp"
 #include "gui/widgets/settings.hpp"
 #include "sdl_utils.hpp"
@@ -180,5 +181,14 @@
 
 }
 
+game_logic::map_formula_callable get_screen_size_variables()
+{
+       game_logic::map_formula_callable result;
+       result.add("screen_width", variant(settings::screen_width));
+       result.add("screen_height", variant(settings::screen_height));
+
+       return result;
+}
+
 } // namespace gui2
 

Modified: trunk/src/gui/widgets/helper.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/helper.hpp?rev=30498&r1=30497&r2=30498&view=diff
==============================================================================
--- trunk/src/gui/widgets/helper.hpp (original)
+++ trunk/src/gui/widgets/helper.hpp Sat Nov  1 17:43:12 2008
@@ -21,6 +21,10 @@
 
 class surface;
 class t_string;
+
+namespace game_logic {
+class map_formula_callable;
+} // namespace game_logic
 
 namespace gui2 {
 
@@ -142,6 +146,15 @@
  */
 std::string get_uid();
 
+/** 
+ * Gets a formula object with the screen size.
+ *
+ * @returns                       Formula object with the screen_width and
+ *                                screen_height variable set to the current
+ *                                values of these in settings.
+ */
+game_logic::map_formula_callable get_screen_size_variables();
+
 } // namespace gui2
 
 #endif

Modified: trunk/src/gui/widgets/window.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/window.cpp?rev=30498&r1=30497&r2=30498&view=diff
==============================================================================
--- trunk/src/gui/widgets/window.cpp (original)
+++ trunk/src/gui/widgets/window.cpp Sat Nov  1 17:43:12 2008
@@ -454,9 +454,7 @@
 
                set_size(create_rect(position, size));
        } else {
-               game_logic::map_formula_callable variables;
-               variables.add("screen_width", variant(settings::screen_width));
-               variables.add("screen_height", 
variant(settings::screen_height));
+               game_logic::map_formula_callable variables = 
get_screen_size_variables(); 
 
                set_size(::create_rect(
                        x_(variables), y_(variables), w_(variables), 
h_(variables)));


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

Reply via email to