[Fix] Corrected selecting hyperspace in map not updating window.
This commit is contained in:
parent
239f42bb85
commit
5a0f5ff145
2
src/ai.c
2
src/ai.c
@ -653,7 +653,7 @@ static int ai_pushtask(lua_State* L) {
|
||||
/* Parse basic parameters. */
|
||||
if(lua_isnumber(L, 1)) pos = (int) lua_tonumber(L, 1);
|
||||
else LLUA_INVALID_PARAMETER();
|
||||
if(lua_isstring(L, 2)) func = (char*)lua_tostring(L, 1);
|
||||
if(lua_isstring(L, 2)) func = (char*)lua_tostring(L, 2);
|
||||
else LLUA_INVALID_PARAMETER();
|
||||
|
||||
t = MALLOC_L(Task);
|
||||
|
26
src/map.c
26
src/map.c
@ -155,6 +155,10 @@ static void map_update(void) {
|
||||
unsigned int services;
|
||||
char buf[128];
|
||||
|
||||
/* Needs map to update. */
|
||||
if(map_wid <= 0)
|
||||
return;
|
||||
|
||||
sys = &systems_stack[map_selected];
|
||||
|
||||
/* Right text. */
|
||||
@ -510,20 +514,18 @@ void map_clear(void) {
|
||||
map_selectCur();
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn static void map_selectCur(void)
|
||||
*
|
||||
* @brief Try to select the current system.
|
||||
*/
|
||||
static void map_selectCur(void) {
|
||||
int i;
|
||||
if(cur_system != NULL) {
|
||||
for(i = 0; i < systems_nstack; i++) {
|
||||
if(&systems_stack[i] == cur_system) {
|
||||
map_selected = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(cur_system != NULL)
|
||||
map_selected = cur_system - systems_stack;
|
||||
else
|
||||
/* Probably going to seg fault now.. */
|
||||
map_selected = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update the map after a jump. */
|
||||
void map_jump(void) {
|
||||
@ -566,7 +568,11 @@ void map_jump(void) {
|
||||
* @param sys System to select.
|
||||
*/
|
||||
void map_select(StarSystem* sys) {
|
||||
if(sys == NULL)
|
||||
map_selectCur();
|
||||
else
|
||||
map_selected = sys - systems_stack;
|
||||
map_update();
|
||||
}
|
||||
|
||||
/* A* Algorithm fo shortest path finding. */
|
||||
|
@ -1776,9 +1776,14 @@ void player_targetHyperspace(void) {
|
||||
else
|
||||
player_playSound(snd_nav, 1);
|
||||
|
||||
if((hyperspace_target != -1) && map_isOpen())
|
||||
/* Map gets special treatment if open. */
|
||||
if(map_isOpen()) {
|
||||
if(hyperspace_target == -1)
|
||||
map_select(NULL);
|
||||
else
|
||||
map_select(&systems_stack[cur_system->jumps[hyperspace_target]]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn void player_jump(void)
|
||||
|
Loading…
Reference in New Issue
Block a user