fix issue with group name string ids after loading new map

This commit is contained in:
zsilencer 2016-01-24 18:33:28 -07:00
parent 4ff3c11366
commit 74225ad4bc
3 changed files with 16 additions and 0 deletions

View file

@ -904,6 +904,7 @@ bool game_load_save(const utf8 *path)
if (result) {
game_load_init();
network_free_string_ids();
if (network_get_mode() == NETWORK_MODE_SERVER) {
network_send_map();
}

View file

@ -1239,6 +1239,13 @@ void Network::LoadGroups()
SDL_RWclose(file);
}
void Network::FreeStringIds()
{
for (auto it = group_list.begin(); it != group_list.end(); it++) {
(*it)->FreeNameStringId();
}
}
void Network::Client_Send_AUTH(const char* name, const char* password)
{
std::unique_ptr<NetworkPacket> packet = std::move(NetworkPacket::Allocate());
@ -2270,6 +2277,11 @@ int network_can_perform_action(unsigned int groupindex, unsigned int index)
return gNetwork.group_list[groupindex]->CanPerformAction(index);
}
void network_free_string_ids()
{
gNetwork.FreeStringIds();
}
void network_send_map()
{
gNetwork.Server_Send_MAP();
@ -2347,6 +2359,7 @@ uint8 network_get_default_group() { return 0; }
int network_get_num_actions() { return 0; }
rct_string_id network_get_action_name_string_id(unsigned int index) { return -1; }
int network_can_perform_action(unsigned int groupindex, unsigned int index) { return 0; }
void network_free_string_ids() {}
void network_send_chat(const char* text) {}
void network_send_password(const char* password) {}
void network_close() {}

View file

@ -306,6 +306,7 @@ public:
void SetDefaultGroup(uint8 id);
void SaveGroups();
void LoadGroups();
void FreeStringIds();
void Client_Send_AUTH(const char* name, const char* password);
void Server_Send_AUTH(NetworkConnection& connection);
@ -445,6 +446,7 @@ uint8 network_get_default_group();
int network_get_num_actions();
rct_string_id network_get_action_name_string_id(unsigned int index);
int network_can_perform_action(unsigned int groupindex, unsigned int index);
void network_free_string_ids();
void network_send_map();
void network_send_chat(const char* text);