Rename potentially ambiguous function
This commit is contained in:
parent
7fab08508f
commit
43f5deaaf0
4 changed files with 14 additions and 16 deletions
|
@ -106,7 +106,7 @@ void tsub_player_list::update_player_count_label()
|
|||
* widget should also be able to handle it itself. Once done the
|
||||
* setting of the label text can also be removed.
|
||||
*/
|
||||
label_player_count->set_label((formatter() << "(" << tree->size() << ")").str());
|
||||
label_player_count->set_label((formatter() << "(" << tree->count_children() << ")").str());
|
||||
}
|
||||
|
||||
void tplayer_list::init(twindow& w)
|
||||
|
|
|
@ -732,7 +732,7 @@ ttree_view_node* ttree_view_node::get_node_above()
|
|||
{
|
||||
assert(!is_root_node());
|
||||
ttree_view_node* cur = nullptr;
|
||||
for(size_t i = 0; i < parent_node_->size(); ++i) {
|
||||
for(size_t i = 0; i < parent_node_->count_children(); ++i) {
|
||||
if(&parent_node_->children_[i] == this) {
|
||||
if(i == 0) {
|
||||
return parent_node_->is_root_node() ? nullptr : parent_node_;
|
||||
|
@ -743,8 +743,8 @@ ttree_view_node* ttree_view_node::get_node_above()
|
|||
}
|
||||
}
|
||||
}
|
||||
while(!cur->is_folded() && cur->size() > 0) {
|
||||
cur = &cur->get_child_at(cur->size() - 1);
|
||||
while(!cur->is_folded() && cur->count_children() > 0) {
|
||||
cur = &cur->get_child_at(cur->count_children() - 1);
|
||||
}
|
||||
return cur;
|
||||
}
|
||||
|
@ -752,16 +752,16 @@ ttree_view_node* ttree_view_node::get_node_above()
|
|||
ttree_view_node* ttree_view_node::get_node_below()
|
||||
{
|
||||
assert(!is_root_node());
|
||||
if(!is_folded() && size() > 0) {
|
||||
if(!is_folded() && count_children() > 0) {
|
||||
return &get_child_at(0);
|
||||
}
|
||||
ttree_view_node* cur = this;
|
||||
while(cur->parent_node_ != nullptr) {
|
||||
ttree_view_node& parent = *cur->parent_node_;
|
||||
|
||||
for(size_t i = 0; i < parent.size(); ++i) {
|
||||
for(size_t i = 0; i < parent.count_children(); ++i) {
|
||||
if(&parent.children_[i] == cur) {
|
||||
if(i < parent.size() - 1) {
|
||||
if(i < parent.count_children() - 1) {
|
||||
return &parent.children_[i + 1];
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -156,11 +156,9 @@ public:
|
|||
const bool must_be_active) const override;
|
||||
|
||||
/**
|
||||
* The "size" of the widget.
|
||||
*
|
||||
* @todo Rename this function, names to close to the size of the widget.
|
||||
* The number of children in this widget.
|
||||
*/
|
||||
size_t size() const
|
||||
size_t count_children() const
|
||||
{
|
||||
return children_.size();
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ static gui2::twidget *find_widget(lua_State *L, int i, bool readonly)
|
|||
int v = lua_tointeger(L, i);
|
||||
if (v < 1)
|
||||
goto error_call_destructors_1;
|
||||
int n = tvn.size();
|
||||
int n = tvn.count_children();
|
||||
if (v > n) {
|
||||
goto error_call_destructors_1;
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ static gui2::twidget *find_widget(lua_State *L, int i, bool readonly)
|
|||
int v = lua_tointeger(L, i);
|
||||
if (v < 1)
|
||||
goto error_call_destructors_1;
|
||||
int n = tvn->size();
|
||||
int n = tvn->count_children();
|
||||
if (v > n) {
|
||||
goto error_call_destructors_1;
|
||||
}
|
||||
|
@ -481,11 +481,11 @@ namespace
|
|||
{
|
||||
//Not tested yet.
|
||||
gui2::ttree_view& tv = node.tree_view();
|
||||
if(pos >= node.size()) {
|
||||
if(pos >= node.count_children()) {
|
||||
return;
|
||||
}
|
||||
if(number <= 0 || number + pos > node.size()) {
|
||||
number = node.size() - pos;
|
||||
if(number <= 0 || number + pos > node.count_children()) {
|
||||
number = node.count_children() - pos;
|
||||
}
|
||||
for (int i = 0; i < number; ++i) {
|
||||
tv.remove_node(&node.get_child_at(pos));
|
||||
|
|
Loading…
Add table
Reference in a new issue