#include <physfs.h>
#include <vorbis/codec.h>
#include <vorbis/vorbisfile.h>
-#include "msg.hpp"
+#include "log.hpp"
class WavSoundFile : public SoundFile
{
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 << std::endl;
+ log_debug << "MAGIC: " << magic << std::endl;
throw std::runtime_error("file is not a RIFF wav file");
}
#include "sound_file.hpp"
#include "sound_source.hpp"
#include "stream_sound_source.hpp"
-#include "msg.hpp"
+#include "log.hpp"
SoundManager* sound_manager = 0;
} catch(std::exception& e) {
device = 0;
context = 0;
- msg_warning << "Couldn't initialize audio device:" << e.what() << std::endl;
+ log_warning << "Couldn't initialize audio device:" << e.what() << std::endl;
print_openal_version();
throw e;
}
source->play();
sources.push_back(source);
} catch(std::exception& e) {
- msg_warning << "Couldn't play sound " << filename << ": " << e.what() << std::endl;
+ log_warning << "Couldn't play sound " << filename << ": " << e.what() << std::endl;
}
}
delete music_source;
music_source = newmusic.release();
} catch(std::exception& e) {
- msg_warning << "Couldn't play music file '" << filename << "': " << e.what() << std::endl;
+ log_warning << "Couldn't play music file '" << filename << "': " << e.what() << std::endl;
}
}
void
SoundManager::print_openal_version()
{
- 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;
+ log_info << "OpenAL Vendor: " << alGetString(AL_VENDOR) << std::endl;
+ log_info << "OpenAL Version: " << alGetString(AL_VERSION) << std::endl;
+ log_info << "OpenAL Renderer: " << alGetString(AL_RENDERER) << std::endl;
+ log_info << "OpenAl Extensions: " << alGetString(AL_EXTENSIONS) << std::endl;
}
void
#include "stream_sound_source.hpp"
#include "sound_manager.hpp"
#include "sound_file.hpp"
-#include "msg.hpp"
+#include "log.hpp"
StreamSoundSource::StreamSoundSource()
: file(0), fade_state(NoFading), looping(false)
return;
// we might have to restart the source if we had a buffer underrun
- msg_info << "Restarting audio source because of buffer underrun" << std::endl;
+ log_info << "Restarting audio source because of buffer underrun" << std::endl;
play();
}
#include "tile.hpp"
#include "statistics.hpp"
#include "game_session.hpp"
-#include "msg.hpp"
+#include "log.hpp"
static const float SQUISH_TIME = 2;
static const float X_OFFSCREEN_DISTANCE = 1600;
void
BadGuy::save(lisp::Writer& )
{
- msg_warning << "tried to write out a generic badguy" << std::endl;
+ log_warning << "tried to write out a generic badguy" << std::endl;
}
void
#include <config.h>
#include "flame.hpp"
-#include "msg.hpp"
+#include "log.hpp"
Flame::Flame(const lisp::Lisp& reader)
: angle(0), radius(100), speed(2), source(0)
delete source;
source = sound_manager->create_sound_source("sounds/flame.wav");
if(!source) {
- msg_warning << "Couldn't start flame sound" << std::endl;
+ log_warning << "Couldn't start flame sound" << std::endl;
return;
}
source->set_position(get_pos());
#include <config.h>
#include "totem.hpp"
-#include "msg.hpp"
+#include "log.hpp"
static const float WALKSPEED = 100;
static const float JUMP_ON_SPEED_Y = 400;
Totem::jump_on(Totem* target)
{
if (target->carrying) {
- msg_warning << "target is already carrying someone" << std::endl;
+ log_warning << "target is already carrying someone" << std::endl;
return;
}
void
Totem::jump_off() {
if (!carried_by) {
- msg_warning << "not carried by anyone" << std::endl;
+ log_warning << "not carried by anyone" << std::endl;
return;
}
#include <config.h>
#include "willowisp.hpp"
-#include "msg.hpp"
+#include "log.hpp"
#include "game_session.hpp"
static const float FLYSPEED = 64; /**< speed in px per second */
delete soundSource;
soundSource = sound_manager->create_sound_source("sounds/willowisp.wav");
if(!soundSource) {
- msg_warning << "Couldn't start WillOWisp sound" << std::endl;
+ log_warning << "Couldn't start WillOWisp sound" << std::endl;
return;
}
soundSource->set_position(get_pos());
#include <iostream>
#include "collision_grid.hpp"
-#include "msg.hpp"
+#include "log.hpp"
#include "collision.hpp"
#include "sector.hpp"
#include "collision_grid_iterator.hpp"
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 << std::endl;
+ log_warning << "Object out of range: " << gridx << ", " << gridy << std::endl;
continue;
}
GridEntry* entry = new GridEntry;
assert(wrapper != 0);
#else
if(wrapper == 0) {
- msg_warning << "Tried to remove nonexistant object" << std::endl;
+ log_warning << "Tried to remove nonexistant object" << std::endl;
return;
}
#endif
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 << std::endl;
+ log_warning << "Object out of range: " << gridx << ", " << gridy << std::endl;
continue;
}
remove_object_from_gridcell(gridy*cells_x + gridx, 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 << std::endl;
+ log_warning << "Object out of range: " << gridx << ", " << gridy << std::endl;
continue;
}
remove_object_from_gridcell(gridy*cells_x + gridx, 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 << std::endl;
+ log_warning << "Object out of range: " << gridx << ", " << gridy << std::endl;
continue;
}
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 << std::endl;
+ //log_warning << "Object out of range: " << gridx << ", " << gridy << std::endl;
continue;
}
entry = entry->next;
};
- msg_warning << "Couldn't find object in cell" << std::endl;
+ log_warning << "Couldn't find object in cell" << std::endl;
}
#define __COLLISION_GRID_ITERATOR_H__
#include "math/rect.hpp"
-#include "msg.hpp"
+#include "log.hpp"
class CollisionGrid;
entry = 0;
if(start_x >= end_x) {
- msg_debug << "bad region" << std::endl;
+ log_debug << "bad region" << std::endl;
y = 0;
end_y = 0;
return;
#include "resources.hpp"
/// speed (pixels/s) the console closes
-static const float CLOSE_SPEED = 50;
+static const float FADE_SPEED = 1;
Console::Console()
- : backgroundOffset(0), height(0), offset(0), focused(false), stayOpen(0)
+ : backgroundOffset(0), height(0), alpha(1.0), offset(0), focused(false),
+ stayOpen(0)
{
+ font.reset(new Font("images/engine/fonts/white-small.png",
+ "images/engine/fonts/shadow-small.png", 8, 9, 1));
background.reset(new Surface("images/engine/console.png"));
background2.reset(new Surface("images/engine/console2.png"));
}
}
int newtop = sq_gettop(vm);
if(newtop < oldtop) {
- msg_fatal << "Script destroyed squirrel stack..." << std::endl;
+ log_fatal << "Script destroyed squirrel stack..." << std::endl;
} else {
sq_settop(vm, oldtop);
}
s = "..."+s.substr(99-3);
}
lines.push_front(s);
- while (lines.size() >= 65535) lines.pop_back();
+
+ while (lines.size() >= 1000)
+ lines.pop_back();
+
if (height < 64) {
- if (height < 4+9) height=4+9;
- height+=9;
+ if(height < 4)
+ height = 4;
+ height += font->get_height();
}
+ alpha = 1.0;
if(stayOpen < 5)
- stayOpen += 0.7;
+ stayOpen += 1;
}
void
// send command to the most recently registered ccr
ConsoleCommandReceiver* ccr = i->second.front();
- if (ccr->consoleCommand(command, args) != true) msg_warning << "Sent command to registered ccr, but command was unhandled" << std::endl;
+ if (ccr->consoleCommand(command, args) != true) log_warning << "Sent command to registered ccr, but command was unhandled" << std::endl;
}
bool
{
if (command == "ccrs") {
if (arguments.size() != 1) {
- msg_info << "Usage: ccrs <command>" << std::endl;
+ log_info << "Usage: ccrs <command>" << std::endl;
return true;
}
std::map<std::string, std::list<ConsoleCommandReceiver*> >::iterator i = commands.find(arguments[0]);
if ((i == commands.end()) || (i->second.size() == 0)) {
- msg_info << "unknown command: \"" << arguments[0] << "\"" << std::endl;
+ log_info << "unknown command: \"" << arguments[0] << "\"" << std::endl;
return true;
}
ccr_list << "[" << *j << "]";
}
- msg_info << "registered ccrs for \"" << arguments[0] << "\": " << ccr_list.str() << std::endl;
+ log_info << "registered ccrs for \"" << arguments[0] << "\": " << ccr_list.str() << std::endl;
return true;
}
{
focused = true;
height = 256;
+ alpha = 1.0;
}
void
if(stayOpen < 0)
stayOpen = 0;
} else if(!focused && height > 0) {
- height -= elapsed_time * CLOSE_SPEED;
- if(height < 0)
+ alpha -= elapsed_time * FADE_SPEED;
+ if(alpha < 0) {
+ alpha = 0;
height = 0;
+ }
}
}
if (height == 0)
return;
+ context.push_transform();
+ context.set_alpha(alpha);
context.draw_surface(background2.get(), Vector(SCREEN_WIDTH/2 - background->get_width()/2 - background->get_width() + backgroundOffset, height - background->get_height()), LAYER_FOREGROUND1+1);
context.draw_surface(background2.get(), Vector(SCREEN_WIDTH/2 - background->get_width()/2 + backgroundOffset, height - background->get_height()), LAYER_FOREGROUND1+1);
context.draw_surface(background.get(), Vector(SCREEN_WIDTH/2 - background->get_width()/2, height - background->get_height()), LAYER_FOREGROUND1+1);
if (focused) {
lineNo++;
float py = height-4-1*9;
- context.draw_text(white_small_text, "> "+inputBuffer.str()+"_", Vector(4, py), LEFT_ALLIGN, LAYER_FOREGROUND1+1);
+ context.draw_text(font.get(), "> "+inputBuffer.str()+"_", Vector(4, py), LEFT_ALLIGN, LAYER_FOREGROUND1+1);
}
int skipLines = -offset;
lineNo++;
float py = height-4-lineNo*9;
if (py < -9) break;
- context.draw_text(white_small_text, *i, Vector(4, py), LEFT_ALLIGN, LAYER_FOREGROUND1+1);
+ context.draw_text(font.get(), *i, Vector(4, py), LEFT_ALLIGN, LAYER_FOREGROUND1+1);
}
+
+ context.pop_transform();
}
void
{
std::map<std::string, std::list<ConsoleCommandReceiver*> >::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." << std::endl;
+ log_warning << "Command \"" << command << "\" not associated with a command receiver. Not dissociated." << std::endl;
return;
}
std::list<ConsoleCommandReceiver*>::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." << std::endl;
+ log_warning << "Command \"" << command << "\" not associated with given command receiver. Not dissociated." << std::endl;
return;
}
i->second.erase(j);
class ConsoleCommandReceiver;
class DrawingContext;
class Surface;
+class Font;
class Console
{
int backgroundOffset; /**< current offset of scrolling background image */
float height; /**< height of the console in px */
+ float alpha;
int offset; /**< decrease to scroll text up */
bool focused; /**< true if console has input focus */
+ std::auto_ptr<Font> font;
float stayOpen;
#include <sstream>
#include "joystickkeyboardcontroller.hpp"
-#include "msg.hpp"
+#include "log.hpp"
#include "gui/menu.hpp"
#include "gettext.hpp"
#include "lisp/lisp.hpp"
SDL_Joystick* joystick = SDL_JoystickOpen(i);
bool good = true;
if(SDL_JoystickNumButtons(joystick) < 2) {
- msg_warning << "Joystick " << i << " has less than 2 buttons" << std::endl;
+ log_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" << std::endl;
+ log_warning << "Joystick " << i << " has less than 2 axes and no hat" << std::endl;
good = false;
}
if(!good) {
map->get("key", key);
map->get("control", control);
if(key < SDLK_FIRST || key >= SDLK_LAST) {
- msg_warning << "Invalid key '" << key << "' in keymap" << std::endl;
+ log_warning << "Invalid key '" << key << "' in keymap" << std::endl;
continue;
}
break;
}
if(controlNames[i] == 0) {
- msg_warning << "Invalid control '" << control << "' in keymap" << std::endl;
+ log_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" << std::endl;
+ log_warning << "Invalid lisp element '" << iter.item() << "' in keymap" << std::endl;
}
}
}
map->get("button", button);
map->get("control", control);
if(button < 0 || button >= max_joybuttons) {
- msg_warning << "Invalid button '" << button << "' in buttonmap" << std::endl;
+ log_warning << "Invalid button '" << button << "' in buttonmap" << std::endl;
continue;
}
break;
}
if(controlNames[i] == 0) {
- msg_warning << "Invalid control '" << control << "' in buttonmap" << std::endl;
+ log_warning << "Invalid control '" << control << "' in buttonmap" << std::endl;
continue;
}
reset_joybutton(button, (Control) i);
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" << std::endl;
+ log_debug << "Unmapped joybutton " << (int)event.jbutton.button << " pressed" << std::endl;
return;
}
// default action: update controls
if(key_mapping == keymap.end()) {
- msg_debug << "Key " << event.key.keysym.sym << " is unbound" << std::endl;
+ log_debug << "Key " << event.key.keysym.sym << " is unbound" << std::endl;
return;
}
Control control = key_mapping->second;
#include <config.h>
-#include "msg.hpp"
+#include "log.hpp"
#include "file_system.hpp"
#include <string>
if(pathelem == "..") {
if(path_stack.empty()) {
- msg_warning << "Invalid '..' in path '" << filename << "'" << std::endl;
+ log_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 {
#include <SDL.h>
#include "game_session.hpp"
-#include "msg.hpp"
+#include "log.hpp"
#include "worldmap.hpp"
#include "mainloop.hpp"
#include "video/screen.hpp"
GameSession::consoleCommand(std::string command, std::vector<std::string>)
{
if (command == "foo") {
- msg_info << "bar" << std::endl;
+ log_info << "bar" << std::endl;
return true;
}
return true;
}
if (command == "whereami") {
- msg_info << "You are at x " << tux.get_pos().x << ", y " << tux.get_pos().y << std::endl;
+ log_info << "You are at x " << tux.get_pos().x << ", y " << tux.get_pos().y << std::endl;
return true;
}
if (command == "gotoend") {
return true;
}
if (command == "camera") {
- msg_info << "Camera is at " << Sector::current()->camera->get_translation().x << "," << Sector::current()->camera->get_translation().y << std::endl;
+ log_info << "Camera is at " << Sector::current()->camera->get_translation().x << "," << Sector::current()->camera->get_translation().y << std::endl;
return true;
}
if (command == "quit") {
if(newsector != "" && newspawnpoint != "") {
Sector* sector = level->get_sector(newsector);
if(sector == 0) {
- msg_warning << "Sector '" << newsector << "' not found" << std::endl;
+ log_warning << "Sector '" << newsector << "' not found" << std::endl;
}
sector->activate(newspawnpoint);
sector->play_music(LEVEL_MUSIC);
}
} else if(sequencename == "stoptux") {
if(!end_sequence) {
- msg_warning << "Final target reached without an active end sequence" << std::endl;
+ log_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 << "'" << std::endl;
+ log_warning << "Unknown sequence '" << sequencename << "'" << std::endl;
}
}
#include <stdexcept>
#include "video/screen.hpp"
-#include "msg.hpp"
+#include "log.hpp"
#include "lisp/parser.hpp"
#include "lisp/lisp.hpp"
#include "lisp/list_iterator.hpp"
if(token == "version") {
iter.value()->get(version);
if(version > 2) {
- msg_warning << "level format newer than application" << std::endl;
+ log_warning << "level format newer than application" << std::endl;
}
} else if(token == "name") {
iter.value()->get(name);
sector->parse(*(iter.lisp()));
add_sector(sector);
} else {
- msg_warning << "Unknown token '" << token << "' in level file" << std::endl;
+ log_warning << "Unknown token '" << token << "' in level file" << std::endl;
continue;
}
}
#include "writer.hpp"
#include "physfs/physfs_stream.hpp"
-#include "msg.hpp"
+#include "log.hpp"
namespace lisp
{
Writer::~Writer()
{
if(lists.size() > 0) {
- msg_warning << "Not all sections closed in lispwriter" << std::endl;
+ log_warning << "Not all sections closed in lispwriter" << std::endl;
}
if(out_owned)
delete out;
Writer::end_list(const std::string& listname)
{
if(lists.size() == 0) {
- msg_warning << "Trying to close list '" << listname << "', which is not open" << std::endl;
+ log_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" << std::endl;
+ log_warning << "trying to close list '" << listname << "' while list '" << lists.back() << "' is open" << std::endl;
return;
}
lists.pop_back();
--- /dev/null
+// $Id: debug.cpp 2650 2005-06-28 12:42:08Z sommer $
+//
+// SuperTux Debug Helper Functions
+// Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __SUPERTUX_MSG_H__
+#define __SUPERTUX_MSG_H__
+
+#include <iostream>
+#include <stdio.h>
+
+#include "console.hpp"
+
+#ifdef DEBUG
+
+namespace {
+
+inline std::ostream& log_debug_f(const char* file, int line) {
+ Console::output << "[DEBUG] " << file << " l." << line << ": ";
+ return Console::output;
+}
+
+inline std::ostream& log_info_f(const char* file, int line) {
+ Console::output << "[INFO] " << file << " l." << line << ": ";
+ return Console::output;
+}
+
+inline std::ostream& log_warning_f(const char* file, int line) {
+ Console::output << "[WARNING] " << file << " l." << line << ": ";
+ return Console::output;
+}
+
+inline std::ostream& log_fatal_f(const char* file, int line) {
+ Console::output << "[FATAL] " << file << " l." << line << ": ";
+ return Console::output;
+}
+
+}
+
+#define log_debug log_debug_f(__FILE__, __LINE__)
+#define log_info log_info_f(__FILE__, __LINE__)
+#define log_warning log_warning_f(__FILE__, __LINE__)
+#define log_fatal log_fatal_f(__FILE__, __LINE__)
+
+#else
+
+namespace {
+
+inline std::ostream& log_warning_f() {
+ Console::output << "Warning: ";
+ return Console::output;
+}
+
+inline std::ostream& log_fatal_f() {
+ Console::output << "Fatal: ";
+ return Console::output;
+}
+
+}
+
+#define log_debug if (0) std::cerr
+#define log_info Console::output
+#define log_warning log_warning_f()
+#define log_fatal log_fatal_f()
+
+#endif
+
+#endif
+
#include <config.h>
#include <assert.h>
-#include "msg.hpp"
+#include "log.hpp"
#include "main.hpp"
#include <stdexcept>
try {
config->load();
} catch(std::exception& e) {
- msg_info << "Couldn't load config file: " << e.what() << ", using default settings" << std::endl;
+ log_info << "Couldn't load config file: " << e.what() << ", using default settings" << std::endl;
}
}
if(f) {
fclose(f);
if(!PHYSFS_addToSearchPath(dir.c_str(), 1)) {
- msg_warning << "Couldn't add '" << dir << "' to physfs searchpath: " << PHYSFS_getLastError() << std::endl;
+ log_warning << "Couldn't add '" << dir << "' to physfs searchpath: " << PHYSFS_getLastError() << std::endl;
} else {
sourcedir = true;
}
datadir = APPDATADIR;
#endif
if(!PHYSFS_addToSearchPath(datadir.c_str(), 1)) {
- msg_warning << "Couldn't add '" << datadir << "' to physfs searchpath: " << PHYSFS_getLastError() << std::endl;
+ log_warning << "Couldn't add '" << datadir << "' to physfs searchpath: " << PHYSFS_getLastError() << std::endl;
}
#endif
}
//show search Path
for(char** i = PHYSFS_getSearchPath(); *i != NULL; i++)
- msg_info << "[" << *i << "] is in the search path" << std::endl;
+ log_info << "[" << *i << "] is in the search path" << std::endl;
}
static void print_usage(const char* argv0)
print_usage(argv[0]);
return true;
} else if(arg == "--version") {
- msg_info << PACKAGE_NAME << " " << PACKAGE_VERSION << std::endl;
+ log_info << PACKAGE_NAME << " " << PACKAGE_VERSION << std::endl;
return true;
} else if(arg[0] != '-') {
config->start_level = arg;
} else {
- msg_warning << "Unknown option '" << arg << "'. Use --help to see a list of options" << std::endl;
+ log_warning << "Unknown option '" << arg << "'. Use --help to see a list of options" << std::endl;
}
}
}
#ifdef DEBUG
else {
- msg_warning << "Couldn't find icon 'images/engine/icons/supertux.xpm'" << std::endl;
+ log_warning << "Couldn't find icon 'images/engine/icons/supertux.xpm'" << std::endl;
}
#endif
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" << std::endl;
+ log_info << "Component '" << last_timelog_component << "' finished after " << (current_ticks - last_timelog_ticks) / 1000.0 << " seconds" << std::endl;
}
last_timelog_ticks = current_ticks;
init_audio();
timelog("video");
init_video();
- Console::instance = new Console();
+ Console::instance = new Console();
timelog("scripting");
init_scripting();
timelog("menu");
setup_menu();
timelog("resources");
- load_shared();
+ load_shared();
timelog(0);
main_loop = new MainLoop();
main_loop->run();
} catch(std::exception& e) {
- msg_fatal << "Unexpected exception: " << e.what() << std::endl;
+ log_fatal << "Unexpected exception: " << e.what() << std::endl;
result = 1;
} catch(...) {
- msg_fatal << "Unexpected exception" << std::endl;
+ log_fatal << "Unexpected exception" << std::endl;
result = 1;
}
+++ /dev/null
-// $Id: debug.cpp 2650 2005-06-28 12:42:08Z sommer $
-//
-// SuperTux Debug Helper Functions
-// Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __SUPERTUX_MSG_H__
-#define __SUPERTUX_MSG_H__
-
-#include <iostream>
-#include <stdio.h>
-
-#include "console.hpp"
-
-#ifdef DEBUG
-
-namespace {
-
-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
-
-namespace {
-
-inline std::ostream& msg_warning_f() {
- Console::output << "Warning: ";
- return Console::output;
-}
-
-inline std::ostream& msg_fatal_f() {
- Console::output << "Fatal: ";
- return Console::output;
-}
-
-}
-
-#define msg_debug if (0) std::cerr
-#define msg_info Console::output
-#define msg_warning msg_warning_f()
-#define msg_fatal msg_fatal_f()
-
-#endif
-
-#endif
-
#include "sector.hpp"
#include "audio/sound_manager.hpp"
#include "audio/sound_source.hpp"
-#include "msg.hpp"
+#include "log.hpp"
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" << std::endl;
+ log_warning << "No Position in ambient_sound" << std::endl;
}
lisp.get("width" , dimension.x);
currentvolume=targetvolume=1e-20;
sound_source->play();
} catch(std::exception& e) {
- msg_warning << "Couldn't play '" << sample << "': " << e.what() << "" << std::endl;
+ log_warning << "Couldn't play '" << sample << "': " << e.what() << "" << std::endl;
delete sound_source;
sound_source = 0;
}
#include <sstream>
#include "anchor_point.hpp"
#include "math/rect.hpp"
-#include "msg.hpp"
+#include "log.hpp"
std::string anchor_point_to_string(AnchorPoint point)
{
#ifdef DEBUG
throw std::runtime_error("Invalid anchor point found");
#endif
- msg_warning << "Invalid anchor point found" << std::endl;
+ log_warning << "Invalid anchor point found" << std::endl;
result.x = rect.get_left();
break;
}
#ifdef DEBUG
throw std::runtime_error("Invalid anchor point found");
#endif
- msg_warning << "Invalid anchor point found" << std::endl;
+ log_warning << "Invalid anchor point found" << std::endl;
result.y = rect.get_top();
break;
}
#ifdef DEBUG
throw std::runtime_error("Invalid anchor point found");
#endif
- msg_warning << "Invalid anchor point found" << std::endl;
+ log_warning << "Invalid anchor point found" << std::endl;
result.x = destrect.get_left();
break;
}
#ifdef DEBUG
throw std::runtime_error("Invalid anchor point found");
#endif
- msg_warning << "Invalid anchor point found" << std::endl;
+ log_warning << "Invalid anchor point found" << std::endl;
result.y = destrect.get_top();
break;
}
#include "object_factory.hpp"
#include "resources.hpp"
#include "main.hpp"
-#include "msg.hpp"
+#include "log.hpp"
Background::Background()
: layer(LAYER_BACKGROUND0)
#include <config.h>
#include "block.hpp"
-#include "msg.hpp"
+#include "log.hpp"
#include <stdexcept>
case 4: contents = CONTENT_1UP; break;
case 5: contents = CONTENT_ICEGROW; break;
default:
- msg_warning << "Invalid box contents" << std::endl;
+ log_warning << "Invalid box contents" << std::endl;
contents = CONTENT_COIN;
break;
}
} else if(contentstring == "custom") {
contents = CONTENT_CUSTOM;
} else {
- msg_warning << "Invalid box contents '" << contentstring << "'" << std::endl;
+ log_warning << "Invalid box contents '" << contentstring << "'" << std::endl;
}
} else {
if(contents == CONTENT_CUSTOM) {
throw std::runtime_error(
"Only MovingObjects are allowed inside BonusBlocks");
} else {
- msg_warning << "Invalid element '" << token << "' in bonusblock" << std::endl;
+ log_warning << "Invalid element '" << token << "' in bonusblock" << std::endl;
}
}
}
#include "sector.hpp"
#include "main.hpp"
#include "object_factory.hpp"
-#include "msg.hpp"
+#include "log.hpp"
#include "path.hpp"
#include "path_walker.hpp"
#include "object_factory.hpp"
#include "resources.hpp"
#include "main.hpp"
-#include "msg.hpp"
+#include "log.hpp"
Gradient::Gradient()
: layer(LAYER_BACKGROUND0)
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" << std::endl;
+ log_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" << std::endl;
+ log_warning << "bottom gradient color has values above 1.0" << std::endl;
}
void
#include "object_factory.hpp"
#include "lisp/lisp.hpp"
#include "sector.hpp"
-#include "msg.hpp"
+#include "log.hpp"
InfoBlock::InfoBlock(const lisp::Lisp& lisp)
: Block(sprite_manager->create("images/objects/bonus_block/infoblock.sprite"))
bbox.set_pos(pos);
if(!lisp.get("message", message)) {
- msg_warning << "No message in InfoBlock" << std::endl;
+ log_warning << "No message in InfoBlock" << std::endl;
}
//stopped = false;
//ringing = new AmbientSound(get_pos(), 0.5, 300, 1, "sounds/phone.wav");
#include "object/player.hpp"
#include "video/drawing_context.hpp"
#include "lisp/list_iterator.hpp"
-#include "msg.hpp"
+#include "log.hpp"
/** When to alert player they're low on time! */
static const float TIME_WARNING = 20;
iter.value()->get(time);
break;
} else {
- msg_warning << "Unknown token '" << iter.item() << "' in LevelTime object" << std::endl;
+ log_warning << "Unknown token '" << iter.item() << "' in LevelTime object" << std::endl;
}
}
if(time < 0)
#include "lisp/lisp.hpp"
#include "lisp/list_iterator.hpp"
#include "object_factory.hpp"
-#include "msg.hpp"
+#include "log.hpp"
#include <assert.h>
#include <iostream>
}
if(iter.item() != "node") {
- msg_warning << "unknown token '" << iter.item() << "' in Path nodes list. Ignored." << std::endl;
+ log_warning << "unknown token '" << iter.item() << "' in Path nodes list. Ignored." << std::endl;
continue;
}
const lisp::Lisp* node_lisp = iter.lisp();
writer.write_string("mode", "circular");
break;
default:
- msg_warning << "Don't know how to write mode " << (int) mode << " ?!?" << std::endl;
+ log_warning << "Don't know how to write mode " << (int) mode << " ?!?" << std::endl;
break;
}
#include "platform.hpp"
#include <stdexcept>
-#include "msg.hpp"
+#include "log.hpp"
#include "video/drawing_context.hpp"
#include "resources.hpp"
#include "player.hpp"
#include "platform.hpp"
#include "badguy/badguy.hpp"
#include "player_status.hpp"
-#include "msg.hpp"
+#include "log.hpp"
static const int TILES_FOR_BUTTJUMP = 3;
static const float SHOOTING_TIME = .150;
if(moving_object) {
moving_object->set_pos(pos);
} else {
- msg_debug << "Non MovingObjetc grabbed?!?" << std::endl;
+ log_debug << "Non MovingObjetc grabbed?!?" << std::endl;
}
grabbed_object->ungrab(*this, dir);
grabbed_object = 0;
#include "audio/sound_manager.hpp"
#include "object_factory.hpp"
#include "sector.hpp"
-#include "msg.hpp"
+#include "log.hpp"
PowerUp::PowerUp(const lisp::Lisp& lisp)
{
#include "resources.hpp"
#include "video/drawing_context.hpp"
#include "scripting/wrapper_util.hpp"
-#include "msg.hpp"
+#include "log.hpp"
TextObject::TextObject()
: fading(0), fadetime(0), visible(false)
} else if(name == "small") {
font = white_small_text;
} else {
- msg_warning << "Unknown font '" << name << "'." << std::endl;
+ log_warning << "Unknown font '" << name << "'." << std::endl;
}
}
#include "lisp/writer.hpp"
#include "object_factory.hpp"
#include "main.hpp"
-#include "msg.hpp"
+#include "log.hpp"
TileMap::TileMap()
: solid(false), speed(1), width(0), height(0), layer(LAYER_TILES),
else if(layer_str == "foreground")
layer = LAYER_FOREGROUNDTILES;
else
- msg_warning << "Unknown layer '" << layer_str << "' in tilemap" << std::endl;
+ log_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" << std::endl;
+ log_warning << "Speed of solid tilemap is not 1. fixing" << std::endl;
speed = 1;
}
if(solid)
writer.write_string("layer", "foreground");
else {
writer.write_string("layer", "unknown");
- msg_warning << "unknown layer in tilemap" << std::endl;
+ log_warning << "unknown layer in tilemap" << std::endl;
}
writer.write_bool("solid", solid);
TileMap::get_tile(int x, int y) const
{
if(x < 0 || x >= width || y < 0 || y >= height) {
- //msg_warning << "tile outside tilemap requested" << std::endl;
+ //log_warning << "tile outside tilemap requested" << std::endl;
return tilemanager->get(0);
}
#include <iostream>
#include <assert.h>
-#include "msg.hpp"
+#include "log.hpp"
static int funcSeek(struct SDL_RWops* context, int offset, int whence)
{
break;
}
if(res == 0) {
- msg_warning << "Error seeking in file: " << PHYSFS_getLastError() << std::endl;
+ log_warning << "Error seeking in file: " << PHYSFS_getLastError() << std::endl;
return -1;
}
#include "sprite/sprite_manager.hpp"
#include "math/vector.hpp"
#include "main.hpp"
-#include "msg.hpp"
+#include "log.hpp"
static const int START_COINS = 100;
static const int MAX_COINS = 99999;
writer.write_string("bonus", "iceflower");
break;
default:
- msg_warning << "Unknown bonus type." << std::endl;
+ log_warning << "Unknown bonus type." << std::endl;
writer.write_string("bonus", "none");
}
writer.write_bool("key-brass", keys & KEY_BRASS);
} else if(bonusname == "iceflower") {
bonus = ICE_BONUS;
} else {
- msg_warning << "Unknown bonus '" << bonusname << "' in savefile" << std::endl;
+ log_warning << "Unknown bonus '" << bonusname << "' in savefile" << std::endl;
bonus = NO_BONUS;
}
}
{
if (command == "coins") {
if ((arguments.size() < 1) || (!Console::string_is<int>(arguments[0]))) {
- msg_info << "Usage: coins <number>" << std::endl;
+ log_info << "Usage: coins <number>" << std::endl;
} else {
coins = Console::string_to<int>(arguments[0]);
}
#include "scripting/camera.hpp"
#include "math/vector.hpp"
-#define NOIMPL msg_fatal << __PRETTY_FUNCTION__ << " not implemented."
+#define NOIMPL log_fatal << __PRETTY_FUNCTION__ << " not implemented."
namespace Scripting
{
} else if(mode == "manual") {
camera->mode = ::Camera::MANUAL;
} else {
- msg_fatal << "Camera mode '" << mode << "' unknown.";
+ log_fatal << "Camera mode '" << mode << "' unknown.";
}
}
#include "script_manager.hpp"
#include "resources.hpp"
#include "gettext.hpp"
-#include "msg.hpp"
+#include "log.hpp"
#include "mainloop.hpp"
#include "worldmap.hpp"
#include "world.hpp"
#include "script_manager.hpp"
#include "scripting/wrapper_util.hpp"
#include "script_interface.hpp"
-#include "msg.hpp"
+#include "log.hpp"
Sector* Sector::_current = 0;
try {
return create_object(name, reader);
} catch(std::exception& e) {
- msg_warning << e.what() << "" << std::endl;
+ log_warning << e.what() << "" << std::endl;
}
return 0;
fix_old_tiles();
if(!camera) {
- msg_warning << "sector '" << name << "' does not contain a camera." << std::endl;
+ log_warning << "sector '" << name << "' does not contain a camera." << std::endl;
update_game_objects();
add_object(new Camera(this));
}
spawnpoints.push_back(sp);
}
} else {
- msg_warning << "Unknown token '" << iter.item() << "' in reset-points." << std::endl;
+ log_warning << "Unknown token '" << iter.item() << "' in reset-points." << std::endl;
}
}
}
if(object) {
add_object(object);
} else {
- msg_warning << "Unknown object '" << iter.item() << "' in level." << std::endl;
+ log_warning << "Unknown object '" << iter.item() << "' in level." << std::endl;
}
}
}
}
}
if(!sp) {
- msg_warning << "Spawnpoint '" << spawnpoint << "' not found." << std::endl;
+ log_warning << "Spawnpoint '" << spawnpoint << "' not found." << std::endl;
if(spawnpoint != "main") {
activate("main");
} else {
if(solids == 0) {
solids = tilemap;
} else {
- msg_warning << "Another solid tilemaps added. Ignoring" << std::endl;
+ log_warning << "Another solid tilemaps added. Ignoring" << std::endl;
}
}
Camera* camera = dynamic_cast<Camera*> (object);
if(camera) {
if(this->camera != 0) {
- msg_warning << "Multiple cameras added. Ignoring" << std::endl;
+ log_warning << "Multiple cameras added. Ignoring" << std::endl;
return false;
}
this->camera = camera;
Player* player = dynamic_cast<Player*> (object);
if(player) {
if(this->player != 0) {
- msg_warning << "Multiple players added. Ignoring" << std::endl;
+ log_warning << "Multiple players added. Ignoring" << std::endl;
return false;
}
this->player = player;
try {
interface->unexpose(vm, -1);
} catch(std::exception& e) {
- msg_warning << "Couldn't unregister object: " << e.what() << std::endl;
+ log_warning << "Couldn't unregister object: " << e.what() << std::endl;
}
sq_settop(vm, oldtop);
}
#include "spawn_point.hpp"
#include "lisp/lisp.hpp"
#include "lisp/list_iterator.hpp"
-#include "msg.hpp"
+#include "log.hpp"
SpawnPoint::SpawnPoint()
{}
} else if(token == "y") {
iter.value()->get(pos.y);
} else {
- msg_warning << "unknown token '" << token << "' in SpawnPoint" << std::endl;
+ log_warning << "unknown token '" << token << "' in SpawnPoint" << std::endl;
}
}
#include "sprite.hpp"
#include "video/drawing_context.hpp"
-#include "msg.hpp"
+#include "log.hpp"
Sprite::Sprite(SpriteData& newdata)
: data(newdata), frame(0), animation_loops(-1)
SpriteData::Action* newaction = data.get_action(name);
if(!newaction) {
- msg_debug << "Action '" << name << "' not found." << std::endl;
+ log_debug << "Action '" << name << "' not found." << std::endl;
return;
}
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() << std::endl;
+ log_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),
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() << std::endl;
+ log_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),
#include "resources.hpp"
#include "video/drawing_context.hpp"
#include "lisp/list_iterator.hpp"
-#include "msg.hpp"
+#include "log.hpp"
SpriteData::Action::Action()
{
} else if(iter.item() == "action") {
parse_action(iter.lisp(), basedir);
} else {
- msg_warning << "Unknown sprite field: " << iter.item() << std::endl;
+ log_warning << "Unknown sprite field: " << iter.item() << std::endl;
}
}
if(actions.empty())
#include "lisp/parser.hpp"
#include "lisp/list_iterator.hpp"
#include "file_system.hpp"
-#include "msg.hpp"
+#include "log.hpp"
SpriteManager::SpriteManager()
{
#include "textscroller.hpp"
#include <stdexcept>
-#include "msg.hpp"
+#include "log.hpp"
#include "mainloop.hpp"
#include "resources.hpp"
#include "video/font.hpp"
break;
}
default:
- msg_warning << "text contains an unformated line" << std::endl;
+ log_warning << "text contains an unformated line" << std::endl;
font = white_text;
center = false;
break;
}
catch (std::exception& e)
{
- msg_warning << "Could not load scrolling images: " << e.what() << std::endl;
+ log_warning << "Could not load scrolling images: " << e.what() << std::endl;
arrow_scrollup = 0;
arrow_scrolldown = 0;
}
break;
}
default:
- msg_warning << "text contains an unformatted line" << std::endl;
+ log_warning << "text contains an unformatted line" << std::endl;
font = normal_font;
center = false;
break;
#include "timer.hpp"
#include "math/vector.hpp"
#include "video/drawing_context.hpp"
-#include "msg.hpp"
+#include "log.hpp"
Tile::Tile()
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" << std::endl;
+ log_warning << "Expected string or list in images tag" << std::endl;
continue;
}
#include <assert.h>
#include <SDL.h>
#include "video/drawing_context.hpp"
-#include "msg.hpp"
+#include "log.hpp"
#include "lisp/lisp.hpp"
#include "lisp/parser.hpp"
#include "lisp/list_iterator.hpp"
#endif
load_tileset(filename);
#ifdef DEBUG
- msg_debug << "Tiles loaded in " << (SDL_GetTicks() - ticks) / 1000.0 << " seconds" << std::endl;
+ log_debug << "Tiles loaded in " << (SDL_GetTicks() - ticks) / 1000.0 << " seconds" << std::endl;
#endif
}
tiles.push_back(0);
}
if(tiles[tile->id] != 0) {
- msg_warning << "Tile with ID " << tile->id << " redefined" << std::endl;
+ log_warning << "Tile with ID " << tile->id << " redefined" << std::endl;
}
tiles[tile->id] = tile;
} else if(iter.item() == "tilegroup") {
} else if(iter.item() == "properties") {
// deprecated
} else {
- msg_warning << "Unknown symbol '" << iter.item() << "' tile defintion file" << std::endl;
+ log_warning << "Unknown symbol '" << iter.item() << "' tile defintion file" << std::endl;
}
}
}
#include <iostream>
#include <stdint.h>
#include <assert.h>
-#include "msg.hpp"
+#include "log.hpp"
#include "tile.hpp"
struct TileGroup
assert(id < tiles.size());
Tile* tile = tiles[id];
if(!tile) {
- msg_warning << "Invalid tile: " << id << std::endl;
+ log_warning << "Invalid tile: " << id << std::endl;
return tiles[0];
}
#include <errno.h>
#include "tinygettext.hpp"
-#include "msg.hpp"
+#include "log.hpp"
#include "physfs/physfs_stream.hpp"
-#include "msg.hpp"
+#include "log.hpp"
//#define TRANSLATION_DEBUG
out_len -= out_len_temp; // see above
if (retval == (size_t) -1)
{
- msg_warning << strerror(errno) << std::endl;
- msg_warning << "Error: conversion from " << from_charset << " to " << to_charset << " went wrong: " << retval << std::endl;
+ log_warning << strerror(errno) << std::endl;
+ log_warning << "Error: conversion from " << from_charset << " to " << to_charset << " went wrong: " << retval << std::endl;
return "";
}
iconv_close(cd);
}
else // Dictionary for languages lang isn't loaded, so we load it
{
- //msg_debug << "get_dictionary: " << lang << std::endl;
+ //log_debug << "get_dictionary: " << lang << std::endl;
Dictionary& dict = dictionaries[lang];
dict.set_language(get_language_def(lang));
char** files = PHYSFS_enumerateFiles(p->c_str());
if(!files)
{
- msg_warning << "Error: enumerateFiles() failed on " << *p << std::endl;
+ log_warning << "Error: enumerateFiles() failed on " << *p << std::endl;
}
else
{
IFileStream in(pofile);
read_po_file(dict, in);
} catch(std::exception& e) {
- msg_warning << "Error: Failure file opening: " << pofile << std::endl;
- msg_warning << e.what() << "" << std::endl;
+ log_warning << "Error: Failure file opening: " << pofile << std::endl;
+ log_warning << e.what() << "" << std::endl;
}
}
}
char** files = PHYSFS_enumerateFiles(p->c_str());
if (!files)
{
- msg_warning << "Error: opendir() failed on " << *p << std::endl;
+ log_warning << "Error: opendir() failed on " << *p << std::endl;
}
else
{
else
{
#ifdef TRANSLATION_DEBUG
- msg_warning << "Couldn't translate: " << msgid << std::endl;
- msg_warning << "Candidates: " << std::endl;
+ log_warning << "Couldn't translate: " << msgid << std::endl;
+ log_warning << "Candidates: " << std::endl;
for (PluralEntries::iterator i = plural_entries.begin(); i != plural_entries.end(); ++i)
- msg_debug << "'" << i->first << "'" << std::endl;
+ log_debug << "'" << i->first << "'" << std::endl;
#endif
if (plural2_1(num)) // default to english rules
else
{
#ifdef TRANSLATION_DBEUG
- msg_warning << "Couldn't translate: " << msgid << std::endl;
+ log_warning << "Couldn't translate: " << msgid << std::endl;
#endif
return msgid;
}
else
{
#ifdef TRANSLATION_DBEUG
- msg_warning << "Couldn't translate: " << msgid << std::endl;
+ log_warning << "Couldn't translate: " << msgid << std::endl;
#endif
return msgid;
}
if (from_charset.empty() || from_charset == "CHARSET")
{
- msg_warning << "Error: Charset not specified for .po, fallback to ISO-8859-1" << std::endl;
+ log_warning << "Error: Charset not specified for .po, fallback to ISO-8859-1" << std::endl;
from_charset = "ISO-8859-1";
}
}
else if (token.keyword.empty())
{
- //msg_warning << "Got EOF, everything looks ok." << std::endl;
+ //log_warning << "Got EOF, everything looks ok." << std::endl;
}
else
{
- msg_warning << "tinygettext: expected 'msgid' keyword, got " << token.keyword << " at line " << line_num << std::endl;
+ log_warning << "tinygettext: expected 'msgid' keyword, got " << token.keyword << " at line " << line_num << std::endl;
}
break;
}
else
{
- msg_warning << "tinygettext: expected 'msgstr' keyword, got " << token.keyword << " at line " << line_num << std::endl;
+ log_warning << "tinygettext: expected 'msgstr' keyword, got " << token.keyword << " at line " << line_num << std::endl;
}
break;
int num;
if (sscanf(token.keyword.c_str(), "msgstr[%d]", &num) != 1)
{
- msg_warning << "Error: Couldn't parse: " << token.keyword << std::endl;
+ log_warning << "Error: Couldn't parse: " << token.keyword << std::endl;
}
else
{
while((c = getchar(in)) != EOF)
{
- //msg_debug << "Lexing char: " << char(c) << " " << state << std::endl;
+ //log_debug << "Lexing char: " << char(c) << " " << state << std::endl;
switch(state)
{
case READ_KEYWORD:
else if (c == '"') token.content += '"';
else
{
- msg_warning << "Unhandled escape character: " << char(c) << std::endl;
+ log_warning << "Unhandled escape character: " << char(c) << std::endl;
}
}
else
{
- msg_warning << "Unterminated string" << std::endl;
+ log_warning << "Unterminated string" << std::endl;
}
} else if (c == '"') { // Content string is terminated
state = READ_CONTENT;
#include "control/joystickkeyboardcontroller.hpp"
#include "control/codecontroller.hpp"
#include "main.hpp"
-#include "msg.hpp"
+#include "log.hpp"
#include "console.hpp"
void
contrib_worlds.push_back(world.release());
} catch(std::exception& e) {
#ifdef DEBUG
- msg_warning << "Couldn't parse levelset info for '" << *it << "': " << e.what() << std::endl;
+ log_warning << "Couldn't parse levelset info for '" << *it << "': " << e.what() << std::endl;
#endif
}
}
level->get("name", name);
return name;
} catch(std::exception& e) {
- msg_warning << "Problem getting name of '" << filename << "'." << std::endl;
+ log_warning << "Problem getting name of '" << filename << "'." << std::endl;
return "";
}
}
if(confirm_dialog(bkg_title, str.c_str())) {
str = "save/slot" + stream.str() + ".stsg";
- msg_debug << "Removing: " << str << std::endl;
+ log_debug << "Removing: " << str << std::endl;
PHYSFS_delete(str.c_str());
}
current_world->set_savegame_filename(slotfile);
current_world->run();
} catch(std::exception& e) {
- msg_fatal << "Couldn't start world: " << e.what() << std::endl;
+ log_fatal << "Couldn't start world: " << e.what() << std::endl;
}
return true;
+// $Id: main.cpp 3314 2006-04-12 12:36:29Z matzebraun $
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
#ifndef __COLOR_HPP__
#define __COLOR_HPP__
#include <vector>
-#include "msg.hpp"
+#include "log.hpp"
class Color
{
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 << std::endl;
+ log_warning << "color value out of range: " << red << ", " << green << ", " << blue << ", " << alpha << std::endl;
}
float red, green, blue, alpha;
#include "screen.hpp"
#include "font.hpp"
#include "drawing_context.hpp"
-#include "msg.hpp"
+#include "log.hpp"
Font::Font(const std::string& file, const std::string& shadowfile,
int w, int h, int shadowsize)
if(c >= 0x80) {
font_index -= 32;
if(c <= 0xa0) {
- msg_debug << "Unsupported utf-8 character '" << c << "' found" << std::endl;
+ log_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" << std::endl;
+ log_debug << "Unsupported utf-8 character found" << std::endl;
font_index = 0;
}
#include "image_texture.hpp"
#include "glutil.hpp"
#include "file_system.hpp"
-#include "msg.hpp"
+#include "log.hpp"
TextureManager* texture_manager = NULL;
i != image_textures.end(); ++i) {
if(i->second == NULL)
continue;
- msg_warning << "Texture '" << i->first << "' not freed" << std::endl;
+ log_warning << "Texture '" << i->first << "' not freed" << std::endl;
delete i->second;
}
}
#include "script_manager.hpp"
#include "scripting/wrapper_util.hpp"
#include "scripting/serialize.hpp"
-#include "msg.hpp"
+#include "log.hpp"
#include "worldmap.hpp"
#include "mainloop.hpp"
std::string path = basedir + "/";
char** files = PHYSFS_enumerateFiles(path.c_str());
if(!files) {
- msg_warning << "Couldn't read subset dir '" << path << "'" << std::endl;
+ log_warning << "Couldn't read subset dir '" << path << "'" << std::endl;
return;
}
throw std::runtime_error("Couldn't create state table");
sq_pop(vm, 1);
} catch(std::exception& e) {
- msg_debug << "Couldn't load savegame: " << e.what() << std::endl;
+ log_debug << "Couldn't load savegame: " << e.what() << std::endl;
}
}
#include "worldmap.hpp"
#include "gettext.hpp"
-#include "msg.hpp"
+#include "log.hpp"
#include "mainloop.hpp"
#include "video/surface.hpp"
#include "video/screen.hpp"
#include "worldmap.hpp"
#include "resources.hpp"
#include "misc.hpp"
-#include "msg.hpp"
+#include "log.hpp"
#include "world.hpp"
#include "player_status.hpp"
#include "textscroller.hpp"
tux_sprite->set_action(moving ? "small-walking" : "small-stop");
break;
default:
- msg_debug << "Bonus type not handled in worldmap." << std::endl;
+ log_debug << "Bonus type not handled in worldmap." << std::endl;
tux_sprite->set_action("large-stop");
break;
}
if (dir == D_NONE)
{
// Should never be reached if tiledata is good
- msg_warning << "Could not determine where to walk next" << std::endl;
+ log_warning << "Could not determine where to walk next" << std::endl;
stop();
return;
}
}
else
{
- msg_warning << "Tilemap data is buggy" << std::endl;
+ log_warning << "Tilemap data is buggy" << std::endl;
stop();
}
}
} else if(iter.item() == "name") {
// skip
} else {
- msg_warning << "Unknown token '" << iter.item() << "' in worldmap" << std::endl;
+ log_warning << "Unknown token '" << iter.item() << "' in worldmap" << std::endl;
}
}
if(solids == 0)
// 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" << std::endl;
+ log_warning << "level file '" << level.name << "' does not exist and will not be added to the worldmap" << std::endl;
return;
}
level_lisp->get("name", level.title);
} catch(std::exception& e) {
- msg_warning << "Problem when reading leveltitle: " << e.what() << std::endl;
+ log_warning << "Problem when reading leveltitle: " << e.what() << std::endl;
return;
}
}
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() << std::endl;
+ log_fatal << "Couldn't run level-extro-script:" << e.what() << std::endl;
}
*/
}
/* 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 << std::endl;
+ log_warning << "No level to enter at: " << tux->get_tile_pos().x << ", " << tux->get_tile_pos().y << std::endl;
return;
}
ST_GL_LOAD_LEVEL_FILE, &level->statistics);
main_loop->push_screen(session);
} catch(std::exception& e) {
- msg_fatal << "Couldn't load level: " << e.what() << std::endl;
+ log_fatal << "Couldn't load level: " << e.what() << std::endl;
}
}
}
sq_pop(vm, 1);
} catch(std::exception& e) {
- msg_debug << "Not loading worldmap state: " << e.what() << std::endl;
+ log_debug << "Not loading worldmap state: " << e.what() << std::endl;
}
sq_settop(vm, oldtop);
}