Skip to content

Commit fd9ac3a

Browse files
committed
Adjusted several uses of party functions
Changed the parameter for partyGetPtr to an int32_t. Removed conditional checks in getPartnerPointer, getFollowerPointer, removePartnerFromOverworld, and removeFollowerFromOverworld. This is because the functions that they call, partyGetPtr and partyKill2, already do the same conditional checks. Removed a conditional check in menufunctions.cpp before calling removeFollowerFromOverworld, for the same reason listed above. Used the proper variable type for partyEntry2Hello in menufunctions.cpp.
1 parent 7400d75 commit fd9ac3a

File tree

3 files changed

+11
-31
lines changed

3 files changed

+11
-31
lines changed

ttyd-tools/rel/include/ttyd/party.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ int32_t partyKill2(int32_t partyId);
9090
// partyPaperOff
9191
// partyPaperOn
9292
// anotherPartyGetPtr
93-
void *partyGetPtr(uint32_t partyId);
93+
void *partyGetPtr(int32_t partyId);
9494

9595
}
9696

ttyd-tools/rel/source/commonfunctions.cpp

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -224,41 +224,25 @@ int32_t getFollowerID()
224224
void *getPartnerPointer()
225225
{
226226
int32_t PartyID = getPartnerID();
227-
if (PartyID < 0)
228-
{
229-
return nullptr;
230-
}
231-
232227
return ttyd::party::partyGetPtr(PartyID);
233228
}
234229

235230
void *getFollowerPointer()
236231
{
237-
int32_t PartyID = getFollowerID();
238-
if (PartyID < 0)
239-
{
240-
return nullptr;
241-
}
242-
243-
return ttyd::party::partyGetPtr(PartyID);
232+
int32_t FollowerID = getFollowerID();
233+
return ttyd::party::partyGetPtr(FollowerID);
244234
}
245235

246236
void removePartnerFromOverworld()
247237
{
248238
int32_t PartyID = getPartnerID();
249-
if (PartyID >= 0)
250-
{
251-
ttyd::party::partyKill2(PartyID);
252-
}
239+
ttyd::party::partyKill2(PartyID);
253240
}
254241

255242
void removeFollowerFromOverworld()
256243
{
257-
int32_t PartyID = getFollowerID();
258-
if (PartyID >= 0)
259-
{
260-
ttyd::party::partyKill2(PartyID);
261-
}
244+
int32_t FollowerID = getFollowerID();
245+
ttyd::party::partyKill2(FollowerID);
262246
}
263247

264248
bool checkIfBadgeEquipped(int16_t badge)

ttyd-tools/rel/source/menufunctions.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,17 +1652,13 @@ uint32_t followersOptionsButtonControls()
16521652
{
16531653
if (checkIfInGame())
16541654
{
1655-
int32_t FollowerId = getFollowerID();
1656-
if (FollowerId >= 0)
1657-
{
1658-
// A follower is currently out, so remove it
1659-
removeFollowerFromOverworld();
1660-
}
1655+
// If a follower is out, remove them
1656+
removeFollowerFromOverworld();
16611657

1662-
// Spawn the new follower
1663-
uint32_t NewFollower = SecondaryMenuOption + 8; // Start at the egg
1658+
// Get the new follower
1659+
uint8_t NewFollower = SecondaryMenuOption + 8; // Start at the egg
16641660

1665-
// Spawn the follower
1661+
// Spawn the new follower
16661662
int32_t ReturnCode = ttyd::party::partyEntry2Hello(
16671663
static_cast<ttyd::party::PartyMembers>(NewFollower));
16681664

0 commit comments

Comments
 (0)