/** * @brief Prints the UFOpaedia description for aircraft * @note Also checks whether the aircraft tech is already researched or collected * @sa BS_MarketAircraftDescription * @sa UP_Article */ void UP_AircraftDescription (const technology_t* tech) { cgi->INV_ItemDescription(nullptr); /* ensure that the buffer is emptied in every case */ upBuffer[0] = '\0'; if (RS_IsResearched_ptr(tech)) { const aircraft_t* aircraft = AIR_GetAircraft(tech->provides); for (int i = 0; i < AIR_STATS_MAX; i++) { switch (i) { case AIR_STATS_SPEED: /* speed may be converted to km/h : multiply by pi / 180 * earth_radius */ Q_strcat(upBuffer, sizeof(upBuffer), _("%s:\t%i km/h\n"), UP_AircraftStatToName(i), AIR_AircraftMenuStatsValues(aircraft->stats[i], i)); break; case AIR_STATS_MAXSPEED: /* speed may be converted to km/h : multiply by pi / 180 * earth_radius */ Q_strcat(upBuffer, sizeof(upBuffer), _("%s:\t%i km/h\n"), UP_AircraftStatToName(i), AIR_AircraftMenuStatsValues(aircraft->stats[i], i)); break; case AIR_STATS_FUELSIZE: Q_strcat(upBuffer, sizeof(upBuffer), _("Operational range:\t%i km\n"), AIR_GetOperationRange(aircraft)); break; case AIR_STATS_ACCURACY: Q_strcat(upBuffer, sizeof(upBuffer), _("%s:\t%i\n"), UP_AircraftStatToName(i), AIR_AircraftMenuStatsValues(aircraft->stats[i], i)); break; default: break; } } const baseCapacities_t cap = AIR_GetCapacityByAircraftWeight(aircraft); const buildingType_t buildingType = B_GetBuildingTypeByCapacity(cap); const building_t* building = B_GetBuildingTemplateByType(buildingType); Q_strcat(upBuffer, sizeof(upBuffer), _("Required Hangar:\t%s\n"), _(building->name)); /* @note: while MAX_ACTIVETEAM limits the number of soldiers on a craft * there is no use to show this in case of an UFO (would be misleading): */ if (!AIR_IsUFO(aircraft)) Q_strcat(upBuffer, sizeof(upBuffer), _("Max. soldiers:\t%i\n"), aircraft->maxTeamSize); } else if (RS_Collected_(tech)) { /** @todo Display crippled info and pre-research text here */ Com_sprintf(upBuffer, sizeof(upBuffer), _("Unknown - need to research this")); } else { Com_sprintf(upBuffer, sizeof(upBuffer), _("Unknown - need to research this")); } cgi->Cvar_Set("mn_upmetadata", "1"); cgi->UI_RegisterText(TEXT_ITEMDESCRIPTION, upBuffer); UP_DisplayTechTree(tech); }
/** * @brief Checks capacity overflows on bases * @sa CP_CampaignRun */ void CAP_CheckOverflow (void) { base_t* base = nullptr; while ((base = B_GetNext(base)) != nullptr) { for (int i = CAP_ALIENS; i < MAX_CAP; i++) { baseCapacities_t capacityType = (baseCapacities_t)i; capacities_t* cap = CAP_Get(base, capacityType); if (cap->cur <= cap->max) continue; switch (capacityType) { case CAP_ANTIMATTER: CAP_RemoveAntimatterExceedingCapacity(base); break; case CAP_WORKSPACE: PR_UpdateProductionCap(base); break; case CAP_LABSPACE: RS_RemoveScientistsExceedingCapacity(base); break; case CAP_AIRCRAFT_SMALL: case CAP_AIRCRAFT_BIG: case CAP_ALIENS: case CAP_EMPLOYEES: case CAP_ITEMS: if (base->baseStatus != BASE_DESTROYED) { const buildingType_t bldgType = B_GetBuildingTypeByCapacity((baseCapacities_t)i); const building_t* bldg = B_GetBuildingTemplateByType(bldgType); CP_GameTimeStop(); cgi->Cmd_ExecuteString("ui_push popup_cap_overload base %d \"%s\" \"%s\" %d %d", base->idx, base->name, _(bldg->name), cap->max - cap->cur, cap->max); } break; default: /* nothing to do */ break; } } } }