summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-07-17 19:40:53 +0300
committerAndrei Karas <akaras@inbox.ru>2015-07-25 14:49:05 +0300
commitf780bc47486289acd70fee5dc4f34efca1440eaa (patch)
tree14d805dda098415e116a9100f53d36139fa396e9 /src
parent58a97dc5edd22bbc7abb40554d19876a43077376 (diff)
downloadhercules-f780bc47486289acd70fee5dc4f34efca1440eaa.tar.gz
hercules-f780bc47486289acd70fee5dc4f34efca1440eaa.tar.bz2
hercules-f780bc47486289acd70fee5dc4f34efca1440eaa.tar.xz
hercules-f780bc47486289acd70fee5dc4f34efca1440eaa.zip
Reduce memory usage in HPM in mercenary.c
Diffstat (limited to 'src')
-rw-r--r--src/map/mercenary.c6
-rw-r--r--src/map/mercenary.h2
2 files changed, 5 insertions, 3 deletions
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index ffcb26629..c60234d5d 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -42,6 +42,7 @@
#include <string.h>
struct mercenary_interface mercenary_s;
+struct s_mercenary_db mercdb[MAX_MERCENARY_CLASS];
int merc_search_index(int class_)
{
@@ -449,7 +450,7 @@ bool read_mercenarydb_sub(char* str[], int columns, int current) {
}
int read_mercenarydb(void) {
- memset(mercenary->db,0,sizeof(mercenary->db));
+ memset(mercenary->db, 0, sizeof(struct s_mercenary_db) * MAX_MERCENARY_CLASS);
sv->readdb(map->db_path, "mercenary_db.txt", ',', 26, 26, MAX_MERCENARY_CLASS, mercenary->read_db_sub);
return 0;
@@ -511,7 +512,8 @@ void mercenary_defaults(void) {
mercenary = &mercenary_s;
/* vars */
- memset(mercenary->db,0,sizeof(mercenary->db));
+ mercenary->db = mercdb;
+ memset(mercenary->db, 0, sizeof(struct s_mercenary_db) * MAX_MERCENARY_CLASS);
/* funcs */
diff --git a/src/map/mercenary.h b/src/map/mercenary.h
index 29a2c6ba0..c96b5a5ef 100644
--- a/src/map/mercenary.h
+++ b/src/map/mercenary.h
@@ -58,7 +58,7 @@ struct mercenary_interface {
/* vars */
- struct s_mercenary_db db[MAX_MERCENARY_CLASS];
+ struct s_mercenary_db *db;
/* funcs */