mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix clang-tidy modernize-use-emplace
This commit is contained in:
parent
cc5ae51cb6
commit
b81fb37f82
|
@ -4564,15 +4564,15 @@ int main(int argc, const char **argv)
|
|||
|
||||
const bool RandInitFailed = secure_random_init() != 0;
|
||||
if(!RandInitFailed)
|
||||
CleanerFunctions.push([]() { secure_random_uninit(); });
|
||||
CleanerFunctions.emplace([]() { secure_random_uninit(); });
|
||||
|
||||
NotificationsInit();
|
||||
CleanerFunctions.push([]() { NotificationsUninit(); });
|
||||
CleanerFunctions.emplace([]() { NotificationsUninit(); });
|
||||
|
||||
// Register SDL for cleanup before creating the kernel and client,
|
||||
// so SDL is shutdown after kernel and client. Otherwise the client
|
||||
// may crash when shutting down after SDL is already shutdown.
|
||||
CleanerFunctions.push([]() { SDL_Quit(); });
|
||||
CleanerFunctions.emplace([]() { SDL_Quit(); });
|
||||
|
||||
CClient *pClient = CreateClient();
|
||||
pClient->SetLoggers(pFutureFileLogger, std::move(pStdoutLogger));
|
||||
|
@ -4580,7 +4580,7 @@ int main(int argc, const char **argv)
|
|||
IKernel *pKernel = IKernel::Create();
|
||||
pKernel->RegisterInterface(pClient, false);
|
||||
pClient->RegisterInterfaces();
|
||||
CleanerFunctions.push([pKernel, pClient]() {
|
||||
CleanerFunctions.emplace([pKernel, pClient]() {
|
||||
pKernel->Shutdown();
|
||||
delete pKernel;
|
||||
pClient->~CClient();
|
||||
|
@ -4648,7 +4648,7 @@ int main(int argc, const char **argv)
|
|||
|
||||
RegisterFail = RegisterFail || !pKernel->RegisterInterface(pEngine, false);
|
||||
|
||||
CleanerFunctions.push([pEngine]() {
|
||||
CleanerFunctions.emplace([pEngine]() {
|
||||
// Has to be before destroying graphics so that skin download thread can finish
|
||||
delete pEngine;
|
||||
});
|
||||
|
|
|
@ -167,7 +167,7 @@ void CJsonWriter::PushState(EJsonStateKind NewState)
|
|||
{
|
||||
m_States.top().m_Empty = false;
|
||||
}
|
||||
m_States.push(SState(NewState));
|
||||
m_States.emplace(NewState);
|
||||
if(NewState != STATE_ATTRIBUTE)
|
||||
{
|
||||
m_Indentation++;
|
||||
|
|
|
@ -234,13 +234,11 @@ void CGameControllerDDRace::InitTeleporter()
|
|||
{
|
||||
if(Type == TILE_TELEOUT)
|
||||
{
|
||||
m_TeleOuts[Number - 1].push_back(
|
||||
vec2(i % Width * 32 + 16, i / Width * 32 + 16));
|
||||
m_TeleOuts[Number - 1].emplace_back(i % Width * 32.0f + 16.0f, i / Width * 32.0f + 16.0f);
|
||||
}
|
||||
else if(Type == TILE_TELECHECKOUT)
|
||||
{
|
||||
m_TeleCheckOuts[Number - 1].push_back(
|
||||
vec2(i % Width * 32 + 16, i / Width * 32 + 16));
|
||||
m_TeleCheckOuts[Number - 1].emplace_back(i % Width * 32.0f + 16.0f, i / Width * 32.0f + 16.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue