From 9b6610e12b484d9bb4b295a5fc609a3eed7f9940 Mon Sep 17 00:00:00 2001 From: ultramage Date: Wed, 22 Jun 2011 20:11:48 +0000 Subject: Added enum e_skill_flag to represent the values of struct s_skill's complicated 'flag' field. Reordered the enum values so SKILL_FLAG_REPLACED_LV_0 goes last and arithmetic can be done on it safely (for storing skill level values). This also adds support for skill levels higher than 10. Fixed several places where SKILL_FLAG_TEMPORARY was not handled properly, and instead was considered as one of the saved skill level values (resulting in skill level -1). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14861 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/char_sql/char.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/char_sql') diff --git a/src/char_sql/char.c b/src/char_sql/char.c index 7e44890cb..7bac93cf7 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -590,11 +590,11 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) //insert here. for( i = 0, count = 0; i < MAX_SKILL; ++i ) { - if(p->skill[i].id && p->skill[i].flag!=1) + if(p->skill[i].id != 0 && p->skill[i].flag != SKILL_FLAG_TEMPORARY) { if( count ) StringBuf_AppendStr(&buf, ","); - StringBuf_Printf(&buf, "('%d','%d','%d')", char_id, p->skill[i].id, (p->skill[i].flag == 0 ? p->skill[i].lv : p->skill[i].flag - 2)); + StringBuf_Printf(&buf, "('%d','%d','%d')", char_id, p->skill[i].id, (p->skill[i].flag == SKILL_FLAG_PERMANENT ? p->skill[i].lv : p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0)); ++count; } } @@ -1107,7 +1107,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id, 0, NULL, NULL) || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_USHORT, &tmp_skill.lv, 0, NULL, NULL) ) SqlStmt_ShowDebug(stmt); - tmp_skill.flag = 0; + tmp_skill.flag = SKILL_FLAG_PERMANENT; for( i = 0; i < MAX_SKILL && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i ) { -- cgit v1.2.3-60-g2f50