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

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

[Wesnoth-cvs-commits] wesnoth/src game.cpp


From: David White
Subject: [Wesnoth-cvs-commits] wesnoth/src game.cpp
Date: Mon, 05 Sep 2005 10:27:30 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     David White <address@hidden>    05/09/05 14:27:30

Modified files:
        src            : game.cpp 

Log message:
        made the campaign server window refuse to display images larger than 
80x80

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game.cpp.diff?tr1=1.275&tr2=1.276&r1=text&r2=text

Patches:
Index: wesnoth/src/game.cpp
diff -u wesnoth/src/game.cpp:1.275 wesnoth/src/game.cpp:1.276
--- wesnoth/src/game.cpp:1.275  Sun Sep  4 20:50:23 2005
+++ wesnoth/src/game.cpp        Mon Sep  5 14:27:30 2005
@@ -1,4 +1,4 @@
-/* $Id: game.cpp,v 1.275 2005/09/04 20:50:23 j_daniel Exp $ */
+/* $Id: game.cpp,v 1.276 2005/09/05 14:27:30 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -929,9 +929,18 @@
                        }
 
                        //add negative sizes to reverse the sort order
-                       sizes.push_back(-atoi((**i)["size"].c_str()));
+                       sizes.push_back(-atoi((**i)["size"].c_str()));
+
+                       const int max_icon_dim = 80;
+
+                       //make sure the icon isn't too big
+                       std::string icon = (**i)["icon"];
+                       const surface icon_img = 
image::get_image(icon,image::UNSCALED);
+                       if(icon_img.null() == false && icon_img->w > 
max_icon_dim && icon_img->h > max_icon_dim) {
+                               icon = "";
+                       }
 
-                       options.push_back(IMAGE_PREFIX + (**i)["icon"].str() + 
COLUMN_SEPARATOR +
+                       options.push_back(IMAGE_PREFIX + icon + 
COLUMN_SEPARATOR +
                                          title + COLUMN_SEPARATOR +
                                          version + COLUMN_SEPARATOR +
                                          author + COLUMN_SEPARATOR +




reply via email to

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