1) Moved more files around.

2) Replaced many (though not all yet) snprintf with ostringstream
   (getting rid of the maximum length of messages).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@3034 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2009-01-23 05:23:22 +00:00
parent 1f6782b14a
commit 6f34674b4c
72 changed files with 304 additions and 369 deletions

View File

@ -63,12 +63,16 @@ supertuxkart_SOURCES = \
utils/ssg_help.hpp \
utils/string_utils.cpp \
utils/string_utils.hpp \
utils/translation.cpp \
utils/translation.hpp \
utils/vec3.cpp \
utils/vec3.hpp \
material_manager.cpp \
material_manager.hpp \
grand_prix_manager.cpp \
grand_prix_manager.hpp \
graphics/camera.cpp \
graphics/camera.hpp \
graphics/nitro.cpp \
graphics/nitro.hpp \
graphics/moving_texture.hpp \
@ -149,20 +153,14 @@ supertuxkart_SOURCES = \
callback_manager.hpp \
main_loop.cpp \
main_loop.hpp \
camera.cpp \
camera.hpp \
sdldrv.cpp \
sdldrv.hpp \
user_pointer.hpp \
terrain_info.cpp \
terrain_info.hpp \
triangle_mesh.cpp \
triangle_mesh.hpp \
history.cpp \
history.hpp \
no_copy.hpp \
translation.cpp \
translation.hpp \
player.hpp \
challenges/challenge.hpp \
challenges/challenge.cpp \
@ -263,6 +261,8 @@ supertuxkart_SOURCES = \
robots/default_robot.hpp \
robots/track_info.cpp \
robots/track_info.hpp \
tracks/terrain_info.cpp \
tracks/terrain_info.hpp \
tracks/track.cpp \
tracks/track.hpp \
tracks/track_manager.cpp \

View File

@ -20,8 +20,8 @@
#include "audio/music_information.hpp"
#include <stdexcept>
#include <sstream>
#include "translation.hpp"
#include "user_config.hpp"
#include "audio/music_ogg.hpp"
#include "lisp/lisp.hpp"
@ -30,10 +30,6 @@
#include "tracks/track_manager.hpp"
#include "utils/string_utils.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif
MusicInformation::MusicInformation(const std::string& filename)
{
m_title = "";
@ -68,11 +64,10 @@ MusicInformation::MusicInformation(const std::string& filename)
if(!LISP)
{
delete ROOT;
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg),
"Couldn't load music information '%s': no music-information node.",
filename.c_str());
throw std::runtime_error(msg);
std::ostringstream msg;
msg << "Couldn't load music information '" << filename
<< "': no music-information node.";
throw std::runtime_error(msg.str());
}
LISP->get ("title", m_title );
LISP->get ("composer", m_composer );

View File

@ -321,7 +321,7 @@ bool MusicOggStream::check()
if(error != AL_NO_ERROR)
{
fprintf(stderr, "OpenAL error: %d\n", error);
fprintf(stderr, "OpenAL error: %d\n", error);
return false;
}

View File

@ -17,14 +17,11 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <assert.h>
#include <fstream>
#include "audio/sound_manager.hpp"
#include <sstream>
#include <stdexcept>
#include <algorithm>
#if defined(WIN32) && !defined(__CYGWIN__)
# define strcasecmp _strcmpi
# define snprintf _snprintf
#endif
#ifdef __APPLE__
# include <OpenAL/al.h>
@ -34,11 +31,9 @@
# include <AL/alc.h>
#endif
#include "audio/sound_manager.hpp"
#include "audio/sfx_openal.hpp"
#include "user_config.hpp"
#include "file_manager.hpp"
#include "translation.hpp"
#include "race_manager.hpp"
SFXManager* sfx_manager= NULL;
@ -97,18 +92,16 @@ void SFXManager::loadSfx()
catch(std::exception& e)
{
(void)e; // avoid warning about unreferenced local variable
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg),
"Sfx config file '%s' does not exist - aborting.\n",
sfx_config_name.c_str());
throw std::runtime_error(msg);
std::ostringstream msg;
msg << "Sfx config file '" << sfx_config_name
<< "' does not exist - aborting.\n";
throw std::runtime_error(msg.str());
}
const lisp::Lisp* lisp = root->getLisp("sfx-config");
if(!lisp)
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg), "No sfx-config node");
std::string msg="No sfx-config node";
throw std::runtime_error(msg);
}
loadSingleSfx(lisp, "ugh", SOUND_UGH );

View File

@ -22,11 +22,6 @@
#include <assert.h>
#include <fstream>
#if defined(WIN32) && !defined(__CYGWIN__)
# define strcasecmp _strcmpi
# define snprintf _snprintf
#endif
#ifdef __APPLE__
# include <OpenAL/al.h>
# include <OpenAL/alc.h>
@ -37,7 +32,6 @@
#include "user_config.hpp"
#include "file_manager.hpp"
#include "translation.hpp"
#include "audio/music_ogg.hpp"
#include "audio/sfx_openal.hpp"
#include "utils/string_utils.hpp"

View File

@ -17,14 +17,15 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "translation.hpp"
#include "challenges/challenge.hpp"
#include "race_manager.hpp"
#include "grand_prix_manager.hpp"
#include "karts/kart_properties_manager.hpp"
#include "karts/kart_properties.hpp"
#include "tracks/track.hpp"
#include "tracks/track_manager.hpp"
#include "utils/translation.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf

View File

@ -19,8 +19,8 @@
#include "challenges/challenge_data.hpp"
#include <stdexcept>
#include <sstream>
#include "translation.hpp"
#include "grand_prix_data.hpp"
#include "grand_prix_manager.hpp"
#include "karts/kart.hpp"
@ -30,10 +30,6 @@
#include "tracks/track.hpp"
#include "tracks/track_manager.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif
ChallengeData::ChallengeData(const std::string& filename)
{
m_filename = filename;
@ -55,11 +51,9 @@ ChallengeData::ChallengeData(const std::string& filename)
if(!lisp)
{
delete ROOT;
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg),
"Couldn't load challenge '%s': no challenge node.",
filename.c_str());
throw std::runtime_error(msg);
std::ostringstream msg;
msg << "Couldn't load challenge '" << filename << "': no challenge node.";
throw std::runtime_error(msg.str());
}
std::string mode;
@ -137,10 +131,10 @@ ChallengeData::ChallengeData(const std::string& filename)
// ----------------------------------------------------------------------------
void ChallengeData::error(const char *id) const
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg), "Undefined or incorrect value for '%s' in challenge file '%s'.",
id, m_filename.c_str());
throw std::runtime_error(msg);
std::ostringstream msg;
msg << "Undefined or incorrect value for '" << id
<< "' in challenge file '" << m_filename << "'.";
throw std::runtime_error(msg.str());
} // error
// ----------------------------------------------------------------------------
/** Checks if this challenge is valid, i.e. contains a valid track or a valid

View File

@ -44,7 +44,6 @@
#include <plib/ul.h>
#include "btBulletDynamicsCommon.h"
#include "translation.hpp"
#include "material_manager.hpp"
#include "utils/string_utils.hpp"

View File

@ -19,7 +19,6 @@
#include "graphics/moving_texture.hpp"
#include "translation.hpp"
#include "modes/world.hpp"
#include "utils/constants.hpp"
#include "utils/string_utils.hpp"

View File

@ -17,8 +17,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_BASEGUI_H
#define HEADER_BASEGUI_H
#ifndef HEADER_BASE_GUI_HPP
#define HEADER_BASE_GUI_HPP
#include <SDL/SDL.h>
#include "input.hpp"

View File

@ -19,10 +19,10 @@
#include "widget_manager.hpp"
#include "menu_manager.hpp"
#include "translation.hpp"
#include "challenges/unlock_manager.hpp"
#include "gui/challenges_menu.hpp"
#include "network/network_manager.hpp"
#include "utils/translation.hpp"
enum WidgetTokens
{

View File

@ -24,15 +24,15 @@
#include "widget_manager.hpp"
#include "race_manager.hpp"
#include "user_config.hpp"
#include "menu_manager.hpp"
#include "material_manager.hpp"
#include "material.hpp"
#include "translation.hpp"
#include "challenges/unlock_manager.hpp"
#include "gui/menu_manager.hpp"
#include "karts/kart_model.hpp"
#include "karts/kart_properties.hpp"
#include "karts/kart_properties_manager.hpp"
#include "network/network_manager.hpp"
#include "utils/translation.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf

View File

@ -18,13 +18,15 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "config_controls.hpp"
#include "widget_manager.hpp"
#include "menu_manager.hpp"
#include "translation.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "utils/translation.hpp"
enum WidgetTokens
{
WTOK_TITLE,

View File

@ -18,19 +18,19 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "config_display.hpp"
#include <algorithm>
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif
#include "main_loop.hpp"
#include "widget_manager.hpp"
#include "user_config.hpp"
#include "menu_manager.hpp"
#include "sdldrv.hpp"
#include "translation.hpp"
#include "utils/translation.hpp"
#include <algorithm>
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif
enum WidgetTokens
{

View File

@ -17,14 +17,14 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_CONFIGDISPLAY_H
#define HEADER_CONFIGDISPLAY_H
#ifndef HEADER_CONFIG_DISPLAY_HPP
#define HEADER_CONFIG_DISPLAY_HPP
#include <vector>
#include "base_gui.hpp"
#include "translation.hpp"
#include "display_res_confirm.hpp"
#include "gui/base_gui.hpp"
#include "gui/display_res_confirm.hpp"
#include "utils/translation.hpp"
class ConfigDisplay: public BaseGUI
{

View File

@ -17,12 +17,12 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "config_sound.hpp"
#include "widget_manager.hpp"
#include "user_config.hpp"
#include "menu_manager.hpp"
#include "translation.hpp"
#include "gui/config_sound.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "audio/sound_manager.hpp"
#include "utils/translation.hpp"
enum WidgetTokens
{

View File

@ -16,19 +16,21 @@
// 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.
#include "credits_menu.hpp"
#include <fstream>
#include <stdexcept>
#include <iostream>
#include "credits_menu.hpp"
#include "file_manager.hpp"
#include "translation.hpp"
#include "widget_manager.hpp"
#include "menu_manager.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define strdup _strdup
#endif
#include "file_manager.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "utils/translation.hpp"
enum WidgetTokens
{
WTOK_CREDITS,

View File

@ -20,12 +20,12 @@
#include <iostream>
#include <sstream>
#include "display_res_confirm.hpp"
#include "menu_manager.hpp"
#include "widget_manager.hpp"
#include "translation.hpp"
#include "user_config.hpp"
#include "sdldrv.hpp"
#include "gui/display_res_confirm.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "utils/translation.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)

View File

@ -17,12 +17,13 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "widget_manager.hpp"
#include "menu_manager.hpp"
#include "translation.hpp"
#include "challenges/unlock_manager.hpp"
#include "gui/feature_unlocked.hpp"
#include "challenges/unlock_manager.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "utils/translation.hpp"
enum WidgetTokens
{
WTOK_TITLE,

View File

@ -18,14 +18,15 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "game_mode.hpp"
#include "widget_manager.hpp"
#include "race_manager.hpp"
#include "material_manager.hpp"
#include "menu_manager.hpp"
#include "translation.hpp"
#include "user_config.hpp"
#include "challenges/unlock_manager.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "network/network_manager.hpp"
#include "utils/translation.hpp"
enum WidgetTokens
{

View File

@ -17,7 +17,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "grand_prix_ending.hpp"
#include "gui/grand_prix_ending.hpp"
#include <sstream>
#include <string>
@ -28,19 +28,19 @@
#include <SDL/SDL.h>
#include "loader.hpp"
#include "widget_manager.hpp"
#include "race_manager.hpp"
#include "user_config.hpp"
#include "menu_manager.hpp"
#include "translation.hpp"
#include "audio/sfx_manager.hpp"
#include "audio/sfx_base.hpp"
#include "challenges/unlock_manager.hpp"
#include "graphics/scene.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "karts/kart.hpp"
#include "karts/kart_model.hpp"
#include "karts/kart_properties.hpp"
#include "karts/kart_properties_manager.hpp"
#include "utils/translation.hpp"
enum WidgetTokens
{

View File

@ -19,15 +19,15 @@
#include <set>
#include "grand_prix_select.hpp"
#include "widget_manager.hpp"
#include "menu_manager.hpp"
#include "race_manager.hpp"
#include "material_manager.hpp"
#include "translation.hpp"
#include "grand_prix_manager.hpp"
#include "challenges/unlock_manager.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "tracks/track_manager.hpp"
#include "tracks/track.hpp"
#include "utils/translation.hpp"
enum WidgetTokens
{

View File

@ -17,12 +17,13 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "help_page_one.hpp"
#include "widget_manager.hpp"
#include "menu_manager.hpp"
#include "gui/help_page_one.hpp"
#include "user_config.hpp"
#include "translation.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "items/item_manager.hpp"
#include "utils/translation.hpp"
enum WidgetTokens
{

View File

@ -17,11 +17,12 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "help_page_three.hpp"
#include "widget_manager.hpp"
#include "menu_manager.hpp"
#include "translation.hpp"
#include "gui/help_page_three.hpp"
#include "challenges/unlock_manager.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "utils/translation.hpp"
enum WidgetTokens
{

View File

@ -17,11 +17,11 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "help_page_two.hpp"
#include "widget_manager.hpp"
#include "menu_manager.hpp"
#include "gui/help_page_two.hpp"
#include "translation.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "utils/translation.hpp"
enum WidgetTokens
{

View File

@ -17,16 +17,17 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "gui/main_menu.hpp"
#include <SDL/SDL.h>
#include "main_menu.hpp"
#include "widget_manager.hpp"
#include "race_manager.hpp"
#include "menu_manager.hpp"
#include "translation.hpp"
#include "user_config.hpp"
#include "challenges/unlock_manager.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "network/network_manager.hpp"
#include "utils/translation.hpp"
enum WidgetTokens
{

View File

@ -18,18 +18,18 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <sstream>
#include "gui/network_gui.hpp"
#include <sstream>
#include <SDL/SDL.h>
#include "widget_manager.hpp"
#include "network_gui.hpp"
#include "menu_manager.hpp"
#include "translation.hpp"
#include "sdldrv.hpp"
#include "user_config.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "network/network_manager.hpp"
#include "utils/string_utils.hpp"
#include "utils/translation.hpp"
enum WidgetTokens
{

View File

@ -17,12 +17,13 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "gui/num_players.hpp"
#include "race_manager.hpp"
#include "num_players.hpp"
#include "widget_manager.hpp"
#include "menu_manager.hpp"
#include "translation.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "network/network_manager.hpp"
#include "utils/translation.hpp"
enum WidgetTokens
{

View File

@ -17,11 +17,12 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "options.hpp"
#include "widget_manager.hpp"
#include "menu_manager.hpp"
#include "translation.hpp"
#include "gui/options.hpp"
#include "user_config.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "utils/translation.hpp"
enum WidgetTokens
{

View File

@ -17,18 +17,19 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <SDL/SDL.h>
#include "gui/player_controls.hpp"
#include "widget_manager.hpp"
#include "player_controls.hpp"
#include "user_config.hpp"
#include "menu_manager.hpp"
#include "translation.hpp"
#include "sdldrv.hpp"
#include <SDL/SDL.h>
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif
#include "sdldrv.hpp"
#include "user_config.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "utils/translation.hpp"
enum WidgetTokens
{
WTOK_TITLE,
@ -81,6 +82,8 @@ PlayerControls::PlayerControls(int whichPlayer):
m_player_index(whichPlayer),
m_grab_input(false)
{
// This is quite difficult to convert to using ustringstream, since the
// position of %s in the string might vary from language to language.
char heading[MAX_MESSAGE_LENGTH];
snprintf(heading, sizeof(heading), _("Choose your controls, %s"),
user_config->m_player[m_player_index].getName().c_str() );

View File

@ -18,7 +18,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "race_gui.hpp"
#include "gui/race_gui.hpp"
#include "input.hpp"
#include "sdldrv.hpp"
@ -26,18 +26,18 @@
#include "history.hpp"
#include "race_manager.hpp"
#include "material_manager.hpp"
#include "menu_manager.hpp"
#include "audio/sound_manager.hpp"
#include "gui/font.hpp"
#include "gui/menu_manager.hpp"
#include "tracks/track.hpp"
#include "utils/constants.hpp"
#include "utils/translation.hpp"
#undef USE_WIDGET_MANAGER
#ifdef USE_WIDGET_MANAGER
#include "widget_manager.hpp"
#include "gui/widget_manager.hpp"
#endif
#include "translation.hpp"
#include "font.hpp"
#ifdef USE_WIDGET_MANAGER
//MAX_TOP_POS is the maximum number of racers to be shown in the bar to the
@ -757,7 +757,7 @@ void RaceGUI::drawAllMessages(Kart* player_kart, int offset_x, int offset_y,
* certain amount of time (unless time<0, then the message is displayed
* once).
**/
void RaceGUI::addMessage(const char *msg, const Kart *kart, float time,
void RaceGUI::addMessage(const std::string &msg, const Kart *kart, float time,
int font_size, int red, int green, int blue)
{
m_messages.push_back(TimedMessage(msg, kart, time, font_size, red, green, blue));

View File

@ -63,7 +63,7 @@ class RaceGUI: public BaseGUI
// std::vector needs standard copy-ctor and std-assignment op.
// let compiler create defaults .. they'll do the job, no
// deep copies here ..
TimedMessage(const char *message,
TimedMessage(const std::string &message,
const Kart *kart, float time, int size,
int red, int green, int blue)
{
@ -92,7 +92,7 @@ public:
void select() {}
void handle(GameAction, int);
void handleKartAction(KartAction ka, int value);
void addMessage(const char *message, const Kart *kart, float time,
void addMessage(const std::string &m, const Kart *kart, float time,
int fonst_size, int red=255, int green=0, int blue=255);
private:

View File

@ -17,15 +17,16 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "gui/race_menu.hpp"
#include <SDL/SDL.h>
#include "widget_manager.hpp"
#include "user_config.hpp"
#include "race_menu.hpp"
#include "menu_manager.hpp"
#include "race_manager.hpp"
#include "translation.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "utils/translation.hpp"
enum WidgetTokens
{

View File

@ -15,13 +15,14 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "gui/race_options.hpp"
#include "race_manager.hpp"
#include "race_options.hpp"
#include "widget_manager.hpp"
#include "user_config.hpp"
#include "menu_manager.hpp"
#include "material_manager.hpp"
#include "translation.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "utils/translation.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf

View File

@ -17,19 +17,19 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <iostream>
#include "gui/race_results_gui.hpp"
#include <SDL/SDL.h>
#include "race_results_gui.hpp"
#include "widget_manager.hpp"
#include "menu_manager.hpp"
#include "race_manager.hpp"
#include "highscore_manager.hpp"
#include "translation.hpp"
#include "challenges/unlock_manager.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "modes/world.hpp"
#include "karts/kart_properties.hpp"
#include "network/network_manager.hpp"
#include "utils/translation.hpp"
RaceResultsGUI::RaceResultsGUI()
{

View File

@ -15,13 +15,12 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <SDL/SDL.h>
#include "start_race_feedback.hpp"
#include "widget_manager.hpp"
#include "race_manager.hpp"
#include "translation.hpp"
#include "gui/widget_manager.hpp"
#include "network/network_manager.hpp"
#include "utils/translation.hpp"
enum WidgetTokens
{

View File

@ -17,19 +17,18 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "track_sel.hpp"
#include "widget_manager.hpp"
#include "gui/track_sel.hpp"
#include <sstream>
#include "race_manager.hpp"
#include "menu_manager.hpp"
#include "user_config.hpp"
#include "translation.hpp"
#include "challenges/unlock_manager.hpp"
#include "gui/menu_manager.hpp"
#include "gui/widget_manager.hpp"
#include "tracks/track.hpp"
#include "tracks/track_manager.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif
#include "utils/translation.hpp"
enum WidgetTokens
{
@ -245,10 +244,9 @@ void TrackSel::displayImages(int selected_track)
}
else
{
char designedby[MAX_MESSAGE_LENGTH];
snprintf(designedby, MAX_MESSAGE_LENGTH,
"Designed by %s", TRACK->getDesigner().c_str());
widget_manager->setWgtText( WTOK_AUTHOR, designedby );
std::ostringstream designedby;
designedby<<"Designed by "<<TRACK->getDesigner();
widget_manager->setWgtText( WTOK_AUTHOR, designedby.str() );
}
const std::string& screenshot = TRACK->getScreenshotFile();
const std::string& topview = TRACK->getTopviewFile();

View File

@ -25,12 +25,12 @@
#endif
#include "race_manager.hpp"
#include "translation.hpp"
#include "file_manager.hpp"
#include "user_config.hpp"
#include "lisp/parser.hpp"
#include "lisp/writer.hpp"
#include "utils/string_utils.hpp"
#include "utils/translation.hpp"
HighscoreManager* highscore_manager=0;

View File

@ -675,10 +675,6 @@
RelativePath="../../../src\callback_manager.cpp"
>
</File>
<File
RelativePath="../../../src\camera.cpp"
>
</File>
<File
RelativePath="../../../src\explosion.cpp"
>
@ -747,18 +743,6 @@
RelativePath="../../../src\stk_config.cpp"
>
</File>
<File
RelativePath="..\..\terrain_info.cpp"
>
</File>
<File
RelativePath="..\..\translation.cpp"
>
</File>
<File
RelativePath="..\..\triangle_mesh.cpp"
>
</File>
<File
RelativePath="../../../src\user_config.cpp"
>
@ -950,6 +934,10 @@
RelativePath="..\..\utils\string_utils.cpp"
>
</File>
<File
RelativePath="..\..\utils\translation.cpp"
>
</File>
<File
RelativePath="..\..\utils\vec3.cpp"
>
@ -1082,6 +1070,10 @@
RelativePath="..\..\physics\physics.cpp"
>
</File>
<File
RelativePath="..\..\physics\triangle_mesh.cpp"
>
</File>
</Filter>
<Filter
Name="karts"
@ -1114,6 +1106,10 @@
<Filter
Name="graphics"
>
<File
RelativePath="..\..\graphics\camera.cpp"
>
</File>
<File
RelativePath="..\..\graphics\moving_texture.cpp"
>
@ -1186,6 +1182,10 @@
<Filter
Name="tracks"
>
<File
RelativePath="..\..\tracks\terrain_info.cpp"
>
</File>
<File
RelativePath="..\..\tracks\track.cpp"
>
@ -1229,10 +1229,6 @@
RelativePath="../../../src\callback_manager.hpp"
>
</File>
<File
RelativePath="../../../src\camera.hpp"
>
</File>
<File
RelativePath="../../../src\constants.hpp"
>
@ -1333,18 +1329,6 @@
RelativePath="../../../src\stk_config.hpp"
>
</File>
<File
RelativePath="..\..\terrain_info.hpp"
>
</File>
<File
RelativePath="../../../src\translation.hpp"
>
</File>
<File
RelativePath="..\..\triangle_mesh.hpp"
>
</File>
<File
RelativePath="../../../src\user_config.hpp"
>
@ -1632,6 +1616,10 @@
RelativePath="..\..\utils\string_utils.hpp"
>
</File>
<File
RelativePath="..\..\utils\translation.hpp"
>
</File>
<File
RelativePath="..\..\utils\vec3.hpp"
>
@ -1772,6 +1760,10 @@
RelativePath="..\..\physics\physics.hpp"
>
</File>
<File
RelativePath="..\..\physics\triangle_mesh.hpp"
>
</File>
</Filter>
<Filter
Name="karts"
@ -1812,6 +1804,10 @@
<Filter
Name="graphics"
>
<File
RelativePath="..\..\graphics\camera.hpp"
>
</File>
<File
RelativePath="..\..\graphics\moving_texture.hpp"
>
@ -1844,6 +1840,10 @@
<Filter
Name="tracks"
>
<File
RelativePath="..\..\tracks\terrain_info.hpp"
>
</File>
<File
RelativePath="..\..\tracks\track.hpp"
>

View File

@ -17,7 +17,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "camera.hpp"
#include "graphics/camera.hpp"
#include "items/bowling.hpp"
#include "karts/player_kart.hpp"

View File

@ -20,10 +20,10 @@
#ifndef HEADER_FLYABLE_HPP
#define HEADER_FLYABLE_HPP
#include "terrain_info.hpp"
#include "audio/sfx_manager.hpp"
#include "items/powerup_manager.hpp"
#include "karts/moveable.hpp"
#include "tracks/terrain_info.hpp"
class FlyableInfo;
class Kart;

View File

@ -26,16 +26,12 @@
#include "loader.hpp"
#include "material_manager.hpp"
#include "material.hpp"
#include "translation.hpp"
#include "items/item_manager.hpp"
#include "items/bubblegumitem.hpp"
#include "karts/kart.hpp"
#include "network/network_manager.hpp"
#include "utils/string_utils.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif
/** Simple shadow class, only used here for default items. */
class Shadow
{
@ -169,15 +165,14 @@ void ItemManager::setDefaultItemStyle()
DEFAULT_NAMES[ITEM_BUBBLEGUM] = "bubblegum";
bool bError=0;
char msg[MAX_ERROR_MESSAGE_LENGTH];
std::ostringstream msg;
for(int i=ITEM_FIRST+1; i<ITEM_LAST; i++)
{
m_item_model[i] = m_all_models[DEFAULT_NAMES[i]];
if(!m_item_model[i])
{
snprintf(msg, sizeof(msg),
"Item model '%s' is missing (see item_manager)!\n",
DEFAULT_NAMES[i].c_str());
msg << "Item model '" << DEFAULT_NAMES[i]
<< "' is missing (see item_manager)!\n";
bError=1;
break;
} // if !m_item_model
@ -201,7 +196,7 @@ void ItemManager::setDefaultItemStyle()
}
} // if i->second
}
throw std::runtime_error(msg);
throw std::runtime_error(msg.str());
exit(-1);
} // if bError
@ -391,11 +386,10 @@ void ItemManager::loadItemStyle(const std::string filename)
const lisp::Lisp* item_node = root->getLisp("item");
if(!item_node)
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg), "Couldn't load map '%s': no item node.",
filename.c_str());
delete root;
throw std::runtime_error(msg);
std::ostringstream msg;
msg << "Couldn't load map '" << filename << "': no item node.";
delete root;
throw std::runtime_error(msg.str());
delete root;
}
setItem(item_node, "red", ITEM_BONUS_BOX );

View File

@ -19,7 +19,6 @@
#include "items/plunger.hpp"
#include "camera.hpp"
#include "race_manager.hpp"
#include "graphics/scene.hpp"
#include "items/rubber_band.hpp"

View File

@ -17,21 +17,20 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "items/powerup_manager.hpp"
#include <iostream>
#include <stdexcept>
#include "items/powerup_manager.hpp"
#include <sstream>
#include "file_manager.hpp"
#include "material_manager.hpp"
#include "material.hpp"
#include "translation.hpp"
#include "items/bowling.hpp"
#include "items/cake.hpp"
#include "items/plunger.hpp"
#include "loader.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif
typedef struct
{
@ -97,11 +96,10 @@ void PowerupManager::Load(int collectType, const char* filename)
const lisp::Lisp* lisp = ROOT->getLisp("tuxkart-collectable");
if(!lisp)
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg),
"No 'tuxkart-collectable' node found while parsing '%s'.",
filename);
throw std::runtime_error(msg);
std::ostringstream msg;
msg << "No 'tuxkart-collectable' node found while parsing '"
<< filename << "'.";
throw std::runtime_error(msg.str());
}
LoadNode(lisp, collectType);

View File

@ -22,9 +22,6 @@
#include <math.h>
#include <iostream>
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif
#define _WINSOCKAPI_
#include <plib/ssg.h>
@ -34,7 +31,6 @@
#include "items/item_manager.hpp"
#include "file_manager.hpp"
#include "user_config.hpp"
#include "translation.hpp"
#include "material_manager.hpp"
#include "audio/sound_manager.hpp"
#include "audio/sfx_manager.hpp"

View File

@ -25,7 +25,6 @@
#include <plib/sg.h>
#include "btBulletDynamicsCommon.h"
#include "terrain_info.hpp"
#include "items/attachment.hpp"
#include "items/powerup.hpp"
#include "karts/moveable.hpp"
@ -33,6 +32,7 @@
#include "karts/kart_control.hpp"
#include "karts/kart_model.hpp"
#include "physics/btKart.hpp"
#include "tracks/terrain_info.hpp"
class SkidMarks;
class Item;

View File

@ -26,7 +26,6 @@
#include "loader.hpp"
#include "file_manager.hpp"
#include "stk_config.hpp"
#include "translation.hpp"
#include "user_config.hpp"
#include "karts/kart_model.hpp"
#include "lisp/parser.hpp"
@ -34,10 +33,6 @@
#include "utils/ssg_help.hpp"
#include "utils/string_utils.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif
float KartProperties::UNDEFINED = -99.9f;
/** The constructor initialises all values with invalid values. It can later
@ -112,9 +107,9 @@ void KartProperties::load(const std::string &filename, const std::string &node,
const lisp::Lisp* const LISP = root->getLisp(node);
if(!LISP)
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg), "No '%s' node found.", node.c_str());
throw std::runtime_error(msg);
std::ostringstream msg;
msg << "No '" << node << "' node found.";
throw std::runtime_error(msg.str());
}
getAllData(LISP);
}

View File

@ -25,16 +25,11 @@
#include "file_manager.hpp"
#include "stk_config.hpp"
#include "translation.hpp"
#include "user_config.hpp"
#include "challenges/unlock_manager.hpp"
#include "karts/kart_properties.hpp"
#include "utils/string_utils.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif
KartPropertiesManager *kart_properties_manager=0;
KartPropertiesManager::KartPropertiesManager()
@ -129,10 +124,9 @@ const int KartPropertiesManager::getKartId(const std::string &ident) const
return i-m_karts_properties.begin();
}
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg), "KartPropertiesManager: Couldn't find kart: '%s'",
ident.c_str());
throw std::runtime_error(msg);
std::ostringstream msg;
msg << "KartPropertiesManager: Couldn't find kart: '" << ident << "'";
throw std::runtime_error(msg.str());
} // getKartId
//-----------------------------------------------------------------------------

View File

@ -23,16 +23,16 @@
#include "history.hpp"
#include "player.hpp"
#include "sdldrv.hpp"
#include "translation.hpp"
#include "camera.hpp"
#include "audio/sfx_manager.hpp"
#include "audio/sfx_base.hpp"
#include "graphics/camera.hpp"
#include "graphics/scene.hpp"
#include "gui/menu_manager.hpp"
#include "gui/race_gui.hpp"
#include "items/item.hpp"
#include "modes/world.hpp"
#include "utils/constants.hpp"
#include "utils/translation.hpp"
PlayerKart::PlayerKart(const std::string& kart_name, int position, Player *player,
const btTransform& init_pos, int player_index) :

View File

@ -21,11 +21,8 @@
#include <stdexcept>
#include <cstring>
#include "lexer.hpp"
#include "translation.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif
#include "lisp/lexer.hpp"
namespace lisp
{
@ -149,11 +146,10 @@ namespace lisp
}
catch(EOFException& )
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg),
"Parse error in line %d: EOF while parsing string.",
STARTLINE);
throw std::runtime_error(msg);
std::ostringstream msg;
msg << "Parse error in line " << STARTLINE
<< ": EOF while parsing string.";
throw std::runtime_error(msg.str());
}
nextChar();
return TOKEN_STRING;
@ -173,11 +169,10 @@ namespace lisp
}
catch(EOFException& )
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg),
"Parse Error in line %d: EOF while parsing constant.",
m_line_number);
throw std::runtime_error(msg);
std::ostringstream msg;
msg << "Parse Error in line " << m_line_number
<< ": EOF while parsing constant.";
throw std::runtime_error(msg.str());
}
if(strcmp(m_token_string, "t") == 0)
@ -189,11 +184,10 @@ namespace lisp
// constants
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg),
"Parse Error in line %d: Unknown constant '%s'.",
m_line_number, m_token_string);
throw std::runtime_error(msg);
std::ostringstream msg;
msg << "Parse Error in line " << m_line_number
<< ": Unknown constant '" << m_token_string<<"'.";
throw std::runtime_error(msg.str());
}
case '_': // can be begin translation

View File

@ -21,9 +21,10 @@
#include <stdexcept>
#include <fstream>
#include "parser.hpp"
#include "lisp.hpp"
#include "translation.hpp"
#include "lisp/parser.hpp"
#include "lisp/lisp.hpp"
#include "utils/translation.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif

View File

@ -22,11 +22,8 @@
#include <fstream>
#include <sstream>
#include "writer.hpp"
#include "translation.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif
#include "lisp/writer.hpp"
#include "utils/translation.hpp"
namespace lisp
{
@ -45,11 +42,10 @@ namespace lisp
#endif
if(!m_out->good())
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg),
"LispWriter Error: Couldn't open file '%s' for writing.",
filename.c_str());
throw std::runtime_error(msg);
std::ostringstream msg;
msg << "LispWriter Error: Couldn't open file '" << filename
<< "' for writing.";
throw std::runtime_error(msg.str());
}
}

View File

@ -54,7 +54,6 @@
#include "callback_manager.hpp"
#include "history.hpp"
#include "stk_config.hpp"
#include "translation.hpp"
#include "highscore_manager.hpp"
#include "grand_prix_manager.hpp"
#include "audio/sound_manager.hpp"
@ -72,6 +71,7 @@
#include "network/network_manager.hpp"
#include "tracks/track.hpp"
#include "tracks/track_manager.hpp"
#include "utils/translation.hpp"
// Only needed for bullet debug!
#ifdef HAVE_GLUT

View File

@ -20,14 +20,10 @@
#include "material_manager.hpp"
#include <stdexcept>
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
# define strdup _strdup
#endif
#include <sstream>
#include "file_manager.hpp"
#include "material.hpp"
#include "translation.hpp"
#include "utils/string_utils.hpp"
ssgState *fuzzy_gst;
@ -90,15 +86,15 @@ void MaterialManager::addSharedMaterial(const std::string& filename)
// material index later, so that these materials are not popped
if(filename=="")
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg), "FATAL: File '%s' not found\n", filename.c_str());
throw std::runtime_error(msg);
std::ostringstream msg;
msg<<"FATAL: File '"<<filename<<"' not found\n";
throw std::runtime_error(msg.str());
}
if(!pushTempMaterial(filename))
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg), "FATAL: Parsing error in '%s'\n", filename.c_str());
throw std::runtime_error(msg);
std::ostringstream msg;
msg <<"FATAL: Parsing error in '"<<filename<<"'\n";
throw std::runtime_error(msg.str());
}
m_shared_material_index = (int)m_materials.size();
} // addSharedMaterial

View File

@ -17,9 +17,10 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_MATERIALMANAGER_H
#define HEADER_MATERIALMANAGER_H
#ifndef HEADER_MATERIAL_MANAGER_HP
#define HEADER_MATERIAL_MANAGER_HPP
#define _WINSOCKAPI_
#include <plib/ssg.h>
#include <string>
#include <vector>

View File

@ -16,13 +16,13 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "user_config.hpp"
#include "translation.hpp"
#include "audio/sound_manager.hpp"
#include "challenges/unlock_manager.hpp"
#include "gui/menu_manager.hpp"
#include "items/powerup_manager.hpp"
#include "modes/follow_the_leader.hpp"
#include "tracks/track.hpp"
#include "utils/translation.hpp"
//-----------------------------------------------------------------------------
FollowTheLeaderRace::FollowTheLeaderRace() : LinearWorld()

View File

@ -16,18 +16,16 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "modes/linear_world.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif
#include "translation.hpp"
#include <sstream>
#include "audio/sound_manager.hpp"
#include "gui/menu_manager.hpp"
#include "gui/race_gui.hpp"
#include "network/network_manager.hpp"
#include "tracks/track.hpp"
#include "utils/constants.hpp"
#include "utils/translation.hpp"
//-----------------------------------------------------------------------------
LinearWorld::LinearWorld() : World()
@ -291,10 +289,9 @@ void LinearWorld::doLapCounting ( KartInfo& kart_info, Kart* kart )
char s[20];
m->TimeToString(time_per_lap, s);
char m_fastest_lap_message[255];
snprintf(m_fastest_lap_message, sizeof(m_fastest_lap_message),
"%s: %s",s, kart->getName().c_str());
m->addMessage(m_fastest_lap_message, NULL,
std::ostringstream m_fastest_lap_message;
m_fastest_lap_message << s << ": " << kart->getName();
m->addMessage(m_fastest_lap_message.str(), NULL,
2.0f, 40, 100, 210, 100);
} // if m
} // end if new fastest lap

View File

@ -28,13 +28,12 @@
#include "user_config.hpp"
#include "callback_manager.hpp"
#include "history.hpp"
#include "translation.hpp"
#include "highscore_manager.hpp"
#include "camera.hpp"
#include "audio/sound_manager.hpp"
#include "audio/sfx_manager.hpp"
#include "audio/sfx_base.hpp"
#include "challenges/unlock_manager.hpp"
#include "graphics/camera.hpp"
#include "graphics/scene.hpp"
#include "gui/menu_manager.hpp"
#include "items/item_manager.hpp"
@ -49,6 +48,7 @@
#include "tracks/track.hpp"
#include "tracks/track_manager.hpp"
#include "utils/constants.hpp"
#include "utils/translation.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
@ -80,10 +80,9 @@ void World::init()
}
catch(std::runtime_error)
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg),
"Track '%s' not found.\n",race_manager->getTrackName().c_str());
throw std::runtime_error(msg);
std::ostringstream msg;
msg << "Track '" << race_manager->getTrackName() << "' not found.\n";
throw std::runtime_error(msg.str());
}
// Create the physics

View File

@ -22,7 +22,6 @@
#include "stk_config.hpp"
#include "user_config.hpp"
#include "race_manager.hpp"
#include "translation.hpp"
#include "gui/menu_manager.hpp"
#include "gui/char_sel.hpp"
#include "gui/race_results_gui.hpp"

View File

@ -21,13 +21,10 @@
#include <stdexcept>
#include <stdio.h>
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif
#include <sstream>
#include "file_manager.hpp"
#include "lisp/parser.hpp"
#include "translation.hpp"
#include "audio/music_information.hpp"
STKConfig* stk_config=0;
@ -51,9 +48,9 @@ void STKConfig::load(const std::string &filename)
const lisp::Lisp* const LISP = root->getLisp("config");
if(!LISP)
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg), "No 'config' node found.");
throw std::runtime_error(msg);
std::ostringstream msg;
msg<<"No 'config' node found in '"<<filename<<"'.";
throw std::runtime_error(msg.str());
}
getAllData(LISP);
}

View File

@ -28,7 +28,6 @@
#include "file_manager.hpp"
#include "loader.hpp"
#include "stk_config.hpp"
#include "translation.hpp"
#include "material_manager.hpp"
#include "isect.hpp"
#include "user_config.hpp"
@ -40,14 +39,11 @@
#include "lisp/parser.hpp"
#include "modes/world.hpp"
#include "physics/moving_physics.hpp"
#include "physics/triangle_mesh.hpp"
#include "race_manager.hpp"
#include "utils/ssg_help.hpp"
#include "utils/string_utils.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
#endif
const float Track::NOHIT = -99999.9f;
const int Track::QUAD_TRI_NONE = -1;
const int Track::QUAD_TRI_FIRST = 1;
@ -860,11 +856,9 @@ void Track::loadTrack(std::string filename_)
if(!LISP)
{
delete ROOT;
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg),
"Couldn't load map '%s': no tuxkart-track node.",
m_filename.c_str());
throw std::runtime_error(msg);
std::ostringstream msg;
msg <<"Couldn't load map '"<<m_filename<<"': no tuxkart-track node.";
throw std::runtime_error(msg.str());
}
LISP->get ("name", m_name);
@ -1027,9 +1021,9 @@ Track::readDrivelineFromFile(std::vector<Vec3>& line, const std::string& file_ex
if ( fd == NULL )
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf (msg, sizeof(msg), "Can't open '%s' for reading.\n", path.c_str() ) ;
throw std::runtime_error(msg);
std::ostringstream msg;
msg<<"Can't open '"<<path<<"' for reading.\n";
throw std::runtime_error(msg.str());
}
int prev_sector = UNKNOWN_SECTOR;
@ -1050,9 +1044,9 @@ Track::readDrivelineFromFile(std::vector<Vec3>& line, const std::string& file_ex
if (sscanf ( s, "%f,%f,%f", &x, &y, &z ) != 3 )
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf (msg, sizeof(msg), "Syntax error in '%s'\n", path.c_str() ) ;
throw std::runtime_error(msg);
std::ostringstream msg;
msg<<"Syntax error in '"<<path<<"'\n";
throw std::runtime_error(msg.str());
}
Vec3 point(x,y,z);
@ -1195,10 +1189,9 @@ void Track::loadTrackModel()
FILE *fd = fopen (path.c_str(), "r" );
if ( fd == NULL )
{
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg),"Can't open track location file '%s'.\n",
path.c_str());
throw std::runtime_error(msg);
std::ostringstream msg;
msg<<"Can't open track location file '"<<path<<"'.";
throw std::runtime_error(msg.str());
}
// Start building the scene graph
@ -1358,10 +1351,9 @@ void Track::loadTrackModel()
else
{
fclose(fd);
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg), "Syntax error in '%s': %s",
path.c_str(), s);
throw std::runtime_error(msg);
std::ostringstream msg;
msg<< "Syntax error in '"<<path<<"': "<<s;
throw std::runtime_error(msg.str());
}
if ( need_hat )
@ -1390,11 +1382,11 @@ void Track::loadTrackModel()
if(!obj)
{
fclose(fd);
char msg[MAX_ERROR_MESSAGE_LENGTH];
snprintf(msg, sizeof(msg), "Can't open track model '%s'",fname);
std::ostringstream msg;
msg<<"Can't open track model '"<<fname<<"'.";
file_manager->popTextureSearchPath();
file_manager->popModelSearchPath ();
throw std::runtime_error(msg);
throw std::runtime_error(msg.str());
}
SSGHelp::createDisplayLists(obj);
ssgRangeSelector *lod = new ssgRangeSelector ;
@ -1412,12 +1404,8 @@ void Track::loadTrackModel()
}
else
{
// fclose(fd);
// char msg[MAX_ERROR_MESSAGE_LENGTH];
// snprintf(msg, sizeof(msg), "Syntax error in '%s': %s",
fprintf(stderr, "Warning: Syntax error in '%s': %s",
path.c_str(), s);
// throw std::runtime_error(msg);
}
} // while fgets

View File

@ -33,10 +33,11 @@
#include <vector>
#include "LinearMath/btTransform.h"
#include "material.hpp"
#include "triangle_mesh.hpp"
#include "audio/music_information.hpp"
#include "utils/vec3.hpp"
class TriangleMesh;
class Track
{
private:

View File

@ -17,14 +17,16 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "file_manager.hpp"
#include <stdio.h>
#include <stdexcept>
#include <algorithm>
#include "file_manager.hpp"
#include <sstream>
#include "track_manager.hpp"
#include "track.hpp"
#include "stk_config.hpp"
#include "translation.hpp"
#include "audio/sound_manager.hpp"
TrackManager* track_manager = 0;
@ -55,9 +57,9 @@ Track* TrackManager::getTrack(const std::string& ident) const
return *i;
}
char msg[MAX_ERROR_MESSAGE_LENGTH];
sprintf(msg, "TrackManager: Couldn't find track: '%s'", ident.c_str() );
throw std::runtime_error(msg);
std::ostringstream msg;
msg<<"TrackManager: Couldn't find track: '"<<ident<<"'";
throw std::runtime_error(msg.str());
} // getTrack
//-----------------------------------------------------------------------------

View File

@ -42,13 +42,13 @@
#include "stk_config.hpp"
#include "actionmap.hpp"
#include "translation.hpp"
#include "race_manager.hpp"
#include "file_manager.hpp"
#include "challenges/unlock_manager.hpp"
#include "lisp/lisp.hpp"
#include "lisp/parser.hpp"
#include "lisp/writer.hpp"
#include "challenges/unlock_manager.hpp"
#include "utils/translation.hpp"
UserConfig *user_config;