IOOBJ.CPP 59 KB

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