From: Matze B. <mat...@us...> - 2002-03-01 19:19:03
|
Update of /cvsroot/planeshift/planeshift/src/client In directory usw-pr-cvs1:/tmp/cvs-serv5431/src/client Modified Files: Makefile.am pscelclient.cpp pscelclient.h Added Files: psclientdr.cpp psclientdr.h Log Message: start client dead reckoning class --- NEW FILE: psclientdr.cpp --- /* * psclientpersist.cpp by Matze Braun <Mat...@gm...> * * Copyright (C) 2002 PlaneShift Team (in...@pl..., * http://www.planeshift.it) * * 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 (version 2 of the License) * 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, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #include "config.h" #include <iutil/databuff.h> #include "net/message.h" #include "net/msghandler.h" #include "engine/celbase.h" #include "psprop/pc/pspclinmove.h" #include "pscelclient.h" #include "psclientdr.h" #define MSGTYPDRUPDATE PS_MSGID('D','R','U','D') SCF_IMPLEMENT_IBASE(psClientDR) SCF_IMPLEMENTS_INTERFACE(iNetSubscriber) SCF_IMPLEMENT_IBASE_END psClientDR::psClientDR() { SCF_CONSTRUCT_IBASE(0); celclient = NULL; msghandler = NULL; } psClientDR::~psClientDR() { if (msghandler) msghandler->Unsubscribe(MSGTYPDRUPDATE, this); } bool psClientDR::Initialize(psCelClient* celclient, MsgHandler* msghandler) { psClientDR::celclient = celclient; psClientDR::msghandler = msghandler; if (!msghandler->Subscribe (MSGTYPDRUPDATE, this)) return false; return true; } void psClientDR::SendPersist() { iCelEntity* entity = celclient->GetActor(); iPcLinearMovement* linmove = CEL_QUERY_PROPCLASS (entity->GetPropertyClassList(), iPcLinearMovement); if (!linmove) return; iDataBuffer* data = linmove->GetDRData(); if (!data) { printf ("No persistance data!\n"); return; } MsgEntry* me = new MsgEntry (data->GetSize(), PRIORITY_LOW); me->clientnum = 0; msghandler->SendMessage(me); me->DecRef(); return; } void psClientDR::HandleMessage (MsgEntry* me) { } --- NEW FILE: psclientdr.h --- /* * psclientpersist.h by Matze Braun <Mat...@gm...> * * Copyright (C) 2002 PlaneShift Team (in...@pl..., * http://www.planeshift.it) * * 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 (version 2 of the License) * 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, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef __PSCLIENTPERSIST_H__ #define __PSCLIENTPERSIST_H__ #include "interface/subscriber.h" class psCelClient; class MsgHandler; class MsgEntry; class psClientDR : public iNetSubscriber { public: SCF_DECLARE_IBASE; psClientDR(); virtual ~psClientDR(); bool Initialize(psCelClient* celbase, MsgHandler* msghandler); void SendPersist(); virtual void HandleMessage(MsgEntry* me); protected: psCelClient* celclient; MsgHandler* msghandler; }; #endif Index: Makefile.am =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/Makefile.am,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** Makefile.am 25 Feb 2002 08:54:03 -0000 1.41 --- Makefile.am 1 Mar 2002 19:18:59 -0000 1.42 *************** *** 14,18 **** authentclient.h authentclient.cpp psnetmanager.h psnetmanager.cpp \ pscelclient.h pscelclient.cpp cmdusers.cpp cmdusers.h cmdguilds.cpp \ ! cmdguilds.h sysmsgclient.cpp sysmsgclient.h psclient_LDADD = $(COMMONSRC)/net/libpsnet.la $(COMMONSRC)/sal/libsal.la \ $(COMMONSRC)/engine/libpsengine.la $(COMMONSRC)/util/libpsutil.la \ --- 14,18 ---- authentclient.h authentclient.cpp psnetmanager.h psnetmanager.cpp \ pscelclient.h pscelclient.cpp cmdusers.cpp cmdusers.h cmdguilds.cpp \ ! cmdguilds.h sysmsgclient.cpp sysmsgclient.h psclientdr.h psclientdr.cpp psclient_LDADD = $(COMMONSRC)/net/libpsnet.la $(COMMONSRC)/sal/libsal.la \ $(COMMONSRC)/engine/libpsengine.la $(COMMONSRC)/util/libpsutil.la \ Index: pscelclient.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/pscelclient.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pscelclient.cpp 28 Feb 2002 22:15:20 -0000 1.14 --- pscelclient.cpp 1 Mar 2002 19:19:00 -0000 1.15 *************** *** 42,46 **** #include <pf/input.h> - #include "pscelclient.h" #include "engine/celbase.h" #include "engine/netpersist.h" --- 42,45 ---- *************** *** 48,51 **** --- 47,53 ---- #include "net/msghandler.h" + #include "pscelclient.h" + #include "psclientdr.h" + SCF_IMPLEMENT_IBASE(psCelClient) SCF_IMPLEMENTS_INTERFACE(iNetSubscriber) *************** *** 58,61 **** --- 60,64 ---- msghandler = NULL; requeststatus = 0; + clientdr = NULL; } *************** *** 66,69 **** --- 69,74 ---- msghandler->Unsubscribe(MSGTYPECELPERSIST, this); SCF_DEC_REF(actor); + if (clientdr) + delete clientdr; } *************** *** 76,79 **** --- 81,92 ---- psCelClient::msghandler = msghandler; msghandler->Subscribe(MSGTYPECELPERSIST, (iNetSubscriber*) this); + + clientdr = new psClientDR; + if (!clientdr->Initialize(this, msghandler)) + { + delete clientdr; + clientdr = NULL; + return false; + } return true; Index: pscelclient.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/pscelclient.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pscelclient.h 25 Feb 2002 19:26:33 -0000 1.4 --- pscelclient.h 1 Mar 2002 19:19:00 -0000 1.5 *************** *** 24,27 **** --- 24,28 ---- class MsgHandler; + class psClientDR; /** *************** *** 42,53 **** bool IsReady(); void SetupControls(); virtual void HandleMessage(MsgEntry* me); - protected: int requeststatus; iCelEntity* actor; MsgHandler* msghandler; }; --- 43,58 ---- bool IsReady(); + iCelEntity* GetActor() { return actor; } + + void SendPersist(); + void SetupControls(); virtual void HandleMessage(MsgEntry* me); protected: int requeststatus; iCelEntity* actor; MsgHandler* msghandler; + psClientDR* clientdr; }; |