[Fix] Corrected selecting hyperspace in map not updating window.

This commit is contained in:
Allanis 2014-01-06 18:56:24 +00:00
parent 239f42bb85
commit 5a0f5ff145
3 changed files with 25 additions and 14 deletions

View File

@ -653,7 +653,7 @@ static int ai_pushtask(lua_State* L) {
/* Parse basic parameters. */ /* Parse basic parameters. */
if(lua_isnumber(L, 1)) pos = (int) lua_tonumber(L, 1); if(lua_isnumber(L, 1)) pos = (int) lua_tonumber(L, 1);
else LLUA_INVALID_PARAMETER(); 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(); else LLUA_INVALID_PARAMETER();
t = MALLOC_L(Task); t = MALLOC_L(Task);

View File

@ -155,6 +155,10 @@ static void map_update(void) {
unsigned int services; unsigned int services;
char buf[128]; char buf[128];
/* Needs map to update. */
if(map_wid <= 0)
return;
sys = &systems_stack[map_selected]; sys = &systems_stack[map_selected];
/* Right text. */ /* Right text. */
@ -510,19 +514,17 @@ void map_clear(void) {
map_selectCur(); map_selectCur();
} }
/**
* @fn static void map_selectCur(void)
*
* @brief Try to select the current system.
*/
static void map_selectCur(void) { static void map_selectCur(void) {
int i; if(cur_system != NULL)
if(cur_system != NULL) { map_selected = cur_system - systems_stack;
for(i = 0; i < systems_nstack; i++) { else
if(&systems_stack[i] == cur_system) {
map_selected = i;
break;
}
}
} else {
/* Probably going to seg fault now.. */ /* Probably going to seg fault now.. */
map_selected = -1; map_selected = -1;
}
} }
/* Update the map after a jump. */ /* Update the map after a jump. */
@ -566,7 +568,11 @@ void map_jump(void) {
* @param sys System to select. * @param sys System to select.
*/ */
void map_select(StarSystem* sys) { void map_select(StarSystem* sys) {
if(sys == NULL)
map_selectCur();
else
map_selected = sys - systems_stack; map_selected = sys - systems_stack;
map_update();
} }
/* A* Algorithm fo shortest path finding. */ /* A* Algorithm fo shortest path finding. */

View File

@ -1776,8 +1776,13 @@ void player_targetHyperspace(void) {
else else
player_playSound(snd_nav, 1); 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]]); map_select(&systems_stack[cur_system->jumps[hyperspace_target]]);
}
} }
/** /**