Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 10, 2008, 1:37:36 AM (16 years ago)
Author:
rgrieder
Message:

merged gui back to trunk.
update the media repository!

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/core/input/HalfAxis.cc

    r1535 r1755  
    2828
    2929/**
    30  @file
    31  @brief Implementation of the different input handlers.
    32  */
     30@file
     31@brief
     32    Implementation of the different input handlers.
     33*/
    3334
    3435#include "HalfAxis.h"
     
    3839namespace orxonox
    3940{
    40   void HalfAxis::clear()
    41   {
    42     Button::clear();
    43     if (nParamCommands_)
     41    void HalfAxis::clear()
    4442    {
    45       // delete all commands and the command pointer array
    46       for (unsigned int i = 0; i < nParamCommands_; i++)
    47         delete paramCommands_[i];
    48       delete[] paramCommands_;
    49       nParamCommands_ = 0;
     43        Button::clear();
     44        if (nParamCommands_)
     45        {
     46            // delete all commands and the command pointer array
     47            for (unsigned int i = 0; i < nParamCommands_; i++)
     48                delete paramCommands_[i];
     49            delete[] paramCommands_;
     50            nParamCommands_ = 0;
     51        }
     52        else
     53        {
     54            nParamCommands_ = 0; nParamCommands_ = 0;
     55        }
    5056    }
    51     else
     57
     58    bool HalfAxis::addParamCommand(ParamCommand* command)
    5259    {
    53       nParamCommands_ = 0; nParamCommands_ = 0;
     60        ParamCommand** cmds = paramCommands_;
     61        paramCommands_ = new ParamCommand*[++nParamCommands_];
     62        unsigned int i;
     63        for (i = 0; i < nParamCommands_ - 1; i++)
     64            paramCommands_[i] = cmds[i];
     65        paramCommands_[i] = command;
     66        if (nParamCommands_ > 1)
     67            delete[] cmds;
     68        return true;
    5469    }
    55   }
    5670
    57   bool HalfAxis::addParamCommand(ParamCommand* command)
    58   {
    59     ParamCommand** cmds = paramCommands_;
    60     paramCommands_ = new ParamCommand*[++nParamCommands_];
    61     unsigned int i;
    62     for (i = 0; i < nParamCommands_ - 1; i++)
    63       paramCommands_[i] = cmds[i];
    64     paramCommands_[i] = command;
    65     if (nParamCommands_ > 1)
    66       delete[] cmds;
    67     return true;
    68   }
    69 
    70   bool HalfAxis::execute()
    71   {
    72     bool success = true;
    73     for (unsigned int i = 0; i < nParamCommands_; i++)
    74       success = success && paramCommands_[i]->execute(absVal_, relVal_);
    75     return success;
    76   }
     71    bool HalfAxis::execute()
     72    {
     73        bool success = true;
     74        for (unsigned int i = 0; i < nParamCommands_; i++)
     75            success = success && paramCommands_[i]->execute(absVal_, relVal_);
     76        return success;
     77    }
    7778}
Note: See TracChangeset for help on using the changeset viewer.