summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-03-06 21:10:20 +0100
committerHaru <haru@dotalux.com>2016-03-06 21:10:20 +0100
commita3ad5b4d9fe01b5a17999078bc1cb566c6f5c813 (patch)
treed67d1076d0aa36df8a412691d47a17a4391e9184 /src/map
parentdbebf2dcaaabd65b20722becdf7b4bb3ee682688 (diff)
parent4f6b2ebd825282937015efabbd35fc2cc6d992db (diff)
downloadhercules-a3ad5b4d9fe01b5a17999078bc1cb566c6f5c813.tar.gz
hercules-a3ad5b4d9fe01b5a17999078bc1cb566c6f5c813.tar.bz2
hercules-a3ad5b4d9fe01b5a17999078bc1cb566c6f5c813.tar.xz
hercules-a3ad5b4d9fe01b5a17999078bc1cb566c6f5c813.zip
Merge pull request #1189 from 4144/itemdbview
Check allowed range for "View" field in item_db for weapon items.
Diffstat (limited to 'src/map')
-rw-r--r--src/map/itemdb.c6
-rw-r--r--src/map/pc.h4
-rw-r--r--src/map/status.c6
-rw-r--r--src/map/status.h2
4 files changed, 12 insertions, 6 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 20efb5e9e..630bc4488 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1613,6 +1613,12 @@ int itemdb_validate_entry(struct item_data *entry, int n, const char *source) {
memset(&entry->stack, '\0', sizeof(entry->stack));
}
+ if (entry->type == IT_WEAPON && (entry->look < 0 || entry->look >= MAX_SINGLE_WEAPON_TYPE)) {
+ ShowWarning("itemdb_validate_entry: Invalid View for weapon items. View value %d for item %d (%s) in '%s', defaulting to 1.\n",
+ entry->look, entry->nameid, entry->jname, source);
+ entry->look = 1;
+ }
+
entry->wlv = cap_value(entry->wlv, REFINE_TYPE_ARMOR, REFINE_TYPE_MAX);
if( !entry->elvmax )
diff --git a/src/map/pc.h b/src/map/pc.h
index db1d7a9da..0d2bca84d 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -302,8 +302,8 @@ BEGIN_ZEROED_BLOCK; // this block will be globally zeroed at the beginning of st
int reseff[SC_COMMON_MAX-SC_COMMON_MIN+1];
int weapon_coma_ele[ELE_MAX];
int weapon_coma_race[RC_MAX];
- int weapon_atk[16];
- int weapon_atk_rate[16];
+ int weapon_atk[MAX_WEAPON_TYPE];
+ int weapon_atk_rate[MAX_WEAPON_TYPE];
int arrow_addele[ELE_MAX];
int arrow_addrace[RC_MAX];
int arrow_addsize[3];
diff --git a/src/map/status.c b/src/map/status.c
index d04e88e3c..82c427317 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -12826,7 +12826,7 @@ bool status_readdb_sizefix(char* fields[], int columns, int current)
{
unsigned int i;
- for(i = 0; i < MAX_WEAPON_TYPE; i++)
+ for(i = 0; i < MAX_SINGLE_WEAPON_TYPE; i++)
{
status->dbs->atkmods[current][i] = atoi(fields[i]);
}
@@ -13008,7 +13008,7 @@ int status_readdb(void)
// size_fix.txt
for(i = 0; i < ARRAYLENGTH(status->dbs->atkmods); i++)
- for(j = 0; j < MAX_WEAPON_TYPE; j++)
+ for(j = 0; j < MAX_SINGLE_WEAPON_TYPE; j++)
status->dbs->atkmods[i][j] = 100;
// refine_db.txt
@@ -13023,7 +13023,7 @@ int status_readdb(void)
// read databases
//
sv->readdb(map->db_path, "job_db2.txt", ',', 1, 1+MAX_LEVEL, -1, status->readdb_job2);
- sv->readdb(map->db_path, DBPATH"size_fix.txt", ',', MAX_WEAPON_TYPE, MAX_WEAPON_TYPE, ARRAYLENGTH(status->dbs->atkmods), status->readdb_sizefix);
+ sv->readdb(map->db_path, DBPATH"size_fix.txt", ',', MAX_SINGLE_WEAPON_TYPE, MAX_SINGLE_WEAPON_TYPE, ARRAYLENGTH(status->dbs->atkmods), status->readdb_sizefix);
status->readdb_refine_libconfig(DBPATH"refine_db.conf");
sv->readdb(map->db_path, "sc_config.txt", ',', 2, 2, SC_MAX, status->readdb_scconfig);
status->read_job_db();
diff --git a/src/map/status.h b/src/map/status.h
index 296b5baae..4e2f1bdc0 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -2169,7 +2169,7 @@ BEGIN_ZEROED_BLOCK; /* Everything within this block will be memset to 0 when sta
/* */
struct s_refine_info refine_info[REFINE_TYPE_MAX];
/* */
- int atkmods[3][MAX_WEAPON_TYPE];//ATK weapon modification for size (size_fix.txt)
+ int atkmods[3][MAX_SINGLE_WEAPON_TYPE];//ATK weapon modification for size (size_fix.txt)
char job_bonus[CLASS_COUNT][MAX_LEVEL];
sc_conf_type sc_conf[SC_MAX];
END_ZEROED_BLOCK; /* End */