Tested RegionPager, removed trace statements, fixed logic errors
This commit is contained in:
@@ -21,14 +21,10 @@
|
||||
*/
|
||||
#include "map_file_format.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
void MapFileFormat::Load(Region** const ptr, int x, int y) {
|
||||
//TODO
|
||||
std::cout << "Load" << std::endl;
|
||||
}
|
||||
|
||||
void MapFileFormat::Save(Region* const ptr) {
|
||||
//TODO
|
||||
std::cout << "Save" << std::endl;
|
||||
}
|
||||
|
||||
@@ -21,14 +21,10 @@
|
||||
*/
|
||||
#include "map_generator.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
void MapGenerator::Create(Region** const ptr, int width, int height, int depth, int x, int y) {
|
||||
(*ptr) = new Region(width, height, depth, x, y);
|
||||
std::cout << "Create" << std::endl;
|
||||
}
|
||||
|
||||
void MapGenerator::Unload(Region* const ptr) {
|
||||
delete ptr;
|
||||
std::cout << "Unload" << std::endl;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
*/
|
||||
#include "region.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
Region::Region(int argWidth, int argHeight, int argDepth, int argX, int argY):
|
||||
width(argWidth),
|
||||
height(argHeight),
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
RegionPagerBase::RegionPagerBase(int argWidth, int argHeight, int argDepth):
|
||||
regionWidth(argWidth),
|
||||
regionHeight(argHeight),
|
||||
@@ -34,18 +32,17 @@ RegionPagerBase::RegionPagerBase(int argWidth, int argHeight, int argDepth):
|
||||
}
|
||||
|
||||
RegionPagerBase::~RegionPagerBase() {
|
||||
std::cout << "final size: " << regionList.size() << std::endl;
|
||||
//EMPTY
|
||||
}
|
||||
|
||||
int RegionPagerBase::SetTile(int x, int y, int z, int v) {
|
||||
Region* ptr = GetRegion(x, y);
|
||||
return ptr->SetTile(x - ptr->GetX(), y = ptr->GetY(), z, v);
|
||||
return ptr->SetTile(x - ptr->GetX(), y - ptr->GetY(), z, v);
|
||||
}
|
||||
|
||||
int RegionPagerBase::GetTile(int x, int y, int z) {
|
||||
Region* ptr = GetRegion(x, y);
|
||||
return ptr->GetTile(x - ptr->GetX(), y = ptr->GetY(), z);
|
||||
return ptr->GetTile(x - ptr->GetX(), y - ptr->GetY(), z);
|
||||
}
|
||||
|
||||
Region* RegionPagerBase::GetRegion(int x, int y) {
|
||||
|
||||
+2
-2
@@ -27,9 +27,9 @@ int snapToBase(int base, int x) {
|
||||
//snap to a grid
|
||||
if (x < 0) {
|
||||
x++;
|
||||
return x - x % base - base;
|
||||
return x / base * base - base;
|
||||
}
|
||||
return x - x % base;
|
||||
return x / base * base;
|
||||
}
|
||||
|
||||
std::string truncatePath(std::string pathname) {
|
||||
|
||||
Reference in New Issue
Block a user