Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ This page lists all the individual contributions to the project by their author.
- Fix an issue where units recruited by a team with `AreTeamMembersRecruitable=false` cannot be recruited even if they have been liberated by that team
- Global default value for `DefaultToGuardArea`
- Weapon range finding in cylinder
- Allow disable an over-optimization in targeting
- **solar-III (凤九歌)**
- Target scanning delay customization (documentation)
- Skip target scanning function calling for unarmed technos (documentation)
Expand Down
12 changes: 12 additions & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,18 @@ AllowAirstrike= ; boolean
AirstrikeTargets=buildings ; List of Affected Target Enumeration (none|infantry|units|buildings|all)
```

### Allow disable an over-optimization in targeting

- In vanilla, there is an optimization in targeting: if a unit finds a valid target within the 1/4 or 1/2 range, it will stop looking for other targets. Now you can disable it.
- This optimization has a negligible effect on average performance, as most targeting calls fail to find a valid target.
- At the same time, it can affect the gaming experience, as it will make units attack nearby targets while ignoring more threatening targets that are farther away.

In `rulesmd.ini`:
```ini
[General]
DisableOveroptimizationInTargeting=false ; boolean
```

### Alternate FLH customizations

- `AlternateFLH.OnTurret` can be used to customize whether or not `AlternateFLH` used for `OpenTopped` transport firing coordinates, multiple mind control link offsets etc. is calculated relative to the unit's turret if available or body.
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ Vanilla fixes:
- Fixed the issue where units recruited by a team with `AreTeamMembersRecruitable=false` cannot be recruited even if they have been liberated by that team (by TaranDahl)
- Fixed the bug that cause technos teleport to cell 0,0 by ChronoSphere superweapon (by NetsuNegi)
- Fixed the bug that techno in attack move will move to target if it cannot attack it (by NetsuNegi)
- [Allow disable an over-optimization in targeting](Fixed-or-Improved-Logics.md#allow-disable-an-over-optimization-in-targeting) (by TaranDahl)

Phobos fixes:
- Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi)
Expand Down
5 changes: 4 additions & 1 deletion src/Ext/Rules/Body.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "Body.h"
#include "Body.h"

#include <Ext/TechnoType/Body.h>
#include <New/Type/RadTypeClass.h>
Expand Down Expand Up @@ -364,6 +364,8 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI)

this->CylinderRangefinding.Read(exINI, GameStrings::General, "CylinderRangefinding");

this->DisableOveroptimizationInTargeting.Read(exINI, GameStrings::General, "DisableOveroptimizationInTargeting");

// Section AITargetTypes
int itemsCount = pINI->GetKeyCount("AITargetTypes");
for (int i = 0; i < itemsCount; ++i)
Expand Down Expand Up @@ -663,6 +665,7 @@ void RulesExt::ExtData::Serialize(T& Stm)
.Process(this->AIParadropMission)
.Process(this->DefaultToGuardArea)
.Process(this->CylinderRangefinding)
.Process(this->DisableOveroptimizationInTargeting)
;
}

Expand Down
2 changes: 2 additions & 0 deletions src/Ext/Rules/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ class RulesExt
Valueable<Mission> AIParadropMission;

Valueable<bool> DefaultToGuardArea;
Valueable<bool> DisableOveroptimizationInTargeting;

Valueable<bool> CylinderRangefinding;

Expand Down Expand Up @@ -570,6 +571,7 @@ class RulesExt
, DefaultToGuardArea { false }

, CylinderRangefinding { false }
, DisableOveroptimizationInTargeting { false }
{ }

virtual ~ExtData() = default;
Expand Down
6 changes: 6 additions & 0 deletions src/Ext/Techno/Hooks.Targeting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,9 @@ DEFINE_HOOK(0x6F7CE2, TechnoClass_CanAutoTargetObject_IronCurtain, 0x6)

return 0;
}

// WW adds an optimization that: If the techno get a target in 1/4 or 1/2 of their targeting range, then it will not checking other targets.
DEFINE_HOOK(0x6F9AF4, TechnoClass_SelectAutoTarget_DisableStupid, 0x6)
{
return RulesExt::Global()->DisableOveroptimizationInTargeting ? 0x6F9B1B : 0;
}