This hack for the collision map was a terrible idea
I'm committing these changes before undoing these, and coding it properly.
This commit is contained in:
@@ -30,11 +30,11 @@ 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"));
|
||||
}
|
||||
memset(tiles, 0, REGION_WIDTH*REGION_HEIGHT*REGION_DEPTH*sizeof(type_t));
|
||||
memset(tiles, 0, REGION_WIDTH*REGION_HEIGHT*(REGION_DEPTH+1)*sizeof(type_t));
|
||||
}
|
||||
|
||||
Region::Region(Region const& rhs): x(rhs.x), y(rhs.y) {
|
||||
memcpy(tiles, rhs.tiles, REGION_WIDTH*REGION_HEIGHT*REGION_DEPTH*sizeof(type_t));
|
||||
memcpy(tiles, rhs.tiles, REGION_WIDTH*REGION_HEIGHT*(REGION_DEPTH+1)*sizeof(type_t));
|
||||
}
|
||||
|
||||
Region::type_t Region::SetTile(int x, int y, int z, type_t v) {
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
#ifndef REGION_HPP_
|
||||
#define REGION_HPP_
|
||||
|
||||
constexpr int REGION_WIDTH = 20;
|
||||
constexpr int REGION_HEIGHT = 20;
|
||||
constexpr int REGION_WIDTH = 21;
|
||||
constexpr int REGION_HEIGHT = 21;
|
||||
constexpr int REGION_DEPTH = 3;
|
||||
|
||||
class Region {
|
||||
@@ -45,7 +45,7 @@ private:
|
||||
const int x;
|
||||
const int y;
|
||||
|
||||
type_t tiles[REGION_WIDTH][REGION_HEIGHT][REGION_DEPTH];
|
||||
type_t tiles[REGION_WIDTH][REGION_HEIGHT][REGION_DEPTH+1];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -85,6 +85,7 @@ static int onUnload(lua_State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//TODO: wrappers for the collision map
|
||||
static const luaL_Reg regionLib[] = {
|
||||
{"SetTile",setTile},
|
||||
{"GetTile",getTile},
|
||||
|
||||
Reference in New Issue
Block a user