update network part
This commit is contained in:
parent
6903d7918a
commit
8a34bc6e39
11 changed files with 1251 additions and 1118 deletions
|
@ -14,11 +14,19 @@ var _shard_names = Array()
|
|||
var _character_summaries = Array()
|
||||
var _mainlands = Array()
|
||||
|
||||
var _create_char = false
|
||||
var _delete_char = false
|
||||
var _select_char = false
|
||||
var _launch_create_user = false
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
|
||||
var cmd = ImpulseConnectionDeleteChar.new()
|
||||
cmd.set_data(0)
|
||||
var name = cmd.get_name()
|
||||
print("slot:" + name)
|
||||
|
||||
pass # Replace with function body.
|
||||
|
||||
func phrase_send(message):
|
||||
|
@ -28,7 +36,7 @@ func phrase_send(message):
|
|||
var id = message['string_id'][i]
|
||||
if _string_manager.check_phrases(id) == false:
|
||||
decoded = false
|
||||
var command = {'action': Action.ACTION_GENERIC_CODE, 'impulse': ImpulseBase.STRING_MANAGER_STRING_RQ, "string_id": id}
|
||||
var command = {'action': Action.ACTION_GENERIC_CODE, 'impulse': Impulse.STRING_MANAGER_STRING_RQ, "string_id": id}
|
||||
_networkconnection.put_command(command);
|
||||
else:
|
||||
tmp.append(_string_manager.get_phrases(id))
|
||||
|
@ -54,7 +62,7 @@ func string_resp(message):
|
|||
decoded = false
|
||||
var command = {
|
||||
'action': Action.ACTION_GENERIC_CODE,
|
||||
'impulse': ImpulseBase.STRING_MANAGER_STRING_RQ,
|
||||
'impulse': Impulse.STRING_MANAGER_STRING_RQ,
|
||||
"string_id": id
|
||||
}
|
||||
_networkconnection.put_command(command);
|
||||
|
@ -97,8 +105,8 @@ func append_message(id, flow):
|
|||
# add message to debug
|
||||
var msg = Dictionary()
|
||||
msg['flow'] = flow
|
||||
var impulse_base = ImpulseBase.new()
|
||||
msg['impulse_debug'] = impulse_base.get_name(id)
|
||||
var impulse_base = Impulse.new()
|
||||
msg['impulse_debug'] = impulse_base.extract_name(id)
|
||||
_history.append(msg)
|
||||
|
||||
func append_message_raw(message, flow):
|
||||
|
@ -110,6 +118,8 @@ func append_message_raw(message, flow):
|
|||
|
||||
func create_char():
|
||||
var slot = 2
|
||||
if _create_char == true:
|
||||
return
|
||||
if _character_summaries.size() <= slot:
|
||||
return
|
||||
if _character_summaries[slot]['people'] != People.Unknown:
|
||||
|
@ -117,12 +127,17 @@ func create_char():
|
|||
print("***** Delete old car")
|
||||
var command = {
|
||||
'action': Action.ACTION_GENERIC_CODE,
|
||||
'impulse': ImpulseBase.CONNECTION_DELETE_CHAR,
|
||||
'impulse': Impulse.CONNECTION_DELETE_CHAR,
|
||||
"slot": slot
|
||||
}
|
||||
_networkconnection.put_command(command);
|
||||
append_message(command['impulse'], '<')
|
||||
_delete_char = true
|
||||
|
||||
#var cmd = ImpulseConnectionDeleteChar.new()
|
||||
#cmd.set_slot(0)
|
||||
#print("slot:" + String(cmd['slot']))
|
||||
|
||||
return
|
||||
if _launch_create_user == true:
|
||||
return
|
||||
|
@ -143,7 +158,7 @@ func create_char():
|
|||
# void setHAIR_COLOR(CCDBSynchronised &dbGroup, uint8 value, bool forceSending = false)
|
||||
var command1 = {
|
||||
'action': Action.ACTION_GENERIC_CODE,
|
||||
'impulse': ImpulseBase.CONNECTION_CREATE_CHAR,
|
||||
'impulse': Impulse.CONNECTION_CREATE_CHAR,
|
||||
'slot': slot,
|
||||
'sheet_id': 0,
|
||||
'session_id': int(_shard_names[0]['session_id']),
|
||||
|
@ -154,7 +169,7 @@ func create_char():
|
|||
'nb_point_caster': 1,
|
||||
'nb_point_crafter': 1,
|
||||
'nb_point_harvester': 1,
|
||||
'start_point': 2281701451,
|
||||
'start_point': 1,
|
||||
'hair_type': 7,
|
||||
'hair_color': 7,
|
||||
'gabarit_height': 255,
|
||||
|
@ -181,7 +196,7 @@ func create_char():
|
|||
}
|
||||
var command2 = {
|
||||
'action': Action.ACTION_GENERIC_CODE,
|
||||
'impulse': ImpulseBase.CONNECTION_CREATE_CHAR,
|
||||
'impulse': Impulse.CONNECTION_CREATE_CHAR,
|
||||
'slot': slot,
|
||||
'sheet_id': 0,
|
||||
'session_id': int(_shard_names[0]['session_id']),
|
||||
|
@ -192,7 +207,7 @@ func create_char():
|
|||
'nb_point_caster': 1,
|
||||
'nb_point_crafter': 1,
|
||||
'nb_point_harvester': 1,
|
||||
'start_point': 123,
|
||||
'start_point': 1,
|
||||
'hair_type': 1,
|
||||
'hair_color': 2,
|
||||
'gabarit_height': 3,
|
||||
|
@ -219,7 +234,7 @@ func create_char():
|
|||
}
|
||||
var command = {
|
||||
'action': Action.ACTION_GENERIC_CODE,
|
||||
'impulse': ImpulseBase.CONNECTION_CREATE_CHAR,
|
||||
'impulse': Impulse.CONNECTION_CREATE_CHAR,
|
||||
'slot': slot,
|
||||
'sheet_id': 0,
|
||||
'session_id': int(_shard_names[0]['session_id']),
|
||||
|
@ -230,7 +245,7 @@ func create_char():
|
|||
'nb_point_caster': 0,
|
||||
'nb_point_crafter': 0,
|
||||
'nb_point_harvester': 0,
|
||||
'start_point': 0,
|
||||
'start_point': 1,
|
||||
'hair_type': 0,
|
||||
'hair_color': 0,
|
||||
'gabarit_height': 0,
|
||||
|
@ -255,25 +270,40 @@ func create_char():
|
|||
'hands_color': 0,
|
||||
'feet_color': 0
|
||||
}
|
||||
_networkconnection.put_command(command);
|
||||
_networkconnection.put_command(command1);
|
||||
append_message(command['impulse'], '<')
|
||||
_delete_char = true
|
||||
_create_char = true
|
||||
|
||||
func select_char():
|
||||
var slot = 2
|
||||
var command = {
|
||||
'action': Action.ACTION_GENERIC_CODE,
|
||||
'impulse': Impulse.CONNECTION_SELECT_CHAR,
|
||||
"slot": slot
|
||||
}
|
||||
_networkconnection.put_command(command);
|
||||
append_message(command['impulse'], '<')
|
||||
_select_char = true
|
||||
|
||||
func analyze_message(message):
|
||||
if message['action'] == Action.ACTION_POSITION_CODE:
|
||||
pass
|
||||
elif message['action'] == Action.ACTION_GENERIC_CODE:
|
||||
if message['impulse'] == ImpulseBase.STRING_MANAGER_RELOAD_CACHE:
|
||||
if message['impulse'] == Impulse.STRING_MANAGER_RELOAD_CACHE:
|
||||
print(message['timestamp'])
|
||||
_string_manager.set_timestamp(message['timestamp'])
|
||||
elif message['impulse'] == ImpulseBase.STRING_MANAGER_PHRASE_SEND:
|
||||
elif message['impulse'] == Impulse.STRING_MANAGER_PHRASE_SEND:
|
||||
phrase_send(message)
|
||||
elif message['impulse'] == ImpulseBase.STRING_MANAGER_STRING_RESP:
|
||||
elif message['impulse'] == Impulse.STRING_MANAGER_STRING_RESP:
|
||||
string_resp(message)
|
||||
elif message['impulse'] == ImpulseBase.CONNECTION_USER_CHARS:
|
||||
elif message['impulse'] == Impulse.CONNECTION_USER_CHARS:
|
||||
user_chars(message)
|
||||
# Normally this step is executed when player ask to create
|
||||
if _create_char == false:
|
||||
create_char()
|
||||
elif _select_char == false:
|
||||
select_char()
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -204,32 +204,43 @@ void BitStream::put_uint32(uint32_t value)
|
|||
this->put_serial(value, 32);
|
||||
}
|
||||
|
||||
void BitStream::put_sint64(int64_t value)
|
||||
void BitStream::put_uint64(uint64_t value)
|
||||
{
|
||||
// khanat-opennel-code/code/nel/include/nel/misc/stream_inline.h inline void IStream::serial(uint64 &b)
|
||||
// khanat-opennel-code/code/nel/include/nel/misc/stream.h #define NLMISC_BSWAP64(src) (src) = (((src)>>56)&0xFF) | ((((src)>>48)&0xFF)<<8) | ((((src)>>40)&0xFF)<<16) | ((((src)>>32)&0xFF)<<24) | ((((src)>>24)&0xFF)<<32) | ((((src)>>16)&0xFF)<<40) | ((((src)>>8)&0xFF)<<48) | (((src)&0xFF)<<56)
|
||||
union S {
|
||||
uint64_t full;
|
||||
uint8_t key[8];
|
||||
};
|
||||
S v;
|
||||
v.full = value;
|
||||
if(little_endian)
|
||||
{
|
||||
this->put_serial(value>>32, 32);
|
||||
this->put_serial(value, 32);
|
||||
this->put_uint8(v.key[3]);
|
||||
this->put_uint8(v.key[2]);
|
||||
this->put_uint8(v.key[1]);
|
||||
this->put_uint8(v.key[0]);
|
||||
this->put_uint8(v.key[7]);
|
||||
this->put_uint8(v.key[6]);
|
||||
this->put_uint8(v.key[5]);
|
||||
this->put_uint8(v.key[4]);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->put_serial(value, 32);
|
||||
this->put_serial(value>>32, 32);
|
||||
this->put_uint8(v.key[0]);
|
||||
this->put_uint8(v.key[1]);
|
||||
this->put_uint8(v.key[2]);
|
||||
this->put_uint8(v.key[3]);
|
||||
this->put_uint8(v.key[4]);
|
||||
this->put_uint8(v.key[5]);
|
||||
this->put_uint8(v.key[6]);
|
||||
this->put_uint8(v.key[7]);
|
||||
}
|
||||
}
|
||||
|
||||
void BitStream::put_uint64(uint64_t value)
|
||||
void BitStream::put_sint64(int64_t value)
|
||||
{
|
||||
if(little_endian)
|
||||
{
|
||||
this->put_serial(value>>32, 32);
|
||||
this->put_serial(value, 32);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->put_serial(value, 32);
|
||||
this->put_serial(value>>32, 32);
|
||||
}
|
||||
put_uint64((uint64_t) value);
|
||||
}
|
||||
|
||||
void BitStream::put_string_hexa32(String hexa)
|
||||
|
@ -525,38 +536,43 @@ uint32_t BitStream::get_uint32()
|
|||
return this->get_serial(32);
|
||||
}
|
||||
|
||||
int64_t BitStream::get_sint64()
|
||||
{
|
||||
int64_t v1;
|
||||
int64_t v2;
|
||||
if(little_endian)
|
||||
{
|
||||
v1 = this->get_serial(32);
|
||||
v2 = this->get_serial(32);
|
||||
}
|
||||
else
|
||||
{
|
||||
v2 = this->get_serial(32);
|
||||
v1 = this->get_serial(32);
|
||||
}
|
||||
return (v1 << 32) | v2;
|
||||
}
|
||||
|
||||
uint64_t BitStream::get_uint64()
|
||||
{
|
||||
int64_t v1;
|
||||
int64_t v2;
|
||||
// khanat-opennel-code/code/nel/include/nel/misc/stream_inline.h inline void IStream::serial(uint64 &b)
|
||||
// khanat-opennel-code/code/nel/include/nel/misc/stream.h #define NLMISC_BSWAP64(src) (src) = (((src)>>56)&0xFF) | ((((src)>>48)&0xFF)<<8) | ((((src)>>40)&0xFF)<<16) | ((((src)>>32)&0xFF)<<24) | ((((src)>>24)&0xFF)<<32) | ((((src)>>16)&0xFF)<<40) | ((((src)>>8)&0xFF)<<48) | (((src)&0xFF)<<56)
|
||||
union S {
|
||||
uint64_t full;
|
||||
uint8_t key[8];
|
||||
};
|
||||
S v;
|
||||
if(little_endian)
|
||||
{
|
||||
v1 = this->get_serial(32);
|
||||
v2 = this->get_serial(32);
|
||||
v.key[3] = this->get_uint8();
|
||||
v.key[2] = this->get_uint8();
|
||||
v.key[1] = this->get_uint8();
|
||||
v.key[0] = this->get_uint8();
|
||||
v.key[7] = this->get_uint8();
|
||||
v.key[6] = this->get_uint8();
|
||||
v.key[5] = this->get_uint8();
|
||||
v.key[4] = this->get_uint8();
|
||||
}
|
||||
else
|
||||
{
|
||||
v2 = this->get_serial(32);
|
||||
v1 = this->get_serial(32);
|
||||
v.key[0] = this->get_uint8();
|
||||
v.key[1] = this->get_uint8();
|
||||
v.key[2] = this->get_uint8();
|
||||
v.key[3] = this->get_uint8();
|
||||
v.key[4] = this->get_uint8();
|
||||
v.key[5] = this->get_uint8();
|
||||
v.key[6] = this->get_uint8();
|
||||
v.key[7] = this->get_uint8();
|
||||
}
|
||||
return (v1 << 32) | v2;
|
||||
return v.full;
|
||||
}
|
||||
|
||||
int64_t BitStream::get_sint64()
|
||||
{
|
||||
return (int64_t) get_uint64();
|
||||
}
|
||||
|
||||
uint32_t BitStream::get_version()
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -18,23 +18,22 @@
|
|||
|
||||
*/
|
||||
|
||||
#ifndef IMPULSE_BASE_H
|
||||
#define IMPULSE_BASE_H
|
||||
#ifndef IMPULSE_H
|
||||
#define IMPULSE_H
|
||||
|
||||
#include "core/object.h"
|
||||
#include "core/reference.h"
|
||||
#include "modules/bitstream/bitstream.h"
|
||||
|
||||
class ImpulseBase : public Reference
|
||||
class Impulse : public Reference
|
||||
{
|
||||
GDCLASS(ImpulseBase, Reference)
|
||||
GDCLASS(Impulse, Reference)
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
private:
|
||||
int _id;
|
||||
public:
|
||||
|
||||
ImpulseBase() {}
|
||||
~ImpulseBase() {}
|
||||
|
||||
enum Impulse {
|
||||
enum eImpulse {
|
||||
TARGET_PARTY,
|
||||
TARGET_INVENTORY,
|
||||
TARGET_FOLLOW,
|
||||
|
@ -372,12 +371,21 @@ public:
|
|||
__LAST_ELEMENT
|
||||
};
|
||||
|
||||
static int get_command(String name);
|
||||
static String get_command_name(uint32_t id);
|
||||
String get_name(Variant id);
|
||||
Impulse() {_id = eImpulse::__LAST_ELEMENT;}
|
||||
Impulse(int id) {_id = id;}
|
||||
~Impulse() {}
|
||||
|
||||
static int extract_command_id(String name);
|
||||
static String extract_command_name(uint32_t id);
|
||||
String extract_name(Variant id); // if static flag is activate, I can't find method to bind with gdscript
|
||||
String get_name();
|
||||
|
||||
int get_id() {return this->_id;}
|
||||
|
||||
void put_stream(Ref<BitStream> msgout);
|
||||
};
|
||||
|
||||
|
||||
VARIANT_ENUM_CAST(ImpulseBase::Impulse);
|
||||
VARIANT_ENUM_CAST(Impulse::eImpulse);
|
||||
|
||||
#endif
|
61
modules/impulse/impulse_connection_delete_char.h
Normal file
61
modules/impulse/impulse_connection_delete_char.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
Header Impulse CONNECTION_DELETE_CHAR
|
||||
|
||||
Copyright (C) 2019 AleaJactaEst
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef IMPULSE_CONNECTION_DELETE_CHAR
|
||||
#define IMPULSE_CONNECTION_DELETE_CHAR
|
||||
|
||||
|
||||
#include "core/reference.h"
|
||||
#include "modules/impulse/impulse.h"
|
||||
#include "modules/bitstream/bitstream.h"
|
||||
|
||||
class ImpulseConnectionDeleteChar : public Impulse
|
||||
{
|
||||
GDCLASS(ImpulseConnectionDeleteChar, Reference)
|
||||
Variant _slot;
|
||||
public:
|
||||
|
||||
ImpulseConnectionDeleteChar() : Impulse(Impulse::CONNECTION_DELETE_CHAR) {_slot = 0;}
|
||||
~ImpulseConnectionDeleteChar() {}
|
||||
|
||||
void set_data(Variant slot) { _slot = slot;}
|
||||
|
||||
void put_stream(Ref<BitStream> msgout)
|
||||
{
|
||||
Impulse::put_stream(msgout);
|
||||
msgout->put_uint8((uint8_t)_slot);
|
||||
}
|
||||
|
||||
String get_name()
|
||||
{
|
||||
// We need re-expose function for gdscript
|
||||
return Impulse::get_name();
|
||||
}
|
||||
|
||||
protected:
|
||||
static void _bind_methods()
|
||||
{
|
||||
ClassDB::bind_method(D_METHOD("get_name"), &ImpulseConnectionDeleteChar::get_name);
|
||||
ClassDB::bind_method(D_METHOD("set_data", "slot"), &ImpulseConnectionDeleteChar::set_data);
|
||||
ClassDB::bind_method(D_METHOD("put_stream", "msgout"), &ImpulseConnectionDeleteChar::put_stream);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -3,11 +3,13 @@
|
|||
#include "register_types.h"
|
||||
|
||||
#include "core/class_db.h"
|
||||
#include "impulsebase.h"
|
||||
#include "impulse.h"
|
||||
#include "impulse_connection_delete_char.h"
|
||||
#include "people.h"
|
||||
|
||||
void register_impulse_types() {
|
||||
ClassDB::register_class<ImpulseBase>();
|
||||
ClassDB::register_class<Impulse>();
|
||||
ClassDB::register_class<ImpulseConnectionDeleteChar>();
|
||||
ClassDB::register_class<People>();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "referentialmessage.h"
|
||||
#include "core/os/os.h"
|
||||
#include "modules/impulse/impulsebase.h"
|
||||
#include "modules/impulse/impulse.h"
|
||||
|
||||
void ReferentialMessage::_bind_methods()
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ int ReferentialMessage::read_command(Ref<BitStream> msgin)
|
|||
return ReferentialMessageCore::get_singleton()->read_command(msgin);
|
||||
}
|
||||
|
||||
void ReferentialMessage::write_command(ImpulseBase::Impulse command, Ref<BitStream> msgout)
|
||||
void ReferentialMessage::write_command(Impulse::eImpulse command, Ref<BitStream> msgout)
|
||||
{
|
||||
ReferentialMessageCore::get_singleton()->write_command(command, msgout);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
//#include "core/dictionary.h"
|
||||
//#include "modules/bitstream/bitstream.h"
|
||||
#include "modules/referentialmessage/referentialmessagecore.h"
|
||||
#include "modules/impulse/impulsebase.h"
|
||||
#include "modules/impulse/impulse.h"
|
||||
|
||||
class ReferentialMessage : public Reference {
|
||||
GDCLASS(ReferentialMessage, Reference)
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
void show();
|
||||
|
||||
int read_command(Ref<BitStream> msgin);
|
||||
void write_command(ImpulseBase::Impulse command, Ref<BitStream> msgout);
|
||||
void write_command(Impulse::eImpulse command, Ref<BitStream> msgout);
|
||||
|
||||
void clear_session();
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
|
||||
#include "modules/debug/debug.h"
|
||||
#include "modules/impulse/impulsebase.h"
|
||||
#include "modules/impulse/impulse.h"
|
||||
#include "referentialmessagecore.h"
|
||||
|
||||
ReferentialMessageCore *ReferentialMessageCore::singleton = nullptr;
|
||||
|
@ -35,14 +35,14 @@ void ElementReferential::show(int level, int pos)
|
|||
String a;
|
||||
for(int i=0;i<level;++i)
|
||||
a += String(CharString("+"));
|
||||
if(_id == ImpulseBase::Impulse::__LAST_ELEMENT)
|
||||
if(_id == Impulse::__LAST_ELEMENT)
|
||||
{
|
||||
//OS::get_singleton()->print("[%s:%d] level:%d %s pos:%3d ------ power:%d\n", __FILE__, __LINE__, level, a.ascii().get_data(), pos, _power2);
|
||||
DBG_PRINT("level:" + itos(level) + " " + a + " id:" + ImpulseBase::get_command_name(_id) + " pos:" + itos(pos) + " ------ power:" + itos(_power2));
|
||||
DBG_PRINT("level:" + itos(level) + " " + a + " id:" + Impulse::extract_command_name(_id) + " pos:" + itos(pos) + " ------ power:" + itos(_power2));
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG_PRINT("level:" + itos(level) + " " + a + " pos:" + itos(pos) + " id:" + ImpulseBase::get_command_name(_id));
|
||||
DBG_PRINT("level:" + itos(level) + " " + a + " pos:" + itos(pos) + " id:" + Impulse::extract_command_name(_id));
|
||||
}
|
||||
level ++;
|
||||
for(int i=0;i<_children.size();++i)
|
||||
|
@ -57,7 +57,7 @@ int ElementReferential::read_command(Ref<BitStream> msgin)
|
|||
uint32_t i = msgin->get_serial(_power2);
|
||||
Ref<ElementReferential> child = _children[i];
|
||||
|
||||
if ( child->_id != ImpulseBase::Impulse::__LAST_ELEMENT )
|
||||
if ( child->_id != Impulse::__LAST_ELEMENT )
|
||||
return child->_id;
|
||||
return child->read_command(msgin);
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ void ReferentialMessageCore::read_referential_step(Dictionary step, Vector<Eleme
|
|||
a += head.get(ii).get_name();
|
||||
uint32_t _size = head.get(ii).get_size()+1;
|
||||
ele->put_serial(head.get(ii).get_pos(), getPowerOf2(_size));
|
||||
int id = ImpulseBase::get_command(a);
|
||||
if (id != ImpulseBase::Impulse::__LAST_ELEMENT)
|
||||
int id = Impulse::extract_command_id(a);
|
||||
if (id != Impulse::__LAST_ELEMENT)
|
||||
{
|
||||
_encoder[id].copy_ref_bitstream(ele);
|
||||
root->set_id(id);
|
||||
|
@ -117,7 +117,7 @@ void ReferentialMessageCore::read_referential_step(Dictionary step, Vector<Eleme
|
|||
if(info.size() == 2 )
|
||||
{
|
||||
uint32_t id = info[0].to_int();
|
||||
Ref<ElementReferential> root_child = root->add_child(ImpulseBase::Impulse::__LAST_ELEMENT, i);
|
||||
Ref<ElementReferential> root_child = root->add_child(Impulse::__LAST_ELEMENT, i);
|
||||
Variant child ;
|
||||
child = step[name];
|
||||
ElementHead tmp;
|
||||
|
@ -133,7 +133,7 @@ void ReferentialMessageCore::read_referential(Dictionary dictionary_message)
|
|||
{
|
||||
Vector<ElementHead> head;
|
||||
DBG_PRINT("Read Referential Message");
|
||||
_decoder->set_id(ImpulseBase::Impulse::__LAST_ELEMENT);
|
||||
_decoder->set_id(Impulse::__LAST_ELEMENT);
|
||||
read_referential_step(dictionary_message, head, _decoder);
|
||||
}
|
||||
|
||||
|
@ -148,9 +148,9 @@ void ReferentialMessageCore::show()
|
|||
*/
|
||||
// show Element to push data
|
||||
{
|
||||
for(int i = 0; i < ImpulseBase::Impulse::__LAST_ELEMENT; ++i)
|
||||
for(int i = 0; i < Impulse::__LAST_ELEMENT; ++i)
|
||||
{
|
||||
DBG_PRINT(itos(i) + ") " + ImpulseBase::get_command_name(i) + " " + this->_encoder[i].show().ascii().get_data() + " [size:" + itos(this->_encoder[i].size_data()) + "]");
|
||||
DBG_PRINT(itos(i) + ") " + Impulse::extract_command_name(i) + " " + this->_encoder[i].show().ascii().get_data() + " [size:" + itos(this->_encoder[i].size_data()) + "]");
|
||||
}
|
||||
}
|
||||
// show element to read data
|
||||
|
@ -171,12 +171,12 @@ int ReferentialMessageCore::read_command(Ref<BitStream> msgin)
|
|||
return _decoder->read_command(msgin);
|
||||
}
|
||||
|
||||
void ReferentialMessageCore::write_command(ImpulseBase::Impulse command, Ref<BitStream> msgout)
|
||||
void ReferentialMessageCore::write_command(Impulse::eImpulse command, Ref<BitStream> msgout)
|
||||
{
|
||||
#ifdef DEBUG_ENABLED
|
||||
if ( command >= ImpulseBase::Impulse::__LAST_ELEMENT )
|
||||
if ( command >= Impulse::__LAST_ELEMENT )
|
||||
{
|
||||
ERR_PRINT("Out of range (" + itos(command) + " / " + itos(ImpulseBase::Impulse::__LAST_ELEMENT) + ")");
|
||||
ERR_PRINT("Out of range (" + itos(command) + " / " + itos(Impulse::__LAST_ELEMENT) + ")");
|
||||
throw "Out of range";
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "core/dictionary.h"
|
||||
#include "modules/bitstream/bitstream.h"
|
||||
#include "modules/debug/debug.h"
|
||||
#include "modules/impulse/impulsebase.h"
|
||||
#include "modules/impulse/impulse.h"
|
||||
|
||||
inline uint32_t getPowerOf2(uint32_t v)
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
};
|
||||
private:
|
||||
static ReferentialMessageCore *singleton;
|
||||
BitStream _encoder[ImpulseBase::Impulse::__LAST_ELEMENT];
|
||||
BitStream _encoder[Impulse::__LAST_ELEMENT];
|
||||
Ref<ElementReferential> _decoder;
|
||||
void read_referential_step(Dictionary step, Vector<ElementHead> head, Ref<ElementReferential> root);
|
||||
public:
|
||||
|
@ -100,7 +100,7 @@ public:
|
|||
|
||||
static void clear_session();
|
||||
int read_command(Ref<BitStream> msgin);
|
||||
void write_command(ImpulseBase::Impulse command, Ref<BitStream> msgout);
|
||||
void write_command(Impulse::eImpulse command, Ref<BitStream> msgout);
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue