AADATA.CPP 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /* $Header: /CounterStrike/AADATA.CPP 1 3/03/97 10:24a Joe_bostic $ */
  15. /***********************************************************************************************
  16. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  17. ***********************************************************************************************
  18. * *
  19. * Project Name : Command & Conquer *
  20. * *
  21. * File Name : AADATA.CPP *
  22. * *
  23. * Programmer : Joe L. Bostic *
  24. * *
  25. * Start Date : July 22, 1994 *
  26. * *
  27. * Last Update : July 9, 1996 [JLB] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * AircraftTypeClass::AircraftTypeClass -- Constructor for aircraft objects. *
  32. * AircraftTypeClass::As_Reference -- Given an aircraft type, find the matching type object. *
  33. * AircraftTypeClass::Create_And_Place -- Creates and places aircraft using normal game syste*
  34. * AircraftTypeClass::Create_One_Of -- Creates an aircraft object of the appropriate type. *
  35. * AircraftTypeClass::Dimensions -- Fetches the graphic dimensions of the aircraft type. *
  36. * AircraftTypeClass::Display -- Displays a generic version of the aircraft type. *
  37. * AircraftTypeClass::From_Name -- Converts an ASCII name into an aircraft type number. *
  38. * AircraftTypeClass::Init_Heap -- Initialize the aircraft type class heap. *
  39. * AircraftTypeClass::Max_Pips -- Fetches the maximum number of pips allowed. *
  40. * AircraftTypeClass::Occupy_List -- Returns with occupation list for landed aircraft. *
  41. * AircraftTypeClass::One_Time -- Performs one time initialization of the aircraft type class*
  42. * AircraftTypeClass::Overlap_List -- Determines the overlap list for a landed aircraft. *
  43. * AircraftTypeClass::Prep_For_Add -- Prepares the scenario editor for adding an aircraft obj*
  44. * AircraftTypeClass::operator delete -- Returns aircraft type to special memory pool. *
  45. * AircraftTypeClass::operator new -- Allocates an aircraft type object from special pool. *
  46. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  47. #include "function.h"
  48. void const * AircraftTypeClass::LRotorData = NULL;
  49. void const * AircraftTypeClass::RRotorData = NULL;
  50. // Badger bomber
  51. static AircraftTypeClass const BadgerPlane(
  52. AIRCRAFT_BADGER, // What kind of aircraft is this.
  53. TXT_BADGER, // Translated text number for aircraft.
  54. "BADR", // INI name of aircraft.
  55. 0x0000, // Vertical offset.
  56. 0x0000, // Primary weapon offset along turret centerline.
  57. 0x0000, // Primary weapon lateral offset along turret centerline.
  58. true, // Fixed wing aircraft?
  59. false, // Equipped with a rotor?
  60. false, // Custom rotor sets for each facing?
  61. false, // Can this aircraft land on clear terrain?
  62. true, // Is it invisible on radar?
  63. false, // Can the player select it so as to give it orders?
  64. true, // Can it be assigned as a target for attack.
  65. false, // Is it insignificant (won't be announced)?
  66. false, // Is it immune to normal combat damage?
  67. STRUCT_NONE, // Preferred landing building.
  68. 0xFF, // Landing speed
  69. 16, // Number of rotation stages.
  70. MISSION_HUNT // Default mission for aircraft.
  71. );
  72. // Photo recon plane.
  73. static AircraftTypeClass const U2Plane(
  74. AIRCRAFT_U2, // What kind of aircraft is this.
  75. TXT_U2, // Translated text number for aircraft.
  76. "U2", // INI name of aircraft.
  77. 0x0000, // Vertical offset.
  78. 0x0000, // Primary weapon offset along turret centerline.
  79. 0x0000, // Primary weapon lateral offset along turret centerline.
  80. true, // Fixed wing aircraft?
  81. false, // Equipped with a rotor?
  82. false, // Custom rotor sets for each facing?
  83. false, // Can this aircraft land on clear terrain?
  84. true, // Is it invisible on radar?
  85. false, // Can the player select it so as to give it orders?
  86. true, // Can it be assigned as a target for attack.
  87. false, // Is it insignificant (won't be announced)?
  88. false, // Is it immune to normal combat damage?
  89. STRUCT_NONE, // Preferred landing building.
  90. 0xFF, // Landing speed
  91. 16, // Number of rotation stages.
  92. MISSION_HUNT // Default mission for aircraft.
  93. );
  94. // Mig attack aircraft.
  95. static AircraftTypeClass const MigPlane(
  96. AIRCRAFT_MIG, // What kind of aircraft is this.
  97. TXT_MIG, // Translated text number for aircraft.
  98. "MIG", // INI name of aircraft.
  99. 0x0000, // Vertical offset.
  100. 0x0020, // Primary weapon offset along turret centerline.
  101. 0x0020, // Primary weapon lateral offset along turret centerline.
  102. true, // Fixed wing aircraft?
  103. false, // Equipped with a rotor?
  104. false, // Custom rotor sets for each facing?
  105. false, // Can this aircraft land on clear terrain?
  106. true, // Is it invisible on radar?
  107. true, // Can the player select it so as to give it orders?
  108. true, // Can it be assigned as a target for attack.
  109. false, // Is it insignificant (won't be announced)?
  110. false, // Is it immune to normal combat damage?
  111. STRUCT_AIRSTRIP, // Preferred landing building.
  112. 0xC0, // Landing speed
  113. 16, // Number of rotation stages.
  114. MISSION_HUNT // Default mission for aircraft.
  115. );
  116. // Yak attack aircraft.
  117. static AircraftTypeClass const YakPlane(
  118. AIRCRAFT_YAK, // What kind of aircraft is this.
  119. TXT_YAK, // Translated text number for aircraft.
  120. "YAK", // INI name of aircraft.
  121. 0x0000, // Vertical offset.
  122. 0x0020, // Primary weapon offset along turret centerline.
  123. 0x0020, // Primary weapon lateral offset along turret centerline.
  124. true, // Fixed wing aircraft?
  125. false, // Equipped with a rotor?
  126. false, // Custom rotor sets for each facing?
  127. false, // Can this aircraft land on clear terrain?
  128. true, // Is it invisible on radar?
  129. true, // Can the player select it so as to give it orders?
  130. true, // Can it be assigned as a target for attack.
  131. false, // Is it insignificant (won't be announced)?
  132. false, // Is it immune to normal combat damage?
  133. STRUCT_AIRSTRIP, // Preferred landing building.
  134. 0xFF, // Landing speed
  135. 16, // Number of rotation stages.
  136. MISSION_HUNT // Default mission for aircraft.
  137. );
  138. // Transport helicopter.
  139. static AircraftTypeClass const TransportHeli(
  140. AIRCRAFT_TRANSPORT, // What kind of aircraft is this.
  141. TXT_TRANS, // Translated text number for aircraft.
  142. "TRAN", // INI name of aircraft.
  143. 0x0000, // Vertical offset.
  144. 0x0000, // Primary weapon offset along turret centerline.
  145. 0x0000, // Primary weapon lateral offset along turret centerline.
  146. false, // Fixed wing aircraft?
  147. true, // Equipped with a rotor?
  148. true, // Custom rotor sets for each facing?
  149. true, // Can this aircraft land on clear terrain?
  150. true, // Is it invisible on radar?
  151. true, // Can the player select it so as to give it orders?
  152. true, // Can it be assigned as a target for attack.
  153. false, // Is it insignificant (won't be announced)?
  154. false, // Is it immune to normal combat damage?
  155. STRUCT_NONE, // Preferred landing building.
  156. 0xFF, // Landing speed
  157. 32, // Number of rotation stages.
  158. MISSION_HUNT // Default mission for aircraft.
  159. );
  160. // Longbow attack helicopter
  161. static AircraftTypeClass const AttackHeli(
  162. AIRCRAFT_LONGBOW, // What kind of aircraft is this.
  163. TXT_HELI, // Translated text number for aircraft.
  164. "HELI", // INI name of aircraft.
  165. 0x0000, // Vertical offset.
  166. 0x0040, // Primary weapon offset along turret centerline.
  167. 0x0000, // Primary weapon lateral offset along turret centerline.
  168. false, // Fixed wing aircraft?
  169. true, // Equipped with a rotor?
  170. false, // Custom rotor sets for each facing?
  171. false, // Can this aircraft land on clear terrain?
  172. true, // Is it invisible on radar?
  173. true, // Can the player select it so as to give it orders?
  174. true, // Can it be assigned as a target for attack.
  175. false, // Is it insignificant (won't be announced)?
  176. false, // Is it immune to normal combat damage?
  177. STRUCT_HELIPAD, // Preferred landing building.
  178. 0xFF, // Landing speed
  179. 32, // Number of rotation stages.
  180. MISSION_HUNT // Default mission for aircraft.
  181. );
  182. // Hind
  183. static AircraftTypeClass const OrcaHeli(
  184. AIRCRAFT_HIND, // What kind of aircraft is this.
  185. TXT_ORCA, // Translated text number for aircraft.
  186. "HIND", // INI name of aircraft.
  187. 0x0000, // Vertical offset.
  188. 0x0040, // Primary weapon offset along turret centerline.
  189. 0x0000, // Primary weapon lateral offset along turret centerline.
  190. false, // Fixed wing aircraft?
  191. true, // Equipped with a rotor?
  192. false, // Custom rotor sets for each facing?
  193. false, // Can this aircraft land on clear terrain?
  194. true, // Is it invisible on radar?
  195. true, // Can the player select it so as to give it orders?
  196. true, // Can it be assigned as a target for attack.
  197. false, // Is it insignificant (won't be announced)?
  198. false, // Is it immune to normal combat damage?
  199. STRUCT_HELIPAD, // Preferred landing building.
  200. 0xFF, // Landing speed
  201. 32, // Number of rotation stages.
  202. MISSION_HUNT // Default mission for aircraft.
  203. );
  204. /***********************************************************************************************
  205. * AircraftTypeClass::AircraftTypeClass -- Constructor for aircraft objects. *
  206. * *
  207. * This is the constructor for the aircraft object. *
  208. * *
  209. * INPUT: see below... *
  210. * *
  211. * OUTPUT: none *
  212. * *
  213. * WARNINGS: none *
  214. * *
  215. * HISTORY: *
  216. * 07/26/1994 JLB : Created. *
  217. *=============================================================================================*/
  218. AircraftTypeClass::AircraftTypeClass(
  219. AircraftType airtype,
  220. int name,
  221. char const * ininame,
  222. int verticaloffset,
  223. int primaryoffset,
  224. int primarylateral,
  225. bool is_fixedwing,
  226. bool is_rotorequipped,
  227. bool is_rotorcustom,
  228. bool is_landable,
  229. bool is_stealthy,
  230. bool is_selectable,
  231. bool is_legal_target,
  232. bool is_insignificant,
  233. bool is_immune,
  234. StructType building,
  235. int landingspeed,
  236. int rotation,
  237. MissionType deforder
  238. ) :
  239. TechnoTypeClass(RTTI_AIRCRAFTTYPE,
  240. int(airtype),
  241. name,
  242. ininame,
  243. REMAP_NORMAL,
  244. verticaloffset,
  245. primaryoffset,
  246. primarylateral,
  247. primaryoffset,
  248. primarylateral,
  249. false,
  250. is_stealthy,
  251. is_selectable,
  252. is_legal_target,
  253. is_insignificant,
  254. is_immune,
  255. false,
  256. false,
  257. true,
  258. true,
  259. rotation,
  260. SPEED_WINGED),
  261. IsFixedWing(is_fixedwing),
  262. IsLandable(is_landable),
  263. IsRotorEquipped(is_rotorequipped),
  264. IsRotorCustom(is_rotorcustom),
  265. Type(airtype),
  266. Mission(deforder),
  267. Building(building),
  268. LandingSpeed(landingspeed)
  269. {
  270. /*
  271. ** Forced aircraft overrides from the default.
  272. */
  273. Speed = SPEED_WINGED;
  274. }
  275. /***********************************************************************************************
  276. * AircraftTypeClass::operator new -- Allocates an aircraft type object from special pool. *
  277. * *
  278. * This will allocate an aircraft type class object from the memory pool of that purpose. *
  279. * *
  280. * INPUT: none *
  281. * *
  282. * OUTPUT: Returns with a pointer to the newly allocated aircraft type class object. If there *
  283. * was insufficient memory to fulfill the request, then NULL is returned. *
  284. * *
  285. * WARNINGS: none *
  286. * *
  287. * HISTORY: *
  288. * 07/09/1996 JLB : Created. *
  289. *=============================================================================================*/
  290. void * AircraftTypeClass::operator new(size_t)
  291. {
  292. return(AircraftTypes.Alloc());
  293. }
  294. /***********************************************************************************************
  295. * AircraftTypeClass::operator delete -- Returns aircraft type to special memory pool. *
  296. * *
  297. * This will return the aircraft type class object back to the special memory pool that *
  298. * it was allocated from. *
  299. * *
  300. * INPUT: pointer -- Pointer to the aircraft type class object to delete. *
  301. * *
  302. * OUTPUT: none *
  303. * *
  304. * WARNINGS: none *
  305. * *
  306. * HISTORY: *
  307. * 07/09/1996 JLB : Created. *
  308. *=============================================================================================*/
  309. void AircraftTypeClass::operator delete(void * pointer)
  310. {
  311. AircraftTypes.Free((AircraftTypeClass *)pointer);
  312. }
  313. /***********************************************************************************************
  314. * AircraftTypeClass::Init_Heap -- Initialize the aircraft type class heap. *
  315. * *
  316. * This will initialize the aircraft type class heap by pre-allocating all known aircraft *
  317. * types. It should be called once and before the rules.ini file is processed. *
  318. * *
  319. * INPUT: none *
  320. * *
  321. * OUTPUT: none *
  322. * *
  323. * WARNINGS: none *
  324. * *
  325. * HISTORY: *
  326. * 07/09/1996 JLB : Created. *
  327. *=============================================================================================*/
  328. void AircraftTypeClass::Init_Heap(void)
  329. {
  330. /*
  331. ** These aircraft type class objects must be allocated in the exact order that they
  332. ** are specified in the AircraftSmen enumeration. This is necessary because the heap
  333. ** allocation block index serves double duty as the type number index.
  334. */
  335. new AircraftTypeClass(TransportHeli);
  336. new AircraftTypeClass(BadgerPlane);
  337. new AircraftTypeClass(U2Plane);
  338. new AircraftTypeClass(MigPlane);
  339. new AircraftTypeClass(YakPlane);
  340. new AircraftTypeClass(AttackHeli);
  341. new AircraftTypeClass(OrcaHeli);
  342. }
  343. /***********************************************************************************************
  344. * AircraftTypeClass::From_Name -- Converts an ASCII name into an aircraft type number. *
  345. * *
  346. * This routine is used to convert an ASCII representation of an aircraft into the *
  347. * matching aircraft type number. This is used by the scenario INI reader code. *
  348. * *
  349. * INPUT: name -- Pointer to ASCII name to translate. *
  350. * *
  351. * OUTPUT: Returns the aircraft type number that matches the ASCII name provided. If no *
  352. * match could be found, then AIRCRAFT_NONE is returned. *
  353. * *
  354. * WARNINGS: none *
  355. * *
  356. * HISTORY: *
  357. * 07/26/1994 JLB : Created. *
  358. *=============================================================================================*/
  359. AircraftType AircraftTypeClass::From_Name(char const * name)
  360. {
  361. if (name != NULL) {
  362. for (int classid = AIRCRAFT_FIRST; classid < AIRCRAFT_COUNT; classid++) {
  363. if (stricmp(As_Reference((AircraftType)classid).IniName, name) == 0) {
  364. return(AircraftType)classid;
  365. }
  366. }
  367. }
  368. return(AIRCRAFT_NONE);
  369. }
  370. /***********************************************************************************************
  371. * AircraftTypeClass::One_Time -- Performs one time initialization of the aircraft type class. *
  372. * *
  373. * This routine is used to perform the onetime initialization of the aircraft type. This *
  374. * includes primarily the shape and other graphic data loading. *
  375. * *
  376. * INPUT: none *
  377. * *
  378. * OUTPUT: none *
  379. * *
  380. * WARNINGS: This goes to disk and also must only be called ONCE. *
  381. * *
  382. * HISTORY: *
  383. * 07/26/1994 JLB : Created. *
  384. *=============================================================================================*/
  385. void AircraftTypeClass::One_Time(void)
  386. {
  387. for (int index = AIRCRAFT_FIRST; index < AIRCRAFT_COUNT; index++) {
  388. char fullname[_MAX_FNAME+_MAX_EXT];
  389. AircraftTypeClass const & uclass = As_Reference((AircraftType)index);
  390. /*
  391. ** Fetch the supporting data files for the unit.
  392. */
  393. char buffer[_MAX_FNAME];
  394. sprintf(buffer, "%sICON", uclass.Graphic_Name());
  395. _makepath(fullname, NULL, NULL, buffer, ".SHP");
  396. ((void const *&)uclass.CameoData) = MFCD::Retrieve(fullname);
  397. /*
  398. ** Generic shape for all houses load method.
  399. */
  400. _makepath(fullname, NULL, NULL, uclass.Graphic_Name(), ".SHP");
  401. ((void const *&)uclass.ImageData) = MFCD::Retrieve(fullname);
  402. }
  403. LRotorData = MFCD::Retrieve("LROTOR.SHP");
  404. RRotorData = MFCD::Retrieve("RROTOR.SHP");
  405. }
  406. /***********************************************************************************************
  407. * AircraftTypeClass::Create_One_Of -- Creates an aircraft object of the appropriate type. *
  408. * *
  409. * This routine is used to create an aircraft object that matches the aircraft type. It *
  410. * serves as a shortcut to creating an object using the "new" operator and "if" checks. *
  411. * *
  412. * INPUT: house -- The house owner of the aircraft that is to be created. *
  413. * *
  414. * OUTPUT: Returns with a pointer to the aircraft created. If the aircraft could not be *
  415. * created, then a NULL is returned. *
  416. * *
  417. * WARNINGS: none *
  418. * *
  419. * HISTORY: *
  420. * 07/26/1994 JLB : Created. *
  421. *=============================================================================================*/
  422. ObjectClass * AircraftTypeClass::Create_One_Of(HouseClass * house) const
  423. {
  424. return(new AircraftClass(Type, house->Class->House));
  425. }
  426. #ifdef SCENARIO_EDITOR
  427. /***********************************************************************************************
  428. * AircraftTypeClass::Prep_For_Add -- Prepares the scenario editor for adding an aircraft objec*
  429. * *
  430. * This routine is used by the scenario editor to prepare for the adding operation. It *
  431. * builds a list of pointers to object types that can be added. *
  432. * *
  433. * INPUT: none *
  434. * *
  435. * OUTPUT: none *
  436. * *
  437. * WARNINGS: none *
  438. * *
  439. * HISTORY: *
  440. * 07/26/1994 JLB : Created. *
  441. *=============================================================================================*/
  442. void AircraftTypeClass::Prep_For_Add(void)
  443. {
  444. for (AircraftType index = AIRCRAFT_FIRST; index < AIRCRAFT_COUNT; index++) {
  445. if (As_Reference(index).Get_Image_Data()) {
  446. Map.Add_To_List(&As_Reference(index));
  447. }
  448. }
  449. }
  450. /***********************************************************************************************
  451. * AircraftTypeClass::Display -- Displays a generic version of the aircraft type. *
  452. * *
  453. * This routine is used by the scenario editor to display a generic version of the object *
  454. * type. This is displayed in the object selection dialog box. *
  455. * *
  456. * INPUT: x,y -- The coordinates to draw the aircraft at (centered). *
  457. * *
  458. * window -- The window to base the coordinates upon. *
  459. * *
  460. * house -- The owner of this generic aircraft. *
  461. * *
  462. * OUTPUT: none *
  463. * *
  464. * WARNINGS: none *
  465. * *
  466. * HISTORY: *
  467. * 07/26/1994 JLB : Created. *
  468. *=============================================================================================*/
  469. void AircraftTypeClass::Display(int x, int y, WindowNumberType window, HousesType ) const
  470. {
  471. int shape = 0;
  472. void const * ptr = Get_Cameo_Data();
  473. if (ptr == NULL) {
  474. ptr = Get_Image_Data();
  475. shape = 5;
  476. }
  477. CC_Draw_Shape(ptr, shape, x, y, window, SHAPE_CENTER|SHAPE_WIN_REL);
  478. }
  479. #endif
  480. /***********************************************************************************************
  481. * AircraftTypeClass::Occupy_List -- Returns with occupation list for landed aircraft. *
  482. * *
  483. * This determines the occupation list for the aircraft (if it was landed). *
  484. * *
  485. * INPUT: placement -- Is this for placement legality checking only? The normal condition *
  486. * is for marking occupation flags. *
  487. * *
  488. * OUTPUT: Returns with a pointer to a cell offset occupation list for the aircraft. *
  489. * *
  490. * WARNINGS: This occupation list is only valid if the aircraft is landed. *
  491. * *
  492. * HISTORY: *
  493. * 07/26/1994 JLB : Created. *
  494. *=============================================================================================*/
  495. short const * AircraftTypeClass::Occupy_List(bool) const
  496. {
  497. static short const _list[] = {0, REFRESH_EOL};
  498. return(_list);
  499. }
  500. /***********************************************************************************************
  501. * AircraftTypeClass::Overlap_List -- Determines the overlap list for a landed aircraft. *
  502. * *
  503. * This routine figures out the overlap list for the aircraft as if it were landed. *
  504. * *
  505. * INPUT: none *
  506. * *
  507. * OUTPUT: Returns with the cell offset overlap list for the aircraft. *
  508. * *
  509. * WARNINGS: This overlap list is only valid when the aircraft is landed. *
  510. * *
  511. * HISTORY: *
  512. * 07/26/1994 JLB : Created. *
  513. *=============================================================================================*/
  514. short const * AircraftTypeClass::Overlap_List(void) const
  515. {
  516. static short const _list[] = {-(MAP_CELL_W-1), -MAP_CELL_W, -(MAP_CELL_W+1), -1, 1, (MAP_CELL_W-1), MAP_CELL_W, (MAP_CELL_W+1), REFRESH_EOL};
  517. return(_list);
  518. }
  519. /***********************************************************************************************
  520. * AircraftTypeClass::Max_Pips -- Fetches the maximum number of pips allowed. *
  521. * *
  522. * Use this routine to retrieve the maximum pip count allowed for this aircraft. This is *
  523. * the maximum number of passengers. *
  524. * *
  525. * INPUT: none *
  526. * *
  527. * OUTPUT: Returns with the maximum number of pips for this aircraft. *
  528. * *
  529. * WARNINGS: none *
  530. * *
  531. * HISTORY: *
  532. * 06/26/1995 JLB : Created. *
  533. *=============================================================================================*/
  534. int AircraftTypeClass::Max_Pips(void) const
  535. {
  536. if (PrimaryWeapon != NULL) {
  537. // Camera weapon (ex. on the Spy plane) doesn't display any pips
  538. if (!PrimaryWeapon->IsCamera) {
  539. return(5);
  540. }
  541. }
  542. return(Max_Passengers());
  543. }
  544. /***********************************************************************************************
  545. * AircraftTypeClass::Create_And_Place -- Creates and places aircraft using normal game system *
  546. * *
  547. * This routine is used to create and place an aircraft through the normal game system. *
  548. * Since creation of aircraft in this fashion is prohibited, this routine does nothing. *
  549. * *
  550. * INPUT: na *
  551. * *
  552. * OUTPUT: Always returns a failure code (false). *
  553. * *
  554. * WARNINGS: none *
  555. * *
  556. * HISTORY: *
  557. * 08/07/1995 JLB : Created. *
  558. *=============================================================================================*/
  559. bool AircraftTypeClass::Create_And_Place(CELL, HousesType) const
  560. {
  561. return(false);
  562. }
  563. /***********************************************************************************************
  564. * AircraftTypeClass::Dimensions -- Fetches the graphic dimensions of the aircraft type. *
  565. * *
  566. * This routine will fetch the pixel dimensions of this aircraft type. These dimensions *
  567. * are used to control map refresh and select box rendering. *
  568. * *
  569. * INPUT: width -- Reference to variable that will be filled in with aircraft width. *
  570. * *
  571. * height -- Reference to variable that will be filled in with aircraft height. *
  572. * *
  573. * OUTPUT: none *
  574. * *
  575. * WARNINGS: none *
  576. * *
  577. * HISTORY: *
  578. * 08/07/1995 JLB : Created. *
  579. *=============================================================================================*/
  580. void AircraftTypeClass::Dimensions(int &width, int &height) const
  581. {
  582. if (Type == AIRCRAFT_BADGER) {
  583. width = 56;
  584. height = 56;
  585. } else {
  586. width = 21;
  587. height = 20;
  588. }
  589. }
  590. /***********************************************************************************************
  591. * AircraftTypeClass::As_Reference -- Given an aircraft type, find the matching type object. *
  592. * *
  593. * This routine is used to fetch a reference to the aircraft type class object that matches *
  594. * the aircraft type specified. *
  595. * *
  596. * INPUT: aircraft -- The aircraft type to fetch a reference to the type class object of. *
  597. * *
  598. * OUTPUT: Returns with a reference to the type class object of this aircraft type. *
  599. * *
  600. * WARNINGS: Be sure that the aircraft type specified is legal. Illegal values will result *
  601. * in undefined behavior. *
  602. * *
  603. * HISTORY: *
  604. * 07/09/1996 JLB : Created. *
  605. *=============================================================================================*/
  606. AircraftTypeClass & AircraftTypeClass::As_Reference(AircraftType aircraft)
  607. {
  608. return(*AircraftTypes.Ptr(aircraft));
  609. }