NetPlayClient/NetPlayServer: Remove now-unnecessary static_casts
Now that we have the enum helpers in place, quite a few casts on their own can be removed.
This commit is contained in:
parent
80b4a4d7fd
commit
3840b55292
|
@ -784,10 +784,7 @@ void NetPlayClient::OnGameStatus(sf::Packet& packet)
|
|||
|
||||
{
|
||||
std::lock_guard lkp(m_crit.players);
|
||||
Player& player = m_players[pid];
|
||||
u32 status;
|
||||
packet >> status;
|
||||
player.game_status = static_cast<SyncIdentifierComparison>(status);
|
||||
packet >> m_players[pid].game_status;
|
||||
}
|
||||
|
||||
m_dialog->Update();
|
||||
|
@ -797,19 +794,12 @@ void NetPlayClient::OnStartGame(sf::Packet& packet)
|
|||
{
|
||||
{
|
||||
std::lock_guard lkg(m_crit.game);
|
||||
packet >> m_current_game;
|
||||
packet >> m_net_settings.m_CPUthread;
|
||||
|
||||
INFO_LOG_FMT(NETPLAY, "Start of game {}", m_selected_game.game_id);
|
||||
|
||||
{
|
||||
std::underlying_type_t<PowerPC::CPUCore> core;
|
||||
if (packet >> core)
|
||||
m_net_settings.m_CPUcore = static_cast<PowerPC::CPUCore>(core);
|
||||
else
|
||||
m_net_settings.m_CPUcore = PowerPC::CPUCore::CachedInterpreter;
|
||||
}
|
||||
|
||||
packet >> m_current_game;
|
||||
packet >> m_net_settings.m_CPUthread;
|
||||
packet >> m_net_settings.m_CPUcore;
|
||||
packet >> m_net_settings.m_EnableCheats;
|
||||
packet >> m_net_settings.m_SelectedLanguage;
|
||||
packet >> m_net_settings.m_OverrideRegionSettings;
|
||||
|
@ -819,24 +809,14 @@ void NetPlayClient::OnStartGame(sf::Packet& packet)
|
|||
packet >> m_net_settings.m_RAMOverrideEnable;
|
||||
packet >> m_net_settings.m_Mem1Size;
|
||||
packet >> m_net_settings.m_Mem2Size;
|
||||
|
||||
{
|
||||
std::underlying_type_t<DiscIO::Region> tmp;
|
||||
packet >> tmp;
|
||||
m_net_settings.m_FallbackRegion = static_cast<DiscIO::Region>(tmp);
|
||||
}
|
||||
|
||||
packet >> m_net_settings.m_FallbackRegion;
|
||||
packet >> m_net_settings.m_AllowSDWrites;
|
||||
packet >> m_net_settings.m_CopyWiiSave;
|
||||
packet >> m_net_settings.m_OCEnable;
|
||||
packet >> m_net_settings.m_OCFactor;
|
||||
|
||||
for (auto& device : m_net_settings.m_EXIDevice)
|
||||
{
|
||||
int tmp;
|
||||
packet >> tmp;
|
||||
device = static_cast<ExpansionInterface::TEXIDevices>(tmp);
|
||||
}
|
||||
packet >> device;
|
||||
|
||||
for (u32& value : m_net_settings.m_SYSCONFSettings)
|
||||
packet >> value;
|
||||
|
@ -1183,11 +1163,7 @@ void NetPlayClient::OnSyncSaveDataWii(sf::Packet& packet)
|
|||
{
|
||||
WiiSave::Storage::SaveFile file;
|
||||
packet >> file.mode >> file.attributes;
|
||||
{
|
||||
u8 tmp;
|
||||
packet >> tmp;
|
||||
file.type = static_cast<WiiSave::Storage::SaveFile::Type>(tmp);
|
||||
}
|
||||
packet >> file.type;
|
||||
packet >> file.path;
|
||||
|
||||
if (file.type == WiiSave::Storage::SaveFile::Type::File)
|
||||
|
|
|
@ -472,7 +472,7 @@ ConnectionError NetPlayServer::OnConnect(ENetPeer* socket, sf::Packet& rpac)
|
|||
|
||||
spac.clear();
|
||||
spac << MessageID::GameStatus;
|
||||
spac << p.second.pid << static_cast<u32>(p.second.game_status);
|
||||
spac << p.second.pid << p.second.game_status;
|
||||
Send(player.socket, spac);
|
||||
}
|
||||
|
||||
|
@ -986,10 +986,10 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player)
|
|||
|
||||
case MessageID::GameStatus:
|
||||
{
|
||||
u32 status;
|
||||
SyncIdentifierComparison status;
|
||||
packet >> status;
|
||||
|
||||
m_players[player.pid].game_status = static_cast<SyncIdentifierComparison>(status);
|
||||
m_players[player.pid].game_status = status;
|
||||
|
||||
// send msg to other clients
|
||||
sf::Packet spac;
|
||||
|
@ -1473,7 +1473,7 @@ bool NetPlayServer::StartGame()
|
|||
spac << MessageID::StartGame;
|
||||
spac << m_current_game;
|
||||
spac << m_settings.m_CPUthread;
|
||||
spac << static_cast<std::underlying_type_t<PowerPC::CPUCore>>(m_settings.m_CPUcore);
|
||||
spac << m_settings.m_CPUcore;
|
||||
spac << m_settings.m_EnableCheats;
|
||||
spac << m_settings.m_SelectedLanguage;
|
||||
spac << m_settings.m_OverrideRegionSettings;
|
||||
|
@ -1483,7 +1483,7 @@ bool NetPlayServer::StartGame()
|
|||
spac << m_settings.m_RAMOverrideEnable;
|
||||
spac << m_settings.m_Mem1Size;
|
||||
spac << m_settings.m_Mem2Size;
|
||||
spac << static_cast<std::underlying_type_t<DiscIO::Region>>(m_settings.m_FallbackRegion);
|
||||
spac << m_settings.m_FallbackRegion;
|
||||
spac << m_settings.m_AllowSDWrites;
|
||||
spac << m_settings.m_CopyWiiSave;
|
||||
spac << m_settings.m_OCEnable;
|
||||
|
@ -1797,7 +1797,7 @@ bool NetPlayServer::SyncSaveData()
|
|||
// Files
|
||||
for (const WiiSave::Storage::SaveFile& file : *files)
|
||||
{
|
||||
pac << file.mode << file.attributes << static_cast<u8>(file.type) << file.path;
|
||||
pac << file.mode << file.attributes << file.type << file.path;
|
||||
|
||||
if (file.type == WiiSave::Storage::SaveFile::Type::File)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue