From: Christoph Sommer Date: Sun, 9 Apr 2006 00:32:34 +0000 (+0000) Subject: Messaging subsystem rewrite, step I X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=67690e081c28b818e94796be284206326bc8a6b9;p=supertux.git Messaging subsystem rewrite, step I SVN-Revision: 3275 --- diff --git a/src/audio/sound_file.cpp b/src/audio/sound_file.cpp index 9a0506bad..42548ace2 100644 --- a/src/audio/sound_file.cpp +++ b/src/audio/sound_file.cpp @@ -55,7 +55,7 @@ WavSoundFile::WavSoundFile(PHYSFS_file* file) if(PHYSFS_read(file, magic, sizeof(magic), 1) != 1) throw std::runtime_error("Couldn't read file magic (not a wave file)"); if(strncmp(magic, "RIFF", 4) != 0) { - msg_debug("MAGIC: " << magic); + msg_debug << "MAGIC: " << magic << std::endl; throw std::runtime_error("file is not a RIFF wav file"); } diff --git a/src/audio/sound_manager.cpp b/src/audio/sound_manager.cpp index dc26cd831..ab45724a7 100644 --- a/src/audio/sound_manager.cpp +++ b/src/audio/sound_manager.cpp @@ -34,7 +34,7 @@ SoundManager::SoundManager() } catch(std::exception& e) { device = 0; context = 0; - msg_warning("Couldn't initialize audio device:" << e.what()); + msg_warning << "Couldn't initialize audio device:" << e.what() << std::endl; print_openal_version(); throw e; } @@ -130,7 +130,7 @@ SoundManager::play(const std::string& filename, const Vector& pos) source->play(); sources.push_back(source); } catch(std::exception& e) { - msg_warning("Couldn't play sound " << filename << ": " << e.what()); + msg_warning << "Couldn't play sound " << filename << ": " << e.what() << std::endl; } } @@ -199,8 +199,7 @@ SoundManager::play_music(const std::string& filename, bool fade) delete music_source; music_source = newmusic.release(); } catch(std::exception& e) { - msg_warning("Couldn't play music file '" << filename << "': " - << e.what()); + msg_warning << "Couldn't play music file '" << filename << "': " << e.what() << std::endl; } } @@ -282,10 +281,10 @@ SoundManager::get_sample_format(SoundFile* file) void SoundManager::print_openal_version() { - msg_info("OpenAL Vendor: " << alGetString(AL_VENDOR)); - msg_info("OpenAL Version: " << alGetString(AL_VERSION)); - msg_info("OpenAL Renderer: " << alGetString(AL_RENDERER)); - msg_info("OpenAl Extensions: " << alGetString(AL_EXTENSIONS)); + msg_info << "OpenAL Vendor: " << alGetString(AL_VENDOR) << std::endl; + msg_info << "OpenAL Version: " << alGetString(AL_VERSION) << std::endl; + msg_info << "OpenAL Renderer: " << alGetString(AL_RENDERER) << std::endl; + msg_info << "OpenAl Extensions: " << alGetString(AL_EXTENSIONS) << std::endl; } void diff --git a/src/audio/stream_sound_source.cpp b/src/audio/stream_sound_source.cpp index 6e6ce06d1..930f34c50 100644 --- a/src/audio/stream_sound_source.cpp +++ b/src/audio/stream_sound_source.cpp @@ -56,7 +56,7 @@ StreamSoundSource::update() return; // we might have to restart the source if we had a buffer underrun - msg_info("Restarting audio source because of buffer underrun"); + msg_info << "Restarting audio source because of buffer underrun" << std::endl; play(); } diff --git a/src/badguy/badguy.cpp b/src/badguy/badguy.cpp index 9be4b0199..42904049c 100644 --- a/src/badguy/badguy.cpp +++ b/src/badguy/badguy.cpp @@ -105,7 +105,7 @@ BadGuy::deactivate() void BadGuy::save(lisp::Writer& ) { - msg_warning("tried to write out a generic badguy"); + msg_warning << "tried to write out a generic badguy" << std::endl; } void diff --git a/src/badguy/flame.cpp b/src/badguy/flame.cpp index da6c0264b..cc017f973 100644 --- a/src/badguy/flame.cpp +++ b/src/badguy/flame.cpp @@ -75,7 +75,7 @@ Flame::activate() delete source; source = sound_manager->create_sound_source("sounds/flame.wav"); if(!source) { - msg_warning("Couldn't start flame sound"); + msg_warning << "Couldn't start flame sound" << std::endl; return; } source->set_position(get_pos()); diff --git a/src/badguy/totem.cpp b/src/badguy/totem.cpp index e0cd2c5ff..67b467dc5 100644 --- a/src/badguy/totem.cpp +++ b/src/badguy/totem.cpp @@ -211,7 +211,7 @@ void Totem::jump_on(Totem* target) { if (target->carrying) { - msg_warning("target is already carrying someone"); + msg_warning << "target is already carrying someone" << std::endl; return; } @@ -227,7 +227,7 @@ Totem::jump_on(Totem* target) void Totem::jump_off() { if (!carried_by) { - msg_warning("not carried by anyone"); + msg_warning << "not carried by anyone" << std::endl; return; } diff --git a/src/badguy/willowisp.cpp b/src/badguy/willowisp.cpp index cbc18f378..35a7a7c6b 100644 --- a/src/badguy/willowisp.cpp +++ b/src/badguy/willowisp.cpp @@ -119,7 +119,7 @@ WillOWisp::activate() delete soundSource; soundSource = sound_manager->create_sound_source("sounds/willowisp.wav"); if(!soundSource) { - msg_warning("Couldn't start WillOWisp sound"); + msg_warning << "Couldn't start WillOWisp sound" << std::endl; return; } soundSource->set_position(get_pos()); diff --git a/src/collision_grid.cpp b/src/collision_grid.cpp index fd3ad33d5..fddc2ce74 100644 --- a/src/collision_grid.cpp +++ b/src/collision_grid.cpp @@ -76,7 +76,7 @@ CollisionGrid::add_object(MovingObject* object) int gridy = int(y / cell_height); if(gridx < 0 || gridy < 0 || gridx >= int(cells_x) || gridy >= int(cells_y)) { - msg_warning("Object out of range: " << gridx << ", " << gridy); + msg_warning << "Object out of range: " << gridx << ", " << gridy << std::endl; continue; } GridEntry* entry = new GridEntry; @@ -102,7 +102,7 @@ CollisionGrid::remove_object(MovingObject* object) assert(wrapper != 0); #else if(wrapper == 0) { - msg_warning("Tried to remove nonexistant object"); + msg_warning << "Tried to remove nonexistant object" << std::endl; return; } #endif @@ -114,7 +114,7 @@ CollisionGrid::remove_object(MovingObject* object) int gridy = int(y / cell_height); if(gridx < 0 || gridy < 0 || gridx >= int(cells_x) || gridy >= int(cells_y)) { - msg_warning("Object out of range: " << gridx << ", " << gridy); + msg_warning << "Object out of range: " << gridx << ", " << gridy << std::endl; continue; } remove_object_from_gridcell(gridy*cells_x + gridx, wrapper); @@ -136,7 +136,7 @@ CollisionGrid::move_object(ObjectWrapper* wrapper) int gridy = int(y / cell_height); if(gridx < 0 || gridy < 0 || gridx >= int(cells_x) || gridy >= int(cells_y)) { - msg_warning("Object out of range: " << gridx << ", " << gridy); + msg_warning << "Object out of range: " << gridx << ", " << gridy << std::endl; continue; } remove_object_from_gridcell(gridy*cells_x + gridx, wrapper); @@ -150,7 +150,7 @@ CollisionGrid::move_object(ObjectWrapper* wrapper) int gridy = int(y / cell_height); if(gridx < 0 || gridy < 0 || gridx >= int(cells_x) || gridy >= int(cells_y)) { - msg_warning("Object out of range: " << gridx << ", " << gridy); + msg_warning << "Object out of range: " << gridx << ", " << gridy << std::endl; continue; } @@ -213,7 +213,7 @@ CollisionGrid::collide_object(ObjectWrapper* wrapper) int gridy = int(y / cell_height); if(gridx < 0 || gridy < 0 || gridx >= int(cells_x) || gridy >= int(cells_y)) { - //msg_warning("Object out of range: " << gridx << ", " << gridy); + //msg_warning << "Object out of range: " << gridx << ", " << gridy << std::endl; continue; } @@ -291,6 +291,6 @@ CollisionGrid::remove_object_from_gridcell(int gridcell, ObjectWrapper* wrapper) entry = entry->next; }; - msg_warning("Couldn't find object in cell"); + msg_warning << "Couldn't find object in cell" << std::endl; } diff --git a/src/collision_grid_iterator.hpp b/src/collision_grid_iterator.hpp index 6c2506be1..a7979b9bc 100644 --- a/src/collision_grid_iterator.hpp +++ b/src/collision_grid_iterator.hpp @@ -52,7 +52,7 @@ public: entry = 0; if(start_x >= end_x) { - msg_debug("bad region"); + msg_debug << "bad region" << std::endl; y = 0; end_y = 0; return; diff --git a/src/console.cpp b/src/console.cpp index ba4df78f2..8f590bbaa 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -128,7 +128,7 @@ Console::parse(std::string s) // send command to the most recently registered ccr ConsoleCommandReceiver* ccr = i->second.front(); - if (ccr->consoleCommand(s) != true) msg_warning("Sent command to registered ccr, but command was unhandled"); + if (ccr->consoleCommand(s) != true) msg_warning << "Sent command to registered ccr, but command was unhandled" << std::endl; } bool @@ -209,12 +209,12 @@ Console::unregisterCommand(std::string command, ConsoleCommandReceiver* ccr) { std::map >::iterator i = commands.find(command); if ((i == commands.end()) || (i->second.size() == 0)) { - msg_warning("Command \"" << command << "\" not associated with a command receiver. Not dissociated."); + msg_warning << "Command \"" << command << "\" not associated with a command receiver. Not dissociated." << std::endl; return; } std::list::iterator j = find(i->second.begin(), i->second.end(), ccr); if (j == i->second.end()) { - msg_warning("Command \"" << command << "\" not associated with given command receiver. Not dissociated."); + msg_warning << "Command \"" << command << "\" not associated with given command receiver. Not dissociated." << std::endl; return; } i->second.erase(j); diff --git a/src/control/joystickkeyboardcontroller.cpp b/src/control/joystickkeyboardcontroller.cpp index 776266b3c..cffa6f5cb 100644 --- a/src/control/joystickkeyboardcontroller.cpp +++ b/src/control/joystickkeyboardcontroller.cpp @@ -79,12 +79,12 @@ JoystickKeyboardController::JoystickKeyboardController() SDL_Joystick* joystick = SDL_JoystickOpen(i); bool good = true; if(SDL_JoystickNumButtons(joystick) < 2) { - msg_warning("Joystick " << i << " has less than 2 buttons"); + msg_warning << "Joystick " << i << " has less than 2 buttons" << std::endl; good = false; } if(SDL_JoystickNumAxes(joystick) < 2 && SDL_JoystickNumHats(joystick) == 0) { - msg_warning("Joystick " << i << " has less than 2 axes and no hat"); + msg_warning << "Joystick " << i << " has less than 2 axes and no hat" << std::endl; good = false; } if(!good) { @@ -153,7 +153,7 @@ JoystickKeyboardController::read(const lisp::Lisp& lisp) map->get("key", key); map->get("control", control); if(key < SDLK_FIRST || key >= SDLK_LAST) { - msg_warning("Invalid key '" << key << "' in keymap"); + msg_warning << "Invalid key '" << key << "' in keymap" << std::endl; continue; } @@ -163,12 +163,12 @@ JoystickKeyboardController::read(const lisp::Lisp& lisp) break; } if(controlNames[i] == 0) { - msg_warning("Invalid control '" << control << "' in keymap"); + msg_warning << "Invalid control '" << control << "' in keymap" << std::endl; continue; } keymap.insert(std::make_pair((SDLKey) key, (Control) i)); } else { - msg_warning("Invalid lisp element '" << iter.item() << "' in keymap"); + msg_warning << "Invalid lisp element '" << iter.item() << "' in keymap" << std::endl; } } } @@ -189,7 +189,7 @@ JoystickKeyboardController::read(const lisp::Lisp& lisp) map->get("button", button); map->get("control", control); if(button < 0 || button >= max_joybuttons) { - msg_warning("Invalid button '" << button << "' in buttonmap"); + msg_warning << "Invalid button '" << button << "' in buttonmap" << std::endl; continue; } @@ -199,7 +199,7 @@ JoystickKeyboardController::read(const lisp::Lisp& lisp) break; } if(controlNames[i] == 0) { - msg_warning("Invalid control '" << control << "' in buttonmap"); + msg_warning << "Invalid control '" << control << "' in buttonmap" << std::endl; continue; } reset_joybutton(button, (Control) i); @@ -321,8 +321,7 @@ JoystickKeyboardController::process_event(const SDL_Event& event) ButtonMap::iterator i = joy_button_map.find(event.jbutton.button); if(i == joy_button_map.end()) { - msg_debug("Unmapped joybutton " << (int) event.jbutton.button - << " pressed"); + msg_debug << "Unmapped joybutton " << (int)event.jbutton.button << " pressed" << std::endl; return; } @@ -362,7 +361,7 @@ JoystickKeyboardController::process_key_event(const SDL_Event& event) // default action: update controls if(key_mapping == keymap.end()) { - msg_debug("Key " << event.key.keysym.sym << " is unbound"); + msg_debug << "Key " << event.key.keysym.sym << " is unbound" << std::endl; return; } Control control = key_mapping->second; diff --git a/src/file_system.cpp b/src/file_system.cpp index b60565663..57bcec407 100644 --- a/src/file_system.cpp +++ b/src/file_system.cpp @@ -56,7 +56,7 @@ std::string normalize(const std::string& filename) if(pathelem == "..") { if(path_stack.empty()) { - msg_warning("Invalid '..' in path '" << filename << "'"); + msg_warning << "Invalid '..' in path '" << filename << "'" << std::endl; // push it into the result path so that the users sees his error... path_stack.push_back(pathelem); } else { diff --git a/src/game_session.cpp b/src/game_session.cpp index dd335c599..9e458bf0e 100644 --- a/src/game_session.cpp +++ b/src/game_session.cpp @@ -351,7 +351,7 @@ bool GameSession::consoleCommand(std::string command) { if (command == "foo") { - msg_info("bar"); + msg_info << "bar" << std::endl; return true; } @@ -412,7 +412,7 @@ GameSession::consoleCommand(std::string command) return true; } if (command == "whereami") { - msg_info("You are at x " << tux.get_pos().x << ", y " << tux.get_pos().y); + msg_info << "You are at x " << tux.get_pos().x << ", y " << tux.get_pos().y << std::endl; return true; } if (command == "gotoend") { @@ -433,13 +433,11 @@ GameSession::consoleCommand(std::string command) return true; } if (command == "camera") { - msg_info("Camera is at " - << Sector::current()->camera->get_translation().x << "," - << Sector::current()->camera->get_translation().y); + msg_info << "Camera is at " << Sector::current()->camera->get_translation().x << "," << Sector::current()->camera->get_translation().y << std::endl; return true; } if (command == "quit") { - msg_info("Please implement me! :-)"); + msg_info << "Please implement me! :-)" << std::endl; return true; } @@ -560,7 +558,7 @@ GameSession::update(float elapsed_time) if(newsector != "" && newspawnpoint != "") { Sector* sector = level->get_sector(newsector); if(sector == 0) { - msg_warning("Sector '" << newsector << "' not found"); + msg_warning << "Sector '" << newsector << "' not found" << std::endl; } sector->activate(newspawnpoint); sector->play_music(LEVEL_MUSIC); @@ -804,13 +802,12 @@ GameSession::start_sequence(const std::string& sequencename) } } else if(sequencename == "stoptux") { if(!end_sequence) { - msg_warning("Final target reached without " - << "an active end sequence"); + msg_warning << "Final target reached without an active end sequence" << std::endl; this->start_sequence("endsequence"); } end_sequence = ENDSEQUENCE_WAITING; } else { - msg_warning("Unknown sequence '" << sequencename << "'"); + msg_warning << "Unknown sequence '" << sequencename << "'" << std::endl; } } diff --git a/src/level.cpp b/src/level.cpp index 57bc4a7f2..30e19e62b 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -80,7 +80,7 @@ Level::load(const std::string& filepath) if(token == "version") { iter.value()->get(version); if(version > 2) { - msg_warning("level format newer than application"); + msg_warning << "level format newer than application" << std::endl; } } else if(token == "name") { iter.value()->get(name); @@ -91,7 +91,7 @@ Level::load(const std::string& filepath) sector->parse(*(iter.lisp())); add_sector(sector); } else { - msg_warning("Unknown token '" << token << "' in level file"); + msg_warning << "Unknown token '" << token << "' in level file" << std::endl; continue; } } diff --git a/src/lisp/writer.cpp b/src/lisp/writer.cpp index ee0633c6b..8b5bc186e 100644 --- a/src/lisp/writer.cpp +++ b/src/lisp/writer.cpp @@ -45,7 +45,7 @@ Writer::Writer(std::ostream* newout) Writer::~Writer() { if(lists.size() > 0) { - msg_warning("Not all sections closed in lispwriter"); + msg_warning << "Not all sections closed in lispwriter" << std::endl; } if(out_owned) delete out; @@ -71,13 +71,11 @@ void Writer::end_list(const std::string& listname) { if(lists.size() == 0) { - msg_warning("Trying to close list '" << listname - << "', which is not open"); + msg_warning << "Trying to close list '" << listname << "', which is not open" << std::endl; return; } if(lists.back() != listname) { - msg_warning("trying to close list '" << listname - << "' while list '" << lists.back() << "' is open"); + msg_warning << "trying to close list '" << listname << "' while list '" << lists.back() << "' is open" << std::endl; return; } lists.pop_back(); diff --git a/src/main.cpp b/src/main.cpp index bb2fd8682..2bfbed289 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -62,7 +62,7 @@ static void init_config() try { config->load(); } catch(std::exception& e) { - msg_info("Couldn't load config file: " << e.what() << ", using default settings"); + msg_info << "Couldn't load config file: " << e.what() << ", using default settings" << std::endl; } } @@ -145,8 +145,7 @@ static void init_physfs(const char* argv0) if(f) { fclose(f); if(!PHYSFS_addToSearchPath(dir.c_str(), 1)) { - msg_warning("Couldn't add '" << dir - << "' to physfs searchpath: " << PHYSFS_getLastError()); + msg_warning << "Couldn't add '" << dir << "' to physfs searchpath: " << PHYSFS_getLastError() << std::endl; } else { sourcedir = true; } @@ -163,8 +162,7 @@ static void init_physfs(const char* argv0) datadir = APPDATADIR; #endif if(!PHYSFS_addToSearchPath(datadir.c_str(), 1)) { - msg_warning("Couldn't add '" << datadir - << "' to physfs searchpath: " << PHYSFS_getLastError()); + msg_warning << "Couldn't add '" << datadir << "' to physfs searchpath: " << PHYSFS_getLastError() << std::endl; } #endif } @@ -174,7 +172,7 @@ static void init_physfs(const char* argv0) //show search Path for(char** i = PHYSFS_getSearchPath(); *i != NULL; i++) - msg_info("[" << *i << "] is in the search path"); + msg_info << "[" << *i << "] is in the search path" << std::endl; } static void print_usage(const char* argv0) @@ -236,12 +234,12 @@ static void parse_commandline(int argc, char** argv) print_usage(argv[0]); throw graceful_shutdown(); } else if(arg == "--version") { - msg_info(PACKAGE_NAME << " " << PACKAGE_VERSION); + msg_info << PACKAGE_NAME << " " << PACKAGE_VERSION << std::endl; throw graceful_shutdown(); } else if(arg[0] != '-') { config->start_level = arg; } else { - msg_warning("Unknown option '" << arg << "'. Use --help to see a list of options"); + msg_warning << "Unknown option '" << arg << "'. Use --help to see a list of options" << std::endl; } } @@ -340,7 +338,7 @@ void init_video() } #ifdef DEBUG else { - msg_warning("Couldn't find icon 'images/engine/icons/supertux.xpm'"); + msg_warning << "Couldn't find icon 'images/engine/icons/supertux.xpm'" << std::endl; } #endif @@ -432,7 +430,7 @@ static inline void timelog(const char* component) Uint32 current_ticks = SDL_GetTicks(); if(last_timelog_component != 0) { - msg_info("Component '" << last_timelog_component << "' finished after " << (current_ticks - last_timelog_ticks) / 1000.0 << " seconds"); + msg_info << "Component '" << last_timelog_component << "' finished after " << (current_ticks - last_timelog_ticks) / 1000.0 << " seconds" << std::endl; } last_timelog_ticks = current_ticks; @@ -493,10 +491,10 @@ int main(int argc, char** argv) main_loop = NULL; } catch(graceful_shutdown& e) { } catch(std::exception& e) { - msg_fatal("Unexpected exception: " << e.what()); + msg_fatal << "Unexpected exception: " << e.what() << std::endl; return 1; } catch(...) { - msg_fatal("Unexpected exception"); + msg_fatal << "Unexpected exception" << std::endl; return 1; } diff --git a/src/msg.hpp b/src/msg.hpp index fa6cb0d9e..731a0b35c 100644 --- a/src/msg.hpp +++ b/src/msg.hpp @@ -26,21 +26,57 @@ #include "console.hpp" -// TODO: make macros more C++ish? - #ifdef DEBUG -#define msg_debug(message) Console::output << "[DEBUG] " << __FILE__ << " l." << __LINE__ << ": " << message << std::endl -#define msg_info(message) Console::output << "[INFO] " << message << std::endl -#define msg_warning(message) Console::output << "[WARNING] " << __FILE__ << " l." << __LINE__ << ": " << message << std::endl -#define msg_fatal(message) Console::output << "[FATAL] " << __FILE__ << " l." << __LINE__ << ": " << message << std::endl +inline std::ostream& msg_debug_f(const char* file, int line) { + Console::output << "[DEBUG] " << file << " l." << line << ": "; + return Console::output; +} + +inline std::ostream& msg_info_f(const char* file, int line) { + Console::output << "[INFO] " << file << " l." << line << ": "; + return Console::output; +} + +inline std::ostream& msg_warning_f(const char* file, int line) { + Console::output << "[WARNING] " << file << " l." << line << ": "; + return Console::output; +} + +inline std::ostream& msg_fatal_f(const char* file, int line) { + Console::output << "[FATAL] " << file << " l." << line << ": "; + return Console::output; +} + +#define msg_debug msg_debug_f(__FILE__, __LINE__) +#define msg_info msg_info_f(__FILE__, __LINE__) +#define msg_warning msg_warning_f(__FILE__, __LINE__) +#define msg_fatal msg_fatal_f(__FILE__, __LINE__) #else -#define msg_debug(message) -#define msg_info(message) Console::output << message << std::endl -#define msg_warning(message) Console::output << "Warning: " << message << std::endl -#define msg_fatal(message) Console::output << "Fatal: " << message << std::endl +inline std::ostream& msg_debug_f(const char* file, int line) { + return Console::output; +} + +inline std::ostream& msg_info_f(const char* file, int line) { + return Console::output; +} + +inline std::ostream& msg_warning_f(const char* file, int line) { + Console::output << "Warning: "; + return Console::output; +} + +inline std::ostream& msg_fatal_f(const char* file, int line) { + Console::output << "Fatal: "; + return Console::output; +} + +#define msg_debug if (0) msg_debug_f(__FILE__, __LINE__) +#define msg_info msg_info_f(__FILE__, __LINE__) +#define msg_warning msg_warning_f(__FILE__, __LINE__) +#define msg_fatal msg_fatal_f(__FILE__, __LINE__) #endif diff --git a/src/object/ambient_sound.cpp b/src/object/ambient_sound.cpp index 397409484..a173d29c8 100644 --- a/src/object/ambient_sound.cpp +++ b/src/object/ambient_sound.cpp @@ -44,7 +44,7 @@ AmbientSound::AmbientSound(const lisp::Lisp& lisp) sample=""; if (!(lisp.get("x", position.x)&&lisp.get("y", position.y))) { - msg_warning("No Position in ambient_sound"); + msg_warning << "No Position in ambient_sound" << std::endl; } lisp.get("width" , dimension.x); @@ -132,7 +132,7 @@ AmbientSound::start_playing() currentvolume=targetvolume=1e-20; sound_source->play(); } catch(std::exception& e) { - msg_warning("Couldn't play '" << sample << "': " << e.what() << ""); + msg_warning << "Couldn't play '" << sample << "': " << e.what() << "" << std::endl; delete sound_source; sound_source = 0; } diff --git a/src/object/anchor_point.cpp b/src/object/anchor_point.cpp index 1150ec50b..0173d61a9 100644 --- a/src/object/anchor_point.cpp +++ b/src/object/anchor_point.cpp @@ -76,7 +76,7 @@ Vector get_anchor_pos(const Rect& rect, AnchorPoint point) #ifdef DEBUG throw std::runtime_error("Invalid anchor point found"); #endif - msg_warning("Invalid anchor point found"); + msg_warning << "Invalid anchor point found" << std::endl; result.x = rect.get_left(); break; } @@ -95,7 +95,7 @@ Vector get_anchor_pos(const Rect& rect, AnchorPoint point) #ifdef DEBUG throw std::runtime_error("Invalid anchor point found"); #endif - msg_warning("Invalid anchor point found"); + msg_warning << "Invalid anchor point found" << std::endl; result.y = rect.get_top(); break; } @@ -122,7 +122,7 @@ Vector get_anchor_pos(const Rect& destrect, float width, float height, #ifdef DEBUG throw std::runtime_error("Invalid anchor point found"); #endif - msg_warning("Invalid anchor point found"); + msg_warning << "Invalid anchor point found" << std::endl; result.x = destrect.get_left(); break; } @@ -141,7 +141,7 @@ Vector get_anchor_pos(const Rect& destrect, float width, float height, #ifdef DEBUG throw std::runtime_error("Invalid anchor point found"); #endif - msg_warning("Invalid anchor point found"); + msg_warning << "Invalid anchor point found" << std::endl; result.y = destrect.get_top(); break; } diff --git a/src/object/block.cpp b/src/object/block.cpp index 417cbdafd..0e9fe524d 100644 --- a/src/object/block.cpp +++ b/src/object/block.cpp @@ -134,7 +134,7 @@ BonusBlock::BonusBlock(const Vector& pos, int data) case 4: contents = CONTENT_1UP; break; case 5: contents = CONTENT_ICEGROW; break; default: - msg_warning("Invalid box contents"); + msg_warning << "Invalid box contents" << std::endl; contents = CONTENT_COIN; break; } @@ -169,7 +169,7 @@ BonusBlock::BonusBlock(const lisp::Lisp& lisp) } else if(contentstring == "custom") { contents = CONTENT_CUSTOM; } else { - msg_warning("Invalid box contents '" << contentstring << "'"); + msg_warning << "Invalid box contents '" << contentstring << "'" << std::endl; } } else { if(contents == CONTENT_CUSTOM) { @@ -179,7 +179,7 @@ BonusBlock::BonusBlock(const lisp::Lisp& lisp) throw std::runtime_error( "Only MovingObjects are allowed inside BonusBlocks"); } else { - msg_warning("Invalid element '" << token << "' in bonusblock"); + msg_warning << "Invalid element '" << token << "' in bonusblock" << std::endl; } } } diff --git a/src/object/gradient.cpp b/src/object/gradient.cpp index a2c9a030a..42950735c 100644 --- a/src/object/gradient.cpp +++ b/src/object/gradient.cpp @@ -84,10 +84,10 @@ Gradient::set_gradient(Color top, Color bottom) if (gradient_top.red > 1.0 || gradient_top.green > 1.0 || gradient_top.blue > 1.0 || gradient_top.alpha > 1.0) - msg_warning("top gradient color has values above 1.0"); + msg_warning << "top gradient color has values above 1.0" << std::endl; if (gradient_bottom.red > 1.0 || gradient_bottom.green > 1.0 || gradient_bottom.blue > 1.0 || gradient_bottom.alpha > 1.0) - msg_warning("bottom gradient color has values above 1.0"); + msg_warning << "bottom gradient color has values above 1.0" << std::endl; } void diff --git a/src/object/infoblock.cpp b/src/object/infoblock.cpp index 6e98963d5..1300bd4ff 100644 --- a/src/object/infoblock.cpp +++ b/src/object/infoblock.cpp @@ -38,7 +38,7 @@ InfoBlock::InfoBlock(const lisp::Lisp& lisp) bbox.set_pos(pos); if(!lisp.get("message", message)) { - msg_warning("No message in InfoBlock"); + msg_warning << "No message in InfoBlock" << std::endl; } //stopped = false; //ringing = new AmbientSound(get_pos(), 0.5, 300, 1, "sounds/phone.wav"); diff --git a/src/object/level_time.cpp b/src/object/level_time.cpp index 57616dae4..30d21d5c5 100644 --- a/src/object/level_time.cpp +++ b/src/object/level_time.cpp @@ -27,8 +27,7 @@ LevelTime::LevelTime(const lisp::Lisp& reader) iter.value()->get(time); break; } else { - msg_warning("Unknown token '" << iter.item() - << "' in LevelTime object"); + msg_warning << "Unknown token '" << iter.item() << "' in LevelTime object" << std::endl; } } if(time < 0) diff --git a/src/object/path.cpp b/src/object/path.cpp index 8d2b9f93c..4ed45d056 100644 --- a/src/object/path.cpp +++ b/src/object/path.cpp @@ -68,7 +68,7 @@ Path::read(const lisp::Lisp& reader) } if(iter.item() != "node") { - msg_warning("unknown token '" << iter.item() << "' in Path nodes list. Ignored."); + msg_warning << "unknown token '" << iter.item() << "' in Path nodes list. Ignored." << std::endl; continue; } const lisp::Lisp* node_lisp = iter.lisp(); @@ -107,7 +107,7 @@ Path::write(lisp::Writer& writer) writer.write_string("mode", "circular"); break; default: - msg_warning("Don't know how to write mode " << (int) mode << " ?!?"); + msg_warning << "Don't know how to write mode " << (int) mode << " ?!?" << std::endl; break; } diff --git a/src/object/player.cpp b/src/object/player.cpp index 7e540c8f7..97a93d36b 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -180,7 +180,7 @@ Player::update(float elapsed_time) if(moving_object) { moving_object->set_pos(pos); } else { - msg_debug("Non MovingObjetc grabbed?!?"); + msg_debug << "Non MovingObjetc grabbed?!?" << std::endl; } grabbed_object->ungrab(*this, dir); grabbed_object = 0; diff --git a/src/object/text_object.cpp b/src/object/text_object.cpp index 8081e852b..8b992cd0c 100644 --- a/src/object/text_object.cpp +++ b/src/object/text_object.cpp @@ -34,7 +34,7 @@ TextObject::set_font(const std::string& name) } else if(name == "small") { font = white_small_text; } else { - msg_warning("Unknown font '" << name << "'."); + msg_warning << "Unknown font '" << name << "'." << std::endl; } } diff --git a/src/object/tilemap.cpp b/src/object/tilemap.cpp index 88c5c08f3..88ffba46a 100644 --- a/src/object/tilemap.cpp +++ b/src/object/tilemap.cpp @@ -63,14 +63,14 @@ TileMap::TileMap(const lisp::Lisp& reader, TileManager* new_tile_manager) else if(layer_str == "foreground") layer = LAYER_FOREGROUNDTILES; else - msg_warning("Unknown layer '" << layer_str << "' in tilemap"); + msg_warning << "Unknown layer '" << layer_str << "' in tilemap" << std::endl; } reader.get("solid", solid); reader.get("speed", speed); if(solid && speed != 1) { - msg_warning("Speed of solid tilemap is not 1. fixing"); + msg_warning << "Speed of solid tilemap is not 1. fixing" << std::endl; speed = 1; } if(solid) @@ -122,7 +122,7 @@ TileMap::write(lisp::Writer& writer) writer.write_string("layer", "foreground"); else { writer.write_string("layer", "unknown"); - msg_warning("unknown layer in tilemap"); + msg_warning << "unknown layer in tilemap" << std::endl; } writer.write_bool("solid", solid); @@ -254,7 +254,7 @@ const Tile* TileMap::get_tile(int x, int y) const { if(x < 0 || x >= width || y < 0 || y >= height) { - //msg_warning("tile outside tilemap requested"); + //msg_warning << "tile outside tilemap requested" << std::endl; return tilemanager->get(0); } diff --git a/src/physfs/physfs_sdl.cpp b/src/physfs/physfs_sdl.cpp index 17ceacbe8..0afcda8f2 100644 --- a/src/physfs/physfs_sdl.cpp +++ b/src/physfs/physfs_sdl.cpp @@ -48,7 +48,7 @@ static int funcSeek(struct SDL_RWops* context, int offset, int whence) break; } if(res == 0) { - msg_warning("Error seeking in file: " << PHYSFS_getLastError()); + msg_warning << "Error seeking in file: " << PHYSFS_getLastError() << std::endl; return -1; } diff --git a/src/player_status.cpp b/src/player_status.cpp index 25eb28ecc..32285d416 100644 --- a/src/player_status.cpp +++ b/src/player_status.cpp @@ -111,7 +111,7 @@ PlayerStatus::write(lisp::Writer& writer) writer.write_string("bonus", "iceflower"); break; default: - msg_warning("Unknown bonus type."); + msg_warning << "Unknown bonus type." << std::endl; writer.write_string("bonus", "none"); } writer.write_bool("key-brass", keys & KEY_BRASS); @@ -140,7 +140,7 @@ PlayerStatus::read(const lisp::Lisp& lisp) } else if(bonusname == "iceflower") { bonus = ICE_BONUS; } else { - msg_warning("Unknown bonus '" << bonusname << "' in savefile"); + msg_warning << "Unknown bonus '" << bonusname << "' in savefile" << std::endl; bonus = NO_BONUS; } } diff --git a/src/scripting/functions.cpp b/src/scripting/functions.cpp index 30afc98db..5c1d6ff12 100644 --- a/src/scripting/functions.cpp +++ b/src/scripting/functions.cpp @@ -36,15 +36,13 @@ void import(HSQUIRRELVM v, const std::string& filename) std::string file = ScriptInterpreter::current()->get_working_directory() + filename; if(sqstd_loadfile(v, file.c_str(), true) < 0) { - msg_warning("couldn't load script '" << filename << "' (" - << file << ")"); + msg_warning << "couldn't load script '" << filename << "' (" << file << ")" << std::endl; return; } sq_push(v, -2); if(sq_call(v, 1, false) < 0) { - msg_warning("Couldn't execute script '" << filename << "' (" - << file << ")"); + msg_warning << "Couldn't execute script '" << filename << "' (" << file << ")" << std::endl; return; } } diff --git a/src/scripting/script_interpreter.cpp b/src/scripting/script_interpreter.cpp index 25f88e11b..32265596d 100644 --- a/src/scripting/script_interpreter.cpp +++ b/src/scripting/script_interpreter.cpp @@ -205,7 +205,7 @@ ScriptInterpreter::add_script_object(Sector* sector, const std::string& name, interpreter->run_script(in, name); sector->add_object(interpreter.release()); } catch(std::exception& e) { - msg_warning("Couldn't start '" << name << "' script: " << e.what()); + msg_warning << "Couldn't start '" << name << "' script: " << e.what() << std::endl; } } diff --git a/src/sector.cpp b/src/sector.cpp index c6ee2419a..3b1926fc4 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -136,7 +136,7 @@ Sector::parse_object(const std::string& name, const lisp::Lisp& reader) try { return create_object(name, reader); } catch(std::exception& e) { - msg_warning(e.what() << ""); + msg_warning << e.what() << "" << std::endl; } return 0; @@ -176,7 +176,7 @@ Sector::parse(const lisp::Lisp& sector) fix_old_tiles(); if(!camera) { - msg_warning("sector '" << name << "' does not contain a camera."); + msg_warning << "sector '" << name << "' does not contain a camera." << std::endl; update_game_objects(); add_object(new Camera(this)); } @@ -286,7 +286,7 @@ Sector::parse_old_format(const lisp::Lisp& reader) spawnpoints.push_back(sp); } } else { - msg_warning("Unknown token '" << iter.item() << "' in reset-points."); + msg_warning << "Unknown token '" << iter.item() << "' in reset-points." << std::endl; } } } @@ -300,7 +300,7 @@ Sector::parse_old_format(const lisp::Lisp& reader) if(object) { add_object(object); } else { - msg_warning("Unknown object '" << iter.item() << "' in level."); + msg_warning << "Unknown object '" << iter.item() << "' in level." << std::endl; } } } @@ -409,7 +409,7 @@ Sector::activate(const std::string& spawnpoint) } } if(!sp) { - msg_warning("Spawnpoint '" << spawnpoint << "' not found."); + msg_warning << "Spawnpoint '" << spawnpoint << "' not found." << std::endl; if(spawnpoint != "main") { activate("main"); } else { @@ -537,14 +537,14 @@ Sector::update_game_objects() if(solids == 0) { solids = tilemap; } else { - msg_warning("Another solid tilemaps added. Ignoring"); + msg_warning << "Another solid tilemaps added. Ignoring" << std::endl; } } Camera* camera = dynamic_cast (object); if(camera) { if(this->camera != 0) { - msg_warning("Multiple cameras added. Ignoring"); + msg_warning << "Multiple cameras added. Ignoring" << std::endl; continue; } this->camera = camera; diff --git a/src/spawn_point.cpp b/src/spawn_point.cpp index b0c9b6487..7ed3a15aa 100644 --- a/src/spawn_point.cpp +++ b/src/spawn_point.cpp @@ -28,8 +28,7 @@ SpawnPoint::SpawnPoint(const lisp::Lisp* slisp) } else if(token == "y") { iter.value()->get(pos.y); } else { - msg_warning("unknown token '" << token - << "' in SpawnPoint"); + msg_warning << "unknown token '" << token << "' in SpawnPoint" << std::endl; } } diff --git a/src/sprite/sprite.cpp b/src/sprite/sprite.cpp index 1c8d0bf80..189f60ef9 100644 --- a/src/sprite/sprite.cpp +++ b/src/sprite/sprite.cpp @@ -56,7 +56,7 @@ Sprite::set_action(const std::string& name, int loops) SpriteData::Action* newaction = data.get_action(name); if(!newaction) { - msg_debug("Action '" << name << "' not found."); + msg_debug << "Action '" << name << "' not found." << std::endl; return; } @@ -99,9 +99,7 @@ Sprite::draw(DrawingContext& context, const Vector& pos, int layer) update(); if((int)frame >= get_frames() || (int)frame < 0) - msg_warning("frame out of range: " << (int)frame - << "/" << get_frames() << " at " << get_name() - << "/" << get_action_name()); + msg_warning << "frame out of range: " << (int)frame << "/" << get_frames() << " at " << get_name() << "/" << get_action_name() << std::endl; else context.draw_surface(action->surfaces[(int)frame], pos - Vector(action->x_offset, action->y_offset), @@ -116,9 +114,7 @@ Sprite::draw_part(DrawingContext& context, const Vector& source, update(); if((int)frame >= get_frames() || (int)frame < 0) - msg_warning("frame out of range: " << (int)frame - << "/" << get_frames() << " at sprite: " << get_name() - << "/" << get_action_name()); + msg_warning << "frame out of range: " << (int)frame << "/" << get_frames() << " at sprite: " << get_name() << "/" << get_action_name() << std::endl; else context.draw_surface_part(action->surfaces[(int)frame], source, size, pos - Vector(action->x_offset, action->y_offset), diff --git a/src/sprite/sprite_data.cpp b/src/sprite/sprite_data.cpp index 90a9e4e52..6a40a6bd8 100644 --- a/src/sprite/sprite_data.cpp +++ b/src/sprite/sprite_data.cpp @@ -53,7 +53,7 @@ SpriteData::SpriteData(const lisp::Lisp* lisp, const std::string& basedir) } else if(iter.item() == "action") { parse_action(iter.lisp(), basedir); } else { - msg_warning("Unknown sprite field: " << iter.item()); + msg_warning << "Unknown sprite field: " << iter.item() << std::endl; } } if(actions.empty()) diff --git a/src/textscroller.cpp b/src/textscroller.cpp index c46dde376..45b092c93 100644 --- a/src/textscroller.cpp +++ b/src/textscroller.cpp @@ -84,7 +84,7 @@ TextScroller::TextScroller(const std::string& filename) text_lisp->get("speed", defaultspeed); text_lisp->get("music", music); } catch(std::exception& e) { - msg_warning("Couldn't load file '" << filename << "': " << e.what()); + msg_warning << "Couldn't load file '" << filename << "': " << e.what() << std::endl; return; } @@ -175,7 +175,7 @@ TextScroller::draw(DrawingContext& context) break; } default: - msg_warning("text contains an unformated line"); + msg_warning << "text contains an unformated line" << std::endl; font = white_text; center = false; break; @@ -230,7 +230,7 @@ InfoBox::InfoBox(const std::string& text) } catch (std::exception& e) { - msg_warning("Could not load scrolling images: " << e.what()); + msg_warning << "Could not load scrolling images: " << e.what() << std::endl; arrow_scrollup = 0; arrow_scrolldown = 0; } @@ -288,7 +288,7 @@ InfoBox::draw(DrawingContext& context) break; } default: - msg_warning("text contains an unformatted line"); + msg_warning << "text contains an unformatted line" << std::endl; font = normal_font; center = false; break; diff --git a/src/tile.cpp b/src/tile.cpp index 4e6080b54..f2d77ddae 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -127,7 +127,7 @@ Tile::parse_images(const lisp::Lisp& images_lisp) ptr->get_car()->get(h); imagespecs.push_back(ImageSpec(file, Rect(x, y, x+w, y+h))); } else { - msg_warning("Expected string or list in images tag"); + msg_warning << "Expected string or list in images tag" << std::endl; continue; } diff --git a/src/tile_manager.cpp b/src/tile_manager.cpp index 77b6d335a..c551acd75 100644 --- a/src/tile_manager.cpp +++ b/src/tile_manager.cpp @@ -41,7 +41,7 @@ TileManager::TileManager(const std::string& filename) #endif load_tileset(filename); #ifdef DEBUG - msg_debug("Tiles loaded in " << (SDL_GetTicks() - ticks) / 1000.0 << " seconds"); + msg_debug << "Tiles loaded in " << (SDL_GetTicks() - ticks) / 1000.0 << " seconds" << std::endl; #endif } @@ -81,7 +81,7 @@ void TileManager::load_tileset(std::string filename) tiles.push_back(0); } if(tiles[tile->id] != 0) { - msg_warning("Tile with ID " << tile->id << " redefined"); + msg_warning << "Tile with ID " << tile->id << " redefined" << std::endl; } tiles[tile->id] = tile; } else if(iter.item() == "tilegroup") { @@ -138,7 +138,7 @@ void TileManager::load_tileset(std::string filename) } else if(iter.item() == "properties") { // deprecated } else { - msg_warning("Unknown symbol '" << iter.item() << "' tile defintion file"); + msg_warning << "Unknown symbol '" << iter.item() << "' tile defintion file" << std::endl; } } } diff --git a/src/tile_manager.hpp b/src/tile_manager.hpp index 66568ba57..5cd6fc2dc 100644 --- a/src/tile_manager.hpp +++ b/src/tile_manager.hpp @@ -70,7 +70,7 @@ public: assert(id < tiles.size()); Tile* tile = tiles[id]; if(!tile) { - msg_warning("Invalid tile: " << id); + msg_warning << "Invalid tile: " << id << std::endl; return tiles[0]; } diff --git a/src/tinygettext/tinygettext.cpp b/src/tinygettext/tinygettext.cpp index 5ea2c9483..424e97c07 100644 --- a/src/tinygettext/tinygettext.cpp +++ b/src/tinygettext/tinygettext.cpp @@ -60,9 +60,8 @@ std::string convert(const std::string& text, out_len -= out_len_temp; // see above if (retval == (size_t) -1) { - msg_warning(strerror(errno)); - msg_warning("Error: conversion from " << from_charset - << " to " << to_charset << " went wrong: " << retval); + msg_warning << strerror(errno) << std::endl; + msg_warning << "Error: conversion from " << from_charset << " to " << to_charset << " went wrong: " << retval << std::endl; return ""; } iconv_close(cd); @@ -238,7 +237,7 @@ DictionaryManager::get_dictionary(const std::string& spec) } else // Dictionary for languages lang isn't loaded, so we load it { - //msg_debug("get_dictionary: " << lang); + //msg_debug << "get_dictionary: " << lang << std::endl; Dictionary& dict = dictionaries[lang]; dict.set_language(get_language_def(lang)); @@ -250,7 +249,7 @@ DictionaryManager::get_dictionary(const std::string& spec) char** files = PHYSFS_enumerateFiles(p->c_str()); if(!files) { - msg_warning("Error: enumerateFiles() failed on " << *p); + msg_warning << "Error: enumerateFiles() failed on " << *p << std::endl; } else { @@ -262,8 +261,8 @@ DictionaryManager::get_dictionary(const std::string& spec) IFileStream in(pofile); read_po_file(dict, in); } catch(std::exception& e) { - msg_warning("Error: Failure file opening: " << pofile); - msg_warning(e.what() << ""); + msg_warning << "Error: Failure file opening: " << pofile << std::endl; + msg_warning << e.what() << "" << std::endl; } } } @@ -285,7 +284,7 @@ DictionaryManager::get_languages() char** files = PHYSFS_enumerateFiles(p->c_str()); if (!files) { - msg_warning("Error: opendir() failed on " << *p); + msg_warning << "Error: opendir() failed on " << *p << std::endl; } else { @@ -406,10 +405,10 @@ Dictionary::translate(const std::string& msgid, const std::string& msgid2, int n else { #ifdef TRANSLATION_DEBUG - msg_warning("Couldn't translate: " << msgid); - msg_warning("Candidates: "); + msg_warning << "Couldn't translate: " << msgid << std::endl; + msg_warning << "Candidates: " << std::endl; for (PluralEntries::iterator i = plural_entries.begin(); i != plural_entries.end(); ++i) - msg_debug("'" << i->first << "'"); + msg_debug << "'" << i->first << "'" << std::endl; #endif if (plural2_1(num)) // default to english rules @@ -430,7 +429,7 @@ Dictionary::translate(const char* msgid) else { #ifdef TRANSLATION_DBEUG - msg_warning("Couldn't translate: " << msgid); + msg_warning << "Couldn't translate: " << msgid << std::endl; #endif return msgid; } @@ -447,7 +446,7 @@ Dictionary::translate(const std::string& msgid) else { #ifdef TRANSLATION_DBEUG - msg_warning("Couldn't translate: " << msgid); + msg_warning << "Couldn't translate: " << msgid << std::endl; #endif return msgid; } @@ -531,7 +530,7 @@ public: if (from_charset.empty() || from_charset == "CHARSET") { - msg_warning("Error: Charset not specified for .po, fallback to ISO-8859-1"); + msg_warning << "Error: Charset not specified for .po, fallback to ISO-8859-1" << std::endl; from_charset = "ISO-8859-1"; } @@ -555,12 +554,11 @@ public: } else if (token.keyword.empty()) { - //msg_warning("Got EOF, everything looks ok."); + //msg_warning << "Got EOF, everything looks ok." << std::endl; } else { - msg_warning("tinygettext: expected 'msgid' keyword, got " << token.keyword - << " at line " << line_num); + msg_warning << "tinygettext: expected 'msgid' keyword, got " << token.keyword << " at line " << line_num << std::endl; } break; @@ -592,8 +590,7 @@ public: } else { - msg_warning("tinygettext: expected 'msgstr' keyword, got " << token.keyword - << " at line " << line_num); + msg_warning << "tinygettext: expected 'msgstr' keyword, got " << token.keyword << " at line " << line_num << std::endl; } break; @@ -603,7 +600,7 @@ public: int num; if (sscanf(token.keyword.c_str(), "msgstr[%d]", &num) != 1) { - msg_warning("Error: Couldn't parse: " << token.keyword); + msg_warning << "Error: Couldn't parse: " << token.keyword << std::endl; } else { @@ -642,7 +639,7 @@ public: while((c = getchar(in)) != EOF) { - //msg_debug("Lexing char: " << char(c) << " " << state); + //msg_debug << "Lexing char: " << char(c) << " " << state << std::endl; switch(state) { case READ_KEYWORD: @@ -693,12 +690,12 @@ public: else if (c == '"') token.content += '"'; else { - msg_warning("Unhandled escape character: " << char(c)); + msg_warning << "Unhandled escape character: " << char(c) << std::endl; } } else { - msg_warning("Unterminated string"); + msg_warning << "Unterminated string" << std::endl; } } else if (c == '"') { // Content string is terminated state = READ_CONTENT; diff --git a/src/title.cpp b/src/title.cpp index f6ebca478..f95c2a872 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -123,8 +123,7 @@ TitleScreen::generate_contrib_menu() contrib_worlds.push_back(world.release()); } catch(std::exception& e) { #ifdef DEBUG - msg_warning("Couldn't parse levelset info for '" - << *it << "': " << e.what() << ""); + msg_warning << "Couldn't parse levelset info for '" << *it << "': " << e.what() << std::endl; #endif } } @@ -148,7 +147,7 @@ TitleScreen::get_level_name(const std::string& filename) level->get("name", name); return name; } catch(std::exception& e) { - msg_warning("Problem getting name of '" << filename << "'."); + msg_warning << "Problem getting name of '" << filename << "'." << std::endl; return ""; } } @@ -364,7 +363,7 @@ TitleScreen::update(float elapsed_time) if(confirm_dialog(bkg_title, str.c_str())) { str = "save/slot" + stream.str() + ".stsg"; - msg_debug("Removing: " << str); + msg_debug << "Removing: " << str << std::endl; PHYSFS_delete(str.c_str()); } diff --git a/src/video/color.hpp b/src/video/color.hpp index 6bce2055f..aca0d9331 100644 --- a/src/video/color.hpp +++ b/src/video/color.hpp @@ -36,7 +36,7 @@ public: if(red < 0 || red > 1.0 || green < 0 || green > 1.0 || blue < 0 || blue > 1.0 || alpha < 0 || alpha > 1.0) - msg_warning("color value out of range: " << red << ", " << green << ", " << blue << ", " << alpha); + msg_warning << "color value out of range: " << red << ", " << green << ", " << blue << ", " << alpha << std::endl; } float red, green, blue, alpha; diff --git a/src/video/font.cpp b/src/video/font.cpp index 972ba40e3..7394441e7 100644 --- a/src/video/font.cpp +++ b/src/video/font.cpp @@ -211,13 +211,13 @@ Font::draw_chars(Surface* pchars, const std::string& text, const Vector& pos, if(c >= 0x80) { font_index -= 32; if(c <= 0xa0) { - msg_debug("Unsupported utf-8 character '" << c << "' found"); + msg_debug << "Unsupported utf-8 character '" << c << "' found" << std::endl; font_index = 0; } } if(font_index < 0 || font_index >= (ssize_t) char_count) { - msg_debug("Unsupported utf-8 character found"); + msg_debug << "Unsupported utf-8 character found" << std::endl; font_index = 0; } diff --git a/src/video/texture_manager.cpp b/src/video/texture_manager.cpp index 38ad4110e..174343bd5 100644 --- a/src/video/texture_manager.cpp +++ b/src/video/texture_manager.cpp @@ -28,7 +28,7 @@ TextureManager::~TextureManager() i != image_textures.end(); ++i) { if(i->second == NULL) continue; - msg_warning("Texture '" << i->first << "' not freed"); + msg_warning << "Texture '" << i->first << "' not freed" << std::endl; delete i->second; } } diff --git a/src/world.cpp b/src/world.cpp index a806afd99..04c2de56b 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -77,8 +77,7 @@ World::load(const std::string& filename) std::string path = basedir + "/"; char** files = PHYSFS_enumerateFiles(path.c_str()); if(!files) { - msg_warning("Couldn't read subset dir '" - << path << "'"); + msg_warning << "Couldn't read subset dir '" << path << "'" << std::endl; return; } @@ -100,7 +99,7 @@ World::run() interpeter->run_script(in, filename, true); } catch(std::exception& e) { - msg_warning("Problem running world script: " << e.what()); + msg_warning << "Problem running world script: " << e.what() << std::endl; } } diff --git a/src/worldmap.cpp b/src/worldmap.cpp index d1ba8162b..b4b6f1f77 100644 --- a/src/worldmap.cpp +++ b/src/worldmap.cpp @@ -151,7 +151,7 @@ Tux::draw(DrawingContext& context) tux_sprite->set_action(moving ? "small-walking" : "small-stop"); break; default: - msg_debug("Bonus type not handled in worldmap."); + msg_debug << "Bonus type not handled in worldmap." << std::endl; tux_sprite->set_action("large-stop"); break; } @@ -296,7 +296,7 @@ Tux::tryContinueWalking(float elapsed_time) if (dir == D_NONE) { // Should never be reached if tiledata is good - msg_warning("Could not determine where to walk next"); + msg_warning << "Could not determine where to walk next" << std::endl; stop(); return; } @@ -316,7 +316,7 @@ Tux::tryContinueWalking(float elapsed_time) } else { - msg_warning("Tilemap data is buggy"); + msg_warning << "Tilemap data is buggy" << std::endl; stop(); } } @@ -444,7 +444,7 @@ WorldMap::load_map() } else if(iter.item() == "name") { // skip } else { - msg_warning("Unknown token '" << iter.item() << "' in worldmap"); + msg_warning << "Unknown token '" << iter.item() << "' in worldmap" << std::endl; } } if(solids == 0) @@ -547,8 +547,7 @@ WorldMap::parse_level_tile(const lisp::Lisp* level_lisp) // Do we want to bail out instead...? We might get messages from modders // who can't make their levels run because they're too dumb to watch // their terminals... - msg_warning("level file '" << level.name - << "' does not exist and will not be added to the worldmap"); + msg_warning << "level file '" << level.name << "' does not exist and will not be added to the worldmap" << std::endl; return; } @@ -580,7 +579,7 @@ WorldMap::get_level_title(Level& level) level_lisp->get("name", level.title); } catch(std::exception& e) { - msg_warning("Problem when reading leveltitle: " << e.what()); + msg_warning << "Problem when reading leveltitle: " << e.what() << std::endl; return; } } @@ -734,7 +733,7 @@ WorldMap::finished_level(const std::string& filename) interpreter->run_script(in, "level-extro-script"); add_object(interpreter.release()); } catch(std::exception& e) { - msg_fatal("Couldn't run level-extro-script:" << e.what()); + msg_fatal << "Couldn't run level-extro-script:" << e.what() << std::endl; } } @@ -833,8 +832,7 @@ WorldMap::update(float delta) /* Check level action */ Level* level = at_level(); if (!level) { - msg_warning("No level to enter at: " - << tux->get_tile_pos().x << ", " << tux->get_tile_pos().y); + msg_warning << "No level to enter at: " << tux->get_tile_pos().x << ", " << tux->get_tile_pos().y << std::endl; return; } @@ -849,7 +847,7 @@ WorldMap::update(float delta) ST_GL_LOAD_LEVEL_FILE, &level->statistics); main_loop->push_screen(session); } catch(std::exception& e) { - msg_fatal("Couldn't load level: " << e.what()); + msg_fatal << "Couldn't load level: " << e.what() << std::endl; } } } @@ -1060,7 +1058,7 @@ WorldMap::savegame(const std::string& filename) void WorldMap::loadgame(const std::string& filename) { - msg_debug("loadgame: " << filename); + msg_debug << "loadgame: " << filename << std::endl; savegame_file = filename; if (PHYSFS_exists(filename.c_str())) // savegame exists @@ -1119,13 +1117,12 @@ WorldMap::loadgame(const std::string& filename) } } } else { - msg_warning("Unknown token '" << iter.item() - << "' in levels block in worldmap"); + msg_warning << "Unknown token '" << iter.item() << "' in levels block in worldmap" << std::endl; } } } } catch(std::exception& e) { - msg_warning("Problem loading game '" << filename << "': " << e.what()); + msg_warning << "Problem loading game '" << filename << "': " << e.what() << std::endl; load_map(); player_status->reset(); }