Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 31, 2010, 4:42:57 AM (14 years ago)
Author:
landauf
Message:

merged dynamicmatch to presentation3

Location:
code/branches/presentation3
Files:
7 edited
2 copied

Legend:

Unmodified
Added
Removed
  • code/branches/presentation3

  • code/branches/presentation3/src/orxonox/OrxonoxPrereqs.h

    r6524 r7031  
    9090    class Asteroids;
    9191    class Deathmatch;
     92    class Dynamicmatch;
    9293    class Gametype;
    9394    class TeamBaseMatch;
  • code/branches/presentation3/src/orxonox/controllers/ArtificialController.cc

    r6502 r7031  
    3434#include "worldentities/pawns/TeamBaseMatchBase.h"
    3535#include "gametypes/TeamDeathmatch.h"
     36#include "gametypes/Dynamicmatch.h"
    3637#include "controllers/WaypointPatrolController.h"
    3738
     
    245246        }
    246247
     248        Dynamicmatch* dynamic = orxonox_cast<Dynamicmatch*>(gametype);
     249        if (dynamic)
     250        {
     251            if (dynamic->notEnoughPigs||dynamic->notEnoughKillers||dynamic->notEnoughChasers) {return false;}
     252
     253            if (entity1->getPlayer())
     254                team1 = dynamic->getParty(entity1->getPlayer());
     255
     256            if (entity2->getPlayer())
     257                team2 = dynamic->getParty(entity2->getPlayer());
     258
     259            if (team1 ==-1 ||team2 ==-1 ) {return false;}
     260            else if (team1 == dynamic->chaser && team2 != dynamic->chaser) {return false;}
     261            else if (team1 == dynamic->piggy && team2 == dynamic->chaser) {return false;}
     262            else if (team1 == dynamic->killer && team2 == dynamic->chaser) {return false;}
     263            else return true;
     264        }
     265
    247266        return (team1 == team2 && team1 != -1);
    248267    }
  • code/branches/presentation3/src/orxonox/gametypes/CMakeLists.txt

    r5781 r7031  
    66  UnderAttack.cc
    77  Asteroids.cc
     8  Dynamicmatch.cc
    89)
  • code/branches/presentation3/src/orxonox/infos/GametypeInfo.cc

    r5781 r7031  
    4242    registerMemberNetworkFunction(GametypeInfo, dispatchKillMessage);
    4343    registerMemberNetworkFunction(GametypeInfo, dispatchDeathMessage);
     44    registerMemberNetworkFunction(GametypeInfo, dispatchStaticMessage);
     45    registerMemberNetworkFunction(GametypeInfo, dispatchFadingMessage);
    4446
    4547    GametypeInfo::GametypeInfo(BaseObject* creator) : Info(creator)
     
    110112    }
    111113
     114    void GametypeInfo::sendStaticMessage(const std::string& message, unsigned int clientID)
     115    {
     116        if (GameMode::isMaster())
     117        {
     118            if (clientID == CLIENTID_SERVER)
     119                this->dispatchStaticMessage(message);
     120            else
     121                callMemberNetworkFunction(GametypeInfo, dispatchStaticMessage, this->getObjectID(), clientID, message);
     122        }
     123    }
     124
     125    void GametypeInfo::sendFadingMessage(const std::string& message, unsigned int clientID)
     126    {
     127        if (GameMode::isMaster())
     128        {
     129            if (clientID == CLIENTID_SERVER)
     130                this->dispatchFadingMessage(message);
     131            else
     132                callMemberNetworkFunction(GametypeInfo, dispatchFadingMessage, this->getObjectID(), clientID, message);
     133        }
     134    }
     135
    112136    void GametypeInfo::dispatchAnnounceMessage(const std::string& message)
    113137    {
     
    127151            it->deathmessage(this, message);
    128152    }
     153
     154     void GametypeInfo::dispatchStaticMessage(const std::string& message)
     155    {
     156        for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)
     157            it->staticmessage(this, message);
     158    }
     159   
     160     void GametypeInfo::dispatchFadingMessage(const std::string& message)
     161    {
     162        for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)
     163            it->fadingmessage(this, message);
     164    }
    129165}
  • code/branches/presentation3/src/orxonox/infos/GametypeInfo.h

    r5781 r7031  
    6464            void sendKillMessage(const std::string& message, unsigned int clientID);
    6565            void sendDeathMessage(const std::string& message, unsigned int clientID);
     66            void sendStaticMessage(const std::string& message, unsigned int clientID);
     67            void sendFadingMessage(const std::string& message, unsigned int clientID);
    6668
    6769            void dispatchAnnounceMessage(const std::string& message);
    6870            void dispatchKillMessage(const std::string& message);
    6971            void dispatchDeathMessage(const std::string& message);
     72            void dispatchStaticMessage(const std::string& message);
     73            void dispatchFadingMessage(const std::string& message);
    7074
    7175        private:
  • code/branches/presentation3/src/orxonox/interfaces/GametypeMessageListener.h

    r5781 r7031  
    4444            virtual void killmessage(const GametypeInfo* gtinfo, const std::string& message) {}
    4545            virtual void deathmessage(const GametypeInfo* gtinfo, const std::string& message) {}
     46            virtual void staticmessage(const GametypeInfo* gtinfo, const std::string& message) {}
     47            virtual void fadingmessage(const GametypeInfo* gtinfo, const std::string& message) {}
    4648    };
    4749}
Note: See TracChangeset for help on using the changeset viewer.