diff --git a/base/buffer_vector.hpp b/base/buffer_vector.hpp index f29f89ad1b..f7d235f724 100644 --- a/base/buffer_vector.hpp +++ b/base/buffer_vector.hpp @@ -53,6 +53,11 @@ template class buffer_vector } } + T * data_private() + { + return (m_size > N ? &m_dynamic[0] : m_static.data()); + } + public: typedef T value_type; typedef T const & const_reference; @@ -91,6 +96,8 @@ public: T const * begin() const { return data(); } T const * end() const { return (data() + m_size); } + T * begin() { return data_private(); } + T * end() { return (data_private() + m_size); } T const * data() const { @@ -148,5 +155,5 @@ void swap(buffer_vector & r1, buffer_vector & r2) { r1.swap(r2); } template inline string debug_print(buffer_vector const & v) { - return ::my::impl::DebugPrintSequence(v.data(), v.data() + v.size()); + return ::my::impl::DebugPrintSequence(v.begin(), v.end()); } diff --git a/map/framework.cpp b/map/framework.cpp index 94aa261281..57fc39e3d9 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -63,6 +63,14 @@ namespace fwork namespace { + struct less_depth + { + bool operator() (di::DrawRule const & r1, di::DrawRule const & r2) const + { + return (r1.m_depth < r2.m_depth); + } + }; + struct less_key { bool operator() (drule::Key const & r1, drule::Key const & r2) const @@ -178,6 +186,8 @@ namespace fwork rules[i] = di::DrawRule(drule::rules().Find(m_keys[i]), depth); } + sort(rules.begin(), rules.end(), less_depth()); + #ifdef PROFILER_DRAWING m_drawCount += m_keys.size(); #endif diff --git a/yg/pen_info.cpp b/yg/pen_info.cpp index 79d3ec1b89..91d2e0d9c6 100644 --- a/yg/pen_info.cpp +++ b/yg/pen_info.cpp @@ -1,8 +1,10 @@ #include "pen_info.hpp" + +#include "../base/logging.hpp" + #include "../std/algorithm.hpp" #include "../std/iterator.hpp" #include "../std/numeric.hpp" -#include "../base/logging.hpp" namespace yg { @@ -56,8 +58,8 @@ namespace yg vec.push_back(0); vec.push_back(curLen + tmpV[i] - offset); - std::copy(tmpV.data() + i + 1, tmpV.end(), back_inserter(vec)); - std::copy(tmpV.begin(), tmpV.data() + i, back_inserter(vec)); + copy(tmpV.begin() + i + 1, tmpV.end(), back_inserter(vec)); + copy(tmpV.begin(), tmpV.begin() + i, back_inserter(vec)); vec.push_back(offset - curLen); if (i % 2 == 0)