Enchanting
#89
@xoft
What is wrong with this code?
int Bookshelves = 0;
	cBlockArea Area;
	Area.Read(a_World, PosX - 2, PosX + 2, PosY, PosY + 1, PosZ - 2, PosZ + 2);

	static const struct
	{
		int m_BookX, m_BookY, m_BookZ;  // Coords to check for bookcases
		int m_AirX, m_AirY, m_AirZ;  // Coords to check for air; if not air, the bookcase won't be counted
	} CheckCoords[] =
	{
		{ -2, 0, -2, -1, 0, -1 },  // Bookcase at {-2, 0, -2}, air at {-1, 0, -1}
		{ -1, 0, -2, -1, 0, -1 },  // Bookcase at {-1, 0, -2}, air at {-1, 0, -1}
		{ 0, 0, -2, 0, 0, -1 },    // Bookcase at {0, 0, -2}, air at {0, 0, -1}
		{ 1, 0, -2, 1, 0, -1 },    // Bookcase at {1, 0, -2}, air at {1, 0, -1}
		{ 2, 0, -2, 1, 0, -1 },    // Bookcase at {2, 0, -2}, air at {1, 0, -1}
		{ 2, 0, -1, 1, 0, -1 },    // Bookcase at {2, 0, -1}, air at {1, 0, -1}
		{ 2, 0, 0, 1, 0, 0 },      // Bookcase at {2, 0, 0}, air at {1, 0, 0}
		{ 2, 0, 1, 1, 0, 1 },      // Bookcase at {2, 0, 1}, air at {1, 0, 1}
		{ 2, 0, 2, 1, 0, 1 },      // Bookcase at {2, 0, 2}, air at {1, 0, 1}
		{ 1, 0, 2, 1, 0, 1 },      // Bookcase at {1, 0, 2}, air at {1, 0, 1}
		{ 0, 0, 2, 0, 0, 1 },      // Bookcase at {0, 0, 2}, air at {0, 0, 1}
		{ -1, 0, 2, -1, 0, 1 },    // Bookcase at {-1, 0, 2}, air at {-1, 0, 1}
		{ -2, 0, 2, -1, 0, 1 },    // Bookcase at {-2, 0, 2}, air at {-1, 0, 1}
		{ -2, 0, 1, -1, 0, 1 },    // Bookcase at {-2, 0, 1}, air at {-1, 0, 1}
		{ -2, 0, 0, -1, 0, 0 },    // Bookcase at {-2, 0, 0}, air at {-1, 0, 0}
		{ -2, 0, -1, -1, 0, -1 },   // Bookcase at {-2, 0, -1}, air at {-1, 0, -1}

		{ -2, 1, -2, -1, 1, -1 },  // Bookcase at {-2, 1, -2}, air at {-1, 1, -1}
		{ -1, 1, -2, -1, 1, -1 },  // Bookcase at {-1, 1, -2}, air at {-1, 1, -1}
		{ 0, 1, -2, 0, 1, -1 },    // Bookcase at {0, 1, -2}, air at {0, 1, -1}
		{ 1, 1, -2, 1, 1, -1 },    // Bookcase at {1, 1, -2}, air at {1, 1, -1}
		{ 2, 1, -2, 1, 1, -1 },    // Bookcase at {2, 1, -2}, air at {1, 1, -1}
		{ 2, 1, -1, 1, 1, -1 },    // Bookcase at {2, 1, -1}, air at {1, 1, -1}
		{ 2, 1, 0, 1, 1, 0 },      // Bookcase at {2, 1, 0}, air at {1, 1, 0}
		{ 2, 1, 1, 1, 1, 1 },      // Bookcase at {2, 1, 1}, air at {1, 1, 1}
		{ 2, 1, 2, 1, 1, 1 },      // Bookcase at {2, 1, 2}, air at {1, 1, 1}
		{ 1, 1, 2, 1, 1, 1 },      // Bookcase at {1, 1, 2}, air at {1, 1, 1}
		{ 0, 1, 2, 0, 1, 1 },      // Bookcase at {0, 1, 2}, air at {0, 1, 1}
		{ -1, 1, 2, -1, 1, 1 },    // Bookcase at {-1, 1, 2}, air at {-1, 1, 1}
		{ -2, 1, 2, -1, 1, 1 },    // Bookcase at {-2, 1, 2}, air at {-1, 1, 1}
		{ -2, 1, 1, -1, 1, 1 },    // Bookcase at {-2, 1, 1}, air at {-1, 1, 1}
		{ -2, 1, 0, -1, 1, 0 },    // Bookcase at {-2, 1, 0}, air at {-1, 1, 0}
		{ -2, 1, -1, -1, 1, -1 }   // Bookcase at {-2, 1, -1}, air at {-1, 1, -1}
	};

	for (size_t i = 0; i < ARRAYCOUNT(CheckCoords); i++)
	{
		if (
			(Area.GetRelBlockType(CheckCoords[i].m_AirX, CheckCoords[i].m_AirY, CheckCoords[i].m_AirZ) == E_BLOCK_AIR) &&  // There's air in the checkspot
			(Area.GetRelBlockType(CheckCoords[i].m_BookX, CheckCoords[i].m_BookY, CheckCoords[i].m_BookZ) == E_BLOCK_BOOKCASE)  // There's bookcase in the wanted place
			)
		{
			Bookshelves++;
			cRoot::Get()->BroadcastChat("Bookshelf");
		}
	}  // for i - CheckCoords
Reply
Thanks given by:


Messages In This Thread
Enchanting - by daniel0916 - 01-19-2014, 09:05 PM
RE: Enchanting - by NiLSPACE - 01-19-2014, 09:17 PM
RE: Enchanting - by daniel0916 - 01-19-2014, 09:39 PM
RE: Enchanting - by tonibm19 - 01-20-2014, 12:07 AM
RE: Enchanting - by xoft - 01-20-2014, 12:16 AM
RE: Enchanting - by daniel0916 - 01-20-2014, 02:03 AM
RE: Enchanting - by tonibm19 - 01-20-2014, 03:05 AM
RE: Enchanting - by daniel0916 - 01-20-2014, 03:30 AM
RE: Enchanting - by daniel0916 - 01-20-2014, 05:45 AM
RE: Enchanting - by tonibm19 - 01-20-2014, 06:02 AM
RE: Enchanting - by daniel0916 - 01-21-2014, 12:35 AM
RE: Enchanting - by tonibm19 - 01-21-2014, 01:58 AM
RE: Enchanting - by daniel0916 - 01-21-2014, 02:05 AM
RE: Enchanting - by tonibm19 - 01-21-2014, 02:53 AM
RE: Enchanting - by NiLSPACE - 01-21-2014, 02:58 AM
RE: Enchanting - by ThuGie - 01-21-2014, 03:03 AM
RE: Enchanting - by daniel0916 - 01-21-2014, 03:24 AM
RE: Enchanting - by ThuGie - 01-21-2014, 03:38 AM
RE: Enchanting - by daniel0916 - 01-21-2014, 03:43 AM
RE: Enchanting - by tonibm19 - 01-21-2014, 03:43 AM
RE: Enchanting - by ThuGie - 01-21-2014, 03:47 AM
RE: Enchanting - by daniel0916 - 01-21-2014, 03:56 AM
RE: Enchanting - by ThuGie - 01-21-2014, 04:02 AM
RE: Enchanting - by daniel0916 - 01-21-2014, 04:16 AM
RE: Enchanting - by ThuGie - 01-21-2014, 04:21 AM
RE: Enchanting - by daniel0916 - 01-21-2014, 04:27 AM
RE: Enchanting - by bearbin - 01-21-2014, 05:04 AM
RE: Enchanting - by daniel0916 - 01-21-2014, 05:15 AM
RE: Enchanting - by tigerw - 01-21-2014, 09:17 AM
RE: Enchanting - by daniel0916 - 01-21-2014, 10:57 PM
RE: Enchanting - by xoft - 01-22-2014, 12:54 AM
RE: Enchanting - by daniel0916 - 01-22-2014, 01:29 AM
RE: Enchanting - by xoft - 01-22-2014, 07:27 AM
RE: Enchanting - by daniel0916 - 01-22-2014, 08:03 AM
RE: Enchanting - by xoft - 01-22-2014, 08:05 AM
RE: Enchanting - by daniel0916 - 01-23-2014, 12:59 AM
RE: Enchanting - by xoft - 01-26-2014, 04:08 AM
RE: Enchanting - by daniel0916 - 01-26-2014, 06:23 AM
RE: Enchanting - by xoft - 01-26-2014, 07:51 AM
RE: Enchanting - by daniel0916 - 01-26-2014, 05:58 PM
RE: Enchanting - by xoft - 01-26-2014, 08:58 PM
RE: Enchanting - by daniel0916 - 01-26-2014, 11:23 PM
RE: Enchanting - by daniel0916 - 01-26-2014, 10:10 PM
RE: Enchanting - by xoft - 01-27-2014, 01:58 AM
RE: Enchanting - by daniel0916 - 01-27-2014, 05:06 AM
RE: Enchanting - by xoft - 01-27-2014, 05:39 AM
RE: Enchanting - by daniel0916 - 01-27-2014, 05:52 AM
RE: Enchanting - by tigerw - 01-27-2014, 06:51 AM
RE: Enchanting - by daniel0916 - 01-28-2014, 05:38 AM
RE: Enchanting - by xoft - 01-28-2014, 05:55 AM
RE: Enchanting - by daniel0916 - 01-28-2014, 06:14 AM
RE: Enchanting - by xoft - 01-28-2014, 06:41 AM
RE: Enchanting - by daniel0916 - 01-31-2014, 12:04 AM
RE: Enchanting - by daniel0916 - 02-01-2014, 03:14 AM
RE: Enchanting - by tigerw - 02-01-2014, 04:11 AM
RE: Enchanting - by NiLSPACE - 02-01-2014, 04:13 AM
RE: Enchanting - by daniel0916 - 02-01-2014, 04:48 AM
RE: Enchanting - by ThuGie - 02-01-2014, 05:10 AM
RE: Enchanting - by daniel0916 - 02-01-2014, 07:48 AM
RE: Enchanting - by ThuGie - 02-01-2014, 11:38 AM
RE: Enchanting - by daniel0916 - 02-01-2014, 05:17 PM
RE: Enchanting - by ThuGie - 02-01-2014, 08:36 PM
RE: Enchanting - by daniel0916 - 04-08-2014, 04:35 AM
RE: Enchanting - by tonibm19 - 04-08-2014, 04:39 AM
RE: Enchanting - by bearbin - 04-08-2014, 04:48 AM
RE: Enchanting - by daniel0916 - 04-09-2014, 12:23 AM
RE: Enchanting - by daniel0916 - 04-12-2014, 10:48 PM
RE: Enchanting - by NiLSPACE - 04-12-2014, 10:53 PM
RE: Enchanting - by xoft - 04-12-2014, 10:55 PM
RE: Enchanting - by daniel0916 - 04-12-2014, 11:06 PM
RE: Enchanting - by LO1ZB - 04-12-2014, 11:45 PM
RE: Enchanting - by LO1ZB - 04-12-2014, 11:28 PM
RE: Enchanting - by daniel0916 - 04-12-2014, 11:35 PM
RE: Enchanting - by daniel0916 - 04-12-2014, 11:59 PM
RE: Enchanting - by LO1ZB - 04-13-2014, 12:13 AM
RE: Enchanting - by daniel0916 - 04-13-2014, 12:28 AM
RE: Enchanting - by LO1ZB - 04-13-2014, 12:39 AM
RE: Enchanting - by daniel0916 - 04-13-2014, 02:03 AM
RE: Enchanting - by LO1ZB - 04-13-2014, 02:40 AM
RE: Enchanting - by daniel0916 - 04-13-2014, 02:53 AM
RE: Enchanting - by tonibm19 - 04-13-2014, 04:55 AM
RE: Enchanting - by daniel0916 - 04-13-2014, 06:15 AM
RE: Enchanting - by daniel0916 - 04-13-2014, 09:37 PM
RE: Enchanting - by daniel0916 - 04-14-2014, 01:42 AM
RE: Enchanting - by xoft - 04-14-2014, 01:52 AM
RE: Enchanting - by daniel0916 - 04-14-2014, 06:12 AM
RE: Enchanting - by daniel0916 - 04-15-2014, 01:01 AM
RE: Enchanting - by daniel0916 - 04-16-2014, 10:05 PM
RE: Enchanting - by daniel0916 - 04-17-2014, 05:11 AM
RE: Enchanting - by NiLSPACE - 04-17-2014, 05:31 AM
RE: Enchanting - by xoft - 04-17-2014, 05:43 AM
RE: Enchanting - by daniel0916 - 04-17-2014, 05:59 AM
RE: Enchanting - by xoft - 04-17-2014, 03:09 PM
RE: Enchanting - by daniel0916 - 04-18-2014, 10:51 PM
RE: Enchanting - by daniel0916 - 04-19-2014, 07:36 PM
RE: Enchanting - by xoft - 04-19-2014, 09:17 PM
RE: Enchanting - by daniel0916 - 04-19-2014, 09:36 PM
RE: Enchanting - by xoft - 04-19-2014, 10:51 PM
RE: Enchanting - by daniel0916 - 04-19-2014, 11:07 PM
RE: Enchanting - by daniel0916 - 04-25-2014, 11:02 PM
RE: Enchanting - by SamJBarney - 04-26-2014, 04:31 AM
RE: Enchanting - by daniel0916 - 04-26-2014, 04:36 AM
RE: Enchanting - by tigerw - 04-26-2014, 06:33 AM
RE: Enchanting - by xoft - 04-26-2014, 07:00 AM
RE: Enchanting - by SamJBarney - 04-26-2014, 11:25 AM
RE: Enchanting - by daniel0916 - 04-27-2014, 12:16 AM
RE: Enchanting - by tigerw - 04-27-2014, 07:34 AM
RE: Enchanting - by daniel0916 - 04-28-2014, 03:34 AM
RE: Enchanting - by xoft - 04-28-2014, 07:25 AM
RE: Enchanting - by tonibm19 - 06-18-2014, 12:49 AM



Users browsing this thread: 31 Guest(s)