Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/wesnoth/wesnoth
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Jun 20, 2014
2 parents 3774107 + ad7cf13 commit 7951ba5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/serialization/string_utils.cpp
Expand Up @@ -564,7 +564,11 @@ std::string si_string(double input, bool base2, std::string unit) {

strings9 prefixes;
strings9::const_iterator prefix;
if (input < 1.0) {
if (input == 0.0) {
strings9 tmp = { { "","","","","","","","","" } };
prefixes = tmp;
prefix = prefixes.begin();
} else if (input < 1.0) {
strings9 tmp = { {
"",
_("prefix_milli^m"),
Expand Down
8 changes: 8 additions & 0 deletions src/unit.cpp
Expand Up @@ -79,11 +79,19 @@ namespace {

void intrusive_ptr_add_ref(const unit * u)
{
if(u->ref_count_ > 1000 || u->ref_count_ < 0)
{
WRN_UT << "found very much references: " << u->ref_count_ << " of them " << std::endl;
}
++(u->ref_count_);
}

void intrusive_ptr_release(const unit * u)
{
if(u->ref_count_ > 1000 || u->ref_count_ < 0)
{
WRN_UT << "found very much references: " << u->ref_count_ << " of them " << std::endl;
}
if (--(u->ref_count_) == 0)
delete u;
}
Expand Down
5 changes: 1 addition & 4 deletions src/unit_map.hpp
Expand Up @@ -227,10 +227,7 @@ class unit_map {
}

bool valid() const {
if(valid_for_dereference()) {
return static_cast<bool> (i_->second.unit);
}
return false;
return (valid_for_dereference() && i_->second.unit);
}

bool operator==(const iterator_base &rhs) const { return (tank_ == rhs.tank_) && ( i_ == rhs.i_ ); }
Expand Down

0 comments on commit 7951ba5

Please sign in to comment.