[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src image.cpp
From: |
Guillaume Melquiond |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src image.cpp |
Date: |
Tue, 08 Feb 2005 15:31:56 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Guillaume Melquiond <address@hidden> 05/02/08 20:31:56
Modified files:
src : image.cpp
Log message:
Fix zipios support so that images can be loaded from user campaigns.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/image.cpp.diff?tr1=1.73&tr2=1.74&r1=text&r2=text
Patches:
Index: wesnoth/src/image.cpp
diff -u wesnoth/src/image.cpp:1.73 wesnoth/src/image.cpp:1.74
--- wesnoth/src/image.cpp:1.73 Tue Feb 8 20:24:49 2005
+++ wesnoth/src/image.cpp Tue Feb 8 20:31:55 2005
@@ -204,18 +204,20 @@
{
surface res;
+ std::string const &location = get_binary_file_location("images",
val_.filename_);
+ if (!location.empty()) {
#ifdef USE_ZIPIOS
- std::string const &s = read_file("images/" + val_.filename_);
- if (!s.empty()) {
- SDL_RWops* ops = SDL_RWFromMem((void*)s.c_str(), s.size());
- res = IMG_Load_RW(ops, 0);
- SDL_FreeRW(ops);
- }
+ std::string const &s = read_file(location);
+ if (!s.empty()) {
+ SDL_RWops* ops = SDL_RWFromMem((void*)s.c_str(),
s.size());
+ res = IMG_Load_RW(ops, 0);
+ SDL_FreeRW(ops);
+ }
#else
- std::string const &location = get_binary_file_location("images",
val_.filename_);
- if (!location.empty())
res = IMG_Load(location.c_str());
#endif
+ }
+
if (res.null())
ERR_DP << "could not open image '" << val_.filename_ << "'\n";