Includes cleanup; especially avoid including in headers, creating implicit dependencies and horrible chains of recursive includes. Avoid iostream when possible because this header is not small

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8749 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-05-29 19:52:24 +00:00
parent 8edee23153
commit 6e4cee9341
46 changed files with 56 additions and 67 deletions

View File

@ -24,6 +24,8 @@
#include "utils/string_utils.hpp"
#include "utils/time.hpp"
#include <iostream>
NewsManager *news_manager=NULL;
// ----------------------------------------------------------------------------

View File

@ -20,7 +20,7 @@
#include "audio/music_information.hpp"
#include <stdexcept>
#include <sstream>
#include <iostream>
#include "audio/music_ogg.hpp"
#include "config/user_config.hpp"

View File

@ -21,7 +21,7 @@
#define HEADER_MUSICOGG_HPP
#include <string>
#include <iostream>
#include <ogg/ogg.h>
// Disable warning about potential loss of precision in vorbisfile.h
#if defined(WIN32) && !defined(__CYGWIN__)

View File

@ -43,6 +43,7 @@
#include "race/race_manager.hpp"
#include "utils/constants.hpp"
#include <iostream>
SFXManager* sfx_manager= NULL;
std::map<std::string, SFXBase*> SFXManager::m_quick_sounds;

View File

@ -19,7 +19,7 @@
#include "challenges/challenge.hpp"
#include <iostream>
#include <fstream>
#include "io/xml_node.hpp"
#include "karts/kart_properties_manager.hpp"

View File

@ -173,7 +173,7 @@ void ChallengeData::error(const char *id) const
msg << "Undefined or incorrect value for '" << id
<< "' in challenge file '" << m_filename << "'.";
std::cerr << "ChallengeData : " << msg.str() << std::endl;
printf("ChallengeData : %s\n", msg.str().c_str());
throw std::runtime_error(msg.str());
} // error
@ -254,8 +254,8 @@ void ChallengeData::getUnlocks(const XMLNode *root, const std:: string &type,
const KartProperties* prop = kart_properties_manager->getKart(attrib);
if (prop == NULL)
{
std::cerr << "Challenge refers to kart " << attrib <<
", which is unknown. Ignoring reward.\n";
fprintf(stderr, "Challenge refers to kart %s, which is unknown. Ignoring reward.\n",
attrib.c_str());
break;
}
irr::core::stringw user_name = prop->getName();

View File

@ -23,6 +23,7 @@
#include <string>
#include <vector>
#include <stdio.h>
#include <iostream>
#include "audio/sfx_base.hpp"
#include "audio/sfx_manager.hpp"

View File

@ -21,6 +21,7 @@
#include "config/device_config.hpp"
#include <SKeyMap.h>
using namespace irr;
//==== D E V I C E C O N F I G =================================================

View File

@ -22,11 +22,9 @@
#include "input/binding.hpp"
#include "input/input.hpp"
#include "io/xml_node.hpp"
#include "utils/no_copy.hpp"
#include <fstream>
#include <iostream>
#include <iosfwd>
#include <irrString.h>
#include <string>

View File

@ -19,10 +19,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//#include <stdio.h>
//#include <stdexcept>
//#include <sstream>
#include <iostream>
#include <string>
#include <stdlib.h>
#include <fstream>

View File

@ -85,7 +85,7 @@ void IrrDriver::initDevice()
// ---- the first time, get a list of available video modes
if (firstTime)
{
std::cout << "[IrrDriver] Creating NULL device\n";
printf("[IrrDriver] Creating NULL device\n");
m_device = createDevice(video::EDT_NULL);
video::IVideoModeList* modes = m_device->getVideoModeList();
@ -153,7 +153,7 @@ void IrrDriver::initDevice()
// Try 32 and, upon failure, 24 then 16 bit per pixels
for (int bits=32; bits>15; bits -=8)
{
std::cout << "[IrrDriver] Trying to create device with " << bits << " bits\n";
printf("[IrrDriver] Trying to create device with %i bits\n", bits);
/*
m_device = createDevice(type,
core::dimension2d<u32>(UserConfigParams::m_width,
@ -299,7 +299,7 @@ video::E_DRIVER_TYPE IrrDriver::getEngineDriverType( int index )
}
// Ouput which render will be tried.
std::cout << "[IrrDriver] Trying " << rendererName << " rendering." << std::endl;
printf("[IrrDriver] Trying %s rendering.\n", rendererName.c_str());
return type;
}

View File

@ -21,6 +21,7 @@
#include "graphics/material.hpp"
#include <stdexcept>
#include <iostream>
#include "audio/sfx_base.hpp"
#include "audio/sfx_buffer.hpp"

View File

@ -90,7 +90,7 @@ ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,2
}
else
{
std::cerr << "[ParticleKind] <particles> main node has unknown value for attribute 'emitter'\n";
fprintf(stderr, "[ParticleKind] <particles> main node has unknown value for attribute 'emitter'\n");
m_shape = EMITTER_POINT;
}

View File

@ -19,7 +19,8 @@
#include "guiengine/abstract_state_manager.hpp"
#include <vector>
#include <iostream>
#include "guiengine/engine.hpp"
#include "guiengine/modaldialog.hpp"
#include "guiengine/screen.hpp"

View File

@ -22,7 +22,7 @@
#include "guiengine/widget.hpp"
#include "io/file_manager.hpp"
#include "utils/ptr_vector.hpp"
#include <sstream>
#include <iostream>
#include <IGUIElement.h>

View File

@ -17,6 +17,8 @@
#include "guiengine/event_handler.hpp"
#include <iostream>
#include <IGUIEnvironment.h>
#include <IGUIListBox.h>

View File

@ -17,7 +17,7 @@
#include "guiengine/layout_manager.hpp"
#include <sstream>
#include <iostream>
#include <IGUIFont.h>
#include <ITexture.h>

View File

@ -4,7 +4,6 @@
#include "guiengine/scalable_font.hpp"
#include <iostream>
#include <IGUIEnvironment.h>
#include <IXMLReader.h>
#include <IReadFile.h>
@ -609,7 +608,7 @@ void ScalableFont::draw(const core::stringw& text,
if (texture == NULL)
{
std::cerr << "WARNING: character not found in current font\n";
fprintf(stderr, "WARNING: character not found in current font\n");
continue; // no such character
}
}
@ -687,7 +686,7 @@ void ScalableFont::lazyLoadTexture(int texID)
// couldn't load texture, abort.
if (!SpriteBank->getTexture(texID))
{
std::cerr << "!!!!! Unable to load all textures in the font" << std::endl;
fprintf(stderr, "!!!!! Unable to load all textures in the font\n");
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return;
}

View File

@ -14,7 +14,6 @@
#include "IReadFile.h"
#include "irrArray.h"
#include <map>
#include <iostream>
namespace irr
{

View File

@ -16,11 +16,8 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <iostream>
#include <sstream>
#include <assert.h>
#include "input/input.hpp"
#include "io/file_manager.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/layout_manager.hpp"
@ -29,7 +26,6 @@
#include "guiengine/widget.hpp"
#include "modes/world.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
using namespace irr;
@ -174,7 +170,7 @@ void Screen::addWidgets()
Widget* w = getFirstWidget();
//std::cout << "First widget is " << (w == NULL ? "null" : w->m_properties[PROP_ID].c_str()) << std::endl;
if (w != NULL) w->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
else std::cerr << "Couldn't select first widget, NULL was returned\n";
else fprintf(stderr, "Couldn't select first widget, NULL was returned\n");
} // addWidgets
// -----------------------------------------------------------------------------

View File

@ -23,6 +23,7 @@
#include <IGUIEnvironment.h>
#include <sstream>
#include <iostream>
using namespace GUIEngine;
using namespace irr::core;

View File

@ -22,6 +22,7 @@
#include "io/file_manager.hpp"
#include "utils/translation.hpp"
#include <iostream>
#include <IGUIElement.h>
#include <IGUIEnvironment.h>
#include <IGUIButton.h>

View File

@ -94,8 +94,7 @@ void RibbonWidget::add()
if (m_children[i].m_type != WTYPE_ICON_BUTTON && m_children[i].m_type != WTYPE_BUTTON)
{
std::cerr << "/!\\ Warning /!\\ : ribbon widgets can only have (icon)button widgets as children "
<< std::endl;
fprintf(stderr, "/!\\ Warning /!\\ : ribbon widgets can only have (icon)button widgets as children\n");
continue;
}
@ -218,7 +217,7 @@ void RibbonWidget::add()
}
else
{
std::cerr << "Invalid tab bar contents\n";
fprintf(stderr, "Invalid tab bar contents\n");
}
m_children[i].m_element = subbtn;
@ -289,7 +288,7 @@ void RibbonWidget::add()
}
else
{
std::cerr << "/!\\ Warning /!\\ : Invalid contents type in ribbon" << std::endl;
fprintf(stderr, "/!\\ Warning /!\\ : Invalid contents type in ribbon\n");
}

View File

@ -132,7 +132,7 @@ void GamePadDevice::resetAxisDirection(const int axis,
Kart* pk = player->getKart();
if (pk == NULL)
{
std::cerr << "Error, trying to reset axis for an unknown player\n";
fprintf(stderr, "Error, trying to reset axis for an unknown player\n");
return;
}

View File

@ -2,13 +2,10 @@
#define INPUT_DEVICE_HPP
#include <string>
#include <iostream>
#include <fstream>
#include "config/device_config.hpp"
#include "input/input.hpp"
#include "input/input_manager.hpp"
#include "io/xml_node.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/no_copy.hpp"
/**

View File

@ -22,8 +22,6 @@
#include "items/cake.hpp"
#include <iostream>
#include "io/xml_node.hpp"
#include "karts/kart.hpp"
#include "utils/constants.hpp"

View File

@ -19,10 +19,7 @@
#include "items/powerup_manager.hpp"
#include <iostream>
#include <stdexcept>
#include <sstream>
#include "graphics/irr_driver.hpp"
#include "graphics/material.hpp"
#include "graphics/material_manager.hpp"
@ -149,7 +146,7 @@ void PowerupManager::LoadPowerup(PowerupType type, const XMLNode &node)
#ifdef DEBUG
if (icon_file.size() == 0)
{
std::cerr << "Cannot load powerup " << type << ", no 'icon' attribute under XML node\n";
fprintf(stderr, "Cannot load powerup %i, no 'icon' attribute under XML node\n", type);
assert(false);
}
#endif

View File

@ -23,6 +23,7 @@
#include <ctime>
#include <stdio.h>
#include <stdexcept>
#include <iostream>
#include "challenges/unlock_manager.hpp"
#include "config/stk_config.hpp"

View File

@ -372,7 +372,7 @@ int handleCmdLinePreliminary(int argc, char **argv)
#endif
else if( !strcmp(argv[i], "--renderer") && (i+1 < argc) )
{
std::cout << "You chose renderer " << atoi(argv[i+1]) << std::endl;
printf("You chose renderer %i\n", atoi(argv[i+1]));
UserConfigParams::m_renderer = atoi(argv[i+1]);
i++;
}
@ -912,8 +912,7 @@ int main(int argc, char *argv[] )
{
std::string logoutfile = file_manager->getLogFile("stdout.log");
std::string logerrfile = file_manager->getLogFile("stderr.log");
std::cout << "Error messages and other text output will be logged to " ;
std::cout << logoutfile << " and "<<logerrfile<<"\n";
printf("Error messages and other text output will be logged to %s and %s\n", logoutfile.c_str(), logerrfile.c_str());
if(freopen (logoutfile.c_str(),"w",stdout)!=stdout)
{
fprintf(stderr, "Can not open log file '%s'. Writing to stdout instead.\n",

View File

@ -18,7 +18,7 @@
#include "modes/linear_world.hpp"
#include "states_screens/race_gui_base.hpp"
#include <sstream>
#include <iostream>
#include "audio/music_manager.hpp"
#include "audio/sfx_base.hpp"

View File

@ -234,7 +234,7 @@ Controller* World::loadAIController(Kart *kart)
controller = new NewAIController(kart);
break;
default:
std::cerr << "Warning: Unknown robot, using default." << std::endl;
fprintf(stderr, "Warning: Unknown robot, using default.\n");
controller = new DefaultAIController(kart);
break;
}

View File

@ -19,6 +19,8 @@
#include "race/history.hpp"
#include <iostream>
//-----------------------------------------------------------------------------
void WorldWithRank::init()
{

View File

@ -17,7 +17,7 @@
#include "states_screens/addons_screen.hpp"
#include <sstream>
#include <iostream>
#include "addons/addons_manager.hpp"
#include "addons/network_http.hpp"

View File

@ -28,6 +28,8 @@
#include "tracks/track_manager.hpp"
#include "utils/translation.hpp"
#include <iostream>
using namespace GUIEngine;
using namespace irr::core;
using namespace irr::video;

View File

@ -32,6 +32,7 @@
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
#include <iostream>
#include <fstream>
#include "irrString.h"

View File

@ -88,7 +88,7 @@ bool getWideLine(std::ifstream& file, stringw* out)
{
if (!file.good())
{
std::cerr << "getWideLine : File is not good!\n";
fprintf(stderr, "getWideLine : File is not good!\n");
return false;
}
wchar_t wide_char;

View File

@ -22,7 +22,7 @@
#include "guiengine/widgets/icon_button_widget.hpp"
#include "guiengine/widgets/label_widget.hpp"
#include "io/file_manager.hpp"
#include "network/network_manager.hpp"
//#include "network/network_manager.hpp"
#include "race/grand_prix_manager.hpp"
#include "race/race_manager.hpp"
#include "states_screens/dialogs/gp_info_dialog.hpp"
@ -32,6 +32,7 @@
#include "tracks/track_manager.hpp"
#include "utils/translation.hpp"
#include <iostream>
#include <IGUIEnvironment.h>
#include <IGUIStaticText.h>

View File

@ -89,12 +89,6 @@ GUIEngine::EventPropagation
GUIEngine::RibbonWidget* chocie_ribbon =
getWidget<GUIEngine::RibbonWidget>("choiceribbon");
if (UserConfigParams::m_verbosity>=5)
{
std::cout << "RacePausedDialog::processEvent("
<< eventSource.c_str() << ")\n";
}
if (eventSource == "backbtn")
{
// unpausing is done in the destructor so nothing more to do here
@ -105,10 +99,6 @@ GUIEngine::EventPropagation
{
const std::string& selection =
chocie_ribbon->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if(UserConfigParams::m_verbosity>=5)
std::cout << "RacePausedDialog::processEvent("
<< eventSource.c_str() << " : " << selection << ")\n";
if (selection == "exit")
{

View File

@ -25,7 +25,6 @@
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
#include "io/file_manager.hpp"
#include "items/item_manager.hpp"
#include "karts/kart.hpp"
#include "karts/kart_properties_manager.hpp"
#include "modes/world.hpp"
@ -41,6 +40,8 @@
#include <IMeshSceneNode.h>
#include <ISceneManager.h>
#include <iostream>
using namespace irr::core;
using namespace irr::gui;
using namespace irr::video;

View File

@ -43,6 +43,7 @@
#include "utils/random_generator.hpp"
#include "utils/string_utils.hpp"
#include <iostream>
#include <string>
#include <IGUIEnvironment.h>
#include <IGUIImage.h>

View File

@ -19,7 +19,6 @@
#include "states_screens/main_menu_screen.hpp"
#include <iostream>
#include <string>
#include "addons/network_http.hpp"
@ -389,7 +388,6 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name, cons
}
else if (selection == "addons")
{
std::cout << "Addons" << std::endl;
StateManager::get()->pushScreen(AddonsScreen::getInstance());
}
}

View File

@ -31,6 +31,8 @@
#include "tracks/track_manager.hpp"
#include "utils/translation.hpp"
#include <iostream>
using namespace GUIEngine;
using namespace irr::core;
using namespace irr::video;

View File

@ -481,7 +481,7 @@ void QuadGraph::spatialToTrack(Vec3 *dst, const Vec3& xyz,
{
if(sector == UNKNOWN_SECTOR )
{
std::cerr << "WARNING: UNKNOWN_SECTOR in spatialToTrack().\n";
fprintf(stderr, "WARNING: UNKNOWN_SECTOR in spatialToTrack().\n");
return;
}

View File

@ -18,7 +18,7 @@
#include "tutorial/tutorial_data.hpp"
#include <stdexcept>
#include <sstream>
#include <iostream>
#include "karts/kart.hpp"
#include "karts/kart_properties_manager.hpp"

View File

@ -21,6 +21,7 @@
#include <string>
#include <vector>
#include <stdio.h>
#include <iostream>
#include "audio/sfx_base.hpp"
#include "audio/sfx_manager.hpp"

View File

@ -23,7 +23,6 @@
#define HEADER_PtrVector_HPP
#include <vector>
#include <iostream>
#include <assert.h>
#include "utils/aligned_array.hpp"