From 41cc92f73e39cec5dfea6b1164176610cccc7df4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 15 Aug 2015 13:58:32 +0300 Subject: Add strong typed int for item color. --- src/actions/actions.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/actions/actions.cpp') diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 92c0029ed..014ae10f8 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -439,7 +439,8 @@ impHandler(dropItemId) return false; // +++ ignoring item color for now - Item *const item = inv->findItem(atoi(event.args.c_str()), 1); + Item *const item = inv->findItem(atoi(event.args.c_str()), + ItemColor_one); if (item && !PlayerInfo::isItemProtected(item->getId())) { @@ -467,7 +468,8 @@ impHandler(dropItemIdAll) return false; // +++ ignoring item color for now - Item *const item = inv->findItem(atoi(event.args.c_str()), 1); + Item *const item = inv->findItem(atoi(event.args.c_str()), + ItemColor_one); if (item && !PlayerInfo::isItemProtected(item->getId())) PlayerInfo::dropItem(item, item->getQuantity(), Sfx_true); @@ -1485,14 +1487,14 @@ impHandler0(createItems) if (!colors) { - dialog->addItem(id, 0, 1, 100, 0); + dialog->addItem(id, 0, ItemColor_one, 100, 0); } else { - for (unsigned char f = 0; f < colors; f ++) + for (int f = 0; f < colors; f ++) { - if (!info->getColor(f).empty()) - dialog->addItem(id, 0, f, 100, 0); + if (!info->getColor(fromInt(f, ItemColor)).empty()) + dialog->addItem(id, 0, fromInt(f, ItemColor), 100, 0); } } } @@ -1548,7 +1550,8 @@ impHandler(useItem) if (inv) { // +++ ignoring item color for now - const Item *const item = inv->findItem(itemId, 1); + const Item *const item = inv->findItem(itemId, + ItemColor_one); PlayerInfo::useEquipItem(item, Sfx_true); } } -- cgit v1.2.3-60-g2f50