Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1538 for code/trunk


Ignore:
Timestamp:
Jun 4, 2008, 10:44:41 PM (17 years ago)
Author:
rgrieder
Message:
  • fixed a bug in cursorChanged in InGameConsole
  • prevented Ogre from displaying unnecessary exceptions when ogre.cfg is not present
Location:
code/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/core/input/KeyBinder.cc

    r1535 r1538  
    214214    std::ifstream infile;
    215215    infile.open("keybindings.ini");
    216     if (!infile.is_open())
     216    if (!infile)
    217217    {
    218218      ConfigFileManager::getSingleton()->setFile(CFT_Keybindings, "def_keybindings.ini");
    219219      ConfigFileManager::getSingleton()->save(CFT_Keybindings, "keybindings.ini");
    220220    }
    221     infile.close();
     221    else
     222      infile.close();
    222223    ConfigFileManager::getSingleton()->setFile(CFT_Keybindings, "keybindings.ini");
    223224
  • code/trunk/src/orxonox/GraphicsEngine.cc

    r1535 r1538  
    3434#include "OrxonoxStableHeaders.h"
    3535#include "GraphicsEngine.h"
     36
     37#include <fstream>
    3638
    3739#include <OgreConfigFile.h>
     
    260262  {
    261263    CCOUT(4) << "Configuring Renderer" << std::endl;
    262     if (!root_->restoreConfig() && !root_->showConfigDialog())
    263       return false;
     264
     265    // check for file existence because Ogre displays exceptions if not
     266    std::ifstream probe;
     267    probe.open(ogreConfigFile_.c_str());
     268    if (!probe)
     269    {
     270      // create a zero sized file
     271      std::ofstream creator;
     272      creator.open(ogreConfigFile_.c_str());
     273      creator.close();
     274    }
     275    else
     276      probe.close();
     277
     278    if (!root_->restoreConfig())
     279      if (!root_->showConfigDialog())
     280        return false;
    264281
    265282    CCOUT(4) << "Creating render window" << std::endl;
  • code/trunk/src/orxonox/console/InGameConsole.cc

    r1535 r1538  
    299299
    300300        this->linesChanged();
     301        this->cursorChanged();
    301302    }
    302303
     
    372373        Shell::getInstance().registerListener(this);
    373374        this->linesChanged();
     375        this->cursorChanged();
    374376
    375377        this->consoleOverlay_->show();
     
    460462    }
    461463
    462     void InGameConsole::setCursorPosition(int pos)
     464    void InGameConsole::setCursorPosition(unsigned int pos)
    463465    {
    464466        static std::string char1 = "bdefgilpqtzCEGIJKNOPQT5[}äü";
     
    471473
    472474        float width = 0;
    473         for (int i = 0; i < pos; ++i)
     475        for (unsigned int i = 0; i < pos && i < displayedText_.size(); ++i)
    474476        {
    475477            if (char1.find(displayedText_[i]) != std::string::npos)
  • code/trunk/src/orxonox/console/InGameConsole.h

    r1535 r1538  
    7272            void shiftLines();
    7373            void colourLine(int colourcode, int index);
    74             void setCursorPosition(int pos);
     74            void setCursorPosition(unsigned int pos);
    7575            void print(const std::string& text, int index, bool alwaysShift = false);
    7676            static Ogre::UTFString convert2UTF(std::string s);
Note: See TracChangeset for help on using the changeset viewer.