//
m_is_player(false),
m_is_local_player(false),
- m_id(0),
//
m_smgr(NULL),
m_irr(NULL),
{
ClientActiveObject *obj = NULL;
- u16 attached_id = m_env->m_attachements[getId()];
+ u16 attached_id = m_env->attachement_parent_ids[getId()];
if ((attached_id != 0) &&
(attached_id != getId())) {
for(std::vector<u16>::iterator ci = m_children.begin();
ci != m_children.end(); ci++)
{
- if (m_env->m_attachements[*ci] == getId()) {
- m_env->m_attachements[*ci] = 0;
+ if (m_env->attachement_parent_ids[*ci] == getId()) {
+ m_env->attachement_parent_ids[*ci] = 0;
}
}
- m_env->m_attachements[getId()] = 0;
+ m_env->attachement_parent_ids[getId()] = 0;
LocalPlayer* player = m_env->getLocalPlayer();
if (this == player->parent) {
for(std::vector<u16>::iterator ci = m_children.begin();
ci != m_children.end();)
{
- if (m_env->m_attachements[*ci] != getId()) {
+ if (m_env->attachement_parent_ids[*ci] != getId()) {
ci = m_children.erase(ci);
continue;
}
m_bone_position[bone] = core::vector2d<v3f>(position, rotation);
updateBonePosition();
- } else if (cmd == GENERIC_CMD_SET_ATTACHMENT) {
+ } else if (cmd == GENERIC_CMD_ATTACH_TO) {
u16 parentID = readS16(is);
- m_env->m_attachements[getId()] = parentID;
+ m_env->attachement_parent_ids[getId()] = parentID;
GenericCAO *parentobj = m_env->getGenericCAO(parentID);
if (parentobj) {
std::string m_name;
bool m_is_player;
bool m_is_local_player;
- int m_id;
// Property-ish things
ObjectProperties m_prop;
//
m_irr(irr)
{
char zero = 0;
- memset(m_attachements, zero, sizeof(m_attachements));
+ memset(attachement_parent_ids, zero, sizeof(attachement_parent_ids));
}
ClientEnvironment::~ClientEnvironment()
// Get event from queue. CEE_NONE is returned if queue is empty.
ClientEnvEvent getClientEvent();
- u16 m_attachements[USHRT_MAX];
+ u16 attachement_parent_ids[USHRT_MAX + 1];
std::list<std::string> getPlayerNames()
{ return m_player_names; }
{
std::ostringstream os(std::ios::binary);
// command
- writeU8(os, GENERIC_CMD_SET_ATTACHMENT);
+ writeU8(os, GENERIC_CMD_ATTACH_TO);
// parameters
writeS16(os, parent_id);
os<<serializeString(bone);
#include "irrlichttypes_bloated.h"
#include <iostream>
-#define GENERIC_CMD_SET_PROPERTIES 0
-#define GENERIC_CMD_UPDATE_POSITION 1
-#define GENERIC_CMD_SET_TEXTURE_MOD 2
-#define GENERIC_CMD_SET_SPRITE 3
-#define GENERIC_CMD_PUNCHED 4
-#define GENERIC_CMD_UPDATE_ARMOR_GROUPS 5
-#define GENERIC_CMD_SET_ANIMATION 6
-#define GENERIC_CMD_SET_BONE_POSITION 7
-#define GENERIC_CMD_SET_ATTACHMENT 8
-#define GENERIC_CMD_SET_PHYSICS_OVERRIDE 9
-#define GENERIC_CMD_UPDATE_NAMETAG_ATTRIBUTES 10
+enum GenericCMD {
+ GENERIC_CMD_SET_PROPERTIES,
+ GENERIC_CMD_UPDATE_POSITION,
+ GENERIC_CMD_SET_TEXTURE_MOD,
+ GENERIC_CMD_SET_SPRITE,
+ GENERIC_CMD_PUNCHED,
+ GENERIC_CMD_UPDATE_ARMOR_GROUPS,
+ GENERIC_CMD_SET_ANIMATION,
+ GENERIC_CMD_SET_BONE_POSITION,
+ GENERIC_CMD_ATTACH_TO,
+ GENERIC_CMD_SET_PHYSICS_OVERRIDE,
+ GENERIC_CMD_UPDATE_NAMETAG_ATTRIBUTES
+};
#include "object_properties.h"
std::string gob_cmd_set_properties(const ObjectProperties &prop);
// sure we can handle all content ids. But it's absolutely worth it as it's
// a speedup of 4 for one of the major time consuming functions on storing
// mapblocks.
-static content_t getBlockNodeIdMapping_mapping[USHRT_MAX];
+static content_t getBlockNodeIdMapping_mapping[USHRT_MAX + 1];
static void getBlockNodeIdMapping(NameIdMapping *nimap, MapNode *nodes,
INodeDefManager *nodedef)
{
- memset(getBlockNodeIdMapping_mapping, 0xFF, USHRT_MAX * sizeof(content_t));
+ memset(getBlockNodeIdMapping_mapping, 0xFF, (USHRT_MAX + 1) * sizeof(content_t));
std::set<content_t> unknown_contents;
content_t id_counter = 0;
Add TOCLIENT_HELLO for presenting server to client after client
presentation
Add TOCLIENT_AUTH_ACCEPT to accept connection from client
+ Rename GENERIC_CMD_SET_ATTACHMENT to GENERIC_CMD_ATTACH_TO
*/
#define LATEST_PROTOCOL_VERSION 25