summaryrefslogtreecommitdiff
path: root/src/proto.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-06-03 21:26:17 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-06-03 21:26:17 +0000
commit2fd0c9d50f1eb83d46080fb114cba5465e8c4506 (patch)
tree69d3aef56532f0a96c5d1b9b2800167152f239ca /src/proto.c
parentf18096a5c43d5cc52670c24d73d3efeebb120307 (diff)
- zaciatok podpory FR jazyka
- server podporuje socre ( treb este zdokumentovat protokol ) - prelozene dve chybove hlasky pre siete - odosielam to na rychlo git-svn-id: http://opensvn.csie.org/tuxanci_ng@59 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/proto.c')
-rw-r--r--src/proto.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/proto.c b/src/proto.c
index d925011..a31e640 100644
--- a/src/proto.c
+++ b/src/proto.c
@@ -18,15 +18,18 @@
#include "idManager.h"
#ifndef PUBLIC_SERVER
+#include "language.h"
#include "network.h"
#include "screen_world.h"
#include "screen_setting.h"
#include "screen_choiceArena.h"
+#include "screen_analyze.h"
#include "client.h"
#include "term.h"
#endif
#ifdef PUBLIC_SERVER
+#include "heightScore.h"
#include "publicServer.h"
#endif
@@ -100,6 +103,14 @@ void proto_recv_error_client(char *msg)
cmd, &errorcode);
printf("proto error code %d\n", errorcode);
+
+ switch(errorcode)
+ {
+ case PROTO_ERROR_CODE_BAD_VERSION :
+ setMsgToAnalyze(getMyText("ERROR_BAD_VERSION"));
+ setWorldEnd();
+ break;
+ }
}
#endif
@@ -170,6 +181,55 @@ void proto_recv_status_server(client_t *client, char *msg)
proto_send_status_server(PROTO_SEND_ONE, client);
}
+#ifdef PUBLIC_SERVER
+
+void proto_send_listscore_server(int type, client_t *client, int max)
+{
+ char *str;
+ char *msg;
+ int i;
+
+ msg = malloc( (max * 24) * sizeof(char) );
+ strcpy(msg, "");
+
+ for( i = 0 ; i < max ; i++ )
+ {
+ str = getTableItem(i);
+
+ if( str == NULL )
+ {
+ break;
+ }
+
+ strcat(msg, str);
+ strcat(msg, "\n");
+ }
+
+ proto_send(type, client, msg);
+ free(msg);
+}
+
+void proto_recv_listscore_server(client_t *client, char *msg)
+{
+ char cmd[STR_PROTO_SIZE];
+ int max;
+ int ret;
+
+ assert( msg != NULL );
+
+ ret = sscanf(msg, "%s %d",
+ cmd, &max);
+
+ if( ret != 2 )
+ {
+ max = HEIGHTSCORE_MAX_PLAYERS;
+ }
+
+ proto_send_listscore_server(PROTO_SEND_ONE, client, max);
+}
+
+#endif
+
#ifndef PUBLIC_SERVER
void proto_send_check_client(int id)