cosmetix
[k8-i-v-a-n.git] / src / game / commands / Read.cpp
blobc04585bbf1bfadba1c27f56d2fe8799cac946253
1 COMMAND(Read) {
2 if (!Char->CanRead() && !game::GetSeeWholeMapCheatMode()) {
3 ADD_MESSAGE("You can't read.");
4 return false;
6 if (!Char->GetStack()->SortedItems(Char, &item::IsReadable)) {
7 ADD_MESSAGE("You have nothing to read!");
8 return false;
10 if (Char->GetLSquareUnder()->IsDark() && !game::GetSeeWholeMapCheatMode()) {
11 ADD_MESSAGE("It is too dark to read.");
12 return false;
14 item *Item = Char->GetStack()->DrawContents(Char, CONST_S("What do you want to read?"), 0, &item::IsReadable);
15 if (Item) {
16 if (ivanconfig::GetConfirmScrollReading() && Item->IsScroll()) {
17 if (!game::TruthQuestion(festring("Do you really want to read ")+Item->CHAR_NAME(DEFINITE)+"? [y/n]")) return false;
19 return Char->ReadItem(Item);
21 return false;