From f70de4e22024a6d8c4f142e02c837e03b6aa762e Mon Sep 17 00:00:00 2001 From: Haibo Date: Fri, 16 Nov 2018 19:53:47 +0800 Subject: [PATCH] fix: the size of intrusive list is not stable fixes commet mistakes --- core/base/Node.h | 3 --- core/base/intrusive/List.hpp | 4 ++-- core/math/rand.h | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/core/base/Node.h b/core/base/Node.h index 353c5875..074a1159 100644 --- a/core/base/Node.h +++ b/core/base/Node.h @@ -321,9 +321,6 @@ namespace easy2d // 获取全部子节点 Children const& GetChildren() const; - // 获取子节点数量 - int GetChildrenCount() const; - // 移除子节点 bool RemoveChild( spNode const& child diff --git a/core/base/intrusive/List.hpp b/core/base/intrusive/List.hpp index 56a34763..99e85c66 100644 --- a/core/base/intrusive/List.hpp +++ b/core/base/intrusive/List.hpp @@ -215,7 +215,7 @@ namespace easy2d std::sort(temp_vec.begin(), temp_vec.end(), if_lt); size_t size = temp_vec.size(); - for (size_t i = 0; i < size_; ++i) + for (size_t i = 0; i < size; ++i) { if (i == 0) temp_vec[i]->prev_ = ItemType(); @@ -224,7 +224,7 @@ namespace easy2d temp_vec[i]->prev_ = temp_vec[i - 1]; temp_vec[i - 1]->next_ = temp_vec[i]; } - if (i == size_ - 1) + if (i == size - 1) temp_vec[i]->next_ = ItemType(); else { diff --git a/core/math/rand.h b/core/math/rand.h index bc300486..13763a1e 100644 --- a/core/math/rand.h +++ b/core/math/rand.h @@ -30,7 +30,7 @@ namespace easy2d // // Usage: // 获取指定范围内的一个随机数, 如: - // int n = math::Rand(1, 5); // 获取 1~6 内的随机整数, 包含 1 和 6 + // int n = math::Rand(1, 5); // 获取 1~5 内的随机整数, 包含 1 和 5 // 方法同样适用于浮点数的生成, 如: // double d = math::Rand(1.2, 1.5); // 注意, 获得的随机数类型取决于参数的类型。