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"));
+3
View File
@@ -33,6 +33,9 @@ constexpr int REGION_DEPTH = 3;
//the size of the solid map
constexpr int REGION_SOLID_FOOTPRINT = ceil(REGION_WIDTH * REGION_HEIGHT / 8.0);
//utility function
int snapToBase(int base, int x);
class Region {
public:
typedef unsigned char type_t;
-2
View File
@@ -24,8 +24,6 @@
#include "region_pager_lua.hpp"
#include "region.hpp"
#include <string>
//DOCS: These glue functions simply wrap RegionPagerLua's methods
static int setTile(lua_State* L) {
-2
View File
@@ -21,8 +21,6 @@
*/
#include "region_pager_base.hpp"
#include "utility.hpp"
#include <stdexcept>
#include <algorithm>
-2
View File
@@ -21,8 +21,6 @@
*/
#include "region_pager_lua.hpp"
#include "utility.hpp"
#include <stdexcept>
//TODO: Could I push the pager to the API functions too?
-13
View File
@@ -23,19 +23,6 @@
#include <algorithm>
int snapToBase(int base, int x) {
//snap to a grid
if (x < 0) {
++x;
return x / base * base - base;
}
return x / base * base;
}
double snapToBase(double base, double x) {
return floor(x / base) * base;
}
std::string truncatePath(std::string pathname) {
return std::string(
std::find_if(
-3
View File
@@ -24,9 +24,6 @@
#include <string>
int snapToBase(int base, int x);
double snapToBase(double base, double x);
std::string truncatePath(std::string pathname);
//fixing known bugs in g++
+1 -6
View File
@@ -3,11 +3,6 @@
#MKDIR=mkdir
#RM=del /y
#CXXFLAGS+=-static-libgcc -static-libstdc++ -g -fno-inline-functions -Wall
#CXXFLAGS+=-static-libgcc -static-libstdc++
#export
OUTDIR=out
all: $(OUTDIR)
@@ -23,7 +18,7 @@ release: clean all package
#For use on my machine ONLY
package:
rar a -r -ep Tortuga.rar out/*.exe out/*.dll
rar a -r -ep Tortuga.rar $(OUTDIR)/*.exe $(OUTDIR)/*.dll
rar a -r Tortuga.rar rsc/* copyright.txt
$(OUTDIR):
+1 -1
View File
@@ -1,5 +1,4 @@
TODO: encapsulate the data structures
TODO: A proper logging system
TODO: Ping-pong and keep alive system
TODO: Move the statistics into their own SQL table, instead of duplicating the structure a dozen times
TODO: Get the rooms working, even if only via hotkeys
@@ -12,3 +11,4 @@ TODO: server is slaved to the client
TODO: Time delay for requesting region packets
TODO: command line parameters overriding config.cfg settings
TODO: A proper logging system