Use minimum size for uid of rewinder
This commit is contained in:
@@ -39,7 +39,7 @@ void NetworkItemManager::create()
|
||||
/** Creates a new instance of the item manager. This is done at startup
|
||||
* of each race. */
|
||||
NetworkItemManager::NetworkItemManager()
|
||||
: Rewinder("nim", /*can be deleted*/false),
|
||||
: Rewinder("N", /*can be deleted*/false),
|
||||
ItemManager()
|
||||
{
|
||||
m_last_confirmed_item_ticks.clear();
|
||||
|
||||
@@ -38,7 +38,7 @@ KartRewinder::KartRewinder(const std::string& ident,
|
||||
const btTransform& init_transform,
|
||||
PerPlayerDifficulty difficulty,
|
||||
std::shared_ptr<RenderInfo> ri)
|
||||
: Rewinder(ident + StringUtils::toString(world_kart_id),
|
||||
: Rewinder(std::string("K") + StringUtils::toString(world_kart_id),
|
||||
/*can_be_destroyed*/ false)
|
||||
, Kart(ident, world_kart_id, position, init_transform, difficulty,
|
||||
ri)
|
||||
|
||||
@@ -29,8 +29,11 @@ class Rewinder
|
||||
{
|
||||
protected:
|
||||
void add();
|
||||
// -------------------------------------------------------------------------
|
||||
void setUniqueIdentity(const std::string& uid) { m_unique_identity = uid; }
|
||||
|
||||
private:
|
||||
const std::string m_unique_identity;
|
||||
std::string m_unique_identity;
|
||||
|
||||
/** True if this object can be destroyed, i.e. if this object is a 'stand
|
||||
* alone' (i.e. not used in inheritance). If the object is used in
|
||||
|
||||
@@ -136,10 +136,7 @@ PhysicalObject* PhysicalObject::fromXML(bool is_dynamic,
|
||||
PhysicalObject::PhysicalObject(bool is_dynamic,
|
||||
const PhysicalObject::Settings& settings,
|
||||
TrackObject* object)
|
||||
: Rewinder(settings.m_id +
|
||||
(object->getParentLibrary() ?
|
||||
object->getParentLibrary()->getID() : "") ,
|
||||
false/*can_be_destroyed*/, false/*auto_add*/)
|
||||
: Rewinder("P", false/*can_be_destroyed*/, false/*auto_add*/)
|
||||
{
|
||||
m_shape = NULL;
|
||||
m_body = NULL;
|
||||
@@ -787,6 +784,8 @@ void PhysicalObject::hit(const Material *m, const Vec3 &normal)
|
||||
// ----------------------------------------------------------------------------
|
||||
void PhysicalObject::addForRewind()
|
||||
{
|
||||
Rewinder::setUniqueIdentity(std::string("P") + StringUtils::toString
|
||||
(Track::getCurrentTrack()->getPhysicalObjectUID()));
|
||||
Rewinder::add();
|
||||
} // addForRewind
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ Track::Track(const std::string &filename)
|
||||
m_clouds = false;
|
||||
m_godrays = false;
|
||||
m_displacement_speed = 1.0f;
|
||||
m_caustics_speed = 1.0f;
|
||||
m_physical_object_uid = 0;
|
||||
m_shadows = true;
|
||||
m_sky_particles = NULL;
|
||||
m_sky_dx = 0.05f;
|
||||
@@ -291,6 +291,7 @@ void Track::reset()
|
||||
*/
|
||||
void Track::cleanup()
|
||||
{
|
||||
m_physical_object_uid = 0;
|
||||
#ifdef USE_RESIZE_CACHE
|
||||
if (!UserConfigParams::m_high_definition_textures)
|
||||
{
|
||||
@@ -556,7 +557,6 @@ void Track::loadTrackInfo()
|
||||
root->get("shadows", &m_shadows);
|
||||
root->get("is-during-day", &m_is_day);
|
||||
root->get("displacement-speed", &m_displacement_speed);
|
||||
root->get("caustics-speed", &m_caustics_speed);
|
||||
root->get("color-level-in", &m_color_inlevel);
|
||||
root->get("color-level-out", &m_color_outlevel);
|
||||
|
||||
|
||||
@@ -363,7 +363,7 @@ private:
|
||||
bool m_shadows;
|
||||
|
||||
float m_displacement_speed;
|
||||
float m_caustics_speed;
|
||||
int m_physical_object_uid;
|
||||
|
||||
/** The levels for color correction
|
||||
* m_color_inlevel(black, gamma, white)
|
||||
@@ -662,7 +662,7 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
float getDisplacementSpeed() const { return m_displacement_speed; }
|
||||
// ------------------------------------------------------------------------
|
||||
float getCausticsSpeed() const { return m_caustics_speed; }
|
||||
int getPhysicalObjectUID() { return m_physical_object_uid++; }
|
||||
// ------------------------------------------------------------------------
|
||||
const int getDefaultNumberOfLaps() const { return m_default_number_of_laps;}
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user