Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // THIS
- TNL_IMPLEMENT_RPC(GameConnection, c2sRequestLevelChange, (S32 newLevelIndex, bool isRelative), (newLevelIndex, isRelative),
- NetClassGroupGameMask, RPCGuaranteedOrdered, RPCDirClientToServer, 0)
- {
- // Custom code here
- }
- // BECOMES THIS:
- class RPC_GameConnection_c2sRequestLevelChange: public TNL::RPCEvent
- {
- public:
- TNL::FunctorDecl<void (GameConnection::*)(S32 newLevelIndex, bool isRelative)> mFunctorDecl;\
- RPC_GameConnection_c2sRequestLevelChange() :
- TNL::RPCEvent(RPCGuaranteedOrdered, RPCDirClientToServer), mFunctorDecl(
- &GameConnection::c2sRequestLevelChange_remote)
- {
- mFunctor = &mFunctorDecl;
- }
- static TNL::NetClassRepInstance<RPC_GameConnection_c2sRequestLevelChange> dynClassRep;
- virtual TNL::NetClassRep* getClassRep() const;
- bool checkClassType(TNL::Object *theObject)
- {
- return dynamic_cast<GameConnection*>(theObject) != 0;
- }
- };
- TNL::NetClassRep* RPC_GameConnection_c2sRequestLevelChange::getClassRep() const
- {
- return &RPC_GameConnection_c2sRequestLevelChange::dynClassRep;
- }
- TNL::NetClassRepInstance<RPC_GameConnection_c2sRequestLevelChange> RPC_GameConnection_c2sRequestLevelChange::dynClassRep(
- "RPC_GameConnection_c2sRequestLevelChange", NetClassGroupGameMask,
- TNL::NetClassTypeEvent, 0);
- void GameConnection::c2sRequestLevelChange(S32 newLevelIndex, bool isRelative)
- {
- if (!canPostNetEvent())
- return;
- RPC_GameConnection_c2sRequestLevelChange *theEvent =
- new RPC_GameConnection_c2sRequestLevelChange;
- theEvent->mFunctorDecl.set(newLevelIndex, isRelative);
- postNetEvent(theEvent);
- }
- TNL::NetEvent* GameConnection::c2sRequestLevelChange_construct(
- S32 newLevelIndex, bool isRelative)
- {
- RPC_GameConnection_c2sRequestLevelChange *theEvent =
- new RPC_GameConnection_c2sRequestLevelChange;
- theEvent->mFunctorDecl.set(newLevelIndex, isRelative);
- return theEvent;
- }
- /*void className::name##_test args { RPC_##className##_##name *theEvent = new RPC_##className##_##name; theEvent->mFunctorDecl.set argNames ; TNL::PacketStream ps; theEvent->pack(this, &ps); ps.setBytePosition(0); theEvent->unpack(this, &ps); theEvent->process(this); }*/
- void GameConnection::c2sRequestLevelChange_remote(S32 newLevelIndex,
- bool isRelative)
- {
- // Custom code here
- }
Advertisement
Add Comment
Please, Sign In to add comment