Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8822


Ignore:
Timestamp:
Aug 4, 2011, 12:45:06 AM (13 years ago)
Author:
landauf
Message:

Chat works again
Removed console output for almost all gameplay messages (use chat/notifications instead)
Deathmatch level now actually uses Deathmatch gametype

Location:
code/branches/output
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • code/branches/output/data/levels/presentationDM.oxw

    r8706 r8822  
    1616 name         = "Presentation"
    1717 description  = "A simple testlevel"
     18 gametype     = Deathmatch
    1819>
    1920  <templates>
  • code/branches/output/src/libraries/network/Host.cc

    r8408 r8822  
    9191  void Host::Chat(const std::string& message)
    9292  {
    93     if(instances_s.size()==0)
     93    for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
     94      it->incomingChat(message, 0);
     95
     96    bool result = true;
     97    for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
    9498    {
    95       for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
    96         it->incomingChat(message, 0);
    97 //      return true;
     99      if( (*it)->isActive() )
     100      {
     101        if( !(*it)->chat(message) )
     102          result = false;
     103      }
    98104    }
    99     else
    100     {
    101       bool result = true;
    102       for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
    103       {
    104         if( (*it)->isActive() )
    105         {
    106           if( !(*it)->chat(message) )
    107             result = false;
    108         }
    109       }
    110 //      return result;
    111     }
     105//    return result;
    112106  }
    113107
    114108  bool Host::Broadcast(const std::string& message)
    115109  {
    116     if(instances_s.size()==0)
     110    for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
     111      it->incomingChat(message, NETWORK_PEER_ID_BROADCAST);
     112
     113    bool result = true;
     114    for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
    117115    {
    118       for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
    119         it->incomingChat(message, NETWORK_PEER_ID_BROADCAST);
    120       return true;
     116      if( (*it)->isActive() )
     117      {
     118        if( !(*it)->broadcast(message) )
     119          result = false;
     120      }
    121121    }
    122     else
    123     {
    124       bool result = true;
    125       for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
    126       {
    127         if( (*it)->isActive() )
    128         {
    129           if( !(*it)->broadcast(message) )
    130             result = false;
    131         }
    132       }
    133       return result;
    134     }
     122    return result;
    135123  }
    136124
     
    161149    return false;
    162150  }
    163  
     151
    164152  Host* Host::getActiveInstance()
    165153  {
  • code/branches/output/src/modules/gametypes/RaceCheckPoint.cc

    r8811 r8822  
    2929#include "RaceCheckPoint.h"
    3030
     31#include "util/Convert.h"
    3132#include "core/CoreIncludes.h"
    3233#include "core/XMLPort.h"
     34#include "network/Host.h"
    3335#include "SpaceRace.h"
    34 #include "util/Convert.h"
    3536
    3637namespace orxonox
    3738{
    3839    CreateFactory(RaceCheckPoint);
    39    
     40
    4041    RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this))
    4142    {
     
    5051        this->setRadarVisibility(false);
    5152    }
    52    
     53
    5354    RaceCheckPoint::~RaceCheckPoint()
    5455    {
    5556    }
    56    
     57
    5758    void RaceCheckPoint::tick(float dt)
    5859    {
     
    6667    }
    6768
    68    
     69
    6970    void RaceCheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    7071    {
     
    7576        XMLPortParam(RaceCheckPoint, "timelimit", setTimelimit, getTimeLimit, xmlelement, mode).defaultValues(0);
    7677    }
    77    
     78
    7879    void RaceCheckPoint::triggered(bool bIsTriggered)
    7980    {
     
    99100        }
    100101    }
    101    
     102
    102103    void RaceCheckPoint::setTimelimit(float timeLimit)
    103104    {
     
    110111                const std::string& message =  "You have " + multi_cast<std::string>(this->bTimeLimit_)
    111112                            + " seconds to reach the check point " + multi_cast<std::string>(this->bCheckpointIndex_+1);
    112                 orxout(level::message) << message << endl;
    113113                const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage(message);
     114                Host::Broadcast(message);
    114115            }
    115116        }
    116117    }
    117    
     118
    118119}
  • code/branches/output/src/modules/gametypes/SpaceRace.cc

    r8811 r8822  
    3838{
    3939    CreateUnloadableFactory(SpaceRace);
    40    
     40
    4141    SpaceRace::SpaceRace(BaseObject* creator) : Gametype(creator)
    4242    {
     
    4646        this->numberOfBots_ = 0;
    4747    }
    48    
     48
    4949    void SpaceRace::end()
    5050    {
    5151        this->Gametype::end();
    52          
     52
    5353        if (this->bTimeIsUp_)
    5454        {
     
    5959                        + "You didn't reach the check point " + multi_cast<std::string>(this->bCheckpointsReached_+1)
    6060                        + " before the time limit. You lose!";
    61             orxout(level::message) << message << endl;
    6261            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
    6362            Host::Broadcast(message);
     
    7069            const std::string& message = "You win!! You have reached the last check point after "+ multi_cast<std::string>(s)
    7170                        + "." + multi_cast<std::string>(ms) + " seconds.";
    72             orxout(level::message) << message << endl;
    7371            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
    7472            Host::Broadcast(message);
     73/*
    7574            float time = this->clock_.getSecondsPrecise();
    7675            this->scores_.insert(time);
    7776            std::set<float>::iterator it;
    7877            for (it=this->scores_.begin(); it!=this->scores_.end(); it++)
    79             orxout(level::message) << multi_cast<std::string>(*it) << endl;
     78                orxout(level::message) << multi_cast<std::string>(*it) << endl;
     79*/
    8080        }
    8181    }
     
    8686
    8787        std::string message("The match has started! Reach the check points as quickly as possible!");
    88         orxout(level::message) << message << endl;
    8988        Host::Broadcast(message);
    9089    }
    91    
     90
    9291    void SpaceRace::newCheckpointReached()
    9392    {
     
    9998                        + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms)
    10099                        + " seconds.";
    101         orxout(level::message) << message << endl;
    102100        const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
    103101        Host::Broadcast(message);
  • code/branches/output/src/modules/overlays/hud/ChatOverlay.cc

    r8811 r8822  
    8787
    8888        this->messages_.push_back(multi_cast<Ogre::DisplayString>(text));
    89         orxout(level::message) << "Chat: " << text << endl;
    9089
    9190        Timer* timer = new Timer();
  • code/branches/output/src/orxonox/gametypes/Asteroids.cc

    r8809 r8822  
    7474
    7575        std::string message("The match has started! Reach the first chekpoint within 15 seconds! But be aware, there may be pirates around...");
    76         orxout(level::message) << message << endl;
    7776        Host::Broadcast(message);
    7877
     
    8483
    8584        std::string message("The match has ended.");
    86         orxout(level::message) << message << endl;
    8785        Host::Broadcast(message);
    8886    }
  • code/branches/output/src/orxonox/gametypes/Deathmatch.cc

    r8809 r8822  
    4848
    4949        std::string message("The match has started!");
    50         orxout(level::message) << message << endl;
    5150        Host::Broadcast(message);
    5251    }
     
    5756
    5857        std::string message("The match has ended.");
    59         orxout(level::message) << message << endl;
    6058        Host::Broadcast(message);
    6159    }
     
    6664
    6765        const std::string& message = player->getName() + " entered the game";
    68         orxout(level::message) << message << endl;
    6966        Host::Broadcast(message);
    7067    }
     
    7774        {
    7875            const std::string& message = player->getName() + " left the game";
    79             orxout(level::message) << message << endl;
    8076            Host::Broadcast(message);
    8177        }
     
    9187        {
    9288            const std::string& message = player->getOldName() + " changed name to " + player->getName();
    93             orxout(level::message) << message << endl;
    9489            Host::Broadcast(message);
    9590        }
     
    113108                message = victim->getPlayer()->getName() + " died";
    114109
    115             orxout(level::message) << message << endl;
    116110            Host::Broadcast(message);
    117111        }
     
    127121        {
    128122            const std::string& message = player->getName() + " scores!";
    129             orxout(level::message) << message << endl;
    130123            Host::Broadcast(message);
    131124        }
  • code/branches/output/src/orxonox/gametypes/Dynamicmatch.cc

    r8809 r8822  
    343343        Gametype::playerEntered(player);
    344344        const std::string& message = player->getName() + " entered the game";
    345         orxout(level::message) << message << endl;
    346345        Host::Broadcast(message);
    347346    }
     
    359358            }
    360359            const std::string& message = player->getName() + " left the game";
    361             orxout(level::message) << message << endl;
    362360            Host::Broadcast(message);
    363361            //remove player from map
     
    617615        {
    618616            const std::string& message = player->getOldName() + " changed name to " + player->getName();
    619             orxout(level::message) << message << endl;
    620617            Host::Broadcast(message);
    621618        }
     
    630627        {
    631628            std::string message("Dynamicmatch started!");
    632             orxout(level::message) << message << endl;
    633629            Host::Broadcast(message);
    634630        }
     
    647643    {
    648644        std::string message("Earn points:\n\n\n\tIf you're red: Chase the blue player!\n\n\tIf you're blue shoot at a red player or hide.\n\n\tIf you're green: You've got the licence to kill red players!");
    649         orxout(level::message) << message << endl;
    650645        Host::Broadcast(message);
    651646        callInstructions_.setTimer(10, false, createExecutor(createFunctor(&Dynamicmatch::furtherInstructions, this)));
     
    655650    {
    656651        std::string message("After 3 Minutes the game is over.");
    657         orxout(level::message) << message << endl;
    658652        Host::Broadcast(message);
    659653    }*/
     
    663657
    664658        std::string message("Time out. Press F2 to see the points you scored.");
    665         orxout(level::message) << message << endl;
    666659        Host::Broadcast(message);
    667660    }
  • code/branches/output/src/orxonox/gametypes/LastManStanding.cc

    r8809 r8822  
    9090                const std::string& message = ""; // resets Camper-Warning-message
    9191                this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
    92             }   
     92            }
    9393        }
    9494        return true;
     
    105105            this->playersAlive--;
    106106            const std::string& message = victim->getPlayer()->getName() + " has lost all lives";
    107             orxout(level::message) << message << endl;
    108107            Host::Broadcast(message);
    109108        }
     
    128127    {
    129128        Gametype::end();
    130        
     129
    131130        for (std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)
    132131        {
     
    148147            return 0;
    149148    }
    150    
     149
    151150    int LastManStanding::getNumPlayersAlive() const
    152151    {
     
    190189        this->timeToAct_[player]=timeRemaining+3.0f+respawnDelay;//reset timer
    191190        this->playerDelayTime_[player]=respawnDelay;
    192        
     191
    193192        std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
    194193        if (it != this->players_.end())
     
    198197            const std::string& message = ""; // resets Camper-Warning-message
    199198            this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
    200         } 
     199        }
    201200    }
    202201
     
    239238            }
    240239            for (std::map<PlayerInfo*, float>::iterator it = this->timeToAct_.begin(); it != this->timeToAct_.end(); ++it)
    241             {   
     240            {
    242241                if (playerGetLives(it->first)<=0)//Players without lives shouldn't be affected by time.
    243                     continue;     
     242                    continue;
    244243                it->second-=dt;//Decreases punishment time.
    245                 if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up. 
     244                if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.
    246245                {
    247246                    playerDelayTime_[it->first]-=dt;
  • code/branches/output/src/orxonox/gametypes/LastTeamStanding.cc

    r8809 r8822  
    119119                this->teamsAlive--;
    120120            const std::string& message = victim->getPlayer()->getName() + " has lost all lives";
    121             orxout(level::message) << message << endl;
    122121            Host::Broadcast(message);
    123122        }
  • code/branches/output/src/orxonox/gametypes/UnderAttack.cc

    r8809 r8822  
    7070        this->end(); //end gametype
    7171        std::string message("Ship destroyed! Team 0 has won!");
    72         orxout(level::message) << message << endl;
    7372        Host::Broadcast(message);
    7473        this->gameEnded_ = true;
     
    153152                this->end();
    154153                std::string message("Time is up! Team 1 has won!");
    155                 orxout(level::message) << message << endl;
    156154                Host::Broadcast(message);
    157155
     
    173171                const std::string& message = multi_cast<std::string>(timesequence_) + " seconds left!";
    174172/*
    175                 orxout(level::message) << message << endl;
    176173                Host::Broadcast(message);
    177174*/
Note: See TracChangeset for help on using the changeset viewer.