Fix compilation with clang 2.9 / boost 1.47.

This applies a slightly modified version of the patch linked in
bug #18399. The changes are coding-style related.

The patch was intended to fix compilation with boost 1.47, but that
boost version is not yet in Debian so didn't test that part. Since it
does fix compilation with clang 2.9 Iapplied it, without waiting for
boost 1.47 to hit Debian.
This commit is contained in:
Mark de Wever 2011-10-25 19:31:42 +00:00
parent 0a1a7ccefd
commit c1c40064eb
2 changed files with 36 additions and 10 deletions

View file

@ -84,6 +84,8 @@ Version 1.9.9+svn:
image lists
* Evaluate key length even if intervening WML children don't exist (bug #18701)
* Fix gold carryover if loading a save created in linger mode (bug #16111)
* Fixed: Compilation with boost 1.47 (bug #18399's patch).
* Fixed: Compilation with the clang 2.9 compiler (bug #18399's patch).
Version 1.9.9:
* AI:

View file

@ -233,6 +233,25 @@ void ttree_view_node::clear()
struct ttree_view_node_implementation
{
private:
template<class W, class It>
static W* find_at_aux(
It begin
, It end
, const tpoint& coordinate
, const bool must_be_active)
{
for(It it = begin; it != end; ++it) {
if(W* widget = it->find_at(coordinate, must_be_active)) {
return widget;
}
}
return NULL;
}
public:
template<class W>
static W* find_at(
typename tconst_duplicator<W, ttree_view_node>::type&
@ -250,13 +269,9 @@ struct ttree_view_node_implementation
}
typedef typename tconst_duplicator<W, ttree_view_node>::type thack;
foreach(thack& node, tree_view_node.children_) {
if(W* widget = node.find_at(coordinate, must_be_active)) {
return widget;
}
}
return NULL;
return find_at_aux<W>(tree_view_node.children_.begin(),
tree_view_node.children_.end(),
coordinate, must_be_active);
}
};
@ -308,7 +323,10 @@ tpoint ttree_view_node::get_current_size() const
return size;
}
foreach(const ttree_view_node& node, children_) {
for(boost::ptr_vector<ttree_view_node>::const_iterator itor =
children_.begin (); itor != children_.end (); ++itor) {
const ttree_view_node& node = *itor;
if(node.grid_.get_visible() == twidget::INVISIBLE) {
continue;
@ -339,7 +357,10 @@ tpoint ttree_view_node::get_unfolded_size() const
size.x += (get_indention_level() - 1) * tree_view().indention_step_size_;
}
foreach(const ttree_view_node& node, children_) {
for(boost::ptr_vector<ttree_view_node>::const_iterator itor =
children_.begin (); itor != children_.end (); ++itor) {
const ttree_view_node& node = *itor;
if(node.grid_.get_visible() == twidget::INVISIBLE) {
continue;
@ -373,7 +394,10 @@ tpoint ttree_view_node::calculate_best_size(const int indention_level
DBG_GUI_L << LOG_HEADER << " own grid best size " << best_size << ".\n";
foreach(const ttree_view_node& node, children_) {
for(boost::ptr_vector<ttree_view_node>::const_iterator itor =
children_.begin (); itor != children_.end (); ++itor) {
const ttree_view_node& node = *itor;
if(node.grid_.get_visible() == twidget::INVISIBLE) {
continue;