summaryrefslogtreecommitdiff
path: root/src/emap/craftconf.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-03 01:15:02 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-04 16:29:02 +0300
commit1246fcc42bc44f624a1c8bd855fd1dd82d51f228 (patch)
tree5ad659704c2f57711dc77e184e4110b527e12e79 /src/emap/craftconf.c
parent9b47893aa8736d173ca85a30c5336d9418b3044f (diff)
downloadevol-hercules-1246fcc42bc44f624a1c8bd855fd1dd82d51f228.tar.gz
evol-hercules-1246fcc42bc44f624a1c8bd855fd1dd82d51f228.tar.bz2
evol-hercules-1246fcc42bc44f624a1c8bd855fd1dd82d51f228.tar.xz
evol-hercules-1246fcc42bc44f624a1c8bd855fd1dd82d51f228.zip
Reduce memory usage in vectors.evolrelease2016-08-07
Diffstat (limited to 'src/emap/craftconf.c')
-rw-r--r--src/emap/craftconf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/emap/craftconf.c b/src/emap/craftconf.c
index 0c9d329..7056d4f 100644
--- a/src/emap/craftconf.c
+++ b/src/emap/craftconf.c
@@ -100,7 +100,7 @@ static void craft_read_source_inventory(struct craft_db_entry *entry,
struct config_setting_t *item;
int invLen = VECTOR_LENGTH(entry->inventories);
- VECTOR_ENSURE(entry->inventories, invLen + 1, 1);
+ VECTOR_ENSURE(entry->inventories, 1, 1);
VECTOR_INSERTZEROED(entry->inventories, invLen);
struct craft_db_inventory *inventory = &VECTOR_INDEX(entry->inventories, invLen);
@@ -145,7 +145,7 @@ static void craft_read_create_items(struct craft_db_entry *entry,
struct config_setting_t *item;
int invLen = VECTOR_LENGTH(entry->create_items);
- VECTOR_ENSURE(entry->create_items, invLen + 1, 1);
+ VECTOR_ENSURE(entry->create_items, 1, 1);
VECTOR_INSERTZEROED(entry->create_items, invLen);
struct craft_items_collection *collection = &VECTOR_INDEX(entry->create_items, invLen);
VECTOR_INIT(*collection);
@@ -171,7 +171,7 @@ static void craft_read_create_items(struct craft_db_entry *entry,
continue;
}
- VECTOR_ENSURE(*collection, collecitonLen + 1, 1);
+ VECTOR_ENSURE(*collection, 1, 1);
VECTOR_INSERTZEROED(*collection, collecitonLen);
struct item_pair *pair = &VECTOR_INDEX(*collection, collecitonLen);
pair->index = itemId;
@@ -282,7 +282,7 @@ static void craft_read_items_collection(struct craft_db_entry *entry,
continue;
}
- VECTOR_ENSURE(*vector, len + 1, 1);
+ VECTOR_ENSURE(*vector, 1, 1);
VECTOR_INSERTZEROED(*vector, len);
struct item_pair *pair = &VECTOR_INDEX(*vector, len);
len ++;