[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src actions.cpp display.cpp dialogs.cpp...
From: |
Guillaume Melquiond |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src actions.cpp display.cpp dialogs.cpp... |
Date: |
Tue, 05 Oct 2004 17:35:24 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Guillaume Melquiond <address@hidden> 04/10/05 21:28:12
Modified files:
src : actions.cpp display.cpp dialogs.cpp config.cpp
cavegen.cpp builder.cpp
Log message:
Switched to new logging system
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/actions.cpp.diff?tr1=1.157&tr2=1.158&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.cpp.diff?tr1=1.263&tr2=1.264&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/dialogs.cpp.diff?tr1=1.58&tr2=1.59&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/config.cpp.diff?tr1=1.109&tr2=1.110&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/cavegen.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/builder.cpp.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
Patches:
Index: wesnoth/src/actions.cpp
diff -u wesnoth/src/actions.cpp:1.157 wesnoth/src/actions.cpp:1.158
--- wesnoth/src/actions.cpp:1.157 Mon Sep 27 00:24:41 2004
+++ wesnoth/src/actions.cpp Tue Oct 5 21:28:12 2004
@@ -1,4 +1,4 @@
-/* $Id: actions.cpp,v 1.157 2004/09/27 00:24:41 ydirson Exp $ */
+/* $Id: actions.cpp,v 1.158 2004/10/05 21:28:12 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1314,7 +1314,7 @@
statistics::advance_unit(new_unit);
preferences::encountered_units().insert(new_unit.type().name());
- std::cout << "Added '" << new_unit.type().name() << "' to encountered
units" << std::endl;
+ lg::info(lg::config) << "Added '" << new_unit.type().name() << "' to
encountered units\n";
units.erase(loc);
units.insert(std::pair<gamemap::location,unit>(loc,new_unit));
Index: wesnoth/src/builder.cpp
diff -u wesnoth/src/builder.cpp:1.35 wesnoth/src/builder.cpp:1.36
--- wesnoth/src/builder.cpp:1.35 Sun Sep 19 07:24:59 2004
+++ wesnoth/src/builder.cpp Tue Oct 5 21:28:12 2004
@@ -1,4 +1,4 @@
-/* $Id: builder.cpp,v 1.35 2004/09/19 07:24:59 silene Exp $ */
+/* $Id: builder.cpp,v 1.36 2004/10/05 21:28:12 silene Exp $ */
/*
Copyright (C) 2004 by Philippe Plantier <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -22,6 +22,8 @@
#include "terrain.hpp"
#include "util.hpp"
+#define ERR_NG lg::err(lg::engine)
+
namespace {
class locator_string_initializer : public
animated<image::locator>::string_initializer
@@ -373,7 +375,7 @@
size_t pos;
if(token.empty()) {
- std::cerr << "Error: empty token in replace_token\n";
+ ERR_NG << "empty token in replace_token\n";
return;
}
while((pos = s.find(token)) != std::string::npos) {
@@ -432,7 +434,7 @@
{
building_rule ret;
if(rot.size() != 6) {
- std::cerr << "Error: invalid rotations\n";
+ ERR_NG << "invalid rotations\n";
return ret;
}
ret.location_constraints = rule.location_constraints;
@@ -700,7 +702,7 @@
if((**tc)["pos"].size()) {
int pos = atoi((**tc)["pos"].c_str());
if(anchors.find(pos) == anchors.end()) {
- std::cerr << "Invalid anchor!\n";
+ lg::warn(lg::engine) << "Invalid
anchor!\n";
continue;
}
Index: wesnoth/src/cavegen.cpp
diff -u wesnoth/src/cavegen.cpp:1.7 wesnoth/src/cavegen.cpp:1.8
--- wesnoth/src/cavegen.cpp:1.7 Sun Aug 15 13:07:14 2004
+++ wesnoth/src/cavegen.cpp Tue Oct 5 21:28:12 2004
@@ -1,7 +1,10 @@
#include "cavegen.hpp"
+#include "log.hpp"
#include "pathfind.hpp"
#include "util.hpp"
+#define LOG_NG lg::info(lg::engine)
+
cave_map_generator::cave_map_generator(const config* cfg) : wall_('W'),
clear_('u'), village_('D'), castle_('o'),
cfg_(cfg),
width_(50), height_(50), village_density_(0),
flipx_(false), flipy_(false)
@@ -20,7 +23,7 @@
flipx_ = r < chance;
- std::cerr << "flipx: " << r << " < " << chance << " = " << (flipx_ ?
"true" : "false") << "\n";
+ LOG_NG << "flipx: " << r << " < " << chance << " = " << (flipx_ ?
"true" : "false") << "\n";
flipy_ = (rand()%100) < atoi((*cfg_)["flipy_chance"].c_str());
@@ -68,21 +71,21 @@
res_ = *settings;
}
- std::cerr << "creating scenario....\n";
+ LOG_NG << "creating scenario....\n";
generate_chambers();
- std::cerr << "placing chambers...\n";
+ LOG_NG << "placing chambers...\n";
for(std::vector<chamber>::const_iterator c = chambers_.begin(); c !=
chambers_.end(); ++c) {
place_chamber(*c);
}
- std::cerr << "placing passages...\n";
+ LOG_NG << "placing passages...\n";
for(std::vector<passage>::const_iterator p = passages_.begin(); p !=
passages_.end(); ++p) {
place_passage(*p);
}
- std::cerr << "outputting map....\n";
+ LOG_NG << "outputting map....\n";
std::stringstream out;
for(size_t y = 0; y != height_; ++y) {
for(size_t x = 0; x != width_; ++x) {
@@ -94,7 +97,7 @@
res_["map_data"] = out.str();
- std::cerr << "returning result...\n";
+ LOG_NG << "returning result...\n";
return res_;
}
Index: wesnoth/src/config.cpp
diff -u wesnoth/src/config.cpp:1.109 wesnoth/src/config.cpp:1.110
--- wesnoth/src/config.cpp:1.109 Sun Sep 12 21:55:19 2004
+++ wesnoth/src/config.cpp Tue Oct 5 21:28:12 2004
@@ -1,4 +1,4 @@
-/* $Id: config.cpp,v 1.109 2004/09/12 21:55:19 Sirp Exp $ */
+/* $Id: config.cpp,v 1.110 2004/10/05 21:28:12 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -35,6 +35,10 @@
#include "util.hpp"
#include "wesconfig.h"
+#define ERR_CF lg::err(lg::config)
+#define WRN_CF lg::warn(lg::config)
+#define LOG_CF lg::info(lg::config)
+
bool operator<(const line_source& a, const line_source& b)
{
return a.linenum < b.linenum;
@@ -268,7 +272,7 @@
const preproc_define& val = defines_map[symbol];
if(val.arguments.size() != items.size()) {
- std::cerr << "error: preprocessor
symbol '" << symbol << "' has "
+ ERR_CF << "preprocessor symbol '" <<
symbol << "' has "
<< items.size() << "
arguments, "
<<
val.arguments.size() << " expected: '" << newfilename << "'\n";
}
@@ -288,7 +292,7 @@
str.replace(pos,item.size(),replace_with);
const std::string::size_type
new_pos = str.find(item);
if(new_pos <
pos+replace_with.size()) {
- std::cerr << "macro
substitution in symbol '" << symbol
+ ERR_CF << "macro
substitution in symbol '" << symbol
<< "'
could lead to infinite recursion. Aborting.\n";
break;
}
@@ -312,7 +316,7 @@
nfname.erase(nfname.begin(),nfname.begin()+1);
nfname = get_user_data_dir() + "/data/"
+ nfname;
- std::cerr << "got relative name '" <<
newfilename << "' -> '" << nfname << "'\n";
+ LOG_CF << "got relative name '" <<
newfilename << "' -> '" << nfname << "'\n";
if(newfilename[0] == '@' &&
file_exists(nfname) == false && is_directory(nfname) == false) {
nfname = "data/" +
newfilename.substr(1);
@@ -708,12 +712,12 @@
if(c == '[' && in_quotes) {
if(line_sources != NULL) {
const line_source src =
get_line_source(*line_sources,line);
- std::cerr << src.file << " " <<
src.fileline << ": ";
+ LOG_CF << src.file << " " <<
src.fileline << ": ";
} else {
- std::cerr << "line " << line <<
": ";
+ LOG_CF << "line " << line << ":
";
}
- std::cerr << "WARNING: square bracket
found in string. Is this a run-away string?\n";
+ WRN_CF << "square bracket found in
string. Is this a run-away string?\n";
}
if(in_quotes && c == '"' && (i+1) != data.end()
&& *(i+1) == '"') {
@@ -902,7 +906,7 @@
const std::string::iterator i = write_internal(res.begin());
assert(i == res.end());
if(i != res.end()) {
- std::cerr << "ERROR in size of config buffer: " << (i -
res.begin()) << "/" << res.size() << "\n";
+ ERR_CF << "size of config buffer: " << (i - res.begin()) << "/"
<< res.size() << "\n";
}
return res;
@@ -1078,7 +1082,7 @@
const
compression_schema::char_word_map::const_iterator itor =
schema.char_to_word.find(code);
if(itor == schema.char_to_word.end()) {
- std::cerr << "illegal word code: " <<
code << "\n";
+ ERR_CF << "illegal word code: " << code
<< "\n";
throw error("Illegal character in
compression input\n");
}
@@ -1452,7 +1456,7 @@
void do_interpolation(std::string& res, size_t npos, const string_map* m)
{
- std::cerr << "doing interpolation into '" << res << "': " << npos <<
"\n";
+ LOG_CF << "doing interpolation into '" << res << "': " << npos << "\n";
const std::string::iterator i =
std::find(res.begin()+npos,res.end(),'$');
if(i == res.end() || i+1 == res.end()) {
return;
Index: wesnoth/src/dialogs.cpp
diff -u wesnoth/src/dialogs.cpp:1.58 wesnoth/src/dialogs.cpp:1.59
--- wesnoth/src/dialogs.cpp:1.58 Sat Sep 25 19:46:33 2004
+++ wesnoth/src/dialogs.cpp Tue Oct 5 21:28:12 2004
@@ -1,4 +1,4 @@
-/* $Id: dialogs.cpp,v 1.58 2004/09/25 19:46:33 ydirson Exp $ */
+/* $Id: dialogs.cpp,v 1.59 2004/10/05 21:28:12 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -33,6 +33,9 @@
#include <time.h>
#include <vector>
+#define LOG_DP lg::info(lg::display)
+#define ERR_G lg::err(lg::general)
+
namespace dialogs
{
@@ -46,7 +49,7 @@
if(u == units.end() || u->second.advances() == false)
return;
- std::cerr << "advance_unit: " << u->second.type().name() << "\n";
+ LOG_DP << "advance_unit: " << u->second.type().name() << "\n";
const std::vector<std::string>& options =
u->second.type().advances_to();
@@ -69,7 +72,7 @@
lang_options.push_back("&" + type.image() + "," +
(**mod)["description"]);
}
- std::cerr << "options: " << options.size() << "\n";
+ LOG_DP << "options: " << options.size() << "\n";
int res = 0;
@@ -91,7 +94,7 @@
recorder.choose_option(res);
- std::cerr << "animating advancement...\n";
+ LOG_DP << "animating advancement...\n";
animate_unit_advancement(info,units,loc,gui,size_t(res));
}
@@ -312,7 +315,7 @@
try {
map_data = read_map((*scenario)["map"]);
} catch(io_exception& e) {
- std::cerr << "could not read map '" <<
(*scenario)["map"] << "': " << e.what() << "\n";
+ ERR_G << "could not read map '" <<
(*scenario)["map"] << "': " << e.what() << "\n";
}
}
}
@@ -475,13 +478,13 @@
extract_summary_data_from_save(state,summary);
} catch(io_exception&) {
summary["corrupt"] = "yes";
- std::cerr << "save '" << games[*s].name << "'
could not be loaded (io_exception)\n";
+ ERR_G << "save '" << games[*s].name << "' could
not be loaded (io_exception)\n";
} catch(config::error&) {
summary["corrupt"] = "yes";
- std::cerr << "save '" << games[*s].name << "'
could not be loaded (config parse error)\n";
+ ERR_G << "save '" << games[*s].name << "' could
not be loaded (config parse error)\n";
} catch(gamestatus::load_game_failed&) {
summary["corrupt"] = "yes";
- std::cerr << "save '" << games[*s].name << "'
could not be loaded (load_game_failed exception)\n";
+ ERR_G << "save '" << games[*s].name << "' could
not be loaded (load_game_failed exception)\n";
}
}
Index: wesnoth/src/display.cpp
diff -u wesnoth/src/display.cpp:1.263 wesnoth/src/display.cpp:1.264
--- wesnoth/src/display.cpp:1.263 Sat Oct 2 16:16:34 2004
+++ wesnoth/src/display.cpp Tue Oct 5 21:28:12 2004
@@ -1,4 +1,4 @@
-/* $Id: display.cpp,v 1.263 2004/10/02 16:16:34 Sirp Exp $ */
+/* $Id: display.cpp,v 1.264 2004/10/05 21:28:12 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -39,6 +39,8 @@
#include <iostream>
#include <sstream>
+#define ERR_DP lg::err(lg::display)
+
std::map<gamemap::location,double> display::debugHighlights_;
namespace {
@@ -97,7 +99,7 @@
flag = teams_[i].flag();
}
- std::cerr << "Adding flag for team " << i << " from animation "
<< flag << "\n";
+ lg::info(lg::display) << "Adding flag for team " << i << " from
animation " << flag << "\n";
flags_.push_back(animated<image::locator>(flag));
flags_.back().start_animation(0,
animated<image::locator>::INFINITE_CYCLES);
}
@@ -766,7 +768,7 @@
if(rect.w > 0 && rect.h > 0) {
surf.assign(get_surface_portion(screen_.getSurface(),rect));
if(reportSurfaces_[report_num] == NULL) {
- std::cerr << "Could not backup
background for report!\n";
+ ERR_DP << "Could not backup background
for report!\n";
}
}
@@ -809,7 +811,7 @@
surface
img(image::get_image(i->image,image::UNSCALED));
if(img == NULL) {
- std::cerr << "could not find
image for report: '" << i->image << "'\n";
+ ERR_DP << "could not find image
for report: '" << i->image << "'\n";
continue;
}
@@ -1129,7 +1131,7 @@
assert(energy_file != NULL);
if(energy_file == NULL) {
- std::cerr << "energy file is NULL\n";
+ ERR_DP << "energy file is NULL\n";
return;
}
@@ -1404,7 +1406,7 @@
surface surface(image::get_image("terrain/void.png"));
if(surface == NULL) {
- std::cerr << "Could not get void surface!\n";
+ ERR_DP << "Could not get void surface!\n";
return;
}
@@ -1521,7 +1523,7 @@
surface image(image::get_image(*image_str));
if(image == NULL) {
- std::cerr << "Could not find image: " << *image_str << "\n";
+ ERR_DP << "Could not find image: " << *image_str << "\n";
return;
}
@@ -1732,7 +1734,7 @@
const surface backup(im);
im = surface(adjust_surface_colour(im,radj,gadj,badj));
if(im == NULL)
- std::cerr << "could not adjust surface..\n";
+ ERR_DP << "could not adjust surface..\n";
}
#endif
@@ -1858,7 +1860,7 @@
}
if(surf == NULL) {
- std::cerr << "surface lost...\n";
+ ERR_DP << "surface lost...\n";
return;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src actions.cpp display.cpp dialogs.cpp...,
Guillaume Melquiond <=