Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 31, 2010, 3:37:40 AM (14 years ago)
Author:
landauf
Message:

merged consolecommands3 branch back to trunk.

note: the console command interface has changed completely, but the documentation is not yet up to date. just copy an existing command and change it to your needs, it's pretty self-explanatory. also the include files related to console commands are now located in core/command/. in the game it should work exactly like before, except for some changes in the auto-completion.

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/network/Host.cc

    r7163 r7284  
    3232#include <string>
    3333
    34 #include "core/ConsoleCommand.h"
    3534#include "core/ObjectList.h"
     35#include "core/command/ConsoleCommand.h"
    3636#include "ChatListener.h"
    3737
    3838namespace orxonox {
    3939
    40   SetConsoleCommandShortcut(Host, Chat);
     40  static const std::string __CC_printRTT_name = "printRTT";
     41
     42  SetConsoleCommand("chat", &Host::Chat);
     43  SetConsoleCommand(__CC_printRTT_name, &Host::printRTT);
    4144
    4245  // Host*               Host::instance_=0;
     
    5255  //   assert(instance_==0);
    5356    instances_s.push_back(this);
    54     this->printRTTCC_ = createConsoleCommand( createFunctor(&Host::printRTT, this), "printRTT" );
    55     CommandExecutor::addConsoleCommandShortcut( this->printRTTCC_ );
     57    ModifyConsoleCommand(__CC_printRTT_name).setObject(this);
    5658    this->bIsActive_ = false;
    5759  }
     
    6567    assert( std::find( instances_s.begin(), instances_s.end(), this )!=instances_s.end() );
    6668    instances_s.erase(std::find( instances_s.begin(), instances_s.end(), this ));
    67     if( this->printRTTCC_ )
    68       delete this->printRTTCC_;
     69    ModifyConsoleCommand(__CC_printRTT_name).setObject(0);
    6970  }
    7071
     
    8990  }
    9091
    91   bool Host::Chat(const std::string& message)
     92  void Host::Chat(const std::string& message)
    9293  {
    9394    if(instances_s.size()==0)
     
    9596      for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
    9697        it->incomingChat(message, 0);
    97       return true;
     98//      return true;
    9899    }
    99100    else
     
    108109        }
    109110      }
    110       return result;
     111//      return result;
    111112    }
    112113  }
     
    139140    for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
    140141      it->incomingChat(message, playerID);
    141    
     142
    142143    bool result = true;
    143144    for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
Note: See TracChangeset for help on using the changeset viewer.