mirror of
https://github.com/minetest/minetestmapper.git
synced 2025-06-28 14:46:01 +02:00
General code cleanups/maintenance
This commit is contained in:
@ -2,13 +2,16 @@
|
||||
|
||||
#include <climits>
|
||||
#include <cstdint>
|
||||
#include "config.h"
|
||||
|
||||
#define BLOCK_SIZE 16
|
||||
|
||||
struct PixelAttribute {
|
||||
PixelAttribute(): height(INT16_MIN), thickness(0) {};
|
||||
PixelAttribute() : height(INT16_MIN), thickness(0) {};
|
||||
|
||||
int16_t height;
|
||||
uint8_t thickness;
|
||||
inline bool valid_height() {
|
||||
|
||||
inline bool valid_height() const {
|
||||
return height != INT16_MIN;
|
||||
}
|
||||
};
|
||||
@ -18,8 +21,10 @@ class PixelAttributes
|
||||
public:
|
||||
PixelAttributes();
|
||||
virtual ~PixelAttributes();
|
||||
|
||||
void setWidth(int width);
|
||||
void scroll();
|
||||
|
||||
inline PixelAttribute &attribute(int z, int x) {
|
||||
return m_pixelAttributes[z + 1][x + 1];
|
||||
};
|
||||
|
@ -6,7 +6,7 @@
|
||||
struct Player
|
||||
{
|
||||
std::string name;
|
||||
double x, y, z;
|
||||
float x, y, z;
|
||||
};
|
||||
|
||||
class PlayerAttributes
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
@ -66,7 +65,6 @@ class TileGenerator
|
||||
{
|
||||
private:
|
||||
typedef std::unordered_map<std::string, ColorEntry> ColorMap;
|
||||
typedef std::unordered_set<std::string> NameSet;
|
||||
|
||||
public:
|
||||
TileGenerator();
|
||||
@ -154,7 +152,7 @@ private:
|
||||
ColorMap m_colorMap;
|
||||
BitmapThing m_readPixels;
|
||||
BitmapThing m_readInfo;
|
||||
NameSet m_unknownNodes;
|
||||
std::set<std::string> m_unknownNodes;
|
||||
Color m_color[16][16];
|
||||
uint8_t m_thickness[16][16];
|
||||
|
||||
|
@ -16,6 +16,5 @@ public:
|
||||
|
||||
private:
|
||||
const u8 *m_data;
|
||||
size_t m_seekPos;
|
||||
size_t m_size;
|
||||
size_t m_seekPos, m_size;
|
||||
};
|
||||
|
@ -4,8 +4,6 @@
|
||||
#define PATH_SEPARATOR '/'
|
||||
#endif
|
||||
|
||||
#define BLOCK_SIZE 16
|
||||
|
||||
#ifdef USE_CMAKE_CONFIG_H
|
||||
#include "cmake_config.h"
|
||||
#else
|
||||
|
@ -21,7 +21,7 @@ protected:
|
||||
PGresult *execPrepared(
|
||||
const char *stmtName, const int paramsNumber,
|
||||
const void **params,
|
||||
const int *paramsLengths = NULL, const int *paramsFormats = NULL,
|
||||
const int *paramsLengths = nullptr, const int *paramsFormats = nullptr,
|
||||
bool clear = true
|
||||
);
|
||||
int pg_binary_to_int(PGresult *res, int row, int col);
|
||||
|
@ -1,7 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
template<typename T>
|
||||
static inline T mymax(T a, T b)
|
||||
{
|
||||
return (a > b) ? a : b;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static inline T mymin(T a, T b)
|
||||
{
|
||||
return (a > b) ? b : a;
|
||||
}
|
||||
|
||||
std::string read_setting(const std::string &name, std::istream &is);
|
||||
|
||||
|
Reference in New Issue
Block a user