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

Erase rf::local_player from g_player_additional_data_map upon leaving server. #317

Merged
merged 5 commits into from
Dec 10, 2024
Merged
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions game_patch/multi/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,10 @@ FunHook<void()> multi_stop_hook{
// Clear server info when leaving
g_df_server_info.reset();
multi_stop_hook.call_target();
if (rf::local_player) {
extern std::unordered_map<rf::Player*, PlayerAdditionalData> g_player_additional_data_map;
Copy link
Owner

Choose a reason for hiding this comment

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

I don't really like this way of accessing this variable. It wasn't intended to be public.
Could you add in player.cpp a function which removes the player from the map? e.g. remove/reset_player_additional_data(Player*)

g_player_additional_data_map.erase(rf::local_player);
}
},
};

Expand Down