summaryrefslogtreecommitdiff
path: root/src/map/trade.c
diff options
context:
space:
mode:
authorLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-27 06:38:17 +0000
committerLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-27 06:38:17 +0000
commit3c8999edce9e1f0d5c0dee3ff8311e781d64c684 (patch)
treed066567a720e5fad02e6f857d55bc165d9a3809a /src/map/trade.c
parentea320701794515d4ffa6a8e8ff8f3b8fdfe09860 (diff)
downloadhercules-3c8999edce9e1f0d5c0dee3ff8311e781d64c684.tar.gz
hercules-3c8999edce9e1f0d5c0dee3ff8311e781d64c684.tar.bz2
hercules-3c8999edce9e1f0d5c0dee3ff8311e781d64c684.tar.xz
hercules-3c8999edce9e1f0d5c0dee3ff8311e781d64c684.zip
* Optional macro MEMSET_TURBO for faster low-level memory initializations.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8499 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/trade.c')
-rw-r--r--src/map/trade.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/map/trade.c b/src/map/trade.c
index 6c8675d2b..fe695d695 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -17,6 +17,7 @@
#include "intif.h"
#include "atcommand.h"
#include "log.h"
+#include "../common/malloc.h"
/*==========================================
@@ -114,8 +115,8 @@ void trade_tradeack(struct map_session_data *sd, int type) {
if (type == 3) { //Initiate trade
sd->state.trading = 1;
target_sd->state.trading = 1;
- memset(&sd->deal, 0, sizeof(sd->deal));
- memset(&target_sd->deal, 0, sizeof(target_sd->deal));
+ malloc_set(&sd->deal, 0, sizeof(sd->deal));
+ malloc_set(&target_sd->deal, 0, sizeof(target_sd->deal));
clif_tradestart(target_sd, type);
clif_tradestart(sd, type);
if (sd->npc_id)
@@ -152,7 +153,7 @@ int impossible_trade_check(struct map_session_data *sd) {
// remove equiped items (they can not be trade)
for (i = 0; i < MAX_INVENTORY; i++)
if (inventory[i].nameid > 0 && inventory[i].equip && !(inventory[i].equip & EQP_AMMO))
- memset(&inventory[i], 0, sizeof(struct item));
+ malloc_set(&inventory[i], 0, sizeof(struct item));
// check items in player inventory
for(i = 0; i < 10; i++) {
@@ -230,7 +231,7 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd) {
inventory[n].amount -= amount;
//let's not make room, as pc_additem is done before pc_delitem, so it could lead to problems depending on order.
// if (!inventory[n].amount)
-// memset(&inventory[n], 0, sizeof(struct item));
+// malloc_set(&inventory[n], 0, sizeof(struct item));
break;
}
}
@@ -243,7 +244,7 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd) {
inventory2[i].amount = amount;
inventory[n].amount -= amount;
// if (!inventory[n].amount)
-// memset(&inventory[n], 0, sizeof(struct item));
+// malloc_set(&inventory[n], 0, sizeof(struct item));
}
}
amount = tsd->deal.item[trade_i].amount;
@@ -265,7 +266,7 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd) {
inventory[i].amount += amount;
inventory2[n].amount -= amount;
// if (!inventory2[n].amount)
-// memset(&inventory2[n], 0, sizeof(struct item));
+// malloc_set(&inventory2[n], 0, sizeof(struct item));
break;
}
}
@@ -277,7 +278,7 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd) {
inventory[i].amount = amount;
inventory2[n].amount -= amount;
// if (!inventory2[n].amount)
-// memset(&inventory2[n], 0, sizeof(struct item));
+// malloc_set(&inventory2[n], 0, sizeof(struct item));
}
}