aboutsummaryrefslogtreecommitdiff
path: root/src/genericobject.h
diff options
context:
space:
mode:
authorkwolekr <mirrorisim@gmail.com>2012-10-28 18:31:14 -0300
committerPerttu Ahola <celeron55@gmail.com>2013-01-21 21:41:09 +0200
commit9b3287b86512a4f4a19cbe036b218e684aa54479 (patch)
tree5693fd60c277e8fbfec0c337880de1d75f241d04 /src/genericobject.h
parent14657bd29a0b6783fc97029769af6d48a05d473d (diff)
downloadminetest-9b3287b86512a4f4a19cbe036b218e684aa54479.tar.gz
minetest-9b3287b86512a4f4a19cbe036b218e684aa54479.tar.bz2
minetest-9b3287b86512a4f4a19cbe036b218e684aa54479.zip
stop MSVC++ from generating dumb warnings
Diffstat (limited to 'src/genericobject.h')
0 files changed, 0 insertions, 0 deletions
> 119 120 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
/*
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 "genericobject.h"
#include <sstream>
#include "util/serialize.h"

std::string gob_cmd_set_properties(const ObjectProperties &prop)
{
	std::ostringstream os(std::ios::binary);
	writeU8(os, GENERIC_CMD_SET_PROPERTIES);
	prop.serialize(os);
	return os.str();
}

ObjectProperties gob_read_set_properties(std::istream &is)
{
	ObjectProperties prop;
	prop.deSerialize(is);
	return prop;
}

std::string gob_cmd_update_position(
	v3f position,
	v3f velocity,
	v3f acceleration,
	f32 yaw,
	bool do_interpolate,
	bool is_movement_end,
	f32 update_interval
){
	std::ostringstream os(std::ios::binary);
	// command
	writeU8(os, GENERIC_CMD_UPDATE_POSITION);
	// pos
	writeV3F1000(os, position);
	// velocity
	writeV3F1000(os, velocity);
	// acceleration
	writeV3F1000(os, acceleration);
	// yaw
	writeF1000(os, yaw);
	// do_interpolate
	writeU8(os, do_interpolate);
	// is_end_position (for interpolation)
	writeU8(os, is_movement_end);