Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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.

File:
1 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}
Note: See TracChangeset for help on using the changeset viewer.