summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/invent.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-05-01 14:47:53 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-05-01 14:47:53 +0000
commit106fb6de1cf3523c10197dc8e02ec44e94523f18 (patch)
treebe6eba2338470be1467fc89131f20d80878a4906 /crawl-ref/source/invent.cc
parent83043ea070b1f45c5cad9c7ad1f1844a01079809 (diff)
downloadcrawl-ref-106fb6de1cf3523c10197dc8e02ec44e94523f18.tar.gz
crawl-ref-106fb6de1cf3523c10197dc8e02ec44e94523f18.zip
Type safety, cast cleanups, etc.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1401 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/invent.cc')
-rw-r--r--crawl-ref/source/invent.cc13
1 files changed, 5 insertions, 8 deletions
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index 5096365115..a570e9e625 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -722,15 +722,13 @@ std::vector<SelItem> prompt_invent_items(
static int digit_to_index( char digit, operation_types oper ) {
- int i;
- unsigned int j;
- char iletter = (char)(oper);
+ const char iletter = static_cast<char>(oper);
- for ( i = 0; i < ENDOFPACK; ++i ) {
+ for ( int i = 0; i < ENDOFPACK; ++i ) {
if (is_valid_item(you.inv[i])) {
const std::string& r(you.inv[i].inscription);
/* note that r.size() is unsigned */
- for ( j = 0; j + 2 < r.size(); ++j ) {
+ for ( unsigned int j = 0; j + 2 < r.size(); ++j ) {
if ( r[j] == '@' &&
(r[j+1] == iletter || r[j+1] == '*') &&
r[j+2] == digit ) {
@@ -745,11 +743,10 @@ static int digit_to_index( char digit, operation_types oper ) {
static bool has_warning_inscription(const item_def& item,
operation_types oper)
{
- char iletter = (char)(oper);
- unsigned int i;
+ const char iletter = static_cast<char>(oper);
const std::string& r(item.inscription);
- for ( i = 0; i + 1 < r.size(); ++i )
+ for ( unsigned int i = 0; i + 1 < r.size(); ++i )
if (r[i] == '!' && (r[i+1] == iletter || r[i+1] == '*'))
return true;
return false;