Fix a few small issues

closes #58
This commit is contained in:
sfan5 2018-10-20 23:01:03 +02:00
parent 657499e981
commit b2406db169
3 changed files with 15 additions and 25 deletions

@ -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;
@ -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);
@ -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);
@ -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);
@ -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;

@ -20,24 +20,18 @@ public:
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;
}
};

@ -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;
@ -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);