UFO: Alien Invasion
cp_market_callbacks.cpp
Go to the documentation of this file.
1 
5 /*
6 Copyright (C) 2002-2022 UFO: Alien Invasion.
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 See the GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23 
24 #include "../../cl_shared.h"
25 #include "../../cl_inventory.h"
26 #include "../../ui/ui_dataids.h"
27 #include "cp_campaign.h"
28 #include "cp_market.h"
29 #include "cp_market_callbacks.h"
30 #include "cp_popup.h"
31 
38 static void BS_MarketAircraftDescription (const aircraft_t* aircraftTemplate)
39 {
40  const technology_t* tech;
41 
42  /* Break if no aircraft was given or if it's no sample-aircraft (i.e. template). */
43  if (!aircraftTemplate || aircraftTemplate != aircraftTemplate->tpl)
44  return;
45 
46  tech = aircraftTemplate->tech;
47  assert(tech);
49  cgi->Cvar_Set("mn_aircraftname", "%s", _(aircraftTemplate->name));
50  cgi->Cvar_Set("mn_item", "%s", aircraftTemplate->id);
51 }
52 
57 static void BS_MarketInfoClick_f (void)
58 {
59  const char* item = cgi->Cvar_GetString("mn_item");
60  const technology_t* tech = RS_GetTechByProvided(item);
61 
62  if (tech)
63  UP_OpenWith(tech->id);
64 }
65 
69 static void BS_SetAutosell_f (void)
70 {
71  const objDef_t* od;
72  const technology_t* tech;
73 
74  if (cgi->Cmd_Argc() < 2) {
75  cgi->Com_Printf("Usage: %s <item-id> [0|1]\nWhere second parameter is the state (off/on), if omitted the autosell property will be flipped.\n",
76  cgi->Cmd_Argv(0));
77  return;
78  }
79  /* aircraft check */
80  if (AIR_GetAircraftSilent(cgi->Cmd_Argv(1)) != nullptr) {
81  cgi->Com_Printf("Aircraft can't be autosold!\n");
82  return;
83  }
84  /* items */
85  od = INVSH_GetItemByID(cgi->Cmd_Argv(1));
86  if (!od) {
87  /* no printf, INVSH_GetItemByID gave warning already */
88  return;
89  }
90  if (od->isVirtual) {
91  cgi->Com_Printf("Item %s is virtual, can't be autosold!\n", od->id);
92  return;
93  }
94  if (od->notOnMarket) {
95  cgi->Com_Printf("Item %s is not on market, can't be autosold!\n", od->id);
96  return;
97  }
98  tech = RS_GetTechForItem(od);
99  /* Don't allow to enable autosell for items not researched. */
100  if (!RS_IsResearched_ptr(tech)) {
101  cgi->Com_Printf("Item %s is not researched, can't be autosold!\n", od->id);
102  return;
103  }
104  if (cgi->Cmd_Argc() >= 3)
105  ccs.eMarket.autosell[od->idx] = atoi(cgi->Cmd_Argv(2));
106  else
107  ccs.eMarket.autosell[od->idx] = ! ccs.eMarket.autosell[od->idx];
108 }
109 
113 static void BS_Buy_f (void)
114 {
115  const char* itemid;
116  int count;
118  const aircraft_t* aircraft;
119  const ugv_t* ugv;
120  const objDef_t* od;
121 
122  if (cgi->Cmd_Argc() < 2) {
123  cgi->Com_Printf("Usage: %s <item-id> <count> [base-idx] \nNegative count means selling. If base index is omitted buys on the currently selected base.\n",
124  cgi->Cmd_Argv(0));
125  return;
126  }
127 
128  itemid = cgi->Cmd_Argv(1);
129  count = atoi(cgi->Cmd_Argv(2));
130 
131  if (cgi->Cmd_Argc() >= 4)
132  base = B_GetFoundedBaseByIDX(atoi(cgi->Cmd_Argv(3)));
133 
134  if (char const* const rest = Q_strstart(itemid, "aircraft_")) {
135  /* aircraft sell - with aircraft golbal idx */
136  int idx = atoi(rest);
137  aircraft_t* aircraft = AIR_AircraftGetFromIDX(idx);
138 
139  if (!aircraft) {
140  cgi->Com_Printf("Invalid aircraft index!\n");
141  return;
142  }
143  AIR_RemoveEmployees(*aircraft);
144  BS_SellAircraft(aircraft);
145  return;
146  }
147 
148  if (char const* const rest = Q_strstart(itemid, "ugv-")) {
149  /* ugv sell - with unique character number index */
150  int ucn = atoi(rest);
152 
153  if (!robot) {
154  cgi->Com_Printf("Invalid UCN for UGV!\n");
155  return;
156  }
157 
158  BS_SellUGV(robot);
159  return;
160  }
161 
162  if (!base) {
163  cgi->Com_Printf("No/invalid base selected.\n");
164  return;
165  }
166 
167  aircraft = AIR_GetAircraftSilent(itemid);
168  if (aircraft) {
169  if (!B_GetBuildingStatus(base, B_COMMAND)) {
170  CP_Popup(_("Note"), _("No Command Centre in this base.\nHangars are not functional.\n"));
171  return;
172  }
173  /* We cannot buy aircraft if there is no power in our base. */
174  if (!B_GetBuildingStatus(base, B_POWER)) {
175  CP_Popup(_("Note"), _("No power supplies in this base.\nHangars are not functional."));
176  return;
177  }
178  /* We cannot buy aircraft without any hangar. */
179  if (!AIR_AircraftAllowed(base)) {
180  CP_Popup(_("Note"), _("Build a hangar first."));
181  return;
182  }
183  /* Check free space in hangars. */
184  if (CAP_GetFreeCapacity(base, AIR_GetHangarCapacityType(aircraft)) <= 0) {
185  CP_Popup(_("Notice"), _("You cannot buy this aircraft.\nNot enough space in hangars.\n"));
186  return;
187  }
188 
189  if (ccs.credits < BS_GetAircraftBuyingPrice(aircraft)) {
190  CP_Popup(_("Notice"), _("You cannot buy this aircraft.\nNot enough credits.\n"));
191  return;
192  }
193 
194  BS_BuyAircraft(aircraft, base);
195  return;
196  }
197 
198  ugv = cgi->Com_GetUGVByIDSilent(itemid);
199  if (ugv) {
200  const objDef_t* ugvWeapon = INVSH_GetItemByID(ugv->weapon);
201  if (!ugvWeapon)
202  cgi->Com_Error(ERR_DROP, "BS_BuyItem_f: Could not get weapon '%s' for ugv/tank '%s'.", ugv->weapon, ugv->id);
203 
204  if (E_CountUnhiredRobotsByType(ugv) < 1)
205  return;
206  if (ccs.eMarket.numItems[ugvWeapon->idx] < 1)
207  return;
208 
209  if (ccs.credits < ugv->price) {
210  CP_Popup(_("Not enough money"), _("You cannot buy this item as you don't have enough credits."));
211  return;
212  }
213 
214  if (CAP_GetFreeCapacity(base, CAP_ITEMS) < UGV_SIZE + ugvWeapon->size) {
215  CP_Popup(_("Not enough storage space"), _("You cannot buy this item.\nNot enough space in storage.\nBuild more storage facilities."));
216  return;
217  }
218 
219  BS_BuyUGV(ugv, base);
220  return;
221  }
222 
223  if (count == 0) {
224  cgi->Com_Printf("Invalid number of items to buy/sell: %s\n", cgi->Cmd_Argv(2));
225  return;
226  }
227 
228  /* item */
229  od = INVSH_GetItemByID(cgi->Cmd_Argv(1));
230  if (od) {
231  if (!BS_IsOnMarket(od))
232  return;
233 
234  if (count > 0) {
235  /* buy */
236  const int price = BS_GetItemBuyingPrice(od);
237  count = std::min(count, BS_GetItemOnMarket(od));
238 
239  /* no items available on market */
240  if (count <= 0)
241  return;
242 
243  if (price <= 0) {
244  cgi->Com_Printf("Item on market with invalid buying price: %s (%d)\n", od->id, BS_GetItemBuyingPrice(od));
245  return;
246  }
248  count = std::min(count, ccs.credits / price);
249  /* not enough money for a single item */
250  if (count <= 0) {
251  CP_Popup(_("Not enough money"), _("You cannot buy this item as you don't have enough credits."));
252  return;
253  }
254 
255  if (od->size <= 0) {
256  cgi->Com_Printf("Item on market with invalid size: %s (%d)\n", od->id, od->size);
257  return;
258  }
259  count = std::min(count, CAP_GetFreeCapacity(base, CAP_ITEMS) / od->size);
260  if (count <= 0) {
261  CP_Popup(_("Not enough storage space"), _("You cannot buy this item.\nNot enough space in storage.\nBuild more storage facilities."));
262  return;
263  }
264 
265  BS_BuyItem(od, base, count);
266  } else {
267  /* sell */
268  count = std::min(-1 * count, B_ItemInBase(od, base));
269  /* no items in storage */
270  if (count <= 0)
271  return;
272  BS_SellItem(od, base, count);
273  }
274  return;
275  }
276  cgi->Com_Printf("Invalid item ID\n");
277 }
278 
282 static void BS_ShowInfo_f (void)
283 {
284  const char* itemid;
285  const aircraft_t* aircraft;
286  const ugv_t* ugv;
287  const objDef_t* od;
288 
289  if (cgi->Cmd_Argc() < 2) {
290  cgi->Com_Printf("Usage: %s <item-id>\n", cgi->Cmd_Argv(0));
291  return;
292  }
293 
294  itemid = cgi->Cmd_Argv(1);
295 
296  if (char const* const rest = Q_strstart(itemid, "aircraft_")) {
297  /* PHALANX aircraft - with aircraft golbal idx */
298  int idx = atoi(rest);
299  aircraft = AIR_AircraftGetFromIDX(idx);
300 
301  if (!aircraft) {
302  cgi->Com_Printf("Invalid aircraft index!\n");
303  return;
304  }
307  return;
308  }
309 
310  if (char const* const rest = Q_strstart(itemid, "ugv-")) {
311  /* PHALANX ugv - with unique character number index */
312  int ucn = atoi(rest);
314 
315  if (!robot) {
316  cgi->Com_Printf("Invalid UCN for UGV!\n");
317  return;
318  }
319 
321  UP_UGVDescription(robot->getUGV());
322  return;
323  }
324 
325  aircraft = AIR_GetAircraftSilent(itemid);
326  if (aircraft) {
328  return;
329  }
330 
331  ugv = cgi->Com_GetUGVByIDSilent(itemid);
332  if (ugv) {
333  UP_UGVDescription(ugv);
334  return;
335  }
336 
337  /* item */
338  od = INVSH_GetItemByID(cgi->Cmd_Argv(1));
339  if (od) {
340  if (!BS_IsOnMarket(od))
341  return;
342 
343  if (od->craftitem.type != MAX_ACITEMS)
345  else
346  cgi->INV_ItemDescription(od);
347  return;
348  }
349  cgi->Com_Printf("Invalid item ID\n");
350 }
351 
355 static void BS_FillMarket_f (void)
356 {
357  const base_t* base = B_GetCurrentSelectedBase();
359 
360  if (cgi->Cmd_Argc() < 2) {
361  cgi->Com_Printf("Usage: %s <category>\n", cgi->Cmd_Argv(0));
362  return;
363  }
364  if (cgi->Cmd_Argc() >= 3)
365  base = B_GetFoundedBaseByIDX(atoi(cgi->Cmd_Argv(2)));
366  if (!base) {
367  cgi->Com_Printf("No/invalid base selected.\n");
368  return;
369  }
370 
371  type = cgi->INV_GetFilterTypeID(cgi->Cmd_Argv(1));
372  cgi->UI_ExecuteConfunc("ui_market_clear");
373  switch (type) {
374  case FILTER_UGVITEM:
375  /* show own UGV */
376  E_Foreach(EMPL_ROBOT, robot) {
377  const ugv_t* ugv = robot->getUGV();
378  const technology_t* tech = RS_GetTechByProvided(ugv->id);
379 
380  if (!robot->isHiredInBase(base))
381  continue;
382 
383  cgi->UI_ExecuteConfunc("ui_market_add \"ugv-%d\" \"%s\" 1 0 0 %d - \"%s\"", robot->chr.ucn, _(tech->name), ugv->price, robot->isAwayFromBase() ? _("UGV is away from home") : "-");
384  }
385  /* show buyable UGV */
386  for (int i = 0; i < cgi->csi->numUGV; i++) {
387  const ugv_t* ugv = &cgi->csi->ugvs[i];
388  const technology_t* tech = RS_GetTechByProvided(ugv->id);
389  const objDef_t* ugvWeapon = INVSH_GetItemByID(ugv->weapon);
390  const int buyable = std::min(E_CountUnhiredRobotsByType(ugv), BS_GetItemOnMarket(ugvWeapon));
391 
392  assert(tech);
393  if (!RS_IsResearched_ptr(tech))
394  continue;
395  if (buyable <= 0)
396  continue;
397 
398  cgi->UI_ExecuteConfunc("ui_market_add %s \"%s\" 0 %d %d %d - -", ugv->id, _(tech->name), buyable, ugv->price, ugv->price);
399  }
400  /* show (UGV) items, fall through */
401  case FILTER_S_PRIMARY:
402  case FILTER_S_SECONDARY:
403  case FILTER_S_HEAVY:
404  case FILTER_S_IMPLANT:
405  case FILTER_S_MISC:
406  case FILTER_S_ARMOUR:
407  case FILTER_DUMMY:
408  case FILTER_CRAFTITEM:
409  case MAX_FILTERTYPES: {
410  for (int i = 0; i < cgi->csi->numODs; i++) {
411  const objDef_t* od = &cgi->csi->ods[i];
412  const technology_t* tech = RS_GetTechForItem(od);
413 
414  if (!BS_IsOnMarket(od))
415  continue;
416  if (B_ItemInBase(od, base) + BS_GetItemOnMarket(od) <= 0)
417  continue;
418  if (type != MAX_FILTERTYPES && !cgi->INV_ItemMatchesFilter(od, type))
419  continue;
420  cgi->UI_ExecuteConfunc("ui_market_add %s \"%s\" %d %d %d %d %s -", od->id, _(od->name), B_ItemInBase(od, base), BS_GetItemOnMarket(od), BS_GetItemBuyingPrice(od), BS_GetItemSellingPrice(od), RS_IsResearched_ptr(tech) ? va("%d", ccs.eMarket.autosell[i]) : "-");
421  }
422  break;
423  }
424  case FILTER_AIRCRAFT: {
425  AIR_ForeachFromBase(aircraft, base) {
426  cgi->UI_ExecuteConfunc("ui_market_add \"aircraft_%d\" \"%s\" 1 0 0 %d - \"%s\"", aircraft->idx, aircraft->name, BS_GetAircraftSellingPrice(aircraft), AIR_IsAircraftInBase(aircraft) ? "-" : _("Aircraft is away from home"));
427  }
428  for (int i = 0; i < ccs.numAircraftTemplates; i++) {
429  const aircraft_t* aircraft = &ccs.aircraftTemplates[i];
430  if (!BS_AircraftIsOnMarket(aircraft))
431  continue;
432  if (!RS_IsResearched_ptr(aircraft->tech))
433  continue;
434  if (BS_GetAircraftOnMarket(aircraft) <= 0)
435  continue;
436  cgi->UI_ExecuteConfunc("ui_market_add \"%s\" \"%s\" 0 %d %d %d - -", aircraft->id, _(aircraft->tech->name), BS_GetAircraftOnMarket(aircraft), BS_GetAircraftBuyingPrice(aircraft), BS_GetAircraftSellingPrice(aircraft));
437  }
438  break;
439  }
440  default:
441  break;
442  }
443  /* update capacity counters */
444  cgi->UI_ExecuteConfunc("ui_market_update_caps %d %d %d %d %d %d", CAP_GetFreeCapacity(base, CAP_ITEMS), CAP_GetMax(base, CAP_ITEMS),
447 }
448 
449 #ifdef DEBUG
450 static void BS_AddMarket_f (void)
451 {
452  if (cgi->Cmd_Argc() < 3) {
453  cgi->Com_Printf("Usage: %s <itemid> <count>\n", cgi->Cmd_Argv(0));
454  return;
455  }
456 
457  const objDef_t* obj = INVSH_GetItemByID(cgi->Cmd_Argv(1));
458  if (!obj)
459  return;
460 
461  const int amount = atoi(cgi->Cmd_Argv(2));
462  BS_AddItemToMarket(obj, amount);
463 }
464 #endif
465 
466 static const cmdList_t marketCallbacks[] = {
467  {"ui_market_openpedia", BS_MarketInfoClick_f, "Open UFOPedia entry for selected item"},
468  {"ui_market_setautosell", BS_SetAutosell_f, "Sets/unsets or flips the autosell property of an item on the market"},
469  {"ui_market_buy", BS_Buy_f, "Buy/Sell item/aircraft/ugv on the market"},
470  {"ui_market_showinfo", BS_ShowInfo_f, "Show information about item/aircaft/ugv in the market"},
471  {"ui_market_fill", BS_FillMarket_f, "Fill market item list"},
472 #ifdef DEBUG
473  {"debug_marketadd", BS_AddMarket_f, "Add items to the market"},
474 #endif
475  {nullptr, nullptr, nullptr}
476 };
481 {
482  cgi->Cmd_TableAddList(marketCallbacks);
483 }
484 
489 {
490  cgi->Cmd_TableRemoveList(marketCallbacks);
491 }
craftItem craftitem
Definition: inv_shared.h:331
const char * name
Definition: inv_shared.h:267
int B_ItemInBase(const objDef_t *item, const base_t *base)
Check if the item has been collected (i.e it is in the storage) in the given base.
Definition: cp_base.cpp:2133
int BS_GetAircraftBuyingPrice(const aircraft_t *aircraft)
Get the price for an aircraft that you want to buy on the market.
Definition: cp_market.cpp:211
static void BS_ShowInfo_f(void)
Show information about item/aircaft/ugv in the market.
bool AIR_IsAircraftInBase(const aircraft_t *aircraft)
Checks whether given aircraft is in its homebase.
void UP_OpenWith(const char *techID)
Opens the UFOpaedia from everywhere with the entry given through name.
csi_t * csi
Definition: cgame.h:100
int numItems[MAX_OBJDEFS]
Definition: cp_market.h:29
int numAircraftTemplates
Definition: cp_campaign.h:385
bool RS_IsResearched_ptr(const technology_t *tech)
Checks whether an item is already researched.
const objDef_t * INVSH_GetItemByID(const char *id)
Returns the item that belongs to the given id or nullptr if it wasn&#39;t found.
Definition: inv_shared.cpp:282
QGL_EXTERN GLint GLenum type
Definition: r_gl.h:94
Defines all attributes of objects used in the inventory.
Definition: inv_shared.h:264
bool B_GetBuildingStatus(const base_t *const base, const buildingType_t buildingType)
Get the status associated to a building.
Definition: cp_base.cpp:478
bool BS_SellUGV(Employee *robot)
Sells the given UGV with all the equipment.
Definition: cp_market.cpp:344
cvar_t *IMPORT * Cvar_Set(const char *varName, const char *value,...) __attribute__((format(__printf__
const char * va(const char *format,...)
does a varargs printf into a temp buffer, so I don&#39;t need to have varargs versions of all text functi...
Definition: shared.cpp:410
A base with all it&#39;s data.
Definition: cp_base.h:84
#define E_Foreach(employeeType, var)
Definition: cp_employee.h:122
#define _(String)
Definition: cl_shared.h:44
char * id
Definition: cp_aircraft.h:120
static void BS_MarketAircraftDescription(const aircraft_t *aircraftTemplate)
Prints general information about aircraft for Buy/Sell menu.
bool BS_IsOnMarket(const objDef_t *item)
Check if an item is on market.
Definition: cp_market.cpp:42
Header for single player market stuff.
const aircraft_t * AIR_GetAircraftSilent(const char *name)
Searches the global array of aircraft types for a given aircraft.
itemFilterTypes_t
A list of filter types in the market and production view.
Definition: cl_inventory.h:35
base_t * B_GetCurrentSelectedBase(void)
returns the currently selected base
Definition: cp_base.cpp:1578
aircraft_t * AIR_AircraftGetFromIDX(int aircraftIdx)
Returns aircraft for a given global index.
market_t eMarket
Definition: cp_campaign.h:232
int BS_GetItemBuyingPrice(const objDef_t *od)
Get the price for an item that you want to buy on the market.
Definition: cp_market.cpp:101
bool isVirtual
Definition: inv_shared.h:284
const char *IMPORT * Cvar_GetString(const char *varName)
const char *IMPORT * Cmd_Argv(int n)
char name[MAX_VAR]
Definition: cp_aircraft.h:121
baseCapacities_t AIR_GetHangarCapacityType(const aircraft_t *aircraft)
Returns capacity type needed for an aircraft.
void BS_ShutdownCallbacks(void)
Function unregisters the callbacks of the maket UI.
bool autosell[MAX_OBJDEFS]
Definition: cp_market.h:33
const char * id
Definition: inv_shared.h:268
base_t * B_GetFoundedBaseByIDX(int baseIdx)
Array bound check for the base index.
Definition: cp_base.cpp:326
int CAP_GetFreeCapacity(const base_t *base, baseCapacities_t capacityType)
Returns the free capacity of a type.
static void BS_FillMarket_f(void)
Fill market item list.
int size
Definition: inv_shared.h:334
int numUGV
Definition: q_shared.h:565
int BS_GetAircraftSellingPrice(const aircraft_t *aircraft)
Get the price for an aircraft that you want to sell on the market.
Definition: cp_market.cpp:170
#define ERR_DROP
Definition: common.h:211
void UP_AircraftDescription(const technology_t *t)
Prints the UFOpaedia description for aircraft.
bool BS_BuyUGV(const ugv_t *ugv, base_t *base)
Buys the given UGV.
Definition: cp_market.cpp:308
bool BS_BuyItem(const objDef_t *od, base_t *base, int count)
Buys items from the market.
Definition: cp_market.cpp:382
int E_CountUnhiredRobotsByType(const ugv_t *ugvType)
Counts all available Robots/UGVs that are for sale.
void CP_Popup(const char *title, const char *text,...)
Wrapper around UI_Popup.
Definition: cp_popup.cpp:474
const cgame_import_t * cgi
int BS_GetItemOnMarket(const objDef_t *od)
Get the number of items of the given type on the market.
Definition: cp_market.cpp:53
void UP_AircraftItemDescription(const objDef_t *item)
Prints the (UFOpaedia and other) description for aircraft items.
char const * Q_strstart(char const *str, char const *start)
Matches the start of a string.
Definition: shared.cpp:587
void BS_InitCallbacks(void)
Function registers the callbacks of the maket UI and do initializations.
struct aircraft_s * tpl
Definition: cp_aircraft.h:119
ccs_t ccs
Definition: cp_campaign.cpp:63
int numODs
Definition: q_shared.h:518
aircraft_t aircraftTemplates[MAX_AIRCRAFT]
Definition: cp_campaign.h:384
char weapon[MAX_VAR]
Definition: chr_shared.h:248
bool BS_SellItem(const objDef_t *od, base_t *base, int count)
Sells items from the market.
Definition: cp_market.cpp:414
static void BS_SetAutosell_f(void)
Sets/unsets or flips the autosell property of an item on the market.
objDef_t ods[MAX_OBJDEFS]
Definition: q_shared.h:517
bool AIR_AircraftAllowed(const base_t *base)
Returns true if the current base is able to handle aircraft.
QGL_EXTERN GLuint count
Definition: r_gl.h:99
static void BS_MarketInfoClick_f(void)
Opens the UFOpedia for the current selected item/aircraft/ugv.
#define AIR_ForeachFromBase(var, base)
iterates trough all aircraft from a specific homebase
Definition: cp_aircraft.h:202
#define CAP_GetMax(base, capacity)
Definition: cp_capacity.h:51
An aircraft with all it&#39;s data.
Definition: cp_aircraft.h:115
int price
Definition: chr_shared.h:252
struct technology_s * tech
Definition: cp_aircraft.h:163
static const cmdList_t marketCallbacks[]
QGL_EXTERN GLint i
Definition: r_gl.h:113
aircraftItemType_t type
Definition: inv_shared.h:247
void BS_AddItemToMarket(const objDef_t *od, int amount)
Internal function to add items to the market.
Definition: cp_market.cpp:64
int BS_GetAircraftOnMarket(const aircraft_t *aircraft)
Get the number of aircraft of the given type on the market.
Definition: cp_market.cpp:127
This is the technology parsed from research.ufo.
Definition: cp_research.h:139
ugv_t ugvs[MAX_UGV]
Definition: q_shared.h:564
int BS_GetItemSellingPrice(const objDef_t *od)
Get the price for an item that you want to sell on the market.
Definition: cp_market.cpp:90
void UP_UGVDescription(const struct ugv_s *ugvType)
Definition: cmd.h:86
Header file for single player campaign control.
bool BS_AircraftIsOnMarket(const aircraft_t *aircraft)
Checks whether a given aircraft should appear on the market.
Definition: cp_market.cpp:112
const ugv_t *IMPORT * Com_GetUGVByIDSilent(const char *ugvID)
bool notOnMarket
Definition: inv_shared.h:336
technology_t * RS_GetTechByProvided(const char *idProvided)
returns a pointer to the item tech (as listed in "provides")
static void BS_Buy_f(void)
Buy/Sell item/aircraft/ugv on the market.
#define UGV_SIZE
Definition: cp_produce.h:33
char * id
Definition: chr_shared.h:246
technology_t * RS_GetTechForItem(const objDef_t *item)
Returns technology entry for an item.
int credits
Definition: cp_campaign.h:243
void AIR_RemoveEmployees(aircraft_t &aircraft)
Removes all soldiers from an aircraft.
bool BS_SellAircraft(aircraft_t *aircraft)
Sells the given aircraft with all the equipment.
Definition: cp_market.cpp:265
Header file for menu related console command callbacks.
Employee * E_GetEmployeeByTypeFromChrUCN(employeeType_t type, int uniqueCharacterNumber)
Searches employee from a type for the ucn (character id)
const struct ugv_s * getUGV() const
Definition: cp_employee.h:107
Defines a type of UGV/Robot.
Definition: chr_shared.h:245
bool BS_BuyAircraft(const aircraft_t *aircraftTemplate, base_t *base)
Buys an aircraft.
Definition: cp_market.cpp:237