resolve conflict

This commit is contained in:
konstin 2014-07-23 21:52:53 +02:00
commit eb5e148aa7
61 changed files with 505 additions and 484 deletions

View File

@ -19,6 +19,7 @@
#include <assert.h>
#include "config/device_config.hpp"
#include "utils/log.hpp"
#include <SKeyMap.h>
using namespace irr;
@ -226,7 +227,7 @@ bool DeviceConfig::deserializeAction(irr::io::IrrXMLReader* xml)
// Never hurts to check ;)
if (xml == NULL)
{
fprintf(stderr, "Error: null pointer (DeviceConfig::deserializeAction)\n");
Log::error("DeviceConfig", "Null pointer (DeviceConfig::deserializeAction)");
return false;
}
@ -243,8 +244,8 @@ bool DeviceConfig::deserializeAction(irr::io::IrrXMLReader* xml)
}
if(binding_id==-1)
{
printf("WARNING: DeviceConfig::deserializeAction : action '%s' is unknown\n",
name_string);
Log::warn("DeviceConfig", "DeviceConfig::deserializeAction : action '%s' is unknown.",
name_string);
return false;
}
@ -349,23 +350,15 @@ GamepadConfig::GamepadConfig(irr::io::IrrXMLReader* xml) : DeviceConfig( DEVICE_
{
const char* name_string = xml->getAttributeValue("name");
if(name_string == NULL)
{
printf("ERROR: Unnamed joystick in config file\n");
}
Log::error("DeviceConfig", "Unnamed joystick in config file.");
else
{
m_name = name_string;
}
const char* enabled_string = xml->getAttributeValue("enabled");
if (enabled_string != NULL)
{
m_enabled = (strcmp(enabled_string, "true") == 0);
}
else
{
m_enabled = true;
}
m_plugged = 0;
setDefaultBinds();

View File

@ -713,8 +713,8 @@ bool UserConfig::loadConfig()
// add back the code previously there that upgraded the config file to the new
// format instead of overwriting it.
GUIEngine::showMessage( _("Your config file was too old, so it was deleted and a new one will be created."), 10.0f);
printf("Your config file was too old, so it was deleted and a new one will be created.");
GUIEngine::showMessage(_("Your config file was too old, so it was deleted and a new one will be created."), 10.0f);
Log::info("UserConfig", "Your config file was too old, so it was deleted and a new one will be created.");
delete root;
return false;

View File

@ -205,8 +205,8 @@ void Camera::setupCamera()
break;
default:
if(UserConfigParams::logMisc())
fprintf(stderr, "Incorrect number of players: '%d' - assuming 1.\n",
race_manager->getNumLocalPlayers());
Log::warn("Camera", "Incorrect number of players: '%d' - assuming 1.",
race_manager->getNumLocalPlayers());
m_viewport = core::recti(0, 0,
UserConfigParams::m_width,
UserConfigParams::m_height);

View File

@ -155,10 +155,9 @@ private:
m_type = EC_AHEAD_OF_KART;
else
{
fprintf(stderr,
"Invalid camera type '%s' - camera is ignored.\n",
s.c_str());
return false;
Log::warn("Camera", "Invalid camera type '%s' - camera is ignored.",
s.c_str());
return false;
}
node.get("xyz", &m_position);
node.get("distance", &m_distance2);

View File

@ -239,7 +239,7 @@ bool MaterialManager::pushTempMaterial(const XMLNode *root,
if(!node)
{
// We don't have access to the filename at this stage anymore :(
fprintf(stderr, "Unknown node in material.xml file\n");
Log::warn("MaterialManager", "Unknown node in material.xml file.");
continue;
}
try
@ -249,7 +249,7 @@ bool MaterialManager::pushTempMaterial(const XMLNode *root,
catch(std::exception& e)
{
// The message contains a '%s' for the filename
fprintf(stderr, e.what(), filename.c_str());
Log::warn("MaterialManager", e.what(), filename.c_str());
}
} // for i<xml->getNumNodes)(
return true;

View File

@ -581,7 +581,7 @@ void ParticleEmitter::setParticleType(const ParticleKind* type)
}
default:
{
fprintf(stderr, "[ParticleEmitter] Unknown shape\n");
Log::error("ParticleEmitter", "Unknown shape");
return;
}
}

View File

@ -100,7 +100,7 @@ ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,2
}
else
{
fprintf(stderr, "[ParticleKind] <particles> main node has unknown value for attribute 'emitter'\n");
Log::warn("ParticleKind", "<particles> main node has unknown value for attribute 'emitter'.");
m_shape = EMITTER_POINT;
}
@ -254,8 +254,8 @@ Material* ParticleKind::getMaterial() const
}
else
{
fprintf(stderr, "[ParticleKind] WARNING: particle image '%s' does not appear in the list of "
"currently known materials\n", m_material_file.c_str());
Log::warn("ParticleKind", "Particle image '%s' does not appear in the list of "
"currently known materials.", m_material_file.c_str());
return NULL;
}
}

View File

@ -140,6 +140,9 @@ void AbstractStateManager::pushScreen(Screen* screen)
void AbstractStateManager::replaceTopMostScreen(Screen* screen, GUIEngine::GameState gameState)
{
if (gameState == GUIEngine::CURRENT)
gameState = getGameState();
//assert(m_game_mode != GAME);
// you need to close any dialog before calling this
assert(!ModalDialog::isADialogActive());

View File

@ -40,7 +40,9 @@ namespace GUIEngine
{
MENU,
GAME,
INGAME_MENU
INGAME_MENU,
/** Dummy GameState e. g. for parameters. */
CURRENT = MENU | GAME | INGAME_MENU
}; // GameState
/**
@ -82,7 +84,7 @@ namespace GUIEngine
* without displaying the second-topmost menu of the stack
* in-between)
*/
void replaceTopMostScreen(Screen* screen, GUIEngine::GameState gameState = GUIEngine::MENU);
void replaceTopMostScreen(Screen* screen, GUIEngine::GameState gameState = GUIEngine::CURRENT);
/**
* \brief removes the menu at the top of the screens stack

View File

@ -87,12 +87,9 @@ namespace GUIEngine
Widget* out = getWidget(name);
T* outCasted = dynamic_cast<T*>( out );
if (out != NULL && outCasted == NULL)
{
fprintf(stderr, "Screen::getWidget : Widget '%s' of type '%s'"
"cannot be casted to requested type '%s'!\n", name,
typeid(*out).name(), typeid(T).name());
abort();
}
Log::fatal("Screen::getWidget", "Widget '%s' of type '%s'"
"cannot be casted to requested type '%s'!\n", name,
typeid(*out).name(), typeid(T).name());
return outCasted;
}

View File

@ -608,7 +608,7 @@ EventPropagation EventHandler::onGUIEvent(const SEvent& event)
if (w == NULL) break;
if (!w->m_focusable) return GUIEngine::EVENT_BLOCK;
if (!w->isFocusable() || !w->isActivated()) return GUIEngine::EVENT_BLOCK;
// When a modal dialog is shown, don't select widgets out of the dialog
if (ModalDialog::isADialogActive() && !ModalDialog::getCurrent()->isMyChild(w))

View File

@ -47,7 +47,7 @@ int atoi_p(const char* val)
}
else
{
fprintf(stderr, "[LayoutManager] WARNING: Invalid value '%s' found in XML file where integer was expected\n", val);
Log::warn("LayoutManager", "Invalid value '%s' found in XML file where integer was expected.", val);
return 0;
}
}
@ -461,7 +461,7 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
if (left_space < 0)
{
fprintf(stderr, "[LayoutManager] WARNING: statically sized widgets took all the place!!\n");
Log::warn("LayoutManager", "Statically sized widgets took all the place!!");
left_space = 0;
}
@ -536,9 +536,9 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
if (widgets[n].m_w <= 0)
{
fprintf(stderr, "WARNING: widget '%s' has a width of %i (left_space = %i, "
"fraction = %f, max_width = %s)\n", widgets[n].m_properties[PROP_ID].c_str(),
widgets[n].m_w, left_space, fraction, widgets[n].m_properties[PROP_MAX_WIDTH].c_str());
Log::warn("LayoutManager", "Widget '%s' has a width of %i (left_space = %i, "
"fraction = %f, max_width = %s)", widgets[n].m_properties[PROP_ID].c_str(),
widgets[n].m_w, left_space, fraction, widgets[n].m_properties[PROP_MAX_WIDTH].c_str());
widgets[n].m_w = 1;
}
@ -556,9 +556,9 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
if (widgets[n].m_h <= 0)
{
fprintf(stderr, "WARNING: widget '%s' has a height of %i (left_space = %i, "
"fraction = %f, max_width = %s)\n", widgets[n].m_properties[PROP_ID].c_str(),
widgets[n].m_h, left_space, fraction, widgets[n].m_properties[PROP_MAX_WIDTH].c_str());
Log::warn("LayoutManager", "Widget '%s' has a height of %i (left_space = %i, "
"fraction = %f, max_width = %s)\n", widgets[n].m_properties[PROP_ID].c_str(),
widgets[n].m_h, left_space, fraction, widgets[n].m_properties[PROP_MAX_WIDTH].c_str());
widgets[n].m_h = 1;
}

View File

@ -57,8 +57,7 @@ ScalableFont::ScalableFont(IGUIEnvironment *env, const std::string &filename)
io::IXMLReader* reader = file_manager->createXMLReader(filename.c_str());
if (!load( reader ))
{
fprintf(stderr, "[ScalableFont] Loading font failed\n");
assert(false);
Log::fatal("ScalableFont", "Loading font failed");
}
reader->drop();
@ -157,7 +156,7 @@ void ScalableFont::doReadXmlFile(io::IXMLReader* xml)
#ifdef DEBUG
if (m_texture_files.find(i) != m_texture_files.end())
{
fprintf(stderr, "[ScalableFont] WARNING: Font conflict, two images have texture %i\n", i);
Log::warn("ScalableFont", "Font conflict, two images have texture %i.", i);
}
#endif
@ -258,7 +257,7 @@ bool ScalableFont::load(io::IXMLReader* xml)
{
if (!SpriteBank)
{
fprintf(stderr, "[ScalableFont::load] SpriteBank is NULL!!\n");
Log::error("ScalableFont::load", "SpriteBank is NULL!!");
return false;
}
@ -633,7 +632,7 @@ void ScalableFont::draw(const core::stringw& text,
if (texture == NULL)
{
fprintf(stderr, "WARNING: character not found in current font\n");
Log::warn("ScalableFont", "Character not found in current font");
continue; // no such character
}
}
@ -709,7 +708,7 @@ void ScalableFont::lazyLoadTexture(int texID)
// couldn't load texture, abort.
if (!SpriteBank->getTexture(texID))
{
fprintf(stderr, "!!!!! Unable to load all textures in the font\n");
Log::error("ScalableFont::lazyLoadTexture", "Unable to load all textures in the font");
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return;
}

View File

@ -184,7 +184,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 fprintf(stderr, "Couldn't select first widget, NULL was returned\n");
else Log::warn("Screen::AddWidgets", "Couldn't select first widget, NULL was returned");
} // addWidgets
// -----------------------------------------------------------------------------
@ -206,9 +206,9 @@ void Screen::manualRemoveWidget(Widget* w)
#ifdef DEBUG
if(!m_widgets.contains(w))
{
fprintf(stderr, "Widget '%d' not found in screen when removing.\n",
w->m_id);
fprintf(stderr, "This can be ignored, but is probably wrong.\n");
Log::info("Screen", "Widget '%d' not found in screen when removing.",
w->m_id);
Log::info("Screen", "This can be ignored, but is probably wrong.");
}
#endif
m_widgets.remove(w);

View File

@ -71,7 +71,7 @@ namespace GUIEngine
GAMEPAD_BADGE = 16,
/** A keyboard icon */
KEYBOARD_BADGE = 32,
/** An hourglass badge to indocate loading */
/** An hourglass badge to indicate loading */
LOADING_BADGE = 64
};

View File

@ -189,7 +189,7 @@ void DynamicRibbonWidget::add()
if (m_child_width <= 0 || m_child_height <= 0)
{
std::cerr << "/!\\ Warning /!\\ : ribbon grid widgets require 'child_width' and 'child_height' arguments" << std::endl;
Log::warn("DynamicRibbonWidget", "Ribbon grid widgets require 'child_width' and 'child_height' arguments");
m_child_width = 256;
m_child_height = 256;
}
@ -206,7 +206,7 @@ void DynamicRibbonWidget::add()
if (m_h - m_label_height < 0)
{
fprintf(stderr, "[DynamicRibbonWidget] WARNING: the widget is too small for anything to fit in it!!\n");
Log::warn("DynamicRibbonWidget", "The widget is too small for anything to fit in it!!");
m_row_amount = 1;
}
else

View File

@ -66,13 +66,9 @@ KartStatsWidget::KartStatsWidget(core::recti area, const int player_id,
}
if(!props)
{
fprintf(stderr,
"[KartSelectionScreen] WARNING: Can't find default "
"kart '%s' nor any other kart.\n",
default_kart.c_str());
exit(-1);
}
Log::fatal("KartSelectionScreen", "Can't find default "
"kart '%s' nor any other kart.",
default_kart.c_str());
}

View File

@ -50,6 +50,8 @@ LabelWidget::LabelWidget(bool title, bool bright) : Widget(WTYPE_LABEL)
}
else
m_has_color = false;
setFocusable(false);
} // LabelWidget
// ----------------------------------------------------------------------------

View File

@ -43,6 +43,7 @@ ListWidget::ListWidget() : Widget(WTYPE_LIST)
m_sort_desc = false;
m_sort_default = true;
m_sort_col = 0;
m_sortable = false;
}
// -----------------------------------------------------------------------------
@ -270,9 +271,11 @@ std::string ListWidget::getSelectionInternalName()
CGUISTKListBox* list = getIrrlichtElement<CGUISTKListBox>();
assert(list != NULL);
if (getSelectionID() == -1 || (getSelectionID() >= (int)list->getItemCount()))
int selectionID = getSelectionID();
if (selectionID == -1 || selectionID >= (int)list->getItemCount())
return "";
return list->getItem(getSelectionID()).m_internal_name;
const CGUISTKListBox::ListItem& item = list->getItem(selectionID);
return item.m_internal_name;
}
// -----------------------------------------------------------------------------
@ -418,6 +421,8 @@ EventPropagation ListWidget::transmitEvent(Widget* w,
if (originator.find(m_properties[PROP_ID] + "_column_") != std::string::npos)
{
if (!m_sortable) return EVENT_BLOCK;
if (m_sort_col != originator[(m_properties[PROP_ID] + "_column_").size()] - '0')
{
m_sort_desc = false;

View File

@ -87,6 +87,8 @@ namespace GUIEngine
IListWidgetHeaderListener* m_listener;
bool m_sortable;
public:
typedef irr::gui::CGUISTKListBox::ListItem ListItem;
typedef ListItem::ListCell ListCell;
@ -240,6 +242,8 @@ namespace GUIEngine
void addColumn(irr::core::stringw col, int proportion=1) { m_header.push_back( Column(col, proportion) ); }
void clearColumns() { m_header.clear(); }
void setSortable(bool sortable) { m_sortable = sortable; }
};
}

View File

@ -34,6 +34,7 @@ ProgressBarWidget::ProgressBarWidget(bool show_label) : Widget(WTYPE_PROGRESS)
{
m_value = 0;
m_show_label = show_label;
setFocusable(false);
}
// -----------------------------------------------------------------------------

View File

@ -115,8 +115,8 @@ void RibbonWidget::add()
if (m_active_children[i].m_type != WTYPE_ICON_BUTTON &&
m_active_children[i].m_type != WTYPE_BUTTON)
{
fprintf(stderr, "/!\\ Warning /!\\ : ribbon widgets can only have "
"(icon)button widgets as children\n");
Log::warn("RiggonWidget", "Ribbon widgets can only have "
"(icon)button widgets as children");
continue;
}
@ -275,7 +275,7 @@ void RibbonWidget::add()
}
else
{
fprintf(stderr, "Invalid tab bar contents\n");
Log::error("RibbonWidget", "Invalid tab bar contents");
}
m_active_children[i].m_element = subbtn;
@ -375,8 +375,7 @@ void RibbonWidget::add()
}
else
{
fprintf(stderr,
"/!\\ Warning /!\\ : Invalid contents type in ribbon\n");
Log::warn("RiggonWidget", "Invalid contents type in ribbon");
}

View File

@ -51,7 +51,7 @@ bool Binding::deserialize(irr::io::IrrXMLReader* xml)
// Proceed only if neccesary tags were found
if ((id_string == NULL) || (event_string == NULL))
{
printf("No id-string or event-string given - ignored.\n");
Log::warn("Binding", "No id-string or event-string given - ignored.");
return false;
}
@ -66,7 +66,7 @@ bool Binding::deserialize(irr::io::IrrXMLReader* xml)
// If the action is a stick motion & a direction is defined
if (dir_string == NULL)
{
printf("WARNING: IT_STICKMOTION without direction, ignoring.\n");
Log::warn("Binding", "IT_STICKMOTION without direction, ignoring.");
return false;
}

View File

@ -156,7 +156,7 @@ void GamePadDevice::resetAxisDirection(const int axis,
AbstractKart* pk = player->getKart();
if (pk == NULL)
{
fprintf(stderr, "Error, trying to reset axis for an unknown player\n");
Log::error("Binding", "Trying to reset axis for an unknown player.");
return;
}

View File

@ -118,7 +118,7 @@ void GetPublicAddress::asynchronousUpdate()
hints.ai_socktype = SOCK_STREAM;
if ((status = getaddrinfo(stun_servers[rand_result].c_str(), NULL, &hints, &res)) != 0) {
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(status));
Log::error("getaddrinfo", gai_strerror(status));
return;
}
for(p = res;p != NULL; p = p->ai_next)

View File

@ -238,10 +238,7 @@ void PhysicalObject::init()
}
else
{
fprintf(stderr, "[PhysicalObject] Unknown node type\n");
max = 1.0f;
min = 0.0f;
assert(false);
Log::fatal("PhysicalObject", "Unknown node type");
}
}
else if (dynamic_cast<TrackObjectPresentationInstancing*>(presentation) != NULL)
@ -256,10 +253,7 @@ void PhysicalObject::init()
}
else
{
fprintf(stderr, "[PhysicalObject] Unknown node type\n");
max = 1.0f;
min = 0.0f;
assert(false);
Log::fatal("PhysicalObject", "Unknown node type");
}
Vec3 extend = max-min;
// Adjust the mesth of the graphical object so that its center is where it
@ -453,7 +447,7 @@ void PhysicalObject::init()
}
case MP_NONE:
default:
fprintf(stderr, "WARNING: Uninitialised moving shape\n");
Log::warn("PhysicalObject", "Uninitialised moving shape");
// intended fall-through
case MP_BOX:
{

View File

@ -112,7 +112,7 @@ void TriangleMesh::createCollisionShape(bool create_collision_object, const char
btOptimizedBvh* bhv = btOptimizedBvh::deSerializeInPlace(bytes, pos, !IS_LITTLE_ENDIAN);
if (bhv == NULL)
{
fprintf(stderr, "[TriangleMesh] WARNING, failed to load serialized BHV\n");
Log::warn("TriangleMesh", "Failed to load serialized BHV");
bhv_triangle_mesh = new btBvhTriangleMeshShape(&m_mesh, false /* useQuantizedAabbCompression */);
}
else

View File

@ -212,10 +212,10 @@ void Highscores::getEntry(int number, std::string &kart_name,
{
if(number<0 || number>getNumberEntries())
{
fprintf(stderr, "Error, accessing undefined highscore entry:\n");
fprintf(stderr,"number %d, but %d entries are defined\n",number,
getNumberEntries());
fprintf(stderr, "This error can be ignored, but no highscores are available\n");
Log::warn("Highscores", "Accessing undefined highscore entry:");
Log::warn("Highscores", "Number %d, but %d entries are defined.", number,
getNumberEntries());
Log::warn("Highscores", "This error can be ignored, but no highscores are available.");
return;
}
kart_name = m_kart_name[number];

View File

@ -127,7 +127,7 @@ void History::updateReplay(float dt)
World *world = World::getWorld();
if(m_current>=(int)m_all_deltas.size())
{
printf("Replay finished.\n");
Log::info("History", "Replay finished");
m_current = 0;
// Note that for physics replay all physics parameters
// need to be reset, e.g. velocity, ...
@ -158,20 +158,19 @@ void History::Save()
{
FILE *fd = fopen("history.dat","w");
if(fd)
printf("History saved in ./history.dat.\n");
Log::info("History", "Saved in ./history.dat.");
else
{
std::string fn = file_manager->getUserConfigFile("history.dat");
fd = fopen(fn.c_str(), "w");
if(fd)
printf("History saved in '%s'.\n",fn.c_str());
Log::info("History", "Saved in '%s'.", fn.c_str());
}
if(!fd)
{
printf("Can't open history.dat file for writing - can't save history.\n");
printf("Make sure history.dat in the current directory or the config\n");
printf("directory is writable.\n");
Log::info("History", "Can't open history.dat file for writing - can't save history.");
Log::info("History", "Make sure history.dat in the current directory "
"or the config directory is writable.");
return;
}
@ -231,75 +230,46 @@ void History::Load()
FILE *fd = fopen("history.dat","r");
if(fd)
printf("Reading ./history.dat\n");
Log::info("History", "Reading ./history.dat");
else
{
std::string fn = file_manager->getUserConfigFile("history.dat");
fd = fopen(fn.c_str(), "r");
if(fd)
printf("Reading '%s'.\n", fn.c_str());
Log::info("History", "Reading '%s'.", fn.c_str());
}
if(!fd)
{
fprintf(stderr, "ERROR: could not open history.dat\n");
exit(-2);
}
Log::fatal("History", "Could not open history.dat");
if (fgets(s, 1023, fd) == NULL)
{
fprintf(stderr, "ERROR: could not read history.dat\n");
exit(-2);
}
Log::fatal("History", "Could not read history.dat.");
if (sscanf(s,"Version: %1023s",s1)!=1)
{
fprintf(stderr, "ERROR: no Version information found in history file (bogus history file)\n");
exit(-2);
}
else
{
if (strcmp(s1,STK_VERSION))
{
fprintf(stderr, "WARNING: history is version '%s'\n",s1);
fprintf(stderr, " STK version is '%s'\n",STK_VERSION);
}
}
Log::fatal("History", "No Version information found in history file (bogus history file).");
else if (strcmp(s1,STK_VERSION))
Log::warn("History", "History is version '%s', STK version is '%s'.", s1, STK_VERSION);
if (fgets(s, 1023, fd) == NULL)
{
fprintf(stderr, "ERROR: could not read history.dat\n");
exit(-2);
}
Log::fatal("History", "Could not read history.dat.");
unsigned int num_karts;
if(sscanf(s, "numkarts: %d",&num_karts)!=1)
{
fprintf(stderr,"WARNING: No number of karts found in history file.\n");
exit(-2);
}
Log::fatal("History", "No number of karts found in history file.");
race_manager->setNumKarts(num_karts);
fgets(s, 1023, fd);
if(sscanf(s, "numplayers: %d",&n)!=1)
{
fprintf(stderr,"WARNING: No number of players found in history file.\n");
exit(-2);
}
Log::fatal("History", "No number of players found in history file.");
race_manager->setNumLocalPlayers(n);
fgets(s, 1023, fd);
if(sscanf(s, "difficulty: %d",&n)!=1)
{
fprintf(stderr,"WARNING: No difficulty found in history file.\n");
exit(-2);
}
Log::fatal("History", "No difficulty found in history file.");
race_manager->setDifficulty((RaceManager::Difficulty)n);
fgets(s, 1023, fd);
if(sscanf(s, "track: %1023s",s1)!=1)
{
fprintf(stderr,"WARNING: Track not found in history file.\n");
}
Log::warn("History", "Track not found in history file.");
race_manager->setTrack(s1);
// This value doesn't really matter, but should be defined, otherwise
// the racing phase can switch to 'ending'
@ -308,12 +278,8 @@ void History::Load()
for(unsigned int i=0; i<num_karts; i++)
{
fgets(s, 1023, fd);
if(sscanf(s, "model %d: %1023s",&n, s1)!=2)
{
fprintf(stderr,"WARNING: No model information for kart %d found.\n",
i);
exit(-2);
}
if(sscanf(s, "model %d: %1023s",&n, s1) != 2)
Log::fatal("History", "No model information for kart %d found.", i);
m_kart_ident.push_back(s1);
if(i<race_manager->getNumPlayers())
{
@ -323,10 +289,8 @@ void History::Load()
// FIXME: The model information is currently ignored
fgets(s, 1023, fd);
if(sscanf(s,"size: %d",&m_size)!=1)
{
fprintf(stderr,"WARNING: Number of records not found in history file.\n");
exit(-2);
}
Log::fatal("History", "Number of records not found in history file.");
allocateMemory(m_size);
m_current = -1;

View File

@ -88,70 +88,51 @@ void ReplayPlay::Load()
FILE *fd = openReplayFile(/*writeable*/false);
if(!fd)
{
printf("Can't read '%s', ghost replay disabled.\n",
Log::error("Replay", "Can't read '%s', ghost replay disabled.",
getReplayFilename().c_str());
destroy();
return;
}
printf("Reading replay file '%s'.\n", getReplayFilename().c_str());
Log::info("Replay", "Reading replay file '%s'.", getReplayFilename().c_str());
if (fgets(s, 1023, fd) == NULL)
{
fprintf(stderr, "ERROR: could not read '%s'.\n",
getReplayFilename().c_str());
exit(-2);
}
Log::fatal("Replay", "Could not read '%s'.", getReplayFilename().c_str());
unsigned int version;
if (sscanf(s,"Version: %d", &version)!=1)
{
fprintf(stderr, "ERROR: no Version information found in replay file"
" (bogus replay file)\n");
exit(-2);
}
if (sscanf(s,"Version: %d", &version) != 1)
Log::fatal("Replay", "No Version information found in replay file (bogus replay file).");
if (version!=getReplayVersion())
if (version != getReplayVersion())
{
fprintf(stderr, "WARNING: replay is version '%d'\n",version);
fprintf(stderr, " STK version is '%d'\n",getReplayVersion());
fprintf(stderr, " We try to proceed, but it may fail.\n");
Log::warn("Replay", "Replay is version '%d'",version);
Log::warn("Replay", "STK version is '%d'",getReplayVersion());
Log::warn("Replay", "We try to proceed, but it may fail.");
}
if (fgets(s, 1023, fd) == NULL)
{
fprintf(stderr, "ERROR: could not read '%s'.\n",
getReplayFilename().c_str());
exit(-2);
}
Log::fatal("Replay", "Could not read '%s'.", getReplayFilename().c_str());
int n;
if(sscanf(s, "difficulty: %d",&n)!=1)
{
fprintf(stderr,"WARNING: No difficulty found in replay file.\n");
exit(-2);
}
if(sscanf(s, "difficulty: %d", &n) != 1)
Log::fatal("Replay", " No difficulty found in replay file.");
if(race_manager->getDifficulty()!=(RaceManager::Difficulty)n)
printf("Warning, difficulty of replay is '%d', "
"while '%d' is selected.\n",
race_manager->getDifficulty(), n);
Log::warn("Replay", "Difficulty of replay is '%d', "
"while '%d' is selected.",
race_manager->getDifficulty(), n);
fgets(s, 1023, fd);
if(sscanf(s, "track: %s",s1)!=1)
{
fprintf(stderr,"WARNING: Track not found in replay file.\n");
}
if(sscanf(s, "track: %s", s1) != 1)
Log::warn("Replay", "Track not found in replay file.");
assert(std::string(s1)==race_manager->getTrackName());
race_manager->setTrack(s1);
unsigned int num_laps;
fgets(s, 1023, fd);
if(sscanf(s, "Laps: %d",&num_laps)!=1)
{
fprintf(stderr,"WARNING: No number of laps found in replay file.\n");
exit(-2);
}
if(sscanf(s, "Laps: %d", &num_laps) != 1)
Log::fatal("Replay", "No number of laps found in replay file.");
race_manager->setNumLaps(num_laps);
// eof actually doesn't trigger here, since it requires first to try
@ -175,25 +156,18 @@ void ReplayPlay::readKartData(FILE *fd, char *next_line)
{
char s[1024];
if(sscanf(next_line, "model: %s", s)!=1)
{
fprintf(stderr,
"WARNING: No model information for kart %d found.\n",
Log::fatal("Replay", "No model information for kart %d found.",
m_ghost_karts.size());
exit(-2);
}
m_ghost_karts.push_back(new GhostKart(std::string(s)));
m_ghost_karts[m_ghost_karts.size()-1].init(RaceManager::KT_GHOST);
fgets(s, 1023, fd);
unsigned int size;
if(sscanf(s,"size: %d",&size)!=1)
{
fprintf(stderr,
"WARNING: Number of records not found in replay file "
"for kart %d.\n",
Log::fatal("Replay", "Number of records not found in replay file "
"for kart %d.",
m_ghost_karts.size()-1);
exit(-2);
}
for(unsigned int i=0; i<size; i++)
{
@ -217,20 +191,17 @@ void ReplayPlay::readKartData(FILE *fd, char *next_line)
{
// Invalid record found
// ---------------------
fprintf(stderr, "Can't read replay data line %d:\n", i);
fprintf(stderr, "%s", s);
fprintf(stderr, "Ignored.\n");
Log::warn("Replay", "Can't read replay data line %d:", i);
Log::warn("Replay", "%s", s);
Log::warn("Replay", "Ignored.");
}
} // for i
fgets(s, 1023, fd);
unsigned int num_events;
if(sscanf(s,"events: %d",&num_events)!=1)
{
fprintf(stderr,
"WARNING: Number of events not found in replay file "
"for kart %d.\n",
m_ghost_karts.size()-1);
}
Log::warn("Replay", "Number of events not found in replay file "
"for kart %d.", m_ghost_karts.size()-1);
for(unsigned int i=0; i<num_events; i++)
{
fgets(s, 1023, fd);
@ -245,9 +216,9 @@ void ReplayPlay::readKartData(FILE *fd, char *next_line)
{
// Invalid record found
// ---------------------
fprintf(stderr, "Can't read replay event line %d:\n", i);
fprintf(stderr, "%s", s);
fprintf(stderr, "Ignored.\n");
Log::warn("Replay", "Can't read replay event line %d:", i);
Log::warn("Replay", "%s", s);
Log::warn("Replay", "Ignored.");
}
} // for i < events

View File

@ -130,8 +130,12 @@ void ReplayRecorder::update(float dt)
{
// Only print this message once.
if(m_count_transforms[i]==m_transform_events[i].size())
printf("Can't store more events for kart %s.\n",
{
char buffer[100];
sprintf(buffer, "Can't store more events for kart %s.",
kart->getIdent().c_str());
Log::warn("ReplayRecorder", buffer);
}
continue;
}
TransformEvent *p = &(m_transform_events[i][m_count_transforms[i]-1]);
@ -153,12 +157,12 @@ void ReplayRecorder::Save()
FILE *fd = openReplayFile(/*writeable*/true);
if(!fd)
{
printf("Can't open '%s' for writing - can't save replay data.\n",
getReplayFilename().c_str());
Log::error("ReplayRecorder", "Can't open '%s' for writing - can't save replay data.",
getReplayFilename().c_str());
return;
}
printf("Replay saved in '%s'.\n", getReplayFilename().c_str());
Log::info("ReplayRecorder", "Replay saved in '%s'.\n", getReplayFilename().c_str());
World *world = World::getWorld();
unsigned int num_karts = world->getNumKarts();

View File

@ -85,7 +85,7 @@ bool CreditsScreen::getWideLine(std::ifstream& file, core::stringw* out)
{
if (!file.good())
{
fprintf(stderr, "getWideLine : File is not good!\n");
Log::error("CreditsScreen", "getWideLine: File is not good!");
return false;
}
wchar_t wide_char;
@ -147,8 +147,8 @@ void CreditsScreen::loadedFromFile()
if (file.fail() || !file.is_open() || file.eof())
{
fprintf(stderr, "\n/!\\ Failed to open file at '%s'\n\n",
creditsfile.c_str());
Log::error("CreditsScreen", "Failed to open file at '%s'.",
creditsfile.c_str());
return;
}
@ -160,10 +160,8 @@ void CreditsScreen::loadedFromFile()
if (file.fail() || !file.is_open() || file.eof())
{
fprintf(stderr,
"\n/!\\ Failed to read file at '%s', unexpected EOF\n\n",
creditsfile.c_str());
assert(false);
Log::error("CreditsScreen", "Failed to read file at '%s', unexpected EOF.",
creditsfile.c_str());
return;
}
@ -203,9 +201,7 @@ void CreditsScreen::loadedFromFile()
if (lineCount == 0)
{
fprintf(stderr,
"\n/!\\ Could not read anything from CREDITS file!\n\n");
assert(false);
Log::error("CreditsScreen", "Could not read anything from CREDITS file!");
return;
}

View File

@ -384,11 +384,10 @@ void AddonsLoading::doUninstall()
error = !addons_manager->uninstall(m_addon);
if(error)
{
printf("[addons]Directory '%s' can not be removed.\n",
m_addon.getDataDir().c_str());
printf("[addons]Please remove this directory manually.\n");
core::stringw msg = StringUtils::insertValues(
_("Problems removing the addon '%s'."),
Log::warn("Addons", "Directory '%s' can not be removed.",
m_addon.getDataDir().c_str());
Log::warn("Addons", "Please remove this directory manually.");
core::stringw msg = StringUtils::insertValues(_("Problems removing the addon '%s'."),
core::stringw(m_addon.getName().c_str()));
getWidget<BubbleWidget>("description")->setText(msg.c_str());
}

View File

@ -213,7 +213,7 @@ void GrandPrixLose::setKarts(std::vector<std::string> ident_arg)
Log::warn("GrandPrixLose", "A kart named '%s' could not be found\n",
ident_arg[n].c_str());
m_kart_node[n] = NULL;
}// if kart !=NULL
} // if kart != NULL
}
} // setKarts

View File

@ -71,8 +71,8 @@ void HelpScreen1::eventCallback(Widget* widget, const std::string& name, const i
if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL)
{
fprintf(stderr, "[MainMenuScreen] WARNING: cannot find kart '%s', will revert to default\n",
UserConfigParams::m_default_kart.c_str());
Log::warn("HelpScreen1", "Cannot find kart '%s', will revert to default",
UserConfigParams::m_default_kart.c_str());
UserConfigParams::m_default_kart.revertToDefaults();
}
race_manager->setLocalKartInfo(0, UserConfigParams::m_default_kart);
@ -89,13 +89,19 @@ void HelpScreen1::eventCallback(Widget* widget, const std::string& name, const i
}
else if (name == "category")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
//if (selection == "page1") StateManager::get()->replaceTopMostScreen(Help1Screen::getInstance());
//else
if (selection == "page2") StateManager::get()->replaceTopMostScreen(HelpScreen2::getInstance());
else if (selection == "page3") StateManager::get()->replaceTopMostScreen(HelpScreen3::getInstance());
else if (selection == "page4") StateManager::get()->replaceTopMostScreen(HelpScreen4::getInstance());
Screen *screen = NULL;
//if (selection == "page1")
// screen = HelpScreen1::getInstance();
if (selection == "page2")
screen = HelpScreen2::getInstance();
else if (selection == "page3")
screen = HelpScreen3::getInstance();
else if (selection == "page4")
screen = HelpScreen4::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}
else if (name == "back")
{

View File

@ -46,12 +46,19 @@ void HelpScreen2::eventCallback(Widget* widget, const std::string& name, const i
{
if (name == "category")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if(selection == "page1") StateManager::get()->replaceTopMostScreen(HelpScreen1::getInstance());
//else if(selection == "page2") StateManager::get()->replaceTopMostScreen(HelpScreen2::getInstance());
else if(selection == "page3") StateManager::get()->replaceTopMostScreen(HelpScreen3::getInstance());
else if(selection == "page4") StateManager::get()->replaceTopMostScreen(HelpScreen4::getInstance());
Screen *screen = NULL;
if (selection == "page1")
screen = HelpScreen1::getInstance();
//else if (selection == "page2")
// screen = HelpScreen2::getInstance();
else if (selection == "page3")
screen = HelpScreen3::getInstance();
else if (selection == "page4")
screen = HelpScreen4::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}
else if (name == "back")
{

View File

@ -47,12 +47,20 @@ void HelpScreen3::eventCallback(Widget* widget, const std::string& name, const i
{
if (name == "category")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selection == "page1") StateManager::get()->replaceTopMostScreen(HelpScreen1::getInstance());
else if (selection == "page2") StateManager::get()->replaceTopMostScreen(HelpScreen2::getInstance());
//else if(selection == "page3") StateManager::get()->replaceTopMostScreen(Help3Screen::getInstance());
else if(selection == "page4") StateManager::get()->replaceTopMostScreen(HelpScreen4::getInstance());
Screen *screen = NULL;
if (selection == "page1")
screen = HelpScreen1::getInstance();
else if (selection == "page2")
screen = HelpScreen2::getInstance();
//else if (selection == "page3")
// screen = HelpScreen3::getInstance();
else if (selection == "page4")
screen = HelpScreen4::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}
else if (name == "back")
{

View File

@ -47,11 +47,20 @@ void HelpScreen4::eventCallback(Widget* widget, const std::string& name, const i
{
if (name == "category")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selection == "page1") StateManager::get()->replaceTopMostScreen(HelpScreen1::getInstance());
else if (selection == "page2") StateManager::get()->replaceTopMostScreen(HelpScreen2::getInstance());
else if(selection == "page3") StateManager::get()->replaceTopMostScreen(HelpScreen3::getInstance());
Screen *screen = NULL;
if (selection == "page1")
screen = HelpScreen1::getInstance();
else if (selection == "page2")
screen = HelpScreen2::getInstance();
else if (selection == "page3")
screen = HelpScreen3::getInstance();
//else if (selection == "page4")
// screen = HelpScreen4::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}
else if (name == "back")
{

View File

@ -331,13 +331,9 @@ PlayerKartWidget::PlayerKartWidget(KartSelectionScreen* parent,
}
if(!props)
{
fprintf(stderr,
"[KartSelectionScreen] WARNING: Can't find default "
"kart '%s' nor any other kart.\n",
default_kart.c_str());
exit(-1);
}
Log::fatal("KartSelectionScreen", "Can't find default "
"kart '%s' nor any other kart.",
default_kart.c_str());
}
m_kartInternalName = props->getIdent();
@ -423,14 +419,12 @@ void PlayerKartWidget::setPlayerID(const int newPlayerID)
if (StateManager::get()->getActivePlayer(newPlayerID)
!= m_associated_player)
{
Log::warn("[KartSelectionScreen]", "Internal "
"inconsistency, PlayerKartWidget has IDs and "
"pointers that do not correspond to one player");
fprintf(stderr,
" Player: %p - Index: %d - m_associated_player: %p\n",
StateManager::get()->getActivePlayer(newPlayerID),
newPlayerID, m_associated_player);
assert(false);
Log::error("KartSelectionScreen", "Internal "
"inconsistency, PlayerKartWidget has IDs and "
"pointers that do not correspond to one player");
Log::fatal("KartSelectionScreen", " Player: %p - Index: %d - m_associated_player: %p",
StateManager::get()->getActivePlayer(newPlayerID),
newPlayerID, m_associated_player);
}
// Remove current focus, but rembmer it
@ -1612,11 +1606,9 @@ void KartSelectionScreen::updateKartWidgetModel(uint8_t widget_id,
->setText( selectionText.c_str(), false );
}
else
{
fprintf(stderr, "[KartSelectionScreen] WARNING: could not "
"find a kart named '%s'\n",
selection.c_str());
}
Log::warn("KartSelectionScreen", "could not "
"find a kart named '%s'",
selection.c_str());
}
}

View File

@ -380,8 +380,8 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL)
{
fprintf(stderr, "[MainMenuScreen] WARNING: cannot find kart '%s', will revert to default\n",
UserConfigParams::m_default_kart.c_str());
Log::warn("MainMenuScreen", "Cannot find kart '%s', will revert to default",
UserConfigParams::m_default_kart.c_str());
UserConfigParams::m_default_kart.revertToDefaults();
}
race_manager->setLocalKartInfo(0, UserConfigParams::m_default_kart);

View File

@ -103,13 +103,21 @@ void OptionsScreenAudio::eventCallback(Widget* widget, const std::string& name,
{
if (name == "options_choice")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selection == "tab_audio") StateManager::get()->replaceTopMostScreen(OptionsScreenAudio::getInstance());
else if (selection == "tab_video") StateManager::get()->replaceTopMostScreen(OptionsScreenVideo::getInstance());
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(TabbedUserScreen::getInstance());
else if (selection == "tab_controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
else if (selection == "tab_ui") StateManager::get()->replaceTopMostScreen(OptionsScreenUI::getInstance());
Screen *screen = NULL;
//if (selection == "tab_audio")
// screen = OptionsScreenAudio::getInstance();
if (selection == "tab_video")
screen = OptionsScreenVideo::getInstance();
else if (selection == "tab_players")
screen = TabbedUserScreen::getInstance();
else if (selection == "tab_controls")
screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
screen = OptionsScreenUI::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}
else if(name == "back")
{

View File

@ -154,6 +154,15 @@ void OptionsScreenInput::init()
const std::string name2("devices");
eventCallback(devices, name2, PLAYER_ID_GAME_MASTER);
*/
// Disable adding keyboard configurations
if (StateManager::get()->getGameState() == GUIEngine::INGAME_MENU)
{
getWidget<ButtonWidget>("add_device")->setDeactivated();
}
else
{
getWidget<ButtonWidget>("add_device")->setActivated();
}
} // init
// -----------------------------------------------------------------------------
@ -184,13 +193,21 @@ void OptionsScreenInput::eventCallback(Widget* widget, const std::string& name,
if (name == "options_choice")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selection == "tab_audio") StateManager::get()->replaceTopMostScreen(OptionsScreenAudio::getInstance());
else if (selection == "tab_video") StateManager::get()->replaceTopMostScreen(OptionsScreenVideo::getInstance());
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(TabbedUserScreen::getInstance());
else if (selection == "tab_controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
else if (selection == "tab_ui") StateManager::get()->replaceTopMostScreen(OptionsScreenUI::getInstance());
Screen *screen = NULL;
if (selection == "tab_audio")
screen = OptionsScreenAudio::getInstance();
else if (selection == "tab_video")
screen = OptionsScreenVideo::getInstance();
else if (selection == "tab_players")
screen = TabbedUserScreen::getInstance();
//else if (selection == "tab_controls")
// screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
screen = OptionsScreenUI::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}
else if (name == "add_device")
{

View File

@ -61,6 +61,19 @@ void OptionsScreenInput2::loadedFromFile()
// ----------------------------------------------------------------------------
void OptionsScreenInput2::beforeAddingWidget()
{
GUIEngine::ListWidget* w_list =
getWidget<GUIEngine::ListWidget>("actions");
assert(w_list != NULL);
w_list->clearColumns();
w_list->addColumn(_("Action"), 1);
w_list->addColumn(_("Key binding"), 1);
w_list->setSortable(false);
}
// ----------------------------------------------------------------------------
void OptionsScreenInput2::init()
{
Screen::init();
@ -127,43 +140,72 @@ void OptionsScreenInput2::init()
// their actualy contents will be adapted as needed after
//I18N: Key binding section
actions->addItem("game_keys_section", _("Game Keys") );
actions->addItem(KartActionStrings[PA_STEER_LEFT], L"" );
actions->addItem(KartActionStrings[PA_STEER_RIGHT], L"" );
actions->addItem(KartActionStrings[PA_ACCEL], L"" );
actions->addItem(KartActionStrings[PA_BRAKE], L"" );
actions->addItem(KartActionStrings[PA_FIRE], L"" );
actions->addItem(KartActionStrings[PA_NITRO], L"" );
actions->addItem(KartActionStrings[PA_DRIFT], L"" );
actions->addItem(KartActionStrings[PA_LOOK_BACK], L"" );
actions->addItem(KartActionStrings[PA_RESCUE], L"" );
actions->addItem(KartActionStrings[PA_PAUSE_RACE], L"" );
addListItemSubheader(actions, "game_keys_section", _("Game Keys"));
addListItem(actions, PA_STEER_LEFT);
addListItem(actions, PA_STEER_RIGHT);
addListItem(actions, PA_ACCEL);
addListItem(actions, PA_BRAKE);
addListItem(actions, PA_FIRE);
addListItem(actions, PA_NITRO);
addListItem(actions, PA_DRIFT);
addListItem(actions, PA_LOOK_BACK);
addListItem(actions, PA_RESCUE);
addListItem(actions, PA_PAUSE_RACE);
//I18N: Key binding section
actions->addItem("menu_keys_section", _("Menu Keys") );
actions->addItem(KartActionStrings[PA_MENU_UP], L"" );
actions->addItem(KartActionStrings[PA_MENU_DOWN], L"" );
actions->addItem(KartActionStrings[PA_MENU_LEFT], L"" );
actions->addItem(KartActionStrings[PA_MENU_RIGHT], L"" );
actions->addItem(KartActionStrings[PA_MENU_SELECT], L"");
actions->addItem(KartActionStrings[PA_MENU_CANCEL], L"" );
addListItemSubheader(actions, "menu_keys_section", _("Menu Keys"));
addListItem(actions, PA_MENU_UP);
addListItem(actions, PA_MENU_DOWN);
addListItem(actions, PA_MENU_LEFT);
addListItem(actions, PA_MENU_RIGHT);
addListItem(actions, PA_MENU_SELECT);
addListItem(actions, PA_MENU_CANCEL);
updateInputButtons();
// Disable deletion keyboard configurations
if (StateManager::get()->getGameState() == GUIEngine::INGAME_MENU)
{
getWidget<ButtonWidget>("delete")->setDeactivated();
} else
{
getWidget<ButtonWidget>("delete")->setActivated();
}
} // init
// -----------------------------------------------------------------------------
irr::core::stringw OptionsScreenInput2::makeLabel(
void OptionsScreenInput2::addListItemSubheader(GUIEngine::ListWidget* actions,
const char* id,
const core::stringw& text)
{
std::vector<GUIEngine::ListWidget::ListCell> row;
row.push_back(GUIEngine::ListWidget::ListCell(text, -1, 1, false));
row.push_back(GUIEngine::ListWidget::ListCell(L"", -1, 1, false));
actions->addItem(id, row);
}
// -----------------------------------------------------------------------------
void OptionsScreenInput2::addListItem(GUIEngine::ListWidget* actions, PlayerAction pa)
{
std::vector<GUIEngine::ListWidget::ListCell> row;
row.push_back(GUIEngine::ListWidget::ListCell(core::stringw(KartActionStrings[pa].c_str()), -1, 1, false));
row.push_back(GUIEngine::ListWidget::ListCell(L"", -1, 1, false));
actions->addItem(KartActionStrings[pa], row);
}
// -----------------------------------------------------------------------------
void OptionsScreenInput2::renameRow(GUIEngine::ListWidget* actions,
int idRow,
const irr::core::stringw &translatedName,
PlayerAction action) const
{
//hack: one tab character is supported by out font object, it moves the
// cursor to the middle of the area
core::stringw out = irr::core::stringw(" ") + translatedName + L"\t";
actions->renameCell(idRow, 0, core::stringw(" ") + translatedName);
actions->renameCell(idRow, 1, m_config->getBindingAsString(action));
out += m_config->getBindingAsString(action);
return out;
} // makeLabel
// -----------------------------------------------------------------------------
@ -182,54 +224,54 @@ void OptionsScreenInput2::updateInputButtons()
i++; // section header
//I18N: Key binding name
actions->renameItem(i++, makeLabel( _("Steer Left"), PA_STEER_LEFT) );
renameRow(actions, i++, _("Steer Left"), PA_STEER_LEFT);
//I18N: Key binding name
actions->renameItem(i++, makeLabel( _("Steer Right"), PA_STEER_RIGHT) );
renameRow(actions, i++, _("Steer Right"), PA_STEER_RIGHT);
//I18N: Key binding name
actions->renameItem(i++, makeLabel( _("Accelerate"), PA_ACCEL) );
renameRow(actions, i++, _("Accelerate"), PA_ACCEL);
//I18N: Key binding name
actions->renameItem(i++, makeLabel( _("Brake"), PA_BRAKE) );
renameRow(actions, i++, _("Brake"), PA_BRAKE);
//I18N: Key binding name
actions->renameItem(i++, makeLabel( _("Fire"), PA_FIRE) );
renameRow(actions, i++, _("Fire"), PA_FIRE);
//I18N: Key binding name
actions->renameItem(i++, makeLabel( _("Nitro"), PA_NITRO) );
renameRow(actions, i++, _("Nitro"), PA_NITRO);
//I18N: Key binding name
actions->renameItem(i++, makeLabel( _("Skidding"), PA_DRIFT) );
renameRow(actions, i++, _("Skidding"), PA_DRIFT);
//I18N: Key binding name
actions->renameItem(i++, makeLabel( _("Look Back"), PA_LOOK_BACK) );
renameRow(actions, i++, _("Look Back"), PA_LOOK_BACK);
//I18N: Key binding name
actions->renameItem(i++, makeLabel( _("Rescue"), PA_RESCUE) );
renameRow(actions, i++, _("Rescue"), PA_RESCUE);
//I18N: Key binding name
actions->renameItem(i++, makeLabel( _("Pause Game"), PA_PAUSE_RACE) );
renameRow(actions, i++, _("Pause Game"), PA_PAUSE_RACE);
i++; // section header
//I18N: Key binding name
actions->renameItem(i++, makeLabel( _("Up"), PA_MENU_UP) );
renameRow(actions, i++, _("Up"), PA_MENU_UP);
//I18N: Key binding name
actions->renameItem(i++, makeLabel( _("Down"), PA_MENU_DOWN) );
renameRow(actions, i++, _("Down"), PA_MENU_DOWN);
//I18N: Key binding name
actions->renameItem(i++, makeLabel( _("Left"), PA_MENU_LEFT) );
renameRow(actions, i++, _("Left"), PA_MENU_LEFT);
//I18N: Key binding name
actions->renameItem(i++, makeLabel( _("Right"), PA_MENU_RIGHT) );
renameRow(actions, i++, _("Right"), PA_MENU_RIGHT);
//I18N: Key binding name
actions->renameItem(i++, makeLabel( _("Select"), PA_MENU_SELECT) );
renameRow(actions, i++, _("Select"), PA_MENU_SELECT);
//I18N: Key binding name
actions->renameItem(i++, makeLabel( _("Cancel/Back"), PA_MENU_CANCEL) );
renameRow(actions, i++, _("Cancel/Back"), PA_MENU_CANCEL);
@ -443,18 +485,21 @@ void OptionsScreenInput2::eventCallback(Widget* widget,
StateManager *sm = StateManager::get();
if (name == "options_choice")
{
const std::string &selection =
((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selection == "tab_audio")
sm->replaceTopMostScreen(OptionsScreenAudio::getInstance());
else if (selection == "tab_video")
sm->replaceTopMostScreen(OptionsScreenVideo::getInstance());
Screen *screen = NULL;
if (selection == "tab_audio")
screen = OptionsScreenAudio::getInstance();
//else if (selection == "tab_video")
// screen = OptionsScreenVideo::getInstance();
else if (selection == "tab_players")
sm->replaceTopMostScreen(TabbedUserScreen::getInstance());
screen = TabbedUserScreen::getInstance();
//else if (selection == "tab_controls")
// screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
sm->replaceTopMostScreen(OptionsScreenUI::getInstance());
else if (selection == "tab_controls") {}
screen = OptionsScreenUI::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}
else if (name == "back_to_device_list")
{
@ -555,7 +600,8 @@ void OptionsScreenInput2::onConfirm()
const bool success =
input_manager->getDeviceList()->deleteConfig(m_config);
assert(success);
if (!success) fprintf(stderr, "Failed to delete config!\n");
if (!success)
Log::error("OptionsScreenInput2", "Failed to delete config!");
m_config = NULL;
input_manager->getDeviceList()->serialize();

View File

@ -25,7 +25,7 @@
#include "guiengine/screen.hpp"
#include "states_screens/dialogs/message_dialog.hpp"
namespace GUIEngine { class Widget; }
namespace GUIEngine { class Widget; class ListWidget; }
class DeviceConfig;
namespace irr { namespace gui { class STKModifiedSpriteBank; } }
@ -50,8 +50,15 @@ class OptionsScreenInput2 : public GUIEngine::Screen,
DeviceConfig* m_config;
irr::core::stringw makeLabel(const irr::core::stringw &translatedName,
PlayerAction action) const;
void renameRow(GUIEngine::ListWidget* actions,
int idRow,
const irr::core::stringw &translatedName,
PlayerAction action) const;
void addListItem(GUIEngine::ListWidget* actions, PlayerAction pa);
void addListItemSubheader(GUIEngine::ListWidget* actions,
const char* id,
const core::stringw& text);
public:
friend class GUIEngine::ScreenSingleton<OptionsScreenInput2>;
@ -84,6 +91,8 @@ public:
/** \brief Implement IConfirmDialogListener callback */
virtual void onConfirm() OVERRIDE;
virtual void beforeAddingWidget() OVERRIDE;
};
#endif

View File

@ -206,12 +206,21 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
{
if (name == "options_choice")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selection == "tab_audio") StateManager::get()->replaceTopMostScreen(OptionsScreenAudio::getInstance());
else if (selection == "tab_video") StateManager::get()->replaceTopMostScreen(OptionsScreenVideo::getInstance());
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(TabbedUserScreen::getInstance());
else if (selection == "tab_controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
Screen *screen = NULL;
if (selection == "tab_audio")
screen = OptionsScreenAudio::getInstance();
else if (selection == "tab_video")
screen = OptionsScreenVideo::getInstance();
else if (selection == "tab_players")
screen = TabbedUserScreen::getInstance();
else if (selection == "tab_controls")
screen = OptionsScreenInput::getInstance();
//else if (selection == "tab_ui")
// screen = OptionsScreenUI::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}
else if(name == "back")
{

View File

@ -167,15 +167,6 @@ void OptionsScreenVideo::init()
if (UserConfigParams::m_fullscreen) rememberWinpos->setDeactivated();
else rememberWinpos->setActivated();
// Enable back widgets if they were visited in-game previously
if (StateManager::get()->getGameState() != GUIEngine::INGAME_MENU)
{
res->setActivated();
full->setActivated();
applyBtn->setActivated();
gfx->setActivated();
getWidget<ButtonWidget>("custom")->setActivated();
}
// --- get resolution list from irrlicht the first time
if (!m_inited)
@ -342,6 +333,15 @@ void OptionsScreenVideo::init()
gfx->setDeactivated();
getWidget<ButtonWidget>("custom")->setDeactivated();
}
else
{
// Enable back widgets if they were visited in-game previously
res->setActivated();
full->setActivated();
applyBtn->setActivated();
gfx->setActivated();
getWidget<ButtonWidget>("custom")->setActivated();
}
} // init
// ----------------------------------------------------------------------------
@ -469,15 +469,13 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
{
if (name == "options_choice")
{
std::string selection =
((RibbonWidget*)widget)
->getSelectionIDString(PLAYER_ID_GAME_MASTER);
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
Screen *screen = NULL;
if (selection == "tab_audio")
screen = OptionsScreenAudio::getInstance();
else if (selection == "tab_video")
screen = OptionsScreenVideo::getInstance();
//else if (selection == "tab_video")
// screen = OptionsScreenVideo::getInstance();
else if (selection == "tab_players")
screen = TabbedUserScreen::getInstance();
else if (selection == "tab_controls")

View File

@ -471,8 +471,8 @@ void RaceGUIOverworld::drawGlobalMiniMap()
if (challenge == NULL)
{
fprintf(stderr, "[RaceGUIOverworld] ERROR: Cannot find challenge <%s>\n",
challenges[n].m_challenge_id.c_str());
Log::error("RaceGUIOverworld", "Cannot find challenge <%s>.",
challenges[n].m_challenge_id.c_str());
break;
}
@ -483,10 +483,10 @@ void RaceGUIOverworld::drawGlobalMiniMap()
if (gp == NULL)
{
fprintf(stderr, "[RaceGUIOverworld] ERROR: Cannot find GP <%s>, "
"referenced from challenge <%s>\n",
challenge->getGPId().c_str(),
challenges[n].m_challenge_id.c_str());
Log::error("RaceGUIOverworld", "Cannot find GP <%s>, "
"referenced from challenge <%s>",
challenge->getGPId().c_str(),
challenges[n].m_challenge_id.c_str());
break;
}
@ -508,10 +508,10 @@ void RaceGUIOverworld::drawGlobalMiniMap()
Track* track = track_manager->getTrack(challenge->getTrackId());
if (track == NULL)
{
fprintf(stderr, "[RaceGUIOverworld] ERROR: Cannot find track <%s>, "
"referenced from challenge <%s>\n",
challenge->getTrackId().c_str(),
challenges[n].m_challenge_id.c_str());
Log::error("RaceGUIOverworld", "Cannot find track <%s>, "
"referenced from challenge <%s>",
challenge->getTrackId().c_str(),
challenges[n].m_challenge_id.c_str());
break;
}

View File

@ -297,9 +297,8 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
}
return;
}
fprintf(stderr, "Incorrect event '%s' when things are unlocked.\n",
name.c_str());
assert(false);
Log::fatal("RaceResultGUI", "Incorrect event '%s' when things are unlocked.",
name.c_str());
}
// If we're playing online :
@ -342,11 +341,8 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
MessageDialog::MESSAGE_DIALOG_CONFIRM, this, false);
}
else if (!getWidget(name.c_str())->isVisible())
{
fprintf(stderr, "Incorrect event '%s' when things are unlocked.\n",
name.c_str());
assert(false);
}
Log::fatal("RaceResultGUI", "Incorrect event '%s' when things are unlocked.",
name.c_str());
return;
}
@ -387,10 +383,8 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
}
}
else
{
fprintf(stderr, "Incorrect event '%s' for normal race.\n",
name.c_str());
}
Log::fatal("RaceResultGUI", "Incorrect event '%s' for normal race.",
name.c_str());
return;
} // eventCallback
@ -615,8 +609,8 @@ void RaceResultGUI::onUpdate(float dt)
}
catch (std::exception& e)
{
fprintf(stderr, "[RaceResultGUI] WARNING: exception caught when "
"trying to load music: %s\n", e.what());
Log::error("RaceResultGUI", "Exception caught when "
"trying to load music: %s", e.what());
}
}
} // onUpdate

View File

@ -108,6 +108,21 @@ void BaseUserScreen::init()
else if (PlayerManager::get()->getNumPlayers() > 0)
selectUser(0);
// Disable changing the user while in game
if (StateManager::get()->getGameState() == GUIEngine::INGAME_MENU)
{
getWidget<IconButtonWidget>("ok")->setDeactivated();
getWidget<IconButtonWidget>("new_user")->setDeactivated();
getWidget<IconButtonWidget>("rename")->setDeactivated();
getWidget<IconButtonWidget>("delete")->setDeactivated();
}
else
{
getWidget<IconButtonWidget>("ok")->setActivated();
getWidget<IconButtonWidget>("new_user")->setActivated();
getWidget<IconButtonWidget>("rename")->setActivated();
getWidget<IconButtonWidget>("delete")->setActivated();
}
} // init
// ----------------------------------------------------------------------------
@ -572,16 +587,21 @@ void TabbedUserScreen::eventCallback(GUIEngine::Widget* widget,
{
if (name == "options_choice")
{
const std::string &selection =
((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
Screen *s;
if (selection=="tab_audio" ) s = OptionsScreenAudio::getInstance();
else if (selection=="tab_video" ) s = OptionsScreenVideo::getInstance();
else if (selection=="tab_players" ) s = TabbedUserScreen::getInstance();
else if (selection=="tab_controls") s = OptionsScreenInput::getInstance();
else if (selection=="tab_ui" ) s = OptionsScreenUI::getInstance();
assert(s);
StateManager::get()->replaceTopMostScreen(s);
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
Screen *screen = NULL;
if (selection == "tab_audio")
screen = OptionsScreenAudio::getInstance();
else if (selection == "tab_video")
screen = OptionsScreenVideo::getInstance();
//else if (selection == "tab_players")
// screen = TabbedUserScreen::getInstance();
else if (selection == "tab_controls")
screen = OptionsScreenInput::getInstance();
else if (selection == "tab_ui")
screen = OptionsScreenUI::getInstance();
if(screen)
StateManager::get()->replaceTopMostScreen(screen);
}
else
BaseUserScreen::eventCallback(widget, name, player_id);

View File

@ -36,12 +36,8 @@ CheckCannon::CheckCannon(const XMLNode &node, unsigned int index)
: CheckLine(node, index)
{
core::vector3df p1, p2;
if(!node.get("target-p1", &p1) ||
!node.get("target-p2", &p2) )
{
printf("CheckCannon has no target line specified.\n");
exit(-1);
}
if(!node.get("target-p1", &p1) || !node.get("target-p2", &p2))
Log::fatal("CheckCannon", "No target line specified.");
m_target.setLine(p1, p2);
m_curve = new Ipo(*(node.getNode("curve")),
/*fps*/25,

View File

@ -72,8 +72,8 @@ void CheckGoal::update(float dt)
if(isTriggered(m_previous_position[ball_index], xyz, ball_index))
{
if(UserConfigParams::m_check_debug)
printf("CHECK: Goal check structure %d triggered for object %s.\n",
m_index, obj->getPresentation<TrackObjectPresentationMesh>()->getNode()->getDebugName());
Log::info("CheckGoal", "Goal check structure %d triggered for object %s.",
m_index, obj->getPresentation<TrackObjectPresentationMesh>()->getNode()->getDebugName());
trigger(ball_index);
}
m_previous_position[ball_index] = xyz;

View File

@ -71,11 +71,10 @@ bool CheckLap::isTriggered(const Vec3 &old_pos, const Vec3 &new_pos,
bool result =(m_previous_distance[indx]>0.95f*track_length &&
current_distance<7.0f);
if(UserConfigParams::m_check_debug && result)
{
printf("CHECK: Kart %s crossed start line from %f to %f.\n",
World::getWorld()->getKart(indx)->getIdent().c_str(),
m_previous_distance[indx], current_distance);
}
Log::info("CheckLap", "Kart %s crossed start line from %f to %f.",
World::getWorld()->getKart(indx)->getIdent().c_str(),
m_previous_distance[indx], current_distance);
m_previous_distance[indx] = current_distance;
return result;

View File

@ -173,14 +173,14 @@ bool CheckLine::isTriggered(const Vec3 &old_pos, const Vec3 &new_pos,
if(UserConfigParams::m_check_debug && !result)
{
if(World::getWorld()->getNumKarts()>0)
printf("CHECK: Kart %s crosses line, but wrong height "
"(%f vs %f).\n",
World::getWorld()->getKart(indx)->getIdent().c_str(),
new_pos.getY(), m_min_height);
Log::info("CheckLine", "Kart %s crosses line, but wrong height "
"(%f vs %f).",
World::getWorld()->getKart(indx)->getIdent().c_str(),
new_pos.getY(), m_min_height);
else
printf("CHECK: Kart %d crosses line, but wrong height "
"(%f vs %f).\n",
indx, new_pos.getY(), m_min_height);
Log::info("CheckLine", "Kart %d crosses line, but wrong height "
"(%f vs %f).",
indx, new_pos.getY(), m_min_height);
}
}

View File

@ -64,7 +64,7 @@ void CheckManager::load(const XMLNode &node)
m_all_checks.push_back(cs);
} // checksphere
else
printf("Unknown check structure '%s' - ignored.\n", type.c_str());
Log::warn("CheckManager", "Unknown check structure '%s' - ignored.", type.c_str());
} // for i<node.getNumNodes
// Now set all 'successors', i.e. check structures that need to get a
@ -141,18 +141,15 @@ unsigned int CheckManager::getLapLineIndex() const
if (dynamic_cast<CheckLap*>(c) != NULL) return i;
}
fprintf(stderr,
"No check-lap structure found! This can cause incorrect kart\n");
fprintf(stderr,
"ranking when crossing the line, but can otherwise be ignored.\n");
Log::warn("CheckManager", "No check-lap structure found! This can cause incorrect kart");
Log::warn("CheckManager", "ranking when crossing the line, but can otherwise be ignored.");
for (unsigned int i=0; i<getCheckStructureCount(); i++)
{
if(getCheckStructure(i)->getType()==CheckStructure::CT_NEW_LAP)
return i;
}
fprintf(stderr, "Error, no kind of lap line for track found, aborting.\n");
exit(-1);
Log::fatal("CheckManager", "Error, no kind of lap line for track found, aborting.");
} // getLapLineIndex
// ----------------------------------------------------------------------------

View File

@ -54,9 +54,7 @@ CheckStructure::CheckStructure(const XMLNode &node, unsigned int index)
else if(node.getName()=="cannon")
m_check_type = CT_CANNON;
else
{
printf("Unknown check structure '%s' - ignored.\n", kind.c_str());
}
Log::warn("CheckStructure", "Unknown check structure '%s' - ignored.", kind.c_str());
node.get("same-group", &m_same_group);
// Make sure that the index of this check structure is included in
@ -108,8 +106,8 @@ void CheckStructure::update(float dt)
if(m_is_active[i] && isTriggered(m_previous_position[i], xyz, i))
{
if(UserConfigParams::m_check_debug)
printf("CHECK: Check structure %d triggered for kart %s.\n",
m_index, world->getKart(i)->getIdent().c_str());
Log::info("CheckStructure", "Check structure %d triggered for kart %s.",
m_index, world->getKart(i)->getIdent().c_str());
trigger(i);
}
m_previous_position[i] = xyz;
@ -144,18 +142,18 @@ void CheckStructure::changeStatus(const std::vector<int> indices,
cs->m_is_active[kart_index] = false;
if(UserConfigParams::m_check_debug)
{
printf("CHECK: Deactivating %d for %s.\n",
indices[i],
World::getWorld()->getKart(kart_index)->getIdent().c_str());
Log::info("CheckStructure", "Deactivating %d for %s.",
indices[i],
World::getWorld()->getKart(kart_index)->getIdent().c_str());
}
break;
case CS_ACTIVATE:
cs->m_is_active[kart_index] = true;
if(UserConfigParams::m_check_debug)
{
printf("CHECK: Activating %d for %s.\n",
indices[i],
World::getWorld()->getKart(kart_index)->getIdent().c_str());
Log::info("CheckStructure", "Activating %d for %s.",
indices[i],
World::getWorld()->getKart(kart_index)->getIdent().c_str());
}
break;
case CS_TOGGLE:
@ -166,10 +164,10 @@ void CheckStructure::changeStatus(const std::vector<int> indices,
// non-POD type 'struct std::_Bit_reference' through '...';
// call will abort at runtime"). So we use this somewhat
// unusual but portable construct.
printf("CHECK: Toggling %d for %s from %d.\n",
indices[i],
World::getWorld()->getKart(kart_index)->getIdent().c_str(),
cs->m_is_active[kart_index]==true);
Log::info("CheckStructure", "Toggling %d for %s from %d.",
indices[i],
World::getWorld()->getKart(kart_index)->getIdent().c_str(),
cs->m_is_active[kart_index]==true);
}
cs->m_is_active[kart_index] = !cs->m_is_active[kart_index];
} // switch
@ -213,9 +211,9 @@ void CheckStructure::trigger(unsigned int kart_index)
World::getWorld()->newLap(kart_index);
if(UserConfigParams::m_check_debug)
{
printf("CHECK: %s new lap %d triggered\n",
World::getWorld()->getKart(kart_index)->getIdent().c_str(),
m_index);
Log::info("CheckStructure", "%s new lap %d triggered",
World::getWorld()->getKart(kart_index)->getIdent().c_str(),
m_index);
}
changeStatus(m_check_structures_to_change_state,
kart_index, CS_ACTIVATE);

View File

@ -30,10 +30,8 @@
GraphNode::GraphNode(unsigned int quad_index, unsigned int node_index)
{
if (quad_index >= QuadSet::get()->getNumberOfQuads())
{
fprintf(stderr, "[GraphNode] ERROR: No driveline found, or empty driveline");
abort();
}
Log::fatal("GraphNode", "No driveline found, or empty driveline.");
m_quad_index = quad_index;
m_node_index = node_index;
m_distance_from_start = -1.0f;
@ -130,10 +128,10 @@ void GraphNode::setupPathsToNode()
gn.markAllSuccessorsToUse(i, &m_path_to_node);
}
#ifdef DEBUG
for(unsigned int i=0; i<m_path_to_node.size(); i++)
for(unsigned int i = 0; i < m_path_to_node.size(); ++i)
{
if(m_path_to_node[i]==-1)
printf("[WARNING] No path to node %d found on graph node %d.\n",
if(m_path_to_node[i] == -1)
Log::warn("GraphNode", "No path to node %d found on graph node %d.",
i, m_node_index);
}
#endif

View File

@ -17,6 +17,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "tracks/quad.hpp"
#include "utils/log.hpp"
#include <algorithm>
#include <S3DVertex.h>
@ -31,10 +32,10 @@ Quad::Quad(const Vec3 &p0, const Vec3 &p1, const Vec3 &p2, const Vec3 &p3,
if(p1.sideOfLine2D(p0, p2)>0 ||
p3.sideOfLine2D(p0, p2)<0)
{
printf("Warning: quad has wrong orientation: p0=%f %f %f p1=%f %f %f\n",
p0.getX(), p0.getY(), p0.getZ(),p1.getX(), p1.getY(), p1.getZ());
printf("The quad will be swapped, nevertheless test for correctness -\n");
printf("quads must be counter-clockwise oriented.\n");
Log::warn("Quad", "Quad has wrong orientation: p0=%f %f %f p1=%f %f %f",
p0.getX(), p0.getY(), p0.getZ(),p1.getX(), p1.getY(), p1.getZ());
Log::warn("Quad", "The quad will be swapped, nevertheless test for correctness -");
Log::warn("Quad", "quads must be counter-clockwise oriented.");
m_p[0]=p1; m_p[1]=p0; m_p[2]=p3; m_p[3]=p2;
}
else

View File

@ -498,10 +498,7 @@ public:
btTransform getStartTransform (unsigned int index) const
{
if (index >= m_start_transforms.size())
{
fprintf(stderr, "No start position for kart %i\n", index);
abort();
}
Log::fatal("Tracj", "No start position for kart %i.", index);
return m_start_transforms[index];
}
// ------------------------------------------------------------------------

View File

@ -98,9 +98,8 @@ void TrackManager::setUnavailableTracks(const std::vector<std::string> &tracks)
if (std::find(tracks.begin(), tracks.end(), id)==tracks.end())
{
m_track_avail[i-m_tracks.begin()] = false;
fprintf(stderr,
"Track '%s' not available on all clients, disabled.\n",
id.c_str());
Log::warn("TrackManager", "Track '%s' not available on all clients, disabled.",
id.c_str());
} // if id not in tracks
} // for all available tracks in track manager
@ -174,7 +173,7 @@ bool TrackManager::loadTrack(const std::string& dirname)
}
catch (std::exception& e)
{
fprintf(stderr, "[TrackManager] ERROR: Cannot load track <%s> : %s\n",
Log::error("TrackManager", "Cannot load track <%s> : %s\n",
dirname.c_str(), e.what());
return false;
}
@ -182,12 +181,12 @@ bool TrackManager::loadTrack(const std::string& dirname)
if (track->getVersion()<stk_config->m_min_track_version ||
track->getVersion()>stk_config->m_max_track_version)
{
fprintf(stderr, "[TrackManager] Warning: track '%s' is not supported "
Log::warn("TrackManager", "Track '%s' is not supported "
"by this binary, ignored. (Track is version %i, this "
"executable supports from %i to %i)\n",
track->getIdent().c_str(), track->getVersion(),
stk_config->m_min_track_version,
stk_config->m_max_track_version);
"executable supports from %i to %i).",
track->getIdent().c_str(), track->getVersion(),
stk_config->m_min_track_version,
stk_config->m_max_track_version);
delete track;
return false;
}
@ -206,22 +205,15 @@ void TrackManager::removeTrack(const std::string &ident)
{
Track *track = getTrack(ident);
if (track == NULL)
{
fprintf(stderr, "[TrackManager] ERROR: There is no track named '%s'!!\n", ident.c_str());
assert(false);
return;
}
Log::fatal("TrackManager", "There is no track named '%s'!!", ident.c_str());
if (track->isInternal()) return;
std::vector<Track*>::iterator it = std::find(m_tracks.begin(),
m_tracks.end(), track);
if (it == m_tracks.end())
{
fprintf(stderr, "[TrackManager] INTERNAL ERROR: Cannot find track '%s' in map!!\n", ident.c_str());
assert(false);
return;
}
Log::fatal("TrackManager", "Cannot find track '%s' in map!!", ident.c_str());
int index = it - m_tracks.begin();
// Remove the track from all groups it belongs to

View File

@ -387,7 +387,7 @@ void TrackObjectPresentationMesh::init(const XMLNode* xml_node, scene::ISceneNod
m_frame_start = 0;
m_frame_end = 0;
if (World::getWorld() != NULL && World::getWorld()->getTrack() != NULL)
if (World::getWorld() != NULL && World::getWorld()->getTrack() != NULL && xml_node != NULL)
World::getWorld()->getTrack()->handleAnimatedTextures(m_node, *xml_node);
}
//#ifdef DEBUG
@ -496,10 +496,7 @@ TrackObjectPresentationSound::TrackObjectPresentationSound(const XMLNode& xml_no
}
}
else
{
fprintf(stderr,
"[TrackObject] Sound emitter object could not be created\n");
}
Log::error("TrackObject", "Sound emitter object could not be created.");
if (trigger_when_near)
{
@ -753,9 +750,7 @@ TrackObjectPresentationActionTrigger::TrackObjectPresentationActionTrigger(const
m_action_active = true;
if (m_action.size() == 0)
{
fprintf(stderr, "[TrackObject] WARNING: action-trigger has no action defined\n");
}
Log::warn("TrackObject", "Action-trigger has no action defined.");
ItemManager::get()->newItem(m_init_xyz, trigger_distance, this);
}
@ -891,10 +886,7 @@ void TrackObjectPresentationActionTrigger::onTriggerItemApproached(Item* who)
return;
}
else
{
fprintf(stderr, "[TrackObject] WARNING: unknown action <%s>\n",
m_action.c_str());
}
Log::warn("TrackObject", "Unknown action '%s'", m_action.c_str());
}

View File

@ -520,7 +520,7 @@ namespace StringUtils
// which admittedly only works for min < 100000 - which is about 68
// days - good enough.
char s[12];
sprintf ( s, "%02d:%02d:%02d", min, sec, hundredths) ;
sprintf(s, "%02d:%02d:%02d", min, sec, hundredths);
return std::string(s);
} // timeToString
@ -738,8 +738,8 @@ namespace StringUtils
+ 10*very_minor
+ release_candidate;
if(version<=0)
printf("Invalid version string '%s'.\n", s.c_str());
if(version <= 0)
Log::error("StringUtils", "Invalid version string '%s'.", s.c_str());
return version;
} // versionToInt