widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #10517
[Merge] lp:~widelands-dev/widelands/bug-986611-cppcheck-unused into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-986611-cppcheck-unused into lp:widelands.
Commit message:
Removed some unused functions and variables.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #986611 in widelands: "Issues reported by cppcheck"
https://bugs.launchpad.net/widelands/+bug/986611
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-986611-cppcheck-unused/+merge/326236
These were flagged up by cppcheck. There are more, but I decided to keep the others, because they are unfinished features and the code might still come in handy in the future.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-986611-cppcheck-unused into lp:widelands.
=== modified file 'src/base/time_string.cc'
--- src/base/time_string.cc 2017-01-25 18:55:59 +0000
+++ src/base/time_string.cc 2017-06-23 17:42:19 +0000
@@ -172,7 +172,7 @@
gamestringbuffer[4] = '0' + (time /= 10) % 6;
gamestringbuffer[2] = '0' + (time /= 6) % 10;
gamestringbuffer[1] = '0' + (time /= 10) % 10;
- gamestringbuffer[0] = '0' + (time /= 10);
+ gamestringbuffer[0] = '0' + (time / 10);
return gamestringbuffer;
}
=== modified file 'src/logic/editor_game_base.cc'
--- src/logic/editor_game_base.cc 2017-02-28 12:59:39 +0000
+++ src/logic/editor_game_base.cc 2017-06-23 17:42:19 +0000
@@ -419,31 +419,6 @@
return lasttrackserial_;
}
-/*
-===============
-Retrieve a previously stored pointer using the serial number.
-Returns 0 if the pointer has been removed.
-===============
-*/
-void* EditorGameBase::get_trackpointer(uint32_t const serial) {
- std::map<uint32_t, void*>::iterator it = trackpointers_.find(serial);
-
- if (it != trackpointers_.end())
- return it->second;
-
- return nullptr;
-}
-
-/*
-===============
-Remove the registered track pointer. Subsequent calls to get_trackpointer()
-using this serial number will return 0.
-===============
-*/
-void EditorGameBase::remove_trackpointer(uint32_t serial) {
- trackpointers_.erase(serial);
-}
-
/**
* Cleanup for load
*
=== modified file 'src/logic/editor_game_base.h'
--- src/logic/editor_game_base.h 2017-05-26 06:11:27 +0000
+++ src/logic/editor_game_base.h 2017-06-23 17:42:19 +0000
@@ -165,8 +165,6 @@
// unlike objects in the ObjectManager, these pointers need not be
// synchronized across the network, and they are not saved in savegames
uint32_t add_trackpointer(void*);
- void* get_trackpointer(uint32_t serial);
- void remove_trackpointer(uint32_t serial);
void inform_players_about_ownership(MapIndex, PlayerNumber);
void inform_players_about_immovable(MapIndex, MapObjectDescr const*);
=== modified file 'src/logic/game.cc'
--- src/logic/game.cc 2017-05-14 18:17:16 +0000
+++ src/logic/game.cc 2017-06-23 17:42:19 +0000
@@ -138,12 +138,6 @@
log("[sync] Reset\n");
}
-/**
- * Returns true if cheat codes have been activated (single-player only)
- */
-bool Game::get_allow_cheats() {
- return true;
-}
/**
* \return a pointer to the \ref InteractivePlayer if any.
=== modified file 'src/logic/game.h'
--- src/logic/game.h 2017-05-14 18:17:16 +0000
+++ src/logic/game.h 2017-06-23 17:42:19 +0000
@@ -172,8 +172,6 @@
StreamWrite& syncstream();
Md5Checksum get_sync_hash() const;
- bool get_allow_cheats();
-
void enqueue_command(Command* const);
void send_player_command(Widelands::PlayerCommand&);
=== modified file 'src/logic/map_objects/map_object.cc'
--- src/logic/map_objects/map_object.cc 2017-05-23 21:07:47 +0000
+++ src/logic/map_objects/map_object.cc 2017-06-23 17:42:19 +0000
@@ -376,17 +376,6 @@
return dyn_attribhigh_;
}
-/**
- * Lookup an attribute by id. If the attribute isn't found,
- * returns an emtpy string.
- */
-std::string MapObjectDescr::get_attribute_name(uint32_t id) {
- for (AttribMap::iterator iter = dyn_attribs_.begin(); iter != dyn_attribs_.end(); ++iter) {
- if (iter->second == id)
- return iter->first;
- }
- return "";
-}
/*
==============================================================================
=== modified file 'src/logic/map_objects/map_object.h'
--- src/logic/map_objects/map_object.h 2017-05-20 22:42:49 +0000
+++ src/logic/map_objects/map_object.h 2017-06-23 17:42:19 +0000
@@ -137,7 +137,6 @@
std::string get_animation_name(uint32_t) const; ///< needed for save, debug
bool has_attribute(uint32_t) const;
static uint32_t get_attribute_id(const std::string& name, bool add_if_not_exists = false);
- static std::string get_attribute_name(uint32_t id);
bool is_animation_known(const std::string& name) const;
void add_animation(const std::string& name, uint32_t anim);
=== modified file 'src/logic/map_objects/tribes/tribe_descr.cc'
--- src/logic/map_objects/tribes/tribe_descr.cc 2017-06-18 08:10:38 +0000
+++ src/logic/map_objects/tribes/tribe_descr.cc 2017-06-23 17:42:19 +0000
@@ -261,9 +261,6 @@
return descname_;
}
-size_t TribeDescr::get_nrbuildings() const {
- return buildings_.size();
-}
size_t TribeDescr::get_nrwares() const {
return wares_.size();
}
=== modified file 'src/logic/map_objects/tribes/tribe_descr.h'
--- src/logic/map_objects/tribes/tribe_descr.h 2017-05-25 06:46:27 +0000
+++ src/logic/map_objects/tribes/tribe_descr.h 2017-06-23 17:42:19 +0000
@@ -63,7 +63,6 @@
const std::string& name() const;
const std::string& descname() const;
- size_t get_nrbuildings() const;
size_t get_nrwares() const;
size_t get_nrworkers() const;
=== modified file 'src/scripting/lua_game.cc'
--- src/scripting/lua_game.cc 2017-06-20 08:18:38 +0000
+++ src/scripting/lua_game.cc 2017-06-23 17:42:19 +0000
@@ -455,9 +455,6 @@
}
#undef CHECK_ARG
- std::string title = luaL_checkstring(L, 2);
- std::string body = luaL_checkstring(L, 3);
-
uint32_t cspeed = game.game_controller()->desired_speed();
game.game_controller()->set_desired_speed(0);
=== modified file 'src/ui_basic/editbox.cc'
--- src/ui_basic/editbox.cc 2017-06-15 16:34:58 +0000
+++ src/ui_basic/editbox.cc 2017-06-23 17:42:19 +0000
@@ -137,12 +137,6 @@
m_->caret = m_->text.size();
}
-/**
- * \return the maximum length of the input string
- */
-uint32_t EditBox::max_length() const {
- return m_->maxLength;
-}
/**
* Set the maximum length of the input string.
=== modified file 'src/ui_basic/editbox.h'
--- src/ui_basic/editbox.h 2017-02-23 19:38:51 +0000
+++ src/ui_basic/editbox.h 2017-06-23 17:42:19 +0000
@@ -59,7 +59,6 @@
const std::string& text() const;
void set_text(const std::string&);
- uint32_t max_length() const;
void set_max_length(uint32_t);
void activate_history(bool activate) {
=== modified file 'src/ui_basic/multilineeditbox.cc'
--- src/ui_basic/multilineeditbox.cc 2017-06-15 16:34:58 +0000
+++ src/ui_basic/multilineeditbox.cc 2017-06-23 17:42:19 +0000
@@ -162,13 +162,6 @@
}
/**
- * Return the currently set maximum number of bytes.
- */
-uint32_t MultilineEditbox::get_maximum_bytes() const {
- return d_->maxbytes;
-}
-
-/**
* Erase the given range of bytes, adjust the cursor position, and update.
*/
void MultilineEditbox::Data::erase_bytes(uint32_t start, uint32_t end) {
=== modified file 'src/ui_basic/multilineeditbox.h'
--- src/ui_basic/multilineeditbox.h 2017-02-28 20:07:07 +0000
+++ src/ui_basic/multilineeditbox.h 2017-06-23 17:42:19 +0000
@@ -50,7 +50,6 @@
void set_text(const std::string&);
void set_maximum_bytes(uint32_t n);
- uint32_t get_maximum_bytes() const;
void focus(bool topcaller = true) override;
=== modified file 'src/wui/itemwaresdisplay.cc'
--- src/wui/itemwaresdisplay.cc 2017-05-14 04:38:39 +0000
+++ src/wui/itemwaresdisplay.cc 2017-06-23 17:42:19 +0000
@@ -67,16 +67,6 @@
}
}
-/**
- * Set the items shown per row of the panel.
- */
-void ItemWaresDisplay::set_items_per_row(uint32_t nr) {
- if (nr != items_per_row_) {
- items_per_row_ = nr;
- recalc_desired_size();
- }
-}
-
void ItemWaresDisplay::recalc_desired_size() {
uint32_t nrrows = (capacity_ + items_per_row_ - 1) / items_per_row_;
uint32_t rowitems = capacity_ >= items_per_row_ ? items_per_row_ : capacity_;
=== modified file 'src/wui/itemwaresdisplay.h'
--- src/wui/itemwaresdisplay.h 2017-01-25 18:55:59 +0000
+++ src/wui/itemwaresdisplay.h 2017-06-23 17:42:19 +0000
@@ -48,7 +48,6 @@
uint32_t items_per_row() const {
return items_per_row_;
}
- void set_items_per_row(uint32_t nr);
void clear();
void add(bool worker, Widelands::DescriptionIndex index);
Follow ups