summaryrefslogtreecommitdiff
path: root/src/proto.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-04-15 19:28:48 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-04-15 19:28:48 +0000
commita8bec57e7a9be7b1fa36ef8be618db4e46cbd599 (patch)
tree1af5e651f4ff628f99393109e3352dbd7b1f39f4 /src/proto.c
parentc8223ce77a4dbf57be272d10c4e1d31f69bd516e (diff)
- oprava chyby #0007 #0006 #0005
- nova zbran bombball - client dostava svoju vlastnu poziciu od servera kazdych 5000 ms git-svn-id: http://opensvn.csie.org/tuxanci_ng@45 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/proto.c')
-rw-r--r--src/proto.c59
1 files changed, 53 insertions, 6 deletions
diff --git a/src/proto.c b/src/proto.c
index 042ce7f..60bcf20 100644
--- a/src/proto.c
+++ b/src/proto.c
@@ -584,8 +584,8 @@ void proto_send_shot_server(int type, client_t *client, shot_t *p)
id = p->author->id;
}
- sprintf(msg, "shot %d %d %d %d %d %d %d %d\n",
- p->x, p->y, p->px, p->py, p->position, p->gun, id, p->isCanKillAuthor);
+ sprintf(msg, "shot %d %d %d %d %d %d %d %d %d\n",
+ p->id, p->x, p->y, p->px, p->py, p->position, p->gun, id, p->isCanKillAuthor);
proto_send(type, client, msg);
}
@@ -595,15 +595,21 @@ void proto_send_shot_server(int type, client_t *client, shot_t *p)
void proto_recv_shot_client(char *msg)
{
char cmd[STR_PROTO_SIZE];
- int x, y, px, py, position, gun, id, isCanKillAuthor;
+ int x, y, px, py, position, gun, shot_id, author_id, isCanKillAuthor;
shot_t *shot;
assert( msg != NULL );
- sscanf(msg, "%s %d %d %d %d %d %d %d %d",
- cmd, &x, &y, &px, &py, &position, &gun, &id, &isCanKillAuthor);
+ sscanf(msg, "%s %d %d %d %d %d %d %d %d %d",
+ cmd, &shot_id, &x, &y, &px, &py, &position, &gun, &author_id, &isCanKillAuthor);
- shot = newShot(x, y, px, py, gun, getTuxID(getCurrentArena()->listTux, id));
+/*
+ if( getShotID(getCurrentArena()->listShot, shot_id) != NULL )
+ {
+ return;
+ }
+*/
+ shot = newShot(x, y, px, py, gun, getTuxID(getCurrentArena()->listTux, author_id));
shot->isCanKillAuthor = isCanKillAuthor;
shot->position = position;
@@ -618,6 +624,47 @@ void proto_recv_shot_client(char *msg)
#endif
+void proto_send_delshot_server(int type, client_t *client, shot_t *shot)
+{
+ char msg[STR_PROTO_SIZE];
+
+ assert( shot != NULL );
+
+ sprintf(msg, "delshot %d\n", shot->id);
+
+ proto_send(type, client, msg);
+}
+
+#ifndef PUBLIC_SERVER
+
+void proto_recv_delshot_client(char *msg)
+{
+ char cmd[STR_PROTO_SIZE];
+ shot_t *shot;
+ int id;
+
+ assert( msg != NULL );
+
+ sscanf(msg, "%s %d",
+ cmd, &id);
+
+ shot = getShotID(getCurrentArena()->listShot, id);
+
+ if( shot != NULL )
+ {
+ int index;
+
+ index = searchListItem(getCurrentArena()->listShot, shot);
+
+ if( index >= 0 )
+ {
+ delListItem(getCurrentArena()->listShot, index, destroyShot);
+ }
+ }
+}
+
+#endif
+
#ifndef PUBLIC_SERVER
void proto_send_ping_client()