diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-09-02 15:32:25 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-09-02 15:32:25 +0000 |
| commit | f8204ae7059f1b49c01c72e1bc9647f366cb34b9 (patch) | |
| tree | c98d4f76726c3bef0c1f87106bca3935b775b4d9 /src | |
| parent | 6e2ef918f0f7d3628d7d6bb5c09c73eded5961cc (diff) | |
- oprava chyby, medzi veci sa nezaratavaju veci ako su miny v arene
( suvisi s ratanim maximalneho poctu veci v arene )
git-svn-id: http://opensvn.csie.org/tuxanci_ng@262 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src')
| -rw-r--r-- | src/base/item.c | 27 | ||||
| -rw-r--r-- | src/base/proto.c | 8 |
2 files changed, 30 insertions, 5 deletions
diff --git a/src/base/item.c b/src/base/item.c index 56ad293..1e8901d 100644 --- a/src/base/item.c +++ b/src/base/item.c @@ -152,6 +152,26 @@ void replaceItemID(item_t *item, int id) item->id = id; } +#ifdef PUBLIC_SERVER +static void action_countitem(space_t *space, item_t *item, int *count) +{ + if( ( item->type >= GUN_DUAL_SIMPLE && item->type <= GUN_BOMBBALL ) || + ( item->type >= BONUS_SPEED && item->type <= BONUS_HIDDEN ) ) + { + (*count)++; + } +} + +static int getCountWeaponOrBonusItem(space_t *spaceItem) +{ + int count = 0; + + actionSpace(spaceItem, action_countitem, &count); + + return count; +} +#endif + void addNewItem(space_t *spaceItem, int author_id) { arena_t *arena; @@ -160,7 +180,7 @@ void addNewItem(space_t *spaceItem, int author_id) int type; #ifdef PUBLIC_SERVER - if( getSpaceCount(spaceItem) >= atoi( getSetting("MAX_ITEM", "--max-item", "100") ) ) + if( getCountWeaponOrBonusItem(spaceItem) >= atoi( getSetting("MAX_ITEM", "--max-item", "100") ) ) { return; } @@ -383,6 +403,7 @@ static void tuxGiveBonus(tux_t *tux, item_t *item) #endif tux->bonus = item->type; tux->bonus_time = TUX_MAX_BONUS; + if (getNetTypeGame() == NET_GAME_TYPE_SERVER) proto_send_newtux_server(PROTO_SEND_ALL, NULL, tux); } @@ -395,6 +416,7 @@ static void tuxGiveGun(tux_t *tux, item_t *item) tux->pickup_time = 0; tux->shot[ item->type ] += GUN_MAX_SHOT; tux->gun = item->type; + if (getNetTypeGame() == NET_GAME_TYPE_SERVER) proto_send_newtux_server(PROTO_SEND_ALL, NULL, tux); } @@ -449,10 +471,13 @@ void eventGiveTuxListItem(tux_t *tux, space_t *spaceItem) assert(spaceItem != NULL); assert(tux != NULL); + if (getNetTypeGame() == NET_GAME_TYPE_CLIENT) return; + if (tux->status == TUX_STATUS_DEAD) return; + getTuxProportion(tux, &x, &y, &w, &h); actionSpaceFromLocation(spaceItem, action_giveitem, tux, x, y, w, h); } diff --git a/src/base/proto.c b/src/base/proto.c index 9362378..ca10743 100644 --- a/src/base/proto.c +++ b/src/base/proto.c @@ -880,7 +880,7 @@ void proto_send_module_client(char *msg) { char out[STR_PROTO_SIZE]; - snprintf(out, STR_PROTO_SIZE, "modules %s\n", msg); + snprintf(out, STR_PROTO_SIZE, "module %s\n", msg); /* strcpy(out, "modules "); strcat(out, msg); @@ -893,14 +893,14 @@ void proto_send_module_client(char *msg) void proto_recv_module_server(client_t *client, char *msg) { - recvMsgModule(msg+8); + recvMsgModule(msg+7); } void proto_send_module_server(int type, client_t *client, char *msg) { char out[STR_PROTO_SIZE]; - snprintf(out, STR_PROTO_SIZE, "modules %s\n", msg); + snprintf(out, STR_PROTO_SIZE, "module %s\n", msg); /* strcpy(out, "modules "); strcat(out, msg); @@ -914,7 +914,7 @@ void proto_send_module_server(int type, client_t *client, char *msg) void proto_recv_module_client(char *msg) { - recvMsgModule(msg+8); + recvMsgModule(msg+7); } #endif |