Commit Graph

41 Commits

Author SHA1 Message Date
sfan5 f0bad0e2ba
Reserve vectors before pushing and other code quality changes (#11161) 2021-04-05 13:38:31 +02:00
SmallJoker 947466ab28 (se)SerializeString: Include max length in the name
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
2020-10-01 09:52:59 +02:00
SmallJoker 3d66622772
Send only changed node metadata to clients instead of whole mapblock (#5268)
Includes newer style changes and fixes by est31

Improve the block position de-serialization
Add type NodeMetadataMap
2018-12-04 20:37:48 +01:00
Loïc Blot 1992db1395 Code modernization: src/n*, src/o* (#6280)
* Code modernization: src/n*, src/o*

* empty function
* default constructor/destructor
* for range-based loops
* use emplace_back instead of push_back
* remove unused IWritableNodeDefManager::clone()
* C++ STL header style
* Pointer constness in some functions
2017-08-19 11:30:46 +02:00
sfan5 071e114ffa Private nodemeta (#5702)
* Private node metadata that isn't sent to the client
2017-05-10 15:29:21 +02:00
rubenwardy bbdd869d72 Derive NodeMetadata from Metadata 2017-02-04 22:07:55 +00:00
sfan5 3a57e52500 Do not serialize empty NodeMetadata
This commit fixes #4516, though note that this will gradually fix MapBlocks
as they are used/modified and thus re-serialized.
2016-09-21 10:29:17 +02:00
ShadowNinja 6f2d785d0f Rename macros with two leading underscores
These names are reserved for the compiler/library implementations.
2015-10-14 02:39:37 -04:00
ShadowNinja 96cc5b34fe Use warningstream for log messages with WARNING
Remove DTIME macro and its uses, too
2015-10-14 01:36:48 -04:00
est31 452df1c723 Various style cleanups + unused code removal
-> 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
2015-09-19 20:57:29 +02:00
David Jones 34b7a147dc Change i++ to ++i 2015-08-25 18:33:52 -04:00
kwolekr da34a2b33e Replace instances of std::map<std::string, std::string> with StringMap
Also, clean up surrounding code style
Replace by-value parameter passing with const refs when possible
Fix post-increment of iterators
2015-05-19 16:10:49 -04:00
kwolekr b785577f03 Add core.find_nodes_with_meta() script API 2015-05-05 16:21:59 -04:00
sapier a39c136e69 Fix NodeMetadataList loosing memory on deserialize due to invalid clear map call instead of clear 2015-01-17 19:14:36 +01:00
Anton 10e0cf8b2c Use std::string::empty() instead of size() where applicable 2014-12-12 15:16:24 -05:00
Rafael Reilova f7d65091f8 serialize.h: use machine native byte swapping if available, fall-back to previous generic method if not (supported for GCC using endian.h, detection done in cmake) write/readARGB8() - just write 32-bit color in one op, instead of 4 1-byte ops cleanup: removed unneeded buffer init for some serialize-out functions use a #define for the fixed point factor in read/writeF1000()
nodemetadata.cpp, nodetimer.cpp
	optimzation: simpler deserialize node position method

staticobject.cpp:
	cleanup: use util/serialize.h inlines instead of its own de/serialization

serialize.cpp:
	minor optimization/cleanup: avoid generation of unneeded string temporary

CMakeLists.txt, cmake_config.h.in: detection of endian.h

config.h: added HAVE_ENDIAN_H

Commits due to feedback squashed

Signed-off-by: Craig Robbins <kde.psych@gmail.com>
2014-11-21 22:33:48 +10:00
ShadowNinja e17f140be0 Add a limit to node meta data resolving recursion 2014-05-07 17:05:44 -04:00
Sfan5 6d0ea26c2d Update Copyright Years 2013-02-24 20:15:24 +01:00
PilzAdam 497ff1ecd6 Change Minetest-c55 to Minetest 2013-02-24 18:49:03 +01:00
Perttu Ahola d0ea6f9920 Properly and efficiently use split utility headers 2012-06-17 02:40:36 +03:00
Perttu Ahola 037b259197 Switch the license to be LGPLv2/later, with small parts still remaining as GPLv2/later, by agreement of major contributors 2012-06-05 18:54:07 +03:00
darkrose c4315a7afa Strip unneeded variables from NodeMetadata 2012-06-03 22:31:00 +03:00
Kahrl 704782c95b WIP node metadata, node timers 2012-06-03 22:31:00 +03:00
Perttu Ahola 8b8ef8acc0 Move NodeMetadata prototype containers to content_nodemeta.cpp to fix them not being filled correctly on some systems and compilers 2011-12-01 01:58:31 +02:00
Perttu Ahola 18bb0ea1ea Mode node definition loading from Lua (still not finished), fix metadata creation from name 2011-11-29 19:13:51 +02:00
Perttu Ahola 3b3ca65562 Add names to NodeMetadata 2011-11-29 19:13:50 +02:00
Perttu Ahola abceeee92f Create framework for getting rid of global definitions of node/tool/item/whatever types 2011-11-29 19:13:41 +02:00
Perttu Ahola 0bf533f753 Switch more stuff to use the logging thing and fix segfault on player leave from server as introduced in a previous switch-to-logging commit 2011-10-16 16:28:12 +03:00
Perttu Ahola da692355e8 Created and moved stuff to content_nodemeta.{h,cpp} 2011-06-18 00:46:50 +03:00
Perttu Ahola dc5319b6c9 Moved some mapnode content stuff from mapnode.{h,cpp} and digging property stuff from material.cpp to content_mapnode.{h,cpp} 2011-06-17 22:20:15 +03:00
Perttu Ahola d6b54514bf hopefully fixed old furnaces taking ridiculous amounts of cpu and halting the server 2011-06-16 19:43:28 +03:00
Perttu Ahola bbead93c1a Reduced server CPU usage on NodeMetadata step()s. Also furnace now cooks while no players are near it. 2011-05-31 20:02:55 +03:00
Perttu Ahola 4b54b291ae Some progress on transitioning from MapBlockObject to ActiveObject. 2011-04-08 00:47:14 +03:00
Perttu Ahola 212f34db82 fixed the bug of disabled removal of empty chests 2011-04-06 01:42:37 +03:00
Perttu Ahola 89aa8b9be1 Furnace is now usable. Added more tools.
--HG--
rename : data/tool_stpick.png => data/tool_stonepick.png
rename : data/tool_wpick.png => data/tool_woodpick.png
2011-04-05 18:23:30 +03:00
Perttu Ahola d6d811f97b A more robust format for node metadata 2011-04-05 10:59:48 +03:00
Perttu Ahola d1d57cf5c3 initial workings of the furnace 2011-04-05 02:56:29 +03:00
Perttu Ahola 389fe31ace changed node metadata format to better accomodate future needs and problems 2011-04-05 00:24:47 +03:00
Perttu Ahola 4a92df6ff0 Chests work now! 2011-04-04 15:13:19 +03:00
Perttu Ahola 9e683fff50 initial chest metadata 2011-04-04 11:18:14 +03:00
Perttu Ahola 3a58f8179f forgot some files 2011-04-04 05:13:08 +03:00