widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #02769
Re: [Merge] lp:~widelands-dev/widelands/bug-1371905_2 into lp:widelands
> How do I turn std::string into const std::string? I tried
const std::string unit_text;
if (sbi->unit.empty()) {
unit_text = (std::to_string(sbi->value)).c_str();
You cannot use const here. Sorry, I saw that wrong. const is a promise that you will not modify this value ever again. You should use it whenever you can, but here you modify the value later on, so you cannot use it.
> Sounds like a good idea, but I have given up on this.
For the reference, I have given up on finding the syntax that allows me to do this. Of all the variatons I have tried, this one seems the most logical to me:
std::vector<UI::Button *> m_buttons;
std::vector<UI::Button *> & get_buttons() {return *m_buttons;}
This should work:
const std::vector<UI::Button*>& get_buttons() { return m_buttons; }
This reads from right to left (as types do in c++): get_buttons returns a reference to a vector of pointers to buttons that is const.
> There were 2 identical background images, so I bzr renamed one of them to ui_fsmenu.jpg and bzr deleted singleplmenu.jpg, which is unused now.
ack.
> This doesn't say anything about what to do if the arguments are a long expression. So, you need to tell me what you want here and I can go change.
Use clang_format over all your changes :). Seriously, when we get clang_format to being used by most people, we will never have to talk about indentation ever again. For now just let it be as it is. We'll can do a sweeping formatting of the whole code base.
--
https://code.launchpad.net/~widelands-dev/widelands/bug-1371905_2/+merge/236227
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1371905_2.
Follow ups
References