Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9471


Ignore:
Timestamp:
Nov 28, 2012, 11:02:55 PM (11 years ago)
Author:
jo
Message:

I fixed the console command. A console command has to be a static function. I used the same workaround as in NewHumanController to bypass the static behaviour of the concerning functions.

Location:
code/branches/spaceNavigation/src/modules/overlays/hud
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.cc

    r9468 r9471  
    5959{
    6060
    61     SetConsoleCommand("selectClosest", &HUDNavigation::selectClosestTarget);
    62     SetConsoleCommand("selectNext", &HUDNavigation::selectNextTarget);
     61    SetConsoleCommand("HUDNavigation","selectClosest", &HUDNavigation::selectClosestTarget).addShortcut().keybindMode(KeybindMode::OnPress);
     62    SetConsoleCommand("HUDNavigation","selectNext", &HUDNavigation::selectNextTarget).addShortcut().keybindMode(KeybindMode::OnPress);
    6363
    6464    static bool compareDistance(std::pair<RadarViewable*, unsigned int> a,
     
    6868    }
    6969    CreateFactory ( HUDNavigation );
     70
     71    HUDNavigation* HUDNavigation::localHUD_s = 0;
    7072
    7173    HUDNavigation::HUDNavigation(BaseObject* creator) :
     
    8688        this->closestTarget_ = true;
    8789        this->nextTarget_ = false;
     90        HUDNavigation::localHUD_s = this;
    8891    }
    8992
     
    544547    void HUDNavigation::selectClosestTarget()
    545548    {
    546         this->closestTarget_ = true;
    547         orxout() << "selectClosestTarget" << std::endl;
     549        if(HUDNavigation::localHUD_s)
     550        {
     551            HUDNavigation::localHUD_s->closestTarget_ = true;
     552            orxout() << "selectClosestTarget" << std::endl;
     553        }
    548554    }
    549555
    550556    void HUDNavigation::selectNextTarget()
    551557    {
    552         this->nextTarget_ = true;
    553         orxout() << "selectNextTarget" << std::endl;
     558        if(HUDNavigation::localHUD_s)
     559        {
     560            HUDNavigation::localHUD_s->nextTarget_ = true;
     561            orxout() << "selectNextTarget" << std::endl;
     562        }
    554563    }
    555564}
  • code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.h

    r9468 r9471  
    7171                { return this->markerLimit_; }
    7272
    73             void selectClosestTarget();
    74             void selectNextTarget();
     73            static void selectClosestTarget();
     74            static void selectNextTarget();
    7575
    7676        private:
     
    132132            static const float LIGHTNING_GUN_SPEED_ = 700.0f;
    133133            static const float HSW01_SPEED_ = 2500.0f;
     134            static HUDNavigation* localHUD_s; //!< This is used as a filter to only influence the local HUD.
     135
    134136
    135137            float currentMunitionSpeed_;
Note: See TracChangeset for help on using the changeset viewer.