mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 00:32:57 -04:00
dded Support for 64bit Server Channels
---------------------------------------------------------------------- src/dcparser/dcClass.cxx src/dcparser/dcClass.h src/dcparser/dcField.cxx src/dcparser/dcField.h src/dcparser/dcPacker.h src/dcparser/dcbase.h src/distributed/DistributedObjectAI.py src/distributed/PyDatagram.py src/distributed/PyDatagramIterator.py src/distributed/cConnectionRepository.I src/distributed/cConnectionRepository.cxx src/distributed/cConnectionRepository.h ----------------------------------------------------------------------
This commit is contained in:
parent
f62de075c8
commit
d74707423c
@ -635,7 +635,7 @@ client_format_update(const string &field_name, int do_id,
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
Datagram DCClass::
|
Datagram DCClass::
|
||||||
ai_format_update(const string &field_name, int do_id,
|
ai_format_update(const string &field_name, int do_id,
|
||||||
int to_id, int from_id, PyObject *args) const {
|
CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const {
|
||||||
DCField *field = get_field_by_name(field_name);
|
DCField *field = get_field_by_name(field_name);
|
||||||
if (field == (DCField *)NULL) {
|
if (field == (DCField *)NULL) {
|
||||||
ostringstream strm;
|
ostringstream strm;
|
||||||
@ -663,12 +663,14 @@ ai_format_update(const string &field_name, int do_id,
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
Datagram DCClass::
|
Datagram DCClass::
|
||||||
ai_format_generate(PyObject *distobj, int do_id,
|
ai_format_generate(PyObject *distobj, int do_id,
|
||||||
int zone_id, int district_id, int from_channel_id,
|
int zone_id, CHANNEL_TYPE district_channel_id, CHANNEL_TYPE from_channel_id,
|
||||||
PyObject *optional_fields) const {
|
PyObject *optional_fields) const {
|
||||||
|
|
||||||
DCPacker packer;
|
DCPacker packer;
|
||||||
|
|
||||||
packer.raw_pack_uint32(district_id);
|
|
||||||
packer.raw_pack_uint32(from_channel_id);
|
packer.RAW_PACK_CHANNEL(district_channel_id);
|
||||||
|
packer.RAW_PACK_CHANNEL(from_channel_id);
|
||||||
packer.raw_pack_uint8('A');
|
packer.raw_pack_uint8('A');
|
||||||
|
|
||||||
bool has_optional_fields = (PyObject_IsTrue(optional_fields) != 0);
|
bool has_optional_fields = (PyObject_IsTrue(optional_fields) != 0);
|
||||||
@ -678,7 +680,7 @@ ai_format_generate(PyObject *distobj, int do_id,
|
|||||||
} else {
|
} else {
|
||||||
packer.raw_pack_uint16(STATESERVER_OBJECT_GENERATE_WITH_REQUIRED);
|
packer.raw_pack_uint16(STATESERVER_OBJECT_GENERATE_WITH_REQUIRED);
|
||||||
}
|
}
|
||||||
|
|
||||||
packer.raw_pack_uint32(zone_id);
|
packer.raw_pack_uint32(zone_id);
|
||||||
packer.raw_pack_uint16(_number);
|
packer.raw_pack_uint16(_number);
|
||||||
packer.raw_pack_uint32(do_id);
|
packer.raw_pack_uint32(do_id);
|
||||||
|
@ -78,12 +78,13 @@ PUBLISHED:
|
|||||||
const DCField *field) const;
|
const DCField *field) const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Datagram client_format_update(const string &field_name,
|
Datagram client_format_update(const string &field_name,
|
||||||
int do_id, PyObject *args) const;
|
int do_id, PyObject *args) const;
|
||||||
Datagram ai_format_update(const string &field_name, int do_id,
|
Datagram ai_format_update(const string &field_name, int do_id,
|
||||||
int to_id, int from_id, PyObject *args) const;
|
CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const;
|
||||||
Datagram ai_format_generate(PyObject *distobj, int do_id, int zone_id,
|
Datagram ai_format_generate(PyObject *distobj, int do_id, int zone_id,
|
||||||
int district_id, int from_channel_id,
|
CHANNEL_TYPE district_channel_id, CHANNEL_TYPE from_channel_id,
|
||||||
PyObject *optional_fields) const;
|
PyObject *optional_fields) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -516,11 +516,11 @@ client_format_update(int do_id, PyObject *args) const {
|
|||||||
// object from the AI.
|
// object from the AI.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
Datagram DCField::
|
Datagram DCField::
|
||||||
ai_format_update(int do_id, int to_id, int from_id, PyObject *args) const {
|
ai_format_update(int do_id, CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const {
|
||||||
DCPacker packer;
|
DCPacker packer;
|
||||||
|
|
||||||
packer.raw_pack_uint32(to_id);
|
packer.RAW_PACK_CHANNEL(to_id);
|
||||||
packer.raw_pack_uint32(from_id);
|
packer.RAW_PACK_CHANNEL(from_id);
|
||||||
packer.raw_pack_uint8('A');
|
packer.raw_pack_uint8('A');
|
||||||
packer.raw_pack_uint16(STATESERVER_OBJECT_UPDATE_FIELD);
|
packer.raw_pack_uint16(STATESERVER_OBJECT_UPDATE_FIELD);
|
||||||
packer.raw_pack_uint32(do_id);
|
packer.raw_pack_uint32(do_id);
|
||||||
|
@ -79,7 +79,7 @@ PUBLISHED:
|
|||||||
void receive_update(DCPacker &packer, PyObject *distobj) const;
|
void receive_update(DCPacker &packer, PyObject *distobj) const;
|
||||||
|
|
||||||
Datagram client_format_update(int do_id, PyObject *args) const;
|
Datagram client_format_update(int do_id, PyObject *args) const;
|
||||||
Datagram ai_format_update(int do_id, int to_id, int from_id,
|
Datagram ai_format_update(int do_id, CHANNEL_TYPE to_id, CHANNEL_TYPE from_id,
|
||||||
PyObject *args) const;
|
PyObject *args) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -151,6 +151,11 @@ PUBLISHED:
|
|||||||
INLINE void raw_pack_float64(double value);
|
INLINE void raw_pack_float64(double value);
|
||||||
INLINE void raw_pack_string(const string &value);
|
INLINE void raw_pack_string(const string &value);
|
||||||
|
|
||||||
|
// this is a hack to allw me to get in and out of 32bit Mode Faster
|
||||||
|
// need to agree with channel_type in dcbase.h
|
||||||
|
#define RAW_PACK_CHANNEL(in) raw_pack_int64(in)
|
||||||
|
|
||||||
|
|
||||||
INLINE int raw_unpack_int8();
|
INLINE int raw_unpack_int8();
|
||||||
INLINE int raw_unpack_int16();
|
INLINE int raw_unpack_int16();
|
||||||
INLINE int raw_unpack_int32();
|
INLINE int raw_unpack_int32();
|
||||||
|
@ -111,6 +111,11 @@ typedef long long PN_int64;
|
|||||||
typedef unsigned long long PN_uint64;
|
typedef unsigned long long PN_uint64;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // WITHIN_PANDA
|
#endif // WITHIN_PANDA
|
||||||
|
|
||||||
|
//typedef unsigned long CHANNEL_TYPE;
|
||||||
|
typedef PN_uint64 CHANNEL_TYPE;
|
||||||
|
|
||||||
#endif // DCBASE_H
|
#endif // DCBASE_H
|
||||||
|
@ -27,6 +27,9 @@ class PyDatagram(Datagram):
|
|||||||
STBlob32 : (Datagram.addString32, None),
|
STBlob32 : (Datagram.addString32, None),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
addChannel = Datagram.addUint64
|
||||||
|
|
||||||
def putArg(self, arg, subatomicType, divisor=1):
|
def putArg(self, arg, subatomicType, divisor=1):
|
||||||
if (divisor == 1):
|
if (divisor == 1):
|
||||||
funcSpecs = self.FuncDict.get(subatomicType)
|
funcSpecs = self.FuncDict.get(subatomicType)
|
||||||
|
@ -27,6 +27,8 @@ class PyDatagramIterator(DatagramIterator):
|
|||||||
STBlob32 : DatagramIterator.getString32,
|
STBlob32 : DatagramIterator.getString32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getChannel = DatagramIterator.getUint64
|
||||||
|
|
||||||
def getArg(self, subatomicType, divisor=1):
|
def getArg(self, subatomicType, divisor=1):
|
||||||
# Import the type numbers
|
# Import the type numbers
|
||||||
if divisor == 1:
|
if divisor == 1:
|
||||||
|
@ -141,7 +141,7 @@ get_datagram_iterator(DatagramIterator &di) {
|
|||||||
// was sent, according to the datagram headers. This
|
// was sent, according to the datagram headers. This
|
||||||
// information is not available to the client.
|
// information is not available to the client.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE unsigned int CConnectionRepository::
|
INLINE CHANNEL_TYPE CConnectionRepository::
|
||||||
get_msg_channel() const {
|
get_msg_channel() const {
|
||||||
return _msg_channel;
|
return _msg_channel;
|
||||||
}
|
}
|
||||||
@ -153,7 +153,7 @@ get_msg_channel() const {
|
|||||||
// according to the datagram headers. This information
|
// according to the datagram headers. This information
|
||||||
// is not available to the client.
|
// is not available to the client.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE unsigned int CConnectionRepository::
|
INLINE CHANNEL_TYPE CConnectionRepository::
|
||||||
get_msg_sender() const {
|
get_msg_sender() const {
|
||||||
return _msg_sender;
|
return _msg_sender;
|
||||||
}
|
}
|
||||||
|
@ -133,8 +133,8 @@ check_datagram() {
|
|||||||
_di = DatagramIterator(_dg);
|
_di = DatagramIterator(_dg);
|
||||||
|
|
||||||
if (!_client_datagram) {
|
if (!_client_datagram) {
|
||||||
_msg_channel = _di.get_uint32();
|
_msg_channel = _di.get_uint64();
|
||||||
_msg_sender = _di.get_uint32();
|
_msg_sender = _di.get_uint64();
|
||||||
_sec_code = _di.get_uint8();
|
_sec_code = _di.get_uint8();
|
||||||
|
|
||||||
#ifdef HAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
@ -142,7 +142,9 @@ check_datagram() {
|
|||||||
// structure, to support legacy code that expects to find it
|
// structure, to support legacy code that expects to find it
|
||||||
// there.
|
// there.
|
||||||
if (_python_repository != (PyObject *)NULL) {
|
if (_python_repository != (PyObject *)NULL) {
|
||||||
|
// Dave Needs to fix interage..
|
||||||
PyObject *value = PyInt_FromLong(_msg_sender);
|
PyObject *value = PyInt_FromLong(_msg_sender);
|
||||||
|
// PyObject *value = PyLong_FromUnsignedLongLong(_msg_sender);
|
||||||
PyObject_SetAttrString(_python_repository, "msgSender", value);
|
PyObject_SetAttrString(_python_repository, "msgSender", value);
|
||||||
Py_DECREF(value);
|
Py_DECREF(value);
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
#include "directbase.h"
|
#include "directbase.h"
|
||||||
#include "pointerTo.h"
|
#include "pointerTo.h"
|
||||||
|
|
||||||
|
#include "dcbase.h"
|
||||||
#include "dcFile.h"
|
#include "dcFile.h"
|
||||||
#include "dcField.h" // to pick up Python.h
|
#include "dcField.h" // to pick up Python.h
|
||||||
|
|
||||||
@ -78,8 +80,8 @@ PUBLISHED:
|
|||||||
bool check_datagram();
|
bool check_datagram();
|
||||||
INLINE void get_datagram(Datagram &dg);
|
INLINE void get_datagram(Datagram &dg);
|
||||||
INLINE void get_datagram_iterator(DatagramIterator &di);
|
INLINE void get_datagram_iterator(DatagramIterator &di);
|
||||||
INLINE unsigned int get_msg_channel() const;
|
INLINE CHANNEL_TYPE get_msg_channel() const;
|
||||||
INLINE unsigned int get_msg_sender() const;
|
INLINE CHANNEL_TYPE get_msg_sender() const;
|
||||||
INLINE unsigned char get_sec_code() const;
|
INLINE unsigned char get_sec_code() const;
|
||||||
INLINE unsigned int get_msg_type() const;
|
INLINE unsigned int get_msg_type() const;
|
||||||
|
|
||||||
@ -122,8 +124,8 @@ private:
|
|||||||
|
|
||||||
Datagram _dg;
|
Datagram _dg;
|
||||||
DatagramIterator _di;
|
DatagramIterator _di;
|
||||||
unsigned int _msg_channel;
|
CHANNEL_TYPE _msg_channel;
|
||||||
unsigned int _msg_sender;
|
CHANNEL_TYPE _msg_sender;
|
||||||
unsigned char _sec_code;
|
unsigned char _sec_code;
|
||||||
unsigned int _msg_type;
|
unsigned int _msg_type;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user