IOOBJ.CPP (60271B)
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: /CounterStrike/IOOBJ.CPP 1 3/03/97 10:24a 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 * * 23 * File Name : IOOBJ.CPP * 24 * * 25 * Programmer : Bill Randolph * 26 * * 27 * Start Date : January 16, 1995 * 28 * * 29 * Last Update : May 13, 1996 [JLB] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * BulletClass::Code_Pointers -- codes class's pointers for load/save * 34 * BulletClass::Decode_Pointers -- decodes pointers for load/save * 35 * CargoClass::Code_Pointers -- codes class's pointers for load/save * 36 * CargoClass::Decode_Pointers -- decodes pointers for load/save * 37 * FactoryClass::Code_Pointers -- codes class's pointers for load/save * 38 * FactoryClass::Decode_Pointers -- decodes pointers for load/save * 39 * FootClass::Code_Pointers -- codes class's pointers for load/save * 40 * FootClass::Decode_Pointers -- decodes pointers for load/save * 41 * HouseClass::Code_Pointers -- codes class's pointers for load/save * 42 * HouseClass::Decode_Pointers -- decodes pointers for load/save * 43 * LayerClass::Code_Pointers -- codes class's pointers for load/save * 44 * LayerClass::Decode_Pointers -- decodes pointers for load/save * 45 * LayerClass::Load -- Reads from a save game file. * 46 * LayerClass::Save -- Write to a save game file. * 47 * ObjectClass::Code_Pointers -- codes class's pointers for load/save * 48 * ObjectClass::Decode_Pointers -- decodes pointers for load/save * 49 * RadioClass::Code_Pointers -- codes class's pointers for load/save * 50 * RadioClass::Decode_Pointers -- decodes pointers for load/save * 51 * ReinforcementClass::Code_Pointers -- codes class's pointers for load/save * 52 * ReinforcementClass::Decode_Pointers -- decodes pointers for load/save * 53 * ScoreClass::Code_Pointers -- codes class's pointers for load/save * 54 * ScoreClass::Decode_Pointers -- decodes pointers for load/save * 55 * TeamClass::Code_Pointers -- codes class's pointers for load/save * 56 * TeamClass::Decode_Pointers -- decodes pointers for load/save * 57 * TeamTypeClass::Code_Pointers -- codes class's pointers for load/save * 58 * TeamTypeClass::Decode_Pointers -- decodes pointers for load/save * 59 * TechnoClass::Code_Pointers -- codes class's pointers for load/save * 60 * TechnoClass::Decode_Pointers -- decodes pointers for load/save * 61 * TriggerClass::Code_Pointers -- codes class's pointers for load/save * 62 * TriggerClass::Decode_Pointers -- decodes pointers for load/save * 63 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 64 65 #include "function.h" 66 67 68 /*********************************************************************************************** 69 * TeamTypeClass::Code_Pointers -- codes class's pointers for load/save * 70 * * 71 * This routine "codes" the pointers in the class by converting them to a number * 72 * that still represents the object pointed to, but isn't actually a pointer. This * 73 * allows a saved game to properly load without relying on the games data still * 74 * being in the exact same location. * 75 * * 76 * INPUT: * 77 * none. * 78 * * 79 * OUTPUT: * 80 * none. * 81 * * 82 * WARNINGS: * 83 * none. * 84 * * 85 * HISTORY: * 86 * 01/02/1995 BR : Created. * 87 *=============================================================================================*/ 88 void TeamTypeClass::Code_Pointers(void) 89 { 90 /* 91 ** Code the Class array 92 */ 93 for (int i = 0; i < ClassCount; i++) { 94 Members[i].Class = (TechnoTypeClass *)Members[i].Class->As_Target(); 95 assert(Members[i].Class != NULL); 96 } 97 } 98 99 100 /*********************************************************************************************** 101 * TeamTypeClass::Decode_Pointers -- decodes pointers for load/save * 102 * * 103 * This routine "decodes" the pointers coded in Code_Pointers by converting the * 104 * code values back into object pointers. * 105 * * 106 * INPUT: * 107 * none. * 108 * * 109 * OUTPUT: * 110 * none. * 111 * * 112 * WARNINGS: * 113 * none. * 114 * * 115 * HISTORY: * 116 * 01/02/1995 BR : Created. * 117 *=============================================================================================*/ 118 void TeamTypeClass::Decode_Pointers(void) 119 { 120 /* 121 ** Decode the Class array 122 */ 123 for (int i = 0; i < ClassCount; i++) { 124 Members[i].Class = As_TechnoType((TARGET)Members[i].Class); 125 assert(Members[i].Class != NULL); 126 } 127 } 128 129 130 /*********************************************************************************************** 131 * TeamClass::Code_Pointers -- codes class's pointers for load/save * 132 * * 133 * This routine "codes" the pointers in the class by converting them to a number * 134 * that still represents the object pointed to, but isn't actually a pointer. This * 135 * allows a saved game to properly load without relying on the games data still * 136 * being in the exact same location. * 137 * * 138 * INPUT: * 139 * none. * 140 * * 141 * OUTPUT: * 142 * none. * 143 * * 144 * WARNINGS: * 145 * none. * 146 * * 147 * HISTORY: * 148 * 01/02/1995 BR : Created. * 149 * 05/13/1996 JLB : Simplified. * 150 *=============================================================================================*/ 151 void TeamClass::Code_Pointers(void) 152 { 153 /* 154 ** Code the 'Member' 155 */ 156 if (Member) { 157 Member = (FootClass *)Member->As_Target(); 158 } 159 } 160 161 162 /*********************************************************************************************** 163 * TeamClass::Decode_Pointers -- decodes pointers for load/save * 164 * * 165 * This routine "decodes" the pointers coded in Code_Pointers by converting the * 166 * code values back into object pointers. * 167 * * 168 * INPUT: * 169 * none. * 170 * * 171 * OUTPUT: * 172 * none. * 173 * * 174 * WARNINGS: * 175 * none. * 176 * * 177 * HISTORY: * 178 * 01/02/1995 BR : Created. * 179 * 03/12/1996 JLB : Simplified. * 180 *=============================================================================================*/ 181 void TeamClass::Decode_Pointers(void) 182 { 183 /* 184 ** Decode the 'Member' 185 */ 186 if (Member) { 187 Member = (FootClass *)As_Techno((TARGET)Member, false); 188 assert(Member != NULL); 189 } 190 } 191 192 193 /*********************************************************************************************** 194 * TriggerClass::Code_Pointers -- codes class's pointers for load/save * 195 * * 196 * This routine "codes" the pointers in the class by converting them to a number * 197 * that still represents the object pointed to, but isn't actually a pointer. This * 198 * allows a saved game to properly load without relying on the games data still * 199 * being in the exact same location. * 200 * * 201 * INPUT: * 202 * none. * 203 * * 204 * OUTPUT: * 205 * none. * 206 * * 207 * WARNINGS: * 208 * none. * 209 * * 210 * HISTORY: * 211 * 01/02/1995 BR : Created. * 212 *=============================================================================================*/ 213 void TriggerTypeClass::Code_Pointers(void) 214 { 215 Action1.Code_Pointers(); 216 Action2.Code_Pointers(); 217 } 218 219 220 /*********************************************************************************************** 221 * TriggerClass::Decode_Pointers -- decodes pointers for load/save * 222 * * 223 * This routine "decodes" the pointers coded in Code_Pointers by converting the * 224 * code values back into object pointers. * 225 * * 226 * INPUT: * 227 * none. * 228 * * 229 * OUTPUT: * 230 * none. * 231 * * 232 * WARNINGS: * 233 * none. * 234 * * 235 * HISTORY: * 236 * 01/02/1995 BR : Created. * 237 *=============================================================================================*/ 238 void TriggerTypeClass::Decode_Pointers(void) 239 { 240 Action1.Decode_Pointers(); 241 Action2.Decode_Pointers(); 242 } 243 244 245 /*********************************************************************************************** 246 * BulletClass::Code_Pointers -- codes class's pointers for load/save * 247 * * 248 * This routine "codes" the pointers in the class by converting them to a number * 249 * that still represents the object pointed to, but isn't actually a pointer. This * 250 * allows a saved game to properly load without relying on the games data still * 251 * being in the exact same location. * 252 * * 253 * INPUT: * 254 * none. * 255 * * 256 * OUTPUT: * 257 * none. * 258 * * 259 * WARNINGS: * 260 * none. * 261 * * 262 * HISTORY: * 263 * 01/02/1995 BR : Created. * 264 *=============================================================================================*/ 265 void BulletClass::Code_Pointers(void) 266 { 267 /* 268 ** Code 'Payback' 269 */ 270 if (Payback) { 271 Payback = (TechnoClass *)Payback->As_Target(); 272 } 273 274 /* 275 ** Chain to parent 276 */ 277 ObjectClass::Code_Pointers(); 278 } 279 280 281 /*********************************************************************************************** 282 * BulletClass::Decode_Pointers -- decodes pointers for load/save * 283 * * 284 * This routine "decodes" the pointers coded in Code_Pointers by converting the * 285 * code values back into object pointers. * 286 * * 287 * INPUT: * 288 * none. * 289 * * 290 * OUTPUT: * 291 * none. * 292 * * 293 * WARNINGS: * 294 * none. * 295 * * 296 * HISTORY: * 297 * 01/02/1995 BR : Created. * 298 *=============================================================================================*/ 299 void BulletClass::Decode_Pointers(void) 300 { 301 /* 302 ** Decode 'Payback' 303 */ 304 if (Payback) { 305 Payback = As_Techno((TARGET)Payback, false); 306 assert(Payback != NULL); 307 } 308 309 /* 310 ** Chain to parent 311 */ 312 ObjectClass::Decode_Pointers(); 313 } 314 315 316 /*********************************************************************************************** 317 * FactoryClass::Code_Pointers -- codes class's pointers for load/save * 318 * * 319 * This routine "codes" the pointers in the class by converting them to a number * 320 * that still represents the object pointed to, but isn't actually a pointer. This * 321 * allows a saved game to properly load without relying on the games data still * 322 * being in the exact same location. * 323 * * 324 * INPUT: * 325 * none. * 326 * * 327 * OUTPUT: * 328 * none. * 329 * * 330 * WARNINGS: * 331 * none. * 332 * * 333 * HISTORY: * 334 * 01/02/1995 BR : Created. * 335 *=============================================================================================*/ 336 void FactoryClass::Code_Pointers(void) 337 { 338 if (Object) { 339 Object = (TechnoClass *)Object->As_Target(); 340 } 341 342 ((HouseClass *&)House) = (HouseClass *)House->Class->House; 343 } 344 345 346 /*********************************************************************************************** 347 * FactoryClass::Decode_Pointers -- decodes pointers for load/save * 348 * * 349 * This routine "decodes" the pointers coded in Code_Pointers by converting the * 350 * code values back into object pointers. * 351 * * 352 * INPUT: * 353 * none. * 354 * * 355 * OUTPUT: * 356 * none. * 357 * * 358 * WARNINGS: * 359 * none. * 360 * * 361 * HISTORY: * 362 * 01/02/1995 BR : Created. * 363 *=============================================================================================*/ 364 void FactoryClass::Decode_Pointers(void) 365 { 366 if (Object) { 367 Object = As_Techno((TARGET)Object, false); 368 assert(Object != NULL); 369 } 370 371 unsigned int house_ptr_val = *((unsigned int*)&House); 372 ((HouseClass *&)House) = HouseClass::As_Pointer((HousesType)house_ptr_val); 373 374 assert(House != NULL); 375 } 376 377 378 /*********************************************************************************************** 379 * LayerClass::Load -- Loads from a save game file. * 380 * * 381 * INPUT: file -- The file to read the cell's data from. * 382 * * 383 * OUTPUT: true = success, false = failure * 384 * * 385 * WARNINGS: none * 386 * * 387 * HISTORY: * 388 * 09/19/1994 JLB : Created. * 389 *=============================================================================================*/ 390 bool LayerClass::Load(Straw & file) 391 { 392 /* 393 ** Read # elements in the layer 394 */ 395 int count; 396 if (file.Get(&count, sizeof(count)) != sizeof(count)) { 397 return(false); 398 } 399 400 /* 401 ** Clear the array 402 */ 403 Clear(); 404 405 /* 406 ** Read in all array elements 407 */ 408 for (int index = 0; index < count; index++) { 409 ObjectClass * ptr; 410 if (file.Get(&ptr, sizeof(ObjectClass *)) != sizeof(ObjectClass *)) { 411 return(false); 412 } 413 Add(ptr); 414 } 415 416 return(true); 417 } 418 419 420 /*********************************************************************************************** 421 * LayerClass::Save -- Write to a save game file. * 422 * * 423 * INPUT: file -- The file to write the cell's data to. * 424 * * 425 * OUTPUT: true = success, false = failure * 426 * * 427 * WARNINGS: none * 428 * * 429 * HISTORY: * 430 * 09/19/1994 JLB : Created. * 431 *=============================================================================================*/ 432 bool LayerClass::Save(Pipe & file) const 433 { 434 /* 435 ** Save # array elements 436 */ 437 int count = Count(); 438 file.Put(&count, sizeof(count)); 439 440 /* 441 ** Save all elements 442 */ 443 for (int index = 0; index < count; index++) { 444 ObjectClass * ptr = (*this)[index]; 445 file.Put(&ptr, sizeof(ObjectClass *)); 446 } 447 448 return(true); 449 } 450 451 452 /*********************************************************************************************** 453 * LayerClass::Code_Pointers -- codes class's pointers for load/save * 454 * * 455 * This routine "codes" the pointers in the class by converting them to a number * 456 * that still represents the object pointed to, but isn't actually a pointer. This * 457 * allows a saved game to properly load without relying on the games data still * 458 * being in the exact same location. * 459 * * 460 * INPUT: * 461 * none. * 462 * * 463 * OUTPUT: * 464 * none. * 465 * * 466 * WARNINGS: * 467 * none. * 468 * * 469 * HISTORY: * 470 * 01/02/1995 BR : Created. * 471 *=============================================================================================*/ 472 void LayerClass::Code_Pointers(void) 473 { 474 for (int index = 0; index < Count(); index++) { 475 ObjectClass * obj = (*this)[index]; 476 assert(obj != NULL); 477 (*this)[index] = (ObjectClass *)(obj->As_Target()); 478 } 479 } 480 481 482 /*********************************************************************************************** 483 * LayerClass::Decode_Pointers -- decodes pointers for load/save * 484 * * 485 * This routine "decodes" the pointers coded in Code_Pointers by converting the * 486 * code values back into object pointers. * 487 * * 488 * INPUT: * 489 * none. * 490 * * 491 * OUTPUT: * 492 * none. * 493 * * 494 * WARNINGS: * 495 * none. * 496 * * 497 * HISTORY: * 498 * 01/02/1995 BR : Created. * 499 *=============================================================================================*/ 500 void LayerClass::Decode_Pointers(void) 501 { 502 for (int index = 0; index < Count(); index++) { 503 TARGET target = (TARGET)(*this)[index]; 504 (*this)[index] = (ObjectClass *)As_Object(target, false); 505 assert((*this)[index] != NULL); 506 } 507 } 508 509 510 /*********************************************************************************************** 511 * HouseClass::Code_Pointers -- codes class's pointers for load/save * 512 * * 513 * This routine "codes" the pointers in the class by converting them to a number * 514 * that still represents the object pointed to, but isn't actually a pointer. This * 515 * allows a saved game to properly load without relying on the games data still * 516 * being in the exact same location. * 517 * * 518 * INPUT: * 519 * none. * 520 * * 521 * OUTPUT: * 522 * none. * 523 * * 524 * WARNINGS: * 525 * none. * 526 * * 527 * HISTORY: * 528 * 01/02/1995 BR : Created. * 529 *=============================================================================================*/ 530 void HouseClass::Code_Pointers(void) 531 { 532 } 533 534 535 /*********************************************************************************************** 536 * HouseClass::Decode_Pointers -- decodes pointers for load/save * 537 * * 538 * This routine "decodes" the pointers coded in Code_Pointers by converting the * 539 * code values back into object pointers. * 540 * * 541 * INPUT: * 542 * none. * 543 * * 544 * OUTPUT: * 545 * none. * 546 * * 547 * WARNINGS: * 548 * none. * 549 * * 550 * HISTORY: * 551 * 01/02/1995 BR : Created. * 552 *=============================================================================================*/ 553 void HouseClass::Decode_Pointers(void) 554 { 555 /* 556 ** Re-assign the house's remap table (for multiplayer game loads) 557 ** Loading the house from disk will have over-written the house's RemapTable, so 558 ** Init_Data() is called to reset it to a valid pointer. 559 */ 560 561 Init_Data(RemapColor, ActLike, Credits); 562 } 563 564 565 /*********************************************************************************************** 566 * ScoreClass::Code_Pointers -- codes class's pointers for load/save * 567 * * 568 * INPUT: * 569 * none. * 570 * * 571 * OUTPUT: * 572 * none. * 573 * * 574 * WARNINGS: * 575 * none. * 576 * * 577 * HISTORY: * 578 * 01/02/1995 BR : Created. * 579 *=============================================================================================*/ 580 void ScoreClass::Code_Pointers(void) 581 { 582 RealTime.Stop(); 583 } 584 585 586 /*********************************************************************************************** 587 * ScoreClass::Decode_Pointers -- decodes pointers for load/save * 588 * * 589 * INPUT: * 590 * none. * 591 * * 592 * OUTPUT: * 593 * none. * 594 * * 595 * WARNINGS: * 596 * none. * 597 * * 598 * HISTORY: * 599 * 01/02/1995 BR : Created. * 600 *=============================================================================================*/ 601 void ScoreClass::Decode_Pointers(void) 602 { 603 RealTime.Start(); 604 } 605 606 607 /*********************************************************************************************** 608 * FootClass::Code_Pointers -- codes class's pointers for load/save * 609 * * 610 * This routine "codes" the pointers in the class by converting them to a number * 611 * that still represents the object pointed to, but isn't actually a pointer. This * 612 * allows a saved game to properly load without relying on the games data still * 613 * being in the exact same location. * 614 * * 615 * INPUT: * 616 * none. * 617 * * 618 * OUTPUT: * 619 * none. * 620 * * 621 * WARNINGS: * 622 * none. * 623 * * 624 * HISTORY: * 625 * 01/02/1995 BR : Created. * 626 *=============================================================================================*/ 627 void FootClass::Code_Pointers(void) 628 { 629 if (Member != NULL && Member->IsActive) { 630 Member = (FootClass *)Member->As_Target(); 631 } else { 632 Member = TARGET_NONE; 633 } 634 635 TechnoClass::Code_Pointers(); 636 } 637 638 639 /*********************************************************************************************** 640 * FootClass::Decode_Pointers -- decodes pointers for load/save * 641 * * 642 * This routine "decodes" the pointers coded in Code_Pointers by converting the * 643 * code values back into object pointers. * 644 * * 645 * INPUT: * 646 * none. * 647 * * 648 * OUTPUT: * 649 * none. * 650 * * 651 * WARNINGS: * 652 * none. * 653 * * 654 * HISTORY: * 655 * 01/02/1995 BR : Created. * 656 *=============================================================================================*/ 657 void FootClass::Decode_Pointers(void) 658 { 659 if ((TARGET)Member != TARGET_NONE) { 660 Member = (FootClass *)As_Techno((TARGET)Member, false); 661 assert(Member != NULL); 662 } 663 664 TechnoClass::Decode_Pointers(); 665 } 666 667 668 /*********************************************************************************************** 669 * RadioClass::Code_Pointers -- codes class's pointers for load/save * 670 * * 671 * This routine "codes" the pointers in the class by converting them to a number * 672 * that still represents the object pointed to, but isn't actually a pointer. This * 673 * allows a saved game to properly load without relying on the games data still * 674 * being in the exact same location. * 675 * * 676 * INPUT: * 677 * none. * 678 * * 679 * OUTPUT: * 680 * none. * 681 * * 682 * WARNINGS: * 683 * none. * 684 * * 685 * HISTORY: * 686 * 01/02/1995 BR : Created. * 687 *=============================================================================================*/ 688 void RadioClass::Code_Pointers(void) 689 { 690 /* 691 ** Code 'Radio' 692 */ 693 if (Radio) { 694 Radio = (RadioClass *)Radio->As_Target(); 695 } 696 697 MissionClass::Code_Pointers(); 698 } 699 700 701 /*********************************************************************************************** 702 * RadioClass::Decode_Pointers -- decodes pointers for load/save * 703 * * 704 * This routine "decodes" the pointers coded in Code_Pointers by converting the * 705 * code values back into object pointers. * 706 * * 707 * INPUT: * 708 * none. * 709 * * 710 * OUTPUT: * 711 * none. * 712 * * 713 * WARNINGS: * 714 * none. * 715 * * 716 * HISTORY: * 717 * 01/02/1995 BR : Created. * 718 *=============================================================================================*/ 719 void RadioClass::Decode_Pointers(void) 720 { 721 /* 722 ** Decode 'Radio' 723 */ 724 if (Radio) { 725 Radio = As_Techno((TARGET)Radio, false); 726 assert(Radio != NULL); 727 } 728 729 MissionClass::Decode_Pointers(); 730 } 731 732 733 /*********************************************************************************************** 734 * TechnoClass::Code_Pointers -- codes class's pointers for load/save * 735 * * 736 * This routine "codes" the pointers in the class by converting them to a number * 737 * that still represents the object pointed to, but isn't actually a pointer. This * 738 * allows a saved game to properly load without relying on the games data still * 739 * being in the exact same location. * 740 * * 741 * INPUT: * 742 * none. * 743 * * 744 * OUTPUT: * 745 * none. * 746 * * 747 * WARNINGS: * 748 * none. * 749 * * 750 * HISTORY: * 751 * 01/02/1995 BR : Created. * 752 *=============================================================================================*/ 753 void TechnoClass::Code_Pointers(void) 754 { 755 CargoClass::Code_Pointers(); 756 RadioClass::Code_Pointers(); 757 } 758 759 760 /*********************************************************************************************** 761 * TechnoClass::Decode_Pointers -- decodes pointers for load/save * 762 * * 763 * This routine "decodes" the pointers coded in Code_Pointers by converting the * 764 * code values back into object pointers. * 765 * * 766 * INPUT: * 767 * none. * 768 * * 769 * OUTPUT: * 770 * none. * 771 * * 772 * WARNINGS: * 773 * none. * 774 * * 775 * HISTORY: * 776 * 01/02/1995 BR : Created. * 777 *=============================================================================================*/ 778 void TechnoClass::Decode_Pointers(void) 779 { 780 CargoClass::Decode_Pointers(); 781 RadioClass::Decode_Pointers(); 782 } 783 784 785 /*********************************************************************************************** 786 * CargoClass::Code_Pointers -- codes class's pointers for load/save * 787 * * 788 * This routine "codes" the pointers in the class by converting them to a number * 789 * that still represents the object pointed to, but isn't actually a pointer. This * 790 * allows a saved game to properly load without relying on the games data still * 791 * being in the exact same location. * 792 * * 793 * INPUT: * 794 * none. * 795 * * 796 * OUTPUT: * 797 * none. * 798 * * 799 * WARNINGS: * 800 * none. * 801 * * 802 * HISTORY: * 803 * 01/02/1995 BR : Created. * 804 *=============================================================================================*/ 805 void CargoClass::Code_Pointers(void) 806 { 807 /* 808 ** Code 'CargoHold' 809 */ 810 if (CargoHold) { 811 CargoHold = (FootClass *)CargoHold->As_Target(); 812 } 813 } 814 815 816 /*********************************************************************************************** 817 * CargoClass::Decode_Pointers -- decodes pointers for load/save * 818 * * 819 * This routine "decodes" the pointers coded in Code_Pointers by converting the * 820 * code values back into object pointers. * 821 * * 822 * INPUT: * 823 * none. * 824 * * 825 * OUTPUT: * 826 * none. * 827 * * 828 * WARNINGS: * 829 * none. * 830 * * 831 * HISTORY: * 832 * 01/02/1995 BR : Created. * 833 *=============================================================================================*/ 834 void CargoClass::Decode_Pointers(void) 835 { 836 /* 837 ** Decode 'CargoHold' 838 */ 839 if (CargoHold) { 840 CargoHold = (FootClass *)As_Techno((TARGET)CargoHold, false); 841 assert(CargoHold != NULL); 842 } 843 } 844 845 846 /*********************************************************************************************** 847 * ObjectClass::Code_Pointers -- codes class's pointers for load/save * 848 * * 849 * This routine "codes" the pointers in the class by converting them to a number * 850 * that still represents the object pointed to, but isn't actually a pointer. This * 851 * allows a saved game to properly load without relying on the games data still * 852 * being in the exact same location. * 853 * * 854 * INPUT: * 855 * none. * 856 * * 857 * OUTPUT: * 858 * none. * 859 * * 860 * WARNINGS: * 861 * none. * 862 * * 863 * HISTORY: * 864 * 01/02/1995 BR : Created. * 865 *=============================================================================================*/ 866 void ObjectClass::Code_Pointers(void) 867 { 868 if (Next) { 869 Next = (ObjectClass *)Next->As_Target(); 870 } 871 } 872 873 874 /*********************************************************************************************** 875 * ObjectClass::Decode_Pointers -- decodes pointers for load/save * 876 * * 877 * This routine "decodes" the pointers coded in Code_Pointers by converting the * 878 * code values back into object pointers. * 879 * * 880 * INPUT: * 881 * none. * 882 * * 883 * OUTPUT: * 884 * none. * 885 * * 886 * WARNINGS: * 887 * none. * 888 * * 889 * HISTORY: * 890 * 01/02/1995 BR : Created. * 891 *=============================================================================================*/ 892 void ObjectClass::Decode_Pointers(void) 893 { 894 if (Next) { 895 Next = As_Object((TARGET)Next, false); 896 assert(Next != NULL); 897 } 898 }