/** * @brief Updates the mission list. * @param wid Window of the mission computer. * @param str Unused. */ static void misn_update( unsigned int wid, char* str ) { (void) str; char *active_misn; Mission* misn; char txt[256], *buf; /* Clear computer markers. */ space_clearComputerMarkers(); /* Update date stuff. */ buf = ntime_pretty( 0, 2 ); snprintf( txt, sizeof(txt), "%s\n%d Tons", buf, player.p->cargo_free ); free(buf); window_modifyText( wid, "txtDate", txt ); active_misn = toolkit_getList( wid, "lstMission" ); if (strcmp(active_misn,"No Missions")==0) { window_modifyText( wid, "txtReward", "None" ); window_modifyText( wid, "txtDesc", "There are no missions available here." ); window_disableButton( wid, "btnAcceptMission" ); return; } misn = &mission_computer[ toolkit_getListPos( wid, "lstMission" ) ]; mission_sysComputerMark( misn ); if (misn->markers != NULL) map_center( system_getIndex( misn->markers[0].sys )->name ); window_modifyText( wid, "txtReward", misn->reward ); window_modifyText( wid, "txtDesc", misn->desc ); window_enableButton( wid, "btnAcceptMission" ); }
/** * @brief Closes the mission computer window. * @param wid Window to close. * @param name Unused. */ static void misn_close( unsigned int wid, char *name ) { (void) wid; (void) name; /* Remove computer markers just in case. */ space_clearComputerMarkers(); }
/** * @brief Marks the system of the computer mission to reflect where it will head to. * * Does not modify other markers. * * @param misn Mission to mark. */ void mission_sysComputerMark( Mission* misn ) { StarSystem *sys; int i, n; /* Clear markers. */ space_clearComputerMarkers(); /* Set all the markers. */ if (misn->markers != NULL) { n = array_size(misn->markers); for (i=0; i<n; i++) { sys = system_getIndex( misn->markers[i].sys ); sys_setFlag( sys,SYSTEM_CMARKED ); } } }
/** * @brief Saves the last place the player was. * * @param wid Unused. * @param wgt Unused. * @param tab Tab changed to. */ static void land_changeTab( unsigned int wid, char *wgt, int tab ) { int i; (void) wid; (void) wgt; unsigned int w; const char *torun_hook; unsigned int to_visit; /* Sane defaults. */ torun_hook = NULL; to_visit = 0; /* Find what switched. */ for (i=0; i<LAND_NUMWINDOWS; i++) { if (land_windowsMap[i] == tab) { last_window = i; w = land_getWid( i ); /* Must regenerate outfits. */ switch (i) { case LAND_WINDOW_MAIN: land_checkAddRefuel(); break; case LAND_WINDOW_OUTFITS: outfits_update( w, NULL ); outfits_updateQuantities( w ); to_visit = VISITED_OUTFITS; torun_hook = "outfits"; break; case LAND_WINDOW_SHIPYARD: shipyard_update( w, NULL ); to_visit = VISITED_SHIPYARD; torun_hook = "shipyard"; break; case LAND_WINDOW_BAR: bar_update( w, NULL ); to_visit = VISITED_BAR; torun_hook = "bar"; break; case LAND_WINDOW_MISSION: misn_update( w, NULL ); to_visit = VISITED_MISSION; torun_hook = "mission"; break; case LAND_WINDOW_COMMODITY: commodity_update( w, NULL ); to_visit = VISITED_COMMODITY; torun_hook = "commodity"; break; case LAND_WINDOW_EQUIPMENT: equipment_updateShips( w, NULL ); equipment_updateOutfits( w, NULL ); to_visit = VISITED_EQUIPMENT; torun_hook = "equipment"; break; default: break; } /* Clear markers if closing Mission Computer. */ if (i != LAND_WINDOW_MISSION) { space_clearComputerMarkers(); } break; } } /* Check land missions - always run hooks. */ /*if ((to_visit != 0) && !has_visited(to_visit)) {*/ { /* Run hooks, run after music in case hook wants to change music. */ if (torun_hook != NULL) if (hooks_run( torun_hook ) > 0) bar_genList( land_getWid(LAND_WINDOW_BAR) ); visited(to_visit); if (land_takeoff) takeoff(1); } }