@@ -151,6 +151,37 @@ void TechnoTypeExt::ExtData::ParseBurstFLHs(INI_EX& exArtINI, const char* pArtSe
151
151
}
152
152
}
153
153
154
+ void TechnoTypeExt::ExtData::CalculateSpawnerRange ()
155
+ {
156
+ const auto pTechnoType = this ->OwnerObject ();
157
+ const int weaponRangeExtra = this ->Spawner_ExtraLimitRange * Unsorted::LeptonsPerCell;
158
+
159
+ auto setWeaponRange = [](int & weaponRange, WeaponTypeClass* pWeaponType)
160
+ {
161
+ if (pWeaponType && pWeaponType->Spawner && pWeaponType->Range > weaponRange)
162
+ weaponRange = pWeaponType->Range ;
163
+ };
164
+
165
+ if (pTechnoType->IsGattling )
166
+ {
167
+ for (int i = 0 ; i < pTechnoType->WeaponCount ; i++)
168
+ {
169
+ setWeaponRange (this ->SpawnerRange , pTechnoType->Weapon [i].WeaponType );
170
+ setWeaponRange (this ->EliteSpawnerRange , pTechnoType->EliteWeapon [i].WeaponType );
171
+ }
172
+ }
173
+ else
174
+ {
175
+ setWeaponRange (this ->SpawnerRange , pTechnoType->Weapon [0 ].WeaponType );
176
+ setWeaponRange (this ->SpawnerRange , pTechnoType->Weapon [1 ].WeaponType );
177
+ setWeaponRange (this ->EliteSpawnerRange , pTechnoType->EliteWeapon [0 ].WeaponType );
178
+ setWeaponRange (this ->EliteSpawnerRange , pTechnoType->EliteWeapon [1 ].WeaponType );
179
+ }
180
+
181
+ this ->SpawnerRange += weaponRangeExtra;
182
+ this ->EliteSpawnerRange += weaponRangeExtra;
183
+ }
184
+
154
185
// TODO: YRpp this with proper casting
155
186
TechnoTypeClass* TechnoTypeExt::GetTechnoType (ObjectTypeClass* pType)
156
187
{
@@ -757,6 +788,10 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
757
788
}
758
789
}
759
790
791
+ // Spawner range
792
+ if (this ->Spawner_LimitRange )
793
+ this ->CalculateSpawnerRange ();
794
+
760
795
// Art tags
761
796
INI_EX exArtINI (CCINIClass::INI_Art);
762
797
auto pArtSection = pThis->ImageFile ;
@@ -932,7 +967,9 @@ void TechnoTypeExt::ExtData::Serialize(T& Stm)
932
967
.Process (this ->ShadowIndices )
933
968
.Process (this ->ShadowIndex_Frame )
934
969
.Process (this ->Spawner_LimitRange )
935
- .Process (this ->Spawner_ExtraLimitRange )
970
+ // .Process(this->Spawner_ExtraLimitRange)
971
+ .Process (this ->SpawnerRange )
972
+ .Process (this ->EliteSpawnerRange )
936
973
.Process (this ->Spawner_DelayFrames )
937
974
.Process (this ->Spawner_AttackImmediately )
938
975
.Process (this ->Spawner_UseTurretFacing )
0 commit comments