summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-08-07 03:39:13 +0200
committerHaru <haru@dotalux.com>2014-08-07 05:37:38 +0200
commitc45e3fa9793a273a0eab40d1626bcda7d710552c (patch)
tree4f6c9d47770a15c8cbfe065f7ee9203f77e57022 /src/map/pc.c
parentcaf89724767465ecf339c391bb6d7a937d563fb2 (diff)
downloadhercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.tar.gz
hercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.tar.bz2
hercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.tar.xz
hercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.zip
Corrected several format-string errors through the code
- Functions that expect a printf-style format string are now marked as such, so that gcc/clang will emit a warning warn you if you mismatch format string and arguments. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c117
1 files changed, 59 insertions, 58 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 5a21c7df0..6c8e3403d 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -2823,9 +2823,9 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
switch (sd->state.lr_flag) {
case 0: //Right hand
ARR_FIND(0, ARRAYLENGTH(sd->right_weapon.add_dmg), i, sd->right_weapon.add_dmg[i].rate == 0 || sd->right_weapon.add_dmg[i].class_ == type2);
- if (i == ARRAYLENGTH(sd->right_weapon.add_dmg))
- {
- ShowWarning("pc_bonus2: Reached max (%d) number of add Class dmg bonuses per character!\n", ARRAYLENGTH(sd->right_weapon.add_dmg));
+ if (i == ARRAYLENGTH(sd->right_weapon.add_dmg)) {
+ ShowWarning("pc_bonus2: Reached max (%"PRIuS") number of add Class dmg bonuses per character!\n",
+ ARRAYLENGTH(sd->right_weapon.add_dmg));
break;
}
sd->right_weapon.add_dmg[i].class_ = type2;
@@ -2835,9 +2835,9 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
break;
case 1: //Left hand
ARR_FIND(0, ARRAYLENGTH(sd->left_weapon.add_dmg), i, sd->left_weapon.add_dmg[i].rate == 0 || sd->left_weapon.add_dmg[i].class_ == type2);
- if (i == ARRAYLENGTH(sd->left_weapon.add_dmg))
- {
- ShowWarning("pc_bonus2: Reached max (%d) number of add Class dmg bonuses per character!\n", ARRAYLENGTH(sd->left_weapon.add_dmg));
+ if (i == ARRAYLENGTH(sd->left_weapon.add_dmg)) {
+ ShowWarning("pc_bonus2: Reached max (%"PRIuS") number of add Class dmg bonuses per character!\n",
+ ARRAYLENGTH(sd->left_weapon.add_dmg));
break;
}
sd->left_weapon.add_dmg[i].class_ = type2;
@@ -2851,9 +2851,8 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
if(sd->state.lr_flag == 2)
break;
ARR_FIND(0, ARRAYLENGTH(sd->add_mdmg), i, sd->add_mdmg[i].rate == 0 || sd->add_mdmg[i].class_ == type2);
- if (i == ARRAYLENGTH(sd->add_mdmg))
- {
- ShowWarning("pc_bonus2: Reached max (%d) number of add Class magic dmg bonuses per character!\n", ARRAYLENGTH(sd->add_mdmg));
+ if (i == ARRAYLENGTH(sd->add_mdmg)) {
+ ShowWarning("pc_bonus2: Reached max (%"PRIuS") number of add Class magic dmg bonuses per character!\n", ARRAYLENGTH(sd->add_mdmg));
break;
}
sd->add_mdmg[i].class_ = type2;
@@ -2865,9 +2864,8 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
if(sd->state.lr_flag == 2)
break;
ARR_FIND(0, ARRAYLENGTH(sd->add_def), i, sd->add_def[i].rate == 0 || sd->add_def[i].class_ == type2);
- if (i == ARRAYLENGTH(sd->add_def))
- {
- ShowWarning("pc_bonus2: Reached max (%d) number of add Class def bonuses per character!\n", ARRAYLENGTH(sd->add_def));
+ if (i == ARRAYLENGTH(sd->add_def)) {
+ ShowWarning("pc_bonus2: Reached max (%"PRIuS") number of add Class def bonuses per character!\n", ARRAYLENGTH(sd->add_def));
break;
}
sd->add_def[i].class_ = type2;
@@ -2879,9 +2877,8 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
if(sd->state.lr_flag == 2)
break;
ARR_FIND(0, ARRAYLENGTH(sd->add_mdef), i, sd->add_mdef[i].rate == 0 || sd->add_mdef[i].class_ == type2);
- if (i == ARRAYLENGTH(sd->add_mdef))
- {
- ShowWarning("pc_bonus2: Reached max (%d) number of add Class mdef bonuses per character!\n", ARRAYLENGTH(sd->add_mdef));
+ if (i == ARRAYLENGTH(sd->add_mdef)) {
+ ShowWarning("pc_bonus2: Reached max (%"PRIuS") number of add Class mdef bonuses per character!\n", ARRAYLENGTH(sd->add_mdef));
break;
}
sd->add_mdef[i].class_ = type2;
@@ -3004,9 +3001,10 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
if(sd->state.lr_flag == 2)
break;
ARR_FIND(0, ARRAYLENGTH(sd->skillatk), i, sd->skillatk[i].id == 0 || sd->skillatk[i].id == type2);
- if (i == ARRAYLENGTH(sd->skillatk))
- { //Better mention this so the array length can be updated. [Skotlex]
- ShowDebug("script->run: bonus2 bSkillAtk reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillatk), type2, val);
+ if (i == ARRAYLENGTH(sd->skillatk)) {
+ //Better mention this so the array length can be updated. [Skotlex]
+ ShowDebug("script->run: bonus2 bSkillAtk reached it's limit (%"PRIuS" skills per character), bonus skill %d (+%d%%) lost.\n",
+ ARRAYLENGTH(sd->skillatk), type2, val);
break;
}
if (sd->skillatk[i].id == type2)
@@ -3020,9 +3018,10 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
if(sd->state.lr_flag == 2)
break;
ARR_FIND(0, ARRAYLENGTH(sd->skillheal), i, sd->skillheal[i].id == 0 || sd->skillheal[i].id == type2);
- if (i == ARRAYLENGTH(sd->skillheal))
- { // Better mention this so the array length can be updated. [Skotlex]
- ShowDebug("script->run: bonus2 bSkillHeal reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillheal), type2, val);
+ if (i == ARRAYLENGTH(sd->skillheal)) {
+ // Better mention this so the array length can be updated. [Skotlex]
+ ShowDebug("script->run: bonus2 bSkillHeal reached it's limit (%"PRIuS" skills per character), bonus skill %d (+%d%%) lost.\n",
+ ARRAYLENGTH(sd->skillheal), type2, val);
break;
}
if (sd->skillheal[i].id == type2)
@@ -3036,9 +3035,10 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
if(sd->state.lr_flag == 2)
break;
ARR_FIND(0, ARRAYLENGTH(sd->skillheal2), i, sd->skillheal2[i].id == 0 || sd->skillheal2[i].id == type2);
- if (i == ARRAYLENGTH(sd->skillheal2))
- { // Better mention this so the array length can be updated. [Skotlex]
- ShowDebug("script->run: bonus2 bSkillHeal2 reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillheal2), type2, val);
+ if (i == ARRAYLENGTH(sd->skillheal2)) {
+ // Better mention this so the array length can be updated. [Skotlex]
+ ShowDebug("script->run: bonus2 bSkillHeal2 reached it's limit (%"PRIuS" skills per character), bonus skill %d (+%d%%) lost.\n",
+ ARRAYLENGTH(sd->skillheal2), type2, val);
break;
}
if (sd->skillheal2[i].id == type2)
@@ -3052,9 +3052,10 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
if(sd->state.lr_flag == 2)
break;
ARR_FIND(0, ARRAYLENGTH(sd->skillblown), i, sd->skillblown[i].id == 0 || sd->skillblown[i].id == type2);
- if (i == ARRAYLENGTH(sd->skillblown))
- { //Better mention this so the array length can be updated. [Skotlex]
- ShowDebug("script->run: bonus2 bSkillBlown reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillblown), type2, val);
+ if (i == ARRAYLENGTH(sd->skillblown)) {
+ //Better mention this so the array length can be updated. [Skotlex]
+ ShowDebug("script->run: bonus2 bSkillBlown reached it's limit (%"PRIuS" skills per character), bonus skill %d (+%d%%) lost.\n",
+ ARRAYLENGTH(sd->skillblown), type2, val);
break;
}
if(sd->skillblown[i].id == type2)
@@ -3071,9 +3072,9 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
if(sd->state.lr_flag == 2)
break;
ARR_FIND(0, ARRAYLENGTH(sd->skillcast), i, sd->skillcast[i].id == 0 || sd->skillcast[i].id == type2);
- if (i == ARRAYLENGTH(sd->skillcast))
- { //Better mention this so the array length can be updated. [Skotlex]
- ShowDebug("script->run: bonus2 %s reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n",
+ if (i == ARRAYLENGTH(sd->skillcast)) {
+ //Better mention this so the array length can be updated. [Skotlex]
+ ShowDebug("script->run: bonus2 %s reached it's limit (%"PRIuS" skills per character), bonus skill %d (+%d%%) lost.\n",
#ifndef RENEWAL_CAST
"bCastRate",
@@ -3098,11 +3099,9 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
ARR_FIND(0, ARRAYLENGTH(sd->skillfixcastrate), i, sd->skillfixcastrate[i].id == 0 || sd->skillfixcastrate[i].id == type2);
- if (i == ARRAYLENGTH(sd->skillfixcastrate))
-
- {
-
- ShowDebug("script->run: bonus2 bFixedCastrate reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillfixcastrate), type2, val);
+ if (i == ARRAYLENGTH(sd->skillfixcastrate)) {
+ ShowDebug("script->run: bonus2 bFixedCastrate reached it's limit (%"PRIuS" skills per character), bonus skill %d (+%d%%) lost.\n",
+ ARRAYLENGTH(sd->skillfixcastrate), type2, val);
break;
}
@@ -3151,8 +3150,8 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
break;
//Standard item bonus.
for(i=0; i < ARRAYLENGTH(sd->itemhealrate) && sd->itemhealrate[i].nameid && sd->itemhealrate[i].nameid != type2; i++);
- if(i == ARRAYLENGTH(sd->itemhealrate)) {
- ShowWarning("pc_bonus2: Reached max (%d) number of item heal bonuses per character!\n", ARRAYLENGTH(sd->itemhealrate));
+ if (i == ARRAYLENGTH(sd->itemhealrate)) {
+ ShowWarning("pc_bonus2: Reached max (%"PRIuS") number of item heal bonuses per character!\n", ARRAYLENGTH(sd->itemhealrate));
break;
}
sd->itemhealrate[i].nameid = type2;
@@ -3219,7 +3218,8 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
break;
ARR_FIND(0, ARRAYLENGTH(sd->skillusesprate), i, sd->skillusesprate[i].id == 0 || sd->skillusesprate[i].id == type2);
if (i == ARRAYLENGTH(sd->skillusesprate)) {
- ShowDebug("script->run: bonus2 bSkillUseSPrate reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillusesprate), type2, val);
+ ShowDebug("script->run: bonus2 bSkillUseSPrate reached it's limit (%"PRIuS" skills per character), bonus skill %d (+%d%%) lost.\n",
+ ARRAYLENGTH(sd->skillusesprate), type2, val);
break;
}
if (sd->skillusesprate[i].id == type2)
@@ -3233,9 +3233,9 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
if(sd->state.lr_flag == 2)
break;
ARR_FIND(0, ARRAYLENGTH(sd->skillcooldown), i, sd->skillcooldown[i].id == 0 || sd->skillcooldown[i].id == type2);
- if (i == ARRAYLENGTH(sd->skillcooldown))
- {
- ShowDebug("script->run: bonus2 bSkillCoolDown reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillcooldown), type2, val);
+ if (i == ARRAYLENGTH(sd->skillcooldown)) {
+ ShowDebug("script->run: bonus2 bSkillCoolDown reached it's limit (%"PRIuS" skills per character), bonus skill %d (+%d%%) lost.\n",
+ ARRAYLENGTH(sd->skillcooldown), type2, val);
break;
}
if (sd->skillcooldown[i].id == type2)
@@ -3249,9 +3249,9 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
if(sd->state.lr_flag == 2)
break;
ARR_FIND(0, ARRAYLENGTH(sd->skillfixcast), i, sd->skillfixcast[i].id == 0 || sd->skillfixcast[i].id == type2);
- if (i == ARRAYLENGTH(sd->skillfixcast))
- {
- ShowDebug("script->run: bonus2 bSkillFixedCast reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillfixcast), type2, val);
+ if (i == ARRAYLENGTH(sd->skillfixcast)) {
+ ShowDebug("script->run: bonus2 bSkillFixedCast reached it's limit (%"PRIuS" skills per character), bonus skill %d (+%d%%) lost.\n",
+ ARRAYLENGTH(sd->skillfixcast), type2, val);
break;
}
if (sd->skillfixcast[i].id == type2)
@@ -3265,9 +3265,9 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
if(sd->state.lr_flag == 2)
break;
ARR_FIND(0, ARRAYLENGTH(sd->skillvarcast), i, sd->skillvarcast[i].id == 0 || sd->skillvarcast[i].id == type2);
- if (i == ARRAYLENGTH(sd->skillvarcast))
- {
- ShowDebug("script->run: bonus2 bSkillVariableCast reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillvarcast), type2, val);
+ if (i == ARRAYLENGTH(sd->skillvarcast)) {
+ ShowDebug("script->run: bonus2 bSkillVariableCast reached it's limit (%"PRIuS" skills per character), bonus skill %d (+%d%%) lost.\n",
+ ARRAYLENGTH(sd->skillvarcast), type2, val);
break;
}
if (sd->skillvarcast[i].id == type2)
@@ -3282,9 +3282,9 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
if(sd->state.lr_flag == 2)
break;
ARR_FIND(0, ARRAYLENGTH(sd->skillcast), i, sd->skillcast[i].id == 0 || sd->skillcast[i].id == type2);
- if (i == ARRAYLENGTH(sd->skillcast))
- {
- ShowDebug("script->run: bonus2 bVariableCastrate reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n",ARRAYLENGTH(sd->skillcast), type2, val);
+ if (i == ARRAYLENGTH(sd->skillcast)) {
+ ShowDebug("script->run: bonus2 bVariableCastrate reached it's limit (%"PRIuS" skills per character), bonus skill %d (+%d%%) lost.\n",
+ ARRAYLENGTH(sd->skillcast), type2, val);
break;
}
if(sd->skillcast[i].id == type2)
@@ -3300,7 +3300,8 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
break;
ARR_FIND(0, ARRAYLENGTH(sd->skillusesp), i, sd->skillusesp[i].id == 0 || sd->skillusesp[i].id == type2);
if (i == ARRAYLENGTH(sd->skillusesp)) {
- ShowDebug("script->run: bonus2 bSkillUseSP reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillusesp), type2, val);
+ ShowDebug("script->run: bonus2 bSkillUseSP reached it's limit (%"PRIuS" skills per character), bonus skill %d (+%d%%) lost.\n",
+ ARRAYLENGTH(sd->skillusesp), type2, val);
break;
}
if (sd->skillusesp[i].id == type2)
@@ -9961,11 +9962,11 @@ void pc_read_skill_tree(void) {
int skidx, offset = 0, h = 0, rlen = 0, rskid = 0;
ARR_FIND( 0, MAX_SKILL_TREE, skidx, pc->skill_tree[idx][skidx].id == 0 || pc->skill_tree[idx][skidx].id == skill_id );
- if( skidx == MAX_SKILL_TREE ) {
- ShowWarning("pc_read_skill_tree: Unable to load skill %hu (%s) into '%s's tree. Maximum number of skills per class has been reached.\n", skill_id, sk_name, name);
+ if (skidx == MAX_SKILL_TREE) {
+ ShowWarning("pc_read_skill_tree: Unable to load skill %d (%s) into '%s's tree. Maximum number of skills per class has been reached.\n", skill_id, sk_name, name);
continue;
- } else if(pc->skill_tree[idx][skidx].id) {
- ShowNotice("pc_read_skill_tree: Overwriting %hu for '%s' (%d)\n", skill_id, name, jnames[k].id);
+ } else if (pc->skill_tree[idx][skidx].id) {
+ ShowNotice("pc_read_skill_tree: Overwriting %d for '%s' (%d)\n", skill_id, name, jnames[k].id);
}
pc->skill_tree[idx][skidx].id = skill_id;
@@ -10182,7 +10183,7 @@ int pc_readdb(void) {
if (!pc->max_level[j][1])
ShowWarning("Class %s (%d) does not has a job exp table.\n", pc->job_name(i), i);
}
- ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,map->db_path,"exp.txt");
+ ShowStatus("Done reading '"CL_WHITE"%u"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,map->db_path,"exp.txt");
count = 0;
// Reset and read skilltree
memset(pc->skill_tree,0,sizeof(pc->skill_tree));
@@ -10256,7 +10257,7 @@ int pc_readdb(void) {
}
}
fclose(fp);
- ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,map->db_path,"attr_fix.txt");
+ ShowStatus("Done reading '"CL_WHITE"%u"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,map->db_path,"attr_fix.txt");
count = 0;
// reset then read statspoint
memset(pc->statp,0,sizeof(pc->statp));
@@ -10283,7 +10284,7 @@ int pc_readdb(void) {
}
fclose(fp);
- ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,map->db_path,"statpoint.txt");
+ ShowStatus("Done reading '"CL_WHITE"%u"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,map->db_path,"statpoint.txt");
}
// generate the remaining parts of the db if necessary
k = battle_config.use_statpoint_table; //save setting