summaryrefslogtreecommitdiff
path: root/src/char
diff options
context:
space:
mode:
Diffstat (limited to 'src/char')
-rw-r--r--src/char/char.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 78b2d19fa..cf3fbb5e7 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -600,7 +600,7 @@ int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p)
StrBuf->Clear(&buf);
StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`id`,`lv`,`flag`) VALUES ", skill_db);
//insert here.
- for( i = 0, count = 0; i < MAX_SKILL; ++i ) {
+ for (i = 0, count = 0; i < MAX_SKILL_DB; ++i) {
if( p->skill[i].id != 0 && p->skill[i].flag != SKILL_FLAG_TEMPORARY ) {
if( p->skill[i].lv == 0 && ( p->skill[i].flag == SKILL_FLAG_PERM_GRANTED || p->skill[i].flag == SKILL_FLAG_PERMANENT ) )
continue;
@@ -1301,7 +1301,7 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every
//read skill
//`skill` (`char_id`, `id`, `lv`)
memset(&tmp_skill, 0, sizeof(tmp_skill));
- if (SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, MAX_SKILL)
+ if (SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, MAX_SKILL_DB)
|| SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0)
|| SQL_ERROR == SQL->StmtExecute(stmt)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id , 0, NULL, NULL)
@@ -1314,7 +1314,7 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every
if( tmp_skill.flag != SKILL_FLAG_PERM_GRANTED )
tmp_skill.flag = SKILL_FLAG_PERMANENT;
- for( i = 0; i < MAX_SKILL && SQL_SUCCESS == SQL->StmtNextRow(stmt); ++i ) {
+ for (i = 0; i < MAX_SKILL_DB && SQL_SUCCESS == SQL->StmtNextRow(stmt); ++i) {
if( skillid2idx[tmp_skill.id] )
memcpy(&p->skill[skillid2idx[tmp_skill.id]], &tmp_skill, sizeof(tmp_skill));
else
@@ -2979,8 +2979,8 @@ void char_parse_frommap_skillid2idx(int fd)
if( j )
j /= 4;
for(i = 0; i < j; i++) {
- if( RFIFOW(fd, 4 + (i*4)) > MAX_SKILL_ID ) {
- ShowWarning("Error skillid2dx[%d] = %d failed, %d is higher than MAX_SKILL_ID (%d)\n",RFIFOW(fd, 4 + (i*4)), RFIFOW(fd, 6 + (i*4)),RFIFOW(fd, 4 + (i*4)),MAX_SKILL_ID);
+ if (RFIFOW(fd, 4 + (i*4)) >= MAX_SKILL_ID) {
+ ShowWarning("Error skillid2dx[%d] = %d failed, %d is higher than MAX_SKILL_ID (%d)\n", RFIFOW(fd, 4 + (i*4)), RFIFOW(fd, 6 + (i*4)), RFIFOW(fd, 4 + (i*4)), MAX_SKILL_ID);
continue;
}
skillid2idx[RFIFOW(fd, 4 + (i*4))] = RFIFOW(fd, 6 + (i*4));