3131#include " ../Ruleset/RuleCraft.h"
3232#include " ../Savegame/SavedGame.h"
3333#include " ../Engine/Options.h"
34+ #include " Globe.h"
3435#include " SelectDestinationState.h"
3536
3637namespace OpenXcom
@@ -104,6 +105,7 @@ InterceptState::InterceptState(Game *game, Globe *globe, Base *base) : State(gam
104105 _lstCrafts->setBackground (_window);
105106 _lstCrafts->setMargin (6 );
106107 _lstCrafts->onMouseClick ((ActionHandler)&InterceptState::lstCraftsClick);
108+ _lstCrafts->onMouseClick ((ActionHandler)&InterceptState::lstCraftsRightClick, SDL_BUTTON_RIGHT );
107109
108110 int row = 0 ;
109111 for (std::vector<Base*>::iterator i = _game->getSavedGame ()->getBases ()->begin (); i != _game->getSavedGame ()->getBases ()->end (); ++i)
@@ -119,7 +121,7 @@ InterceptState::InterceptState(Game *game, Globe *globe, Base *base) : State(gam
119121 }
120122 else
121123 {
122- ss << (*j)-> getNumWeapons () ;
124+ ss << 0 ;
123125 }
124126 ss << " /" ;
125127 if ((*j)->getNumSoldiers () > 0 )
@@ -128,7 +130,7 @@ InterceptState::InterceptState(Game *game, Globe *globe, Base *base) : State(gam
128130 }
129131 else
130132 {
131- ss << (*j)-> getNumSoldiers () ;
133+ ss << 0 ;
132134 }
133135 ss << " /" ;
134136 if ((*j)->getNumVehicles () > 0 )
@@ -137,7 +139,7 @@ InterceptState::InterceptState(Game *game, Globe *globe, Base *base) : State(gam
137139 }
138140 else
139141 {
140- ss << (*j)-> getNumVehicles () ;
142+ ss << 0 ;
141143 }
142144 _crafts.push_back (*j);
143145 _lstCrafts->addRow (4 , (*j)->getName (_game->getLanguage ()).c_str (), tr ((*j)->getStatus ()).c_str (), (*i)->getName ().c_str (), ss.str ().c_str ());
@@ -174,11 +176,25 @@ void InterceptState::btnCancelClick(Action *)
174176void InterceptState::lstCraftsClick (Action *)
175177{
176178 Craft* c = _crafts[_lstCrafts->getSelectedRow ()];
177- if (c->getStatus () != " STR_OUT" && (c->getStatus () == " STR_READY" || Options::getBool (" craftLaunchAlways" )))
179+ if (( c->getStatus () != " STR_OUT" && (c->getStatus () == " STR_READY" || Options::getBool (" craftLaunchAlways" ))) || c-> getStatus () == " STR_OUT " )
178180 {
179181 _game->popState ();
180182 _game->pushState (new SelectDestinationState (_game, c, _globe));
181183 }
182184}
183185
186+ /* *
187+ * Centers on the selected craft.
188+ * @param action Pointer to an action.
189+ */
190+ void InterceptState::lstCraftsRightClick (Action *)
191+ {
192+ Craft* c = _crafts[_lstCrafts->getSelectedRow ()];
193+ if (c->getStatus () == " STR_OUT" )
194+ {
195+ _globe->center (c->getLongitude (), c->getLatitude ());
196+ _game->popState ();
197+ }
198+ }
199+
184200}
0 commit comments