the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 69 lines 1.1 kB view raw
1#include "stdafx.h" 2 3#include "DoorInfo.h" 4 5DoorInfo::DoorInfo(int x, int y, int z, int insideDx, int insideDy, int timeStamp) : x(x), y(y), z(z), insideDx(insideDx), insideDz(insideDy) 6{ 7 removed = false; 8 bookings = 0; 9 10 this->timeStamp = timeStamp; 11} 12 13int DoorInfo::distanceTo(int x2, int y2, int z2) 14{ 15 return (int) sqrt((float)distanceToSqr(x2, y2, z2)); 16} 17 18int DoorInfo::distanceToSqr(int x2, int y2, int z2) 19{ 20 int dx = x2 - x; 21 int dy = y2 - y; 22 int dz = z2 - z; 23 return dx * dx + dy * dy + dz * dz; 24} 25 26int DoorInfo::distanceToInsideSqr(int x2, int y2, int z2) 27{ 28 int dx = x2 - x - insideDx; 29 int dy = y2 - y; 30 int dz = z2 - z - insideDz; 31 return dx * dx + dy * dy + dz * dz; 32} 33 34int DoorInfo::getIndoorX() 35{ 36 return x + insideDx; 37} 38 39int DoorInfo::getIndoorY() 40{ 41 return y; 42} 43 44int DoorInfo::getIndoorZ() 45{ 46 return z + insideDz; 47} 48 49bool DoorInfo::isInsideSide(int testX, int testZ) 50{ 51 int vdx = testX - x; 52 int vdz = testZ - z; 53 return vdx * insideDx + vdz * insideDz >= 0; 54} 55 56void DoorInfo::resetBookingCount() 57{ 58 bookings = 0; 59} 60 61void DoorInfo::incBookingCount() 62{ 63 ++bookings; 64} 65 66int DoorInfo::getBookingsCount() 67{ 68 return bookings; 69}