#endif
#endif
+#define S8_MIN (-0x7F - 1)
+#define S16_MIN (-0x7FFF - 1)
+#define S32_MIN (-0x7FFFFFFF - 1)
+#define S64_MIN (-0x7FFFFFFFFFFFFFFF - 1)
+
+#define S8_MAX 0x7F
+#define S16_MAX 0x7FFF
+#define S32_MAX 0x7FFFFFFF
+#define S64_MAX 0x7FFFFFFFFFFFFFFF
+
+#define U8_MAX 0xFF
+#define U16_MAX 0xFFFF
+#define U32_MAX 0xFFFFFFFF
+#define U64_MAX 0xFFFFFFFFFFFFFFFF
+
#endif
beginSave();
// If there is no practical limit, we spare creation of mapblock_queue
- if (max_loaded_blocks == (u32)-1) {
+ if (max_loaded_blocks == U32_MAX) {
for (std::map<v2s16, MapSector*>::iterator si = m_sectors.begin();
si != m_sectors.end(); ++si) {
MapSector *sector = si->second;
settings.setU64("seed", seed);
settings.setS16("water_level", water_level);
settings.setS16("chunksize", chunksize);
- settings.setFlagStr("mg_flags", flags, flagdesc_mapgen, (u32)-1);
+ settings.setFlagStr("mg_flags", flags, flagdesc_mapgen, U32_MAX);
settings.setNoiseParams("mg_biome_np_heat", np_biome_heat);
settings.setNoiseParams("mg_biome_np_heat_blend", np_biome_heat_blend);
settings.setNoiseParams("mg_biome_np_humidity", np_biome_humidity);
void MapgenV5Params::writeParams(Settings *settings) const
{
- settings->setFlagStr("mgv5_spflags", spflags, flagdesc_mapgen_v5, (u32)-1);
+ settings->setFlagStr("mgv5_spflags", spflags, flagdesc_mapgen_v5, U32_MAX);
settings->setNoiseParams("mgv5_np_filler_depth", np_filler_depth);
settings->setNoiseParams("mgv5_np_factor", np_factor);
// If there is air or water above enable top/filler placement, otherwise force
// nplaced to stone level by setting a number exceeding any possible filler depth.
- u16 nplaced = (air_above || water_above) ? 0 : (u16)-1;
+ u16 nplaced = (air_above || water_above) ? 0 : U16_MAX;
for (s16 y = node_max.Y; y >= node_min.Y; y--) {
content_t c = vm->m_data[vi].getContent();
// This is done by aborting the cycle of top/filler placement
// immediately by forcing nplaced to stone level.
if (c_below == CONTENT_AIR || c_below == c_water_source)
- nplaced = (u16)-1;
+ nplaced = U16_MAX;
if (nplaced < depth_top) {
vm->m_data[vi] = MapNode(biome->c_top);
air_above = true;
water_above = false;
} else { // Possible various nodes overgenerated from neighbouring mapchunks
- nplaced = (u16)-1; // Disable top/filler placement
+ nplaced = U16_MAX; // Disable top/filler placement
air_above = false;
water_above = false;
}
void MapgenV6Params::writeParams(Settings *settings) const
{
- settings->setFlagStr("mgv6_spflags", spflags, flagdesc_mapgen_v6, (u32)-1);
+ settings->setFlagStr("mgv6_spflags", spflags, flagdesc_mapgen_v6, U32_MAX);
settings->setFloat("mgv6_freq_desert", freq_desert);
settings->setFloat("mgv6_freq_beach", freq_beach);
void MapgenV7Params::writeParams(Settings *settings) const
{
- settings->setFlagStr("mgv7_spflags", spflags, flagdesc_mapgen_v7, (u32)-1);
+ settings->setFlagStr("mgv7_spflags", spflags, flagdesc_mapgen_v7, U32_MAX);
settings->setNoiseParams("mgv7_np_terrain_base", np_terrain_base);
settings->setNoiseParams("mgv7_np_terrain_alt", np_terrain_alt);
// If there is air or water above enable top/filler placement, otherwise force
// nplaced to stone level by setting a number exceeding any possible filler depth.
- u16 nplaced = (air_above || water_above) ? 0 : (u16)-1;
+ u16 nplaced = (air_above || water_above) ? 0 : U16_MAX;
for (s16 y = node_max.Y; y >= node_min.Y; y--) {
content_t c = vm->m_data[vi].getContent();
// This is done by aborting the cycle of top/filler placement
// immediately by forcing nplaced to stone level.
if (c_below == CONTENT_AIR || c_below == c_water_source)
- nplaced = (u16)-1;
+ nplaced = U16_MAX;
if (nplaced < depth_top) {
vm->m_data[vi] = MapNode(biome->c_top);
air_above = true;
water_above = false;
} else { // Possible various nodes overgenerated from neighbouring mapchunks
- nplaced = (u16)-1; // Disable top/filler placement
+ nplaced = U16_MAX; // Disable top/filler placement
air_above = false;
water_above = false;
}
lua_pushinteger(L, params->chunksize);
lua_setfield(L, -2, "chunksize");
- std::string flagstr = writeFlagString(params->flags, flagdesc_mapgen, (u32)-1);
+ std::string flagstr = writeFlagString(params->flags, flagdesc_mapgen, U32_MAX);
lua_pushstring(L, flagstr.c_str());
lua_setfield(L, -2, "flags");
}
u32 id = getServer(L)->hudAdd(player, elem);
- if (id == (u32)-1) {
+ if (id == U32_MAX) {
delete elem;
return 0;
}
ScopeProfiler sp(g_profiler, "Server: map timer and unload");
m_env->getMap().timerUpdate(map_timer_and_unload_dtime,
g_settings->getFloat("server_unload_unused_data_timeout"),
- (u32)-1);
+ U32_MAX);
}
/*
size_t count = m_stored.size() + m_active.size();
// Make sure it fits into u16, else it would get truncated and cause e.g.
// issue #2610 (Invalid block data in database: unsupported NameIdMapping version).
- if (count > (u16)-1) {
+ if (count > U16_MAX) {
errorstream << "StaticObjectList::serialize(): "
<< "too many objects (" << count << ") in list, "
<< "not writing them to disk." << std::endl;
UASSERT(is_power_of_two((1 << exponent)) == true);
UASSERT(is_power_of_two((1 << exponent) + 1) == false);
}
- UASSERT(is_power_of_two((u32)-1) == false);
+ UASSERT(is_power_of_two(U32_MAX) == false);
}
void TestUtilities::testMyround()