summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-12 22:53:58 +0300
committerGitHub <noreply@github.com>2016-07-12 22:53:58 +0300
commit69df5ffa970dbcafde7dbb5d360c0ea28300cb50 (patch)
treeba5165b102784eb793da8e9cd8dc35108fbeeed0 /src/map
parent4b8dd1cdaadba7ae2200f114a4e11ef62454eaa1 (diff)
parent14c9f5228fec75fc4e9bc8552e3fbae16f356103 (diff)
downloadhercules-69df5ffa970dbcafde7dbb5d360c0ea28300cb50.tar.gz
hercules-69df5ffa970dbcafde7dbb5d360c0ea28300cb50.tar.bz2
hercules-69df5ffa970dbcafde7dbb5d360c0ea28300cb50.tar.xz
hercules-69df5ffa970dbcafde7dbb5d360c0ea28300cb50.zip
Merge pull request #1290 from HerculesWS/common_interfacing
Common interfacing
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/clif.c5
-rw-r--r--src/map/homunculus.c50
-rw-r--r--src/map/map.c21
-rw-r--r--src/map/script.c4
-rw-r--r--src/map/skill.c4
6 files changed, 44 insertions, 42 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 944271efa..76b74a766 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -2431,7 +2431,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
RE_LVL_DMOD(100);
break;
case LG_OVERBRAND_PLUSATK:
- skillratio = 200 * skill_lv + rnd_value( 10, 100);
+ skillratio = 200 * skill_lv + rnd->value(10, 100);
RE_LVL_DMOD(100);
break;
case LG_RAYOFGENESIS:
diff --git a/src/map/clif.c b/src/map/clif.c
index 9619a7201..3069e95ad 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
@@ -12878,7 +12878,8 @@ bool clif_validate_emblem(const uint8 *emblem, unsigned long emblem_len) {
int header = 0, bitmap = 0, offbits = 0, palettesize = 0;
nullpo_retr(false, emblem);
- if( decode_zip(buf, &buf_len, emblem, emblem_len) != 0 || buf_len < BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE
+ if (grfio->decode_zip(buf, &buf_len, emblem, emblem_len) != 0
+ || buf_len < BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE
|| RBUFW(buf,0) != 0x4d42 // BITMAPFILEHEADER.bfType (signature)
|| RBUFL(buf,2) != buf_len // BITMAPFILEHEADER.bfSize (file size)
|| RBUFL(buf,14) != BITMAPINFOHEADER_SIZE // BITMAPINFOHEADER.biSize (other headers are not supported)
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index 66cce23e6..080a314b8 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -356,14 +356,14 @@ bool homunculus_levelup(struct homun_data *hd) {
max = &hd->homunculusDB->gmax;
min = &hd->homunculusDB->gmin;
- growth_max_hp = rnd_value(min->HP, max->HP);
- growth_max_sp = rnd_value(min->SP, max->SP);
- growth_str = rnd_value(min->str, max->str);
- growth_agi = rnd_value(min->agi, max->agi);
- growth_vit = rnd_value(min->vit, max->vit);
- growth_dex = rnd_value(min->dex, max->dex);
- growth_int = rnd_value(min->int_,max->int_);
- growth_luk = rnd_value(min->luk, max->luk);
+ growth_max_hp = rnd->value(min->HP, max->HP);
+ growth_max_sp = rnd->value(min->SP, max->SP);
+ growth_str = rnd->value(min->str, max->str);
+ growth_agi = rnd->value(min->agi, max->agi);
+ growth_vit = rnd->value(min->vit, max->vit);
+ growth_dex = rnd->value(min->dex, max->dex);
+ growth_int = rnd->value(min->int_,max->int_);
+ growth_luk = rnd->value(min->luk, max->luk);
//Aegis discards the decimals in the stat growth values!
growth_str-=growth_str%10;
@@ -432,14 +432,14 @@ bool homunculus_evolve(struct homun_data *hd) {
hom = &hd->homunculus;
max = &hd->homunculusDB->emax;
min = &hd->homunculusDB->emin;
- hom->max_hp += rnd_value(min->HP, max->HP);
- hom->max_sp += rnd_value(min->SP, max->SP);
- hom->str += 10*rnd_value(min->str, max->str);
- hom->agi += 10*rnd_value(min->agi, max->agi);
- hom->vit += 10*rnd_value(min->vit, max->vit);
- hom->int_+= 10*rnd_value(min->int_,max->int_);
- hom->dex += 10*rnd_value(min->dex, max->dex);
- hom->luk += 10*rnd_value(min->luk, max->luk);
+ hom->max_hp += rnd->value(min->HP, max->HP);
+ hom->max_sp += rnd->value(min->SP, max->SP);
+ hom->str += 10*rnd->value(min->str, max->str);
+ hom->agi += 10*rnd->value(min->agi, max->agi);
+ hom->vit += 10*rnd->value(min->vit, max->vit);
+ hom->int_+= 10*rnd->value(min->int_,max->int_);
+ hom->dex += 10*rnd->value(min->dex, max->dex);
+ hom->luk += 10*rnd->value(min->luk, max->luk);
hom->intimacy = 500;
unit->remove_map(&hd->bl, CLR_OUTSIGHT, ALC_MARK);
@@ -848,7 +848,7 @@ bool homunculus_call(struct map_session_data *sd) {
nullpo_retr(false, sd);
if (!sd->status.hom_id) //Create a new homun.
- return homun->creation_request(sd, HM_CLASS_BASE + rnd_value(0, 7));
+ return homun->creation_request(sd, HM_CLASS_BASE + rnd->value(0, 7));
// If homunc not yet loaded, load it
if (!sd->hd)
@@ -1075,14 +1075,14 @@ bool homunculus_shuffle(struct homun_data *hd) {
//Evolved bonuses
struct s_homunculus *hom = &hd->homunculus;
struct h_stats *max = &hd->homunculusDB->emax, *min = &hd->homunculusDB->emin;
- hom->max_hp += rnd_value(min->HP, max->HP);
- hom->max_sp += rnd_value(min->SP, max->SP);
- hom->str += 10*rnd_value(min->str, max->str);
- hom->agi += 10*rnd_value(min->agi, max->agi);
- hom->vit += 10*rnd_value(min->vit, max->vit);
- hom->int_+= 10*rnd_value(min->int_,max->int_);
- hom->dex += 10*rnd_value(min->dex, max->dex);
- hom->luk += 10*rnd_value(min->luk, max->luk);
+ hom->max_hp += rnd->value(min->HP, max->HP);
+ hom->max_sp += rnd->value(min->SP, max->SP);
+ hom->str += 10*rnd->value(min->str, max->str);
+ hom->agi += 10*rnd->value(min->agi, max->agi);
+ hom->vit += 10*rnd->value(min->vit, max->vit);
+ hom->int_+= 10*rnd->value(min->int_,max->int_);
+ hom->dex += 10*rnd->value(min->dex, max->dex);
+ hom->luk += 10*rnd->value(min->luk, max->luk);
}
hd->homunculus.exp = exp;
diff --git a/src/map/map.c b/src/map/map.c
index 30c849ed1..c5ea7c1f3 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
@@ -2851,7 +2851,7 @@ void map_cellfromcache(struct map_data *m) {
size = (unsigned long)info->xs*(unsigned long)info->ys;
// TO-DO: Maybe handle the scenario, if the decoded buffer isn't the same size as expected? [Shinryo]
- decode_zip(decode_buffer, &size, m->cellPos+sizeof(struct map_cache_map_info), info->len);
+ grfio->decode_zip(decode_buffer, &size, m->cellPos+sizeof(struct map_cache_map_info), info->len);
CREATE(m->cell, struct mapcell, size);
// Set cell properties
@@ -3579,17 +3579,18 @@ void map_flags_init(void) {
int map_waterheight(char* mapname)
{
char fn[256];
- char *rsw, *found;
+ char *rsw = NULL;
+ const char *found;
nullpo_retr(NO_WATER, mapname);
//Look up for the rsw
snprintf(fn, sizeof(fn), "data\\%s.rsw", mapname);
- if ( (found = grfio_find_file(fn)) )
+ if ((found = grfio->find_file(fn)))
safestrncpy(fn, found, sizeof(fn)); // replace with real name
// read & convert fn
- rsw = (char *) grfio_read (fn);
+ rsw = grfio_read(fn);
if (rsw) {
//Load water height from file
int wh = (int) *(float*)(rsw+166);
@@ -3613,7 +3614,7 @@ int map_readgat (struct map_data* m)
nullpo_ret(m);
sprintf(filename, "data\\%s.gat", m->name);
- gat = (uint8 *) grfio_read(filename);
+ gat = grfio_read(filename);
if (gat == NULL)
return 0;
@@ -5677,8 +5678,8 @@ int do_final(void) {
map->map_db->destroy(map->map_db, map->db_final);
mapindex->final();
- if(map->enable_grf)
- grfio_final();
+ if (map->enable_grf)
+ grfio->final();
db_destroy(map->id_db);
db_destroy(map->pc_db);
@@ -6122,8 +6123,8 @@ int do_init(int argc, char *argv[])
}
}
- if(map->enable_grf)
- grfio_init(map->GRF_PATH_FILENAME);
+ if (map->enable_grf)
+ grfio->init(map->GRF_PATH_FILENAME);
map->readallmaps();
diff --git a/src/map/script.c b/src/map/script.c
index 90a70e48d..effe40ea5 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
@@ -16049,7 +16049,7 @@ BUILDIN(md5)
tmpstr = script_getstr(st,2);
md5str = (char *)aMalloc((32+1)*sizeof(char));
- MD5_String(tmpstr, md5str);
+ md5->string(tmpstr, md5str);
script_pushstr(st, md5str);
return true;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 76ee3d3fd..0b66c1ded 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -8827,9 +8827,9 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
if (is_boss(bl)) break;
joblvbonus = ( sd ? sd->status.job_level : 50 );
//First we set the success chance based on the caster's build which increases the chance.
- rate = 10 * skill_lv + rnd_value( sstatus->dex / 12, sstatus->dex / 4 ) + joblvbonus + status->get_lv(src) / 10;
+ rate = 10 * skill_lv + rnd->value( sstatus->dex / 12, sstatus->dex / 4 ) + joblvbonus + status->get_lv(src) / 10;
// We then reduce the success chance based on the target's build.
- rate -= rnd_value( tstatus->agi / 6, tstatus->agi / 3 ) + tstatus->luk / 10 + ( dstsd ? (dstsd->max_weight / 10 - dstsd->weight / 10 ) / 100 : 0 ) + status->get_lv(bl) / 10;
+ rate -= rnd->value( tstatus->agi / 6, tstatus->agi / 3 ) + tstatus->luk / 10 + ( dstsd ? (dstsd->max_weight / 10 - dstsd->weight / 10 ) / 100 : 0 ) + status->get_lv(bl) / 10;
//Finally we set the minimum success chance cap based on the caster's skill level and DEX.
rate = cap_value( rate, skill_lv + sstatus->dex / 20, 100);
clif->skill_nodamage(src,bl,skill_id,0,sc_start(src,bl,type,rate,skill_lv,skill->get_time(skill_id,skill_lv)));