Cleaned up some metaserver code

This commit is contained in:
jsalmon3 2003-10-14 21:44:31 +00:00
parent 9f8c855041
commit d3d9e3feab
3 changed files with 21 additions and 21 deletions
src

View file

@ -56,8 +56,8 @@ extern int MetaServerInUse;
extern int MetaInit(void);
extern int MetaClose(void);
extern int MetaServerOK(char **reply);
extern int MetaServerOK(char* reply);
extern int SendMetaCommand(char* command, char* format, ...);
extern int RecvMetaReply(char **reply);
extern int RecvMetaReply(char** reply);
#endif // !__MASTER_H__

View file

@ -113,7 +113,7 @@ global int MetaInit(void)
//TODO: Notify player that connection was aborted...
return -1;
} else {
if (MetaServerOK(&reply)) {
if (MetaServerOK(reply)) {
free(reply);
return 0;
} else {
@ -140,9 +140,9 @@ global int MetaClose(void)
**
** @return 1 OK, 0 Error.
*/
global int MetaServerOK(char** reply)
global int MetaServerOK(char* reply)
{
return !strcmp("OK\r\n", *reply) || !strcmp("OK\n", *reply);
return !strcmp("OK\r\n", reply) || !strcmp("OK\n", reply);
}
/**
@ -243,7 +243,7 @@ global int RecvMetaReply(char** reply)
if (!(p = malloc(n + 1))) {
return -1;
}
buf[n]='\0';
buf[n] = '\0';
strcpy(p, buf);
*reply = p;

View file

@ -7285,41 +7285,41 @@ local void ShowMetaServerList(void)
** Mohydine: Right now, because I find it simpler, the client is sending n commands, one for each online game.
** TODO: well, redo this :)
*/
local void MultiMetaServerGameSetupInit(Menuitem *mi)
local void MultiMetaServerGameSetupInit(Menuitem* mi)
{
int i;
int j;
int k;
int numparams;
int nummenus;
char **reply;
char* reply;
SendMetaCommand("GameList","");
SendMetaCommand("GameList", "");
reply = NULL;
//receive
//check okay
// Meta server only sends matching version
// Only Displays games from Matching version
nummenus=5;
i=1;
k=0;
numparams=4; //TODO: To be changed if more params are sent
nummenus = 5;
i = 1;
k = 0;
numparams = 4; //TODO: To be changed if more params are sent
//Retrieve list of online game from the meta server
for (j=4; j <= nummenus*(numparams+1); j = j + numparams + 1) { // loop over the number of items in the menu
for (j = 4; j <= nummenus * (numparams + 1); j += numparams + 1) { // loop over the number of items in the menu
//TODO: hard coded.
// Check if connection to meta server is there.
SendMetaCommand("NextGameInList","");
i=RecvMetaReply(reply);
SendMetaCommand("NextGameInList", "");
i = RecvMetaReply(&reply);
if (i == 0) {
// fill the menus with the right info.
mi->menu->Items[j].d.text.text="Nick";
mi->menu->Items[j+1].d.text.text="IP";
mi->menu->Items[j+2].d.text.text="OS";
mi->menu->Items[j+3].d.text.text="Engine Version";
mi->menu->Items[j].d.text.text = "Nick";
mi->menu->Items[j + 1].d.text.text = "IP";
mi->menu->Items[j + 2].d.text.text = "OS";
mi->menu->Items[j + 3].d.text.text = "Engine Version";
}
k++;
++k;
}
// mi->menu->Items[4].d.text.text=TheMessage->Nickname;
// mi->menu->Items[9].d.text.text=TheMessage->Nickname;