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

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

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


From: Guillaume Melquiond
Subject: [Wesnoth-cvs-commits] wesnoth/src map.cpp
Date: Thu, 20 Jan 2005 16:59:53 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <address@hidden>    05/01/20 21:59:53

Modified files:
        src            : map.cpp 

Log message:
        Switch map handling to new logging system.

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

Patches:
Index: wesnoth/src/map.cpp
diff -u wesnoth/src/map.cpp:1.46 wesnoth/src/map.cpp:1.47
--- wesnoth/src/map.cpp:1.46    Sat Jan  8 13:39:37 2005
+++ wesnoth/src/map.cpp Thu Jan 20 21:59:52 2005
@@ -1,4 +1,4 @@
-/* $Id: map.cpp,v 1.46 2005/01/08 13:39:37 silene Exp $ */
+/* $Id: map.cpp,v 1.47 2005/01/20 21:59:52 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -14,6 +14,7 @@
 #include "global.hpp"
 
 #include "game.hpp"
+#include "log.hpp"
 #include "map.hpp"
 #include "pathfind.hpp"
 #include "util.hpp"
@@ -25,6 +26,9 @@
 #include <iostream>
 #include <sstream>
 
+#define ERR_CF lg::err(lg::config)
+#define LOG_G lg::info(lg::general)
+
 gamemap::location gamemap::location::null_location;
 
 const std::string& gamemap::underlying_terrain(TERRAIN terrain) const
@@ -162,7 +166,7 @@
 
 gamemap::gamemap(const config& cfg, const std::string& data) : tiles_(1)
 {
-       std::cerr << "loading map: '" << data << "'\n";
+       LOG_G << "loading map: '" << data << "'\n";
        const config::child_list& terrains = cfg.get_children("terrain");
        create_terrain_maps(terrains,terrainList_,letterToTerrain_,terrain_);
 
@@ -189,7 +193,7 @@
                                        startingPositions_[c - '0'] = 
location(x,y);
                                        c = KEEP;
                                } else {
-                                       std::cerr << "Illegal character in map: 
(" << int(c) << ") '" << c << "'\n";
+                                       ERR_CF << "Illegal character in map: (" 
<< int(c) << ") '" << c << "'\n";
                                        throw 
incorrect_format_exception("Illegal character found in map. The scenario cannot 
be loaded.");
                                }
                        }
@@ -208,15 +212,16 @@
                }
        }
 
-       for(size_t n = 0; n != tiles_.size(); ++n) {
-               if(tiles_[n].size() != size_t(this->y())) {
-                       std::cerr << "Map is not rectangular!\n";
+       unsigned ysize = this->y();
+       for(size_t n = 0; n != tiles_.size(); ++n) { // tiles_.size() is not 
constant
+               if (tiles_[n].size() != ysize) {
+                       ERR_CF << "Map is not rectangular!\n";
                        tiles_.erase(tiles_.begin()+n);
                        --n;
                }
        }
 
-       std::cerr << "loaded map: " << this->x() << "," << this->y() << "\n";
+       LOG_G << "loaded map: " << this->x() << ',' << ysize << '\n';
 }
 
 std::string gamemap::write() const




reply via email to

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