Fix some minor std::function-related bugs.

Lambdas to be stored in `function<void()>` should not return `bool`.

Two uses of `std::function` could be just `function`, like everywhere
else in the codebase.
This commit is contained in:
Arthur O'Dwyer
2019-02-06 18:48:53 +01:00
committed by Zeno Rogue
parent 26fe57ef92
commit a478bb1485
4 changed files with 6 additions and 9 deletions
+1 -2
View File
@@ -473,7 +473,7 @@ namespace dialog {
color_t *colorPointer; color_t *colorPointer;
bool handleKeyColor(int sym, int uni) { void handleKeyColor(int sym, int uni) {
unsigned& color = *colorPointer; unsigned& color = *colorPointer;
int shift = colorAlpha ? 0 : 8; int shift = colorAlpha ? 0 : 8;
@@ -514,7 +514,6 @@ namespace dialog {
else if(doexiton(sym, uni)) { else if(doexiton(sym, uni)) {
popScreen(); popScreen();
} }
return false;
} }
bool colorAlpha; bool colorAlpha;
+3 -3
View File
@@ -1870,9 +1870,9 @@ int taildist(cell *c) {
} }
int last_wormsegment = -1; int last_wormsegment = -1;
vector<vector< std::function<void()> > > wormsegments; vector<vector< function<void()> > > wormsegments;
void add_segment(int d, const std::function<void()>& s) { void add_segment(int d, const function<void()>& s) {
if(isize(wormsegments) <= d) wormsegments.resize(d+1); if(isize(wormsegments) <= d) wormsegments.resize(d+1);
last_wormsegment = max(last_wormsegment, d); last_wormsegment = max(last_wormsegment, d);
wormsegments[d].push_back(s); wormsegments[d].push_back(s);
@@ -5778,7 +5778,7 @@ void drawscreen() {
mouseovers = " "; mouseovers = " ";
cmode = 0; cmode = 0;
keyhandler = [] (int sym, int uni) { return false; }; keyhandler = [] (int sym, int uni) {};
#if CAP_SDL #if CAP_SDL
joyhandler = [] (SDL_Event& ev) { return false; }; joyhandler = [] (SDL_Event& ev) { return false; };
#endif #endif
+1 -2
View File
@@ -442,7 +442,7 @@ void bantar_anim() {
bool bmap; bool bmap;
bool bantar_stats() { void bantar_stats() {
if(bmap) { if(bmap) {
vid.linewidth *= (inHighQual ? 10 : 2); vid.linewidth *= (inHighQual ? 10 : 2);
for(auto p: parent) if(gmatrix.count(p.first) && gmatrix.count(p.second)) for(auto p: parent) if(gmatrix.count(p.first) && gmatrix.count(p.second))
@@ -458,7 +458,6 @@ bool bantar_stats() {
vid.linewidth /= (inHighQual ? 10 : 2); vid.linewidth /= (inHighQual ? 10 : 2);
drawqueue(); drawqueue();
} }
return false;
} }
void init_bantar() { void init_bantar() {
+1 -2
View File
@@ -389,7 +389,7 @@ void show_graph() {
}; };
} }
bool frame() { void frame() {
if(graphcolor) { if(graphcolor) {
hyperpoint h0 = find_point(0); hyperpoint h0 = find_point(0);
hyperpoint h1 = find_point(1); hyperpoint h1 = find_point(1);
@@ -397,7 +397,6 @@ bool frame() {
draw_to(0, h0, 1, h1); draw_to(0, h0, 1, h1);
finish(); finish();
} }
return false;
} }
#if CAP_COMMANDLINE #if CAP_COMMANDLINE