summaryrefslogtreecommitdiff
path: root/src/server.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-06-08 21:43:44 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-06-08 21:43:44 +0000
commit4919e623c6695a80aaf96187253756dcbb72bf87 (patch)
tree948fbcc211b1a8f13e3830853edef6505234bab2 /src/server.c
parenta8110d0786e7931715a0d7116ed7d4c23697bdb6 (diff)
- kod bol prepisany tak aby dokazal pracovat aj s arenami vascimi ako je obrazovka okna
( ako pozadie na arenu sa da pouzit aj tepeta aj textura ) git-svn-id: http://opensvn.csie.org/tuxanci_ng@62 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/server.c')
-rw-r--r--src/server.c56
1 files changed, 38 insertions, 18 deletions
diff --git a/src/server.c b/src/server.c
index 8777e7a..b9a611e 100644
--- a/src/server.c
+++ b/src/server.c
@@ -92,28 +92,22 @@ static void eventPeriodicSyncClient(void *p_nothink)
client_t *thisClientSend;
tux_t *thisTux;
int i, j;
-/*
- for( i = 0 ; i < getCurrentArena()->listItem->count; i++)
- {
- thisItem = (item_t *) getCurrentArena()->listItem->list[i];
-
- if( thisItem->type != ITEM_EXPLOSION || thisItem->type != ITEM_BIG_EXPLOSION )
- {
- proto_send_additem_server(PROTO_SEND_ALL, NULL, thisItem);
- }
- }
-*/
+
for( i = 0 ; i < listClient->count; i++)
{
thisClientSend = (client_t *) listClient->list[i];
- if( thisClientSend->tux != NULL )
+ if( thisClientSend->tux == NULL )
{
+ continue;
+ }
+
#ifndef PUBLIC_SERVER
- proto_send_newtux_server(PROTO_SEND_ONE, thisClientSend,
- (tux_t *)(getCurrentArena()->listTux->list[SERVER_INDEX_ROOT_TUX]));
+ thisTux = (tux_t *)(getCurrentArena()->listTux->list[SERVER_INDEX_ROOT_TUX]);
+
+ if( isTuxSeesTux(thisClientSend->tux, thisTux) )
+ proto_send_newtux_server(PROTO_SEND_ONE, thisClientSend, thisTux);
#endif
- }
for( j = 0 ; j < listClient->count; j++)
{
@@ -121,9 +115,8 @@ static void eventPeriodicSyncClient(void *p_nothink)
thisTux = thisClientInfo->tux;
if( thisTux != NULL &&
- thisClientSend->tux != NULL &&
- thisClientSend != thisClientInfo /*&&
- thisTux->status == TUX_STATUS_ALIVE*/ )
+ thisClientSend != thisClientInfo &&
+ isTuxSeesTux(thisClientSend->tux, thisTux) )
{
proto_send_newtux_server(PROTO_SEND_ONE,
thisClientSend, thisTux);
@@ -362,6 +355,28 @@ void sendAllClient(char *msg)
sendAllClientBut(msg, NULL);
}
+void sendAllClientSeesTux(char *msg, tux_t *tux)
+{
+ int i;
+
+ assert( msg != NULL );
+
+ for( i = 0 ; i < listClient->count ; i++ )
+ {
+ client_t *thisClient;
+ tux_t *thisTux;
+
+ thisClient = (client_t *)listClient->list[i];
+ thisTux = (tux_t *)thisClient->tux;
+
+ if( tux != thisTux &&
+ isTuxSeesTux(thisTux, tux) )
+ {
+ sendClient(thisClient, msg);
+ }
+ }
+}
+
void addMsgClient(client_t *p, char *msg, int id)
{
assert( p != NULL );
@@ -398,6 +413,11 @@ void addMsgAllClient(char *msg, int id)
addMsgAllClientBut(msg, NULL, id);
}
+tux_t *getServerTux()
+{
+ return (tux_t *)(getCurrentArena()->listTux->list[SERVER_INDEX_ROOT_TUX]);
+}
+
void sendInfoCreateClient(client_t *client)
{
client_t *thisClient;