From: Perttu Ahola Date: Mon, 14 Nov 2011 21:39:32 +0000 (+0200) Subject: ToolDefinition serialization X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=8d2d28f1dc575a6ed5e3aeb63a6c1b917813aeb4;p=zefram%2Fminetest%2Fminetest_engine.git ToolDefinition serialization --- diff --git a/src/tooldef.cpp b/src/tooldef.cpp index f35cf2b8..93bedf92 100644 --- a/src/tooldef.cpp +++ b/src/tooldef.cpp @@ -20,7 +20,65 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "tooldef.h" #include "irrlichttypes.h" #include "log.h" -#include +#include +#include "utility.h" + +ToolDiggingProperties::ToolDiggingProperties( + float a, float b, float c, float d, float e, + float f, float g, float h, float i, float j): + basetime(a), + dt_weight(b), + dt_crackiness(c), + dt_crumbliness(d), + dt_cuttability(e), + basedurability(f), + dd_weight(g), + dd_crackiness(h), + dd_crumbliness(i), + dd_cuttability(j) +{} + +std::string ToolDefinition::dump() +{ + std::ostringstream os(std::ios::binary); + os<<"[ToolDefinition::dump() not implemented due to lazyness]" + < +#include /* TODO: Rename to tooldef.h @@ -40,19 +41,9 @@ struct ToolDiggingProperties float dd_crumbliness; float dd_cuttability; - ToolDiggingProperties(float a=0.75, float b=0, float c=0, float d=0, float e=0, - float f=50, float g=0, float h=0, float i=0, float j=0): - basetime(a), - dt_weight(b), - dt_crackiness(c), - dt_crumbliness(d), - dt_cuttability(e), - basedurability(f), - dd_weight(g), - dd_crackiness(h), - dd_crumbliness(i), - dd_cuttability(j) - {} + ToolDiggingProperties( + float a=0.75, float b=0, float c=0, float d=0, float e=0, + float f=50, float g=0, float h=0, float i=0, float j=0); }; struct ToolDefinition @@ -66,6 +57,10 @@ struct ToolDefinition imagename(imagename_), properties(properties_) {} + + std::string dump(); + void serialize(std::ostream &os); + void deSerialize(std::istream &is); }; class IToolDefManager