diff options
author | Adam Borowski <kilobyte@angband.pl> | 2011-07-04 17:59:38 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2011-07-05 02:21:51 +0200 |
commit | 06bb5b5c8199203001e4b3479351adf321299be5 (patch) | |
tree | c0bd4f83380fe5f3f408b3b605838e0d056b309b /crawl-ref/source/quiver.cc | |
parent | eb03baac873c59367d8308b3c0a535b136f99633 (diff) | |
download | crawl-ref-06bb5b5c8199203001e4b3479351adf321299be5.tar.gz crawl-ref-06bb5b5c8199203001e4b3479351adf321299be5.zip |
cppcheck: fix inefficient checking for emptiness.
On some STL structures size() is slow. I did not bother limitting sed,
so innocent bystanders got pulled into the machine, but there's no loss.
Diffstat (limited to 'crawl-ref/source/quiver.cc')
-rw-r--r-- | crawl-ref/source/quiver.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crawl-ref/source/quiver.cc b/crawl-ref/source/quiver.cc index 6d6a831873..afae1159d5 100644 --- a/crawl-ref/source/quiver.cc +++ b/crawl-ref/source/quiver.cc @@ -95,7 +95,7 @@ int player_quiver::get_fire_item(std::string* no_item_reason) const { std::vector<int> order; _get_fire_order(order, false, you.weapon()); - if (order.size()) + if (!order.empty()) slot = order[0]; } @@ -108,7 +108,7 @@ int player_quiver::get_fire_item(std::string* no_item_reason) const { // nothing } - else if (full_fire_order.size() == 0) + else if (full_fire_order.empty()) { *no_item_reason = "No suitable missiles."; } |