Permalink
Browse files

* system.adjacentSystems() should not return systems whose jumps are …

…hidden or exit-only.

* Corrected an insubstantial redundant data retrieval.
  • Loading branch information...
1 parent 5181772 commit 525fd777a92db741f8b8a8ebd79d58b989fe1fdb BTAxis committed Mar 16, 2013
Showing with 8 additions and 5 deletions.
  1. +1 −1 dat/scripts/cargo_common.lua
  2. +7 −4 src/nlua_system.c
@@ -105,7 +105,7 @@ end
-- Calculates the minimum possible time taken for the player to reach a destination.
function cargoGetTransit( timelimit, numjumps, traveldist )
local pstats = player.pilot():stats()
- local stuperpx = 1 / player.pilot():stats().speed_max * 30
+ local stuperpx = 1 / pstats.speed_max * 30
local arrivalt = time.get() + time.create(0, 0, traveldist * stuperpx +
numjumps * pstats.jump_delay + 10180 + 240 * numjumps)
return arrivalt
View
@@ -25,6 +25,7 @@
#include "land.h"
#include "map.h"
#include "map_overlay.h"
+#include "space.h"
/* System metatable methods */
@@ -449,10 +450,12 @@ static int systemL_adjacent( lua_State *L )
/* Push all adjacent systems. */
lua_newtable(L);
for (i=0; i<s->njumps; i++) {
- sysp.id = system_index( s->jumps[i].target );
- lua_pushnumber(L,i+1); /* key. */
- lua_pushsystem(L,sysp); /* value. */
- lua_rawset(L,-3);
+ if (!jp_isFlag(&s->jumps[i], JP_HIDDEN) && !jp_isFlag(&s->jumps[i], JP_EXITONLY)) {
+ sysp.id = system_index( s->jumps[i].target );
+ lua_pushnumber(L,i+1); /* key. */
+ lua_pushsystem(L,sysp); /* value. */
+ lua_rawset(L,-3);
+ }
}
return 1;

0 comments on commit 525fd77

Please sign in to comment.