From fb26d2ba870f63deb5515521ecf5ce0c35780a2b Mon Sep 17 00:00:00 2001 From: daniel0916 Date: Mon, 14 Apr 2014 11:56:50 +0200 Subject: Fixed Bookshelf Checking Code by LO1ZB --- src/UI/SlotArea.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/UI') diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp index 673c036b6..23108c256 100644 --- a/src/UI/SlotArea.cpp +++ b/src/UI/SlotArea.cpp @@ -659,29 +659,31 @@ void cSlotAreaEnchanting::ClickedResult(cPlayer & a_Player) cEnchantingWindow * Window = (cEnchantingWindow*)&m_ParentWindow; Window->GetBlockPos(PosX, PosY, PosZ); + int bookshelves = 0; cBlockArea Area; Area.Read(a_Player.GetWorld(), PosX - 2, PosX + 2, PosY, PosY + 1, PosZ - 2, PosZ + 2); - for (int x = 0; x < 6; x++) + for (int y = 0; y <= 2; y++) { - for (int y = 0; y < 3; y++) + for (int x = 0; x <= 4; x++) { - for (int z = 0; z < 6; z++) + for (int z = 0; z <= 4; z++) { - if ((((x == 0) || (x == 5)) || ((z == 0) || (z == 5))) && ((y == 0) || y == 1)) + if ((((x == 0) || (x == 4)) || ((z == 0) || (z == 4))) && ((y == 0) || y == 1)) { - LOG("%i", Area.GetRelBlockType(x, y, z)); - if (Area.GetRelBlockType(x, y, z) == E_BLOCK_BOOKCASE) { - LOG("BookShelf"); + bookshelves++; } } } } } - int bookshelves = 15; // TODO: Check Bookshelves + if (bookshelves > 15) + { + bookshelves = 15; + } cFastRandom Random; int base = (Random.GenerateRandomInteger(1, 8) + floor(bookshelves / 2) + Random.GenerateRandomInteger(0, bookshelves)); -- cgit v1.2.3