summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-09-25 09:07:33 -0300
committershennetsind <ind@henn.et>2013-09-25 09:07:33 -0300
commit13afb7e0bf35bacc9c90c7dffe34120ddd2fd099 (patch)
tree180c739ac69aceab8ce4cc6151030539a32ac8c3 /src/map/script.c
parent1114eb3da58b078258a824424fef687a1ccee90c (diff)
parent66979ef89363c03e3cc02d63feb5248836daff4e (diff)
downloadhercules-13afb7e0bf35bacc9c90c7dffe34120ddd2fd099.tar.gz
hercules-13afb7e0bf35bacc9c90c7dffe34120ddd2fd099.tar.bz2
hercules-13afb7e0bf35bacc9c90c7dffe34120ddd2fd099.tar.xz
hercules-13afb7e0bf35bacc9c90c7dffe34120ddd2fd099.zip
Merge branch 'master' of https://github.com/HerculesWS/Hercules
Conflicts: src/map/chrif.c src/map/clif.c src/map/homunculus.c src/map/pet.c src/map/script.c src/map/skill.c src/map/status.c All clear.
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c83
1 files changed, 35 insertions, 48 deletions
diff --git a/src/map/script.c b/src/map/script.c
index bba74e669..6ef015009 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -2761,11 +2761,10 @@ void pop_stack(struct script_state* st, int start, int end)
/*==========================================
* Release script dependent variable, dependent variable of function
*------------------------------------------*/
-void script_free_vars(struct DBMap* storage)
-{
- if( storage )
- {// destroy the storage construct containing the variables
- db_destroy(storage);
+void script_free_vars(struct DBMap* var_storage) {
+ if( var_storage ) {
+ // destroy the storage construct containing the variables
+ db_destroy(var_storage);
}
}
@@ -8151,10 +8150,9 @@ BUILDIN(savepoint)
/*==========================================
* GetTimeTick(0: System Tick, 1: Time Second Tick)
*------------------------------------------*/
-BUILDIN(gettimetick) /* Asgard Version */
-{
+BUILDIN(gettimetick) { /* Asgard Version */
int type;
- time_t tt;
+ time_t clock;
struct tm *t;
type=script_getnum(st,2);
@@ -8167,8 +8165,8 @@ BUILDIN(gettimetick) /* Asgard Version */
break;
case 1:
//type 1:(Second Ticks: 0-86399, 00:00:00-23:59:59)
- time(&tt);
- t=localtime(&tt);
+ time(&clock);
+ t=localtime(&clock);
script_pushint(st,((t->tm_hour)*3600+(t->tm_min)*60+t->tm_sec));
break;
case 0:
@@ -8179,23 +8177,21 @@ BUILDIN(gettimetick) /* Asgard Version */
}
return true;
}
-
/*==========================================
* GetTime(Type);
* 1: Sec 2: Min 3: Hour
* 4: WeekDay 5: MonthDay 6: Month
* 7: Year
*------------------------------------------*/
-BUILDIN(gettime) /* Asgard Version */
-{
+BUILDIN(gettime) { /* Asgard Version */
int type;
- time_t timer;
+ time_t clock;
struct tm *t;
type=script_getnum(st,2);
- time(&timer);
- t=localtime(&timer);
+ time(&clock);
+ t=localtime(&clock);
switch(type){
case 1://Sec(0~59)
@@ -9716,8 +9712,7 @@ BUILDIN(getstatus)
return true;
}
- switch( type )
- {
+ switch( type ) {
case 1: script_pushint(st, sd->sc.data[id]->val1); break;
case 2: script_pushint(st, sd->sc.data[id]->val2); break;
case 3: script_pushint(st, sd->sc.data[id]->val3); break;
@@ -9726,8 +9721,8 @@ BUILDIN(getstatus)
{
struct TimerData* td = (struct TimerData*)timer->get(sd->sc.data[id]->timer);
- if( td )
- {// return the amount of time remaining
+ if( td ) {
+ // return the amount of time remaining
script_pushint(st, td->tick - timer->gettick());
}
}
@@ -9797,16 +9792,16 @@ BUILDIN(homunculus_mutate) {
if( sd == NULL || sd->hd == NULL )
return true;
- if(script_hasdata(st,2))
+ if( script_hasdata(st,2) )
homun_id = script_getnum(st,2);
else
homun_id = 6048 + (rnd() % 4);
- if(homun_alive(sd->hd)) {
+ if( homun_alive(sd->hd) ) {
m_class = homun->class2type(sd->hd->homunculus.class_);
m_id = homun->class2type(homun_id);
- if ( m_class != -1 && m_id != -1 && m_class == HT_EVO && m_id == HT_S && sd->hd->homunculus.level >= 99 )
+ if( m_class != HT_INVALID && m_id != HT_INVALID && m_class == HT_EVO && m_id == HT_S && sd->hd->homunculus.level >= 99 )
homun->mutate(sd->hd, homun_id);
else
clif->emotion(&sd->hd->bl, E_SWT);
@@ -15496,17 +15491,15 @@ BUILDIN(mercenary_sc_start)
return true;
}
-BUILDIN(mercenary_get_calls)
-{
+BUILDIN(mercenary_get_calls) {
struct map_session_data *sd = script_rid2sd(st);
- int guild;
+ int guild_id;
if( sd == NULL )
return true;
- guild = script_getnum(st,2);
- switch( guild )
- {
+ guild_id = script_getnum(st,2);
+ switch( guild_id ) {
case ARCH_MERC_GUILD:
script_pushint(st,sd->status.arch_calls);
break;
@@ -15524,19 +15517,17 @@ BUILDIN(mercenary_get_calls)
return true;
}
-BUILDIN(mercenary_set_calls)
-{
+BUILDIN(mercenary_set_calls) {
struct map_session_data *sd = script_rid2sd(st);
- int guild, value, *calls;
+ int guild_id, value, *calls;
if( sd == NULL )
return true;
- guild = script_getnum(st,2);
+ guild_id = script_getnum(st,2);
value = script_getnum(st,3);
- switch( guild )
- {
+ switch( guild_id ) {
case ARCH_MERC_GUILD:
calls = &sd->status.arch_calls;
break;
@@ -15556,17 +15547,15 @@ BUILDIN(mercenary_set_calls)
return true;
}
-BUILDIN(mercenary_get_faith)
-{
+BUILDIN(mercenary_get_faith) {
struct map_session_data *sd = script_rid2sd(st);
- int guild;
+ int guild_id;
if( sd == NULL )
return true;
- guild = script_getnum(st,2);
- switch( guild )
- {
+ guild_id = script_getnum(st,2);
+ switch( guild_id ) {
case ARCH_MERC_GUILD:
script_pushint(st,sd->status.arch_faith);
break;
@@ -15584,19 +15573,17 @@ BUILDIN(mercenary_get_faith)
return true;
}
-BUILDIN(mercenary_set_faith)
-{
+BUILDIN(mercenary_set_faith) {
struct map_session_data *sd = script_rid2sd(st);
- int guild, value, *calls;
+ int guild_id, value, *calls;
if( sd == NULL )
return true;
- guild = script_getnum(st,2);
+ guild_id = script_getnum(st,2);
value = script_getnum(st,3);
- switch( guild )
- {
+ switch( guild_id ) {
case ARCH_MERC_GUILD:
calls = &sd->status.arch_faith;
break;
@@ -15612,7 +15599,7 @@ BUILDIN(mercenary_set_faith)
*calls += value;
*calls = cap_value(*calls, 0, INT_MAX);
- if( mercenary->get_guild(sd->md) == guild )
+ if( mercenary->get_guild(sd->md) == guild_id )
clif->mercenary_updatestatus(sd,SP_MERCFAITH);
return true;