RPGQuest help (lost logic's book example)
hey, I know lostlogic''s book is a little old to be worrying about, but i''m new to this. anyway, the book was awesome. No problems, save this one: the RPGQuest (both client and server) compile fine, (except the client leaves me a warning [LINK : warning LNK4089: all references to "ADVAPI32.dll" discarded by /OPT:REF] whick shouldnt bee much to worry about). Heres the real problem. When i run the client, it connects to the server, updates time of day, everything works great. But when i connect a second client, the first one is invisible to the second one to move around. it also scrolls thousands of "arrogant god enters zone" messages at the bottom left corner. I was hoping to build off this example, but it is unuseable like this.
thanks for reading, hope someone can help.
01001001001000000111010001101000011010010110111001101011001000000111100101101111011101010010000001110111011010010110110001101100001000000110011001101001011011100110010000101100001000000111010001101000011000010111010000100000011110010110111101110101001000000110000101110010011001010010000001101101011001010111001001100101011011000111100100100000011010010110111001110011011010010110010001100101001000000110000100100000011010100110010101101100011011000111100100101110
ok, I''ve run into the same problem. It seems like a huge error to me. It took me hours of hunting through code, and I eventually fixed it, but I can''t believe an error like this could get through. I''ve been to the forums at lostlogic.com, and i''ve seen no mention of this error. So I don''t know what the deal is, but here is how I got it to work. In the vSendPlayerInformation() function on the server, the variables are mixed up. It should read,
void vSendPlayerInformation(int ireceive, int iplayer)
instead of the other way around.
I hope this works for you.
void vSendPlayerInformation(int ireceive, int iplayer)
instead of the other way around.
I hope this works for you.
Here''s the lesson you can learn from this:
ALWAYS use a specific typedef for each identifier.
In your public header, put something like this:
Then, when you actually create a player, you don''t necessarily need to use something called _player_t; you can use a void*, or a CComPtr, or an int internally; at the beginning of each function you cast from player_t to your real type, and when returning players to the user, cast back to player_t. This doesn''t actually generate any extra instructions in machine code, but it provides TYPE SAFETY.
ALWAYS use a specific typedef for each identifier.
In your public header, put something like this:
typedef struct _player_t * player_t;typedef struct _receive_t * receive_t;player_t new_player( char const * name ); // or whatevervoid function( player_t player, receive_t receive );
Then, when you actually create a player, you don''t necessarily need to use something called _player_t; you can use a void*, or a CComPtr
struct PlayerStruct { std::string name; int generation;};player_t new_player( char const * name ) { PlayerStruct * ps = new PlayerStruct; ps->name = std::string( name ); ps->generation = 0; return (player_t)ps;}void function( player_t player, receive_t receive ) { PlayerStruct * pl = (PlayerStruct *)player; ReceiveStruct * rc = (ReceiveStruct *)receive; ...}
enum Bool { True, False, FileNotFound };
yeah, that definitely would have solved this problem. My big error was assuming the code in the book was accurate, I suppose.
WOW. thanks a ton! I diddn''t actually expect anyone to find this. It works perfectly now! I owe you guys.
01001001001000000111010001101000011010010110111001101011001000000111100101101111011101010010000001110111011010010110110001101100001000000110011001101001011011100110010000101100001000000111010001101000011000010111010000100000011110010110111101110101001000000110000101110010011001010010000001101101011001010111001001100101011011000111100100100000011010010110111001110011011010010110010001100101001000000110000100100000011010100110010101101100011011000111100100101110
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement