Skip to content

Commit 465ca1d

Browse files
committed
Revert "Various style fixed found using cppcheck"
This reverts commit 2513e84.
1 parent edce029 commit 465ca1d

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

src/editor/editor.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -842,10 +842,13 @@ Editor::check_save_prerequisites(const std::function<void ()>& callback) const
842842
if (sector->get_name() == "main")
843843
{
844844
sector_valid = true;
845-
const auto& spawnpoints = sector->get_objects_by_type<SpawnPointMarker>();
846-
spawnpoint_valid = std::any_of(spawnpoints.begin(), spawnpoints.end(), [](const auto& spawnpoint) {
847-
return spawnpoint.get_name() == "main";
848-
});
845+
for (const auto& spawnpoint : sector->get_objects_by_type<SpawnPointMarker>())
846+
{
847+
if (spawnpoint.get_name() == "main")
848+
{
849+
spawnpoint_valid = true;
850+
}
851+
}
849852
}
850853
}
851854

src/gui/menu_script.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ ScriptMenu::ScriptMenu(std::string* script_) :
3131
// Split the script to the lines.
3232
std::string script = *base_script;
3333
std::string line_break = "\n";
34+
std::string new_line;
3435
size_t endl_pos = script.find(line_break);
3536
while (endl_pos != std::string::npos) {
36-
const auto& new_line = script.substr(0, endl_pos);
37+
new_line = script.substr(0, endl_pos);
3738
script = script.substr(endl_pos + line_break.length());
3839
push_string(new_line);
3940
endl_pos = script.find(line_break);

src/interface/control_textbox.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "interface/control_textbox.hpp"
1818

1919
#include <math.h>
20-
#include <numeric>
2120

2221
#include <SDL.h>
2322

@@ -364,8 +363,13 @@ ControlTextbox::get_string() const
364363
std::string
365364
ControlTextbox::get_contents() const
366365
{
366+
std::string temp;
367+
368+
for (char c : m_charlist) {
369+
temp += c;
370+
}
367371

368-
return std::accumulate(m_charlist.begin(), m_charlist.end(), "");
372+
return temp;
369373
}
370374

371375
std::string

src/object/brick.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ Brick::try_break(Player* player)
104104
return;
105105

106106
SoundManager::current()->play("sounds/brick.wav", get_pos());
107+
Player& player_one = *Sector::get().get_players()[0];
107108
if (m_coin_counter > 0 ) {
108109
Sector::get().add<BouncyCoin>(get_pos(), true);
109110
m_coin_counter--;
110-
Player& player_one = *Sector::get().get_players()[0];
111111
player_one.get_status().add_coins(1);
112112
if (m_coin_counter == 0)
113113
m_sprite->set_action("empty");

src/supertux/command_line_arguments.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ void
7373
CommandLineArguments::print_acknowledgements() const
7474
{
7575
IFileStream in("ACKNOWLEDGEMENTS.txt");
76+
std::string line;
7677
if (in.good())
7778
{
78-
std::string line;
7979
while (std::getline(in, line))
8080
{
8181
std::cout << line << std::endl;

0 commit comments

Comments
 (0)