Fix #966: replace printf, thanks to muditjaju.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12742 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "karts/kart_model.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
||||
/** Creates a kart.
|
||||
* \param ident The identifier of the kart.
|
||||
@@ -104,12 +105,13 @@ void AbstractKart::setKartAnimation(AbstractKartAnimation *ka)
|
||||
#ifdef DEBUG
|
||||
if( ( (ka!=NULL) ^ (m_kart_animation!=NULL) ) ==0)
|
||||
{
|
||||
if(ka) printf("Setting kart animation to '%s'.\n",
|
||||
ka->getName().c_str());
|
||||
else printf("Setting kart animation to NULL.\n");
|
||||
if(m_kart_animation) printf("Current kart animation is '%s'.\n",
|
||||
m_kart_animation->getName().c_str());
|
||||
else printf("Current kart animation is NULL.\n");
|
||||
if(ka) Log::debug("Abstract_Kart", "Setting kart animation to '%s'.",
|
||||
ka->getName().c_str());
|
||||
else Log::debug("Abstract_Kart", "Setting kart animation to NULL.");
|
||||
if(m_kart_animation) Log::info("Abstract_Kart", "Current kart"
|
||||
"animation is '%s'.\n",
|
||||
m_kart_animation->getName().c_str());
|
||||
else Log::debug("Abstract_Kart", "Current kart animation is NULL.");
|
||||
}
|
||||
#endif
|
||||
// Make sure that the either the current animation is NULL and a new (!=0)
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "modes/world.hpp"
|
||||
|
||||
#include "LinearMath/btQuaternion.h"
|
||||
#include "utils/log.hpp"
|
||||
|
||||
GhostKart::GhostKart(const std::string& ident)
|
||||
: Kart(ident, /*world kart id*/99999,
|
||||
@@ -78,7 +79,7 @@ void GhostKart::update(float dt)
|
||||
while(m_next_event < m_replay_events.size() &&
|
||||
m_replay_events[m_next_event].m_time <= t)
|
||||
{
|
||||
printf("Handling event %d\n", m_next_event);
|
||||
Log::debug("Ghost_Kart", "Handling event %d", m_next_event);
|
||||
// Handle the next event now
|
||||
m_next_event++;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "physics/btKart.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
||||
#define SKELETON_DEBUG 0
|
||||
|
||||
@@ -353,8 +354,9 @@ bool KartModel::loadModels(const KartProperties &kart_properties)
|
||||
m_mesh = irr_driver->getAnimatedMesh(full_path);
|
||||
if(!m_mesh)
|
||||
{
|
||||
printf("Problems loading mesh '%s' - kart '%s' will not be available\n",
|
||||
full_path.c_str(), kart_properties.getIdent().c_str());
|
||||
Log::error("Kart_Model", "Problems loading mesh '%s' - kart '%s' will"
|
||||
"not be available.",
|
||||
full_path.c_str(), kart_properties.getIdent().c_str());
|
||||
return false;
|
||||
}
|
||||
m_mesh->grab();
|
||||
@@ -419,9 +421,10 @@ void KartModel::loadWheelInfo(const XMLNode &node,
|
||||
// stk_config file is read (which has no model information).
|
||||
if(m_model_filename!="")
|
||||
{
|
||||
fprintf(stderr, "Missing wheel information '%s' for model '%s'.\n",
|
||||
wheel_name.c_str(), m_model_filename.c_str());
|
||||
fprintf(stderr, "This can be ignored, but the wheels will not rotate.\n");
|
||||
Log::error("Kart_Model", "Missing wheel information '%s' for model"
|
||||
"'%s'.", wheel_name.c_str(), m_model_filename.c_str());
|
||||
Log::error("Kart_Model", "This can be ignored, but the wheels will"
|
||||
"not rotate.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -548,7 +551,7 @@ void KartModel::OnAnimationEnd(scene::IAnimatedMeshSceneNode *node)
|
||||
if(m_current_animation==AF_DEFAULT ||
|
||||
m_animation_frame[m_current_animation]<=-1)
|
||||
{
|
||||
printf("OnAnimationEnd for '%s': current %d frame %d\n",
|
||||
Log::debug("Kart_Model", "OnAnimationEnd for '%s': current %d frame %d",
|
||||
m_model_filename.c_str(),
|
||||
m_current_animation, m_animation_frame[m_current_animation]);
|
||||
assert(false);
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "utils/log.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
KartPropertiesManager *kart_properties_manager=0;
|
||||
@@ -209,9 +210,9 @@ bool KartPropertiesManager::loadKart(const std::string &dir)
|
||||
if (kart_properties->getVersion() < stk_config->m_min_kart_version ||
|
||||
kart_properties->getVersion() > stk_config->m_max_kart_version)
|
||||
{
|
||||
fprintf(stderr, "[KartPropertiesManager] Warning: kart '%s' is not "
|
||||
"supported by this binary, ignored.\n",
|
||||
kart_properties->getIdent().c_str());
|
||||
Log::warn("Kart_Properties_Manager", "Warning: kart '%s' is not "
|
||||
"supported by this binary, ignored.",
|
||||
kart_properties->getIdent().c_str());
|
||||
delete kart_properties;
|
||||
return false;
|
||||
}
|
||||
@@ -302,9 +303,9 @@ void KartPropertiesManager::setUnavailableKarts(std::vector<std::string> karts)
|
||||
{
|
||||
m_kart_available[i] = false;
|
||||
|
||||
fprintf(stderr,
|
||||
"Kart '%s' not available on all clients, disabled.\n",
|
||||
m_karts_properties[i].getIdent().c_str());
|
||||
Log::error("Kart_Properties_Manager",
|
||||
"Kart '%s' not available on all clients, disabled.",
|
||||
m_karts_properties[i].getIdent().c_str());
|
||||
} // kart not in list
|
||||
} // for i in m_kart_properties
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "modes/world.hpp"
|
||||
#include "physics/btKart.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
||||
/** Constructor of the skidding object.
|
||||
*/
|
||||
@@ -320,7 +321,7 @@ void Skidding::update(float dt, bool is_on_ground,
|
||||
Vec3 xyz(real_x, 0.2f, sqrt(r*r-(r-x)*(r-x))*(1.0f+SPEED/150.0f)
|
||||
*(1+(angle/m_kart->getKartProperties()->getMaxSteerAngle(SPEED)-0.6f)*0.1f));
|
||||
Vec3 xyz1=m_kart->getTrans()(xyz);
|
||||
printf("predict %f %f %f speed %f angle %f\n",
|
||||
Log::debug("Skidding", "predict %f %f %f speed %f angle %f",
|
||||
xyz1.getX(), xyz1.getY(), xyz1.getZ(),
|
||||
m_kart->getSpeed(), angle);
|
||||
m_predicted_curve->addPoint(xyz);
|
||||
@@ -344,7 +345,7 @@ void Skidding::update(float dt, bool is_on_ground,
|
||||
}
|
||||
|
||||
m_actual_curve->addPoint(m_kart->getXYZ());
|
||||
printf("actual %f %f %f turn %f speed %f angle %f\n",
|
||||
Log::debug("Skidding", "actual %f %f %f turn %f speed %f angle %f",
|
||||
m_kart->getXYZ().getX(),m_kart->getXYZ().getY(),m_kart->getXYZ().getZ(),
|
||||
m_real_steering, m_kart->getSpeed(),
|
||||
m_kart->getKartProperties()->getMaxSteerAngle(m_kart->getSpeed()));
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "karts/skidding_properties.hpp"
|
||||
|
||||
#include "io/xml_node.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -73,9 +74,10 @@ void SkiddingProperties::load(const XMLNode *skid_node)
|
||||
// ----------------------------------------------------------------------------
|
||||
void SkiddingProperties::checkAllSet(const std::string &filename) const
|
||||
{
|
||||
#define CHECK_NEG( a,strA) if(a<=UNDEFINED) { \
|
||||
fprintf(stderr,"Missing default value for '%s' in '%s'.\n", \
|
||||
strA,filename.c_str());exit(-1); \
|
||||
#define CHECK_NEG( a,strA) if(a<=UNDEFINED) { \
|
||||
Log::error("Skidding_Properties", "Missing default value for '%s'"\
|
||||
"in '%s'.", \
|
||||
strA,filename.c_str());exit(-1); \
|
||||
}
|
||||
CHECK_NEG(m_skid_increase, "skid increase" );
|
||||
CHECK_NEG(m_skid_decrease, "skid decrease" );
|
||||
@@ -92,30 +94,32 @@ void SkiddingProperties::checkAllSet(const std::string &filename) const
|
||||
CHECK_NEG(m_min_skid_speed, "skid min-speed" );
|
||||
|
||||
if(m_skid_time_till_bonus.size()==0)
|
||||
fprintf(stderr, "Warning: no skid time declared, can be ignored.\n");
|
||||
Log::error("Skidding_Properties", "Warning: no skid time declared,"
|
||||
"can be ignored.");
|
||||
if(m_skid_time_till_bonus.size()!=m_skid_bonus_speed.size())
|
||||
{
|
||||
fprintf(stderr, "Warning: skid time-till-bonus and bonus-speed\n");
|
||||
fprintf(stderr, " must have same number of elements.\n");
|
||||
Log::error("Skidding_Properties", "Warning: skid time-till-bonus"
|
||||
"and bonus-speed\n must have same number of elements.");
|
||||
exit(-1);
|
||||
}
|
||||
if(m_skid_time_till_bonus.size()!=m_skid_bonus_time.size())
|
||||
{
|
||||
fprintf(stderr, "Warning: skid time-till-bonus and bonus-time must\n");
|
||||
fprintf(stderr, " have same number of elements.\n");
|
||||
Log::error("Skidding_Properties", "Warning: skid time-till-bonus"
|
||||
"and bonus-time must\n have same number of elements.");
|
||||
exit(-1);
|
||||
}
|
||||
if(m_skid_time_till_bonus.size()!=m_skid_bonus_force.size())
|
||||
{
|
||||
fprintf(stderr, "Warning: skid time-till-bonus and bonus-force must\n");
|
||||
fprintf(stderr, " have same number of elements.\n");
|
||||
Log::error("Skidding_Properties", "Warning: skid time-till-bonus"
|
||||
"and bonus-force must\n have same number of elements.");
|
||||
exit(-1);
|
||||
}
|
||||
for(unsigned int i=0; i<m_skid_time_till_bonus.size()-1; i++)
|
||||
{
|
||||
if(m_skid_time_till_bonus[i]>=m_skid_time_till_bonus[i+1])
|
||||
{
|
||||
fprintf(stderr, "Warning: skid time-till-bonus not sorted.\n");
|
||||
Log::error("Skidding_Properties", "Warning: skid time-till-bonus"
|
||||
"not sorted.");
|
||||
exit(-1);
|
||||
}
|
||||
} // for i
|
||||
|
||||
Reference in New Issue
Block a user