Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 18, 2009, 6:23:31 PM (15 years ago)
Author:
rgrieder
Message:

Merged netp6 branch back to the trunk.

Location:
code/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/gamestates/GSDedicated.cc

    r3301 r3304  
    4242#include <boost/bind.hpp>
    4343
    44 #ifndef ORXONOX_PLATFORM_WINDOWS
     44#ifdef ORXONOX_PLATFORM_UNIX
    4545#include <termios.h>
    4646#endif
     
    5858        : GameState(params)
    5959        , server_(0)
    60         , timeSinceLastUpdate_(0)
    6160        , closeThread_(false)
    6261        , cleanLine_(true)
     
    6564        , cursorY_(0)
    6665    {
    67         this->commandLine_ = new unsigned char[MAX_COMMAND_LENGTH];
    68 //         memset( this->commandLine_, 0, MAX_COMMAND_LENGTH );
    6966    }
    7067
     
    9693       
    9794        closeThread_ = true;
    98 #ifndef ORXONOX_PLATFORM_WINDOWS
     95#ifdef ORXONOX_PLATFORM_UNIX
    9996        std::cout << "\033[0G\033[K";
    10097        std::cout.flush();
     
    10299        delete this->originalTerminalSettings_;
    103100#endif
    104         //inputThread_->join();
     101        COUT(0) << "Press enter to end the game..." << std::endl;
     102        inputThread_->join();
     103        delete this->inputThread_;
    105104
    106105        GameMode::setHasServer(false);
     
    109108    void GSDedicated::update(const Clock& time)
    110109    {
    111         timeSinceLastUpdate_ += time.getDeltaTime();
    112         if (timeSinceLastUpdate_ >= NETWORK_PERIOD)
    113         {
    114             timeSinceLastUpdate_ -= static_cast<unsigned int>(timeSinceLastUpdate_ / NETWORK_PERIOD) * NETWORK_PERIOD;
    115             server_->update(time);
    116         }
    117         else
    118         {
    119             msleep(static_cast<unsigned int>((NETWORK_PERIOD - timeSinceLastUpdate_)*1000));
    120             msleep(static_cast<unsigned int>(NETWORK_PERIOD*1000)); // NOTE: this is to throttle the non-network framerate
    121 //            COUT(0) << "sleeping for " << static_cast<int>((NETWORK_PERIOD - timeSinceLastUpdate_) * 1000 * 1000) << " usec" << endl;
    122         }
     110        server_->update(time);
    123111        processQueue();
    124112        printLine();
     
    127115    void GSDedicated::inputThread()
    128116    {
     117        this->commandLine_ = new unsigned char[MAX_COMMAND_LENGTH];
     118//         memset( this->commandLine_, 0, MAX_COMMAND_LENGTH );
    129119        unsigned char c;
    130120        unsigned int  escapeChar=0;
     
    194184                            std::cout << endl << CommandExecutor::hint( std::string((const char*)this->commandLine_,inputIterator_) ) << endl;
    195185                            strncpy(reinterpret_cast<char*>(this->commandLine_), CommandExecutor::complete( std::string(reinterpret_cast<char*>(this->commandLine_),inputIterator_) ).c_str(), MAX_COMMAND_LENGTH);
    196                             inputIterator_ = strlen((const char*)this->commandLine_);
     186                            this->inputIterator_ = strlen((const char*)this->commandLine_);
     187                            this->cursorX_ = this->inputIterator_;
    197188                            break;
    198189                        }
     
    207198            }
    208199        }
     200
     201        delete[] this->commandLine_;
    209202    }
    210203   
    211204    void GSDedicated::printLine()
    212205    {
    213 #ifndef ORXONOX_PLATFORM_WINDOWS
     206#ifdef ORXONOX_PLATFORM_UNIX
    214207        // set cursor to the begining of the line and erase the line
    215208        std::cout << "\033[0G\033[K";
     
    251244    void GSDedicated::setTerminalMode()
    252245    {
    253 #ifndef ORXONOX_PLATFORM_WINDOWS
     246#ifdef ORXONOX_PLATFORM_UNIX
    254247        termios new_settings;
    255248     
     
    268261    void GSDedicated::resetTerminalMode()
    269262    {
    270 #ifndef ORXONOX_PLATFORM_WINDOWS
     263#ifdef ORXONOX_PLATFORM_UNIX
    271264        tcsetattr(0, TCSANOW, GSDedicated::originalTerminalSettings_);
    272265#endif
  • code/trunk/src/orxonox/gamestates/GSDedicated.h

    r3280 r3304  
    6666       
    6767        Server*                 server_;
    68         float                   timeSinceLastUpdate_;
    6968       
    7069        boost::thread           *inputThread_;
  • code/trunk/src/orxonox/gamestates/GSRoot.cc

    r3280 r3304  
    3434#include "core/Game.h"
    3535#include "core/GameMode.h"
     36#include "network/NetworkFunction.h"
    3637#include "tools/Timer.h"
    3738#include "interfaces/TimeFactorListener.h"
     
    6162    GSRoot::~GSRoot()
    6263    {
     64        NetworkFunctionBase::destroyAllNetworkFunctions();
    6365    }
    6466
Note: See TracChangeset for help on using the changeset viewer.