AADATA.CPP (42122B)
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 9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 10 // in the hope that it will be useful, but with permitted additional restrictions 11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 // distributed with this program. You should have received a copy of the 13 // GNU General Public License along with permitted additional restrictions 14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection 15 16 /* $Header: F:\projects\c&c\vcs\code\aadata.cpv 2.18 16 Oct 1995 16:49:50 JOE_BOSTIC $ */ 17 /*********************************************************************************************** 18 *** 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 *** 19 *********************************************************************************************** 20 * * 21 * Project Name : Command & Conquer * 22 * name in * 23 * File Name : AADATA.CPP * 24 * * 25 * Programmer : Joe L. Bostic * 26 * * 27 * Start Date : July 22, 1994 * 28 * * 29 * Last Update : August 7, 1995 [JLB] * 30 * Determines * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * AircraftTypeClass::AircraftTypeClass -- Constructor for aircraft objects. * 34 * AircraftTypeClass::Create_And_Place -- Creates and places aircraft using normal game syste* 35 * AircraftTypeClass::Create_One_Of -- Creates an aircraft object of the appropriate type. * 36 * AircraftTypeClass::Dimensions -- Fetches the graphic dimensions of the aircraft type. * 37 * AircraftTypeClass::Display -- Displays a generic version of the aircraft type. * 38 * AircraftTypeClass::From_Name -- Converts an ASCIIto an aircraft type number. * 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 -- the overlap list for a landed aircraft. * 43 * AircraftTypeClass::Prep_For_Add -- Prepares the scenario editor for adding an aircraft objec* 44 * AircraftTypeClass::Repair_Cost -- Fetchs the cost per repair step. * 45 * AircraftTypeClass::Repair_Step -- Fetches the number of health points per repair. * 46 * AircraftTypeClass::Who_Can_Build_Me -- Determines which object can build the aircraft obje* 47 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 48 49 #include "function.h" 50 51 52 void const * AircraftTypeClass::LRotorData = NULL; 53 void const * AircraftTypeClass::RRotorData = NULL; 54 55 // A-10 attack plane 56 static AircraftTypeClass const AttackPlane( 57 AIRCRAFT_A10, // What kind of aircraft is this. 58 TXT_A10, // Translated text number for aircraft. 59 "A10", // INI name of aircraft. 60 99, // Build level. 61 STRUCTF_NONE, // Building prerequisite. 62 false, // Is a leader type? 63 false, // Does it fire a pair of shots in quick succession? 64 false, // Is this a typical transport vehicle? 65 true, // Fixed wing aircraft? 66 false, // Equipped with a rotor? 67 false, // Custom rotor sets for each facing? 68 false, // Can this aircraft land on clear terrain? 69 false, // Can the aircraft be crushed by a tracked vehicle? 70 true, // Is it invisible on radar? 71 false, // Can the player select it so as to give it orders? 72 true, // Can it be assigned as a target for attack. 73 false, // Is it insignificant (won't be announced)? 74 false, // Is it immune to normal combat damage? 75 false, // Theater specific graphic image? 76 false, // Can it be repaired in a repair facility? 77 false, // Can the player construct or order this unit? 78 true, // Is there a crew inside? 79 3, // Number of shots it has (default). 80 60, // The strength of this unit. 81 0, // The range that it reveals terrain around itself. 82 800, // Credit cost to construct. 83 0, // The scenario this becomes available. 84 10,1, // Risk, reward when calculating AI. 85 HOUSEF_MULTI1| 86 HOUSEF_MULTI2| 87 HOUSEF_MULTI3| 88 HOUSEF_MULTI4| 89 HOUSEF_MULTI5| 90 HOUSEF_MULTI6| 91 HOUSEF_JP| 92 HOUSEF_GOOD| 93 HOUSEF_BAD, // Who can own this aircraft type. 94 WEAPON_NAPALM,WEAPON_NONE, 95 ARMOR_ALUMINUM, // Armor type of this aircraft. 96 MPH_FAST, // Maximum speed of aircraft. 97 5, // Rate of turn. 98 MISSION_HUNT // Default mission for aircraft. 99 ); 100 101 // Transport helicopter. 102 static AircraftTypeClass const TransportHeli( 103 AIRCRAFT_TRANSPORT, // What kind of aircraft is this. 104 TXT_TRANS, // Translated text number for aircraft. 105 "TRAN", // INI name of aircraft. 106 6, // Build level. 107 STRUCTF_HELIPAD, // Building prerequisite. 108 false, // Is a leader type? 109 false, // Does it fire a pair of shots in quick succession? 110 true, // Is this a typical transport vehicle? 111 false, // Fixed wing aircraft? 112 true, // Equipped with a rotor? 113 true, // Custom rotor sets for each facing? 114 true, // Can this aircraft land on clear terrain? 115 false, // Can the aircraft be crushed by a tracked vehicle? 116 true, // Is it invisible on radar? 117 true, // Can the player select it so as to give it orders? 118 true, // Can it be assigned as a target for attack. 119 false, // Is it insignificant (won't be announced)? 120 false, // Theater specific graphic image? 121 false, // Is it equipped with a combat turret? 122 false, // Can it be repaired in a repair facility? 123 true, // Can the player construct or order this unit? 124 true, // Is there a crew inside? 125 0, // Number of shots it has (default). 126 90, // The strength of this unit. 127 0, // The range that it reveals terrain around itself. 128 1500, // Credit cost to construct. 129 98, // The scenario this becomes available. 130 10,80, // Risk, reward when calculating AI. 131 HOUSEF_MULTI1| 132 HOUSEF_MULTI2| 133 HOUSEF_MULTI3| 134 HOUSEF_MULTI4| 135 HOUSEF_MULTI5| 136 HOUSEF_MULTI6| 137 HOUSEF_JP| 138 HOUSEF_BAD| 139 HOUSEF_GOOD, // Who can own this aircraft type. 140 WEAPON_NONE,WEAPON_NONE, 141 ARMOR_ALUMINUM, // Armor type of this aircraft. 142 MPH_MEDIUM_FAST, // Maximum speed of aircraft. 143 5, // Rate of turn. 144 MISSION_HUNT // Default mission for aircraft. 145 ); 146 147 // Apache attach helicopter. 148 static AircraftTypeClass const AttackHeli( 149 AIRCRAFT_HELICOPTER, // What kind of aircraft is this. 150 TXT_HELI, // Translated text number for aircraft. 151 "HELI", // INI name of aircraft. 152 6, // Build level. 153 STRUCTF_HELIPAD, // Building prerequisite. 154 true, // Is a leader type? 155 true, // Does it fire a pair of shots in quick succession? 156 false, // Is this a typical transport vehicle? 157 false, // Fixed wing aircraft? 158 true, // Equipped with a rotor? 159 false, // Custom rotor sets for each facing? 160 false, // Can this aircraft land on clear terrain? 161 false, // Can the aircraft be crushed by a tracked vehicle? 162 true, // Is it invisible on radar? 163 true, // Can the player select it so as to give it orders? 164 true, // Can it be assigned as a target for attack. 165 false, // Is it insignificant (won't be announced)? 166 false, // Is it immune to normal combat damage? 167 false, // Theater specific graphic image? 168 false, // Can it be repaired in a repair facility? 169 true, // Can the player construct or order this unit? 170 true, // Is there a crew inside? 171 15, // Number of shots it has (default). 172 125, // The strength of this unit. 173 0, // The range that it reveals terrain around itself. 174 1200, // Credit cost to construct. 175 10, // The scenario this becomes available. 176 10,80, // Risk, reward when calculating AI. 177 HOUSEF_MULTI1| 178 HOUSEF_MULTI2| 179 HOUSEF_MULTI3| 180 HOUSEF_MULTI4| 181 HOUSEF_MULTI5| 182 HOUSEF_MULTI6| 183 HOUSEF_JP| 184 HOUSEF_BAD, // Who can own this aircraft type. 185 WEAPON_CHAIN_GUN,WEAPON_NONE, 186 ARMOR_STEEL, // Armor type of this aircraft. 187 MPH_FAST, // Maximum speed of aircraft. 188 4, // Rate of turn. 189 MISSION_HUNT // Default mission for aircraft. 190 ); 191 192 193 // Orca attack helicopter. 194 static AircraftTypeClass const OrcaHeli( 195 AIRCRAFT_ORCA, // What kind of aircraft is this. 196 TXT_ORCA, // Translated text number for aircraft. 197 "ORCA", // INI name of aircraft. 198 6, // Build level. 199 STRUCTF_HELIPAD, // Building prerequisite. 200 true, // Is a leader type? 201 true, // Does it fire a pair of shots in quick succession? 202 false, // Is this a typical transport vehicle? 203 false, // Fixed wing aircraft? 204 false, // Equipped with a rotor? 205 false, // Custom rotor sets for each facing? 206 false, // Can this aircraft land on clear terrain? 207 false, // Can the aircraft be crushed by a tracked vehicle? 208 true, // Is it invisible on radar? 209 true, // Can the player select it so as to give it orders? 210 true, // Can it be assigned as a target for attack. 211 false, // Is it insignificant (won't be announced)? 212 false, // Is it immune to normal combat damage? 213 false, // Theater specific graphic image? 214 false, // Can it be repaired in a repair facility? 215 true, // Can the player construct or order this unit? 216 true, // Is there a crew inside? 217 6, // Number of shots it has (default). 218 125, // The strength of this unit. 219 0, // The range that it reveals terrain around itself. 220 1200, // Credit cost to construct. 221 10, // The scenario this becomes available. 222 10,80, // Risk, reward when calculating AI. 223 HOUSEF_MULTI1| 224 HOUSEF_MULTI2| 225 HOUSEF_MULTI3| 226 HOUSEF_MULTI4| 227 HOUSEF_MULTI5| 228 HOUSEF_MULTI6| 229 HOUSEF_JP| 230 HOUSEF_GOOD, // Who can own this aircraft type. 231 WEAPON_DRAGON,WEAPON_NONE, 232 ARMOR_STEEL, // Armor type of this aircraft. 233 MPH_FAST, // Maximum speed of aircraft. 234 4, // Rate of turn. 235 MISSION_HUNT // Default mission for aircraft. 236 ); 237 238 239 // C-17 transport plane. 240 static AircraftTypeClass const CargoPlane( 241 AIRCRAFT_CARGO, // What kind of aircraft is this. 242 TXT_C17, // Translated text number for aircraft. 243 "C17", // INI name of aircraft. 244 99, // Build level. 245 STRUCTF_NONE, // Building prerequisite. 246 false, // Is a leader type? 247 false, // Does it fire a pair of shots in quick succession? 248 true, // Is this a typical transport vehicle? 249 true, // Fixed wing aircraft? 250 false, // Equipped with a rotor? 251 false, // Custom rotor sets for each facing? 252 false, // Can this aircraft land on clear terrain? 253 false, // Can the aircraft be crushed by a tracked vehicle? 254 true, // Is it invisible on radar? 255 false, // Can the player select it so as to give it orders? 256 false, // Can it be assigned as a target for attack. 257 false, // Is it insignificant (won't be announced)? 258 false, // Is it immune to normal combat damage? 259 false, // Theater specific graphic image? 260 false, // Can it be repaired in a repair facility? 261 false, // Can the player construct or order this unit? 262 true, // Is there a crew inside? 263 0, // Number of shots it has (default). 264 25, // The strength of this unit. 265 0, // The range that it reveals terrain around itself. 266 800, // Credit cost to construct. 267 0, // The scenario this becomes available. 268 10,1, // Risk, reward when calculating AI. 269 HOUSEF_MULTI1| 270 HOUSEF_MULTI2| 271 HOUSEF_MULTI3| 272 HOUSEF_MULTI4| 273 HOUSEF_MULTI5| 274 HOUSEF_MULTI6| 275 HOUSEF_JP| 276 HOUSEF_GOOD| 277 HOUSEF_BAD, // Who can own this aircraft type. 278 WEAPON_NONE,WEAPON_NONE, 279 ARMOR_ALUMINUM, // Armor type of this aircraft. 280 MPH_FAST, // Maximum speed of aircraft. 281 5, // Rate of turn. 282 MISSION_HUNT // Default mission for aircraft. 283 ); 284 285 286 AircraftTypeClass const * const AircraftTypeClass::Pointers[AIRCRAFT_COUNT] = { 287 &TransportHeli, 288 &AttackPlane, 289 &AttackHeli, 290 &CargoPlane, 291 &OrcaHeli, 292 }; 293 294 295 /*********************************************************************************************** 296 * AircraftTypeClass::AircraftTypeClass -- Constructor for aircraft objects. * 297 * * 298 * This is the constructor for the aircraft object. * 299 * * 300 * INPUT: see below... * 301 * * 302 * OUTPUT: none * 303 * * 304 * WARNINGS: none * 305 * * 306 * HISTORY: * 307 * 07/26/1994 JLB : Created. * 308 *=============================================================================================*/ 309 AircraftTypeClass::AircraftTypeClass( 310 AircraftType airtype, 311 int name, 312 char const *ininame, 313 unsigned char level, 314 long pre, 315 bool is_leader, 316 bool is_twoshooter, 317 bool is_transporter, 318 bool is_fixedwing, 319 bool is_rotorequipped, 320 bool is_rotorcustom, 321 bool is_landable, 322 bool is_crushable, 323 bool is_stealthy, 324 bool is_selectable, 325 bool is_legal_target, 326 bool is_insignificant, 327 bool is_immune, 328 bool is_theater, 329 bool is_repairable, 330 bool is_buildable, 331 bool is_crew, 332 int ammo, 333 unsigned short strength, 334 int sightrange, 335 int cost, 336 int scenario, 337 int risk, 338 int reward, 339 int ownable, 340 WeaponType primary, 341 WeaponType secondary, 342 ArmorType armor, 343 MPHType maxspeed, 344 int rot, 345 MissionType deforder) : 346 TechnoTypeClass(name, 347 ininame, 348 level, 349 pre, 350 is_leader, 351 false, 352 false, 353 is_transporter, 354 false, 355 is_crushable, 356 is_stealthy, 357 is_selectable, 358 is_legal_target, 359 is_insignificant, 360 is_immune, 361 is_theater, 362 is_twoshooter, 363 false, 364 is_repairable, 365 is_buildable, 366 is_crew, 367 ammo, 368 strength, 369 maxspeed, 370 sightrange, 371 cost, 372 scenario, 373 risk, 374 reward, 375 ownable, 376 primary, 377 secondary, 378 armor) 379 { 380 IsRotorEquipped = is_rotorequipped; 381 IsRotorCustom = is_rotorcustom; 382 IsLandable = is_landable; 383 IsFixedWing = is_fixedwing; 384 Type = airtype; 385 ROT = rot; 386 Mission = deforder; 387 } 388 389 390 /*********************************************************************************************** 391 * AircraftTypeClass::From_Name -- Converts an ASCII name into an aircraft type number. * 392 * * 393 * This routine is used to convert an ASCII representation of an aircraft into the * 394 * matching aircraft type number. This is used by the scenario INI reader code. * 395 * * 396 * INPUT: name -- Pointer to ASCII name to translate. * 397 * * 398 * OUTPUT: Returns the aircraft type number that matches the ASCII name provided. If no * 399 * match could be found, then AIRCRAFT_NONE is returned. * 400 * * 401 * WARNINGS: none * 402 * * 403 * HISTORY: * 404 * 07/26/1994 JLB : Created. * 405 *=============================================================================================*/ 406 AircraftType AircraftTypeClass::From_Name(char const *name) 407 { 408 if (name) { 409 for (AircraftType classid = AIRCRAFT_FIRST; classid < AIRCRAFT_COUNT; classid++) { 410 if (stricmp(Pointers[classid]->IniName, name) == 0) { 411 return(classid); 412 } 413 } 414 } 415 return(AIRCRAFT_NONE); 416 } 417 418 419 /*********************************************************************************************** 420 * AircraftTypeClass::One_Time -- Performs one time initialization of the aircraft type class. * 421 * * 422 * This routine is used to perform the onetime initialization of the aircraft type. This * 423 * includes primarily the shape and other graphic data loading. * 424 * * 425 * INPUT: none * 426 * * 427 * OUTPUT: none * 428 * * 429 * WARNINGS: This goes to disk and also must only be called ONCE. * 430 * * 431 * HISTORY: * 432 * 07/26/1994 JLB : Created. * 433 *=============================================================================================*/ 434 void AircraftTypeClass::One_Time(void) 435 { 436 AircraftType index; 437 438 for (index = AIRCRAFT_FIRST; index < AIRCRAFT_COUNT; index++) { 439 char fullname[_MAX_FNAME+_MAX_EXT]; 440 AircraftTypeClass const & uclass = As_Reference(index); 441 442 /* 443 ** Fetch the supporting data files for the unit. 444 */ 445 char buffer[_MAX_FNAME]; 446 if ( Get_Resolution_Factor() ) { 447 sprintf(buffer, "%sICNH", uclass.IniName); 448 } else { 449 sprintf(buffer, "%sICON", uclass.IniName); 450 } 451 _makepath(fullname, NULL, NULL, buffer, ".SHP"); 452 ((void const *&)uclass.CameoData) = MixFileClass::Retrieve(fullname); 453 454 /* 455 ** Generic shape for all houses load method. 456 */ 457 _makepath(fullname, NULL, NULL, uclass.IniName, ".SHP"); 458 ((void const *&)uclass.ImageData) = MixFileClass::Retrieve(fullname); 459 } 460 461 LRotorData = MixFileClass::Retrieve("LROTOR.SHP"); 462 RRotorData = MixFileClass::Retrieve("RROTOR.SHP"); 463 } 464 465 466 /*********************************************************************************************** 467 * AircraftTypeClass::Create_One_Of -- Creates an aircraft object of the appropriate type. * 468 * * 469 * This routine is used to create an aircraft object that matches the aircraft type. It * 470 * serves as a shortcut to creating an object using the "new" operator and "if" checks. * 471 * * 472 * INPUT: house -- The house owner of the aircraft that is to be created. * 473 * * 474 * OUTPUT: Returns with a pointer to the aircraft created. If the aircraft could not be * 475 * created, then a NULL is returned. * 476 * * 477 * WARNINGS: none * 478 * * 479 * HISTORY: * 480 * 07/26/1994 JLB : Created. * 481 *=============================================================================================*/ 482 ObjectClass * AircraftTypeClass::Create_One_Of(HouseClass * house) const 483 { 484 return(new AircraftClass(Type, house->Class->House)); 485 } 486 487 488 #ifdef SCENARIO_EDITOR 489 /*********************************************************************************************** 490 * AircraftTypeClass::Prep_For_Add -- Prepares the scenario editor for adding an aircraft objec* 491 * * 492 * This routine is used by the scenario editor to prepare for the adding operation. It * 493 * builds a list of pointers to object types that can be added. * 494 * * 495 * INPUT: none * 496 * * 497 * OUTPUT: none * 498 * * 499 * WARNINGS: none * 500 * * 501 * HISTORY: * 502 * 07/26/1994 JLB : Created. * 503 *=============================================================================================*/ 504 void AircraftTypeClass::Prep_For_Add(void) 505 { 506 for (AircraftType index = AIRCRAFT_FIRST; index < AIRCRAFT_COUNT; index++) { 507 if (As_Reference(index).Get_Image_Data()) { 508 Map.Add_To_List(&As_Reference(index)); 509 } 510 } 511 } 512 513 514 /*********************************************************************************************** 515 * AircraftTypeClass::Display -- Displays a generic version of the aircraft type. * 516 * * 517 * This routine is used by the scenario editor to display a generic version of the object * 518 * type. This is displayed in the object selection dialog box. * 519 * * 520 * INPUT: x,y -- The coordinates to draw the aircraft at (centered). * 521 * * 522 * window -- The window to base the coordinates upon. * 523 * * 524 * house -- The owner of this generic aircraft. * 525 * * 526 * OUTPUT: none * 527 * * 528 * WARNINGS: none * 529 * * 530 * HISTORY: * 531 * 07/26/1994 JLB : Created. * 532 *=============================================================================================*/ 533 void AircraftTypeClass::Display(int x, int y, WindowNumberType window, HousesType house) const 534 { 535 int shape = 0; 536 void const * ptr = Get_Cameo_Data(); 537 if (!ptr) { 538 ptr = Get_Image_Data(); 539 shape = 5; 540 } 541 CC_Draw_Shape(ptr, shape, x, y, window, SHAPE_CENTER|SHAPE_WIN_REL|SHAPE_FADING, HouseClass::As_Pointer(house)->Remap_Table(false, true)); 542 } 543 #endif 544 545 546 /*********************************************************************************************** 547 * AircraftTypeClass::Occupy_List -- Returns with occupation list for landed aircraft. * 548 * * 549 * This determines the occupation list for the aircraft (if it was landed). * 550 * * 551 * INPUT: placement -- Is this for placement legality checking only? The normal condition * 552 * is for marking occupation flags. * 553 * * 554 * OUTPUT: Returns with a pointer to a cell offset occupation list for the aircraft. * 555 * * 556 * WARNINGS: This occupation list is only valid if the aircraft is landed. * 557 * * 558 * HISTORY: * 559 * 07/26/1994 JLB : Created. * 560 *=============================================================================================*/ 561 short const * AircraftTypeClass::Occupy_List(bool) const 562 { 563 static short const _list[] = {0, REFRESH_EOL}; 564 return(_list); 565 } 566 567 568 /*********************************************************************************************** 569 * AircraftTypeClass::Overlap_List -- Determines the overlap list for a landed aircraft. * 570 * * 571 * This routine figures out the overlap list for the aircraft as if it were landed. * 572 * * 573 * INPUT: none * 574 * * 575 * OUTPUT: Returns with the cell offset overlap list for the aircraft. * 576 * * 577 * WARNINGS: This overlap list is only valid when the aircraft is landed. * 578 * * 579 * HISTORY: * 580 * 07/26/1994 JLB : Created. * 581 *=============================================================================================*/ 582 short const * AircraftTypeClass::Overlap_List(void) const 583 { 584 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}; 585 return(_list); 586 } 587 588 589 /*********************************************************************************************** 590 * AircraftTypeClass::Who_Can_Build_Me -- Determines which object can build the aircraft objec * 591 * * 592 * Use this routine to determine which object (factory) can build the aircraft. It * 593 * determines this by scanning through the available factories, looking for one that is * 594 * of the proper ownership and is available. * 595 * * 596 * INPUT: intheory -- When true, it doesn't consider if the factory is currently busy. It * 597 * only considers that it is the right type. * 598 * * 599 * legal -- Should building prerequisite legality checks be performed as well? * 600 * For building placements, this is usually false. For sidebar button * 601 * adding, this is usually true. * 602 * * 603 * house -- The house of the desired aircraft to be built. * 604 * * 605 * OUTPUT: Returns with a pointer to the object that can build the aircraft. * 606 * * 607 * WARNINGS: none * 608 * * 609 * HISTORY: * 610 * 11/30/1994 JLB : Created. * 611 *=============================================================================================*/ 612 BuildingClass * AircraftTypeClass::Who_Can_Build_Me(bool , bool legal, HousesType house) const 613 { 614 BuildingClass * anybuilding = NULL; 615 for (int index = 0; index < Buildings.Count(); index++) { 616 BuildingClass * building = Buildings.Ptr(index); 617 618 if (building && 619 !building->IsInLimbo && 620 building->House->Class->House == house && 621 building->Mission != MISSION_DECONSTRUCTION && 622 ((1L << building->ActLike) & Ownable) && 623 (!legal || building->House->Can_Build(Type, building->ActLike)) && 624 building->Class->ToBuild == RTTI_AIRCRAFTTYPE) { 625 626 if (building->IsLeader) return(building); 627 anybuilding = building; 628 } 629 } 630 return(anybuilding); 631 } 632 633 634 /*********************************************************************************************** 635 * AircraftTypeClass::Repair_Cost -- Fetchs the cost per repair step. * 636 * * 637 * This routine will return the cost for every repair step. * 638 * * 639 * INPUT: none * 640 * * 641 * OUTPUT: Returns with the credit expense for every repair step. * 642 * * 643 * WARNINGS: none * 644 * * 645 * HISTORY: * 646 * 06/26/1995 JLB : Created. * 647 *=============================================================================================*/ 648 int AircraftTypeClass::Repair_Cost(void) const 649 { 650 return(Fixed_To_Cardinal(Cost/(MaxStrength/REPAIR_STEP), REPAIR_PERCENT)); 651 } 652 653 654 /*********************************************************************************************** 655 * AircraftTypeClass::Repair_Step -- Fetches the number of health points per repair. * 656 * * 657 * For every repair event, the returned number of health points is acquired. * 658 * * 659 * INPUT: none * 660 * * 661 * OUTPUT: Returns with the number of health points to recover each repair step. * 662 * * 663 * WARNINGS: none * 664 * * 665 * HISTORY: * 666 * 06/26/1995 JLB : Created. * 667 *=============================================================================================*/ 668 int AircraftTypeClass::Repair_Step(void) const 669 { 670 return(REPAIR_STEP); 671 } 672 673 674 /*********************************************************************************************** 675 * AircraftTypeClass::Max_Pips -- Fetches the maximum number of pips allowed. * 676 * * 677 * Use this routine to retrieve the maximum pip count allowed for this aircraft. This is * 678 * the maximum number of passengers. * 679 * * 680 * INPUT: none * 681 * * 682 * OUTPUT: Returns with the maximum number of pips for this aircraft. * 683 * * 684 * WARNINGS: none * 685 * * 686 * HISTORY: * 687 * 06/26/1995 JLB : Created. * 688 *=============================================================================================*/ 689 int AircraftTypeClass::Max_Pips(void) const 690 { 691 if (IsTransporter) { 692 return(Max_Passengers()); 693 } else { 694 if (Primary != WEAPON_NONE) { 695 return(5); 696 } 697 } 698 return(0); 699 } 700 701 702 /*********************************************************************************************** 703 * AircraftTypeClass::Create_And_Place -- Creates and places aircraft using normal game system * 704 * * 705 * This routine is used to create and place an aircraft through the normal game system. * 706 * Since creation of aircraft in this fashion is prohibited, this routine does nothing. * 707 * * 708 * INPUT: na * 709 * * 710 * OUTPUT: Always returns a failure code (false). * 711 * * 712 * WARNINGS: none * 713 * * 714 * HISTORY: * 715 * 08/07/1995 JLB : Created. * 716 *=============================================================================================*/ 717 bool AircraftTypeClass::Create_And_Place(CELL, HousesType) const 718 { 719 return(false); 720 } 721 722 723 724 725 726 /*********************************************************************************************** 727 * ATC::Init -- load up terrain set dependant sidebar icons * 728 * * 729 * * 730 * * 731 * INPUT: theater type * 732 * * 733 * OUTPUT: Nothing * 734 * * 735 * WARNINGS: None * 736 * * 737 * HISTORY: * 738 * 4/25/96 0:33AM ST : Created * 739 *=============================================================================================*/ 740 741 void AircraftTypeClass::Init(TheaterType theater) 742 { 743 if (theater != LastTheater){ 744 if ( Get_Resolution_Factor() ) { 745 746 AircraftType index; 747 char buffer[_MAX_FNAME]; 748 char fullname[_MAX_FNAME+_MAX_EXT]; 749 void const * cameo_ptr; 750 751 for (index = AIRCRAFT_FIRST; index < AIRCRAFT_COUNT; index++) { 752 AircraftTypeClass const & uclass = As_Reference(index); 753 754 ((void const *&)uclass.CameoData) = NULL; 755 756 sprintf(buffer, "%.4sICNH", uclass.IniName); 757 _makepath (fullname, NULL, NULL, buffer, Theaters[theater].Suffix); 758 cameo_ptr = MixFileClass::Retrieve(fullname); 759 if (cameo_ptr){ 760 ((void const *&)uclass.CameoData) = cameo_ptr; 761 } 762 } 763 } 764 } 765 } 766 767 768 769 770 771 /*********************************************************************************************** 772 * AircraftTypeClass::Dimensions -- Fetches the graphic dimensions of the aircraft type. * 773 * * 774 * This routine will fetch the pixel dimensions of this aircraft type. These dimensions * 775 * are used to control map refresh and select box rendering. * 776 * * 777 * INPUT: width -- Reference to variable that will be filled in with aircraft width. * 778 * * 779 * height -- Reference to variable that will be filled in with aircraft height. * 780 * * 781 * OUTPUT: none * 782 * * 783 * WARNINGS: none * 784 * * 785 * HISTORY: * 786 * 08/07/1995 JLB : Created. * 787 *=============================================================================================*/ 788 void AircraftTypeClass::Dimensions(int &width, int &height) const 789 { 790 width = 21; 791 height = 20; 792 } 793 794 795 RTTIType AircraftTypeClass::What_Am_I(void) const {return RTTI_AIRCRAFTTYPE;};