more backporting and bugfixes

This commit is contained in:
darkrose 2013-05-18 13:57:52 +10:00
parent 0fa0585608
commit 1a51606ffb
3 changed files with 18 additions and 27 deletions

View File

@ -1245,7 +1245,7 @@ void ServerEnvironment::step(float dtime)
}
if (n.getContent() == CONTENT_LEAVES) // leaf decay
{
if (myrand()%20 == 0)
if (myrand()%10 == 0)
{
s16 max_d = 3;
v3s16 leaf_p = p;

View File

@ -796,32 +796,21 @@ bool generate_image(std::string part_of_name, video::IImage *& baseimg,
if(image == NULL)
{
infostream<<"generate_image(): Could not load image \""
<<part_of_name<<"\" from path \""<<path<<"\""
<<" while building texture"<<std::endl;
if (part_of_name != "") {
infostream<<"generate_image(): Could not load image \""
<<part_of_name<<"\" from path \""<<path<<"\""
<<" while building texture"<<std::endl;
//return false;
infostream<<"generate_image(): Creating a dummy"
<<" image for \""<<part_of_name<<"\""<<std::endl;
infostream<<"generate_image(): Creating a dummy"
<<" image for \""<<part_of_name<<"\""<<std::endl;
}
// Just create a dummy image
//core::dimension2d<u32> dim(2,2);
core::dimension2d<u32> dim(1,1);
image = driver->createImage(video::ECF_A8R8G8B8, dim);
assert(image);
/*image->setPixel(0,0, video::SColor(255,255,0,0));
image->setPixel(1,0, video::SColor(255,0,255,0));
image->setPixel(0,1, video::SColor(255,0,0,255));
image->setPixel(1,1, video::SColor(255,255,0,255));*/
image->setPixel(0,0, video::SColor(255,myrand()%256,
myrand()%256,myrand()%256));
/*image->setPixel(1,0, video::SColor(255,myrand()%256,
myrand()%256,myrand()%256));
image->setPixel(0,1, video::SColor(255,myrand()%256,
myrand()%256,myrand()%256));
image->setPixel(1,1, video::SColor(255,myrand()%256,
myrand()%256,myrand()%256));*/
}
// If base image is NULL, load as base.

View File

@ -309,21 +309,21 @@ void VoxelManipulator::unspreadLight(enum LightBank bank, v3s16 p, u8 oldlight,
If the neighbor is dimmer than what was specified
as oldlight (the light of the previous node)
*/
if(n2.getLight(bank) < oldlight)
u8 light2 = n2.getLight(bank);
if(light2 < oldlight)
{
/*
And the neighbor is transparent and it has some light
*/
if(n2.light_propagates() && n2.getLight(bank) != 0)
if(n2.light_propagates() && light2 != 0)
{
/*
Set light to 0 and add to queue
*/
u8 current_light = n2.getLight(bank);
n2.setLight(bank, 0);
unspreadLight(bank, n2pos, current_light, light_sources);
unspreadLight(bank, n2pos, light2, light_sources);
/*
Remove from light_sources if it is there
@ -526,12 +526,13 @@ void VoxelManipulator::spreadLight(enum LightBank bank, v3s16 p)
continue;
MapNode &n2 = m_data[n2i];
u8 light2 = n2.getLight(bank);
/*
If the neighbor is brighter than the current node,
add to list (it will light up this node on its turn)
*/
if(n2.getLight(bank) > undiminish_light(oldlight))
if(light2 > undiminish_light(oldlight))
{
spreadLight(bank, n2pos);
}
@ -539,7 +540,7 @@ void VoxelManipulator::spreadLight(enum LightBank bank, v3s16 p)
If the neighbor is dimmer than how much light this node
would spread on it, add to list
*/
if(n2.getLight(bank) < newlight)
if(light2 < newlight)
{
if(n2.light_propagates())
{
@ -631,12 +632,13 @@ void VoxelManipulator::spreadLight(enum LightBank bank,
continue;
MapNode &n2 = m_data[n2i];
u8 light2 = n2.getLight(bank);
/*
If the neighbor is brighter than the current node,
add to list (it will light up this node on its turn)
*/
if(n2.getLight(bank) > undiminish_light(oldlight))
if(light2 > undiminish_light(oldlight))
{
lighted_nodes.insert(n2pos, true);
}
@ -644,7 +646,7 @@ void VoxelManipulator::spreadLight(enum LightBank bank,
If the neighbor is dimmer than how much light this node
would spread on it, add to list
*/
if(n2.getLight(bank) < newlight)
if(light2 < newlight)
{
if(n2.light_propagates())
{