Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2422


Ignore:
Timestamp:
Dec 13, 2008, 2:55:13 PM (16 years ago)
Author:
landauf
Message:
  • deatheffect (explosion) of Pawns works on client and server (creator of the effects can't be the Pawn itself because it will be destroyed on the client before synchronizing the effects)
  • fixed a small initialization error in Shader
  • fixed a bug in the resynchronization of already deleted MovableEntities
  • ExplosionChunk only recalculates it's velocity on the Master
Location:
code/branches/objecthierarchy2/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy2/src/network/Synchronisable.cc

    r2171 r2422  
    8585    for(it = ObjectList<Synchronisable>::begin(); it!=ObjectList<Synchronisable>::end(); ++it){
    8686      if( it->getObjectID()==this->objectID )
    87         assert(*it==this || (it->objectID==OBJECTID_UNKNOWN && it->objectMode_==0x0));
     87        if(!(*it==this || (it->objectID==OBJECTID_UNKNOWN && it->objectMode_==0x0)))
     88        {
     89            COUT(1) << "Assertion failed: *it==this || (it->objectID==OBJECTID_UNKNOWN && it->objectMode_==0x0)" << std::endl;
     90            COUT(1) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << std::endl;
     91            abort();
     92        }
    8893    }
    8994#endif
     
    177182
    178183    Identifier* id = ClassByID(header->classID);
     184    if (!id)
     185    {
     186        COUT(1) << "Assertion failed: id" << std::endl;
     187        COUT(1) << "Possible reason for this error: Client received a synchronizable object whose class has no factory." << std::endl;
     188        abort();
     189    }
    179190    assert(id);
    180191    BaseObject* creator = 0;
  • code/branches/objecthierarchy2/src/orxonox/OrxonoxPrereqs.h

    r2369 r2422  
    114114    class Billboard;
    115115    class BlinkingBillboard;
     116    class ExplosionChunk;
    116117    class FadingBillboard;
    117118    class GlobalShader;
     
    158159    class HumanPlayer;
    159160    class Bot;
     161    class GametypeInfo;
    160162
    161163    class Gametype;
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/ExplosionChunk.cc

    r2414 r2422  
    3030#include "ExplosionChunk.h"
    3131
     32#include "core/Core.h"
    3233#include "core/CoreIncludes.h"
    3334#include "core/Executor.h"
     
    4748            ThrowException(AbortLoading, "Can't create ExplosionChunk, no scene or no scene manager given.");
    4849
     50        this->bStop_ = false;
    4951        this->LOD_ = LODParticle::normal;
    5052
     
    6365        }
    6466
    65         Vector3 velocity(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1));
    66         velocity.normalise();
    67         velocity *= rnd(40, 60);
    68         this->setVelocity(velocity);
     67        if (Core::isMaster())
     68        {
     69            Vector3 velocity(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1));
     70            velocity.normalise();
     71            velocity *= rnd(60, 80);
     72            this->setVelocity(velocity);
    6973
    70         this->destroyTimer_.setTimer(rnd(1, 2), false, this, createExecutor(createFunctor(&ExplosionChunk::stop)));
     74            this->destroyTimer_.setTimer(rnd(1, 2), false, this, createExecutor(createFunctor(&ExplosionChunk::stop)));
     75        }
    7176
    7277        this->registerVariables();
     
    8691    void ExplosionChunk::registerVariables()
    8792    {
    88         REGISTERDATA(this->LOD_, direction::toclient, new NetworkCallback<ExplosionChunk>(this, &ExplosionChunk::LODchanged));
     93        REGISTERDATA(this->LOD_,   direction::toclient, new NetworkCallback<ExplosionChunk>(this, &ExplosionChunk::LODchanged));
     94        REGISTERDATA(this->bStop_, direction::toclient, new NetworkCallback<ExplosionChunk>(this, &ExplosionChunk::checkStop));
    8995    }
    9096
     
    97103    }
    98104
     105    void ExplosionChunk::checkStop()
     106    {
     107        if (this->bStop_)
     108            this->stop();
     109    }
     110
    99111    void ExplosionChunk::stop()
    100112    {
     
    104116            this->smoke_->setEnabled(false);
    105117
    106         this->destroyTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&ExplosionChunk::destroy)));
     118        if (Core::isMaster())
     119        {
     120            this->bStop_ = true;
     121            this->destroyTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&ExplosionChunk::destroy)));
     122        }
    107123    }
    108124
     
    116132        static const unsigned int CHANGES_PER_SECOND = 5;
    117133
    118         if (rnd() < dt*CHANGES_PER_SECOND)
     134        if (Core::isMaster() && rnd() < dt*CHANGES_PER_SECOND)
    119135        {
    120136            float length = this->getVelocity().length();
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/ExplosionChunk.h

    r2414 r2422  
    5353        private:
    5454            void LODchanged();
     55            void checkStop();
    5556            void stop();
    5657            void destroy();
    5758
     59            bool                  bStop_;
    5860            ParticleInterface*    fire_;
    5961            ParticleInterface*    smoke_;
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/MovableEntity.cc

    r2361 r2422  
    3333#include "core/XMLPort.h"
    3434#include "core/Executor.h"
    35 #include "tools/Timer.h"
    3635
    3736namespace orxonox
     
    112111    void MovableEntity::clientConnected(unsigned int clientID)
    113112    {
    114         new Timer<MovableEntity>(rnd() * MAX_RESYNCHRONIZE_TIME, false, this, createExecutor(createFunctor(&MovableEntity::resynchronize)), true);
     113        this->resynchronizeTimer_.setTimer(rnd() * MAX_RESYNCHRONIZE_TIME, false, this, createExecutor(createFunctor(&MovableEntity::resynchronize)));
    115114    }
    116115
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/MovableEntity.h

    r2171 r2422  
    3535#include "objects/Tickable.h"
    3636#include "network/ClientConnectionListener.h"
     37#include "tools/Timer.h"
    3738
    3839namespace orxonox
     
    119120            Vector3 overwrite_position_;
    120121            Quaternion overwrite_orientation_;
     122
     123            Timer<MovableEntity> resynchronizeTimer_;
    121124    };
    122125}
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/pawns/Pawn.cc

    r2414 r2422  
    3030#include "Pawn.h"
    3131
     32#include "core/Core.h"
    3233#include "core/CoreIncludes.h"
    3334#include "core/XMLPort.h"
     
    145146        if (this->spawnparticlesource_ != "")
    146147        {
    147             ParticleSpawner* effect = new ParticleSpawner(this);
     148            ParticleSpawner* effect = new ParticleSpawner(this->getCreator());
    148149            effect->setPosition(this->getPosition());
    149150            effect->setOrientation(this->getOrientation());
     
    167168            this->getPlayer()->stopControl(this);
    168169
    169         this->deatheffect();
     170        if (Core::isMaster())
     171            this->deatheffect();
    170172    }
    171173
     
    174176        // play death effect
    175177        {
    176             ParticleSpawner* effect = new ParticleSpawner(this);
     178            ParticleSpawner* effect = new ParticleSpawner(this->getCreator());
    177179            effect->setPosition(this->getPosition());
    178180            effect->setOrientation(this->getOrientation());
     
    182184        }
    183185        {
    184             ParticleSpawner* effect = new ParticleSpawner(this);
     186            ParticleSpawner* effect = new ParticleSpawner(this->getCreator());
    185187            effect->setPosition(this->getPosition());
    186188            effect->setOrientation(this->getOrientation());
     
    190192        }
    191193        {
    192             ParticleSpawner* effect = new ParticleSpawner(this);
     194            ParticleSpawner* effect = new ParticleSpawner(this->getCreator());
    193195            effect->setPosition(this->getPosition());
    194196            effect->setOrientation(this->getOrientation());
     
    199201        for (unsigned int i = 0; i < this->numexplosionchunks_; ++i)
    200202        {
    201             ExplosionChunk* chunk = new ExplosionChunk(this);
     203            ExplosionChunk* chunk = new ExplosionChunk(this->getCreator());
    202204            chunk->setPosition(this->getPosition());
    203205
     
    214216    {
    215217        this->setHealth(this->initialHealth_);
    216         this->spawneffect();
     218        if (Core::isMaster())
     219            this->spawneffect();
    217220    }
    218221
  • code/branches/objecthierarchy2/src/orxonox/objects/worldentities/pawns/Spectator.cc

    r2362 r2422  
    6262
    6363        this->greetingFlare_ = new BillboardSet();
    64         this->greetingFlare_->setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(1.0, 1.0, 0.8), Vector3(0, 20, 0), 1);
     64        this->greetingFlare_->setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(1.0, 1.0, 0.8), Vector3(0, 0, 0), 1);
    6565        if (this->greetingFlare_->getBillboardSet())
    6666            this->getNode()->attachObject(this->greetingFlare_->getBillboardSet());
  • code/branches/objecthierarchy2/src/orxonox/tools/Shader.cc

    r2396 r2422  
    5252    Shader::MaterialMap Shader::parameters_s;
    5353
    54     Shader::Shader(Ogre::SceneManager* scenemanager)
     54    Shader::Shader(Ogre::SceneManager* scenemanager) : compositorInstance_(0)
    5555    {
    5656        RegisterObject(Shader);
Note: See TracChangeset for help on using the changeset viewer.