RULES.CPP 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049
  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/RULES.CPP 1 3/03/97 10:25a 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 : RULES.CPP *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : 05/12/96 *
  30. * *
  31. * Last Update : September 10, 1996 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * Difficulty_Get -- Fetch the difficulty bias values. *
  36. * RulesClass::AI -- Processes the AI control constants from the database. *
  37. * RulesClass::General -- Process the general main game rules. *
  38. * RulesClass::Heap_Maximums -- Fetch and process the heap override values. *
  39. * RulesClass::IQ -- Fetches the IQ control values from the INI database. *
  40. * RulesClass::Land_Types -- Inits the land type values. *
  41. * RulesClass::MPlayer -- Fetch and process the multiplayer default settings. *
  42. * RulesClass::Powerups -- Process the powerup values from the database. *
  43. * RulesClass::Process -- Fetch the bulk of the rule data from the control file. *
  44. * RulesClass::Recharge -- Process the super weapon recharge statistics. *
  45. * RulesClass::RulesClass -- Default constructor for rules class object. *
  46. * RulesClass::Themes -- Fetches the theme control values from the INI database. *
  47. * Techno_Get -- Get rule data common for all techno type objects. *
  48. * _Scale_To_256 -- Scales a 1..100 number into a 1..255 number. *
  49. * RulesClass::Difficulty -- Fetch the various difficulty group settings. *
  50. * RulesClass::Objects -- Fetch all the object characteristic values. *
  51. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  52. #include "function.h"
  53. #include "vortex.h"
  54. /***********************************************************************************************
  55. * _Scale_To_256 -- Scales a 1..100 number into a 1..255 number. *
  56. * *
  57. * This is a helper routine that will take a decimal percentage number and convert it *
  58. * into a game based fixed point number. *
  59. * *
  60. * INPUT: val -- Decimal percent number to convert. *
  61. * *
  62. * OUTPUT: Returns with the decimal percent number converted to a game fixed point number. *
  63. * *
  64. * WARNINGS: none *
  65. * *
  66. * HISTORY: *
  67. * 06/17/1996 JLB : Created. *
  68. *=============================================================================================*/
  69. static inline int _Scale_To_256(int val)
  70. {
  71. val = fixed(100, 256) * val;
  72. val = min(val, 255);
  73. return(val);
  74. }
  75. /***********************************************************************************************
  76. * RulesClass::RulesClass -- Default constructor for rules class object. *
  77. * *
  78. * This is the default constructor for the rules class object. Although it initializes the *
  79. * rule data with default values, it is expected that they will all be overridden by the *
  80. * rules control file. *
  81. * *
  82. * INPUT: none *
  83. * *
  84. * OUTPUT: none *
  85. * *
  86. * WARNINGS: none *
  87. * *
  88. * HISTORY: *
  89. * 06/17/1996 JLB : Created. *
  90. *=============================================================================================*/
  91. RulesClass::RulesClass(void) :
  92. TurboBoost("1.5"),
  93. AttackInterval(3),
  94. AttackDelay(5),
  95. PowerEmergencyFraction(fixed::_3_4),
  96. BadgerBombCount(1),
  97. AirstripRatio(".12"),
  98. AirstripLimit(5),
  99. HelipadRatio(".12"),
  100. HelipadLimit(5),
  101. TeslaRatio(".16"),
  102. TeslaLimit(10),
  103. AARatio(".14"),
  104. AALimit(10),
  105. DefenseRatio(".5"),
  106. DefenseLimit(40),
  107. WarRatio(".1"),
  108. WarLimit(2),
  109. BarracksRatio(".16"),
  110. BarracksLimit(2),
  111. RefineryLimit(4),
  112. RefineryRatio(".16"),
  113. BaseSizeAdd(3),
  114. PowerSurplus(50),
  115. InfantryReserve(2000),
  116. InfantryBaseMult(2),
  117. ChronoDuration(3),
  118. WaterCrateChance(".2"),
  119. SoloCrateMoney(2000),
  120. GPSTechLevel(0),
  121. UnitCrateType(UNIT_NONE),
  122. PatrolTime(".016"),
  123. TeamDelay(".6"),
  124. CloakDelay(0),
  125. GameSpeedBias(1),
  126. NervousBias(1),
  127. VortexRange(10*CELL_LEPTON_W),
  128. VortexSpeed((MPHType)10),
  129. VortexDamage(200),
  130. VortexChance(".2"),
  131. ExplosionSpread(fixed::_1_2),
  132. SupressRadius(CELL_LEPTON_W),
  133. ParaInfantryTechLevel(10),
  134. SpyPlaneTechLevel(10),
  135. ParaBombTechLevel(10),
  136. MaxIQ(5),
  137. IQSuperWeapons(4),
  138. IQProduction(5),
  139. IQGuardArea(4),
  140. IQRepairSell(3),
  141. IQCrush(2),
  142. IQScatter(3),
  143. IQContentScan(4),
  144. IQAircraft(4),
  145. IQHarvester(3),
  146. IQSellBack(2),
  147. SilverCrate(CRATE_HEAL_BASE),
  148. WoodCrate(CRATE_MONEY),
  149. WaterCrate(CRATE_MONEY),
  150. CrateMinimum(1),
  151. CrateMaximum(255),
  152. LZScanRadius(16*CELL_LEPTON_W),
  153. MPDefaultMoney(3000),
  154. MPMaxMoney(10000),
  155. IsMPShadowGrow(true),
  156. IsMPBasesOn(true),
  157. IsMPTiberiumGrow(true),
  158. IsMPCrates(true),
  159. IsMPAIPlayers(false),
  160. IsMPCaptureTheFlag(false),
  161. DropZoneRadius(4*CELL_LEPTON_W),
  162. MessageDelay(".6"),
  163. SavourDelay(".03"),
  164. AVMineDamage(1200),
  165. APMineDamage(1000),
  166. MaxPlayers(8),
  167. BaseDefenseDelay(fixed::_1_4),
  168. SuspendPriority(20),
  169. SuspendDelay(2),
  170. SurvivorFraction(fixed::_1_2),
  171. ReloadRate(".05"),
  172. AutocreateTime(5),
  173. BuildupTime(".05"),
  174. OreDumpRate(2),
  175. AtomDamage(1000),
  176. IsComputerParanoid(true),
  177. IsCurleyShuffle(false),
  178. IsFlashLowPower(true),
  179. IsCompEasyBonus(true),
  180. IsFineDifficulty(false),
  181. IsExplosiveHarvester(false),
  182. IsHealthBar(true),
  183. IsMCVDeploy(false),
  184. IsAllyReveal(true),
  185. IsSeparate(false),
  186. IsTreeTarget(false),
  187. IsMineAware(true),
  188. IsTGrowth(true),
  189. IsTSpread(true),
  190. IsNamed(false),
  191. IsAutoCrush(false),
  192. IsSmartDefense(false),
  193. IsScatter(false),
  194. IsChronoKill(true),
  195. ProneDamageBias(fixed::_1_2),
  196. QuakeDamagePercent(".33"),
  197. QuakeChance(".2"),
  198. GrowthRate(2),
  199. ShroudRate(4),
  200. CrateTime(10),
  201. TimerWarning(2),
  202. ChronoTechLevel(1),
  203. SonarTime(14),
  204. ChronoTime(3),
  205. ParaBombTime(14),
  206. ParaInfantryTime(2),
  207. ParaSaboteurTime(14),
  208. SpyTime(2),
  209. IronCurtainTime(14),
  210. GPSTime(1),
  211. NukeTime(14),
  212. SpeakDelay(2),
  213. DamageDelay(1),
  214. Gravity(3),
  215. GapShroudRadius(10),
  216. GapRegenInterval(".1"),
  217. RadarJamRadius(10*CELL_LEPTON_W),
  218. Incoming(MPH_IMMOBILE),
  219. MinDamage(1),
  220. MaxDamage(1000),
  221. RepairStep(5),
  222. RepairPercent(fixed::_1_4),
  223. URepairStep(5),
  224. URepairPercent(fixed::_1_4),
  225. RepairRate(".016"),
  226. ConditionGreen(1),
  227. ConditionYellow(fixed::_1_2),
  228. ConditionRed(fixed::_1_4),
  229. RandomAnimateTime(".083"),
  230. BailCount(28),
  231. GoldValue(35),
  232. GemValue(110),
  233. AircraftMax(100),
  234. AnimMax(100),
  235. BuildingMax(500),
  236. BulletMax(40),
  237. FactoryMax(20),
  238. InfantryMax(500),
  239. OverlayMax(1),
  240. SmudgeMax(1),
  241. TeamMax(60),
  242. TeamTypeMax(60),
  243. TemplateMax(1),
  244. TerrainMax(500),
  245. TriggerMax(60),
  246. UnitMax(500),
  247. VesselMax(100),
  248. ProjectileMax(20),
  249. WeaponMax(20),
  250. WarheadMax(20),
  251. TrigTypeMax(80),
  252. CloseEnoughDistance(0x0280),
  253. StrayDistance(0x0200),
  254. CrushDistance(0x0180),
  255. CrateRadius(0x0280),
  256. HomingScatter(0x0200),
  257. BallisticScatter(0x0100),
  258. RefundPercent(fixed::_1_2),
  259. IronCurtainDuration(fixed::_1_2),
  260. BridgeStrength(1000),
  261. BuildSpeedBias(1),
  262. C4Delay(".03"),
  263. RepairThreshhold(1000),
  264. PathDelay(".016"),
  265. MovieTime(fixed::_1_4),
  266. TiberiumShortScan(0x0600),
  267. TiberiumLongScan(0x2000)
  268. {
  269. #ifdef FIXIT_CSII // checked - ajw 9/28/98
  270. NewUnitsEnabled = SecretUnitsEnabled = 0;
  271. MTankDistance = 30;
  272. QuakeUnitDamage = 0x080;
  273. QuakeBuildingDamage = 0x040;
  274. QuakeInfantryDamage = 0;
  275. QuakeDelay = 120;
  276. ChronoTankDuration = 0x300;
  277. #ifdef FIXIT_ENGINEER // checked - ajw 9/28/98
  278. EngineerDamage=(fixed)1 / (fixed)3; // Amount of damage an engineer does
  279. EngineerCaptureLevel=ConditionRed; // Building damage level before engineer can capture
  280. #endif
  281. #ifdef FIXIT_CARRIER // checked - ajw 9/28/98
  282. CarrierLaunchDelay = 60;
  283. #endif
  284. #endif
  285. }
  286. /***********************************************************************************************
  287. * Difficulty_Get -- Fetch the difficulty bias values. *
  288. * *
  289. * This will fetch the difficulty bias values for the section specified. *
  290. * *
  291. * INPUT: ini -- Reference the INI database to fetch the values from. *
  292. * *
  293. * diff -- Reference to the difficulty class object to fill in with the values. *
  294. * *
  295. * section -- The section identifier to lift the values from. *
  296. * *
  297. * OUTPUT: none *
  298. * *
  299. * WARNINGS: none *
  300. * *
  301. * HISTORY: *
  302. * 07/11/1996 JLB : Created. *
  303. *=============================================================================================*/
  304. static void Difficulty_Get(CCINIClass & ini, DifficultyClass & diff, char const * section)
  305. {
  306. if (ini.Is_Present(section)) {
  307. diff.FirepowerBias = ini.Get_Fixed(section, "FirePower", 1);
  308. diff.GroundspeedBias = ini.Get_Fixed(section, "Groundspeed", 1);
  309. diff.AirspeedBias = ini.Get_Fixed(section, "Airspeed", 1);
  310. diff.ArmorBias = ini.Get_Fixed(section, "Armor", 1);
  311. diff.ROFBias = ini.Get_Fixed(section, "ROF", 1);
  312. diff.CostBias = ini.Get_Fixed(section, "Cost", 1);
  313. diff.RepairDelay = ini.Get_Fixed(section, "RepairDelay", ".02");
  314. diff.BuildDelay = ini.Get_Fixed(section, "BuildDelay", ".03");
  315. diff.IsBuildSlowdown = ini.Get_Bool(section, "BuildSlowdown", false);
  316. diff.BuildSpeedBias = ini.Get_Fixed(section, "BuildTime", 1);
  317. diff.IsWallDestroyer = ini.Get_Bool(section, "DestroyWalls", true);
  318. diff.IsContentScan = ini.Get_Bool(section, "ContentScan", false);
  319. }
  320. }
  321. /***********************************************************************************************
  322. * RulesClass::Process -- Fetch the bulk of the rule data from the control file. *
  323. * *
  324. * This routine will fetch the rule data from the control file. *
  325. * *
  326. * INPUT: file -- Reference to the rule file to process. *
  327. * *
  328. * OUTPUT: bool; Was the rule file processed? *
  329. * *
  330. * WARNINGS: none *
  331. * *
  332. * HISTORY: *
  333. * 06/17/1996 JLB : Created. *
  334. *=============================================================================================*/
  335. bool RulesClass::Process(CCINIClass & ini)
  336. {
  337. BStart(BENCH_RULES);
  338. General(ini);
  339. MPlayer(ini);
  340. Recharge(ini);
  341. Heap_Maximums(ini);
  342. AI(ini);
  343. Powerups(ini);
  344. Land_Types(ini);
  345. Themes(ini);
  346. IQ(ini);
  347. Objects(ini);
  348. Difficulty(ini);
  349. BEnd(BENCH_RULES);
  350. return(true);
  351. }
  352. /***********************************************************************************************
  353. * RulesClass::General -- Process the general main game rules. *
  354. * *
  355. * This fetches the control constants uses for regular game processing. Any game behavior *
  356. * controlling values that don't properly fit in any of the other catagories will be *
  357. * stored here. *
  358. * *
  359. * INPUT: ini -- Reference to the database to fetch the values from. *
  360. * *
  361. * OUTPUT: bool; Was the general section found and processed? *
  362. * *
  363. * WARNINGS: none *
  364. * *
  365. * HISTORY: *
  366. * 08/08/1996 JLB : Created. *
  367. *=============================================================================================*/
  368. bool RulesClass::General(CCINIClass & ini)
  369. {
  370. static char const * const GENERAL = "General";
  371. #ifdef FIXIT_CSII // checked - ajw 9/28/98
  372. static char const * const AFTERMATH = "Aftermath";
  373. if(ini.Is_Present(AFTERMATH)) {
  374. //debugprint( "NewUnitsEnabled previously %i\n", NewUnitsEnabled );
  375. NewUnitsEnabled = ini.Get_Int(AFTERMATH, "NewUnitsEnabled", 0);
  376. //debugprint( "NewUnitsEnabled set to %i by Rules\n", NewUnitsEnabled );
  377. MTankDistance = ini.Get_Int(AFTERMATH,"MTankDistance",MTankDistance);
  378. QuakeUnitDamage = ini.Get_Fixed(AFTERMATH, "QuakeUnitDamage", QuakeUnitDamage);
  379. QuakeBuildingDamage = ini.Get_Fixed(AFTERMATH, "QuakeBuildingDamage", QuakeBuildingDamage);
  380. QuakeInfantryDamage = ini.Get_Int(AFTERMATH,"QuakeInfantryDamage",QuakeInfantryDamage);
  381. QuakeDelay = ini.Get_Int(AFTERMATH,"QuakeDelay",QuakeDelay);
  382. ChronoTankDuration = ini.Get_Fixed(AFTERMATH, "ChronoTankDuration", ChronoTankDuration);
  383. //Mono_Set_Cursor(0,0);Mono_Printf("Chrono duration: %08x \n",ChronoTankDuration);Keyboard->Get();Keyboard->Get();
  384. #ifdef FIXIT_CARRIER // checked - ajw 9/28/98
  385. CarrierLaunchDelay = ini.Get_Int(AFTERMATH,"CarrierLaunchDelay",120);
  386. #endif
  387. #ifdef FIXIT_ENGINEER // checked - ajw 9/28/98
  388. // Engineer changing fields were specifically left out of Aftrmath.ini, thus these values are not found to set. ajw
  389. // Implies interesting security hole if user creates a separate Aftrmath.ini file!
  390. EngineerDamage = ini.Get_Fixed(AFTERMATH, "EngineerDamage", EngineerDamage); // Amount of damage an engineer does
  391. EngineerCaptureLevel = ini.Get_Fixed(AFTERMATH, "EngineerCaptureLevel", EngineerCaptureLevel); // Building damage level before engineer can capture
  392. #endif
  393. }
  394. #endif
  395. if (ini.Is_Present(GENERAL)) {
  396. TurboBoost = ini.Get_Fixed(GENERAL, "TurboBoost", TurboBoost);
  397. BadgerBombCount = ini.Get_Int(GENERAL, "BadgerBombCount", BadgerBombCount);
  398. IsCurleyShuffle = ini.Get_Bool(GENERAL, "CurleyShuffle", IsCurleyShuffle);
  399. IsFlashLowPower = ini.Get_Bool(GENERAL, "FlashLowPower", IsFlashLowPower);
  400. IsChronoKill = ini.Get_Bool(GENERAL, "ChronoKillCargo", IsChronoKill);
  401. ChronoDuration = ini.Get_Fixed(GENERAL, "ChronoDuration", ChronoDuration);
  402. IsFineDifficulty = ini.Get_Bool(GENERAL, "FineDiffControl", IsFineDifficulty);
  403. WaterCrateChance = ini.Get_Fixed(GENERAL, "WaterCrateChance", WaterCrateChance);
  404. SoloCrateMoney = ini.Get_Int(GENERAL, "SoloCrateMoney", SoloCrateMoney);
  405. ParaBombTechLevel = ini.Get_Int(GENERAL, "ParabombTech", ParaBombTechLevel);
  406. GPSTechLevel = ini.Get_Int(GENERAL, "GPSTechLevel", GPSTechLevel);
  407. UnitCrateType = ini.Get_UnitType(GENERAL, "UnitCrateType", UnitCrateType);
  408. IsExplosiveHarvester = ini.Get_Fixed(GENERAL, "OreExplosive", IsExplosiveHarvester);
  409. GapRegenInterval = ini.Get_Fixed(GENERAL, "GapRegenInterval", GapRegenInterval);
  410. TeamDelay = ini.Get_Fixed(GENERAL, "TeamDelay", TeamDelay);
  411. CloakDelay = ini.Get_Fixed(GENERAL, "SubmergeDelay", CloakDelay);
  412. GameSpeedBias = ini.Get_Fixed(GENERAL, "GameSpeedBias", GameSpeedBias);
  413. NervousBias = ini.Get_Fixed(GENERAL, "BaseBias", NervousBias);
  414. ExplosionSpread = ini.Get_Fixed(GENERAL, "ExpSpread", ExplosionSpread);
  415. SupressRadius = ini.Get_Lepton(GENERAL, "FireSupress", SupressRadius);
  416. ParaInfantryTechLevel = ini.Get_Int(GENERAL, "ParaTech", ParaInfantryTechLevel);
  417. SpyPlaneTechLevel = ini.Get_Int(GENERAL, "SpyPlaneTech", SpyPlaneTechLevel);
  418. SilverCrate = ini.Get_CrateType(GENERAL, "SilverCrate", SilverCrate);
  419. WoodCrate = ini.Get_CrateType(GENERAL, "WoodCrate", WoodCrate);
  420. WaterCrate = ini.Get_CrateType(GENERAL, "WaterCrate", WaterCrate);
  421. CrateMinimum = ini.Get_Int(GENERAL, "CrateMinimum", CrateMinimum);
  422. CrateMaximum = ini.Get_Int(GENERAL, "CrateMaximum", CrateMaximum);
  423. IsScatter = ini.Get_Bool(GENERAL, "PlayerScatter", IsScatter);
  424. IsSmartDefense = ini.Get_Bool(GENERAL, "PlayerReturnFire", IsSmartDefense);
  425. IsAutoCrush = ini.Get_Bool(GENERAL, "PlayerAutoCrush", IsAutoCrush);
  426. IsNamed = ini.Get_Bool(GENERAL, "NamedCivilians", IsNamed);
  427. IsTGrowth = ini.Get_Bool(GENERAL, "OreGrows", IsTGrowth);
  428. IsTSpread = ini.Get_Bool(GENERAL, "OreSpreads", IsTSpread);
  429. IsMineAware = ini.Get_Bool(GENERAL, "MineAware", IsMineAware);
  430. IsTreeTarget = ini.Get_Bool(GENERAL, "TreeTargeting", IsTreeTarget);
  431. IsSeparate = ini.Get_Bool(GENERAL, "SeparateAircraft", IsSeparate);
  432. DropZoneRadius = ini.Get_Lepton(GENERAL, "DropZoneRadius", DropZoneRadius);
  433. MessageDelay = ini.Get_Fixed(GENERAL, "MessageDelay", MessageDelay);
  434. SavourDelay = ini.Get_Fixed(GENERAL, "SavourDelay", SavourDelay);
  435. AVMineDamage = ini.Get_Int(GENERAL, "AVMineDamage", AVMineDamage);
  436. APMineDamage = ini.Get_Int(GENERAL, "APMineDamage", APMineDamage);
  437. BaseDefenseDelay = ini.Get_Fixed(GENERAL, "BaseDefenseDelay", BaseDefenseDelay);
  438. SuspendPriority = ini.Get_Int(GENERAL, "SuspendPriority", SuspendPriority);
  439. SuspendDelay = ini.Get_Fixed(GENERAL, "SuspendDelay", SuspendDelay);
  440. SurvivorFraction = ini.Get_Fixed(GENERAL, "SurvivorRate", SurvivorFraction);
  441. RadarJamRadius = ini.Get_Lepton(GENERAL, "RadarJamRadius", RadarJamRadius);
  442. ReloadRate = ini.Get_Fixed(GENERAL, "ReloadRate", ReloadRate);
  443. RandomAnimateTime = ini.Get_Fixed(GENERAL, "IdleActionFrequency", RandomAnimateTime);
  444. BuildupTime = ini.Get_Fixed(GENERAL, "BuildupTime", BuildupTime);
  445. OreDumpRate = ini.Get_Int(GENERAL, "OreTruckRate", OreDumpRate);
  446. AtomDamage = ini.Get_Int(GENERAL, "AtomDamage", AtomDamage);
  447. BailCount = ini.Get_Int(GENERAL, "BailCount", BailCount);
  448. BallisticScatter = ini.Get_Lepton(GENERAL, "BallisticScatter", BallisticScatter);
  449. BridgeStrength = ini.Get_Int(GENERAL, "BridgeStrength", BridgeStrength);
  450. BuildSpeedBias = ini.Get_Fixed(GENERAL, "BuildSpeed", BuildSpeedBias);
  451. ConditionGreen = 1;
  452. ConditionRed = ini.Get_Fixed(GENERAL, "ConditionRed", ConditionRed);
  453. ConditionYellow = ini.Get_Fixed(GENERAL, "ConditionYellow", ConditionYellow);
  454. CrateRadius = ini.Get_Lepton(GENERAL, "CrateRadius", CrateRadius);
  455. CrushDistance = ini.Get_Lepton(GENERAL, "Crush", CrushDistance);
  456. DamageDelay = ini.Get_Fixed(GENERAL, "DamageDelay", DamageDelay);
  457. GapShroudRadius = ini.Get_Int(GENERAL, "GapRadius", GapShroudRadius);
  458. GemValue = ini.Get_Int(GENERAL, "GemValue", GemValue);
  459. GoldValue = ini.Get_Int(GENERAL, "GoldValue", GoldValue);
  460. Gravity = ini.Get_Int(GENERAL, "Gravity", Gravity);
  461. GrowthRate = ini.Get_Fixed(GENERAL, "GrowthRate", GrowthRate);
  462. HomingScatter = ini.Get_Lepton(GENERAL, "HomingScatter", HomingScatter);
  463. Incoming = ini.Get_MPHType(GENERAL, "Incoming", MPH_IMMOBILE);
  464. IronCurtainDuration = ini.Get_Fixed(GENERAL, "IronCurtain", IronCurtainDuration);
  465. IsAllyReveal = ini.Get_Bool(GENERAL, "AllyReveal", IsAllyReveal);
  466. IsHealthBar = ini.Get_Bool(GENERAL, "EnemyHealth", IsHealthBar);
  467. IsMCVDeploy = ini.Get_Bool(GENERAL, "MCVUndeploy", IsMCVDeploy);
  468. MaxDamage = ini.Get_Int(GENERAL, "MaxDamage", MaxDamage);
  469. MinDamage = ini.Get_Int(GENERAL, "MinDamage", MinDamage);
  470. ProneDamageBias = ini.Get_Fixed(GENERAL, "ProneDamage", ProneDamageBias);
  471. QuakeDamagePercent = ini.Get_Fixed(GENERAL, "QuakeDamage", QuakeDamagePercent);
  472. QuakeChance = ini.Get_Fixed(GENERAL, "QuakeChance", QuakeChance);
  473. RefundPercent = ini.Get_Fixed(GENERAL, "RefundPercent", RefundPercent);
  474. RepairPercent = ini.Get_Fixed(GENERAL, "RepairPercent", RepairPercent);
  475. RepairStep = ini.Get_Int(GENERAL, "RepairStep", RepairStep);
  476. URepairPercent = ini.Get_Fixed(GENERAL, "URepairPercent", URepairPercent);
  477. URepairStep = ini.Get_Int(GENERAL, "URepairStep", URepairStep);
  478. RepairRate = ini.Get_Fixed(GENERAL, "RepairRate", RepairRate);
  479. ShroudRate = ini.Get_Fixed(GENERAL, "ShroudRate", ShroudRate);
  480. SpeakDelay = ini.Get_Fixed(GENERAL, "SpeakDelay", SpeakDelay);
  481. StrayDistance = ini.Get_Lepton(GENERAL, "Stray", StrayDistance);
  482. CloseEnoughDistance = ini.Get_Lepton(GENERAL, "CloseEnough", CloseEnoughDistance);
  483. TimerWarning = ini.Get_Fixed(GENERAL, "TimerWarning", TimerWarning);
  484. MovieTime = ini.Get_Fixed(GENERAL, "MovieTime", MovieTime);
  485. C4Delay = ini.Get_Fixed(GENERAL, "C4Delay", C4Delay);
  486. ChronoTechLevel = ini.Get_Int(GENERAL, "ChronoTechLevel", ChronoTechLevel);
  487. CrateTime = ini.Get_Fixed(GENERAL, "CrateRegen", CrateTime);
  488. VortexRange = ini.Get_Lepton(GENERAL, "VortexRange", VortexRange);
  489. VortexSpeed = MPHType(_Scale_To_256(ini.Get_Int(GENERAL, "VortexSpeed", VortexSpeed)));
  490. VortexDamage = ini.Get_Int(GENERAL, "VortexDamage", VortexDamage);
  491. VortexChance = ini.Get_Fixed(GENERAL, "VortexChance", VortexChance);
  492. ChronalVortex.Set_Range(VortexRange / CELL_LEPTON_W);
  493. ChronalVortex.Set_Speed(VortexSpeed);
  494. ChronalVortex.Set_Damage(VortexDamage);
  495. //ChronalVortex.Set_Range ( ini.Get_Int (GENERAL, "VortexRange", ChronalVortex.Get_Range() ) );
  496. //ChronalVortex.Set_Speed ( ini.Get_Int (GENERAL, "VortexSpeed", ChronalVortex.Get_Speed() ) );
  497. //ChronalVortex.Set_Damage ( ini.Get_Int (GENERAL, "VortexDamage", ChronalVortex.Get_Damage() ) );
  498. return(true);
  499. }
  500. return(false);
  501. }
  502. /***********************************************************************************************
  503. * RulesClass::MPlayer -- Fetch and process the multiplayer default settings. *
  504. * *
  505. * This is used to set the default settings for the multiplayer system. *
  506. * *
  507. * INPUT: ini -- Reference to the INI database. *
  508. * *
  509. * OUTPUT: bool; Was the multiplayer default override section found and processed? *
  510. * *
  511. * WARNINGS: none *
  512. * *
  513. * HISTORY: *
  514. * 08/08/1996 JLB : Created. *
  515. *=============================================================================================*/
  516. bool RulesClass::MPlayer(CCINIClass & ini)
  517. {
  518. static char const * const MPLAYER = "MultiplayerDefaults";
  519. if (ini.Is_Present(MPLAYER)) {
  520. MPDefaultMoney = ini.Get_Int(MPLAYER, "Money", MPDefaultMoney);
  521. MPMaxMoney = ini.Get_Int(MPLAYER, "MaxMoney", MPMaxMoney);
  522. IsMPShadowGrow = ini.Get_Bool(MPLAYER, "ShadowGrow", IsMPShadowGrow);
  523. IsMPBasesOn = ini.Get_Bool(MPLAYER, "Bases", IsMPBasesOn);
  524. IsMPTiberiumGrow = ini.Get_Bool(MPLAYER, "OreGrows", IsMPTiberiumGrow);
  525. IsMPCrates = ini.Get_Bool(MPLAYER, "Crates", IsMPCrates);
  526. IsMPCaptureTheFlag = ini.Get_Bool(MPLAYER, "CaptureTheFlag", IsMPCaptureTheFlag);
  527. return(true);
  528. }
  529. return(false);
  530. }
  531. /***********************************************************************************************
  532. * RulesClass::Recharge -- Process the super weapon recharge statistics. *
  533. * *
  534. * Use this to set the recharge times for the various super weapons available. *
  535. * *
  536. * INPUT: ini -- Reference to the database. *
  537. * *
  538. * OUTPUT: bool; Was the recharge section found and processed? *
  539. * *
  540. * WARNINGS: none *
  541. * *
  542. * HISTORY: *
  543. * 08/08/1996 JLB : Created. *
  544. *=============================================================================================*/
  545. bool RulesClass::Recharge(CCINIClass & ini)
  546. {
  547. static char const * const RECHARGE = "Recharge";
  548. if (ini.Is_Present(RECHARGE)) {
  549. SonarTime = ini.Get_Fixed(RECHARGE, "Sonar", SonarTime);
  550. ChronoTime = ini.Get_Fixed(RECHARGE, "Chrono", ChronoTime);
  551. ParaBombTime = ini.Get_Fixed(RECHARGE, "ParaBomb", ParaBombTime);
  552. ParaInfantryTime = ini.Get_Fixed(RECHARGE, "Paratrooper", ParaInfantryTime);
  553. SpyTime = ini.Get_Fixed(RECHARGE, "SpyPlane", SpyTime);
  554. IronCurtainTime = ini.Get_Fixed(RECHARGE, "IronCurtain", IronCurtainTime);
  555. GPSTime = ini.Get_Fixed(RECHARGE, "GPS", GPSTime);
  556. NukeTime = ini.Get_Fixed(RECHARGE, "Nuke", NukeTime);
  557. return(true);
  558. }
  559. return(false);
  560. }
  561. /***********************************************************************************************
  562. * RulesClass::Heap_Maximums -- Fetch and process the heap override values. *
  563. * *
  564. * This fetches the maximum heap sizes from the database specified. The heaps will be *
  565. * initialized by this routine as indicated. *
  566. * *
  567. * INPUT: ini -- Reference to the INI database. *
  568. * *
  569. * OUTPUT: bool; Was the maximum section found and processed? *
  570. * *
  571. * WARNINGS: This process is catastrophic to any data currently existing in the heaps *
  572. * modified. This should only be processed during the game initialization stage. *
  573. * *
  574. * HISTORY: *
  575. * 08/08/1996 JLB : Created. *
  576. *=============================================================================================*/
  577. bool RulesClass::Heap_Maximums(CCINIClass & ini)
  578. {
  579. /*
  580. ** Heap maximum values.
  581. */
  582. static char const * const MAXIMUMS = "Maximums";
  583. if (ini.Is_Present(MAXIMUMS)) {
  584. MaxPlayers = ini.Get_Int(MAXIMUMS, "Players", MaxPlayers);
  585. AircraftMax = ini.Get_Int(MAXIMUMS, "Aircraft", AircraftMax);
  586. AnimMax = ini.Get_Int(MAXIMUMS, "Anim", AnimMax);
  587. BuildingMax = ini.Get_Int(MAXIMUMS, "Building", BuildingMax);
  588. BulletMax = ini.Get_Int(MAXIMUMS, "Bullet", BulletMax);
  589. FactoryMax = ini.Get_Int(MAXIMUMS, "Factory", FactoryMax);
  590. InfantryMax = ini.Get_Int(MAXIMUMS, "Infantry", InfantryMax);
  591. OverlayMax = ini.Get_Int(MAXIMUMS, "Overlay", OverlayMax);
  592. SmudgeMax = ini.Get_Int(MAXIMUMS, "Smudge", SmudgeMax);
  593. TeamMax = ini.Get_Int(MAXIMUMS, "Team", TeamMax);
  594. TeamTypeMax = ini.Get_Int(MAXIMUMS, "TeamType", TeamTypeMax);
  595. TemplateMax = ini.Get_Int(MAXIMUMS, "Template", TemplateMax);
  596. TerrainMax = ini.Get_Int(MAXIMUMS, "Terrain", TerrainMax);
  597. TriggerMax = ini.Get_Int(MAXIMUMS, "Trigger", TriggerMax);
  598. UnitMax = ini.Get_Int(MAXIMUMS, "Unit", UnitMax);
  599. VesselMax = ini.Get_Int(MAXIMUMS, "Vessel", VesselMax);
  600. ProjectileMax = ini.Get_Int(MAXIMUMS, "Projectile", ProjectileMax);
  601. WeaponMax = ini.Get_Int(MAXIMUMS, "Weapon", WeaponMax);
  602. WarheadMax = ini.Get_Int(MAXIMUMS, "Warhead", WarheadMax);
  603. TrigTypeMax = ini.Get_Int(MAXIMUMS, "TrigType", TrigTypeMax);
  604. }
  605. /*
  606. ** Any heaps that use the maximums that were just loaded, must
  607. ** be initialized as necessary.
  608. */
  609. Warheads.Set_Heap(WarheadMax);
  610. new WarheadTypeClass("SA");
  611. new WarheadTypeClass("HE");
  612. new WarheadTypeClass("AP");
  613. new WarheadTypeClass("Fire");
  614. new WarheadTypeClass("HollowPoint");
  615. new WarheadTypeClass("Super");
  616. new WarheadTypeClass("Organic");
  617. new WarheadTypeClass("Nuke");
  618. #ifdef FIXIT_CSII // checked - ajw 9/28/98
  619. new WarheadTypeClass("Mechanical");
  620. #endif
  621. Weapons.Set_Heap(WeaponMax);
  622. new WeaponTypeClass("Colt45");
  623. new WeaponTypeClass("ZSU-23");
  624. new WeaponTypeClass("Vulcan");
  625. new WeaponTypeClass("Maverick");
  626. new WeaponTypeClass("Camera");
  627. new WeaponTypeClass("FireballLauncher");
  628. new WeaponTypeClass("Sniper");
  629. new WeaponTypeClass("ChainGun");
  630. new WeaponTypeClass("Pistol");
  631. new WeaponTypeClass("M1Carbine");
  632. new WeaponTypeClass("Dragon");
  633. new WeaponTypeClass("Hellfire");
  634. new WeaponTypeClass("Grenade");
  635. new WeaponTypeClass("75mm");
  636. new WeaponTypeClass("90mm");
  637. new WeaponTypeClass("105mm");
  638. new WeaponTypeClass("120mm");
  639. new WeaponTypeClass("TurretGun");
  640. new WeaponTypeClass("MammothTusk");
  641. new WeaponTypeClass("155mm");
  642. new WeaponTypeClass("M60mg");
  643. new WeaponTypeClass("Napalm");
  644. new WeaponTypeClass("TeslaZap");
  645. new WeaponTypeClass("Nike");
  646. new WeaponTypeClass("8Inch");
  647. new WeaponTypeClass("Stinger");
  648. new WeaponTypeClass("TorpTube");
  649. new WeaponTypeClass("2Inch");
  650. new WeaponTypeClass("DepthCharge");
  651. new WeaponTypeClass("ParaBomb");
  652. new WeaponTypeClass("DogJaw");
  653. new WeaponTypeClass("Heal");
  654. new WeaponTypeClass("SCUD");
  655. new WeaponTypeClass("Flamer");
  656. new WeaponTypeClass("RedEye");
  657. #ifdef FIXIT_ANTS
  658. new WeaponTypeClass("Mandible");
  659. #endif
  660. #ifdef FIXIT_CSII // checked - ajw 9/28/98
  661. new WeaponTypeClass("PortaTesla");
  662. new WeaponTypeClass("GoodWrench");
  663. new WeaponTypeClass("SubSCUD");
  664. new WeaponTypeClass("TTankZap");
  665. new WeaponTypeClass("APTusk");
  666. new WeaponTypeClass("Democharge");
  667. #endif
  668. #ifdef FIXIT_CARRIER // checked - ajw 9/28/98
  669. new WeaponTypeClass("AirAssault");
  670. #endif
  671. return(true);
  672. }
  673. /***********************************************************************************************
  674. * RulesClass::AI -- Processes the AI control constants from the database. *
  675. * *
  676. * This will examine the database specified and set the AI override values accordingly. *
  677. * *
  678. * INPUT: ini -- Reference to the INI database that holds the AI overrides. *
  679. * *
  680. * OUTPUT: bool; Was the AI section found and processed? *
  681. * *
  682. * WARNINGS: none *
  683. * *
  684. * HISTORY: *
  685. * 08/08/1996 JLB : Created. *
  686. *=============================================================================================*/
  687. bool RulesClass::AI(CCINIClass & ini)
  688. {
  689. static char const * const AI = "AI";
  690. if (ini.Is_Present(AI)) {
  691. AttackInterval = ini.Get_Fixed(AI, "AttackInterval", AttackInterval);
  692. AttackDelay = ini.Get_Fixed(AI, "AttackDelay", AttackDelay);
  693. PatrolTime = ini.Get_Fixed(AI, "PatrolScan", PatrolTime);
  694. RepairThreshhold = ini.Get_Int(AI, "CreditReserve", RepairThreshhold);
  695. PathDelay = ini.Get_Fixed(AI, "PathDelay", PathDelay);
  696. TiberiumShortScan = ini.Get_Lepton(AI, "OreNearScan", TiberiumShortScan);
  697. TiberiumLongScan = ini.Get_Lepton(AI, "OreFarScan", TiberiumLongScan);
  698. AutocreateTime = ini.Get_Fixed(AI, "AutocreateTime", AutocreateTime);
  699. InfantryReserve = ini.Get_Int(AI, "InfantryReserve", InfantryReserve);
  700. InfantryBaseMult = ini.Get_Int(AI, "InfantryBaseMult", InfantryBaseMult);
  701. PowerSurplus = ini.Get_Int(AI, "PowerSurplus", PowerSurplus);
  702. BaseSizeAdd = ini.Get_Int(AI, "BaseSizeAdd", BaseSizeAdd);
  703. RefineryRatio = ini.Get_Fixed(AI, "RefineryRatio", RefineryRatio);
  704. RefineryLimit = ini.Get_Int(AI, "RefineryLimit", RefineryLimit);
  705. BarracksRatio = ini.Get_Fixed(AI, "BarracksRatio", BarracksRatio);
  706. BarracksLimit = ini.Get_Int(AI, "BarracksLimit", BarracksLimit);
  707. WarRatio = ini.Get_Fixed(AI, "WarRatio", WarRatio);
  708. WarLimit = ini.Get_Int(AI, "WarLimit", WarLimit);
  709. DefenseRatio = ini.Get_Fixed(AI, "DefenseRatio", DefenseRatio);
  710. DefenseLimit = ini.Get_Int(AI, "DefenseLimit", DefenseLimit);
  711. AARatio = ini.Get_Fixed(AI, "AARatio", AARatio);
  712. AALimit = ini.Get_Int(AI, "AALimit", AALimit);
  713. TeslaRatio = ini.Get_Fixed(AI, "TeslaRatio", TeslaRatio);
  714. TeslaLimit = ini.Get_Int(AI, "TeslaLimit", TeslaLimit);
  715. HelipadRatio = ini.Get_Fixed(AI, "HelipadRatio", HelipadRatio);
  716. HelipadLimit = ini.Get_Int(AI, "HelipadLimit", HelipadLimit);
  717. AirstripRatio = ini.Get_Fixed(AI, "AirstripRatio", AirstripRatio);
  718. AirstripLimit = ini.Get_Int(AI, "AirstripLimit", AirstripLimit);
  719. IsCompEasyBonus = ini.Get_Bool(AI, "CompEasyBonus", IsCompEasyBonus);
  720. IsComputerParanoid = ini.Get_Bool(AI, "Paranoid", IsComputerParanoid);
  721. PowerEmergencyFraction = ini.Get_Fixed(AI, "PowerEmergency", PowerEmergencyFraction);
  722. return(true);
  723. }
  724. return(false);
  725. }
  726. /***********************************************************************************************
  727. * RulesClass::Powerups -- Process the powerup values from the database. *
  728. * *
  729. * This will examine the database and initialize the powerup override values accordingly. *
  730. * *
  731. * INPUT: ini -- Reference to the INI database the the powerup values are to be *
  732. * initialized from. *
  733. * *
  734. * OUTPUT: bool; Was the powerup section found and processed? *
  735. * *
  736. * WARNINGS: none *
  737. * *
  738. * HISTORY: *
  739. * 08/08/1996 JLB : Created. *
  740. *=============================================================================================*/
  741. bool RulesClass::Powerups(CCINIClass & ini)
  742. {
  743. static char const * const POWERUPS = "Powerups";
  744. if (ini.Is_Present(POWERUPS)) {
  745. for (CrateType crate = CRATE_FIRST; crate < CRATE_COUNT; crate++) {
  746. char buffer[128];
  747. if (ini.Get_String(POWERUPS, CrateNames[crate], "0,NONE", buffer, sizeof(buffer))) {
  748. /*
  749. ** Share odds.
  750. */
  751. char * token = strtok(buffer, ",");
  752. if (token) {
  753. strtrim(token);
  754. CrateShares[crate] = atoi(token);
  755. }
  756. /*
  757. ** Animation to use.
  758. */
  759. token = strtok(NULL, ",");
  760. if (token) {
  761. strtrim(token);
  762. CrateAnims[crate] = Anim_From_Name(token);
  763. }
  764. /*
  765. ** Optional data number.
  766. */
  767. token = strtok(NULL, ",");
  768. if (token != NULL) {
  769. if (strpbrk(token, ".%") != NULL) {
  770. CrateData[crate] = fixed(token) * 256;
  771. } else {
  772. strtrim(token);
  773. CrateData[crate] = atoi(token);
  774. }
  775. }
  776. }
  777. }
  778. return(true);
  779. }
  780. return(false);
  781. }
  782. /***********************************************************************************************
  783. * RulesClass::Land_Types -- Inits the land type values. *
  784. * *
  785. * This will set the land movement attributes from the database specified. *
  786. * *
  787. * INPUT: ini -- Reference to the database that has the land value overrides. *
  788. * *
  789. * OUTPUT: bool; Was the land type sections found and processed? *
  790. * *
  791. * WARNINGS: none *
  792. * *
  793. * HISTORY: *
  794. * 08/08/1996 JLB : Created. *
  795. *=============================================================================================*/
  796. bool RulesClass::Land_Types(CCINIClass & ini)
  797. {
  798. /*
  799. ** Fetch the movement characteristic data for terrain types.
  800. */
  801. for (LandType land = LAND_FIRST; land < LAND_COUNT; land++) {
  802. static char const * _lands[LAND_COUNT] = {
  803. "Clear",
  804. "Road",
  805. "Water",
  806. "Rock",
  807. "Wall",
  808. "Ore",
  809. "Beach",
  810. "Rough",
  811. "River"
  812. };
  813. GroundType * gptr = &Ground[land];
  814. if (ini.Is_Present(_lands[land])) {
  815. gptr->Cost[SPEED_FOOT] = Sub_Saturate(ini.Get_Fixed(_lands[land], "Foot", 1), 1);
  816. gptr->Cost[SPEED_TRACK] = Sub_Saturate(ini.Get_Fixed(_lands[land], "Track", 1), 1);
  817. gptr->Cost[SPEED_WHEEL] = Sub_Saturate(ini.Get_Fixed(_lands[land], "Wheel", 1), 1);
  818. gptr->Cost[SPEED_WINGED] = Sub_Saturate(1, 1);
  819. gptr->Cost[SPEED_FLOAT] = Sub_Saturate(ini.Get_Fixed(_lands[land], "Float", 1), 1);
  820. gptr->Build = ini.Get_Bool(_lands[land], "Buildable", false);
  821. }
  822. }
  823. return(true);
  824. }
  825. /***********************************************************************************************
  826. * RulesClass::Themes -- Fetches the theme control values from the INI database. *
  827. * *
  828. * The musical theme availability is controlled by the scenario and the player's house *
  829. * choice. These controls can be specified in the theme control section of the INI *
  830. * database. *
  831. * *
  832. * INPUT: ini -- Reference to the INI database to process. *
  833. * *
  834. * OUTPUT: bool; Was the theme section found and processed? *
  835. * *
  836. * WARNINGS: none *
  837. * *
  838. * HISTORY: *
  839. * 08/11/1996 JLB : Created. *
  840. *=============================================================================================*/
  841. bool RulesClass::Themes(CCINIClass & ini)
  842. {
  843. static char const * const THEMECONTROL = "ThemeControl";
  844. if (ini.Is_Present(THEMECONTROL)) {
  845. for (ThemeType theme = THEME_FIRST; theme < THEME_COUNT; theme++) {
  846. if (ini.Is_Present(THEMECONTROL, Theme.Base_Name(theme))) {
  847. char buffer[128];
  848. int scen = 1;
  849. int owners = HOUSEF_ALLIES | HOUSEF_SOVIET | HOUSEF_OTHERS;
  850. ini.Get_String(THEMECONTROL, Theme.Base_Name(theme), "", buffer, sizeof(buffer));
  851. char const * token = strtok(buffer, ",");
  852. if (token != NULL) {
  853. scen = atoi(token);
  854. }
  855. token = strtok(NULL, ",");
  856. if (token != NULL) {
  857. owners = Owner_From_Name(token);
  858. }
  859. Theme.Set_Theme_Data(theme, scen, owners);
  860. }
  861. }
  862. return(true);
  863. }
  864. return(false);
  865. }
  866. /***********************************************************************************************
  867. * RulesClass::IQ -- Fetches the IQ control values from the INI database. *
  868. * *
  869. * This will scan the database specified and retrieve the IQ control values from it. These *
  870. * IQ control values are what gives the IQ rating meaning. It fundimentally controls how *
  871. * the computer behaves. *
  872. * *
  873. * INPUT: ini -- Reference to the INI database to read the IQ controls from. *
  874. * *
  875. * OUTPUT: bool; Was the IQ section found and processed? *
  876. * *
  877. * WARNINGS: none *
  878. * *
  879. * HISTORY: *
  880. * 08/11/1996 JLB : Created. *
  881. *=============================================================================================*/
  882. bool RulesClass::IQ(CCINIClass & ini)
  883. {
  884. static char const * const IQCONTROL = "IQ";
  885. if (ini.Is_Present(IQCONTROL)) {
  886. MaxIQ = ini.Get_Int(IQCONTROL, "MaxIQLevels", MaxIQ);
  887. IQSuperWeapons = ini.Get_Int(IQCONTROL, "SuperWeapons", IQSuperWeapons);
  888. IQProduction = ini.Get_Int(IQCONTROL, "Production", IQProduction);
  889. IQGuardArea = ini.Get_Int(IQCONTROL, "GuardArea", IQGuardArea);
  890. IQRepairSell = ini.Get_Int(IQCONTROL, "RepairSell", IQRepairSell);
  891. IQCrush = ini.Get_Int(IQCONTROL, "AutoCrush", IQCrush);
  892. IQScatter = ini.Get_Int(IQCONTROL, "Scatter", IQScatter);
  893. IQContentScan = ini.Get_Int(IQCONTROL, "ContentScan", IQContentScan);
  894. IQAircraft = ini.Get_Int(IQCONTROL, "Aircraft", IQAircraft);
  895. IQHarvester = ini.Get_Int(IQCONTROL, "Harvester", IQHarvester);
  896. IQSellBack = ini.Get_Int(IQCONTROL, "SellBack", IQSellBack);
  897. return(true);
  898. }
  899. return(false);
  900. }
  901. /***********************************************************************************************
  902. * RulesClass::Objects -- Fetch all the object characteristic values. *
  903. * *
  904. * This will parse the specified INI database and fetch all the object characteristic *
  905. * values specified therein. *
  906. * *
  907. * INPUT: ini -- Reference to the ini database to scan. *
  908. * *
  909. * OUTPUT: none *
  910. * *
  911. * WARNINGS: none *
  912. * *
  913. * HISTORY: *
  914. * 09/10/1996 JLB : Created. *
  915. *=============================================================================================*/
  916. bool RulesClass::Objects(CCINIClass & ini)
  917. {
  918. /*
  919. ** Fetch the game object values from the rules file.
  920. */
  921. for (int index = 0; index < Warheads.Count(); index++) {
  922. Warheads.Ptr(index)->Read_INI(ini);
  923. }
  924. for (int proj = 0; proj < BulletTypes.Count(); proj++) {
  925. BulletTypes.Ptr(proj)->Read_INI(ini);
  926. }
  927. for (int windex = 0; windex < Weapons.Count(); windex++) {
  928. Weapons.Ptr(windex)->Read_INI(ini);
  929. }
  930. for (int uindex = 0; uindex < UnitTypes.Count(); uindex++) {
  931. UnitTypes.Ptr(uindex)->Read_INI(ini);
  932. }
  933. for (int iindex = 0; iindex < InfantryTypes.Count(); iindex++) {
  934. InfantryTypes.Ptr(iindex)->Read_INI(ini);
  935. }
  936. for (int vindex = 0; vindex < VesselTypes.Count(); vindex++) {
  937. VesselTypes.Ptr(vindex)->Read_INI(ini);
  938. }
  939. for (int aindex = 0; aindex < AircraftTypes.Count(); aindex++) {
  940. AircraftTypes.Ptr(aindex)->Read_INI(ini);
  941. }
  942. for (int bindex = 0; bindex < BuildingTypes.Count(); bindex++) {
  943. BuildingTypes.Ptr(bindex)->Read_INI(ini);
  944. }
  945. /*
  946. ** Fetch the house attribute override values.
  947. */
  948. for (HousesType house = HOUSE_FIRST; house < HOUSE_COUNT; house++) {
  949. HouseTypeClass::As_Reference(house).Read_INI(ini);
  950. }
  951. /*
  952. ** Fetch the mission control values.
  953. */
  954. for (MissionType mission = MISSION_FIRST; mission < MISSION_COUNT; mission++) {
  955. MissionControlClass * miss = &MissionControl[mission];
  956. miss->Mission = mission;
  957. miss->Read_INI(ini);
  958. }
  959. return(true);
  960. }
  961. /***********************************************************************************************
  962. * RulesClass::Difficulty -- Fetch the various difficulty group settings. *
  963. * *
  964. * This routine is used to fetch the various group settings for the difficulty levels. *
  965. * *
  966. * INPUT: ini -- Reference to the INI database that has the difficulty setting values. *
  967. * *
  968. * OUTPUT: bool; Was the difficulty section found and processed. *
  969. * *
  970. * WARNINGS: none *
  971. * *
  972. * HISTORY: *
  973. * 09/10/1996 JLB : Created. *
  974. *=============================================================================================*/
  975. bool RulesClass::Difficulty(CCINIClass & ini)
  976. {
  977. Difficulty_Get(ini, Diff[DIFF_EASY], "Easy");
  978. Difficulty_Get(ini, Diff[DIFF_NORMAL], "Normal");
  979. Difficulty_Get(ini, Diff[DIFF_HARD], "Difficult");
  980. return(true);
  981. }