clean src/items

This commit is contained in:
KroArtem 2014-02-07 15:38:20 +04:00
parent c0b13b01ff
commit 746c1ddf5d
6 changed files with 21 additions and 23 deletions

View File

@ -39,7 +39,6 @@
#include "physics/triangle_mesh.hpp"
#include "tracks/track.hpp"
#include "utils/constants.hpp"
#include "utils/log.hpp"
/** Initialises the attachment each kart has.
*/

View File

@ -143,9 +143,9 @@ void Flyable::createPhysics(float forw_offset, const Vec3 &velocity,
// Just to get some additional information if the assert is triggered
if(isnan(v.getX()) || isnan(v.getY()) || isnan(v.getZ()))
{
printf("vel %f %f %f v %f %f %f\n",
velocity.getX(),velocity.getY(),velocity.getZ(),
v.getX(),v.getY(),v.getZ());
Log::debug("[Flyable]", "vel %f %f %f v %f %f %f",
velocity.getX(),velocity.getY(),velocity.getZ(),
v.getX(),v.getY(),v.getZ());
}
#endif
assert(!isnan(v.getX()));

View File

@ -97,8 +97,8 @@ void ItemManager::loadDefaultItemMeshes()
scene::IMesh *mesh = irr_driver->getAnimatedMesh(model_filename);
if(!node || model_filename.size()==0 || !mesh)
{
fprintf(stderr, "Item model '%s' in items.xml could not be loaded "
"- aborting", name.c_str());
Log::fatal("[ItemManager]", "Item model '%s' in items.xml could not be loaded "
"- aborting", name.c_str());
exit(-1);
}
mesh->grab();

View File

@ -34,8 +34,6 @@
#include "utils/constants.hpp"
#include "utils/string_utils.hpp"
#include "utils/log.hpp" //TODO: remove after debugging is done
// -----------------------------------------------------------------------------
Plunger::Plunger(AbstractKart *kart)
: Flyable(kart, PowerupManager::POWERUP_PLUNGER)

View File

@ -125,8 +125,8 @@ void PowerupManager::loadAllPowerups()
LoadPowerup(type, *node);
else
{
printf("Can't find item '%s' from powerup.xml, entry %d/\n",
name.c_str(), i+1);
Log::fatal("[PowerupManager]", "Can't find item '%s' from powerup.xml, entry %d/",
name.c_str(), i+1);
exit(-1);
}
}
@ -157,7 +157,7 @@ void PowerupManager::LoadPowerup(PowerupType type, const XMLNode &node)
#ifdef DEBUG
if (icon_file.size() == 0)
{
fprintf(stderr, "Cannot load powerup %i, no 'icon' attribute under XML node\n", type);
Log::debug("[PowerupManager]", "Cannot load powerup %i, no 'icon' attribute under XML node", type);
assert(false);
}
#endif
@ -221,8 +221,9 @@ void PowerupManager::loadWeights(const XMLNode &root,
if(!node || s=="" || s_multi=="")
{
printf("No weights found for class '%s' - probabilities will be incorrect.\n",
class_name.c_str());
Log::error("[PowerupManager]", "No weights found for class '%s'"
" - probabilities will be incorrect.",
class_name.c_str());
return;
}
@ -245,9 +246,9 @@ void PowerupManager::loadWeights(const XMLNode &root,
if(weight_list.size()!=2*(int)POWERUP_LAST)
{
printf("Incorrect number of weights found in class '%s':\n",
Log::error("[PowerupManager]", "Incorrect number of weights found in class '%s':",
class_name.c_str());
printf("%d instead of %d - probabilities will be incorrect.\n",
Log::error("[PowerupManager]", "%d instead of %d - probabilities will be incorrect.",
(int)weight_list.size(), (int)POWERUP_LAST);
return;
}

View File

@ -158,7 +158,7 @@ void RubberBall::computeTarget()
if(m_target==m_owner && m_delete_timer < 0)
{
#ifdef PRINT_BALL_REMOVE_INFO
Log::debug("RubberBall",
Log::debug("[RubberBall]",
"ball %d removed because owner is target.", m_id);
#endif
m_delete_timer = m_st_delete_time;
@ -171,7 +171,7 @@ void RubberBall::computeTarget()
// aim at the owner (the ball is unlikely to hit it), and
// this will trigger the usage of the delete time in updateAndDelete
#ifdef PRINT_BALL_REMOVE_INFO
Log::debug("RubberBall" "ball %d removed because no more active target.",
Log::debug("[RubberBall]" "ball %d removed because no more active target.",
m_id);
#endif
m_delete_timer = m_st_delete_time;
@ -312,7 +312,7 @@ bool RubberBall::updateAndDelete(float dt)
{
hit(NULL);
#ifdef PRINT_BALL_REMOVE_INFO
Log::debug("RubberBall", "ball %d deleted.", m_id);
Log::debug("[RubberBall]", "ball %d deleted.", m_id);
#endif
return true;
}
@ -355,7 +355,7 @@ bool RubberBall::updateAndDelete(float dt)
float new_y = getHoT()+height;
if(UserConfigParams::logFlyable())
printf("ball %d: %f %f %f height %f new_y %f gethot %f ",
Log::debug("[RubberBall]", "ball %d: %f %f %f height %f new_y %f gethot %f ",
m_id, next_xyz.getX(), next_xyz.getY(), next_xyz.getZ(), height, new_y, getHoT());
// No need to check for terrain height if the ball is low to the ground
@ -503,7 +503,7 @@ bool RubberBall::checkTunneling()
if(m_tunnel_count > 3)
{
#ifdef PRINT_BALL_REMOVE_INFO
Log::debug("RubberBall",
Log::debug("[RubberBall]",
"Ball %d nearly tunneled at %f %f %f -> %f %f %f",
m_id, m_previous_xyz.getX(),m_previous_xyz.getY(),
m_previous_xyz.getZ(),
@ -627,7 +627,7 @@ void RubberBall::updateDistanceToTarget()
m_distance_to_target += world->getTrack()->getTrackLength();
}
if(UserConfigParams::logFlyable())
printf("ball %d: target %f %f %f distance_2_target %f",
Log::debug("[RubberBall]", "ball %d: target %f %f %f distance_2_target %f",
m_id, m_target->getXYZ().getX(),m_target->getXYZ().getY(),
m_target->getXYZ().getZ(),m_distance_to_target
);
@ -657,7 +657,7 @@ void RubberBall::updateDistanceToTarget()
{
m_delete_timer = m_st_delete_time;
#ifdef PRINT_BALL_REMOVE_INFO
Log::debug("RubberBall", "ball %d lost target (overtook?).",
Log::debug("[RubberBall]", "ball %d lost target (overtook?).",
m_id);
#endif
@ -690,7 +690,7 @@ bool RubberBall::hit(AbstractKart* kart, PhysicalObject* object)
{
#ifdef PRINT_BALL_REMOVE_INFO
if(kart)
Log::debug("RuberBall", "ball %d hit kart.", m_id);
Log::debug("[RuberBall]", "ball %d hit kart.", m_id);
#endif
if(kart && kart!=m_target)
{