/** * @brief Prints general information about aircraft for Buy/Sell menu. * @param[in] aircraftTemplate Aircraft type. * @sa UP_AircraftDescription * @sa UP_AircraftItemDescription */ static void BS_MarketAircraftDescription (const aircraft_t* aircraftTemplate) { const technology_t* tech; /* Break if no aircraft was given or if it's no sample-aircraft (i.e. template). */ if (!aircraftTemplate || aircraftTemplate != aircraftTemplate->tpl) return; tech = aircraftTemplate->tech; assert(tech); UP_AircraftDescription(tech); cgi->Cvar_Set("mn_aircraftname", "%s", _(aircraftTemplate->name)); cgi->Cvar_Set("mn_item", "%s", aircraftTemplate->id); }
/** * @brief Display only the TEXT_UFOPEDIA part for a given technology * @param[in] tech The technology_t pointer to print the UFOpaedia article for * @param[in] mail The mail parameters in case we produce a mail * @sa UP_Article */ static void UP_Article (technology_t* tech, eventMail_t* mail) { UP_ChangeDisplay(UFOPEDIA_ARTICLE); if (tech) { if (tech->mdl) cgi->Cvar_Set("mn_upmodel_top", "%s", tech->mdl); else cgi->Cvar_Set("mn_upmodel_top", ""); if (tech->image) cgi->Cvar_Set("mn_upimage_top", "%s", tech->image); else cgi->Cvar_Set("mn_upimage_top", ""); cgi->Cvar_Set("mn_upmodel_bottom", ""); if (tech->type == RS_WEAPON) UP_DrawAssociatedAmmo(tech); cgi->Cvar_Set("mn_uprequirement", ""); cgi->Cvar_Set("mn_upmetadata", ""); } cgi->UI_ResetData(TEXT_UFOPEDIA); cgi->UI_ResetData(TEXT_UFOPEDIA_REQUIREMENT); if (mail) { /* event mail */ cgi->Cvar_SetValue("mn_uppreavailable", 0); cgi->Cvar_SetValue("mn_updisplay", UFOPEDIA_CHAPTERS); UP_SetMailHeader(nullptr, TECHMAIL_PRE, mail); cgi->UI_RegisterText(TEXT_UFOPEDIA, _(mail->body)); /* This allows us to use the index button in the UFOpaedia, * eventMails don't have any chapter to go back to. */ upDisplay = UFOPEDIA_INDEX; } else if (tech) { currentChapter = tech->upChapter; upCurrentTech = tech; /* Reset itemdescription */ cgi->UI_ExecuteConfunc("itemdesc_view 0 0;"); if (RS_IsResearched_ptr(tech)) { cgi->Cvar_Set("mn_uptitle", _("UFOpaedia: %s (complete)"), _(tech->name)); /* If researched -> display research text */ cgi->UI_RegisterText(TEXT_UFOPEDIA, _(RS_GetDescription(&tech->description))); if (tech->preDescription.numDescriptions > 0) { /* Display pre-research text and the buttons if a pre-research text is available. */ if (mn_uppretext->integer) { cgi->UI_RegisterText(TEXT_UFOPEDIA, _(RS_GetDescription(&tech->preDescription))); UP_SetMailHeader(tech, TECHMAIL_PRE, nullptr); } else { UP_SetMailHeader(tech, TECHMAIL_RESEARCHED, nullptr); } cgi->Cvar_SetValue("mn_uppreavailable", 1); } else { /* Do not display the pre-research-text button if none is available (no need to even bother clicking there). */ cgi->Cvar_SetValue("mn_uppreavailable", 0); cgi->Cvar_SetValue("mn_updisplay", UFOPEDIA_CHAPTERS); UP_SetMailHeader(tech, TECHMAIL_RESEARCHED, nullptr); } switch (tech->type) { case RS_ARMOUR: case RS_WEAPON: for (int i = 0; i < cgi->csi->numODs; i++) { const objDef_t* od = INVSH_GetItemByIDX(i); if (Q_streq(tech->provides, od->id)) { cgi->INV_ItemDescription(od); UP_DisplayTechTree(tech); cgi->Cvar_Set("mn_upmetadata", "1"); break; } } break; case RS_TECH: UP_DisplayTechTree(tech); break; case RS_CRAFT: UP_AircraftDescription(tech); break; case RS_CRAFTITEM: UP_AircraftItemDescription(INVSH_GetItemByID(tech->provides)); break; case RS_BUILDING: UP_BuildingDescription(tech); break; case RS_UGV: UP_UGVDescription(cgi->Com_GetUGVByIDSilent(tech->provides)); break; default: break; } /* see also UP_TechGetsDisplayed */ } else if (RS_Collected_(tech) || (tech->statusResearchable && tech->preDescription.numDescriptions > 0)) { /* This tech has something collected or has a research proposal. (i.e. pre-research text) */ cgi->Cvar_Set("mn_uptitle", _("UFOpaedia: %s"), _(tech->name)); /* Not researched but some items collected -> display pre-research text if available. */ if (tech->preDescription.numDescriptions > 0) { cgi->UI_RegisterText(TEXT_UFOPEDIA, _(RS_GetDescription(&tech->preDescription))); UP_SetMailHeader(tech, TECHMAIL_PRE, nullptr); } else { cgi->UI_RegisterText(TEXT_UFOPEDIA, _("No pre-research description available.")); } } else { cgi->Cvar_Set("mn_uptitle", _("UFOpaedia: %s"), _(tech->name)); cgi->UI_ResetData(TEXT_UFOPEDIA); } } else { cgi->Com_Error(ERR_DROP, "UP_Article: No mail or tech given"); } }