aboutsummaryrefslogtreecommitdiff
path: root/src/content_nodemeta.cpp
Commit message (Collapse)AuthorAge
* (se)SerializeString: Include max length in the nameSmallJoker2020-10-01
| | | | | | | This commit clarifies the maximal length of the serialized strings. It will avoid accidental use of serializeString() when a larger string can be expected. Removes unused Wide String serialization functions
* C++11 patchset 9: move hardcoded init parameters to class definitions (part ↵Loïc Blot2017-06-16
| | | | | | | | | | | | | | | | | | | | | | | | 1) (#5984) * C++11 patchset 9: move hardcoded init parameters to class definitions C++11 introduced the possibility to define the default values directly in class definitions, do it on current code Also remove some unused attributes * CollisionInfo::bouncy * collisionMoveResult::collides_xy * collisionMoveResult::standing_on_unloaded * Clouds::speed * More constructor cleanups + some variables removal * remove only write guiFormSpecMenu::m_old_tooltip * move header included inside defintions in genericobject.h * remove some unused since years exception classes * remove unused & empty debug_stacks_init * remove unused & empty content_nodemeta_serialize_legacy * remove forgotten useless bool (bouncy) in collision.cpp code
* Make node timers more efficientEkdohibs2016-06-11
|
* Rename macros with two leading underscoresShadowNinja2015-10-14
| | | | These names are reserved for the compiler/library implementations.
* Use warningstream for log messages with WARNINGShadowNinja2015-10-14
| | | | Remove DTIME macro and its uses, too
* Various style cleanups + unused code removalest312015-09-19
| | | | | | | | | | -> Don't pass pointer to whole IGameDef to NodeMetadata constructors and deserializers, but only to IItemDefManager, which is needed -> Remove the unused content_mapnode_get_new_name() method -> Fix style for MapBlock::deSerialize and MapBlock::deSerialize_pre22, improving accuracy of error messages a bit -> Fix style at other serialisation methods too -> Improve accuracy of some comments
* Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenuKahrl2013-08-14
|
* Update Copyright YearsSfan52013-02-24
|
* Change Minetest-c55 to MinetestPilzAdam2013-02-24
|
* Implement formspecdarkrose2012-07-22
|
* Properly and efficiently use split utility headersPerttu Ahola2012-06-17
|
* Switch the license to be LGPLv2/later, with small parts still remaining as ↵Perttu Ahola2012-06-05
| | | | GPLv2/later, by agreement of major contributors
* Fix loading of old signsPerttu Ahola2012-06-04
|
* Fix loading of legacy chestsPerttu Ahola2012-06-03
|
* Implement sign using form field protocolPerttu Ahola2012-06-03
|
* Convert legacy chest inventory list "0" to "main"Perttu Ahola2012-06-03
|
* Strip unneeded variables from NodeMetadatadarkrose2012-06-03
|
* WIP node metadata, node timersKahrl2012-06-03
|
* Fix server hang when stepping a furnace with a huge dtimeKahrl2012-02-02
|
* The huge item definition and item namespace unification patch (itemdef), see ↵Kahrl2012-01-12
| | | | http://c55.me/minetest/wiki/doku.php?id=changes:itemdef
* Move NodeMetadata prototype containers to content_nodemeta.cpp to fix them ↵Perttu Ahola2011-12-01
| | | | not being filled correctly on some systems and compilers
* GenericNodeMetadata and an example furnacePerttu Ahola2011-11-29
|
* Mode node definition loading from Lua (still not finished), fix metadata ↵Perttu Ahola2011-11-29
| | | | creation from name
* Add names to NodeMetadataPerttu Ahola2011-11-29
|
* Do not expose CONTENT_* stuff in content_mapnode.h and use a name converter ↵Perttu Ahola2011-11-29
| | | | wrapper in old code
* Remove burn time definitions from FurnaceNodeMetadataPerttu Ahola2011-11-29
|
* Clean mapnode.h and fix other files accordinglyPerttu Ahola2011-11-29
|
* Create framework for getting rid of global definitions of ↵Perttu Ahola2011-11-29
| | | | node/tool/item/whatever types
* Switch more stuff to use the logging thing and fix segfault on player leave ↵Perttu Ahola2011-10-16
| | | | from server as introduced in a previous switch-to-logging commit
* added locking chests - clean patchdarkrose2011-09-22
|
* Furnace was crashing stuff againJacobF2011-09-02
|
* * Furnace would say it was overloaded when it had a non-cookable sourceJacobF2011-09-01
| | | | | * I didn't understand that expression last fix and now the furnace would burn fuel even when it had no source item.
* If there was no source item in a furnace it would cause a segmentation fault.JacobF2011-08-30
|
* Merge remote-tracking branch 'queatz/furnace-is-not-blackhole'Perttu Ahola2011-08-30
|\
| * Don't remove furnace if something is inside it.JacobF2011-08-24
| |
* | Merged 2 branches because they relied on each other.JacobF2011-08-25
|/ | | | | | | | | | | This one contains these changes from main c55: * Adds a function to check if there is room for a specific item * Using that, you can now pick up rats if you have a full inventory and a not full rat stack * Furnace would cook only 1 item if that item used the last available result slot, now it will continue * Furnace will say it's overloaded * Furnace won't wait until the next step to start on the next item - This caused small fuels to cook slower than meant to - Also caused furnaces to say they were out of fuel after finishing the last fuel item
* Some inventory const-ificationGiuseppe Bilotta2011-08-11
|
* made more things burnable in furnacePerttu Ahola2011-07-30
|
* fixed wrong furnace menu layoutPerttu Ahola2011-06-18
|
* moved inventory menu definition of chest and furnace to content_nodemeta.{h,cpp}Perttu Ahola2011-06-18
|
* Created and moved stuff to content_nodemeta.{h,cpp}Perttu Ahola2011-06-18
an class="hl opt">) self:print(HR) for modname,mod_stats in pairs(profile.stats) do if filter_matches(filter, modname) then self:format_row(modname, nil, mod_stats) if mod_stats.instruments ~= nil then for instrument_name, instrument_stats in pairs(mod_stats.instruments) do self:format_row(nil, instrument_name, instrument_stats) end end end end self:print(HR) if not filter then self:format_row("total", nil, profile.stats_total) end end } local CsvFormatter = Formatter:new { format_row = function(self, modname, instrument_name, statistics) self:print( "%q,%q,%d,%d,%d,%d,%d,%f,%f,%f", modname, instrument_name, statistics.samples, statistics.time_min, statistics.time_max, statistics:get_time_avg(), statistics.time_all, statistics.part_min, statistics.part_max, statistics:get_part_avg() ) end, format = function(self, filter) self:print( "%q,%q,%q,%q,%q,%q,%q,%q,%q,%q", "modname", "instrumentation", "samples", "time min µs", "time max µs", "time avg µs", "time all µs", "part min %", "part max %", "part avg %" ) for modname, mod_stats in pairs(self.profile.stats) do if filter_matches(filter, modname) then self:format_row(modname, "*", mod_stats) if mod_stats.instruments ~= nil then for instrument_name, instrument_stats in pairs(mod_stats.instruments) do self:format_row(modname, instrument_name, instrument_stats) end end end end end } local function format_statistics(profile, format, filter) local formatter if format == "csv" then formatter = CsvFormatter:new { profile = profile } else formatter = TxtFormatter:new { profile = profile } end formatter:format(filter) return formatter:flush() end --- -- Format the profile ready for display and -- @return string to be printed to the console -- function reporter.print(profile, filter) if filter == "" then filter = nil end return format_statistics(profile, "txt", filter) end --- -- Serialize the profile data and -- @return serialized data to be saved to a file -- local function serialize_profile(profile, format, filter) if format == "lua" or format == "json" or format == "json_pretty" then local stats = filter and {} or profile.stats if filter then for modname, mod_stats in pairs(profile.stats) do if filter_matches(filter, modname) then stats[modname] = mod_stats end end end if format == "lua" then return core.serialize(stats) elseif format == "json" then return core.write_json(stats) elseif format == "json_pretty" then return core.write_json(stats, true) end end -- Fall back to textual formats. return format_statistics(profile, format, filter) end local worldpath = core.get_worldpath() local function get_save_path(format, filter) local report_path = settings:get("profiler.report_path") or "" if report_path ~= "" then core.mkdir(sprintf("%s%s%s", worldpath, DIR_DELIM, report_path)) end return (sprintf( "%s/%s/profile-%s%s.%s", worldpath, report_path, os.date("%Y%m%dT%H%M%S"), filter and ("-" .. filter) or "", format ):gsub("[/\\]+", DIR_DELIM))-- Clean up delims end --- -- Save the profile to the world path. -- @return success, log message -- function reporter.save(profile, format, filter) if not format or format == "" then format = settings:get("profiler.default_report_format") or "txt" end if filter == "" then filter = nil end local path = get_save_path(format, filter) local output, io_err = io.open(path, "w") if not output then return false, "Saving of profile failed with: " .. io_err end local content, err = serialize_profile(profile, format, filter) if not content then output:close() return false, "Saving of profile failed with: " .. err end output:write(content) output:close() local logmessage = "Profile saved to " .. path core.log("action", logmessage) return true, logmessage end return reporter