Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Followerslots with EF_FollowerList - FIX #1251 #1252

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 10 additions & 2 deletions src/game/chars/CCharUse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1209,10 +1209,18 @@ bool CChar::FollowersUpdate( CChar * pChar, short iFollowerSlots, bool fCheckOnl
++it;
}

if (!fExists && ((short)(m_followers.size()) < iMaxFollower || IsPriv(PRIV_GM)))
if (!fExists && ((short)(m_followers.size()) + iFollowerSlots <= iMaxFollower || IsPriv(PRIV_GM)))
{
if (!fCheckOnly)
m_followers.emplace_back(pChar->GetUID());
{
for (short i = 0; i < iFollowerSlots; ++i)
{
m_followers.emplace_back(pChar->GetUID());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do that better, by making m_followers a vector of std::pair<ushort, CUID>, where the first number is the followerslots, value the second the UID.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try, but I think Im not capable of doing that. Wouldnt that need more complex changes in the whole code?

Copy link
Author

@AtillaG1 AtillaG1 Jun 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose its defined as CUID already
std::vector<CUID> m_followers; which means we would have to review every code where is it used? If we change it to std::vector<std::pair<ushort, CUID>> m_followers; ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im sorry im not able to do that, I guess if we change the def of the vector, we need to change every part where the FollowersUpdate is called/used, and even with the AI help, I couldnt make it work. 😥
Anyone ideas or more experience?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will take care of it, we'll need to change other code to make it working but it will be worth it.

}
short iCurFollower = (short)(GetDefNum("CURFOLLOWER", true));
iCurFollower += iFollowerSlots;
SetDefNum("CURFOLLOWER", maximum(iCurFollower, 0));
}
}
else
return false;
Expand Down
Loading