Game Development Community

Tnl_implement_rpc Build Error

by TheBren · in Torque Game Engine · 03/30/2005 (1:33 am) · 2 replies

I'm having a problem building a GhostConnection subclass.

NetworkConnection.h

#ifndef _NETWORKCONNECTION_H_
#define _NETWORKCONNECTION_H_

class NetworkConnection : public TNL::GhostConnection
{
	typedef TNL::GhostConnection Parent;

public:

    TNL_DECLARE_NETCONNECTION(NetworkConnection);

    // declare the client to server message
    TNL_DECLARE_RPC(rpcMessageClientToServer, (const char *theMessageString));

    // declare the server to client message
    TNL_DECLARE_RPC(rpcMessageServerToClient, (const char *theMessageString));

};

#endif

NetworkConnection.cpp

#include "NetworkIncludes.h"

TNL_IMPLEMENT_NETCONNECTION(NetworkConnection, TNL::NetClassGroupGame, true);

TNL_IMPLEMENT_RPC(NetworkConnection, 
				  rpcMessageClientToServer, 
				  (const char * messageString), 
				  (messageString),
				  TNL::NetClassGroupGameMask, 
				  TNL::RPCGuaranteedOrdered, 
				  TNL::RPCDirClientToServer, 
				  0)
{
    // display the message the client sent
    printf("Got message from client: %s\n", messageString);
    // send a hello world back to the client.
    rpcMessageServerToClient("Hello, World!");
}

TNL_IMPLEMENT_RPC(NetworkConnection, 
				  rpcMessageServerToClient, 
				  (const char * messageString),
				  (messageString),
				  TNL::NetClassGroupGameMask, 
				  TNL::RPCGuaranteedOrdered, 
				  TNL::RPCDirServerToClient, 
				  0)
{
    // display the message the server sent
    printf("Got a message from server: %s\n", messageString);

    // once the client has heard back from the server, it should quit.
//    gQuit = true;
}

The build error:

d:\Project\tnl\tnl\tnlMethodDispatch.h(85) : error C2664: 'bool TNL::BitStream::read(TNL::ByteBuffer *)' : cannot convert parameter 1 from 'const char ** ' to 'TNL::ByteBuffer *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

This is based on the Hello World sample, but changed from EventConnection to GhostConnection. I poured through the TNLTest source and didn't see any significant differences.

Any suggestions?

About the author

Recent Threads

  • Crash on shutdown

  • #1
    03/30/2005 (11:20 am)
    I need to fix the doco for the sample -- RPCs in TNL 1.5.0 can't take const char * arguments. Use StringPtr instead.
    #2
    03/30/2005 (4:14 pm)
    Ah OK, I'll try that.