summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/base/item.c27
-rw-r--r--src/base/proto.c8
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