From 61cae4a761c2f72cda44ae269c7007b37a0c14a7 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 26 Jun 2008 10:39:39 +0000 Subject: Misc. minor cleanups. (Yes, a huge amount of them but still...) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6146 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/database.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/database.cc') diff --git a/crawl-ref/source/database.cc b/crawl-ref/source/database.cc index 12eec729e2..2aaa4f8bd5 100644 --- a/crawl-ref/source/database.cc +++ b/crawl-ref/source/database.cc @@ -157,9 +157,9 @@ bool TextDB::_needs_update() const { std::string full_input_path = datafile_path(_input_files[i], true); if (is_newer(full_input_path, full_db_path)) - return true; + return (true); } - return false; + return (false); } void TextDB::_regenerate_db() @@ -407,7 +407,7 @@ static std::string _chooseStrByWeight(std::string entry, int fixed_weight = -1) { // Skip over multiple blank lines, and leading and trailing // blank lines. - while (i < size && lines[i] == "") + while (i < size && lines[i].empty()) i++; if (i == size) @@ -427,7 +427,7 @@ static std::string _chooseStrByWeight(std::string entry, int fixed_weight = -1) total_weight += weight; - while (i < size && lines[i] != "") + while (i < size && !lines[i].empty()) { part += lines[i++]; part += "\n"; @@ -561,9 +561,11 @@ static void _call_recursive_replacement(std::string &str, DBM *database, _getRandomisedStr(database, marker, suffix, num_replacements, recursion_depth); - if (replacement == "") + if (replacement.empty()) + { // Nothing in database, leave it alone and go onto next @foo@ pos = str.find("@", end + 1); + } else { str.replace(pos, marker_full.length(), replacement); -- cgit v1.2.3-54-g00ecf