From 7128e9c3ac86cb9d6b3270de1f5e46793d343f23 Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 6 Jul 2020 13:11:05 -0700 Subject: [PATCH] Remove unnecessary string initializations from constructors std::string is one of those special types that has a constructor that just initializes itself to a blank state automatically. This means all `std::string`s are by default already `""`, so there's no need to set them. And in fact, cppcheck throws out warnings about performance due to initializing `std::string`s this way. --- desktop_version/src/BlockV.cpp | 2 -- desktop_version/src/Game.cpp | 8 -------- desktop_version/src/editor.cpp | 1 - 3 files changed, 11 deletions(-) diff --git a/desktop_version/src/BlockV.cpp b/desktop_version/src/BlockV.cpp index b5a73296..74e6a45c 100644 --- a/desktop_version/src/BlockV.cpp +++ b/desktop_version/src/BlockV.cpp @@ -14,8 +14,6 @@ blockclass::blockclass() rect.w = wp; rect.h = hp; - prompt = ""; - script = ""; r = 0; g = 0; b = 0; diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 0d0b25d5..eaea3380 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -140,7 +140,6 @@ void Game::init(void) roomchange = false; - teleportscript = ""; savemystats = false; quickrestartkludge = false; @@ -159,7 +158,6 @@ void Game::init(void) prev_act_fade = 0; backgroundtext = false; startscript = false; - newscript = ""; inintermission = false; alarmon = false; @@ -176,7 +174,6 @@ void Game::init(void) activetele = false; readytotele = 0; oldreadytotele = 0; - activity_lastprompt = ""; activity_r = 0; activity_g = 0; activity_b = 0; @@ -203,10 +200,6 @@ void Game::init(void) nodeathmode = false; nocutscenes = false; - for(int i=0; i<50; i++) - { - customscript[i]=""; - } customcol=0; SDL_memset(crewstats, false, sizeof(crewstats)); @@ -239,7 +232,6 @@ void Game::init(void) menucountdown = 0; levelpage=0; playcustomlevel=0; - customleveltitle=""; createmenu(Menu::mainmenu); deathcounts = 0; diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp index 8c7d50d5..074301d6 100644 --- a/desktop_version/src/editor.cpp +++ b/desktop_version/src/editor.cpp @@ -33,7 +33,6 @@ edlevelclass::edlevelclass() { tileset=0; tilecol=0; - roomname=""; warpdir=0; platx1=0; platy1=0;