Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a named struct for terrain name and movement pair
This allows the sorting logic top be shared between the sidebar and the unit preview pane. It also means that we no longer need to create a lambda to sort them. I also refactored the generation of movement cost data in help. In particular, we're no longer extracting the struct to named local variables. (cherry-picked from commit d8e2498)
- Loading branch information
Showing
6 changed files
with
91 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
Copyright (C) 2018 by Jyrki Vesterinen <sandgtx@gmail.com> | ||
Part of the Battle for Wesnoth Project https://www.wesnoth.org/ | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License version 2 | ||
or at your option any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY. | ||
See the COPYING file for more details. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "gettext.hpp" | ||
#include "tstring.hpp" | ||
|
||
struct terrain_movement | ||
{ | ||
const t_string& name; | ||
int moves; | ||
|
||
terrain_movement(const t_string& name_, int moves_) | ||
: name(name_), moves(moves_) | ||
{} | ||
|
||
bool operator<(const terrain_movement& other) const | ||
{ | ||
return translation::icompare(name, other.name) < 0; | ||
} | ||
}; |