/** * @brief Generates the weapons list. */ static void weapons_genList( unsigned int wid ) { const char *str; char **buf; int i; int w, h; /* Get the dimensions. */ window_dimWindow( wid, &w, &h ); /* Destroy widget if needed. */ if (widget_exists( wid, "lstWeapSets" )) window_destroyWidget( wid, "lstWeapSets" ); /* List */ buf = malloc( sizeof(char*) * PILOT_WEAPON_SETS ); for (i=0; i<PILOT_WEAPON_SETS; i++) { str = pilot_weapSetName( info_eq_weaps.selected, i ); if (str == NULL) { buf[i] = malloc( sizeof(char) * PATH_MAX ); snprintf( buf[i], PATH_MAX, "Weapon Set %d", (i+1)%10 ); } else { buf[i] = strdup( str ); } } window_addList( wid, 20+180+20, -40, w - (20+180+20+20), 160, "lstWeapSets", buf, PILOT_WEAPON_SETS, 0, weapons_update ); /* Update. */ weapons_update( wid, NULL ); }
/** * @brief Actually runs the updates * * @param[in] dt Current delta tick. */ static void update_routine( double dt ) { space_update(dt); weapons_update(dt); spfx_update(dt); pilots_update(dt); missions_update(dt); events_update(dt); }
/** * @brief Updates the info windows. */ void info_update (void) { weapons_update( info_windows[ INFO_WIN_WEAP ], NULL ); }