summaryrefslogtreecommitdiff
path: root/src/gettext.cpp
diff options
context:
space:
mode:
authorCraig Robbins <kde.psych@gmail.com>2014-09-11 22:49:25 +1000
committerShadowNinja <shadowninja@minetest.net>2014-09-21 14:39:35 -0400
commitb97c9c65777b0389f4cc9a6e3257506f29761e03 (patch)
treeb98098387c7ecd87d8ac732df0afba31f018ff4d /src/gettext.cpp
parenta020d1b653f94fbcaac06c15f9dbab4521fda355 (diff)
downloadminetest-b97c9c65777b0389f4cc9a6e3257506f29761e03.tar.gz
minetest-b97c9c65777b0389f4cc9a6e3257506f29761e03.tar.bz2
minetest-b97c9c65777b0389f4cc9a6e3257506f29761e03.zip
Make getters of the Settings class const
Also removed 2 unused functions.
Diffstat (limited to 'src/gettext.cpp')
0 files changed, 0 insertions, 0 deletions
a id='n121' href='#n121'>121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "tool.h"
#include "itemgroup.h"
#include "log.h"
#include "inventory.h"
#include "exceptions.h"
#include "util/serialize.h"
#include "util/numeric.h"

void ToolCapabilities::serialize(std::ostream &os, u16 protocol_version) const
{
	writeU8(os, 2); // version (protocol >= 18)
	writeF1000(os, full_punch_interval);
	writeS16(os, max_drop_level);
	writeU32(os, groupcaps.size());
	for (ToolGCMap::const_iterator i = groupcaps.begin(); i != groupcaps.end(); ++i) {
		const std::string *name = &i->first;
		const ToolGroupCap *cap = &i->second;
		os << serializeString(*name);
		writeS16(os, cap->uses);
		writeS16(os, cap->maxlevel);
		writeU32(os, cap->times.size());
		for (UNORDERED_MAP<int, float>::const_iterator
				j = cap->times.begin(); j != cap->times.end(); ++j) {
			writeS16(os, j->first);
			writeF1000(os, j->second);
		}
	}

	writeU32(os, damageGroups.size());

	for (DamageGroup::const_iterator i = damageGroups.begin();
			i != damageGroups.end(); ++i) {
		os << serializeString(i->first);
		writeS16(os, i->second);
	}
}

void ToolCapabilities::deSerialize(std::istream &is)
{
	int version = readU8(is);
	if(version != 1 && version != 2) throw SerializationError(
			"unsupported ToolCapabilities version");
	full_punch_interval = readF1000(is);
	max_drop_level = readS16(is);
	groupcaps.clear();
	u32 groupcaps_size = readU32(is);
	for(u32 i=0; i<groupcaps_size; i++){
		std::string name = deSerializeString(is);
		ToolGroupCap cap;
		cap.uses = readS16(is);