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");
}
} 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;
}
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;
}
}
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;
}
}
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
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();
}
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
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());
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;
}
void
Totem::jump_off() {
if (!carried_by) {
- msg_warning("not carried by anyone");
+ msg_warning << "not carried by anyone" << std::endl;
return;
}
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());
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;
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
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);
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);
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;
}
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;
}
entry = entry->next;
};
- msg_warning("Couldn't find object in cell");
+ msg_warning << "Couldn't find object in cell" << std::endl;
}
entry = 0;
if(start_x >= end_x) {
- msg_debug("bad region");
+ msg_debug << "bad region" << std::endl;
y = 0;
end_y = 0;
return;
// 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
{
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.");
+ msg_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.");
+ msg_warning << "Command \"" << command << "\" not associated with given command receiver. Not dissociated." << std::endl;
return;
}
i->second.erase(j);
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) {
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;
}
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;
}
}
}
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;
}
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);
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;
}
// 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;
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 {
GameSession::consoleCommand(std::string command)
{
if (command == "foo") {
- msg_info("bar");
+ msg_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);
+ msg_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);
+ 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;
}
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);
}
} 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;
}
}
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);
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;
}
}
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;
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();
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;
}
}
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;
}
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
}
//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)
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;
}
}
}
#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
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;
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;
}
#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
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);
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;
}
#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;
}
#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;
}
#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;
}
#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;
}
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;
}
} 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) {
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;
}
}
}
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
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");
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)
}
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();
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;
}
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;
} else if(name == "small") {
font = white_small_text;
} else {
- msg_warning("Unknown font '" << name << "'.");
+ msg_warning << "Unknown font '" << name << "'." << std::endl;
}
}
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)
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);
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);
}
break;
}
if(res == 0) {
- msg_warning("Error seeking in file: " << PHYSFS_getLastError());
+ msg_warning << "Error seeking in file: " << PHYSFS_getLastError() << std::endl;
return -1;
}
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);
} 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;
}
}
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;
}
}
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;
}
}
try {
return create_object(name, reader);
} catch(std::exception& e) {
- msg_warning(e.what() << "");
+ msg_warning << e.what() << "" << std::endl;
}
return 0;
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));
}
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;
}
}
}
if(object) {
add_object(object);
} else {
- msg_warning("Unknown object '" << iter.item() << "' in level.");
+ msg_warning << "Unknown object '" << iter.item() << "' in level." << std::endl;
}
}
}
}
}
if(!sp) {
- msg_warning("Spawnpoint '" << spawnpoint << "' not found.");
+ msg_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");
+ msg_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");
+ msg_warning << "Multiple cameras added. Ignoring" << std::endl;
continue;
}
this->camera = camera;
} 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;
}
}
SpriteData::Action* newaction = data.get_action(name);
if(!newaction) {
- msg_debug("Action '" << name << "' not found.");
+ msg_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());
+ 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),
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),
} 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())
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;
}
break;
}
default:
- msg_warning("text contains an unformated line");
+ msg_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());
+ msg_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");
+ msg_warning << "text contains an unformatted line" << std::endl;
font = normal_font;
center = false;
break;
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;
}
#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
}
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") {
} 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;
}
}
}
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];
}
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);
}
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));
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
{
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;
}
}
}
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
{
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
else
{
#ifdef TRANSLATION_DBEUG
- msg_warning("Couldn't translate: " << msgid);
+ msg_warning << "Couldn't translate: " << msgid << std::endl;
#endif
return msgid;
}
else
{
#ifdef TRANSLATION_DBEUG
- msg_warning("Couldn't translate: " << msgid);
+ msg_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");
+ msg_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.");
+ //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;
}
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;
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
{
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:
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;
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
}
}
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 "";
}
}
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());
}
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;
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;
}
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;
}
}
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;
}
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;
}
}
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;
}
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;
}
}
else
{
- msg_warning("Tilemap data is buggy");
+ msg_warning << "Tilemap data is buggy" << std::endl;
stop();
}
}
} 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)
// 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;
}
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;
}
}
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;
}
}
/* 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;
}
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;
}
}
}
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
}
}
} 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();
}