Moved the snapToBase() utility function to region.*pp

I've also adjusted the TODO file, which really shouldn't be committed.
Still, it's there now, so it stays. I don't think the logger is going to
be possible any time soon, so I'll probably look into the disconnection
handler.
This commit is contained in:
Kayne Ruse
2014-08-24 13:23:50 +10:00
parent af8e7b70a0
commit 4ed512e0e2
9 changed files with 9 additions and 31 deletions
+4 -2
View File
@@ -21,11 +21,13 @@
*/
#include "region.hpp"
#include "utility.hpp"
#include <stdexcept>
#include <cstring>
int snapToBase(int base, int x) {
return floor((double)x / base) * base;
}
Region::Region(int argX, int argY): x(argX), y(argY) {
if (x != snapToBase(REGION_WIDTH, x) || y != snapToBase(REGION_HEIGHT, y)) {
throw(std::invalid_argument("Region location is off grid"));