commands separated
[k8-i-v-a-n.git] / src / game / commands / Drop.cpp
blob26122379d760ae4c01576a3cd1da6e971e3c8a33
1 COMMAND(Drop) {
2 if (!Char->GetStack()->GetItems()) {
3 ADD_MESSAGE("You have nothing to drop!");
4 return false;
6 truth Success = false;
7 stack::SetSelected(0);
8 for (;;) {
9 itemvector ToDrop;
10 game::DrawEverythingNoBlit();
11 Char->GetStack()->DrawContents(ToDrop, Char, CONST_S("What do you want to drop?"), REMEMBER_SELECTED);
12 if (ToDrop.empty()) break;
13 if (game::IsInWilderness()) {
14 for (uInt c = 0; c < ToDrop.size(); ++c) {
15 if (game::TruthQuestion(CONST_S("Are you sure? You will never see ")+ToDrop[c]->CHAR_NAME(DEFINITE)+" again! [y/N]")) {
16 ADD_MESSAGE("You drop %s.", ToDrop[c]->CHAR_NAME(DEFINITE));
17 ToDrop[c]->RemoveFromSlot();
18 ToDrop[c]->SendToHell();
21 } else if (!Char->GetRoom() || Char->GetRoom()->DropItem(Char, ToDrop[0], ToDrop.size())) {
22 ADD_MESSAGE("%s dropped.", ToDrop[0]->GetName(INDEFINITE, ToDrop.size()).CStr());
23 for (uInt c = 0; c < ToDrop.size(); ++c) ToDrop[c]->MoveTo(Char->GetStackUnder());
24 Success = true;
27 if (Success) {
28 Char->DexterityAction(2);
29 return true;
31 return false;