summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkzd <markzd@54d463be-8e91-2dee-dedb-b68131a5f0ec>2013-01-07 06:01:48 +0000
committermarkzd <markzd@54d463be-8e91-2dee-dedb-b68131a5f0ec>2013-01-07 06:01:48 +0000
commitcf31e4f05bb62b5a93f891d219a405e2e942c75c (patch)
tree0c50a11c2f6761546502b7be2b106870ea56de99
parent24987d8513307094064f59d3c9f9c35d0f6a6e87 (diff)
downloadhercules-cf31e4f05bb62b5a93f891d219a405e2e942c75c.tar.gz
hercules-cf31e4f05bb62b5a93f891d219a405e2e942c75c.tar.bz2
hercules-cf31e4f05bb62b5a93f891d219a405e2e942c75c.tar.xz
hercules-cf31e4f05bb62b5a93f891d219a405e2e942c75c.zip
* Follow Up: r17080
1. Removed an unnecessary update call. 2. Implemented interreg table at main.sql. * Follow Up: r17077, r17072, r17065 1. Fixed bugreport:7078, removed unnecessary checks. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@17081 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--sql-files/main.sql8
-rw-r--r--src/char/char.c1
-rw-r--r--src/map/guild.c2
-rw-r--r--src/map/skill.c26
4 files changed, 22 insertions, 15 deletions
diff --git a/sql-files/main.sql b/sql-files/main.sql
index 206515176..f2c574c79 100644
--- a/sql-files/main.sql
+++ b/sql-files/main.sql
@@ -670,3 +670,11 @@ CREATE TABLE IF NOT EXISTS `storage` (
PRIMARY KEY (`id`),
KEY `account_id` (`account_id`)
) ENGINE=MyISAM;
+
+CREATE TABLE IF NOT EXISTS `interreg` (
+ `varname` varchar(11) NOT NULL,
+ `value` varchar(20) NOT NULL,
+ PRIMARY KEY (`varname`)
+) ENGINE=InnoDB;
+INSERT INTO `interreg` (`varname`, `value`) VALUES
+('nsiuid', '0');
diff --git a/src/char/char.c b/src/char/char.c
index e2b313ad9..1aa6ee734 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -837,7 +837,6 @@ int memitemdata_to_sql(const struct item items[], int max, int id, int tableswit
updateLastUid(items[i].nsiuid); // Unique Non Stackable Item ID
}
- updateLastUid(0);
dbUpdateUid(sql_handle); // Unique Non Stackable Item ID
if( found && SQL_ERROR == Sql_QueryStr(sql_handle, StringBuf_Value(&buf)) )
diff --git a/src/map/guild.c b/src/map/guild.c
index 4e256fbd0..780154590 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -1299,7 +1299,7 @@ void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint1
if( !(battle_config.guild_aura&((agit_flag || agit2_flag)?2:1)) &&
!(battle_config.guild_aura&(map_flag_gvg2(sd->bl.m)?8:4)) )
return;
- if( skill_lv <= 0 )
+ if( !skill_lv )
return;
if( sd->sc.data[type] && (group = skill_id2group(sd->sc.data[type]->val4)) ) {
skill_delunitgroup(group);
diff --git a/src/map/skill.c b/src/map/skill.c
index 9a597e1a3..797d5aeda 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -165,7 +165,7 @@ int skill_get_index( uint16 skill_id )
skill_id = HM_SKILLRANGEMIN + skill_id - HM_SKILLBASE;
// validate result
- if( skill_id <= 0 || skill_id >= MAX_SKILL_DB )
+ if( !skill_id || skill_id >= MAX_SKILL_DB )
return 0;
return skill_id;
@@ -185,7 +185,7 @@ const char* skill_get_desc( uint16 skill_id )
static void skill_chk(int16* skill_id, uint16 skill_lv)
{
*skill_id = skill_get_index(*skill_id); // checks/adjusts id
- if( skill_lv <= 0 || skill_lv > MAX_SKILL_LEVEL ) *skill_id = 0;
+ if( skill_lv > MAX_SKILL_LEVEL ) *skill_id = 0;
}
#define skill_get(var,id,lv) { skill_chk(&id,lv); if(!id) return 0; return var; }
@@ -1638,7 +1638,7 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint1
int skill, skill_lv, i, type, notok;
struct block_list *tbl;
- if( sd == NULL || skill_id <= 0 )
+ if( sd == NULL || !skill_id )
return 0;
for( i = 0; i < ARRAYLENGTH(sd->autospell3) && sd->autospell3[i].flag; i++ ) {
@@ -2192,7 +2192,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
int type,damage,rdamage=0;
int8 rmdamage=0;//magic reflected
- if(skill_id > 0 && skill_lv <= 0) return 0;
+ if(skill_id > 0 && !skill_lv) return 0;
nullpo_ret(src); //Source is the master behind the attack (player/mob/pet)
nullpo_ret(dsrc); //dsrc is the actual originator of the damage, can be the same as src, or a skill casted by src.
@@ -3414,7 +3414,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
struct status_data *tstatus;
struct status_change *sc;
- if (skill_id > 0 && skill_lv <= 0) return 0;
+ if (skill_id > 0 && !skill_lv) return 0;
nullpo_retr(1, src);
nullpo_retr(1, bl);
@@ -4678,7 +4678,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
int i = 0;
enum sc_type type;
- if(skill_id > 0 && skill_lv <= 0) return 0; // celest
+ if(skill_id > 0 && !skill_lv) return 0; // celest
nullpo_retr(1, src);
nullpo_retr(1, bl);
@@ -6755,14 +6755,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case WE_MALE:
{
- int hp_rate=(skill_lv <= 0)? 0:skill_db[skill_id].hp_rate[skill_lv-1];
+ int hp_rate=(!skill_lv)? 0:skill_db[skill_id].hp_rate[skill_lv-1];
int gain_hp= tstatus->max_hp*abs(hp_rate)/100; // The earned is the same % of the target HP than it costed the caster. [Skotlex]
clif_skill_nodamage(src,bl,skill_id,status_heal(bl, gain_hp, 0, 0),1);
}
break;
case WE_FEMALE:
{
- int sp_rate=(skill_lv <= 0)? 0:skill_db[skill_id].sp_rate[skill_lv-1];
+ int sp_rate=(!skill_lv)? 0:skill_db[skill_id].sp_rate[skill_lv-1];
int gain_sp=tstatus->max_sp*abs(sp_rate)/100;// The earned is the same % of the target SP than it costed the caster. [Skotlex]
clif_skill_nodamage(src,bl,skill_id,status_heal(bl, 0, gain_sp, 0),1);
}
@@ -9552,7 +9552,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
int i;
//if(skill_lv <= 0) return 0;
- if(skill_id > 0 && skill_lv <= 0) return 0; // celest
+ if(skill_id > 0 && !skill_lv) return 0; // celest
nullpo_ret(src);
@@ -14286,7 +14286,7 @@ int skill_autospell (struct map_session_data *sd, uint16 skill_id)
skill_lv = sd->menuskill_val;
lv=pc_checkskill(sd,skill_id);
- if(skill_lv <= 0 || !lv) return 0; // Player must learn the skill before doing auto-spell [Lance]
+ if(!skill_lv || !lv) return 0; // Player must learn the skill before doing auto-spell [Lance]
if(skill_id==MG_NAPALMBEAT) maxlv=3;
else if(skill_id==MG_COLDBOLT || skill_id==MG_FIREBOLT || skill_id==MG_LIGHTNINGBOLT){
@@ -14427,7 +14427,7 @@ int skill_frostjoke_scream (struct block_list *bl, va_list ap)
skill_id=va_arg(ap,int);
skill_lv=va_arg(ap,int);
- if(skill_lv <= 0) return 0;
+ if(!skill_lv) return 0;
tick=va_arg(ap,unsigned int);
if (src == bl || status_isdead(bl))
@@ -15107,7 +15107,7 @@ struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count,
struct skill_unit_group* group;
int i;
- if(skill_id <= 0 || skill_lv <= 0) return 0;
+ if(!(skill_id && skill_lv)) return 0;
nullpo_retr(NULL, src);
nullpo_retr(NULL, ud);
@@ -17366,7 +17366,7 @@ int skill_block_check(struct block_list *bl, sc_type type , uint16 skill_id) {
int inf = 0;
struct status_change *sc = status_get_sc(bl);
- if( !sc || !bl || skill_id < 1 )
+ if( !sc || !bl || !skill_id )
return 0; // Can do it
switch(type){