Skip to content

Commit 8fab0a8

Browse files
committed
Implements MultipleFactoryCap for RulesClass.
1 parent 83905e3 commit 8fab0a8

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/extensions/rules/rulesext.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ RulesClassExtension::RulesClassExtension(const RulesClass *this_ptr) :
7474
IsMPPrePlacedConYards(false),
7575
IsBuildOffAlly(true),
7676
IsShowSuperWeaponTimers(true),
77-
LowPowerPenaltyModifier(1.0f)
77+
LowPowerPenaltyModifier(1.0f),
78+
MultipleFactoryCap(0)
7879
{
7980
//if (this_ptr) EXT_DEBUG_TRACE("RulesClassExtension::RulesClassExtension - 0x%08X\n", (uintptr_t)(ThisPtr));
8081

@@ -440,13 +441,15 @@ bool RulesClassExtension::AudioVisual(CCINIClass &ini)
440441
{
441442
//EXT_DEBUG_TRACE("RulesClassExtension::General - 0x%08X\n", (uintptr_t)(This()));
442443

444+
static char const * const GENERAL = "General";
443445
static char const * const AUDIOVISUAL = "AudioVisual";
444446

445447
if (!ini.Is_Present(AUDIOVISUAL)) {
446448
return false;
447449
}
448450

449451
IsShowSuperWeaponTimers = ini.Get_Bool(AUDIOVISUAL, "ShowSuperWeaponTimers", IsShowSuperWeaponTimers);
452+
MultipleFactoryCap = ini.Get_Int(GENERAL, "MultipleFactoryCap", MultipleFactoryCap);
450453

451454
return true;
452455
}

src/extensions/rules/rulesext.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,10 @@ class RulesClassExtension final : public GlobalExtensionClass<RulesClass>
9696
* units you are short of to get the actual penalty to the build speed.
9797
*/
9898
float LowPowerPenaltyModifier;
99+
100+
/**
101+
* The maximum number of factories that can be considered when calculating
102+
* the multiple factory bonus on an object's build time.
103+
*/
104+
int MultipleFactoryCap;
99105
};

src/extensions/techno/technoext.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,20 @@ int TechnoClassExtension::Time_To_Build() const
414414
* @author: CCHyper
415415
*/
416416
if (Rule->MultipleFactory > 0.0 && (divisor-1) > 0) {
417+
418+
/**
419+
* #issue-659
420+
*
421+
* Implements MultipleFactoryCap for RulesClass.
422+
*
423+
* @author: CCHyper
424+
*/
425+
if (RuleExtension->MultipleFactoryCap > 0) {
426+
divisor = RuleExtension->MultipleFactoryCap;
427+
}
428+
429+
divisor = (divisor-1);
430+
417431
while (divisor) {
418432
time *= Rule->MultipleFactory;
419433
--divisor;

0 commit comments

Comments
 (0)