Merge remote-tracking branch 'minetest/master'

This commit is contained in:
proller 2016-09-21 16:21:17 +03:00
commit 5588f109f4
7 changed files with 32 additions and 10 deletions

View File

@ -128,7 +128,9 @@ function core.register_item(name, itemdef)
}
end
if itemdef.light_source and itemdef.light_source > core.LIGHT_MAX then
print("Unable to register node: 'light_source' exceeds maximum: " .. name)
itemdef.light_source = core.LIGHT_MAX
core.log("warning", "Node 'light_source' value exceeds maximum," ..
" limiting to maximum: " ..name)
end
setmetatable(itemdef, {__index = core.nodedef_default})
core.registered_nodes[itemdef.name] = itemdef

View File

@ -561,13 +561,13 @@ freetype (Freetype fonts) bool true
# Path to TrueTypeFont or bitmap.
font_path (Font path) path fonts/liberationsans.ttf
font_size (Font size) int 15
font_size (Font size) int 16
# Font shadow offset, if 0 then shadow will not be drawn.
font_shadow (Font shadow) int 1
# Font shadow alpha (opaqueness, between 0 and 255).
font_shadow_alpha (Font shadow alpha) int 128 0 255
font_shadow_alpha (Font shadow alpha) int 127 0 255
mono_font_path (Monospace font path) path fonts/liberationmono.ttf

View File

@ -655,7 +655,7 @@
# font_path = fonts/liberationsans.ttf
# type: int
# font_size = 15
# font_size = 16
# Font shadow offset, if 0 then shadow will not be drawn.
# type: int
@ -663,7 +663,7 @@
# Font shadow alpha (opaqueness, between 0 and 255).
# type: int min: 0 max: 255
# font_shadow_alpha = 128
# font_shadow_alpha = 127
# type: path
# mono_font_path = fonts/liberationmono.ttf

View File

@ -116,7 +116,7 @@ along with Freeminer. If not, see <http://www.gnu.org/licenses/>.
//#elif defined(__ANDROID__)
// #define TTF_DEFAULT_FONT_SIZE (17)
#else
#define TTF_DEFAULT_FONT_SIZE (17)
#define TTF_DEFAULT_FONT_SIZE (16)
#endif
#define DEFAULT_FONT_SIZE (10)

View File

@ -570,7 +570,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("freetype", "true");
settings->setDefault("font_path", porting::getDataPath("fonts" DIR_DELIM "liberationsans.ttf"));
settings->setDefault("font_shadow", "1");
settings->setDefault("font_shadow_alpha", "128");
settings->setDefault("font_shadow_alpha", "127");
settings->setDefault("mono_font_path", porting::getDataPath("fonts" DIR_DELIM "liberationmono.ttf"));
settings->setDefault("fallback_font_path", porting::getDataPath("fonts" DIR_DELIM "DroidSansFallbackFull.ttf"));

View File

@ -77,6 +77,11 @@ void NodeMetadata::clear()
m_inventory->clear();
}
bool NodeMetadata::empty() const
{
return m_stringvars.size() == 0 && m_inventory->getLists().size() == 0;
}
/*
NodeMetadataList
*/
@ -87,14 +92,13 @@ void NodeMetadataList::serialize(std::ostream &os) const
Version 0 is a placeholder for "nothing to see here; go away."
*/
if(m_data.empty()){
u16 count = countNonEmpty();
if (count == 0) {
writeU8(os, 0); // version
return;
}
writeU8(os, 1); // version
u16 count = m_data.size();
writeU16(os, count);
for(std::map<v3s16, NodeMetadata*>::const_iterator
@ -103,6 +107,8 @@ void NodeMetadataList::serialize(std::ostream &os) const
{
v3s16 p = i->first;
NodeMetadata *data = i->second;
if (data->empty())
continue;
u16 p16 = p.Z * MAP_BLOCKSIZE * MAP_BLOCKSIZE + p.Y * MAP_BLOCKSIZE + p.X;
writeU16(os, p16);
@ -203,6 +209,17 @@ void NodeMetadataList::clear()
m_data.clear();
}
int NodeMetadataList::countNonEmpty() const
{
int n = 0;
std::map<v3s16, NodeMetadata*>::const_iterator it;
for (it = m_data.begin(); it != m_data.end(); ++it) {
if (!it->second->empty())
n++;
}
return n;
}
std::string NodeMetadata::getString(const std::string &name,
unsigned short recursion) const
{

View File

@ -50,6 +50,7 @@ public:
void deSerialize(std::istream &is);
void clear();
bool empty() const;
// Generic key/value store
std::string getString(const std::string &name, unsigned short recursion = 0) const;
@ -97,6 +98,8 @@ public:
void clear();
private:
int countNonEmpty() const;
std::map<v3s16, NodeMetadata *> m_data;
};