IOOBJ.CPP 59 KB

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