Skip to content

Commit

Permalink
Replace cout with SDL_Log
Browse files Browse the repository at this point in the history
  • Loading branch information
kieranmillar committed Nov 25, 2017
1 parent 0615a33 commit 0ae63c6
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/cmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,6 @@ bool Cmp::load( const string &ind_filename, const string &cmp_filename )
animation.push_back(a);
}

cout << "loaded " << animation.size() << " animations from '" << cmp_filename << "'" << endl;
SDL_Log("Loaded %d animations from '%s'\n", animation.size(), cmp_filename.c_str());
return true;
}
2 changes: 1 addition & 1 deletion src/del.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,6 @@ bool Del::load( const string &din_filename, const string &del_filename )
frame.push_back(f);
}

cout << "loaded " << frame.size() << " images from '" << del_filename << "'" << endl;
SDL_Log("Loaded %d images from '%s'\n", frame.size(), del_filename.c_str());
return true;
}
13 changes: 7 additions & 6 deletions src/lem3edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ int main( int argc, char *argv[] )
{
if (g_currentMode == EDITORMODE)
editor.editor_input.handleEvents(event);

}

window.destroy();
Expand Down Expand Up @@ -112,12 +113,12 @@ string l3_filename( const string &path, const string &name, int n, const string

void version(void)
{
cerr << prog_name << " " << prog_ver << " (" << prog_date << ")" << endl;
cerr << "Copyright (C) 2008-2009 Carl Reinke" << endl;
cerr << "Copyright (C) 2017 Kieran Millar" << endl << endl;
cerr << "This is free software. You may redistribute copies of it under the terms of" << endl
<< "the GNU General Public License <http://www.gnu.org/licenses/gpl.html>." << endl
<< "There is NO WARRANTY, to the extent permitted by law." << endl << endl;
SDL_Log("%s %s (%s)\n", prog_name, prog_ver, prog_date);
SDL_Log("Copyright(C) 2008 - 2009 Carl Reinke\n");
SDL_Log("Copyright (C) 2017 Kieran Millar\n");
SDL_Log("This is free software. You may redistribute copies of it under the terms of\n");
SDL_Log("the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.\n");
SDL_Log("There is NO WARRANTY, to the extent permitted by law.\n");
}

void printDebugNumber(int n)
Expand Down
16 changes: 8 additions & 8 deletions src/level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ bool Level::load_level( const string &filename )
ifstream f(filename.c_str(), ios::binary);
if (!f)
{
cerr << "failed to open '" << filename << "'" << endl;
SDL_Log("Failed to open '%s'\n", filename.c_str());
return false;
}

Expand All @@ -153,7 +153,7 @@ bool Level::load_level( const string &filename )
f.read((char *)&release_delay, sizeof(release_delay));
f.read((char *)&enemies, sizeof(enemies));

cout << "loaded level from '" << filename << "'" << endl;
SDL_Log("Loaded level from '%s'\n", filename.c_str());

f.close();
return true;
Expand All @@ -177,7 +177,7 @@ bool Level::load_objects( int type, const string &filename )
ifstream f(filename.c_str(), ios::binary);
if (!f)
{
cerr << "failed to open '" << filename << "'" << endl;
SDL_Log("Failed to open '%s'\n", filename.c_str());
return false;
}

Expand All @@ -195,7 +195,7 @@ bool Level::load_objects( int type, const string &filename )
object[type].push_back(o);
}

cout << "loaded " << object[type].size() << " objects from '" << filename << "'" << endl;
SDL_Log("Loaded %d objects from '%s'\n", object[type].size(), filename.c_str());
f.close();
return true;
}
Expand Down Expand Up @@ -226,7 +226,7 @@ bool Level::save_level(const string &filename)
ofstream f(filename.c_str(), ios::binary | ios::trunc);
if (!f)
{
cerr << "failed to open '" << filename << "'" << endl;
SDL_Log("Failed to open '%s'\n", filename.c_str());
return false;
}

Expand All @@ -247,7 +247,7 @@ bool Level::save_level(const string &filename)
f.write((char *)&release_delay, sizeof(release_delay));
f.write((char *)&enemies, sizeof(enemies));

cout << "wrote level to '" << filename << "'" << endl;
SDL_Log("Wrote level to '%s'\n", filename.c_str());
f.close();
return true;
}
Expand All @@ -268,7 +268,7 @@ bool Level::save_objects(int type, const string &filename)
ofstream f(filename.c_str(), ios::binary | ios::trunc);
if (!f)
{
cerr << "failed to open '" << filename << "'" << endl;
SDL_Log("Failed to open '%s'\n", filename.c_str());
return false;
}

Expand All @@ -284,7 +284,7 @@ bool Level::save_objects(int type, const string &filename)
enemies++;
}

cout << "wrote " << object[type].size() << " objects to '" << filename << "'" << endl;
SDL_Log("Wrote %d objects to '%s'\n", object[type].size(), filename.c_str());
f.close();
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/raw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ bool Raw::load_raw( string raw_filename )

delete[] temp;

cout << "loaded " << frame.size() << " images from '" << raw_filename << "'" << endl;
SDL_Log("Loaded %d images from '%s'\n", frame.size(), raw_filename.c_str());
return true;
}

Expand Down
6 changes: 3 additions & 3 deletions src/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ bool Style::load_objects( int type, const string &obj_filename, const string &fr

}

cout << "loaded " << object[type].size() << " objects from '" << obj_filename << "'" << endl;
SDL_Log("Loaded %d objects from '%s'\n", object[type].size(), obj_filename.c_str());
return true;
}

Expand All @@ -410,7 +410,7 @@ bool Style::load_blocks( int type, const string &blk_filename )
ifstream blk_f(blk_filename.c_str(), ios::binary);
if (!blk_f)
{
cerr << "failed to open '" << blk_filename << "'" << endl;
SDL_Log("Failed to open '%s'\n", blk_filename.c_str());
return false;
}

Expand All @@ -428,7 +428,7 @@ bool Style::load_blocks( int type, const string &blk_filename )
block[type].push_back(b);
}

cout << "loaded " << block[type].size() << " blocks from '" << blk_filename << "'" << endl;
SDL_Log("Loaded %d blocks from '%s'\n", object[type].size(), blk_filename.c_str());
return true;
}

Expand Down

0 comments on commit 0ae63c6

Please sign in to comment.