Skip to content

Commit 36a3b56

Browse files
authored
[Phobos bug] Map Events 600 Bug Fixes (#1660)
I don't know how to describe it, but the map event 600 is easily activated when the attached object does not have a shield and is selected and attacked. Interestingly, this issue was also present in **Build 30** when it was originally created.
1 parent 41c191b commit 36a3b56

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

CREDITS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ This page lists all the individual contributions to the project by their author.
356356
- `Set Force Enemy` Trigger Action
357357
- Fix the issue where computer players did not search for new enemies after defeating them or forming alliances with them
358358
- Customize the damage taken when falling from a bridge
359+
- `600 The shield of the attached object is broken` bug fix for the triggered event
359360
- **NetsuNegi**:
360361
- Forbidding parallel AI queues by type
361362
- Jumpjet crash speed fix when crashing onto building

docs/Whats-New.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ Vanilla fixes:
398398
399399
Phobos fixes:
400400
- Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi)
401+
- `600 The shield of the attached object is broken` bug fix for the triggered event (by FlyStar)
401402
402403
Fixes / interactions with other extensions:
403404
- Allowed `AuxBuilding` and Ares' `SW.Aux/NegBuildings` to count building upgrades (by Ollerus)

src/Ext/TEvent/Body.cpp

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ bool TEventExt::Execute(TEventClass* pThis, int iEvent, HouseClass* pHouse, Obje
3737
CDTimerClass* pTimer, bool* isPersitant, TechnoClass* pSource, bool& bHandled)
3838
{
3939
bHandled = true;
40-
switch (static_cast<PhobosTriggerEvent>(pThis->EventKind))
40+
const auto eventKind = static_cast<PhobosTriggerEvent>(pThis->EventKind);
41+
42+
switch (eventKind)
4143
{
4244
// helper struct
4345
struct and_with { bool operator()(int a, int b) { return a & b; } };
@@ -117,8 +119,6 @@ bool TEventExt::Execute(TEventClass* pThis, int iEvent, HouseClass* pHouse, Obje
117119
case PhobosTriggerEvent::GlobalVariableAndIsTrueGlobalVariable:
118120
return TEventExt::VariableCheckBinary<true, true, and_with>(pThis);
119121

120-
case PhobosTriggerEvent::ShieldBroken:
121-
return ShieldClass::ShieldIsBrokenTEvent(pObject);
122122
case PhobosTriggerEvent::HouseOwnsTechnoType:
123123
return TEventExt::HouseOwnsTechnoTypeTEvent(pThis);
124124
case PhobosTriggerEvent::HouseDoesntOwnTechnoType:
@@ -128,6 +128,27 @@ bool TEventExt::Execute(TEventClass* pThis, int iEvent, HouseClass* pHouse, Obje
128128
case PhobosTriggerEvent::CellHasAnyTechnoTypeFromList:
129129
return TEventExt::CellHasAnyTechnoTypeFromListTEvent(pThis, pObject, pHouse);
130130

131+
// If it requires an additional object as like mapping events 7 or 48, please fill it in here.
132+
// case PhobosTriggerEvent::SomeTriggerAttachedToObject:
133+
case PhobosTriggerEvent::ShieldBroken:
134+
// They must be the same.
135+
if (eventKind == static_cast<PhobosTriggerEvent>(iEvent))
136+
{
137+
switch (eventKind)
138+
{
139+
// SomeTriggerAttachedToObject needs to be restricted to situations where ...
140+
// case PhobosTriggerEvent::SomeTriggerAttachedToObject:
141+
// return ...::ThisAttachedToObjectTEvent(pObject, ...);
142+
143+
// ShieldBroken needs to be restricted to situations where the shield is being attacked.
144+
case PhobosTriggerEvent::ShieldBroken:
145+
return ShieldClass::ShieldIsBrokenTEvent(pObject);
146+
147+
default:
148+
break;
149+
}
150+
}
151+
131152
default:
132153
bHandled = false;
133154
return true;

0 commit comments

Comments
 (0)