From 7b8d372947aae232ddf598155e972bb4dda157af Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Thu, 15 Oct 2015 01:08:18 -0400 Subject: Use warningstream for deprecated field messages and refactor log_deprecated --- src/script/common/c_content.cpp | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'src/script/common/c_content.cpp') diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index 3754fc2ff..00ec85b2f 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -76,7 +76,7 @@ ItemDefinition read_item_definition(lua_State* L,int index, getboolfield(L, index, "liquids_pointable", def.liquids_pointable); warn_if_field_exists(L, index, "tool_digging_properties", - "deprecated: use tool_capabilities"); + "Deprecated; use tool_capabilities"); lua_getfield(L, index, "tool_capabilities"); if(lua_istable(L, -1)){ @@ -427,17 +427,17 @@ ContentFeatures read_content_features(lua_State *L, int index) // Warn about some deprecated fields warn_if_field_exists(L, index, "wall_mounted", - "deprecated: use paramtype2 = 'wallmounted'"); + "Deprecated; use paramtype2 = 'wallmounted'"); warn_if_field_exists(L, index, "light_propagates", - "deprecated: determined from paramtype"); + "Deprecated; determined from paramtype"); warn_if_field_exists(L, index, "dug_item", - "deprecated: use 'drop' field"); + "Deprecated; use 'drop' field"); warn_if_field_exists(L, index, "extra_dug_item", - "deprecated: use 'drop' field"); + "Deprecated; use 'drop' field"); warn_if_field_exists(L, index, "extra_dug_item_rarity", - "deprecated: use 'drop' field"); + "Deprecated; use 'drop' field"); warn_if_field_exists(L, index, "metadata_name", - "deprecated: use on_add and metadata callbacks"); + "Deprecated; use on_add and metadata callbacks"); // True for all ground-like things like stone and mud, false for eg. trees getboolfield(L, index, "is_ground_content", f.is_ground_content); @@ -639,14 +639,13 @@ void pushnode(lua_State *L, const MapNode &n, INodeDefManager *ndef) /******************************************************************************/ void warn_if_field_exists(lua_State *L, int table, - const char *fieldname, const std::string &message) + const char *name, const std::string &message) { - lua_getfield(L, table, fieldname); - if(!lua_isnil(L, -1)){ -//TODO find way to access backtrace fct from here - // infostream<