summaryrefslogtreecommitdiff
path: root/src/server.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-03-25 21:23:08 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-03-25 21:23:08 +0000
commitca324c005d511752b2bcdc21fdc7d6c46597469b (patch)
tree050b5b836f26390ef44f67a2208fe47c161e8b62 /src/server.c
parent6d43cfd6df88e1b6e94c63f9e8e9eb6775bdbf42 (diff)
- drobne upravy v kode
- vymazanie duplivitneho kodu pri "hre s GUI" a "public serverom" git-svn-id: http://opensvn.csie.org/tuxanci_ng@36 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/server.c')
-rw-r--r--src/server.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/server.c b/src/server.c
index bf99659..4add211 100644
--- a/src/server.c
+++ b/src/server.c
@@ -18,6 +18,7 @@
#include "server.h"
#include "assert.h"
#include "myTimer.h"
+#include "arena.h"
#include "net_multiplayer.h"
#ifndef PUBLIC_SERVER
@@ -193,8 +194,8 @@ void destroyClient(client_t *p)
if( p->tux != NULL )
{
- index = searchListItem(getWorldArena()->listTux, p->tux);
- delListItem(getWorldArena()->listTux, index, destroyTux);
+ index = searchListItem(getCurrentArena()->listTux, p->tux);
+ delListItem(getCurrentArena()->listTux, index, destroyTux);
}
free(p);
@@ -288,7 +289,7 @@ void sendInfoCreateClient(client_t *client)
#ifndef PUBLIC_SERVER
proto_send_newtux_server(PROTO_SEND_ONE, client,
- (tux_t *)(getWorldArena()->listTux->list[SERVER_INDEX_ROOT_TUX]) );
+ (tux_t *)(getCurrentArena()->listTux->list[SERVER_INDEX_ROOT_TUX]) );
#endif
for( i = 0 ; i < listClient->count; i++)
@@ -303,9 +304,9 @@ void sendInfoCreateClient(client_t *client)
}
}
- for( i = 0 ; i < getWorldArena()->listItem->count; i++)
+ for( i = 0 ; i < getCurrentArena()->listItem->count; i++)
{
- thisItem = (item_t *) getWorldArena()->listItem->list[i];
+ thisItem = (item_t *) getCurrentArena()->listItem->list[i];
proto_send_additem_server(PROTO_SEND_ONE, client, thisItem);
}
}
@@ -402,7 +403,11 @@ static void eventClientBuffer(client_t *client)
continue;
}
- if( strncmp(line, "status", 6) == 0 )proto_recv_status_server(client, line);
+ if( strncmp(line, "status", 6) == 0 )
+ {
+ proto_recv_status_server(client, line);
+ continue;
+ }
if( client->tux != NULL )
{
@@ -425,7 +430,10 @@ static void eventClientBuffer(client_t *client)
}
}
- proto_send_error_server(PROTO_SEND_ONE, client, PROTO_ERROR_CODE_BAD_COMMAND);
+ if( client->tux != NULL )
+ {
+ proto_send_error_server(PROTO_SEND_ONE, client, PROTO_ERROR_CODE_BAD_COMMAND);
+ }
}
}
@@ -555,7 +563,7 @@ void eventPeriodicSyncClient()
#ifndef PUBLIC_SERVER
proto_send_newtux_server(PROTO_SEND_ONE, thisClientSend,
- (tux_t *)(getWorldArena()->listTux->list[SERVER_INDEX_ROOT_TUX]));
+ (tux_t *)(getCurrentArena()->listTux->list[SERVER_INDEX_ROOT_TUX]));
#endif
}
@@ -622,7 +630,7 @@ static void eventClientUdpSelect(sock_udp_t *sock_server)
if( client == NULL )
{
- if( getWorldArena()->listTux->count+1 > maxClients )
+ if( getCurrentArena()->listTux->count+1 > maxClients )
{
destroySockUdp(sock_client);
return;