Navigation Menu

Skip to content

Commit

Permalink
Fix a few small issues
Browse files Browse the repository at this point in the history
closes #58
  • Loading branch information
sfan5 committed Oct 20, 2018
1 parent 657499e commit b2406db
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
10 changes: 5 additions & 5 deletions TileGenerator.cpp
Expand Up @@ -269,7 +269,7 @@ void TileGenerator::parseColorsStream(std::istream &in)
if(strlen(line) == 0)
continue;

char name[64];
char name[64 + 1];
unsigned int r, g, b, a, t;
a = 255;
t = 0;
Expand Down Expand Up @@ -536,7 +536,7 @@ void TileGenerator::renderScale()
if (m_scales & SCALE_TOP) {
m_image->drawText(24, 0, "X", m_scaleColor);
for (int i = (m_xMin / 4) * 4; i <= m_xMax; i += 4) {
stringstream buf;
std::ostringstream buf;
buf << i * 16;

int xPos = getImageX(i * 16, true);
Expand All @@ -550,7 +550,7 @@ void TileGenerator::renderScale()
if (m_scales & SCALE_LEFT) {
m_image->drawText(2, 24, "Z", m_scaleColor);
for (int i = (m_zMax / 4) * 4; i >= m_zMin; i -= 4) {
stringstream buf;
std::ostringstream buf;
buf << i * 16;

int yPos = getImageY(i * 16 + 1, true);
Expand All @@ -566,7 +566,7 @@ void TileGenerator::renderScale()
yPos = m_yBorder + m_mapHeight*m_zoom + scale_d - 12;
m_image->drawText(xPos, yPos, "X", m_scaleColor);
for (int i = (m_xMin / 4) * 4; i <= m_xMax; i += 4) {
stringstream buf;
std::ostringstream buf;
buf << i * 16;

xPos = getImageX(i * 16, true);
Expand All @@ -583,7 +583,7 @@ void TileGenerator::renderScale()
yPos = m_yBorder + m_mapHeight*m_zoom - 24 - 12;
m_image->drawText(xPos, yPos, "Z", m_scaleColor);
for (int i = (m_zMax / 4) * 4; i >= m_zMin; i -= 4) {
stringstream buf;
std::ostringstream buf;
buf << i * 16;

xPos = m_xBorder + m_mapWidth*m_zoom;
Expand Down
18 changes: 6 additions & 12 deletions include/db.h
Expand Up @@ -20,24 +20,18 @@ class BlockPos {
BlockPos(int16_t x, int16_t y, int16_t z) : x(x), y(y), z(z) {}
bool operator < (const BlockPos &p) const
{
if (z > p.z) {
if (z > p.z)
return true;
}
if (z < p.z) {
if (z < p.z)
return false;
}
if (y > p.y) {
if (y > p.y)
return true;
}
if (y < p.y) {
if (y < p.y)
return false;
}
if (x > p.x) {
if (x > p.x)
return true;
}
if (x < p.x) {
if (x < p.x)
return false;
}
return false;
}
};
Expand Down
12 changes: 4 additions & 8 deletions mapper.cpp
Expand Up @@ -147,24 +147,21 @@ int main(int argc, char *argv[])
generator.setBackend(optarg);
break;
case 'a': {
std::istringstream iss;
iss.str(optarg);
std::istringstream iss(optarg);
int miny;
iss >> miny;
generator.setMinY(miny);
}
break;
case 'c': {
std::istringstream iss;
iss.str(optarg);
std::istringstream iss(optarg);
int maxy;
iss >> maxy;
generator.setMaxY(maxy);
}
break;
case 'g': {
std::istringstream geometry;
geometry.str(optarg);
std::istringstream geometry(optarg);
int x, y, w, h;
char c;
geometry >> x >> c >> y >> w >> h;
Expand All @@ -189,8 +186,7 @@ int main(int argc, char *argv[])
}
break;
case 'z': {
std::istringstream iss;
iss.str(optarg);
std::istringstream iss(optarg);
int zoom;
iss >> zoom;
generator.setZoom(zoom);
Expand Down

0 comments on commit b2406db

Please sign in to comment.