summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content_mapnode.cpp2
-rw-r--r--src/content_nodemeta.cpp19
-rw-r--r--src/content_sao.cpp5
-rw-r--r--src/defaultsettings.cpp1
-rw-r--r--src/filesys.cpp2
-rw-r--r--src/inventory.cpp19
-rw-r--r--src/inventory.h2
-rw-r--r--src/map.cpp15
-rw-r--r--src/tile.cpp1
9 files changed, 47 insertions, 19 deletions
diff --git a/src/content_mapnode.cpp b/src/content_mapnode.cpp
index 386a5e4ee..e18112ae4 100644
--- a/src/content_mapnode.cpp
+++ b/src/content_mapnode.cpp
@@ -293,7 +293,7 @@ void content_mapnode_init()
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->solidness = 0; // drawn separately, makes no faces
f->air_equivalent = true; // grass grows underneath
- f->setInventoryTexture("item_fence.png");
+ f->setInventoryTexture("fence.png");
setWoodLikeDiggingProperties(f->digging_properties, 0.75);
i = CONTENT_RAIL;
diff --git a/src/content_nodemeta.cpp b/src/content_nodemeta.cpp
index e8f1e197e..1552c8e15 100644
--- a/src/content_nodemeta.cpp
+++ b/src/content_nodemeta.cpp
@@ -182,7 +182,7 @@ std::string FurnaceNodeMetadata::infoText()
assert(src_list);
const InventoryItem *src_item = src_list->getItem(0);
- if(src_item) {
+ if(src_item && src_item->isCookable()) {
InventoryList *dst_list = m_inventory->getList("dst");
if(!dst_list->roomForCookedItem(src_item))
return "Furnace is overloaded";
@@ -245,7 +245,7 @@ bool FurnaceNodeMetadata::step(float dtime)
InventoryList *src_list = m_inventory->getList("src");
assert(src_list);
- const InventoryItem *src_item = src_list->getItem(0);
+ InventoryItem *src_item = src_list->getItem(0);
bool room_available = false;
@@ -284,17 +284,22 @@ bool FurnaceNodeMetadata::step(float dtime)
}
changed = true;
- // Fall through if the fuel item was used up this step
+ // If the fuel was not used up this step, just keep burning it
if(m_fuel_time < m_fuel_totaltime)
continue;
}
/*
- If there is no source item or source item is not cookable,
- or furnace became overloaded, stop loop.
+ Get the source again in case it has all burned
+ */
+ src_item = src_list->getItem(0);
+
+ /*
+ If there is no source item, or the source item is not cookable,
+ or the furnace is still cooking, or the furnace became overloaded, stop loop.
*/
- if((m_fuel_time < m_fuel_totaltime || (src_item && dst_list->roomForCookedItem(src_item) == false))
- && (src_item == NULL || m_src_totaltime < 0.001))
+ if(src_item == NULL || !room_available || m_fuel_time < m_fuel_totaltime ||
+ dst_list->roomForCookedItem(src_item) == false)
{
m_step_accumulator = 0;
break;
diff --git a/src/content_sao.cpp b/src/content_sao.cpp
index 638f50c9d..0bb518c16 100644
--- a/src/content_sao.cpp
+++ b/src/content_sao.cpp
@@ -226,6 +226,11 @@ void ItemSAO::rightClick(Player *player)
if(to_be_deleted)
m_removed = true;
+ else
+ // Reflect changes to the item here
+ m_inventorystring = item->getItemString();
+
+ delete item;
}
/*
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index 8438bf4f5..1e17f2f3a 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -85,6 +85,7 @@ void set_default_settings()
g_settings.setDefault("default_privs", "build, shout");
g_settings.setDefault("profiler_print_interval", "0");
g_settings.setDefault("enable_mapgen_debug_info", "false");
+ g_settings.setDefault("fixed_map_seed", "");
g_settings.setDefault("objectdata_interval", "0.2");
g_settings.setDefault("active_object_range", "2");
diff --git a/src/filesys.cpp b/src/filesys.cpp
index 037d21fdb..8aa10ba58 100644
--- a/src/filesys.cpp
+++ b/src/filesys.cpp
@@ -254,7 +254,7 @@ bool RecursiveDelete(std::string path)
execv(argv[0], argv);
// Execv shouldn't return. Failed.
- return false;
+ _exit(1);
}
else
{
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 116ceeb6d..f31e19f77 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -122,16 +122,20 @@ InventoryItem* InventoryItem::deSerialize(std::istream &is)
}
}
+std::string InventoryItem::getItemString() {
+ // Get item string
+ std::ostringstream os(std::ios_base::binary);
+ serialize(os);
+ return os.str();
+}
+
ServerActiveObject* InventoryItem::createSAO(ServerEnvironment *env, u16 id, v3f pos)
{
/*
Create an ItemSAO
*/
- // Get item string
- std::ostringstream os(std::ios_base::binary);
- serialize(os);
// Create object
- ServerActiveObject *obj = new ItemSAO(env, 0, pos, os.str());
+ ServerActiveObject *obj = new ItemSAO(env, 0, pos, getItemString());
return obj;
}
@@ -200,12 +204,17 @@ bool CraftItem::use(ServerEnvironment *env, Player *player)
{
if(item_craft_is_eatable(m_subname))
{
+ u16 result_count = getCount() - 1; // Eat one at a time
s16 hp_change = item_craft_eat_hp_change(m_subname);
if(player->hp + hp_change > 20)
player->hp = 20;
else
player->hp += hp_change;
- return true;
+
+ if(result_count < 1)
+ return true;
+ else
+ setCount(result_count);
}
return false;
}
diff --git a/src/inventory.h b/src/inventory.h
index b19a365c8..44ba6a5ad 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -58,6 +58,8 @@ public:
#endif
// Shall return a text to show in the GUI
virtual std::string getText() { return ""; }
+ // Returns the string used for inventory
+ virtual std::string getItemString();
// Creates an object from the item, to be placed in the world.
virtual ServerActiveObject* createSAO(ServerEnvironment *env, u16 id, v3f pos);
// Gets amount of items that dropping one SAO will decrement
diff --git a/src/map.cpp b/src/map.cpp
index 46ee5b53f..5e2fd558c 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -1894,10 +1894,17 @@ ServerMap::ServerMap(std::string savedir):
//m_chunksize = 8; // Takes a few seconds
- m_seed = (((u64)(myrand()%0xffff)<<0)
- + ((u64)(myrand()%0xffff)<<16)
- + ((u64)(myrand()%0xffff)<<32)
- + ((u64)(myrand()%0xffff)<<48));
+ if (g_settings.get("fixed_map_seed").empty())
+ {
+ m_seed = (((u64)(myrand()%0xffff)<<0)
+ + ((u64)(myrand()%0xffff)<<16)
+ + ((u64)(myrand()%0xffff)<<32)
+ + ((u64)(myrand()%0xffff)<<48));
+ }
+ else
+ {
+ m_seed = g_settings.getU64("fixed_map_seed");
+ }
/*
Experimental and debug stuff
diff --git a/src/tile.cpp b/src/tile.cpp
index c93c0680b..d4244bd42 100644
--- a/src/tile.cpp
+++ b/src/tile.cpp
@@ -524,7 +524,6 @@ void TextureSource::buildMainAtlas()
sourcelist.push_back("cobble.png");
sourcelist.push_back("mossycobble.png");
sourcelist.push_back("gravel.png");
- sourcelist.push_back("cactus.png");
sourcelist.push_back("jungletree.png");
sourcelist.push_back("stone.png^mineral_coal.png");