wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src sdl_utils.cpp sdl_utils.hpp


From: Guillaume Melquiond
Subject: [Wesnoth-cvs-commits] wesnoth/src sdl_utils.cpp sdl_utils.hpp
Date: Sun, 29 Aug 2004 13:22:36 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <address@hidden>    04/08/29 17:17:46

Modified files:
        src            : sdl_utils.cpp sdl_utils.hpp 

Log message:
        No need for pixel_data::read to be in the header; it's too big to be 
inlined anyway. Remove the dependence on config.hpp as a side effect.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/sdl_utils.cpp.diff?tr1=1.55&tr2=1.56&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/sdl_utils.hpp.diff?tr1=1.41&tr2=1.42&r1=text&r2=text

Patches:
Index: wesnoth/src/sdl_utils.cpp
diff -u wesnoth/src/sdl_utils.cpp:1.55 wesnoth/src/sdl_utils.cpp:1.56
--- wesnoth/src/sdl_utils.cpp:1.55      Tue Aug 24 01:12:03 2004
+++ wesnoth/src/sdl_utils.cpp   Sun Aug 29 17:17:45 2004
@@ -1,4 +1,4 @@
-/* $Id: sdl_utils.cpp,v 1.55 2004/08/24 01:12:03 Sirp Exp $ */
+/* $Id: sdl_utils.cpp,v 1.56 2004/08/29 17:17:45 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -15,6 +15,7 @@
 #include <cmath>
 #include <iostream>
 
+#include "config.hpp"
 #include "game.hpp"
 #include "log.hpp"
 #include "sdl_utils.hpp"
@@ -731,6 +732,27 @@
        return !operator==(a,b);
 }
 
+void pixel_data::read(const config& cfg) {
+       const std::string& red = cfg["red"];
+       const std::string& green = cfg["green"];
+       const std::string& blue = cfg["blue"];
+
+       if (red.empty())
+               r = 0;
+       else
+               r = atoi(red.c_str());
+
+       if (green.empty())
+               g = 0;
+       else
+               g = atoi(green.c_str());
+
+       if (blue.empty())
+               b = 0;
+       else
+               b = atoi(blue.c_str());
+}
+
 namespace {
        const SDL_Rect empty_rect = {0,0,0,0};
 }
Index: wesnoth/src/sdl_utils.hpp
diff -u wesnoth/src/sdl_utils.hpp:1.41 wesnoth/src/sdl_utils.hpp:1.42
--- wesnoth/src/sdl_utils.hpp:1.41      Sun Aug 15 19:42:44 2004
+++ wesnoth/src/sdl_utils.hpp   Sun Aug 29 17:17:45 2004
@@ -1,4 +1,4 @@
-/* $Id: sdl_utils.hpp,v 1.41 2004/08/15 19:42:44 gruikya Exp $ */
+/* $Id: sdl_utils.hpp,v 1.42 2004/08/29 17:17:45 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -13,7 +13,6 @@
 #ifndef SDL_UTILS_INCLUDED
 #define SDL_UTILS_INCLUDED
 
-#include "config.hpp"
 #include "scoped_resource.hpp"
 
 #include "SDL.h"
@@ -120,6 +119,8 @@
 bool operator==(const SDL_Rect& a, const SDL_Rect& b);
 bool operator!=(const SDL_Rect& a, const SDL_Rect& b);
 
+struct config; // no need to include config.hpp
+
 struct pixel_data
 {
        pixel_data() : r(0), g(0), b(0)
@@ -146,26 +147,7 @@
                b = ((pixel&fmt->Bmask) >> fmt->Bshift);
        }
 
-       void read(const config& cfg) {
-               const std::string& red = cfg["red"];
-               const std::string& green = cfg["green"];
-               const std::string& blue = cfg["blue"];
-
-               if(red.empty())
-                       r = 0;
-               else
-                       r = atoi(red.c_str());
-
-               if(green.empty())
-                       g = 0;
-               else
-                       g = atoi(green.c_str());
-
-               if(blue.empty())
-                       b = 0;
-               else
-                       b = atoi(blue.c_str());
-       }
+       void read(const config& cfg);
 
        int r, g, b;
 };




reply via email to

[Prev in Thread] Current Thread [Next in Thread]