From e5edc53ee2ad910c41748a2e087dc7b19bed7bd6 Mon Sep 17 00:00:00 2001 From: lorien420 Date: Mon, 14 Aug 2006 17:33:29 +0000 Subject: [PATCH] 2006-08-14 Andrew Sayman * src/gtk-gui/persist.cxx, src/Game.h, src/ComputerPlayer.cxx, src/ComputerPlayerAI.cxx, src/Displayer.cxx: Previous "using namespace std;" clean up missed some of the debug-only usages. The biggest violators were the output macros defined in Game.h. * src/ComputerPlayerAI.cxx: Removed remnants of more_gray since it's not used at all anymore. Put back gray_height because it is used in debug mode. --- ChangeLog | 9 +++++++++ src/ComputerPlayer.cxx | 6 +++--- src/ComputerPlayerAI.cxx | 6 ++---- src/Displayer.cxx | 6 +++--- src/Game.h | 33 +++++++++++++++++---------------- src/gtk-gui/persist.cxx | 3 ++- 6 files changed, 36 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 38d4211..aeaf7a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-08-14 Andrew Sayman + + * src/gtk-gui/persist.cxx, src/Game.h, src/ComputerPlayer.cxx, + src/ComputerPlayerAI.cxx, src/Displayer.cxx: Previous "using namespace std;" + clean up missed some of the debug-only usages. The biggest violators were + the output macros defined in Game.h. + * src/ComputerPlayerAI.cxx: Removed remnants of more_gray since it's not + used at all anymore. Put back gray_height because it is used in debug mode. + 2006-08-13 Bjørn Lindeijer * src/String.cxx, src/obj_clock.cxx, src/obj_sign.cxx, data/*, diff --git a/src/ComputerPlayer.cxx b/src/ComputerPlayer.cxx index d8552bb..e7fabc3 100644 --- a/src/ComputerPlayer.cxx +++ b/src/ComputerPlayer.cxx @@ -75,9 +75,9 @@ void ComputerPlayer::timeStep() if (Game::time_step >= localAi.alarm()) { localAi.garbageAmount()->sendToGenerator(); #ifndef NDEBUG - cout << "init pop: " << GC_INITIAL_POP_DELAY << endl; - cout << "steps per second: " << GC_STEPS_PER_SECOND << endl; - cout << "Height: " << ai->garbageQueue()->height() << endl; + std::cout << "init pop: " << GC_INITIAL_POP_DELAY << std::endl; + std::cout << "steps per second: " << GC_STEPS_PER_SECOND << std::endl; + std::cout << "Height: " << ai->garbageQueue()->height() << std::endl; #endif localAi.resetAlarm(); MESSAGE("AI will drop again in " << ((localAi.alarm() - Game::time_step) / GC_STEPS_PER_SECOND) << " seconds"); diff --git a/src/ComputerPlayerAI.cxx b/src/ComputerPlayerAI.cxx index 7013d7e..86bd959 100644 --- a/src/ComputerPlayerAI.cxx +++ b/src/ComputerPlayerAI.cxx @@ -107,11 +107,9 @@ GarbageQueue *ComputerPlayerAI::garbageAmount( ) int norm_div = num_normals / 3; int norm_mod = num_normals % 3; - //int more_gray = norm_mod / 2; - LOG("div: " << norm_div << " mod: " << norm_mod << " gray: " << more_gray); + LOG("div: " << norm_div << " mod: " << norm_mod); if (norm_div > 0) q->add(norm_div, 6, GF_NORMAL); loopi(norm_mod) q->add(1, 6, GF_NORMAL); - //loopi(more_gray) q->add(1, 6, GF_GRAY); shatter(); return q; @@ -122,7 +120,7 @@ void ComputerPlayerAI::shatter() MESSAGE("Resetting garbageQueue " << garbageQueue()->height()); if (garbageQueue()->height() > 0) { state = AI_SHATTERING; - //int gray_height = garbageQueue()->specialHeight(); + int gray_height = garbageQueue()->specialHeight(); last_shatter_height = garbageQueue()->removeWithSpecials(); MESSAGE(last_shatter_height << " shattered and " << garbageQueue()->height() << " remaining grays:" << gray_height); loopi(last_shatter_height) { diff --git a/src/Displayer.cxx b/src/Displayer.cxx index 3ce882c..797a917 100644 --- a/src/Displayer.cxx +++ b/src/Displayer.cxx @@ -407,9 +407,9 @@ void Displayer::screenShot ( ) glReadPixels(0, 0, screen_length, screen_length, GL_RGBA, GL_UNSIGNED_BYTE, image); - ostringstream file_name; - file_name << DC_SCREEN_SHOT_FILE_NAME_BASE "_" << setw(GC_GARBAGE_TEX_NUMBER_DIGITS) - << setfill('0') << count << ".tga" << ends; + std::ostringstream file_name; + file_name << DC_SCREEN_SHOT_FILE_NAME_BASE "_" << std::setw(GC_GARBAGE_TEX_NUMBER_DIGITS) + << std::setfill('0') << count << ".tga" << std::ends; TextureLoader::createTGA(file_name.str().c_str(), image, screen_length, screen_length, TL_SCREEN_SHOT_TGA_ID); diff --git a/src/Game.h b/src/Game.h index 6aa37c3..6cd7bb4 100644 --- a/src/Game.h +++ b/src/Game.h @@ -286,37 +286,38 @@ # define COLOR(n) "" # define NOCOLOR "" # endif -# define DOT(n) { cerr << COLOR(37 - n) \ - << "." NOCOLOR << flush; } -# define DUMP(a) { cerr << COLOR(32) << "Dump: " \ +# define DOT(n) { std::cerr << COLOR(37 - n) \ + << "." NOCOLOR << std::flush; } +# define DUMP(a) { std::cerr << COLOR(32) << "Dump: " \ __FILE__ ":" << __LINE__ << ": " \ NOCOLOR #a \ - " = " << (a) << endl; } + " = " << (a) << std::endl; } # define PERIODIC_DUMP(a, b) { if (!(Game::time_step % a)) \ - cerr << COLOR(32) << "Dump: " \ + std::cerr << COLOR(32) << "Dump: " \ __FILE__ ":" << __LINE__ << ": " \ NOCOLOR #b \ - " = " << (b) << endl; } -# define MESSAGE(a) { cerr << COLOR(33) << "Mesg: " \ + " = " << (b) << std::endl; } +# define MESSAGE(a) { std::cerr << COLOR(33) << "Mesg: " \ __FILE__ ":" << __LINE__ << ": " \ - NOCOLOR << a << endl; } + NOCOLOR << a << std::endl; } # ifndef _WIN32 -# define MARK() { cerr << COLOR(35) << "Mark: " \ +# define MARK() { std::cerr << COLOR(35) << "Mark: " \ __FILE__ ":" << __LINE__ << ": " \ << __PRETTY_FUNCTION__ << NOCOLOR \ - << endl; } + << std::endl; } # else -# define MARK() { cerr << COLOR(35) << "Mark: " \ +# define MARK() { std::cerr << COLOR(35) << "Mark: " \ __FILE__ ":" << __LINE__ << ":" \ - NOCOLOR << endl; } + NOCOLOR << std::endl; } # endif -# define ENDL() { cerr << COLOR(34) << "Endl: " \ +# define ENDL() { std::cerr << COLOR(34) << "Endl: " \ __FILE__ ":" << __LINE__ << ":" \ - NOCOLOR << endl; } -# define LOG(a) { ofstream log("log", ios::app); \ + NOCOLOR << std::endl; } +# define LOG(a) { std::ofstream log("log", \ + std::ios::app); \ log << "Log: " __FILE__ ":" \ << __LINE__ << ": " << a \ - << endl; } + << std::endl; } #else # define DOT(n) ((void) 0) # define DUMP(a) ((void) 0) diff --git a/src/gtk-gui/persist.cxx b/src/gtk-gui/persist.cxx index d209b85..a2cfcee 100644 --- a/src/gtk-gui/persist.cxx +++ b/src/gtk-gui/persist.cxx @@ -3,6 +3,7 @@ * Kevin Webb - 3/21/05 * * Copyright (C) 2005 Kevin Webb + * Copyright (C) 2006 Andrew Sayman * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -99,7 +100,7 @@ gui_data_read (GtkWidget *widget) std::ifstream file(file_name); if (file.fail()) { #ifdef DEVELOPMENT - cerr << "Unable to find gui data file!\n"; + std::cerr << "Unable to find gui data file!\n"; #endif return; } -- 2.11.4.GIT