You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// PR #746: [QOL] Trigger owner can set as player of multiplayer game map.DEFINE_HOOK(0x7272B5, TriggerTypeClass_FillIn_HouseType, 0x6)
{
GET(int, nIndex, EAX);
// Only if the house wasn't foundif (nIndex == -1)
{
GET(constchar*, pString, ECX);
nIndex = HouseClass::GetPlayerAtFromString(pString);
if (nIndex == -1)
{
nIndex = atoi(pString);
if (nIndex == -1)
nIndex = 0; // process it like <none>
}
if (HouseClass::IsPlayerAtType(nIndex))
{
if (auto pHouse = HouseClass::FindByPlayerAt(nIndex))
nIndex = pHouse->Type->ArrayIndex;
}
else
nIndex = 0;
R->EAX(nIndex);
}
return0;
}
// PR #746: [QOL] Trigger owner can set as player of multiplayer game map.DEFINE_HOOK(0x7272B5, TriggerTypeClass_FillIn_HouseType, 0x6)
{
GET(int, nIndex, EAX);
// Only if the house wasn't foundif (nIndex == -1)
{
GET(constchar*, pString, ECX);
nIndex = HouseClass::GetPlayerAtFromString(pString);
if (nIndex == -1)
{
nIndex = atoi(pString);
if (nIndex == -1)
nIndex = 0; // process it like <none>
}
if (HouseClass::IsPlayerAtType(nIndex))
{
if (auto pHouse = HouseClass::FindByPlayerAt(nIndex))
nIndex = pHouse->Type->ArrayIndex;
}
else
nIndex = 0;
R->EAX(nIndex);
}
return0;
}
I don't quite understand this method. Two players from the same country can only find the first player to select this country through HouseClass:: FindByCountryIndex, so I need to establish a corresponding relationship between TriggerType and Player. The TriggerType's member is HouseTypeClass*, and it is not sure which player it is. Unless I directly assign an MP reference like 4475 to this pointer, although this can be achieved, it seems that it is not a good practice to assign integer values to pointer types.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In a multiplayer map, set trigger owner as '4475'-'4482' is
player@A-player@G. If player nonexist, trigger will be desotroyed.