Do not allow player to switch destinations in flight.

When travelling between planets, while the progress bar was growing, it was
possible to click on planets, thereby changing the final destination planet.
This commit is contained in:
Guus Sliepen 2012-02-29 14:12:22 +01:00
parent f51dbd0669
commit 3c9f8e2135
1 changed files with 9 additions and 9 deletions

View File

@ -239,7 +239,7 @@ Spins the planets around the sun, spaced according to their Y value
as defined in setSystemPlanets(). Moving the cursor over the planet as defined in setSystemPlanets(). Moving the cursor over the planet
will show their name and their current status will show their name and their current status
*/ */
static bool showSystem(float x, float y) static bool showSystem(float x, float y, bool selectable)
{ {
SDL_Rect r; SDL_Rect r;
signed char planet = 0; signed char planet = 0;
@ -265,7 +265,7 @@ static bool showSystem(float x, float y)
r.y -= (systemPlanet[planet].image->h / 2); r.y -= (systemPlanet[planet].image->h / 2);
blit(systemPlanet[planet].image, r.x, r.y); blit(systemPlanet[planet].image, r.x, r.y);
if (collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, r.x, r.y, systemPlanet[planet].image->w, systemPlanet[planet].image->h)) if (selectable && collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, r.x, r.y, systemPlanet[planet].image->w, systemPlanet[planet].image->h))
{ {
drawString(systemPlanet[planet].name, -1, 545, FONT_WHITE); drawString(systemPlanet[planet].name, -1, 545, FONT_WHITE);
if ((engine.keyState[SDLK_LCTRL]) || (engine.keyState[SDLK_RCTRL])) if ((engine.keyState[SDLK_LCTRL]) || (engine.keyState[SDLK_RCTRL]))
@ -691,7 +691,7 @@ int galaxyMap()
cosY += 0.01; cosY += 0.01;
} }
if (showSystem(sinX, cosY)) if (showSystem(sinX, cosY, true))
{ {
if (currentGame.system == 0) if (currentGame.system == 0)
{ {
@ -722,9 +722,9 @@ int galaxyMap()
saveSlot = showSaveSlots(savesSurface, saveSlot); saveSlot = showSaveSlots(savesSurface, saveSlot);
break; break;
case 4: case 4:
showShop(); showShop();
break; break;
case 5: case 5:
blit(commsSurface, 170, 70); blit(commsSurface, 170, 70);
@ -736,13 +736,13 @@ int galaxyMap()
showOptions(optionsSurface); showOptions(optionsSurface);
break; break;
case 7: case 7:
rtn = 0; rtn = 0;
engine.done = 1; engine.done = 1;
break; break;
case 8: case 8:
showSystem(sinX, cosY); showSystem(sinX, cosY, false);
blit(systemPlanet[currentGame.stationedPlanet].image, 150, 450); blit(systemPlanet[currentGame.stationedPlanet].image, 150, 450);
blit(iconInfo[9].image, 135, 480); blit(iconInfo[9].image, 135, 480);