Skip to content
Permalink
Browse files
Fix compilation issue
Follow up dae8122 (AEGIS class system) fix out of bound issue for
array.
(didn't check the x_ALL option system yet)
Follow up 7a9aa7f Fix possible mapcrash due to offline player
Follow up 12007fe Fix some invalide string check and remove the
reverted sqlfiles
  • Loading branch information
lighta committed Dec 30, 2013
1 parent e18bf43 commit b695ab3f4186acb350850df3debb1f36713a2eb7
Showing with 91 additions and 134 deletions.
  1. +0 −50 sql-files/upgrades/upgrade_20131229.sql
  2. +3 −1 src/char/char.c
  3. +1 −1 src/map/atcommand.c
  4. +7 −11 src/map/battle.c
  5. +2 −1 src/map/battle.h
  6. +1 −1 src/map/chat.c
  7. +1 −1 src/map/chrif.c
  8. +1 −1 src/map/itemdb.c
  9. +1 −1 src/map/itemdb.h
  10. +1 −1 src/map/log.c
  11. +8 −6 src/map/map.h
  12. +1 −0 src/map/mob.h
  13. +23 −24 src/map/pc.c
  14. +30 −30 src/map/pc.h
  15. +2 −1 src/map/script.c
  16. +9 −4 src/map/skill.c
@@ -1,50 +0,0 @@
ALTER TABLE `item_db2` CHANGE `type` `type` VARCHAR( 2 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db2` CHANGE `price_buy` `price_buy` VARCHAR( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db2` CHANGE `price_sell` `price_sell` VARCHAR( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db2` CHANGE `weight` `weight` VARCHAR( 5 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db2` CHANGE `attack` `attack` VARCHAR( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db2` CHANGE `defence` `defence` VARCHAR( 5 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db2` CHANGE `range` `range` VARCHAR( 2 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db2` CHANGE `slots` `slots` VARCHAR( 2 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db2` CHANGE `equip_jobs` `equip_jobs` VARCHAR( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db2` CHANGE `equip_upper` `equip_upper` VARCHAR( 2 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db2` CHANGE `equip_genders` `equip_genders` CHAR( 1 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db2` CHANGE `equip_locations` `equip_locations` VARCHAR( 8 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db2` CHANGE `weapon_level` `weapon_level` CHAR( 1 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db2` CHANGE `equip_level` `equip_level` VARCHAR( 4 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db2` CHANGE `refineable` `refineable` CHAR( 1 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db2` CHANGE `view` `view` VARCHAR( 5 ) NOT NULL DEFAULT '0';

ALTER TABLE `item_db` CHANGE `type` `type` VARCHAR( 2 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db` CHANGE `price_buy` `price_buy` VARCHAR( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db` CHANGE `price_sell` `price_sell` VARCHAR( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db` CHANGE `weight` `weight` VARCHAR( 5 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db` CHANGE `attack` `attack` VARCHAR( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db` CHANGE `defence` `defence` VARCHAR( 5 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db` CHANGE `range` `range` VARCHAR( 2 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db` CHANGE `slots` `slots` VARCHAR( 2 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db` CHANGE `equip_jobs` `equip_jobs` VARCHAR( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db` CHANGE `equip_upper` `equip_upper` VARCHAR( 2 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db` CHANGE `equip_genders` `equip_genders` CHAR( 1 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db` CHANGE `equip_locations` `equip_locations` VARCHAR( 8 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db` CHANGE `weapon_level` `weapon_level` CHAR( 1 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db` CHANGE `equip_level` `equip_level` VARCHAR( 4 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db` CHANGE `refineable` `refineable` CHAR( 1 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db` CHANGE `view` `view` VARCHAR( 5 ) NOT NULL DEFAULT '0';

ALTER TABLE `item_db_re` CHANGE `type` `type` VARCHAR( 2 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db_re` CHANGE `price_buy` `price_buy` VARCHAR( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db_re` CHANGE `price_sell` `price_sell` VARCHAR( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db_re` CHANGE `weight` `weight` VARCHAR( 5 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db_re` CHANGE `atk:matk` `atk:matk` VARCHAR( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db_re` CHANGE `defence` `defence` VARCHAR( 5 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db_re` CHANGE `range` `range` VARCHAR( 2 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db_re` CHANGE `slots` `slots` VARCHAR( 2 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db_re` CHANGE `equip_jobs` `equip_jobs` VARCHAR( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db_re` CHANGE `equip_upper` `equip_upper` VARCHAR( 2 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db_re` CHANGE `equip_genders` `equip_genders` CHAR( 1 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db_re` CHANGE `equip_locations` `equip_locations` VARCHAR( 8 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db_re` CHANGE `weapon_level` `weapon_level` CHAR( 1 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db_re` CHANGE `equip_level` `equip_level` VARCHAR( 4 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db_re` CHANGE `refineable` `refineable` CHAR( 1 ) NOT NULL DEFAULT '0';
ALTER TABLE `item_db_re` CHANGE `view` `view` VARCHAR( 5 ) NOT NULL DEFAULT '0';
@@ -4137,7 +4137,9 @@ static void char_delete2_accept(int fd, struct char_session_data* sd)
return;
}

if( ( char_del_level > 0 && base_level >= (unsigned int)char_del_level ) || ( char_del_level < 0 && base_level <= (unsigned int)(-char_del_level) ) || !char_del_option&2 )
if( ( char_del_level > 0 && base_level >= (unsigned int)char_del_level )
|| ( char_del_level < 0 && base_level <= (unsigned int)(-char_del_level) )
|| !(char_del_option&2) )
{// character level config restriction
char_delete2_accept_ack(fd, char_id, 2);
return;
@@ -14,6 +14,7 @@
#include "../common/utils.h"
#include "../common/conf.h"

#include "map.h"
#include "atcommand.h"
#include "battle.h"
#include "chat.h"
@@ -25,7 +26,6 @@
#include "intif.h"
#include "itemdb.h"
#include "log.h"
#include "map.h"
#include "pc.h"
#include "pc_groups.h" // groupid2name
#include "status.h"
@@ -35,7 +35,7 @@
#include <string.h>
#include <math.h>

int attr_fix_table[4][ELE_ALL][ELE_ALL];
int attr_fix_table[4][ELE_NONE][ELE_NONE];

struct Battle_Config battle_config;
static struct eri *delay_damage_ers; //For battle delay damage structures.
@@ -292,15 +292,11 @@ int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src,

return 0;
}
int battle_attr_ratio(int atk_elem,int def_type, int def_lv)
{

if (atk_elem < 0 || atk_elem >= ELE_ALL)
int battle_attr_ratio(int atk_elem,int def_type, int def_lv){
if (atk_elem < ELE_NEUTRAL || atk_elem >= ELE_ALL)
return 100;

if (def_type < 0 || def_type > ELE_ALL || def_lv < 1 || def_lv > 4)
if (def_type < ELE_NEUTRAL || def_type > ELE_ALL || def_lv < 1 || def_lv > 4)
return 100;

return attr_fix_table[def_lv-1][atk_elem][def_type];
}

@@ -317,10 +313,10 @@ int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 d
if (src) sc = status_get_sc(src);
if (target) tsc = status_get_sc(target);

if (atk_elem < 0 || atk_elem >= ELE_ALL)
if (atk_elem < ELE_NEUTRAL || atk_elem >= ELE_ALL)
atk_elem = rnd()%ELE_ALL;

if (def_type < 0 || def_type > ELE_ALL ||
if (def_type < ELE_NEUTRAL || def_type > ELE_ALL ||
def_lv < 1 || def_lv > 4) {
ShowError("battle_attr_fix: unknown attr type: atk=%d def_type=%d def_lv=%d\n",atk_elem,def_type,def_lv);
return damage;
@@ -5974,7 +5970,7 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int64 rdamage, int64 ldama
{
struct weapon_data *wd;
int64 *damage;
int thp = 0, tsp = 0, rhp = 0, rsp = 0, hp, sp, i;
int thp = 0, tsp = 0, rhp = 0, rsp = 0, hp=0, sp=0, i;
for (i = 0; i < 4; i++) {
//First two iterations: Right hand
if (i < 2) { wd = &sd->right_weapon; damage = &rdamage; }
@@ -6,6 +6,7 @@

#include "../common/mmo.h"
#include "../config/core.h"
#include "map.h" //ELE_MAX

// state of a single attack attempt; used in flee/def penalty calculations when mobbed
typedef enum damage_lv {
@@ -59,7 +60,7 @@ struct Damage {
};

//(Used in read pc.c,) attribute table (battle_attr_fix)
extern int attr_fix_table[4][10][10];
extern int attr_fix_table[4][ELE_NONE][ELE_NONE];

struct map_session_data;
struct mob_data;
@@ -7,10 +7,10 @@
#include "../common/showmsg.h"
#include "../common/strlib.h"
#include "../common/mmo.h"
#include "map.h"
#include "atcommand.h" // msg_txt()
#include "battle.h" // struct battle_config
#include "clif.h"
#include "map.h"
#include "npc.h" // npc_event_do()
#include "pc.h"
#include "skill.h" // ext_skill_unit_onplace()
@@ -1859,7 +1859,7 @@ int chrif_load_bsdata(int fd) {
struct script_code *script;
struct bonus_script_data *bs = (struct bonus_script_data*)RFIFOP(fd,10 + i*sizeof(struct bonus_script_data));

if (bs->script == '\0' || !(script = parse_script(bs->script,"chrif_load_bsdata",1,1)))
if (bs->script[0] == '\0' || !(script = parse_script(bs->script,"chrif_load_bsdata",1,1)))
continue;

memcpy(sd->bonus_script[i].script_str,bs->script,strlen(bs->script));
@@ -1481,7 +1481,7 @@ static int itemdb_read_sqldb(void) {
* 2 set new value bypassing anything
* 3/other return last value
*------------------------------------------*/
static uint64 itemdb_unique_id(int8 flag, int64 value) {
uint64 itemdb_unique_id(int8 flag, int64 value) {
static uint64 item_uid = 0;

if(flag)
@@ -428,7 +428,7 @@ struct item_data* itemdb_exists(int nameid);
#define itemdb_iscashfood(id) ( (id) >= ITEMID_STR_DISH10_ && (id) <= ITEMID_VIT_DISH10_ )
#define itemdb_is_GNbomb(n) (n >= ITEMID_APPLE_BOMB && n <= ITEMID_VERY_HARD_LUMP)
#define itemdb_is_GNthrowable(n) (n >= ITEMID_MYSTERIOUS_POWDER && n <= ITEMID_BLACK_THING_TO_THROW)
const char* itemdb_typename(int type);
const char* itemdb_typename(enum item_types type);

int itemdb_group_bonus(struct map_session_data* sd, int itemid);
unsigned short itemdb_searchrandomid(int group_id, uint8 sub_group);
@@ -6,10 +6,10 @@
#include "../common/strlib.h"
#include "../common/nullpo.h"
#include "../common/showmsg.h"
#include "map.h"
#include "battle.h"
#include "itemdb.h"
#include "log.h"
#include "map.h"
#include "mob.h"
#include "pc.h"

@@ -280,7 +280,7 @@ enum bl_type {

enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, ITEMSHOP, POINTSHOP, TOMB };

enum {
enum e_race {
RC_FORMLESS=0,
RC_UNDEAD,
RC_BRUTE,
@@ -291,17 +291,19 @@ enum {
RC_DEMIHUMAN,
RC_ANGEL,
RC_DRAGON,
RC_ALL
RC_ALL,
RC_MAX //auto upd enum for array size
};

enum {
enum e_classAE {
CLASS_NORMAL = 0,
CLASS_BOSS,
CLASS_GUARDIAN,
CLASS_ALL
CLASS_ALL,
CLASS_MAX //auto upd enum for array len
};

enum {
enum e_race2 {
RC2_NONE = 0,
RC2_GOBLIN,
RC2_KOBOLD,
@@ -312,7 +314,7 @@ enum {
RC2_MAX
};

enum {
enum e_elemen {
ELE_NEUTRAL=0,
ELE_WATER,
ELE_EARTH,
@@ -68,6 +68,7 @@ enum size {
SZ_MEDIUM,
SZ_BIG,
SZ_ALL,
SZ_MAX
};

struct mob_skill {
@@ -14,6 +14,7 @@
#include "../common/mmo.h" //NAME_LENGTH

#include "atcommand.h" // get_atcommand_level()
#include "map.h"
#include "battle.h" // battle_config
#include "battleground.h"
#include "channel.h"
@@ -26,7 +27,6 @@
#include "itemdb.h"
#include "log.h"
#include "mail.h"
#include "map.h"
#include "path.h"
#include "homunculus.h"
#include "instance.h"
@@ -56,7 +56,7 @@ int pc_split_atoui(char* str, unsigned int* val, char sep, int max);

static unsigned int statp[MAX_LEVEL+1];
#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
static unsigned int level_penalty[3][CLASS_ALL][MAX_LEVEL*2+1];
static unsigned int level_penalty[3][CLASS_MAX][MAX_LEVEL*2+1];
#endif

// h-files are for declarations, not for implementations... [Shinomori]
@@ -9314,36 +9314,35 @@ bool pc_divorce(struct map_session_data *sd)
return true;
}

/*==========================================
* Get sd partner charid. (Married partner)
*------------------------------------------*/
struct map_session_data *pc_get_partner(struct map_session_data *sd)
{
/**
* Get the partner map_session_data of a player
* @param sd : the husband|wife session
* @return partner session or NULL
*/
struct map_session_data *pc_get_partner(struct map_session_data *sd){
if (!sd || !pc_ismarried(sd))
// charid2sd returns NULL if not found
return NULL;
return map_charid2sd(sd->status.partner_id);
}

/*==========================================
* Get sd father charid. (Need to be baby)
*------------------------------------------*/
struct map_session_data *pc_get_father (struct map_session_data *sd)
{
if (!sd || !sd->class_&JOBL_BABY || !sd->status.father)
// charid2sd returns NULL if not found
/**
* Get the father map_session_data of a player
* @param sd : the baby session
* @return father session or NULL
*/
struct map_session_data *pc_get_father (struct map_session_data *sd){
if (!sd || !(sd->class_&JOBL_BABY) || !sd->status.father)
return NULL;

return map_charid2sd(sd->status.father);
}

/*==========================================
* Get sd mother charid. (Need to be baby)
*------------------------------------------*/
struct map_session_data *pc_get_mother (struct map_session_data *sd)
{
if (!sd || sd->class_&JOBL_BABY || !sd->status.mother)
// charid2sd returns NULL if not found
/**
* Get the mother map_session_data of a player
* @param sd : the baby session
* @return mother session or NULL
*/
struct map_session_data *pc_get_mother (struct map_session_data *sd){
if (!sd || !(sd->class_&JOBL_BABY) || !sd->status.mother)
return NULL;
return map_charid2sd(sd->status.mother);
}
@@ -10500,7 +10499,7 @@ void pc_bonus_script_remove(struct map_session_data *sd, uint8 i) {

script_free_code(sd->bonus_script[i].script);
memset(&sd->bonus_script[i].script,0,sizeof(sd->bonus_script[i].script));
*sd->bonus_script[i].script_str = '\0';
sd->bonus_script[i].script_str[0] = '\0';
sd->bonus_script[i].tick = 0;
sd->bonus_script[i].tid = 0;
sd->bonus_script[i].flag = 0;

0 comments on commit b695ab3

Please sign in to comment.