CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

IOOBJ.CPP (180642B)


      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\ioobj.cpv   2.18   16 Oct 1995 16:51:22   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 : January 16, 1995   [BR]                                      *
     30  *                                                                                             *
     31  *---------------------------------------------------------------------------------------------*
     32  * All object-related loading/saving routines should go in this module, so it can be overlayed.*
     33  *---------------------------------------------------------------------------------------------*
     34  * Functions:                                                                                  *
     35  *   TeamTypeClass::Load -- Reads from a save game file.                                       *
     36  *   TeamTypeClass::Save -- Write to a save game file.                                         *
     37  *   TeamTypeClass::Code_Pointers -- codes class's pointers for load/save                      *
     38  *   TeamTypeClass::Decode_Pointers -- decodes pointers for load/save                          *
     39  *   TeamClass::Load -- Reads from a save game file.                                           *
     40  *   TeamClass::Save -- Write to a save game file.                                             *
     41  *   TeamClass::Code_Pointers -- codes class's pointers for load/save                          *
     42  *   TeamClass::Decode_Pointers -- decodes pointers for load/save                              *
     43  *   TriggerClass::Load -- Reads from a save game file.                                        *
     44  *   TriggerClass::Save -- Write to a save game file.                                          *
     45  *   TriggerClass::Code_Pointers -- codes class's pointers for load/save                       *
     46  *   TriggerClass::Decode_Pointers -- decodes pointers for load/save                           *
     47  *   AircraftClass::Load -- Reads from a save game file.                                       *
     48  *   AircraftClass::Save -- Write to a save game file.                                         *
     49  *   AircraftClass::Code_Pointers -- codes class's pointers for load/save                      *
     50  *   AircraftClass::Decode_Pointers -- decodes pointers for load/save                          *
     51  *   AnimClass::Load -- Reads from a save game file.                                           *
     52  *   AnimClass::Save -- Write to a save game file.                                             *
     53  *   AnimClass::Code_Pointers -- codes class's pointers for load/save                          *
     54  *   AnimClass::Decode_Pointers -- decodes pointers for load/save                              *
     55  *   BuildingClass::Load -- Reads from a save game file.                                       *
     56  *   BuildingClass::Save -- Write to a save game file.                                         *
     57  *   BuildingClass::Code_Pointers -- codes class's pointers for load/save                      *
     58  *   BuildingClass::Decode_Pointers -- decodes pointers for load/save                          *
     59  *   BulletClass::Load -- Reads from a save game file.                                         *
     60  *   BulletClass::Save -- Write to a save game file.                                           *
     61  *   BulletClass::Code_Pointers -- codes class's pointers for load/save                        *
     62  *   BulletClass::Decode_Pointers -- decodes pointers for load/save                            *
     63  *   InfantryClass::Load -- Reads from a save game file.                                       *
     64  *   InfantryClass::Save -- Write to a save game file.                                         *
     65  *   InfantryClass::Code_Pointers -- codes class's pointers for load/save                      *
     66  *   InfantryClass::Decode_Pointers -- decodes pointers for load/save                          *
     67  *   OverlayClass::Load -- Reads from a save game file.                                        *
     68  *   OverlayClass::Save -- Write to a save game file.                                          *
     69  *   OverlayClass::Code_Pointers -- codes class's pointers for load/save                       *
     70  *   OverlayClass::Decode_Pointers -- decodes pointers for load/save                           *
     71  *   ReinforcementClass::Load -- Reads from a save game file.                                  *
     72  *   ReinforcementClass::Save -- Write to a save game file.                                    *
     73  *   ReinforcementClass::Code_Pointers -- codes class's pointers for load/save                 *
     74  *   ReinforcementClass::Decode_Pointers -- decodes pointers for load/save                     *
     75  *   SmudgeClass::Load -- Reads from a save game file.                                         *
     76  *   SmudgeClass::Save -- Write to a save game file.                                           *
     77  *   SmudgeClass::Code_Pointers -- codes class's pointers for load/save                        *
     78  *   SmudgeClass::Decode_Pointers -- decodes pointers for load/save                            *
     79  *   TemplateClass::Load -- Reads from a save game file.                                       *
     80  *   TemplateClass::Save -- Write to a save game file.                                         *
     81  *   TemplateClass::Code_Pointers -- codes class's pointers for load/save                      *
     82  *   TemplateClass::Decode_Pointers -- decodes pointers for load/save                          *
     83  *   TerrainClass::Load -- Reads from a save game file.                                        *
     84  *   TerrainClass::Save -- Write to a save game file.                                          *
     85  *   TerrainClass::Code_Pointers -- codes class's pointers for load/save                       *
     86  *   TerrainClass::Decode_Pointers -- decodes pointers for load/save                           *
     87  *   UnitClass::Load -- Reads from a save game file.                                           *
     88  *   UnitClass::Save -- Write to a save game file.                                             *
     89  *   UnitClass::Code_Pointers -- codes class's pointers for load/save                          *
     90  *   UnitClass::Decode_Pointers -- decodes pointers for load/save                              *
     91  *   FactoryClass::Load -- Reads from a save game file.                                        *
     92  *   FactoryClass::Save -- Write to a save game file.                                          *
     93  *   FactoryClass::Code_Pointers -- codes class's pointers for load/save                       *
     94  *   FactoryClass::Decode_Pointers -- decodes pointers for load/save                           *
     95  *   LayerClass::Load -- Reads from a save game file.                                          *
     96  *   LayerClass::Save -- Write to a save game file.                                            *
     97  *   LayerClass::Code_Pointers -- codes class's pointers for load/save                         *
     98  *   LayerClass::Decode_Pointers -- decodes pointers for load/save                             *
     99  *   HouseClass::Load -- Reads from a save game file.                                          *
    100  *   HouseClass::Save -- Write to a save game file.                                            *
    101  *   HouseClass::Code_Pointers -- codes class's pointers for load/save                         *
    102  *   HouseClass::Decode_Pointers -- decodes pointers for load/save                             *
    103  *   ScoreClass::Load -- Reads from a save game file.                                          *
    104  *   ScoreClass::Save -- Write to a save game file.                                            *
    105  *   ScoreClass::Code_Pointers -- codes class's pointers for load/save                         *
    106  *   ScoreClass::Decode_Pointers -- decodes pointers for load/save                             *
    107  *   FlyClass::Code_Pointers -- codes class's pointers for load/save                           *
    108  *   FlyClass::Decode_Pointers -- decodes pointers for load/save                               *
    109  *   FuseClass::Code_Pointers -- codes class's pointers for load/save                          *
    110  *   FuseClass::Decode_Pointers -- decodes pointers for load/save                              *
    111  *   TarComClass::Code_Pointers -- codes class's pointers for load/save                        *
    112  *   TarComClass::Decode_Pointers -- decodes pointers for load/save                            *
    113  *   TurretClass::Code_Pointers -- codes class's pointers for load/save                        *
    114  *   TurretClass::Decode_Pointers -- decodes pointers for load/save                            *
    115  *   DriveClass::Code_Pointers -- codes class's pointers for load/save                         *
    116  *   DriveClass::Decode_Pointers -- decodes pointers for load/save                             *
    117  *   FootClass::Code_Pointers -- codes class's pointers for load/save                          *
    118  *   FootClass::Decode_Pointers -- decodes pointers for load/save                              *
    119  *   RadioClass::Code_Pointers -- codes class's pointers for load/save                         *
    120  *   RadioClass::Decode_Pointers -- decodes pointers for load/save                             *
    121  *   TechnoClass::Code_Pointers -- codes class's pointers for load/save                        *
    122  *   TechnoClass::Decode_Pointers -- decodes pointers for load/save                            *
    123  *   FlasherClass::Code_Pointers -- codes class's pointers for load/save                       *
    124  *   FlasherClass::Decode_Pointers -- decodes pointers for load/save                           *
    125  *   CargoClass::Code_Pointers -- codes class's pointers for load/save                         *
    126  *   CargoClass::Decode_Pointers -- decodes pointers for load/save                             *
    127  *   MissionClass::Code_Pointers -- codes class's pointers for load/save                       *
    128  *   MissionClass::Decode_Pointers -- decodes pointers for load/save                           *
    129  *   ObjectClass::Code_Pointers -- codes class's pointers for load/save                        *
    130  *   ObjectClass::Decode_Pointers -- decodes pointers for load/save                            *
    131  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
    132 
    133 #include "function.h"
    134 
    135 #pragma warning (disable : 4302)			// Truncation from pointer to TARGET
    136 
    137 
    138 /***********************************************************************************************
    139  * TeamTypeClass::Load -- Loads from a save game file.                                         *
    140  *                                                                                             *
    141  * INPUT:   file  -- The file to read the cell's data from.                                    *
    142  *                                                                                             *
    143  * OUTPUT:  true = success, false = failure                                                    *
    144  *                                                                                             *
    145  * WARNINGS:   none                                                                            *
    146  *                                                                                             *
    147  * HISTORY:                                                                                    *
    148  *   09/19/1994 JLB : Created.                                                                 *
    149  *=============================================================================================*/
    150 bool TeamTypeClass::Load(FileClass & file)
    151 {
    152 	::new (this) TeamTypeClass();
    153 	return(Read_Object(this, sizeof(*this), file, true));
    154 	
    155 	//return(Read_Object(this, sizeof(AbstractTypeClass), sizeof(*this), file, VTable));
    156 }
    157 
    158 
    159 /***********************************************************************************************
    160  * TeamTypeClass::Save -- Write to a save game file.                                           *
    161  *                                                                                             *
    162  * INPUT:   file  -- The file to write the cell's data to.                                     *
    163  *                                                                                             *
    164  * OUTPUT:  true = success, false = failure                                                    *
    165  *                                                                                             *
    166  * WARNINGS:   none                                                                            *
    167  *                                                                                             *
    168  * HISTORY:                                                                                    *
    169  *   09/19/1994 JLB : Created.                                                                 *
    170  *=============================================================================================*/
    171 bool TeamTypeClass::Save(FileClass & file)
    172 {
    173 	return(Write_Object(this, sizeof(*this), file));
    174 }
    175 
    176 
    177 /***********************************************************************************************
    178  * TeamTypeClass::Code_Pointers -- codes class's pointers for load/save                        *
    179  *                                                                                             *
    180  * This routine "codes" the pointers in the class by converting them to a number               *
    181  * that still represents the object pointed to, but isn't actually a pointer.  This            *
    182  * allows a saved game to properly load without relying on the games data still                *
    183  * being in the exact same location.                                                           *
    184  *                                                                                             *
    185  * INPUT:                                                                                      *
    186  *      none.                                                                                  *
    187  *                                                                                             *
    188  * OUTPUT:                                                                                     *
    189  *      none.                                                                                  *
    190  *                                                                                             *
    191  * WARNINGS:                                                                                   *
    192  *      none.                                                                                  *
    193  *                                                                                             *
    194  * HISTORY:                                                                                    *
    195  *   01/02/1995 BR : Created.                                                                  *
    196  *=============================================================================================*/
    197 void TeamTypeClass::Code_Pointers(void)
    198 {
    199 	/*
    200 	-------------------------- Code the Class array --------------------------
    201 	*/
    202 	for (int i = 0; i < ClassCount; i++) {
    203 		Class[i] = (TechnoTypeClass *)TechnoType_To_Target(Class[i]);
    204 	}
    205 }
    206 
    207 
    208 /***********************************************************************************************
    209  * TeamTypeClass::Decode_Pointers -- decodes pointers for load/save                            *
    210  *                                                                                             *
    211  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
    212  * code values back into object pointers.                                                      *
    213  *                                                                                             *
    214  * INPUT:                                                                                      *
    215  *      none.                                                                                  *
    216  *                                                                                             *
    217  * OUTPUT:                                                                                     *
    218  *      none.                                                                                  *
    219  *                                                                                             *
    220  * WARNINGS:                                                                                   *
    221  *      none.                                                                                  *
    222  *                                                                                             *
    223  * HISTORY:                                                                                    *
    224  *   01/02/1995 BR : Created.                                                                  *
    225  *=============================================================================================*/
    226 void TeamTypeClass::Decode_Pointers(void)
    227 {
    228 	/*
    229 	------------------------- Decode the Class array -------------------------
    230 	*/
    231 	for (int i = 0; i < ClassCount; i++) {
    232 		Class[i] =  Target_To_TechnoType((TARGET)Class[i]);
    233 		Check_Ptr((void *)Class[i],__FILE__,__LINE__);
    234 	}
    235 }
    236 
    237 
    238 /***********************************************************************************************
    239  * TeamClass::Load -- Loads from a save game file.                                             *
    240  *                                                                                             *
    241  * INPUT:   file  -- The file to read the cell's data from.                                    *
    242  *                                                                                             *
    243  * OUTPUT:  true = success, false = failure                                                    *
    244  *                                                                                             *
    245  * WARNINGS:   none                                                                            *
    246  *                                                                                             *
    247  * HISTORY:                                                                                    *
    248  *   09/19/1994 JLB : Created.                                                                 *
    249  *=============================================================================================*/
    250 bool TeamClass::Load(FileClass & file)
    251 {
    252 	::new (this) TeamClass();
    253 	return(Read_Object(this, sizeof(*this), file, true));
    254 	
    255 	//return(Read_Object(this, sizeof(AbstractClass), sizeof(*this), file, VTable));
    256 }
    257 
    258 
    259 /***********************************************************************************************
    260  * TeamClass::Save -- Write to a save game file.                                               *
    261  *                                                                                             *
    262  * INPUT:   file  -- The file to write the cell's data to.                                     *
    263  *                                                                                             *
    264  * OUTPUT:  true = success, false = failure                                                    *
    265  *                                                                                             *
    266  * WARNINGS:   none                                                                            *
    267  *                                                                                             *
    268  * HISTORY:                                                                                    *
    269  *   09/19/1994 JLB : Created.                                                                 *
    270  *=============================================================================================*/
    271 bool TeamClass::Save(FileClass & file)
    272 {
    273 	return(Write_Object(this, sizeof(*this), file));
    274 }
    275 
    276 
    277 /***********************************************************************************************
    278  * TeamClass::Code_Pointers -- codes class's pointers for load/save                            *
    279  *                                                                                             *
    280  * This routine "codes" the pointers in the class by converting them to a number               *
    281  * that still represents the object pointed to, but isn't actually a pointer.  This            *
    282  * allows a saved game to properly load without relying on the games data still                *
    283  * being in the exact same location.                                                           *
    284  *                                                                                             *
    285  * INPUT:                                                                                      *
    286  *      none.                                                                                  *
    287  *                                                                                             *
    288  * OUTPUT:                                                                                     *
    289  *      none.                                                                                  *
    290  *                                                                                             *
    291  * WARNINGS:                                                                                   *
    292  *      none.                                                                                  *
    293  *                                                                                             *
    294  * HISTORY:                                                                                    *
    295  *   01/02/1995 BR : Created.                                                                  *
    296  *=============================================================================================*/
    297 void TeamClass::Code_Pointers(void)
    298 {
    299 	TeamTypeClass const * cls;
    300 
    301 	/*
    302 	-------------------- Code Class & House for this team --------------------
    303 	*/
    304 	cls = Class;
    305 	((TeamTypeClass *&)Class) = (TeamTypeClass *)cls->As_Target();
    306 	((HouseClass *&)House) = (HouseClass *)House->Class->House;
    307 
    308 	/*
    309 	--------------------------- Code the 'Member' ----------------------------
    310 	*/
    311 	if (Member) {
    312 		Member = (FootClass *)Member->As_Target();
    313 	}
    314 }
    315 
    316 
    317 /***********************************************************************************************
    318  * TeamClass::Decode_Pointers -- decodes pointers for load/save                                *
    319  *                                                                                             *
    320  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
    321  * code values back into object pointers.                                                      *
    322  *                                                                                             *
    323  * INPUT:                                                                                      *
    324  *      none.                                                                                  *
    325  *                                                                                             *
    326  * OUTPUT:                                                                                     *
    327  *      none.                                                                                  *
    328  *                                                                                             *
    329  * WARNINGS:                                                                                   *
    330  *      none.                                                                                  *
    331  *                                                                                             *
    332  * HISTORY:                                                                                    *
    333  *   01/02/1995 BR : Created.                                                                  *
    334  *=============================================================================================*/
    335 void TeamClass::Decode_Pointers(void)
    336 {
    337 	/*
    338 	------------------- Decode Class & House for this team -------------------
    339 	*/
    340 	((TeamTypeClass *&)Class) = As_TeamType((TARGET)Class);
    341 	Check_Ptr((void *)Class,__FILE__,__LINE__);
    342 	((HouseClass *&)House) = HouseClass::As_Pointer(*((HousesType*)&House));
    343 	Check_Ptr((void *)House,__FILE__,__LINE__);
    344 
    345 	/*
    346 	-------------------------- Decode the 'Member' ---------------------------
    347 	*/
    348 	if (Member) {
    349 		switch (Target_Kind((TARGET)Member)) {
    350 			case KIND_INFANTRY:
    351 				Member = As_Infantry((TARGET)Member, false);
    352 				break;
    353 
    354 			case KIND_UNIT:
    355 				Member = As_Unit((TARGET)Member, false);
    356 				break;
    357 
    358 			case KIND_AIRCRAFT:
    359 				Member = As_Aircraft((TARGET)Member, false);
    360 				break;
    361 
    362 			default:
    363 				Member = 0;
    364 				break;
    365 		}
    366 
    367 		Check_Ptr((void *)Member,__FILE__,__LINE__);
    368 	}
    369 }
    370 
    371 
    372 /***********************************************************************************************
    373  * TriggerClass::Load -- Loads from a save game file.                                          *
    374  *                                                                                             *
    375  * INPUT:   file  -- The file to read the cell's data from.                                    *
    376  *                                                                                             *
    377  * OUTPUT:  true = success, false = failure                                                    *
    378  *                                                                                             *
    379  * WARNINGS:   none                                                                            *
    380  *                                                                                             *
    381  * HISTORY:                                                                                    *
    382  *   09/19/1994 JLB : Created.                                                                 *
    383  *=============================================================================================*/
    384 bool TriggerClass::Load(FileClass & file)
    385 {
    386 	::new (this) TriggerClass();
    387 	int rc = Read_Object(this, sizeof(*this), file, false);
    388 	
    389 	//int rc = Read_Object(this, sizeof(*this), sizeof(*this), file, 0);
    390 
    391 	/*
    392 	-------------------------- Add to HouseTriggers --------------------------
    393 	*/
    394 	if (rc) {
    395 		if (House != HOUSE_NONE) {
    396 			HouseTriggers[House].Add(this);
    397 		}
    398 	}
    399 
    400 	return(rc);
    401 }
    402 
    403 
    404 /***********************************************************************************************
    405  * TriggerClass::Save -- Write to a save game file.                                            *
    406  *                                                                                             *
    407  * INPUT:   file  -- The file to write the cell's data to.                                     *
    408  *                                                                                             *
    409  * OUTPUT:  true = success, false = failure                                                    *
    410  *                                                                                             *
    411  * WARNINGS:   none                                                                            *
    412  *                                                                                             *
    413  * HISTORY:                                                                                    *
    414  *   09/19/1994 JLB : Created.                                                                 *
    415  *=============================================================================================*/
    416 bool TriggerClass::Save(FileClass & file)
    417 {
    418 	return(Write_Object(this, sizeof(*this), file));
    419 }
    420 
    421 
    422 /***********************************************************************************************
    423  * TriggerClass::Code_Pointers -- codes class's pointers for load/save                         *
    424  *                                                                                             *
    425  * This routine "codes" the pointers in the class by converting them to a number               *
    426  * that still represents the object pointed to, but isn't actually a pointer.  This            *
    427  * allows a saved game to properly load without relying on the games data still                *
    428  * being in the exact same location.                                                           *
    429  *                                                                                             *
    430  * INPUT:                                                                                      *
    431  *      none.                                                                                  *
    432  *                                                                                             *
    433  * OUTPUT:                                                                                     *
    434  *      none.                                                                                  *
    435  *                                                                                             *
    436  * WARNINGS:                                                                                   *
    437  *      none.                                                                                  *
    438  *                                                                                             *
    439  * HISTORY:                                                                                    *
    440  *   01/02/1995 BR : Created.                                                                  *
    441  *=============================================================================================*/
    442 void TriggerClass::Code_Pointers(void)
    443 {
    444 	if (Team) {
    445 		Team = (TeamTypeClass *)Team->As_Target();
    446 	}
    447 }
    448 
    449 
    450 /***********************************************************************************************
    451  * TriggerClass::Decode_Pointers -- decodes pointers for load/save                             *
    452  *                                                                                             *
    453  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
    454  * code values back into object pointers.                                                      *
    455  *                                                                                             *
    456  * INPUT:                                                                                      *
    457  *      none.                                                                                  *
    458  *                                                                                             *
    459  * OUTPUT:                                                                                     *
    460  *      none.                                                                                  *
    461  *                                                                                             *
    462  * WARNINGS:                                                                                   *
    463  *      none.                                                                                  *
    464  *                                                                                             *
    465  * HISTORY:                                                                                    *
    466  *   01/02/1995 BR : Created.                                                                  *
    467  *=============================================================================================*/
    468 void TriggerClass::Decode_Pointers(void)
    469 {
    470 	if (Team) {
    471 		Team = As_TeamType((TARGET)Team);
    472 		Check_Ptr((void *)Team,__FILE__,__LINE__);
    473 	}
    474 }
    475 
    476 
    477 /***********************************************************************************************
    478  * AircraftClass::Load -- Loads from a save game file.                                         *
    479  *                                                                                             *
    480  * INPUT:   file  -- The file to read the cell's data from.                                    *
    481  *                                                                                             *
    482  * OUTPUT:  true = success, false = failure                                                    *
    483  *                                                                                             *
    484  * WARNINGS:   none                                                                            *
    485  *                                                                                             *
    486  * HISTORY:                                                                                    *
    487  *   09/19/1994 JLB : Created.                                                                 *
    488  *=============================================================================================*/
    489 bool AircraftClass::Load(FileClass & file)
    490 {
    491 	::new (this) AircraftClass();
    492 	return(Read_Object(this, sizeof(*this), file, true));
    493 	
    494 	//return(Read_Object(this, sizeof(AbstractClass), sizeof(*this), file, VTable));
    495 }
    496 
    497 
    498 /***********************************************************************************************
    499  * AircraftClass::Save -- Write to a save game file.                                           *
    500  *                                                                                             *
    501  * INPUT:   file  -- The file to write the cell's data to.                                     *
    502  *                                                                                             *
    503  * OUTPUT:  true = success, false = failure                                                    *
    504  *                                                                                             *
    505  * WARNINGS:   none                                                                            *
    506  *                                                                                             *
    507  * HISTORY:                                                                                    *
    508  *   09/19/1994 JLB : Created.                                                                 *
    509  *=============================================================================================*/
    510 bool AircraftClass::Save(FileClass & file)
    511 {
    512 	return(Write_Object(this, sizeof(*this), file));
    513 }
    514 
    515 
    516 /***********************************************************************************************
    517  * AircraftClass::Code_Pointers -- codes class's pointers for load/save                        *
    518  *                                                                                             *
    519  * This routine "codes" the pointers in the class by converting them to a number               *
    520  * that still represents the object pointed to, but isn't actually a pointer.  This            *
    521  * allows a saved game to properly load without relying on the games data still                *
    522  * being in the exact same location.                                                           *
    523  *                                                                                             *
    524  * INPUT:                                                                                      *
    525  *      none.                                                                                  *
    526  *                                                                                             *
    527  * OUTPUT:                                                                                     *
    528  *      none.                                                                                  *
    529  *                                                                                             *
    530  * WARNINGS:                                                                                   *
    531  *      none.                                                                                  *
    532  *                                                                                             *
    533  * HISTORY:                                                                                    *
    534  *   01/02/1995 BR : Created.                                                                  *
    535  *=============================================================================================*/
    536 void AircraftClass::Code_Pointers(void)
    537 {
    538 	/*
    539 	------------------------------ Code 'Class' ------------------------------
    540 	*/
    541 	((AircraftTypeClass *&)Class) = (AircraftTypeClass *)Class->Type;
    542 
    543 	/*
    544 	---------------------------- Chain to parent -----------------------------
    545 	*/
    546 	FootClass::Code_Pointers();
    547 	FlyClass::Code_Pointers();
    548 }
    549 
    550 
    551 /***********************************************************************************************
    552  * AircraftClass::Decode_Pointers -- decodes pointers for load/save                            *
    553  *                                                                                             *
    554  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
    555  * code values back into object pointers.                                                      *
    556  *                                                                                             *
    557  * INPUT:                                                                                      *
    558  *      none.                                                                                  *
    559  *                                                                                             *
    560  * OUTPUT:                                                                                     *
    561  *      none.                                                                                  *
    562  *                                                                                             *
    563  * WARNINGS:                                                                                   *
    564  *      none.                                                                                  *
    565  *                                                                                             *
    566  * HISTORY:                                                                                    *
    567  *   01/02/1995 BR : Created.                                                                  *
    568  *=============================================================================================*/
    569 void AircraftClass::Decode_Pointers(void)
    570 {
    571 	/*
    572 	----------------------------- Decode 'Class' -----------------------------
    573 	*/
    574 	((AircraftTypeClass const *&)Class) = &AircraftTypeClass::As_Reference(*((AircraftType*)&Class));
    575 	Check_Ptr((void *)Class,__FILE__,__LINE__);
    576 
    577 	/*
    578 	---------------------------- Chain to parent -----------------------------
    579 	*/
    580 	FootClass::Decode_Pointers();
    581 	FlyClass::Decode_Pointers();
    582 }
    583 
    584 
    585 /***********************************************************************************************
    586  * AnimClass::Load -- Loads from a save game file.                                             *
    587  *                                                                                             *
    588  * INPUT:   file  -- The file to read the cell's data from.                                    *
    589  *                                                                                             *
    590  * OUTPUT:  true = success, false = failure                                                    *
    591  *                                                                                             *
    592  * WARNINGS:   none                                                                            *
    593  *                                                                                             *
    594  * HISTORY:                                                                                    *
    595  *   09/19/1994 JLB : Created.                                                                 *
    596  *=============================================================================================*/
    597 bool AnimClass::Load(FileClass & file)
    598 {
    599 	::new (this) AnimClass();
    600 	return(Read_Object(this, sizeof(*this), file, true));
    601 	
    602 	//return(Read_Object(this, sizeof(AbstractClass), sizeof(*this), file, VTable));
    603 }
    604 
    605 
    606 /***********************************************************************************************
    607  * AnimClass::Save -- Write to a save game file.                                               *
    608  *                                                                                             *
    609  * INPUT:   file  -- The file to write the cell's data to.                                     *
    610  *                                                                                             *
    611  * OUTPUT:  true = success, false = failure                                                    *
    612  *                                                                                             *
    613  * WARNINGS:   none                                                                            *
    614  *                                                                                             *
    615  * HISTORY:                                                                                    *
    616  *   09/19/1994 JLB : Created.                                                                 *
    617  *=============================================================================================*/
    618 bool AnimClass::Save(FileClass & file)
    619 {
    620 	return(Write_Object(this, sizeof(*this), file));
    621 }
    622 
    623 
    624 /***********************************************************************************************
    625  * AnimClass::Code_Pointers -- codes class's pointers for load/save                            *
    626  *                                                                                             *
    627  * This routine "codes" the pointers in the class by converting them to a number               *
    628  * that still represents the object pointed to, but isn't actually a pointer.  This            *
    629  * allows a saved game to properly load without relying on the games data still                *
    630  * being in the exact same location.                                                           *
    631  *                                                                                             *
    632  * INPUT:                                                                                      *
    633  *      none.                                                                                  *
    634  *                                                                                             *
    635  * OUTPUT:                                                                                     *
    636  *      none.                                                                                  *
    637  *                                                                                             *
    638  * WARNINGS:                                                                                   *
    639  *      none.                                                                                  *
    640  *                                                                                             *
    641  * HISTORY:                                                                                    *
    642  *   01/02/1995 BR : Created.                                                                  *
    643  *=============================================================================================*/
    644 void AnimClass::Code_Pointers(void)
    645 {
    646 	/*
    647 	------------------------------ Code 'Class' ------------------------------
    648 	*/
    649 	((AnimTypeClass *&)Class) = (AnimTypeClass *)Class->Type;
    650 
    651 	/*
    652 	----------------------------- Code 'Object' ------------------------------
    653 	*/
    654 	if (Object) {
    655 		Object = (ObjectClass *)Object->As_Target();
    656 	}
    657 
    658 	/*
    659 	----------------------------- Code 'VirtualAnim' -------------------------
    660 	*/
    661 	if (VirtualAnim) {
    662 		VirtualAnim = (AnimClass *)VirtualAnim->As_Target();
    663 	}
    664 
    665 	/*
    666 	---------------------------- Chain to parent -----------------------------
    667 	*/
    668 	ObjectClass::Code_Pointers();
    669 	StageClass::Code_Pointers();
    670 }
    671 
    672 
    673 /***********************************************************************************************
    674  * AnimClass::Decode_Pointers -- decodes pointers for load/save                                *
    675  *                                                                                             *
    676  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
    677  * code values back into object pointers.                                                      *
    678  *                                                                                             *
    679  * INPUT:                                                                                      *
    680  *      none.                                                                                  *
    681  *                                                                                             *
    682  * OUTPUT:                                                                                     *
    683  *      none.                                                                                  *
    684  *                                                                                             *
    685  * WARNINGS:                                                                                   *
    686  *      none.                                                                                  *
    687  *                                                                                             *
    688  * HISTORY:                                                                                    *
    689  *   01/02/1995 BR : Created.                                                                  *
    690  *=============================================================================================*/
    691 void AnimClass::Decode_Pointers(void)
    692 {
    693 	/*
    694 	----------------------------- Decode 'Class' -----------------------------
    695 	*/
    696 	((AnimTypeClass const *&)Class) = &AnimTypeClass::As_Reference(*((AnimType*)&Class));
    697 	Check_Ptr((void *)Class,__FILE__,__LINE__);
    698 
    699 	/*
    700 	---------------------------- Decode 'Object' -----------------------------
    701 	*/
    702 	if (Object) {
    703 		Object = As_Object((TARGET)Object, false);
    704 		Check_Ptr((void *)Object,__FILE__,__LINE__);
    705 	}
    706 
    707 	/*
    708 	---------------------------- Decode 'VirtualAnim' ------------------------
    709 	*/
    710 	if (VirtualAnim) {
    711 		VirtualAnim = As_Animation((TARGET)VirtualAnim, false);
    712 		Check_Ptr((void *)VirtualAnim, __FILE__, __LINE__);
    713 	}
    714 
    715 	/*
    716 	---------------------------- Chain to parent -----------------------------
    717 	*/
    718 	ObjectClass::Decode_Pointers();
    719 	StageClass::Decode_Pointers();
    720 }
    721 
    722 
    723 /***********************************************************************************************
    724  * BuildingClass::Load -- Loads from a save game file.                                         *
    725  *                                                                                             *
    726  * INPUT:   file  -- The file to read the cell's data from.                                    *
    727  *                                                                                             *
    728  * OUTPUT:  true = success, false = failure                                                    *
    729  *                                                                                             *
    730  * WARNINGS:   none                                                                            *
    731  *                                                                                             *
    732  * HISTORY:                                                                                    *
    733  *   09/19/1994 JLB : Created.                                                                 *
    734  *=============================================================================================*/
    735 bool BuildingClass::Load(FileClass & file)
    736 {
    737 	::new (this) BuildingClass();
    738 	return(Read_Object(this, sizeof(*this), file, true));
    739 	
    740 	//return(Read_Object(this, sizeof(AbstractClass), sizeof(*this), file, VTable));
    741 }
    742 
    743 
    744 /***********************************************************************************************
    745  * BuildingClass::Save -- Write to a save game file.                                           *
    746  *                                                                                             *
    747  * INPUT:   file  -- The file to write the cell's data to.                                     *
    748  *                                                                                             *
    749  * OUTPUT:  true = success, false = failure                                                    *
    750  *                                                                                             *
    751  * WARNINGS:   none                                                                            *
    752  *                                                                                             *
    753  * HISTORY:                                                                                    *
    754  *   09/19/1994 JLB : Created.                                                                 *
    755  *=============================================================================================*/
    756 bool BuildingClass::Save(FileClass & file)
    757 {
    758 	return(Write_Object(this, sizeof(*this), file));
    759 }
    760 
    761 
    762 /***********************************************************************************************
    763  * BuildingClass::Code_Pointers -- codes class's pointers for load/save                        *
    764  *                                                                                             *
    765  * This routine "codes" the pointers in the class by converting them to a number               *
    766  * that still represents the object pointed to, but isn't actually a pointer.  This            *
    767  * allows a saved game to properly load without relying on the games data still                *
    768  * being in the exact same location.                                                           *
    769  *                                                                                             *
    770  * INPUT:                                                                                      *
    771  *      none.                                                                                  *
    772  *                                                                                             *
    773  * OUTPUT:                                                                                     *
    774  *      none.                                                                                  *
    775  *                                                                                             *
    776  * WARNINGS:                                                                                   *
    777  *      none.                                                                                  *
    778  *                                                                                             *
    779  * HISTORY:                                                                                    *
    780  *   01/02/1995 BR : Created.                                                                  *
    781  *=============================================================================================*/
    782 void BuildingClass::Code_Pointers(void)
    783 {
    784 	/*
    785 	------------------------------ Code 'Class' ------------------------------
    786 	*/
    787 	((BuildingTypeClass const *&)Class) = (BuildingTypeClass *)Class->Type;
    788 
    789 	/*------------------------------------------------------------------------
    790 	Code the Factory value; there's not target conversion routine for factories, 
    791 	so just use its Array ID, plus 1 so it doesn't look like a NULL value when 
    792 	it's converted back
    793 	------------------------------------------------------------------------*/
    794 	if (Factory) {
    795 		Factory = (FactoryClass *)(Factories.ID(Factory) + 1);
    796 	}
    797 
    798 	/*
    799 	---------------------------- Chain to parent -----------------------------
    800 	*/
    801 	TechnoClass::Code_Pointers();
    802 }
    803 
    804 
    805 /***********************************************************************************************
    806  * BuildingClass::Decode_Pointers -- decodes pointers for load/save                            *
    807  *                                                                                             *
    808  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
    809  * code values back into object pointers.                                                      *
    810  *                                                                                             *
    811  * INPUT:                                                                                      *
    812  *      none.                                                                                  *
    813  *                                                                                             *
    814  * OUTPUT:                                                                                     *
    815  *      none.                                                                                  *
    816  *                                                                                             *
    817  * WARNINGS:                                                                                   *
    818  *      none.                                                                                  *
    819  *                                                                                             *
    820  * HISTORY:                                                                                    *
    821  *   01/02/1995 BR : Created.                                                                  *
    822  *=============================================================================================*/
    823 void BuildingClass::Decode_Pointers(void)
    824 {
    825 	/*
    826 	----------------------------- Decode 'Class' -----------------------------
    827 	*/
    828 	((BuildingTypeClass const *&)Class) = &BuildingTypeClass::As_Reference(*((StructType*)&Class));
    829 	Check_Ptr((void *)Class,__FILE__,__LINE__);
    830 
    831 	/*------------------------------------------------------------------------
    832 	Decode the Factory value, subtracting off the '1' we added when coding it
    833 	------------------------------------------------------------------------*/
    834 	if (Factory) {
    835 		Factory = Factories.Raw_Ptr((int)Factory - 1);
    836 		Check_Ptr((void *)Factory,__FILE__,__LINE__);
    837 	}
    838 
    839 	/*
    840 	---------------------------- Chain to parent -----------------------------
    841 	*/
    842 	TechnoClass::Decode_Pointers();
    843 }
    844 
    845 
    846 /***********************************************************************************************
    847  * BulletClass::Load -- Loads from a save game file.                                           *
    848  *                                                                                             *
    849  * INPUT:   file  -- The file to read the cell's data from.                                    *
    850  *                                                                                             *
    851  * OUTPUT:  true = success, false = failure                                                    *
    852  *                                                                                             *
    853  * WARNINGS:   none                                                                            *
    854  *                                                                                             *
    855  * HISTORY:                                                                                    *
    856  *   09/19/1994 JLB : Created.                                                                 *
    857  *=============================================================================================*/
    858 bool BulletClass::Load(FileClass & file)
    859 {
    860 	::new (this) BulletClass();
    861 	return(Read_Object(this, sizeof(*this), file, true));
    862 	
    863 	//return(Read_Object(this, sizeof(AbstractClass), sizeof(*this), file, VTable));
    864 }
    865 
    866 
    867 /***********************************************************************************************
    868  * BulletClass::Save -- Write to a save game file.                                             *
    869  *                                                                                             *
    870  * INPUT:   file  -- The file to write the cell's data to.                                     *
    871  *                                                                                             *
    872  * OUTPUT:  true = success, false = failure                                                    *
    873  *                                                                                             *
    874  * WARNINGS:   none                                                                            *
    875  *                                                                                             *
    876  * HISTORY:                                                                                    *
    877  *   09/19/1994 JLB : Created.                                                                 *
    878  *=============================================================================================*/
    879 bool BulletClass::Save(FileClass & file)
    880 {
    881 	return(Write_Object(this, sizeof(*this), file));
    882 }
    883 
    884 
    885 /***********************************************************************************************
    886  * BulletClass::Code_Pointers -- codes class's pointers for load/save                          *
    887  *                                                                                             *
    888  * This routine "codes" the pointers in the class by converting them to a number               *
    889  * that still represents the object pointed to, but isn't actually a pointer.  This            *
    890  * allows a saved game to properly load without relying on the games data still                *
    891  * being in the exact same location.                                                           *
    892  *                                                                                             *
    893  * INPUT:                                                                                      *
    894  *      none.                                                                                  *
    895  *                                                                                             *
    896  * OUTPUT:                                                                                     *
    897  *      none.                                                                                  *
    898  *                                                                                             *
    899  * WARNINGS:                                                                                   *
    900  *      none.                                                                                  *
    901  *                                                                                             *
    902  * HISTORY:                                                                                    *
    903  *   01/02/1995 BR : Created.                                                                  *
    904  *=============================================================================================*/
    905 void BulletClass::Code_Pointers(void)
    906 {
    907 	/*
    908 	------------------------------ Code 'Class' ------------------------------
    909 	*/
    910 	((BulletTypeClass *&)Class) = (BulletTypeClass *)Class->Type;
    911 
    912 	/*
    913 	----------------------------- Code 'Payback' -----------------------------
    914 	*/
    915 	if (Payback)
    916 		Payback = (TechnoClass *)Payback->As_Target();
    917 
    918 	/*
    919 	---------------------------- Chain to parent -----------------------------
    920 	*/
    921 	ObjectClass::Code_Pointers();
    922 	FlyClass::Code_Pointers();
    923 	FuseClass::Code_Pointers();
    924 }
    925 
    926 
    927 /***********************************************************************************************
    928  * BulletClass::Decode_Pointers -- decodes pointers for load/save                              *
    929  *                                                                                             *
    930  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
    931  * code values back into object pointers.                                                      *
    932  *                                                                                             *
    933  * INPUT:                                                                                      *
    934  *      none.                                                                                  *
    935  *                                                                                             *
    936  * OUTPUT:                                                                                     *
    937  *      none.                                                                                  *
    938  *                                                                                             *
    939  * WARNINGS:                                                                                   *
    940  *      none.                                                                                  *
    941  *                                                                                             *
    942  * HISTORY:                                                                                    *
    943  *   01/02/1995 BR : Created.                                                                  *
    944  *=============================================================================================*/
    945 void BulletClass::Decode_Pointers(void)
    946 {
    947 	/*
    948 	----------------------------- Decode 'Class' -----------------------------
    949 	*/
    950 	((BulletTypeClass const *&)Class) = &BulletTypeClass::As_Reference(*((BulletType*)&Class));
    951 	Check_Ptr((void *)Class,__FILE__,__LINE__);
    952 
    953 	/*
    954 	---------------------------- Decode 'Payback' ----------------------------
    955 	*/
    956 	if (Payback) {
    957 		Payback = As_Techno((TARGET)Payback, false);
    958 		Check_Ptr((void *)Payback,__FILE__,__LINE__);
    959 	}
    960 
    961 	/*
    962 	---------------------------- Chain to parent -----------------------------
    963 	*/
    964 	ObjectClass::Decode_Pointers();
    965 	FlyClass::Decode_Pointers();
    966 	FuseClass::Decode_Pointers();
    967 }
    968 
    969 
    970 /***********************************************************************************************
    971  * InfantryClass::Load -- Loads from a save game file.                                         *
    972  *                                                                                             *
    973  * INPUT:   file  -- The file to read the cell's data from.                                    *
    974  *                                                                                             *
    975  * OUTPUT:  true = success, false = failure                                                    *
    976  *                                                                                             *
    977  * WARNINGS:   none                                                                            *
    978  *                                                                                             *
    979  * HISTORY:                                                                                    *
    980  *   09/19/1994 JLB : Created.                                                                 *
    981  *=============================================================================================*/
    982 bool InfantryClass::Load(FileClass & file)
    983 {
    984 	::new (this) InfantryClass();
    985 	return(Read_Object(this, sizeof(*this), file, true));
    986 	
    987 	//return(Read_Object(this, sizeof(AbstractClass), sizeof(*this), file, VTable));
    988 }
    989 
    990 
    991 /***********************************************************************************************
    992  * InfantryClass::Save -- Write to a save game file.                                           *
    993  *                                                                                             *
    994  * INPUT:   file  -- The file to write the cell's data to.                                     *
    995  *                                                                                             *
    996  * OUTPUT:  true = success, false = failure                                                    *
    997  *                                                                                             *
    998  * WARNINGS:   none                                                                            *
    999  *                                                                                             *
   1000  * HISTORY:                                                                                    *
   1001  *   09/19/1994 JLB : Created.                                                                 *
   1002  *=============================================================================================*/
   1003 bool InfantryClass::Save(FileClass & file)
   1004 {
   1005 	return(Write_Object(this, sizeof(*this), file));
   1006 }
   1007 
   1008 
   1009 /***********************************************************************************************
   1010  * InfantryClass::Code_Pointers -- codes class's pointers for load/save                        *
   1011  *                                                                                             *
   1012  * This routine "codes" the pointers in the class by converting them to a number               *
   1013  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   1014  * allows a saved game to properly load without relying on the games data still                *
   1015  * being in the exact same location.                                                           *
   1016  *                                                                                             *
   1017  * INPUT:                                                                                      *
   1018  *      none.                                                                                  *
   1019  *                                                                                             *
   1020  * OUTPUT:                                                                                     *
   1021  *      none.                                                                                  *
   1022  *                                                                                             *
   1023  * WARNINGS:                                                                                   *
   1024  *      none.                                                                                  *
   1025  *                                                                                             *
   1026  * HISTORY:                                                                                    *
   1027  *   01/02/1995 BR : Created.                                                                  *
   1028  *=============================================================================================*/
   1029 void InfantryClass::Code_Pointers(void)
   1030 {
   1031 	/*
   1032 	------------------------------ Code 'Class' ------------------------------
   1033 	*/
   1034 	((InfantryTypeClass *&)Class) = (InfantryTypeClass *)Class->Type;
   1035 
   1036 	/*
   1037 	---------------------------- Chain to parent -----------------------------
   1038 	*/
   1039 	FootClass::Code_Pointers();
   1040 }
   1041 
   1042 
   1043 /***********************************************************************************************
   1044  * InfantryClass::Decode_Pointers -- decodes pointers for load/save                            *
   1045  *                                                                                             *
   1046  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   1047  * code values back into object pointers.                                                      *
   1048  *                                                                                             *
   1049  * INPUT:                                                                                      *
   1050  *      none.                                                                                  *
   1051  *                                                                                             *
   1052  * OUTPUT:                                                                                     *
   1053  *      none.                                                                                  *
   1054  *                                                                                             *
   1055  * WARNINGS:                                                                                   *
   1056  *      none.                                                                                  *
   1057  *                                                                                             *
   1058  * HISTORY:                                                                                    *
   1059  *   01/02/1995 BR : Created.                                                                  *
   1060  *=============================================================================================*/
   1061 void InfantryClass::Decode_Pointers(void)
   1062 {
   1063 	/*
   1064 	----------------------------- Decode 'Class' -----------------------------
   1065 	*/
   1066 	((InfantryTypeClass const *&)Class) = &InfantryTypeClass::As_Reference(*((InfantryType*)&Class));
   1067 	Check_Ptr((void *)Class,__FILE__,__LINE__);
   1068 
   1069 	/*
   1070 	---------------------------- Chain to parent -----------------------------
   1071 	*/
   1072 	FootClass::Decode_Pointers();
   1073 }
   1074 
   1075 
   1076 /***********************************************************************************************
   1077  * OverlayClass::Load -- Loads from a save game file.                                          *
   1078  *                                                                                             *
   1079  * INPUT:   file  -- The file to read the cell's data from.                                    *
   1080  *                                                                                             *
   1081  * OUTPUT:  true = success, false = failure                                                    *
   1082  *                                                                                             *
   1083  * WARNINGS:   none                                                                            *
   1084  *                                                                                             *
   1085  * HISTORY:                                                                                    *
   1086  *   09/19/1994 JLB : Created.                                                                 *
   1087  *=============================================================================================*/
   1088 bool OverlayClass::Load(FileClass & file)
   1089 {
   1090 	::new (this) OverlayClass();
   1091 	return(Read_Object(this, sizeof(*this), file, true));
   1092 	
   1093 	//return(Read_Object(this, sizeof(AbstractClass), sizeof(*this), file, VTable));
   1094 }
   1095 
   1096 
   1097 /***********************************************************************************************
   1098  * OverlayClass::Save -- Write to a save game file.                                            *
   1099  *                                                                                             *
   1100  * INPUT:   file  -- The file to write the cell's data to.                                     *
   1101  *                                                                                             *
   1102  * OUTPUT:  true = success, false = failure                                                    *
   1103  *                                                                                             *
   1104  * WARNINGS:   none                                                                            *
   1105  *                                                                                             *
   1106  * HISTORY:                                                                                    *
   1107  *   09/19/1994 JLB : Created.                                                                 *
   1108  *=============================================================================================*/
   1109 bool OverlayClass::Save(FileClass & file)
   1110 {
   1111 	return(Write_Object(this, sizeof(*this), file));
   1112 }
   1113 
   1114 
   1115 /***********************************************************************************************
   1116  * OverlayClass::Code_Pointers -- codes class's pointers for load/save                         *
   1117  *                                                                                             *
   1118  * This routine "codes" the pointers in the class by converting them to a number               *
   1119  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   1120  * allows a saved game to properly load without relying on the games data still                *
   1121  * being in the exact same location.                                                           *
   1122  *                                                                                             *
   1123  * INPUT:                                                                                      *
   1124  *      none.                                                                                  *
   1125  *                                                                                             *
   1126  * OUTPUT:                                                                                     *
   1127  *      none.                                                                                  *
   1128  *                                                                                             *
   1129  * WARNINGS:                                                                                   *
   1130  *      none.                                                                                  *
   1131  *                                                                                             *
   1132  * HISTORY:                                                                                    *
   1133  *   01/02/1995 BR : Created.                                                                  *
   1134  *=============================================================================================*/
   1135 void OverlayClass::Code_Pointers(void)
   1136 {
   1137 	/*
   1138 	------------------------------ Code 'Class' ------------------------------
   1139 	*/
   1140 	((OverlayTypeClass *&)Class) = (OverlayTypeClass *)Class->Type;
   1141 
   1142 	/*
   1143 	---------------------------- Chain to parent -----------------------------
   1144 	*/
   1145 	ObjectClass::Code_Pointers();
   1146 }
   1147 
   1148 
   1149 /***********************************************************************************************
   1150  * OverlayClass::Decode_Pointers -- decodes pointers for load/save                             *
   1151  *                                                                                             *
   1152  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   1153  * code values back into object pointers.                                                      *
   1154  *                                                                                             *
   1155  * INPUT:                                                                                      *
   1156  *      none.                                                                                  *
   1157  *                                                                                             *
   1158  * OUTPUT:                                                                                     *
   1159  *      none.                                                                                  *
   1160  *                                                                                             *
   1161  * WARNINGS:                                                                                   *
   1162  *      none.                                                                                  *
   1163  *                                                                                             *
   1164  * HISTORY:                                                                                    *
   1165  *   01/02/1995 BR : Created.                                                                  *
   1166  *=============================================================================================*/
   1167 void OverlayClass::Decode_Pointers(void)
   1168 {
   1169 	/*
   1170 	----------------------------- Decode 'Class' -----------------------------
   1171 	*/
   1172 	((OverlayTypeClass const *&)Class) = &OverlayTypeClass::As_Reference(*((OverlayType*)&Class));
   1173 	Check_Ptr((void *)Class,__FILE__,__LINE__);
   1174 
   1175 	/*
   1176 	---------------------------- Chain to parent -----------------------------
   1177 	*/
   1178 	ObjectClass::Decode_Pointers();
   1179 }
   1180 
   1181 
   1182 /***********************************************************************************************
   1183  * SmudgeClass::Load -- Loads from a save game file.                                           *
   1184  *                                                                                             *
   1185  * INPUT:   file  -- The file to read the cell's data from.                                    *
   1186  *                                                                                             *
   1187  * OUTPUT:  true = success, false = failure                                                    *
   1188  *                                                                                             *
   1189  * WARNINGS:   none                                                                            *
   1190  *                                                                                             *
   1191  * HISTORY:                                                                                    *
   1192  *   09/19/1994 JLB : Created.                                                                 *
   1193  *=============================================================================================*/
   1194 bool SmudgeClass::Load(FileClass & file)
   1195 {
   1196 	::new (this) SmudgeClass();
   1197 	return(Read_Object(this, sizeof(*this), file, true));
   1198 	
   1199 	//return(Read_Object(this, sizeof(AbstractClass), sizeof(*this), file, VTable));
   1200 }
   1201 
   1202 
   1203 /***********************************************************************************************
   1204  * SmudgeClass::Save -- Write to a save game file.                                             *
   1205  *                                                                                             *
   1206  * INPUT:   file  -- The file to write the cell's data to.                                     *
   1207  *                                                                                             *
   1208  * OUTPUT:  true = success, false = failure                                                    *
   1209  *                                                                                             *
   1210  * WARNINGS:   none                                                                            *
   1211  *                                                                                             *
   1212  * HISTORY:                                                                                    *
   1213  *   09/19/1994 JLB : Created.                                                                 *
   1214  *=============================================================================================*/
   1215 bool SmudgeClass::Save(FileClass & file)
   1216 {
   1217 	return(Write_Object(this, sizeof(*this), file));
   1218 }
   1219 
   1220 
   1221 /***********************************************************************************************
   1222  * SmudgeClass::Code_Pointers -- codes class's pointers for load/save                          *
   1223  *                                                                                             *
   1224  * This routine "codes" the pointers in the class by converting them to a number               *
   1225  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   1226  * allows a saved game to properly load without relying on the games data still                *
   1227  * being in the exact same location.                                                           *
   1228  *                                                                                             *
   1229  * INPUT:                                                                                      *
   1230  *      none.                                                                                  *
   1231  *                                                                                             *
   1232  * OUTPUT:                                                                                     *
   1233  *      none.                                                                                  *
   1234  *                                                                                             *
   1235  * WARNINGS:                                                                                   *
   1236  *      none.                                                                                  *
   1237  *                                                                                             *
   1238  * HISTORY:                                                                                    *
   1239  *   01/02/1995 BR : Created.                                                                  *
   1240  *=============================================================================================*/
   1241 void SmudgeClass::Code_Pointers(void)
   1242 {
   1243 	/*
   1244 	------------------------------ Code 'Class' ------------------------------
   1245 	*/
   1246 	((SmudgeTypeClass const *&)Class) = (SmudgeTypeClass *)Class->Type;
   1247 
   1248 	/*
   1249 	---------------------------- Chain to parent -----------------------------
   1250 	*/
   1251 	ObjectClass::Code_Pointers();
   1252 }
   1253 
   1254 
   1255 /***********************************************************************************************
   1256  * SmudgeClass::Decode_Pointers -- decodes pointers for load/save                              *
   1257  *                                                                                             *
   1258  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   1259  * code values back into object pointers.                                                      *
   1260  *                                                                                             *
   1261  * INPUT:                                                                                      *
   1262  *      none.                                                                                  *
   1263  *                                                                                             *
   1264  * OUTPUT:                                                                                     *
   1265  *      none.                                                                                  *
   1266  *                                                                                             *
   1267  * WARNINGS:                                                                                   *
   1268  *      none.                                                                                  *
   1269  *                                                                                             *
   1270  * HISTORY:                                                                                    *
   1271  *   01/02/1995 BR : Created.                                                                  *
   1272  *=============================================================================================*/
   1273 void SmudgeClass::Decode_Pointers(void)
   1274 {
   1275 	/*
   1276 	----------------------------- Decode 'Class' -----------------------------
   1277 	*/
   1278 	((SmudgeTypeClass const *&)Class) = &SmudgeTypeClass::As_Reference(*((SmudgeType*)&Class));
   1279 	Check_Ptr((void *)Class,__FILE__,__LINE__);
   1280 
   1281 	/*
   1282 	---------------------------- Chain to parent -----------------------------
   1283 	*/
   1284 	ObjectClass::Decode_Pointers();
   1285 }
   1286 
   1287 
   1288 /***********************************************************************************************
   1289  * TemplateClass::Load -- Loads from a save game file.                                         *
   1290  *                                                                                             *
   1291  * INPUT:   file  -- The file to read the cell's data from.                                    *
   1292  *                                                                                             *
   1293  * OUTPUT:  true = success, false = failure                                                    *
   1294  *                                                                                             *
   1295  * WARNINGS:   none                                                                            *
   1296  *                                                                                             *
   1297  * HISTORY:                                                                                    *
   1298  *   09/19/1994 JLB : Created.                                                                 *
   1299  *=============================================================================================*/
   1300 bool TemplateClass::Load(FileClass & file)
   1301 {
   1302 	::new (this) TemplateClass();
   1303 	return(Read_Object(this, sizeof(*this), file, true));
   1304 	
   1305 	//return(Read_Object(this, sizeof(AbstractClass), sizeof(*this), file, VTable));
   1306 }
   1307 
   1308 
   1309 /***********************************************************************************************
   1310  * TemplateClass::Save -- Write to a save game file.                                           *
   1311  *                                                                                             *
   1312  * INPUT:   file  -- The file to write the cell's data to.                                     *
   1313  *                                                                                             *
   1314  * OUTPUT:  true = success, false = failure                                                    *
   1315  *                                                                                             *
   1316  * WARNINGS:   none                                                                            *
   1317  *                                                                                             *
   1318  * HISTORY:                                                                                    *
   1319  *   09/19/1994 JLB : Created.                                                                 *
   1320  *=============================================================================================*/
   1321 bool TemplateClass::Save(FileClass & file)
   1322 {
   1323 	return(Write_Object(this, sizeof(*this), file));
   1324 }
   1325 
   1326 
   1327 /***********************************************************************************************
   1328  * TemplateClass::Code_Pointers -- codes class's pointers for load/save                        *
   1329  *                                                                                             *
   1330  * This routine "codes" the pointers in the class by converting them to a number               *
   1331  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   1332  * allows a saved game to properly load without relying on the games data still                *
   1333  * being in the exact same location.                                                           *
   1334  *                                                                                             *
   1335  * INPUT:                                                                                      *
   1336  *      none.                                                                                  *
   1337  *                                                                                             *
   1338  * OUTPUT:                                                                                     *
   1339  *      none.                                                                                  *
   1340  *                                                                                             *
   1341  * WARNINGS:                                                                                   *
   1342  *      none.                                                                                  *
   1343  *                                                                                             *
   1344  * HISTORY:                                                                                    *
   1345  *   01/02/1995 BR : Created.                                                                  *
   1346  *=============================================================================================*/
   1347 void TemplateClass::Code_Pointers(void)
   1348 {
   1349 	/*
   1350 	------------------------------ Code 'Class' ------------------------------
   1351 	*/
   1352 	((TemplateTypeClass *&)Class) = (TemplateTypeClass *)Class->Type;
   1353 
   1354 	/*
   1355 	---------------------------- Chain to parent -----------------------------
   1356 	*/
   1357 	ObjectClass::Code_Pointers();
   1358 }
   1359 
   1360 
   1361 /***********************************************************************************************
   1362  * TemplateClass::Decode_Pointers -- decodes pointers for load/save                            *
   1363  *                                                                                             *
   1364  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   1365  * code values back into object pointers.                                                      *
   1366  *                                                                                             *
   1367  * INPUT:                                                                                      *
   1368  *      none.                                                                                  *
   1369  *                                                                                             *
   1370  * OUTPUT:                                                                                     *
   1371  *      none.                                                                                  *
   1372  *                                                                                             *
   1373  * WARNINGS:                                                                                   *
   1374  *      none.                                                                                  *
   1375  *                                                                                             *
   1376  * HISTORY:                                                                                    *
   1377  *   01/02/1995 BR : Created.                                                                  *
   1378  *=============================================================================================*/
   1379 void TemplateClass::Decode_Pointers(void)
   1380 {
   1381 	/*
   1382 	----------------------------- Decode 'Class' -----------------------------
   1383 	*/
   1384 	((TemplateTypeClass const *&)Class) = &TemplateTypeClass::As_Reference(*((TemplateType*)&Class));
   1385 	Check_Ptr((void *)Class,__FILE__,__LINE__);
   1386 
   1387 	/*
   1388 	---------------------------- Chain to parent -----------------------------
   1389 	*/
   1390 	ObjectClass::Decode_Pointers();
   1391 }
   1392 
   1393 
   1394 /***********************************************************************************************
   1395  * TerrainClass::Load -- Loads from a save game file.                                          *
   1396  *                                                                                             *
   1397  * INPUT:   file  -- The file to read the cell's data from.                                    *
   1398  *                                                                                             *
   1399  * OUTPUT:  true = success, false = failure                                                    *
   1400  *                                                                                             *
   1401  * WARNINGS:   none                                                                            *
   1402  *                                                                                             *
   1403  * HISTORY:                                                                                    *
   1404  *   09/19/1994 JLB : Created.                                                                 *
   1405  *=============================================================================================*/
   1406 bool TerrainClass::Load(FileClass & file)
   1407 {
   1408 	::new (this) TerrainClass();
   1409 	return(Read_Object(this, sizeof(*this), file, true));
   1410 	
   1411 	//return(Read_Object(this, sizeof(AbstractClass), sizeof(*this), file, VTable));
   1412 }
   1413 
   1414 
   1415 /***********************************************************************************************
   1416  * TerrainClass::Save -- Write to a save game file.                                            *
   1417  *                                                                                             *
   1418  * INPUT:   file  -- The file to write the cell's data to.                                     *
   1419  *                                                                                             *
   1420  * OUTPUT:  true = success, false = failure                                                    *
   1421  *                                                                                             *
   1422  * WARNINGS:   none                                                                            *
   1423  *                                                                                             *
   1424  * HISTORY:                                                                                    *
   1425  *   09/19/1994 JLB : Created.                                                                 *
   1426  *=============================================================================================*/
   1427 bool TerrainClass::Save(FileClass & file)
   1428 {
   1429 	return(Write_Object(this, sizeof(*this), file));
   1430 }
   1431 
   1432 
   1433 /***********************************************************************************************
   1434  * TerrainClass::Code_Pointers -- codes class's pointers for load/save                         *
   1435  *                                                                                             *
   1436  * This routine "codes" the pointers in the class by converting them to a number               *
   1437  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   1438  * allows a saved game to properly load without relying on the games data still                *
   1439  * being in the exact same location.                                                           *
   1440  *                                                                                             *
   1441  * INPUT:                                                                                      *
   1442  *      none.                                                                                  *
   1443  *                                                                                             *
   1444  * OUTPUT:                                                                                     *
   1445  *      none.                                                                                  *
   1446  *                                                                                             *
   1447  * WARNINGS:                                                                                   *
   1448  *      none.                                                                                  *
   1449  *                                                                                             *
   1450  * HISTORY:                                                                                    *
   1451  *   01/02/1995 BR : Created.                                                                  *
   1452  *=============================================================================================*/
   1453 void TerrainClass::Code_Pointers(void)
   1454 {
   1455 	/*
   1456 	------------------------------ Code 'Class' ------------------------------
   1457 	*/
   1458 	((TerrainTypeClass *&)Class) = (TerrainTypeClass *)Class->Type;
   1459 
   1460 	/*
   1461 	---------------------------- Chain to parent -----------------------------
   1462 	*/
   1463 	ObjectClass::Code_Pointers();
   1464 	StageClass::Code_Pointers();
   1465 }
   1466 
   1467 
   1468 /***********************************************************************************************
   1469  * TerrainClass::Decode_Pointers -- decodes pointers for load/save                             *
   1470  *                                                                                             *
   1471  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   1472  * code values back into object pointers.                                                      *
   1473  *                                                                                             *
   1474  * INPUT:                                                                                      *
   1475  *      none.                                                                                  *
   1476  *                                                                                             *
   1477  * OUTPUT:                                                                                     *
   1478  *      none.                                                                                  *
   1479  *                                                                                             *
   1480  * WARNINGS:                                                                                   *
   1481  *      none.                                                                                  *
   1482  *                                                                                             *
   1483  * HISTORY:                                                                                    *
   1484  *   01/02/1995 BR : Created.                                                                  *
   1485  *=============================================================================================*/
   1486 void TerrainClass::Decode_Pointers(void)
   1487 {
   1488 	/*
   1489 	----------------------------- Decode 'Class' -----------------------------
   1490 	*/
   1491 	((TerrainTypeClass const *&)Class) = &TerrainTypeClass::As_Reference(*((TerrainType*)&Class));
   1492 	Check_Ptr((void *)Class,__FILE__,__LINE__);
   1493 
   1494 	/*
   1495 	---------------------------- Chain to parent -----------------------------
   1496 	*/
   1497 	ObjectClass::Decode_Pointers();
   1498 	StageClass::Decode_Pointers();
   1499 }
   1500 
   1501 
   1502 /***********************************************************************************************
   1503  * UnitClass::Load -- Loads from a save game file.                                             *
   1504  *                                                                                             *
   1505  * INPUT:   file  -- The file to read the cell's data from.                                    *
   1506  *                                                                                             *
   1507  * OUTPUT:  true = success, false = failure                                                    *
   1508  *                                                                                             *
   1509  * WARNINGS:   none                                                                            *
   1510  *                                                                                             *
   1511  * HISTORY:                                                                                    *
   1512  *   09/19/1994 JLB : Created.                                                                 *
   1513  *=============================================================================================*/
   1514 bool UnitClass::Load(FileClass & file)
   1515 {
   1516 	::new (this) UnitClass();
   1517 	return(Read_Object(this, sizeof(*this), file, true));
   1518 	
   1519 	//return(Read_Object(this, sizeof(AbstractClass), sizeof(*this), file, VTable));
   1520 }
   1521 
   1522 
   1523 /***********************************************************************************************
   1524  * UnitClass::Save -- Write to a save game file.                                               *
   1525  *                                                                                             *
   1526  * INPUT:   file  -- The file to write the cell's data to.                                     *
   1527  *                                                                                             *
   1528  * OUTPUT:  true = success, false = failure                                                    *
   1529  *                                                                                             *
   1530  * WARNINGS:   none                                                                            *
   1531  *                                                                                             *
   1532  * HISTORY:                                                                                    *
   1533  *   09/19/1994 JLB : Created.                                                                 *
   1534  *=============================================================================================*/
   1535 bool UnitClass::Save(FileClass & file)
   1536 {
   1537 	return(Write_Object(this, sizeof(*this), file));
   1538 }
   1539 
   1540 
   1541 /***********************************************************************************************
   1542  * UnitClass::Code_Pointers -- codes class's pointers for load/save                            *
   1543  *                                                                                             *
   1544  * This routine "codes" the pointers in the class by converting them to a number               *
   1545  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   1546  * allows a saved game to properly load without relying on the games data still                *
   1547  * being in the exact same location.                                                           *
   1548  *                                                                                             *
   1549  * INPUT:                                                                                      *
   1550  *      none.                                                                                  *
   1551  *                                                                                             *
   1552  * OUTPUT:                                                                                     *
   1553  *      none.                                                                                  *
   1554  *                                                                                             *
   1555  * WARNINGS:                                                                                   *
   1556  *      none.                                                                                  *
   1557  *                                                                                             *
   1558  * HISTORY:                                                                                    *
   1559  *   01/02/1995 BR : Created.                                                                  *
   1560  *=============================================================================================*/
   1561 void UnitClass::Code_Pointers(void)
   1562 {
   1563 	if (TiberiumUnloadRefinery) {
   1564 		TiberiumUnloadRefinery = (BuildingClass *)TiberiumUnloadRefinery->As_Target();
   1565 	}
   1566 
   1567 	TarComClass::Code_Pointers();
   1568 }
   1569 
   1570 
   1571 /***********************************************************************************************
   1572  * UnitClass::Decode_Pointers -- decodes pointers for load/save                                *
   1573  *                                                                                             *
   1574  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   1575  * code values back into object pointers.                                                      *
   1576  *                                                                                             *
   1577  * INPUT:                                                                                      *
   1578  *      none.                                                                                  *
   1579  *                                                                                             *
   1580  * OUTPUT:                                                                                     *
   1581  *      none.                                                                                  *
   1582  *                                                                                             *
   1583  * WARNINGS:                                                                                   *
   1584  *      none.                                                                                  *
   1585  *                                                                                             *
   1586  * HISTORY:                                                                                    *
   1587  *   01/02/1995 BR : Created.                                                                  *
   1588  *=============================================================================================*/
   1589 void UnitClass::Decode_Pointers(void)
   1590 {
   1591 	if (TiberiumUnloadRefinery) {
   1592 		TiberiumUnloadRefinery = As_Building((TARGET)TiberiumUnloadRefinery, false);
   1593 		Check_Ptr((void *)TiberiumUnloadRefinery, __FILE__, __LINE__);
   1594 	}
   1595 
   1596 	TarComClass::Decode_Pointers();
   1597 }
   1598 
   1599 
   1600 /***********************************************************************************************
   1601  * FactoryClass::Load -- Loads from a save game file.                                          *
   1602  *                                                                                             *
   1603  * INPUT:   file  -- The file to read the cell's data from.                                    *
   1604  *                                                                                             *
   1605  * OUTPUT:  true = success, false = failure                                                    *
   1606  *                                                                                             *
   1607  * WARNINGS:   none                                                                            *
   1608  *                                                                                             *
   1609  * HISTORY:                                                                                    *
   1610  *   09/19/1994 JLB : Created.                                                                 *
   1611  *=============================================================================================*/
   1612 bool FactoryClass::Load(FileClass & file)
   1613 {
   1614 	::new (this) FactoryClass();
   1615 	return(Read_Object(this, sizeof(*this), file, false));
   1616 	
   1617 	//return(Read_Object(this, sizeof(StageClass), sizeof(*this), file, 0));
   1618 }
   1619 
   1620 
   1621 /***********************************************************************************************
   1622  * FactoryClass::Save -- Write to a save game file.                                            *
   1623  *                                                                                             *
   1624  * INPUT:   file  -- The file to write the cell's data to.                                     *
   1625  *                                                                                             *
   1626  * OUTPUT:  true = success, false = failure                                                    *
   1627  *                                                                                             *
   1628  * WARNINGS:   none                                                                            *
   1629  *                                                                                             *
   1630  * HISTORY:                                                                                    *
   1631  *   09/19/1994 JLB : Created.                                                                 *
   1632  *=============================================================================================*/
   1633 bool FactoryClass::Save(FileClass & file)
   1634 {
   1635 	return(Write_Object(this, sizeof(*this), file));
   1636 }
   1637 
   1638 
   1639 /***********************************************************************************************
   1640  * FactoryClass::Code_Pointers -- codes class's pointers for load/save                         *
   1641  *                                                                                             *
   1642  * This routine "codes" the pointers in the class by converting them to a number               *
   1643  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   1644  * allows a saved game to properly load without relying on the games data still                *
   1645  * being in the exact same location.                                                           *
   1646  *                                                                                             *
   1647  * INPUT:                                                                                      *
   1648  *      none.                                                                                  *
   1649  *                                                                                             *
   1650  * OUTPUT:                                                                                     *
   1651  *      none.                                                                                  *
   1652  *                                                                                             *
   1653  * WARNINGS:                                                                                   *
   1654  *      none.                                                                                  *
   1655  *                                                                                             *
   1656  * HISTORY:                                                                                    *
   1657  *   01/02/1995 BR : Created.                                                                  *
   1658  *=============================================================================================*/
   1659 void FactoryClass::Code_Pointers(void)
   1660 {
   1661 	if (Object) {
   1662 		Object = (TechnoClass *)Object->As_Target();
   1663 	}
   1664 
   1665 	((HouseClass *&)House) = (HouseClass *)House->Class->House;
   1666 
   1667 	StageClass::Code_Pointers();
   1668 }
   1669 
   1670 
   1671 /***********************************************************************************************
   1672  * FactoryClass::Decode_Pointers -- decodes pointers for load/save                             *
   1673  *                                                                                             *
   1674  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   1675  * code values back into object pointers.                                                      *
   1676  *                                                                                             *
   1677  * INPUT:                                                                                      *
   1678  *      none.                                                                                  *
   1679  *                                                                                             *
   1680  * OUTPUT:                                                                                     *
   1681  *      none.                                                                                  *
   1682  *                                                                                             *
   1683  * WARNINGS:                                                                                   *
   1684  *      none.                                                                                  *
   1685  *                                                                                             *
   1686  * HISTORY:                                                                                    *
   1687  *   01/02/1995 BR : Created.                                                                  *
   1688  *=============================================================================================*/
   1689 void FactoryClass::Decode_Pointers(void)
   1690 {
   1691 	if (Object) {
   1692 		Object = As_Techno((TARGET)Object, false);
   1693 		Check_Ptr((void *)Object,__FILE__,__LINE__);
   1694 	}
   1695 
   1696 	((HouseClass *&)House) = HouseClass::As_Pointer(*((HousesType*)&House));
   1697 	Check_Ptr((void *)House,__FILE__,__LINE__);
   1698 
   1699 	StageClass::Decode_Pointers();
   1700 }
   1701 
   1702 
   1703 /***********************************************************************************************
   1704  * LayerClass::Load -- Loads from a save game file.                                            *
   1705  *                                                                                             *
   1706  * INPUT:   file  -- The file to read the cell's data from.                                    *
   1707  *                                                                                             *
   1708  * OUTPUT:  true = success, false = failure                                                    *
   1709  *                                                                                             *
   1710  * WARNINGS:   none                                                                            *
   1711  *                                                                                             *
   1712  * HISTORY:                                                                                    *
   1713  *   09/19/1994 JLB : Created.                                                                 *
   1714  *=============================================================================================*/
   1715 bool LayerClass::Load(FileClass & file)
   1716 {
   1717 	int count;
   1718 	int i;
   1719 	ObjectClass * ptr;
   1720 
   1721 	/*
   1722 	---------------------- Read # elements in the layer ----------------------
   1723 	*/
   1724 	if (file.Read(&count,sizeof(count)) != sizeof(count)) {
   1725 		return(false);
   1726 	}
   1727 
   1728 	/*
   1729 	---------------------------- Clear the array -----------------------------
   1730 	*/
   1731 	Clear();
   1732 
   1733 	/*
   1734 	----------------------- Read in all array elements -----------------------
   1735 	*/
   1736 	for (i = 0; i < count; i++) {
   1737 		if (file.Read(&ptr, sizeof(ObjectClass *)) != sizeof(ObjectClass *)) {
   1738 			return(false);
   1739 		}
   1740 		Add(ptr);
   1741 	}
   1742 	
   1743 	return(true);
   1744 }
   1745 
   1746 
   1747 /***********************************************************************************************
   1748  * LayerClass::Save -- Write to a save game file.                                              *
   1749  *                                                                                             *
   1750  * INPUT:   file  -- The file to write the cell's data to.                                     *
   1751  *                                                                                             *
   1752  * OUTPUT:  true = success, false = failure                                                    *
   1753  *                                                                                             *
   1754  * WARNINGS:   none                                                                            *
   1755  *                                                                                             *
   1756  * HISTORY:                                                                                    *
   1757  *   09/19/1994 JLB : Created.                                                                 *
   1758  *=============================================================================================*/
   1759 bool LayerClass::Save(FileClass & file)
   1760 {
   1761 	int count;
   1762 	int i;
   1763 	ObjectClass * ptr;
   1764 
   1765 	/*
   1766 	------------------------- Save # array elements --------------------------
   1767 	*/
   1768 	count = Count();
   1769 	if (file.Write(&count, sizeof(count)) != sizeof(count))
   1770 		return(false);
   1771 
   1772 	/*
   1773 	--------------------------- Save all elements ----------------------------
   1774 	*/
   1775 	for (i = 0; i < count; i++) {
   1776 		ptr = (*this)[i];
   1777 		if (file.Write(&ptr, sizeof(ObjectClass *)) != sizeof(ObjectClass *))
   1778 			return(false);
   1779 	}
   1780 
   1781 	return(true);
   1782 }
   1783 
   1784 
   1785 /***********************************************************************************************
   1786  * LayerClass::Code_Pointers -- codes class's pointers for load/save                           *
   1787  *                                                                                             *
   1788  * This routine "codes" the pointers in the class by converting them to a number               *
   1789  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   1790  * allows a saved game to properly load without relying on the games data still                *
   1791  * being in the exact same location.                                                           *
   1792  *                                                                                             *
   1793  * INPUT:                                                                                      *
   1794  *      none.                                                                                  *
   1795  *                                                                                             *
   1796  * OUTPUT:                                                                                     *
   1797  *      none.                                                                                  *
   1798  *                                                                                             *
   1799  * WARNINGS:                                                                                   *
   1800  *      none.                                                                                  *
   1801  *                                                                                             *
   1802  * HISTORY:                                                                                    *
   1803  *   01/02/1995 BR : Created.                                                                  *
   1804  *=============================================================================================*/
   1805 void LayerClass::Code_Pointers(void)
   1806 {
   1807 	ObjectClass *obj;
   1808 
   1809 	for (int i = 0; i < Count(); i++) {
   1810 		obj = (*this)[i];
   1811 		(*this)[i] = (ObjectClass *)(obj->As_Target());
   1812 	}
   1813 }
   1814 
   1815 
   1816 /***********************************************************************************************
   1817  * LayerClass::Decode_Pointers -- decodes pointers for load/save                               *
   1818  *                                                                                             *
   1819  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   1820  * code values back into object pointers.                                                      *
   1821  *                                                                                             *
   1822  * INPUT:                                                                                      *
   1823  *      none.                                                                                  *
   1824  *                                                                                             *
   1825  * OUTPUT:                                                                                     *
   1826  *      none.                                                                                  *
   1827  *                                                                                             *
   1828  * WARNINGS:                                                                                   *
   1829  *      none.                                                                                  *
   1830  *                                                                                             *
   1831  * HISTORY:                                                                                    *
   1832  *   01/02/1995 BR : Created.                                                                  *
   1833  *=============================================================================================*/
   1834 void LayerClass::Decode_Pointers(void)
   1835 {
   1836 	TARGET target;
   1837 
   1838 	for (int i = 0; i < Count(); i++) {
   1839 		target = (TARGET)(*this)[i];
   1840 		(*this)[i] = (ObjectClass *)As_Object(target, false);
   1841 		Check_Ptr((*this)[i],__FILE__,__LINE__);
   1842 	}
   1843 }
   1844 
   1845 
   1846 /***********************************************************************************************
   1847  * HouseClass::Load -- Loads from a save game file.                                            *
   1848  *                                                                                             *
   1849  * INPUT:   file  -- The file to read the cell's data from.                                    *
   1850  *                                                                                             *
   1851  * OUTPUT:  true = success, false = failure                                                    *
   1852  *                                                                                             *
   1853  * WARNINGS:   none                                                                            *
   1854  *                                                                                             *
   1855  * HISTORY:                                                                                    *
   1856  *   09/19/1994 JLB : Created.                                                                 *
   1857  *=============================================================================================*/
   1858 bool HouseClass::Load(FileClass & file)
   1859 {
   1860 	::new (this) HouseClass();
   1861 	return(Read_Object(this, sizeof(*this), file, false));
   1862 	
   1863 	//return(Read_Object(this, sizeof(*this), sizeof(*this), file, 0));
   1864 }
   1865 
   1866 
   1867 /***********************************************************************************************
   1868  * HouseClass::Save -- Write to a save game file.                                              *
   1869  *                                                                                             *
   1870  * INPUT:   file  -- The file to write the cell's data to.                                     *
   1871  *                                                                                             *
   1872  * OUTPUT:  true = success, false = failure                                                    *
   1873  *                                                                                             *
   1874  * WARNINGS:   none                                                                            *
   1875  *                                                                                             *
   1876  * HISTORY:                                                                                    *
   1877  *   09/19/1994 JLB : Created.                                                                 *
   1878  *=============================================================================================*/
   1879 bool HouseClass::Save(FileClass & file)
   1880 {
   1881 	return(Write_Object(this, sizeof(*this), file));
   1882 }
   1883 
   1884 
   1885 /***********************************************************************************************
   1886  * HouseClass::Code_Pointers -- codes class's pointers for load/save                           *
   1887  *                                                                                             *
   1888  * This routine "codes" the pointers in the class by converting them to a number               *
   1889  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   1890  * allows a saved game to properly load without relying on the games data still                *
   1891  * being in the exact same location.                                                           *
   1892  *                                                                                             *
   1893  * INPUT:                                                                                      *
   1894  *      none.                                                                                  *
   1895  *                                                                                             *
   1896  * OUTPUT:                                                                                     *
   1897  *      none.                                                                                  *
   1898  *                                                                                             *
   1899  * WARNINGS:                                                                                   *
   1900  *      none.                                                                                  *
   1901  *                                                                                             *
   1902  * HISTORY:                                                                                    *
   1903  *   01/02/1995 BR : Created.                                                                  *
   1904  *=============================================================================================*/
   1905 void HouseClass::Code_Pointers(void)
   1906 {
   1907 	/*
   1908 	------------------------------ Code 'Class' ------------------------------
   1909 	*/
   1910 	((HouseTypeClass const *&)Class) = (HouseTypeClass const *)Class->House;
   1911 }
   1912 
   1913 
   1914 /***********************************************************************************************
   1915  * HouseClass::Decode_Pointers -- decodes pointers for load/save                               *
   1916  *                                                                                             *
   1917  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   1918  * code values back into object pointers.                                                      *
   1919  *                                                                                             *
   1920  * INPUT:                                                                                      *
   1921  *      none.                                                                                  *
   1922  *                                                                                             *
   1923  * OUTPUT:                                                                                     *
   1924  *      none.                                                                                  *
   1925  *                                                                                             *
   1926  * WARNINGS:                                                                                   *
   1927  *      none.                                                                                  *
   1928  *                                                                                             *
   1929  * HISTORY:                                                                                    *
   1930  *   01/02/1995 BR : Created.                                                                  *
   1931  *=============================================================================================*/
   1932 void HouseClass::Decode_Pointers(void)
   1933 {
   1934 	/*
   1935 	----------------------------- Decode 'Class' -----------------------------
   1936 	*/
   1937 	((HouseTypeClass const *&)Class) = &HouseTypeClass::As_Reference(*((HousesType*)&Class));
   1938 	Check_Ptr((void *)Class,__FILE__,__LINE__);
   1939 }
   1940 
   1941 
   1942 /***********************************************************************************************
   1943  * ScoreClass::Load -- Loads from a save game file.                                            *
   1944  *                                                                                             *
   1945  * INPUT:   file  -- The file to read the cell's data from.                                    *
   1946  *                                                                                             *
   1947  * OUTPUT:  true = success, false = failure                                                    *
   1948  *                                                                                             *
   1949  * WARNINGS:   none                                                                            *
   1950  *                                                                                             *
   1951  * HISTORY:                                                                                    *
   1952  *   09/19/1994 JLB : Created.                                                                 *
   1953  *=============================================================================================*/
   1954 bool ScoreClass::Load(FileClass & file)
   1955 {
   1956 	::new (this) ScoreClass();
   1957 	return(Read_Object(this, sizeof(*this), file, false));
   1958 	
   1959 	//return(Read_Object(this, sizeof(*this), sizeof(*this), file, 0));
   1960 }
   1961 
   1962 
   1963 /***********************************************************************************************
   1964  * ScoreClass::Save -- Write to a save game file.                                              *
   1965  *                                                                                             *
   1966  * INPUT:   file  -- The file to write the cell's data to.                                     *
   1967  *                                                                                             *
   1968  * OUTPUT:  true = success, false = failure                                                    *
   1969  *                                                                                             *
   1970  * WARNINGS:   none                                                                            *
   1971  *                                                                                             *
   1972  * HISTORY:                                                                                    *
   1973  *   09/19/1994 JLB : Created.                                                                 *
   1974  *=============================================================================================*/
   1975 bool ScoreClass::Save(FileClass & file)
   1976 {
   1977 	return(Write_Object(this, sizeof(*this), file));
   1978 }
   1979 
   1980 
   1981 /***********************************************************************************************
   1982  * ScoreClass::Code_Pointers -- codes class's pointers for load/save                           *
   1983  *                                                                                             *
   1984  * INPUT:                                                                                      *
   1985  *      none.                                                                                  *
   1986  *                                                                                             *
   1987  * OUTPUT:                                                                                     *
   1988  *      none.                                                                                  *
   1989  *                                                                                             *
   1990  * WARNINGS:                                                                                   *
   1991  *      none.                                                                                  *
   1992  *                                                                                             *
   1993  * HISTORY:                                                                                    *
   1994  *   01/02/1995 BR : Created.                                                                  *
   1995  *=============================================================================================*/
   1996 void ScoreClass::Code_Pointers(void)
   1997 {
   1998 }
   1999 
   2000 
   2001 /***********************************************************************************************
   2002  * ScoreClass::Decode_Pointers -- decodes pointers for load/save                               *
   2003  *                                                                                             *
   2004  * INPUT:                                                                                      *
   2005  *      none.                                                                                  *
   2006  *                                                                                             *
   2007  * OUTPUT:                                                                                     *
   2008  *      none.                                                                                  *
   2009  *                                                                                             *
   2010  * WARNINGS:                                                                                   *
   2011  *      none.                                                                                  *
   2012  *                                                                                             *
   2013  * HISTORY:                                                                                    *
   2014  *   01/02/1995 BR : Created.                                                                  *
   2015  *=============================================================================================*/
   2016 void ScoreClass::Decode_Pointers(void)
   2017 {
   2018 }
   2019 
   2020 
   2021 /***********************************************************************************************
   2022  * FlyClass::Code_Pointers -- codes class's pointers for load/save                             *
   2023  *                                                                                             *
   2024  * This routine "codes" the pointers in the class by converting them to a number               *
   2025  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   2026  * allows a saved game to properly load without relying on the games data still                *
   2027  * being in the exact same location.                                                           *
   2028  *                                                                                             *
   2029  * INPUT:                                                                                      *
   2030  *      none.                                                                                  *
   2031  *                                                                                             *
   2032  * OUTPUT:                                                                                     *
   2033  *      none.                                                                                  *
   2034  *                                                                                             *
   2035  * WARNINGS:                                                                                   *
   2036  *      none.                                                                                  *
   2037  *                                                                                             *
   2038  * HISTORY:                                                                                    *
   2039  *   01/02/1995 BR : Created.                                                                  *
   2040  *=============================================================================================*/
   2041 void FlyClass::Code_Pointers(void)
   2042 {
   2043 }
   2044 
   2045 
   2046 /***********************************************************************************************
   2047  * FlyClass::Decode_Pointers -- decodes pointers for load/save                                 *
   2048  *                                                                                             *
   2049  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   2050  * code values back into object pointers.                                                      *
   2051  *                                                                                             *
   2052  * INPUT:                                                                                      *
   2053  *      none.                                                                                  *
   2054  *                                                                                             *
   2055  * OUTPUT:                                                                                     *
   2056  *      none.                                                                                  *
   2057  *                                                                                             *
   2058  * WARNINGS:                                                                                   *
   2059  *      none.                                                                                  *
   2060  *                                                                                             *
   2061  * HISTORY:                                                                                    *
   2062  *   01/02/1995 BR : Created.                                                                  *
   2063  *=============================================================================================*/
   2064 void FlyClass::Decode_Pointers(void)
   2065 {
   2066 }
   2067 
   2068 
   2069 /***********************************************************************************************
   2070  * FuseClass::Code_Pointers -- codes class's pointers for load/save                            *
   2071  *                                                                                             *
   2072  * This routine "codes" the pointers in the class by converting them to a number               *
   2073  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   2074  * allows a saved game to properly load without relying on the games data still                *
   2075  * being in the exact same location.                                                           *
   2076  *                                                                                             *
   2077  * INPUT:                                                                                      *
   2078  *      none.                                                                                  *
   2079  *                                                                                             *
   2080  * OUTPUT:                                                                                     *
   2081  *      none.                                                                                  *
   2082  *                                                                                             *
   2083  * WARNINGS:                                                                                   *
   2084  *      none.                                                                                  *
   2085  *                                                                                             *
   2086  * HISTORY:                                                                                    *
   2087  *   01/02/1995 BR : Created.                                                                  *
   2088  *=============================================================================================*/
   2089 void FuseClass::Code_Pointers(void)
   2090 {
   2091 }
   2092 
   2093 
   2094 /***********************************************************************************************
   2095  * FuseClass::Decode_Pointers -- decodes pointers for load/save                                *
   2096  *                                                                                             *
   2097  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   2098  * code values back into object pointers.                                                      *
   2099  *                                                                                             *
   2100  * INPUT:                                                                                      *
   2101  *      none.                                                                                  *
   2102  *                                                                                             *
   2103  * OUTPUT:                                                                                     *
   2104  *      none.                                                                                  *
   2105  *                                                                                             *
   2106  * WARNINGS:                                                                                   *
   2107  *      none.                                                                                  *
   2108  *                                                                                             *
   2109  * HISTORY:                                                                                    *
   2110  *   01/02/1995 BR : Created.                                                                  *
   2111  *=============================================================================================*/
   2112 void FuseClass::Decode_Pointers(void)
   2113 {
   2114 }
   2115 
   2116 
   2117 /***********************************************************************************************
   2118  * TarComClass::Code_Pointers -- codes class's pointers for load/save                          *
   2119  *                                                                                             *
   2120  * This routine "codes" the pointers in the class by converting them to a number               *
   2121  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   2122  * allows a saved game to properly load without relying on the games data still                *
   2123  * being in the exact same location.                                                           *
   2124  *                                                                                             *
   2125  * INPUT:                                                                                      *
   2126  *      none.                                                                                  *
   2127  *                                                                                             *
   2128  * OUTPUT:                                                                                     *
   2129  *      none.                                                                                  *
   2130  *                                                                                             *
   2131  * WARNINGS:                                                                                   *
   2132  *      none.                                                                                  *
   2133  *                                                                                             *
   2134  * HISTORY:                                                                                    *
   2135  *   01/02/1995 BR : Created.                                                                  *
   2136  *=============================================================================================*/
   2137 void TarComClass::Code_Pointers(void)
   2138 {
   2139 	TurretClass::Code_Pointers();
   2140 }
   2141 
   2142 
   2143 /***********************************************************************************************
   2144  * TarComClass::Decode_Pointers -- decodes pointers for load/save                              *
   2145  *                                                                                             *
   2146  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   2147  * code values back into object pointers.                                                      *
   2148  *                                                                                             *
   2149  * INPUT:                                                                                      *
   2150  *      none.                                                                                  *
   2151  *                                                                                             *
   2152  * OUTPUT:                                                                                     *
   2153  *      none.                                                                                  *
   2154  *                                                                                             *
   2155  * WARNINGS:                                                                                   *
   2156  *      none.                                                                                  *
   2157  *                                                                                             *
   2158  * HISTORY:                                                                                    *
   2159  *   01/02/1995 BR : Created.                                                                  *
   2160  *=============================================================================================*/
   2161 void TarComClass::Decode_Pointers(void)
   2162 {
   2163 	TurretClass::Decode_Pointers();
   2164 }
   2165 
   2166 
   2167 /***********************************************************************************************
   2168  * TurretClass::Code_Pointers -- codes class's pointers for load/save                          *
   2169  *                                                                                             *
   2170  * This routine "codes" the pointers in the class by converting them to a number               *
   2171  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   2172  * allows a saved game to properly load without relying on the games data still                *
   2173  * being in the exact same location.                                                           *
   2174  *                                                                                             *
   2175  * INPUT:                                                                                      *
   2176  *      none.                                                                                  *
   2177  *                                                                                             *
   2178  * OUTPUT:                                                                                     *
   2179  *      none.                                                                                  *
   2180  *                                                                                             *
   2181  * WARNINGS:                                                                                   *
   2182  *      none.                                                                                  *
   2183  *                                                                                             *
   2184  * HISTORY:                                                                                    *
   2185  *   01/02/1995 BR : Created.                                                                  *
   2186  *=============================================================================================*/
   2187 void TurretClass::Code_Pointers(void)
   2188 {
   2189 	DriveClass::Code_Pointers();
   2190 }
   2191 
   2192 
   2193 /***********************************************************************************************
   2194  * TurretClass::Decode_Pointers -- decodes pointers for load/save                              *
   2195  *                                                                                             *
   2196  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   2197  * code values back into object pointers.                                                      *
   2198  *                                                                                             *
   2199  * INPUT:                                                                                      *
   2200  *      none.                                                                                  *
   2201  *                                                                                             *
   2202  * OUTPUT:                                                                                     *
   2203  *      none.                                                                                  *
   2204  *                                                                                             *
   2205  * WARNINGS:                                                                                   *
   2206  *      none.                                                                                  *
   2207  *                                                                                             *
   2208  * HISTORY:                                                                                    *
   2209  *   01/02/1995 BR : Created.                                                                  *
   2210  *=============================================================================================*/
   2211 void TurretClass::Decode_Pointers(void)
   2212 {
   2213 	DriveClass::Decode_Pointers();
   2214 }
   2215 
   2216 
   2217 /***********************************************************************************************
   2218  * DriveClass::Code_Pointers -- codes class's pointers for load/save                           *
   2219  *                                                                                             *
   2220  * This routine "codes" the pointers in the class by converting them to a number               *
   2221  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   2222  * allows a saved game to properly load without relying on the games data still                *
   2223  * being in the exact same location.                                                           *
   2224  *                                                                                             *
   2225  * INPUT:                                                                                      *
   2226  *      none.                                                                                  *
   2227  *                                                                                             *
   2228  * OUTPUT:                                                                                     *
   2229  *      none.                                                                                  *
   2230  *                                                                                             *
   2231  * WARNINGS:                                                                                   *
   2232  *      none.                                                                                  *
   2233  *                                                                                             *
   2234  * HISTORY:                                                                                    *
   2235  *   01/02/1995 BR : Created.                                                                  *
   2236  *=============================================================================================*/
   2237 void DriveClass::Code_Pointers(void)
   2238 {
   2239 	/*
   2240 	------------------------------ Code 'Class' ------------------------------
   2241 	*/
   2242 	((UnitTypeClass *&)Class) = (UnitTypeClass *)Class->Type;
   2243 
   2244 	/*
   2245 	---------------------------- Chain to parent -----------------------------
   2246 	*/
   2247 	FootClass::Code_Pointers();
   2248 }
   2249 
   2250 
   2251 /***********************************************************************************************
   2252  * DriveClass::Decode_Pointers -- decodes pointers for load/save                               *
   2253  *                                                                                             *
   2254  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   2255  * code values back into object pointers.                                                      *
   2256  *                                                                                             *
   2257  * INPUT:                                                                                      *
   2258  *      none.                                                                                  *
   2259  *                                                                                             *
   2260  * OUTPUT:                                                                                     *
   2261  *      none.                                                                                  *
   2262  *                                                                                             *
   2263  * WARNINGS:                                                                                   *
   2264  *      none.                                                                                  *
   2265  *                                                                                             *
   2266  * HISTORY:                                                                                    *
   2267  *   01/02/1995 BR : Created.                                                                  *
   2268  *=============================================================================================*/
   2269 void DriveClass::Decode_Pointers(void)
   2270 {
   2271 	/*
   2272 	----------------------------- Decode 'Class' -----------------------------
   2273 	*/
   2274 	((UnitTypeClass const *&)Class) = &UnitTypeClass::As_Reference(*((UnitType*)&Class));
   2275 	Check_Ptr((void *)Class,__FILE__,__LINE__);
   2276 
   2277 	/*
   2278 	---------------------------- Chain to parent -----------------------------
   2279 	*/
   2280 	FootClass::Decode_Pointers();
   2281 }
   2282 
   2283 
   2284 /***********************************************************************************************
   2285  * FootClass::Code_Pointers -- codes class's pointers for load/save                            *
   2286  *                                                                                             *
   2287  * This routine "codes" the pointers in the class by converting them to a number               *
   2288  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   2289  * allows a saved game to properly load without relying on the games data still                *
   2290  * being in the exact same location.                                                           *
   2291  *                                                                                             *
   2292  * INPUT:                                                                                      *
   2293  *      none.                                                                                  *
   2294  *                                                                                             *
   2295  * OUTPUT:                                                                                     *
   2296  *      none.                                                                                  *
   2297  *                                                                                             *
   2298  * WARNINGS:                                                                                   *
   2299  *      none.                                                                                  *
   2300  *                                                                                             *
   2301  * HISTORY:                                                                                    *
   2302  *   01/02/1995 BR : Created.                                                                  *
   2303  *=============================================================================================*/
   2304 void FootClass::Code_Pointers(void)
   2305 {
   2306 	if (Team)
   2307 		Team = (TeamClass *)Team->As_Target();
   2308 
   2309 	if (Member) {
   2310 		Member = (FootClass *)Member->As_Target();
   2311 	}
   2312 
   2313 	TechnoClass::Code_Pointers();
   2314 }
   2315 
   2316 
   2317 /***********************************************************************************************
   2318  * FootClass::Decode_Pointers -- decodes pointers for load/save                                *
   2319  *                                                                                             *
   2320  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   2321  * code values back into object pointers.                                                      *
   2322  *                                                                                             *
   2323  * INPUT:                                                                                      *
   2324  *      none.                                                                                  *
   2325  *                                                                                             *
   2326  * OUTPUT:                                                                                     *
   2327  *      none.                                                                                  *
   2328  *                                                                                             *
   2329  * WARNINGS:                                                                                   *
   2330  *      none.                                                                                  *
   2331  *                                                                                             *
   2332  * HISTORY:                                                                                    *
   2333  *   01/02/1995 BR : Created.                                                                  *
   2334  *=============================================================================================*/
   2335 void FootClass::Decode_Pointers(void)
   2336 {
   2337 	if (Team) {
   2338 		Team = As_Team((TARGET)Team, false);
   2339 		Check_Ptr((void *)Team,__FILE__,__LINE__);
   2340 	}
   2341 
   2342 	if (Member) {
   2343 		Member = (FootClass *)As_Techno((TARGET)Member, false);
   2344 		Check_Ptr((void *)Member,__FILE__,__LINE__);
   2345 	}
   2346 
   2347 	TechnoClass::Decode_Pointers();
   2348 }
   2349 
   2350 
   2351 /***********************************************************************************************
   2352  * RadioClass::Code_Pointers -- codes class's pointers for load/save                           *
   2353  *                                                                                             *
   2354  * This routine "codes" the pointers in the class by converting them to a number               *
   2355  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   2356  * allows a saved game to properly load without relying on the games data still                *
   2357  * being in the exact same location.                                                           *
   2358  *                                                                                             *
   2359  * INPUT:                                                                                      *
   2360  *      none.                                                                                  *
   2361  *                                                                                             *
   2362  * OUTPUT:                                                                                     *
   2363  *      none.                                                                                  *
   2364  *                                                                                             *
   2365  * WARNINGS:                                                                                   *
   2366  *      none.                                                                                  *
   2367  *                                                                                             *
   2368  * HISTORY:                                                                                    *
   2369  *   01/02/1995 BR : Created.                                                                  *
   2370  *=============================================================================================*/
   2371 void RadioClass::Code_Pointers(void)
   2372 {
   2373 	/*
   2374 	------------------------------ Code 'Radio' ------------------------------
   2375 	*/
   2376 	if (Radio) {
   2377 		Radio = (RadioClass *)Radio->As_Target();
   2378 	}
   2379 
   2380 	MissionClass::Code_Pointers();
   2381 }
   2382 
   2383 
   2384 /***********************************************************************************************
   2385  * RadioClass::Decode_Pointers -- decodes pointers for load/save                               *
   2386  *                                                                                             *
   2387  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   2388  * code values back into object pointers.                                                      *
   2389  *                                                                                             *
   2390  * INPUT:                                                                                      *
   2391  *      none.                                                                                  *
   2392  *                                                                                             *
   2393  * OUTPUT:                                                                                     *
   2394  *      none.                                                                                  *
   2395  *                                                                                             *
   2396  * WARNINGS:                                                                                   *
   2397  *      none.                                                                                  *
   2398  *                                                                                             *
   2399  * HISTORY:                                                                                    *
   2400  *   01/02/1995 BR : Created.                                                                  *
   2401  *=============================================================================================*/
   2402 void RadioClass::Decode_Pointers(void)
   2403 {
   2404 	/*
   2405 	----------------------------- Decode 'Radio' -----------------------------
   2406 	*/
   2407 	if (Radio) {
   2408 		Radio = As_Techno((TARGET)Radio, false);
   2409 		Check_Ptr((void *)Radio,__FILE__,__LINE__);
   2410 	}
   2411 
   2412 	MissionClass::Decode_Pointers();
   2413 }
   2414 
   2415 
   2416 /***********************************************************************************************
   2417  * TechnoClass::Code_Pointers -- codes class's pointers for load/save                          *
   2418  *                                                                                             *
   2419  * This routine "codes" the pointers in the class by converting them to a number               *
   2420  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   2421  * allows a saved game to properly load without relying on the games data still                *
   2422  * being in the exact same location.                                                           *
   2423  *                                                                                             *
   2424  * INPUT:                                                                                      *
   2425  *      none.                                                                                  *
   2426  *                                                                                             *
   2427  * OUTPUT:                                                                                     *
   2428  *      none.                                                                                  *
   2429  *                                                                                             *
   2430  * WARNINGS:                                                                                   *
   2431  *      none.                                                                                  *
   2432  *                                                                                             *
   2433  * HISTORY:                                                                                    *
   2434  *   01/02/1995 BR : Created.                                                                  *
   2435  *=============================================================================================*/
   2436 void TechnoClass::Code_Pointers(void)
   2437 {
   2438 	/*
   2439 	------------------------------ Code 'House' ------------------------------
   2440 	*/
   2441 	((HouseClass *&)House) = (HouseClass *)(House->Class->House);
   2442 
   2443 	FlasherClass::Code_Pointers();
   2444 	StageClass::Code_Pointers();
   2445 	CargoClass::Code_Pointers();
   2446 	DoorClass::Code_Pointers();
   2447 
   2448 	RadioClass::Code_Pointers();
   2449 }
   2450 
   2451 
   2452 /***********************************************************************************************
   2453  * TechnoClass::Decode_Pointers -- decodes pointers for load/save                              *
   2454  *                                                                                             *
   2455  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   2456  * code values back into object pointers.                                                      *
   2457  *                                                                                             *
   2458  * INPUT:                                                                                      *
   2459  *      none.                                                                                  *
   2460  *                                                                                             *
   2461  * OUTPUT:                                                                                     *
   2462  *      none.                                                                                  *
   2463  *                                                                                             *
   2464  * WARNINGS:                                                                                   *
   2465  *      none.                                                                                  *
   2466  *                                                                                             *
   2467  * HISTORY:                                                                                    *
   2468  *   01/02/1995 BR : Created.                                                                  *
   2469  *=============================================================================================*/
   2470 void TechnoClass::Decode_Pointers(void)
   2471 {
   2472 	/*
   2473 	----------------------------- Decode 'House' -----------------------------
   2474 	*/
   2475 	((HouseClass *&)House) = HouseClass::As_Pointer(*((HousesType*)&House));
   2476 	Check_Ptr((void *)House,__FILE__,__LINE__);
   2477 
   2478 	FlasherClass::Decode_Pointers();
   2479 	StageClass::Decode_Pointers();
   2480 	CargoClass::Decode_Pointers();
   2481 	DoorClass::Decode_Pointers();
   2482 
   2483 	RadioClass::Decode_Pointers();
   2484 }
   2485 
   2486 
   2487 /***********************************************************************************************
   2488  * FlasherClass::Code_Pointers -- codes class's pointers for load/save                         *
   2489  *                                                                                             *
   2490  * This routine "codes" the pointers in the class by converting them to a number               *
   2491  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   2492  * allows a saved game to properly load without relying on the games data still                *
   2493  * being in the exact same location.                                                           *
   2494  *                                                                                             *
   2495  * INPUT:                                                                                      *
   2496  *      none.                                                                                  *
   2497  *                                                                                             *
   2498  * OUTPUT:                                                                                     *
   2499  *      none.                                                                                  *
   2500  *                                                                                             *
   2501  * WARNINGS:                                                                                   *
   2502  *      none.                                                                                  *
   2503  *                                                                                             *
   2504  * HISTORY:                                                                                    *
   2505  *   01/02/1995 BR : Created.                                                                  *
   2506  *=============================================================================================*/
   2507 void FlasherClass::Code_Pointers(void)
   2508 {
   2509 }
   2510 
   2511 
   2512 /***********************************************************************************************
   2513  * FlasherClass::Decode_Pointers -- decodes pointers for load/save                             *
   2514  *                                                                                             *
   2515  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   2516  * code values back into object pointers.                                                      *
   2517  *                                                                                             *
   2518  * INPUT:                                                                                      *
   2519  *      none.                                                                                  *
   2520  *                                                                                             *
   2521  * OUTPUT:                                                                                     *
   2522  *      none.                                                                                  *
   2523  *                                                                                             *
   2524  * WARNINGS:                                                                                   *
   2525  *      none.                                                                                  *
   2526  *                                                                                             *
   2527  * HISTORY:                                                                                    *
   2528  *   01/02/1995 BR : Created.                                                                  *
   2529  *=============================================================================================*/
   2530 void FlasherClass::Decode_Pointers(void)
   2531 {
   2532 }
   2533 
   2534 
   2535 /***********************************************************************************************
   2536  * CargoClass::Code_Pointers -- codes class's pointers for load/save                           *
   2537  *                                                                                             *
   2538  * This routine "codes" the pointers in the class by converting them to a number               *
   2539  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   2540  * allows a saved game to properly load without relying on the games data still                *
   2541  * being in the exact same location.                                                           *
   2542  *                                                                                             *
   2543  * INPUT:                                                                                      *
   2544  *      none.                                                                                  *
   2545  *                                                                                             *
   2546  * OUTPUT:                                                                                     *
   2547  *      none.                                                                                  *
   2548  *                                                                                             *
   2549  * WARNINGS:                                                                                   *
   2550  *      none.                                                                                  *
   2551  *                                                                                             *
   2552  * HISTORY:                                                                                    *
   2553  *   01/02/1995 BR : Created.                                                                  *
   2554  *=============================================================================================*/
   2555 void CargoClass::Code_Pointers(void)
   2556 {
   2557 	/*
   2558 	---------------------------- Code 'CargoHold' ----------------------------
   2559 	*/
   2560 	if (CargoHold) {
   2561 		CargoHold = (FootClass *)CargoHold->As_Target();
   2562 	}
   2563 }
   2564 
   2565 
   2566 /***********************************************************************************************
   2567  * CargoClass::Decode_Pointers -- decodes pointers for load/save                               *
   2568  *                                                                                             *
   2569  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   2570  * code values back into object pointers.                                                      *
   2571  *                                                                                             *
   2572  * INPUT:                                                                                      *
   2573  *      none.                                                                                  *
   2574  *                                                                                             *
   2575  * OUTPUT:                                                                                     *
   2576  *      none.                                                                                  *
   2577  *                                                                                             *
   2578  * WARNINGS:                                                                                   *
   2579  *      none.                                                                                  *
   2580  *                                                                                             *
   2581  * HISTORY:                                                                                    *
   2582  *   01/02/1995 BR : Created.                                                                  *
   2583  *=============================================================================================*/
   2584 void CargoClass::Decode_Pointers(void)
   2585 {
   2586 	/*
   2587 	--------------------------- Decode 'CargoHold' ---------------------------
   2588 	*/
   2589 	if (CargoHold) {
   2590 		CargoHold = (FootClass *)As_Techno((TARGET)CargoHold, false);
   2591 		Check_Ptr((void *)CargoHold,__FILE__,__LINE__);
   2592 	}
   2593 }
   2594 
   2595 
   2596 /***********************************************************************************************
   2597  * MissionClass::Code_Pointers -- codes class's pointers for load/save                         *
   2598  *                                                                                             *
   2599  * This routine "codes" the pointers in the class by converting them to a number               *
   2600  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   2601  * allows a saved game to properly load without relying on the games data still                *
   2602  * being in the exact same location.                                                           *
   2603  *                                                                                             *
   2604  * INPUT:                                                                                      *
   2605  *      none.                                                                                  *
   2606  *                                                                                             *
   2607  * OUTPUT:                                                                                     *
   2608  *      none.                                                                                  *
   2609  *                                                                                             *
   2610  * WARNINGS:                                                                                   *
   2611  *      none.                                                                                  *
   2612  *                                                                                             *
   2613  * HISTORY:                                                                                    *
   2614  *   01/02/1995 BR : Created.                                                                  *
   2615  *=============================================================================================*/
   2616 void MissionClass::Code_Pointers(void)
   2617 {
   2618 	ObjectClass::Code_Pointers();
   2619 }
   2620 
   2621 
   2622 /***********************************************************************************************
   2623  * MissionClass::Decode_Pointers -- decodes pointers for load/save                             *
   2624  *                                                                                             *
   2625  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   2626  * code values back into object pointers.                                                      *
   2627  *                                                                                             *
   2628  * INPUT:                                                                                      *
   2629  *      none.                                                                                  *
   2630  *                                                                                             *
   2631  * OUTPUT:                                                                                     *
   2632  *      none.                                                                                  *
   2633  *                                                                                             *
   2634  * WARNINGS:                                                                                   *
   2635  *      none.                                                                                  *
   2636  *                                                                                             *
   2637  * HISTORY:                                                                                    *
   2638  *   01/02/1995 BR : Created.                                                                  *
   2639  *=============================================================================================*/
   2640 void MissionClass::Decode_Pointers(void)
   2641 {
   2642 	ObjectClass::Decode_Pointers();
   2643 }
   2644 
   2645 
   2646 /***********************************************************************************************
   2647  * ObjectClass::Code_Pointers -- codes class's pointers for load/save                          *
   2648  *                                                                                             *
   2649  * This routine "codes" the pointers in the class by converting them to a number               *
   2650  * that still represents the object pointed to, but isn't actually a pointer.  This            *
   2651  * allows a saved game to properly load without relying on the games data still                *
   2652  * being in the exact same location.                                                           *
   2653  *                                                                                             *
   2654  * INPUT:                                                                                      *
   2655  *      none.                                                                                  *
   2656  *                                                                                             *
   2657  * OUTPUT:                                                                                     *
   2658  *      none.                                                                                  *
   2659  *                                                                                             *
   2660  * WARNINGS:                                                                                   *
   2661  *      none.                                                                                  *
   2662  *                                                                                             *
   2663  * HISTORY:                                                                                    *
   2664  *   01/02/1995 BR : Created.                                                                  *
   2665  *=============================================================================================*/
   2666 void ObjectClass::Code_Pointers(void)
   2667 {
   2668 	if (Next) {
   2669 		Next = (ObjectClass *)Next->As_Target();
   2670 	}
   2671 
   2672 	if (Trigger) {
   2673 		Trigger = (TriggerClass *)Trigger->As_Target();
   2674 	}
   2675 }
   2676 
   2677 
   2678 /***********************************************************************************************
   2679  * ObjectClass::Decode_Pointers -- decodes pointers for load/save                              *
   2680  *                                                                                             *
   2681  * This routine "decodes" the pointers coded in Code_Pointers by converting the                *
   2682  * code values back into object pointers.                                                      *
   2683  *                                                                                             *
   2684  * INPUT:                                                                                      *
   2685  *      none.                                                                                  *
   2686  *                                                                                             *
   2687  * OUTPUT:                                                                                     *
   2688  *      none.                                                                                  *
   2689  *                                                                                             *
   2690  * WARNINGS:                                                                                   *
   2691  *      none.                                                                                  *
   2692  *                                                                                             *
   2693  * HISTORY:                                                                                    *
   2694  *   01/02/1995 BR : Created.                                                                  *
   2695  *=============================================================================================*/
   2696 void ObjectClass::Decode_Pointers(void)
   2697 {
   2698 	if (Next) {
   2699 		Next = As_Object((TARGET)Next, false);
   2700 		Check_Ptr((void *)Next,__FILE__,__LINE__);
   2701 	}
   2702 
   2703 	if (Trigger) {
   2704 		Trigger = As_Trigger((TARGET)Trigger, false);
   2705 		Check_Ptr((void *)Trigger,__FILE__,__LINE__);
   2706 	}
   2707 }