forked from Mirrorlandia_minetest/minetest
fully working i guess
This commit is contained in:
parent
804b2647ce
commit
52d99fef31
@ -25,6 +25,7 @@
|
|||||||
#enable_fog = true
|
#enable_fog = true
|
||||||
#new_style_water = true
|
#new_style_water = true
|
||||||
#new_style_leaves = true
|
#new_style_leaves = true
|
||||||
|
#frametime_graph = false
|
||||||
|
|
||||||
# Server side stuff
|
# Server side stuff
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ void set_default_settings()
|
|||||||
g_settings.setDefault("enable_fog", "true");
|
g_settings.setDefault("enable_fog", "true");
|
||||||
g_settings.setDefault("new_style_water", "true");
|
g_settings.setDefault("new_style_water", "true");
|
||||||
g_settings.setDefault("new_style_leaves", "true");
|
g_settings.setDefault("new_style_leaves", "true");
|
||||||
|
g_settings.setDefault("frametime_graph", "false");
|
||||||
|
|
||||||
g_settings.setDefault("free_move", "false");
|
g_settings.setDefault("free_move", "false");
|
||||||
g_settings.setDefault("continuous_forward", "false");
|
g_settings.setDefault("continuous_forward", "false");
|
||||||
|
28
src/main.cpp
28
src/main.cpp
@ -267,15 +267,6 @@ Doing now (most important at the top):
|
|||||||
# maybe done
|
# maybe done
|
||||||
* not done
|
* not done
|
||||||
|
|
||||||
=== Immediate stuff
|
|
||||||
* Combine meshes to bigger ones in ClientMap and set them EHM_STATIC
|
|
||||||
|
|
||||||
=== Making it more portable
|
|
||||||
* MinGW: Switch away from swprintf; mingw has a bad version of it.
|
|
||||||
Use snprintf + narrow_to_wide or (w)ostringstream
|
|
||||||
* Some MSVC: std::sto* are defined without a namespace and collide
|
|
||||||
with the ones in utility.h
|
|
||||||
|
|
||||||
=== Stuff to do before release
|
=== Stuff to do before release
|
||||||
* Save the new mapgen stuff
|
* Save the new mapgen stuff
|
||||||
- map/meta.txt, which should contain only plain text, something like this:
|
- map/meta.txt, which should contain only plain text, something like this:
|
||||||
@ -291,7 +282,15 @@ Doing now (most important at the top):
|
|||||||
* only_from_disk might not work anymore - check and fix it.
|
* only_from_disk might not work anymore - check and fix it.
|
||||||
* Check the fixmes in the list above
|
* Check the fixmes in the list above
|
||||||
|
|
||||||
|
=== Making it more portable
|
||||||
|
* MinGW: Switch away from swprintf; mingw has a bad version of it.
|
||||||
|
Use snprintf + narrow_to_wide or (w)ostringstream
|
||||||
|
* Some MSVC: std::sto* are defined without a namespace and collide
|
||||||
|
with the ones in utility.h
|
||||||
|
|
||||||
=== Stuff to do after release
|
=== Stuff to do after release
|
||||||
|
* Move digging property stuff from material.{h,cpp} to mapnode.cpp...
|
||||||
|
- Or maybe move content_features to material.{h,cpp}?
|
||||||
* Add some kind of erosion and other stuff that now is possible
|
* Add some kind of erosion and other stuff that now is possible
|
||||||
* Make client to fetch stuff asynchronously
|
* Make client to fetch stuff asynchronously
|
||||||
- Needs method SyncProcessData
|
- Needs method SyncProcessData
|
||||||
@ -308,6 +307,7 @@ Doing now (most important at the top):
|
|||||||
is generated. Fix it.
|
is generated. Fix it.
|
||||||
* Make a small history check to transformLiquids to detect and log
|
* Make a small history check to transformLiquids to detect and log
|
||||||
continuous oscillations, in such detail that they can be fixed.
|
continuous oscillations, in such detail that they can be fixed.
|
||||||
|
* Combine meshes to bigger ones in ClientMap and set them EHM_STATIC
|
||||||
|
|
||||||
======================================================================
|
======================================================================
|
||||||
|
|
||||||
@ -381,7 +381,7 @@ Doing now (most important at the top):
|
|||||||
IrrlichtWrapper *g_irrlicht = NULL;
|
IrrlichtWrapper *g_irrlicht = NULL;
|
||||||
|
|
||||||
// This makes textures
|
// This makes textures
|
||||||
TextureSource *g_texturesource = NULL;
|
ITextureSource *g_texturesource = NULL;
|
||||||
|
|
||||||
MapDrawControl draw_control;
|
MapDrawControl draw_control;
|
||||||
|
|
||||||
@ -1659,7 +1659,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
g_device = device;
|
g_device = device;
|
||||||
g_irrlicht = new IrrlichtWrapper(device);
|
g_irrlicht = new IrrlichtWrapper(device);
|
||||||
g_texturesource = new TextureSource(device);
|
TextureSource *texturesource = new TextureSource(device);
|
||||||
|
g_texturesource = texturesource;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Speed tests (done after irrlicht is loaded to get timer)
|
Speed tests (done after irrlicht is loaded to get timer)
|
||||||
@ -1722,7 +1723,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
init_content_inventory_texture_paths();
|
init_content_inventory_texture_paths();
|
||||||
init_mapnode(); // Second call with g_texturesource set
|
init_mapnode(); // Second call with g_texturesource set
|
||||||
init_mineral(g_irrlicht);
|
init_mineral();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
GUI stuff
|
GUI stuff
|
||||||
@ -2084,7 +2085,7 @@ int main(int argc, char *argv[])
|
|||||||
/*
|
/*
|
||||||
Process TextureSource's queue
|
Process TextureSource's queue
|
||||||
*/
|
*/
|
||||||
g_texturesource->processQueue();
|
texturesource->processQueue();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Random calculations
|
Random calculations
|
||||||
@ -3006,6 +3007,7 @@ int main(int argc, char *argv[])
|
|||||||
/*
|
/*
|
||||||
Frametime log
|
Frametime log
|
||||||
*/
|
*/
|
||||||
|
if(g_settings.getBool("frametime_graph") == true)
|
||||||
{
|
{
|
||||||
s32 x = 10;
|
s32 x = 10;
|
||||||
for(core::list<float>::Iterator
|
for(core::list<float>::Iterator
|
||||||
|
@ -32,7 +32,7 @@ extern IrrlichtWrapper *g_irrlicht;
|
|||||||
|
|
||||||
// This makes and maps textures
|
// This makes and maps textures
|
||||||
#include "tile.h"
|
#include "tile.h"
|
||||||
extern TextureSource *g_texturesource;
|
extern ITextureSource *g_texturesource;
|
||||||
|
|
||||||
// Debug streams
|
// Debug streams
|
||||||
|
|
||||||
|
289
src/map.cpp
289
src/map.cpp
@ -1741,10 +1741,10 @@ ServerMap::ServerMap(std::string savedir):
|
|||||||
//m_chunksize = 2;
|
//m_chunksize = 2;
|
||||||
|
|
||||||
// TODO: Save to and load from a file
|
// TODO: Save to and load from a file
|
||||||
m_seed = (((u64)myrand()<<0)%0x7fff)
|
m_seed = (((u64)(myrand()%0xffff)<<0)
|
||||||
+ (((u64)myrand()<<16)%0x7fff)
|
+ ((u64)(myrand()%0xffff)<<16)
|
||||||
+ (((u64)myrand()<<32)%0x7fff)
|
+ ((u64)(myrand()%0xffff)<<32)
|
||||||
+ (((u64)myrand()<<48)%0x7fff);
|
+ ((u64)(myrand()%0xffff)<<48));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Experimental and debug stuff
|
Experimental and debug stuff
|
||||||
@ -1774,16 +1774,24 @@ ServerMap::ServerMap(std::string savedir):
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Load master heightmap
|
// Load map metadata (seed, chunksize)
|
||||||
loadMasterHeightmap();
|
loadMapMeta();
|
||||||
|
|
||||||
// Load sector (0,0) and throw and exception on fail
|
// Load chunk metadata
|
||||||
|
loadChunkMeta();
|
||||||
|
|
||||||
|
/*// Load sector (0,0) and throw and exception on fail
|
||||||
if(loadSectorFull(v2s16(0,0)) == false)
|
if(loadSectorFull(v2s16(0,0)) == false)
|
||||||
throw LoadError("Failed to load sector (0,0)");
|
throw LoadError("Failed to load sector (0,0)");*/
|
||||||
|
|
||||||
dstream<<DTIME<<"Server: Successfully loaded master "
|
/*dstream<<DTIME<<"Server: Successfully loaded chunk "
|
||||||
"heightmap and sector (0,0) from "<<savedir<<
|
"metadata and sector (0,0) from "<<savedir<<
|
||||||
", assuming valid save directory."
|
", assuming valid save directory."
|
||||||
|
<<std::endl;*/
|
||||||
|
|
||||||
|
dstream<<DTIME<<"INFO: Server: Successfully loaded map "
|
||||||
|
<<"and chunk metadata from "<<savedir
|
||||||
|
<<", assuming valid save directory."
|
||||||
<<std::endl;
|
<<std::endl;
|
||||||
|
|
||||||
m_map_saving_enabled = true;
|
m_map_saving_enabled = true;
|
||||||
@ -1798,13 +1806,13 @@ ServerMap::ServerMap(std::string savedir):
|
|||||||
}
|
}
|
||||||
catch(std::exception &e)
|
catch(std::exception &e)
|
||||||
{
|
{
|
||||||
dstream<<DTIME<<"Server: Failed to load map from "<<savedir
|
dstream<<DTIME<<"WARNING: Server: Failed to load map from "<<savedir
|
||||||
<<", exception: "<<e.what()<<std::endl;
|
<<", exception: "<<e.what()<<std::endl;
|
||||||
dstream<<DTIME<<"Please remove the map or fix it."<<std::endl;
|
dstream<<"Please remove the map or fix it."<<std::endl;
|
||||||
dstream<<DTIME<<"WARNING: Map saving will be disabled."<<std::endl;
|
dstream<<"WARNING: Map saving will be disabled."<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
dstream<<DTIME<<"Initializing new map."<<std::endl;
|
dstream<<DTIME<<"INFO: Initializing new map."<<std::endl;
|
||||||
|
|
||||||
// Create zero sector
|
// Create zero sector
|
||||||
emergeSector(v2s16(0,0));
|
emergeSector(v2s16(0,0));
|
||||||
@ -2062,6 +2070,8 @@ double base_rock_level_2d(u64 seed, v2s16 p)
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define VMANIP_FLAG_DUNGEON VOXELFLAG_CHECKED1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This is the main map generation method
|
This is the main map generation method
|
||||||
*/
|
*/
|
||||||
@ -2195,6 +2205,9 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos,
|
|||||||
vmanip.initialEmerge(bigarea_blocks_min, bigarea_blocks_max);
|
vmanip.initialEmerge(bigarea_blocks_min, bigarea_blocks_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear all flags
|
||||||
|
vmanip.clearFlag(0xff);
|
||||||
|
|
||||||
TimeTaker timer_generate("generateChunkRaw() generate");
|
TimeTaker timer_generate("generateChunkRaw() generate");
|
||||||
|
|
||||||
// Maximum height of the stone surface and obstacles.
|
// Maximum height of the stone surface and obstacles.
|
||||||
@ -2414,7 +2427,7 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos,
|
|||||||
/*
|
/*
|
||||||
Make dungeons
|
Make dungeons
|
||||||
*/
|
*/
|
||||||
u32 dungeons_count = relative_volume / 600000;
|
u32 dungeons_count = relative_volume / 400000;
|
||||||
u32 bruises_count = relative_volume * stone_surface_max_y / 40000000;
|
u32 bruises_count = relative_volume * stone_surface_max_y / 40000000;
|
||||||
if(stone_surface_max_y < WATER_LEVEL)
|
if(stone_surface_max_y < WATER_LEVEL)
|
||||||
bruises_count = 0;
|
bruises_count = 0;
|
||||||
@ -2424,7 +2437,7 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos,
|
|||||||
{
|
{
|
||||||
s16 min_tunnel_diameter = 2;
|
s16 min_tunnel_diameter = 2;
|
||||||
s16 max_tunnel_diameter = 6;
|
s16 max_tunnel_diameter = 6;
|
||||||
u16 tunnel_routepoints = 15;
|
u16 tunnel_routepoints = 25;
|
||||||
|
|
||||||
bool bruise_surface = (jj < bruises_count);
|
bool bruise_surface = (jj < bruises_count);
|
||||||
|
|
||||||
@ -2464,14 +2477,14 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos,
|
|||||||
of -= v3s16(1,0,1) * more;
|
of -= v3s16(1,0,1) * more;
|
||||||
|
|
||||||
s16 route_y_min = 0;
|
s16 route_y_min = 0;
|
||||||
//s16 route_y_max = ar.Y-1;
|
// Allow half a diameter + 7 over stone surface
|
||||||
s16 route_y_max = -of.Y + stone_surface_max_y + max_tunnel_diameter/2;
|
s16 route_y_max = -of.Y + stone_surface_max_y + max_tunnel_diameter/2 + 7;
|
||||||
// If dungeons
|
|
||||||
|
/*// If dungeons, don't go through surface too often
|
||||||
if(bruise_surface == false)
|
if(bruise_surface == false)
|
||||||
{
|
route_y_max -= myrand_range(0, max_tunnel_diameter*2);*/
|
||||||
// Don't go through surface too often
|
|
||||||
route_y_max -= myrand_range(0, max_tunnel_diameter*2);
|
// Limit maximum to area
|
||||||
}
|
|
||||||
route_y_max = rangelim(route_y_max, 0, ar.Y-1);
|
route_y_max = rangelim(route_y_max, 0, ar.Y-1);
|
||||||
|
|
||||||
if(bruise_surface)
|
if(bruise_surface)
|
||||||
@ -2489,10 +2502,24 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos,
|
|||||||
/*dstream<<"route_y_min = "<<route_y_min
|
/*dstream<<"route_y_min = "<<route_y_min
|
||||||
<<", route_y_max = "<<route_y_max<<std::endl;*/
|
<<", route_y_max = "<<route_y_max<<std::endl;*/
|
||||||
|
|
||||||
|
s16 route_start_y_min = route_y_min;
|
||||||
|
s16 route_start_y_max = route_y_max;
|
||||||
|
|
||||||
|
// Start every 2nd dungeon from surface
|
||||||
|
bool coming_from_surface = (jj % 2 == 0 && bruise_surface == false);
|
||||||
|
|
||||||
|
if(coming_from_surface)
|
||||||
|
{
|
||||||
|
route_start_y_min = -of.Y + stone_surface_max_y + 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
route_start_y_min = rangelim(route_start_y_min, 0, ar.Y-1);
|
||||||
|
route_start_y_max = rangelim(route_start_y_max, 0, ar.Y-1);
|
||||||
|
|
||||||
// Randomize starting position
|
// Randomize starting position
|
||||||
v3f orp(
|
v3f orp(
|
||||||
(float)(myrand()%ar.X)+0.5,
|
(float)(myrand()%ar.X)+0.5,
|
||||||
(float)(myrand_range(route_y_min, route_y_max))+0.5,
|
(float)(myrand_range(route_start_y_min, route_start_y_max))+0.5,
|
||||||
(float)(myrand()%ar.Z)+0.5
|
(float)(myrand()%ar.Z)+0.5
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -2509,18 +2536,35 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos,
|
|||||||
s16 max_d = max_tunnel_diameter;
|
s16 max_d = max_tunnel_diameter;
|
||||||
s16 rs = myrand_range(min_d, max_d);
|
s16 rs = myrand_range(min_d, max_d);
|
||||||
|
|
||||||
v3s16 maxlen(15, 5, 15);
|
v3s16 maxlen;
|
||||||
|
|
||||||
if(bruise_surface)
|
if(bruise_surface)
|
||||||
{
|
{
|
||||||
maxlen = v3s16(rs*7,rs*7,rs*7);
|
maxlen = v3s16(rs*7,rs*7,rs*7);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
maxlen = v3s16(15, myrand_range(1, 20), 15);
|
||||||
|
}
|
||||||
|
|
||||||
v3f vec(
|
v3f vec;
|
||||||
|
|
||||||
|
if(coming_from_surface && j < 3)
|
||||||
|
{
|
||||||
|
vec = v3f(
|
||||||
|
(float)(myrand()%(maxlen.X*2))-(float)maxlen.X,
|
||||||
|
(float)(myrand()%(maxlen.Y*1))-(float)maxlen.Y,
|
||||||
|
(float)(myrand()%(maxlen.Z*2))-(float)maxlen.Z
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vec = v3f(
|
||||||
(float)(myrand()%(maxlen.X*2))-(float)maxlen.X,
|
(float)(myrand()%(maxlen.X*2))-(float)maxlen.X,
|
||||||
(float)(myrand()%(maxlen.Y*2))-(float)maxlen.Y,
|
(float)(myrand()%(maxlen.Y*2))-(float)maxlen.Y,
|
||||||
(float)(myrand()%(maxlen.Z*2))-(float)maxlen.Z
|
(float)(myrand()%(maxlen.Z*2))-(float)maxlen.Z
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
v3f rp = orp + vec;
|
v3f rp = orp + vec;
|
||||||
if(rp.X < 0)
|
if(rp.X < 0)
|
||||||
rp.X = 0;
|
rp.X = 0;
|
||||||
@ -2553,7 +2597,7 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos,
|
|||||||
//s16 si2 = rs - MYMAX(0, maxabsxz-rs/4);
|
//s16 si2 = rs - MYMAX(0, maxabsxz-rs/4);
|
||||||
s16 si2 = rs - MYMAX(0, maxabsxz-rs/7);
|
s16 si2 = rs - MYMAX(0, maxabsxz-rs/7);
|
||||||
//s16 si2 = rs - abs(x0);
|
//s16 si2 = rs - abs(x0);
|
||||||
for(s16 y0=-si2+1+1; y0<=si2-1; y0++)
|
for(s16 y0=-si2+1+2; y0<=si2-1; y0++)
|
||||||
{
|
{
|
||||||
s16 z = cp.Z + z0;
|
s16 z = cp.Z + z0;
|
||||||
s16 y = cp.Y + y0;
|
s16 y = cp.Y + y0;
|
||||||
@ -2580,6 +2624,12 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos,
|
|||||||
// water afterwards
|
// water afterwards
|
||||||
u32 i = vmanip.m_area.index(p);
|
u32 i = vmanip.m_area.index(p);
|
||||||
vmanip.m_data[i] = airnode;
|
vmanip.m_data[i] = airnode;
|
||||||
|
|
||||||
|
if(bruise_surface == false)
|
||||||
|
{
|
||||||
|
// Set tunnel flag
|
||||||
|
vmanip.m_flags[i] |= VMANIP_FLAG_DUNGEON;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3000,13 +3050,17 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make water only not in dungeons
|
||||||
|
if(!(vmanip.m_flags[i]&VMANIP_FLAG_DUNGEON))
|
||||||
|
{
|
||||||
n->d = CONTENT_WATERSOURCE;
|
n->d = CONTENT_WATERSOURCE;
|
||||||
n->setLight(LIGHTBANK_DAY, light);
|
//n->setLight(LIGHTBANK_DAY, light);
|
||||||
|
|
||||||
// Add to transforming liquid queue (in case it'd
|
// Add to transforming liquid queue (in case it'd
|
||||||
// start flowing)
|
// start flowing)
|
||||||
v3s16 p = v3s16(p2d.X, y, p2d.Y);
|
v3s16 p = v3s16(p2d.X, y, p2d.Y);
|
||||||
m_transforming_liquid.push_back(p);
|
m_transforming_liquid.push_back(p);
|
||||||
|
}
|
||||||
|
|
||||||
// Next one
|
// Next one
|
||||||
vmanip.m_area.add_y(em, i, -1);
|
vmanip.m_area.add_y(em, i, -1);
|
||||||
@ -3519,6 +3573,7 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos,
|
|||||||
//TimeTaker timer("generateChunkRaw() blitBackAll");
|
//TimeTaker timer("generateChunkRaw() blitBackAll");
|
||||||
vmanip.blitBackAll(&changed_blocks);
|
vmanip.blitBackAll(&changed_blocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Update day/night difference cache of the MapBlocks
|
Update day/night difference cache of the MapBlocks
|
||||||
*/
|
*/
|
||||||
@ -3553,14 +3608,22 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set central chunk non-volatile and return it
|
Set central chunk non-volatile
|
||||||
*/
|
*/
|
||||||
MapChunk *chunk = getChunk(chunkpos);
|
MapChunk *chunk = getChunk(chunkpos);
|
||||||
assert(chunk);
|
assert(chunk);
|
||||||
// Set non-volatile
|
// Set non-volatile
|
||||||
//chunk->setIsVolatile(false);
|
//chunk->setIsVolatile(false);
|
||||||
chunk->setGenLevel(GENERATED_FULLY);
|
chunk->setGenLevel(GENERATED_FULLY);
|
||||||
// Return it
|
|
||||||
|
/*
|
||||||
|
Save changed parts of map
|
||||||
|
*/
|
||||||
|
save(true);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Return central chunk (which was requested)
|
||||||
|
*/
|
||||||
return chunk;
|
return chunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4543,7 +4606,8 @@ void ServerMap::save(bool only_changed)
|
|||||||
dstream<<DTIME<<"ServerMap: Saving whole map, this can take time."
|
dstream<<DTIME<<"ServerMap: Saving whole map, this can take time."
|
||||||
<<std::endl;
|
<<std::endl;
|
||||||
|
|
||||||
saveMasterHeightmap();
|
saveMapMeta();
|
||||||
|
saveChunkMeta();
|
||||||
|
|
||||||
u32 sector_meta_count = 0;
|
u32 sector_meta_count = 0;
|
||||||
u32 block_count = 0;
|
u32 block_count = 0;
|
||||||
@ -4602,7 +4666,8 @@ void ServerMap::loadAll()
|
|||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(__FUNCTION_NAME);
|
||||||
dstream<<DTIME<<"ServerMap: Loading map..."<<std::endl;
|
dstream<<DTIME<<"ServerMap: Loading map..."<<std::endl;
|
||||||
|
|
||||||
loadMasterHeightmap();
|
loadMapMeta();
|
||||||
|
loadChunkMeta();
|
||||||
|
|
||||||
std::vector<fs::DirListNode> list = fs::GetDirListing(m_savedir+"/sectors/");
|
std::vector<fs::DirListNode> list = fs::GetDirListing(m_savedir+"/sectors/");
|
||||||
|
|
||||||
@ -4657,6 +4722,7 @@ void ServerMap::loadAll()
|
|||||||
dstream<<DTIME<<"ServerMap: Map loaded."<<std::endl;
|
dstream<<DTIME<<"ServerMap: Map loaded."<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
void ServerMap::saveMasterHeightmap()
|
void ServerMap::saveMasterHeightmap()
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(__FUNCTION_NAME);
|
||||||
@ -4685,6 +4751,163 @@ void ServerMap::loadMasterHeightmap()
|
|||||||
if(is.good() == false)
|
if(is.good() == false)
|
||||||
throw FileNotGoodException("Cannot open master heightmap");*/
|
throw FileNotGoodException("Cannot open master heightmap");*/
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void ServerMap::saveMapMeta()
|
||||||
|
{
|
||||||
|
DSTACK(__FUNCTION_NAME);
|
||||||
|
|
||||||
|
dstream<<"INFO: ServerMap::saveMapMeta(): "
|
||||||
|
<<"seed="<<m_seed<<", chunksize="<<m_chunksize
|
||||||
|
<<std::endl;
|
||||||
|
|
||||||
|
createDir(m_savedir);
|
||||||
|
|
||||||
|
std::string fullpath = m_savedir + "/meta.txt";
|
||||||
|
std::ofstream os(fullpath.c_str(), std::ios_base::binary);
|
||||||
|
if(os.good() == false)
|
||||||
|
{
|
||||||
|
dstream<<"ERROR: ServerMap::saveMapMeta(): "
|
||||||
|
<<"could not open"<<fullpath<<std::endl;
|
||||||
|
throw FileNotGoodException("Cannot open chunk metadata");
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings params;
|
||||||
|
params.setU64("seed", m_seed);
|
||||||
|
params.setS32("chunksize", m_chunksize);
|
||||||
|
|
||||||
|
params.writeLines(os);
|
||||||
|
|
||||||
|
os<<"[end_of_params]\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerMap::loadMapMeta()
|
||||||
|
{
|
||||||
|
DSTACK(__FUNCTION_NAME);
|
||||||
|
|
||||||
|
dstream<<"INFO: ServerMap::loadMapMeta(): Loading chunk metadata"
|
||||||
|
<<std::endl;
|
||||||
|
|
||||||
|
std::string fullpath = m_savedir + "/meta.txt";
|
||||||
|
std::ifstream is(fullpath.c_str(), std::ios_base::binary);
|
||||||
|
if(is.good() == false)
|
||||||
|
{
|
||||||
|
dstream<<"ERROR: ServerMap::loadMapMeta(): "
|
||||||
|
<<"could not open"<<fullpath<<std::endl;
|
||||||
|
throw FileNotGoodException("Cannot open chunk metadata");
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings params;
|
||||||
|
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
if(is.eof())
|
||||||
|
throw SerializationError
|
||||||
|
("ServerMap::loadMapMeta(): [end_of_params] not found");
|
||||||
|
std::string line;
|
||||||
|
std::getline(is, line);
|
||||||
|
std::string trimmedline = trim(line);
|
||||||
|
if(trimmedline == "[end_of_params]")
|
||||||
|
break;
|
||||||
|
params.parseConfigLine(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_seed = params.getU64("seed");
|
||||||
|
m_chunksize = params.getS32("chunksize");
|
||||||
|
|
||||||
|
dstream<<"INFO: ServerMap::loadMapMeta(): "
|
||||||
|
<<"seed="<<m_seed<<", chunksize="<<m_chunksize
|
||||||
|
<<std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerMap::saveChunkMeta()
|
||||||
|
{
|
||||||
|
DSTACK(__FUNCTION_NAME);
|
||||||
|
|
||||||
|
u32 count = m_chunks.size();
|
||||||
|
|
||||||
|
dstream<<"INFO: ServerMap::saveChunkMeta(): Saving metadata of "
|
||||||
|
<<count<<" chunks"<<std::endl;
|
||||||
|
|
||||||
|
createDir(m_savedir);
|
||||||
|
|
||||||
|
std::string fullpath = m_savedir + "/chunk_meta";
|
||||||
|
std::ofstream os(fullpath.c_str(), std::ios_base::binary);
|
||||||
|
if(os.good() == false)
|
||||||
|
{
|
||||||
|
dstream<<"ERROR: ServerMap::saveChunkMeta(): "
|
||||||
|
<<"could not open"<<fullpath<<std::endl;
|
||||||
|
throw FileNotGoodException("Cannot open chunk metadata");
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 version = 0;
|
||||||
|
|
||||||
|
// Write version
|
||||||
|
os.write((char*)&version, 1);
|
||||||
|
|
||||||
|
u8 buf[4];
|
||||||
|
|
||||||
|
// Write count
|
||||||
|
writeU32(buf, count);
|
||||||
|
os.write((char*)buf, 4);
|
||||||
|
|
||||||
|
for(core::map<v2s16, MapChunk*>::Iterator
|
||||||
|
i = m_chunks.getIterator();
|
||||||
|
i.atEnd()==false; i++)
|
||||||
|
{
|
||||||
|
v2s16 p = i.getNode()->getKey();
|
||||||
|
MapChunk *chunk = i.getNode()->getValue();
|
||||||
|
// Write position
|
||||||
|
writeV2S16(buf, p);
|
||||||
|
os.write((char*)buf, 4);
|
||||||
|
// Write chunk data
|
||||||
|
chunk->serialize(os, version);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerMap::loadChunkMeta()
|
||||||
|
{
|
||||||
|
DSTACK(__FUNCTION_NAME);
|
||||||
|
|
||||||
|
dstream<<"INFO: ServerMap::loadChunkMeta(): Loading chunk metadata"
|
||||||
|
<<std::endl;
|
||||||
|
|
||||||
|
std::string fullpath = m_savedir + "/chunk_meta";
|
||||||
|
std::ifstream is(fullpath.c_str(), std::ios_base::binary);
|
||||||
|
if(is.good() == false)
|
||||||
|
{
|
||||||
|
dstream<<"ERROR: ServerMap::loadChunkMeta(): "
|
||||||
|
<<"could not open"<<fullpath<<std::endl;
|
||||||
|
throw FileNotGoodException("Cannot open chunk metadata");
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 version = 0;
|
||||||
|
|
||||||
|
// Read version
|
||||||
|
is.read((char*)&version, 1);
|
||||||
|
|
||||||
|
u8 buf[4];
|
||||||
|
|
||||||
|
// Read count
|
||||||
|
is.read((char*)buf, 4);
|
||||||
|
u32 count = readU32(buf);
|
||||||
|
|
||||||
|
dstream<<"INFO: ServerMap::loadChunkMeta(): Loading metadata of "
|
||||||
|
<<count<<" chunks"<<std::endl;
|
||||||
|
|
||||||
|
for(u32 i=0; i<count; i++)
|
||||||
|
{
|
||||||
|
v2s16 p;
|
||||||
|
MapChunk *chunk = new MapChunk();
|
||||||
|
// Read position
|
||||||
|
is.read((char*)buf, 4);
|
||||||
|
p = readV2S16(buf);
|
||||||
|
// Read chunk data
|
||||||
|
chunk->deSerialize(is, version);
|
||||||
|
m_chunks.insert(p, chunk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ServerMap::saveSectorMeta(ServerMapSector *sector)
|
void ServerMap::saveSectorMeta(ServerMapSector *sector)
|
||||||
{
|
{
|
||||||
|
@ -475,18 +475,13 @@ public:
|
|||||||
void save(bool only_changed);
|
void save(bool only_changed);
|
||||||
void loadAll();
|
void loadAll();
|
||||||
|
|
||||||
// TODO
|
// Saves map seed and possibly other stuff
|
||||||
void saveMapMeta();
|
void saveMapMeta();
|
||||||
void loadMapMeta();
|
void loadMapMeta();
|
||||||
|
|
||||||
// TODO
|
|
||||||
void saveChunkMeta();
|
void saveChunkMeta();
|
||||||
void loadChunkMeta();
|
void loadChunkMeta();
|
||||||
|
|
||||||
// DEPRECATED
|
|
||||||
void saveMasterHeightmap();
|
|
||||||
void loadMasterHeightmap();
|
|
||||||
|
|
||||||
// The sector mutex should be locked when calling most of these
|
// The sector mutex should be locked when calling most of these
|
||||||
|
|
||||||
// This only saves sector-specific data such as the heightmap
|
// This only saves sector-specific data such as the heightmap
|
||||||
|
@ -148,25 +148,6 @@ u8 MapBlock::getFaceLight(u32 daynight_ratio, MapNode n, MapNode n2,
|
|||||||
v3s16 face_dir)
|
v3s16 face_dir)
|
||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
// DEBUG
|
|
||||||
/*{
|
|
||||||
if(n.d == CONTENT_WATER)
|
|
||||||
{
|
|
||||||
u8 l = n.param2*2;
|
|
||||||
if(l > LIGHT_MAX)
|
|
||||||
l = LIGHT_MAX;
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
if(n2.d == CONTENT_WATER)
|
|
||||||
{
|
|
||||||
u8 l = n2.param2*2;
|
|
||||||
if(l > LIGHT_MAX)
|
|
||||||
l = LIGHT_MAX;
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
u8 light;
|
u8 light;
|
||||||
u8 l1 = n.getLightBlend(daynight_ratio);
|
u8 l1 = n.getLightBlend(daynight_ratio);
|
||||||
u8 l2 = n2.getLightBlend(daynight_ratio);
|
u8 l2 = n2.getLightBlend(daynight_ratio);
|
||||||
@ -177,11 +158,13 @@ u8 MapBlock::getFaceLight(u32 daynight_ratio, MapNode n, MapNode n2,
|
|||||||
|
|
||||||
// Make some nice difference to different sides
|
// Make some nice difference to different sides
|
||||||
|
|
||||||
|
// This makes light come from a corner
|
||||||
/*if(face_dir.X == 1 || face_dir.Z == 1 || face_dir.Y == -1)
|
/*if(face_dir.X == 1 || face_dir.Z == 1 || face_dir.Y == -1)
|
||||||
light = diminish_light(diminish_light(light));
|
light = diminish_light(diminish_light(light));
|
||||||
else if(face_dir.X == -1 || face_dir.Z == -1)
|
else if(face_dir.X == -1 || face_dir.Z == -1)
|
||||||
light = diminish_light(light);*/
|
light = diminish_light(light);*/
|
||||||
|
|
||||||
|
// All neighboring faces have different shade (like in minecraft)
|
||||||
if(face_dir.X == 1 || face_dir.X == -1 || face_dir.Y == -1)
|
if(face_dir.X == 1 || face_dir.X == -1 || face_dir.Y == -1)
|
||||||
light = diminish_light(diminish_light(light));
|
light = diminish_light(diminish_light(light));
|
||||||
else if(face_dir.Z == 1 || face_dir.Z == -1)
|
else if(face_dir.Z == 1 || face_dir.Z == -1)
|
||||||
@ -791,7 +774,7 @@ void MapBlock::updateMesh(u32 daynight_ratio)
|
|||||||
// Flowing water material
|
// Flowing water material
|
||||||
video::SMaterial material_water1;
|
video::SMaterial material_water1;
|
||||||
material_water1.setFlag(video::EMF_LIGHTING, false);
|
material_water1.setFlag(video::EMF_LIGHTING, false);
|
||||||
material_water1.setFlag(video::EMF_BACK_FACE_CULLING, false);
|
//material_water1.setFlag(video::EMF_BACK_FACE_CULLING, false);
|
||||||
material_water1.setFlag(video::EMF_BILINEAR_FILTER, false);
|
material_water1.setFlag(video::EMF_BILINEAR_FILTER, false);
|
||||||
material_water1.setFlag(video::EMF_FOG_ENABLE, true);
|
material_water1.setFlag(video::EMF_FOG_ENABLE, true);
|
||||||
material_water1.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
|
material_water1.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
|
||||||
@ -1040,9 +1023,9 @@ void MapBlock::updateMesh(u32 daynight_ratio)
|
|||||||
video::S3DVertex(BS/2,0,BS/2, 0,0,0, c, 1,1),
|
video::S3DVertex(BS/2,0,BS/2, 0,0,0, c, 1,1),
|
||||||
video::S3DVertex(BS/2,0,BS/2, 0,0,0, c, 1,0),
|
video::S3DVertex(BS/2,0,BS/2, 0,0,0, c, 1,0),
|
||||||
video::S3DVertex(-BS/2,0,BS/2, 0,0,0, c, 0,0),*/
|
video::S3DVertex(-BS/2,0,BS/2, 0,0,0, c, 0,0),*/
|
||||||
video::S3DVertex(-BS/2,0,-BS/2, 0,0,0, c,
|
video::S3DVertex(-BS/2,0,BS/2, 0,0,0, c,
|
||||||
pa_water1.x0(), pa_water1.y1()),
|
pa_water1.x0(), pa_water1.y1()),
|
||||||
video::S3DVertex(BS/2,0,-BS/2, 0,0,0, c,
|
video::S3DVertex(BS/2,0,BS/2, 0,0,0, c,
|
||||||
pa_water1.x1(), pa_water1.y1()),
|
pa_water1.x1(), pa_water1.y1()),
|
||||||
video::S3DVertex(BS/2,0,BS/2, 0,0,0, c,
|
video::S3DVertex(BS/2,0,BS/2, 0,0,0, c,
|
||||||
pa_water1.x1(), pa_water1.y0()),
|
pa_water1.x1(), pa_water1.y0()),
|
||||||
@ -1118,21 +1101,25 @@ void MapBlock::updateMesh(u32 daynight_ratio)
|
|||||||
video::S3DVertex(BS/2,0,-BS/2, 0,0,0, c, 1,1),
|
video::S3DVertex(BS/2,0,-BS/2, 0,0,0, c, 1,1),
|
||||||
video::S3DVertex(BS/2,0,BS/2, 0,0,0, c, 1,0),
|
video::S3DVertex(BS/2,0,BS/2, 0,0,0, c, 1,0),
|
||||||
video::S3DVertex(-BS/2,0,BS/2, 0,0,0, c, 0,0),*/
|
video::S3DVertex(-BS/2,0,BS/2, 0,0,0, c, 0,0),*/
|
||||||
video::S3DVertex(-BS/2,0,-BS/2, 0,0,0, c,
|
|
||||||
pa_water1.x0(), pa_water1.y1()),
|
|
||||||
video::S3DVertex(BS/2,0,-BS/2, 0,0,0, c,
|
|
||||||
pa_water1.x1(), pa_water1.y1()),
|
|
||||||
video::S3DVertex(BS/2,0,BS/2, 0,0,0, c,
|
|
||||||
pa_water1.x1(), pa_water1.y0()),
|
|
||||||
video::S3DVertex(-BS/2,0,BS/2, 0,0,0, c,
|
video::S3DVertex(-BS/2,0,BS/2, 0,0,0, c,
|
||||||
|
pa_water1.x0(), pa_water1.y1()),
|
||||||
|
video::S3DVertex(BS/2,0,BS/2, 0,0,0, c,
|
||||||
|
pa_water1.x1(), pa_water1.y1()),
|
||||||
|
video::S3DVertex(BS/2,0,-BS/2, 0,0,0, c,
|
||||||
|
pa_water1.x1(), pa_water1.y0()),
|
||||||
|
video::S3DVertex(-BS/2,0,-BS/2, 0,0,0, c,
|
||||||
pa_water1.x0(), pa_water1.y0()),
|
pa_water1.x0(), pa_water1.y0()),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// This fixes a strange bug
|
||||||
|
s32 corner_resolve[4] = {3,2,1,0};
|
||||||
|
|
||||||
for(s32 i=0; i<4; i++)
|
for(s32 i=0; i<4; i++)
|
||||||
{
|
{
|
||||||
//vertices[i].Pos.Y += water_level;
|
//vertices[i].Pos.Y += water_level;
|
||||||
//vertices[i].Pos.Y += neighbor_levels[v3s16(0,0,0)];
|
//vertices[i].Pos.Y += neighbor_levels[v3s16(0,0,0)];
|
||||||
vertices[i].Pos.Y += corner_levels[i];
|
s32 j = corner_resolve[i];
|
||||||
|
vertices[i].Pos.Y += corner_levels[j];
|
||||||
vertices[i].Pos += intToFloat(p + getPosRelative());
|
vertices[i].Pos += intToFloat(p + getPosRelative());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
some MapSectors. (something like 16x16)
|
some MapSectors. (something like 16x16)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// These should fit in 8 bits, as they are saved as such.
|
||||||
enum{
|
enum{
|
||||||
GENERATED_FULLY = 0,
|
GENERATED_FULLY = 0,
|
||||||
GENERATED_PARTLY = 10,
|
GENERATED_PARTLY = 10,
|
||||||
@ -35,21 +36,10 @@ class MapChunk
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MapChunk():
|
MapChunk():
|
||||||
//m_is_volatile(true)
|
|
||||||
m_generation_level(GENERATED_NOT)
|
m_generation_level(GENERATED_NOT)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
If is_volatile is true, chunk can be modified when
|
|
||||||
neighboring chunks are generated.
|
|
||||||
|
|
||||||
It is set to false when all the 8 neighboring chunks have
|
|
||||||
been generated.
|
|
||||||
*/
|
|
||||||
/*bool getIsVolatile(){ return m_is_volatile; }
|
|
||||||
void setIsVolatile(bool is){ m_is_volatile = is; }*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Generation level. Possible values:
|
Generation level. Possible values:
|
||||||
GENERATED_FULLY = 0 = fully generated
|
GENERATED_FULLY = 0 = fully generated
|
||||||
@ -59,9 +49,17 @@ public:
|
|||||||
u16 getGenLevel(){ return m_generation_level; }
|
u16 getGenLevel(){ return m_generation_level; }
|
||||||
void setGenLevel(u16 lev){ m_generation_level = lev; }
|
void setGenLevel(u16 lev){ m_generation_level = lev; }
|
||||||
|
|
||||||
|
void serialize(std::ostream &os, u8 version)
|
||||||
|
{
|
||||||
|
os.write((char*)&m_generation_level, 1);
|
||||||
|
}
|
||||||
|
void deSerialize(std::istream &is, u8 version)
|
||||||
|
{
|
||||||
|
is.read((char*)&m_generation_level, 1);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//bool m_is_volatile;
|
u8 m_generation_level;
|
||||||
u16 m_generation_level;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -58,7 +58,7 @@ void initializeMaterialProperties()
|
|||||||
DiggingProperties(true, 1.0, 0));
|
DiggingProperties(true, 1.0, 0));
|
||||||
|
|
||||||
g_material_properties[CONTENT_SAND].setDiggingProperties("",
|
g_material_properties[CONTENT_SAND].setDiggingProperties("",
|
||||||
DiggingProperties(true, 0.5, 0));
|
DiggingProperties(true, 0.4, 0));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Add MesePick to everything
|
Add MesePick to everything
|
||||||
|
@ -30,14 +30,12 @@ const char *mineral_filenames[MINERAL_COUNT] =
|
|||||||
//textureid_t mineral_textures[MINERAL_COUNT] = {0};
|
//textureid_t mineral_textures[MINERAL_COUNT] = {0};
|
||||||
std::string mineral_textures[MINERAL_COUNT];
|
std::string mineral_textures[MINERAL_COUNT];
|
||||||
|
|
||||||
void init_mineral(IIrrlichtWrapper *irrlicht)
|
void init_mineral()
|
||||||
{
|
{
|
||||||
for(u32 i=0; i<MINERAL_COUNT; i++)
|
for(u32 i=0; i<MINERAL_COUNT; i++)
|
||||||
{
|
{
|
||||||
if(mineral_filenames[i] == NULL)
|
if(mineral_filenames[i] == NULL)
|
||||||
continue;
|
continue;
|
||||||
//mineral_textures[i] = irrlicht->getTextureId(mineral_filenames[i]);
|
|
||||||
//mineral_textures[i] = 0;
|
|
||||||
mineral_textures[i] = mineral_filenames[i];
|
mineral_textures[i] = mineral_filenames[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
#include "inventory.h"
|
#include "inventory.h"
|
||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
#include "iirrlichtwrapper.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Minerals
|
Minerals
|
||||||
@ -32,7 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Caches textures
|
// Caches textures
|
||||||
void init_mineral(IIrrlichtWrapper *irrlicht);
|
void init_mineral();
|
||||||
|
|
||||||
#define MINERAL_NONE 0
|
#define MINERAL_NONE 0
|
||||||
#define MINERAL_COAL 1
|
#define MINERAL_COAL 1
|
||||||
|
@ -79,6 +79,9 @@ Settings g_settings;
|
|||||||
|
|
||||||
extern void set_default_settings();
|
extern void set_default_settings();
|
||||||
|
|
||||||
|
// A dummy thing
|
||||||
|
ITextureSource *g_texturesource = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Debug streams
|
Debug streams
|
||||||
*/
|
*/
|
||||||
@ -259,9 +262,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Initialize stuff
|
// Initialize stuff
|
||||||
|
|
||||||
IIrrlichtWrapper irrlicht; // Dummy
|
init_mapnode();
|
||||||
init_mapnode(&irrlicht);
|
init_mineral();
|
||||||
init_mineral(&irrlicht);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Check parameters
|
Check parameters
|
||||||
|
@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma comment(lib, "wsock32.lib")
|
#pragma comment(lib, "ws2_32.lib")
|
||||||
#endif
|
#endif
|
||||||
typedef SOCKET socket_t;
|
typedef SOCKET socket_t;
|
||||||
typedef int socklen_t;
|
typedef int socklen_t;
|
||||||
|
20
src/tile.h
20
src/tile.h
@ -103,10 +103,28 @@ struct SourceAtlasPointer
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Implementation (to be used as a no-op on the server)
|
||||||
|
*/
|
||||||
|
class ITextureSource
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ITextureSource(){}
|
||||||
|
virtual ~ITextureSource(){}
|
||||||
|
virtual u32 getTextureId(const std::string &name){return 0;}
|
||||||
|
virtual u32 getTextureIdDirect(const std::string &name){return 0;}
|
||||||
|
virtual std::string getTextureName(u32 id){return "";}
|
||||||
|
virtual AtlasPointer getTexture(u32 id){return AtlasPointer(0);}
|
||||||
|
virtual AtlasPointer getTexture(const std::string &name)
|
||||||
|
{return AtlasPointer(0);}
|
||||||
|
virtual video::ITexture* getTextureRaw(const std::string &name)
|
||||||
|
{return NULL;}
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Creates and caches textures.
|
Creates and caches textures.
|
||||||
*/
|
*/
|
||||||
class TextureSource
|
class TextureSource : public ITextureSource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TextureSource(IrrlichtDevice *device);
|
TextureSource(IrrlichtDevice *device);
|
||||||
|
@ -1201,6 +1201,15 @@ public:
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u64 getU64(std::string name)
|
||||||
|
{
|
||||||
|
u64 value = 0;
|
||||||
|
std::string s = get(name);
|
||||||
|
std::istringstream ss(s);
|
||||||
|
ss>>value;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
void setS32(std::string name, s32 value)
|
void setS32(std::string name, s32 value)
|
||||||
{
|
{
|
||||||
set(name, itos(value));
|
set(name, itos(value));
|
||||||
@ -1218,6 +1227,13 @@ public:
|
|||||||
set(name, os.str());
|
set(name, os.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setU64(std::string name, u64 value)
|
||||||
|
{
|
||||||
|
std::ostringstream os;
|
||||||
|
os<<value;
|
||||||
|
set(name, os.str());
|
||||||
|
}
|
||||||
|
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
m_settings.clear();
|
m_settings.clear();
|
||||||
|
@ -314,16 +314,12 @@ public:
|
|||||||
// Checked as being inexistent in source
|
// Checked as being inexistent in source
|
||||||
#define VOXELFLAG_INEXISTENT (1<<1)
|
#define VOXELFLAG_INEXISTENT (1<<1)
|
||||||
// Algorithm-dependent
|
// Algorithm-dependent
|
||||||
// flowWater: "visited"
|
#define VOXELFLAG_CHECKED1 (1<<2)
|
||||||
#define VOXELFLAG_CHECKED (1<<2)
|
|
||||||
// Algorithm-dependent
|
// Algorithm-dependent
|
||||||
// getWaterPressure: "visited"
|
|
||||||
#define VOXELFLAG_CHECKED2 (1<<3)
|
#define VOXELFLAG_CHECKED2 (1<<3)
|
||||||
// Algorithm-dependent
|
// Algorithm-dependent
|
||||||
// spreadWaterPressure: "visited"
|
|
||||||
#define VOXELFLAG_CHECKED3 (1<<4)
|
#define VOXELFLAG_CHECKED3 (1<<4)
|
||||||
// Algorithm-dependent
|
// Algorithm-dependent
|
||||||
// water: "pressure check route node"
|
|
||||||
#define VOXELFLAG_CHECKED4 (1<<5)
|
#define VOXELFLAG_CHECKED4 (1<<5)
|
||||||
|
|
||||||
enum VoxelPrintMode
|
enum VoxelPrintMode
|
||||||
|
Loading…
Reference in New Issue
Block a user