Permalink
Browse files

Merge pull request #2364 from 4144/shortfixes

Change different variables types short to int
  • Loading branch information...
MishimaHaruna committed Feb 11, 2019
2 parents 68126f7 + dbaa9ac commit 2d8a44b753832610d23678629127369f5db576a3
@@ -1098,7 +1098,7 @@ static int char_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf, int
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, sizeof p.char_id, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, sizeof p.slot, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof p.name, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_INT16, &p.class, sizeof p.class, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_INT, &p.class, sizeof p.class, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_INT, &p.base_level, sizeof p.base_level, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_INT, &p.job_level, sizeof p.job_level, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT64, &p.base_exp, sizeof p.base_exp, NULL, NULL)
@@ -1221,7 +1221,7 @@ static int char_mmo_char_fromsql(int char_id, struct mmo_charstatus *p, bool loa
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, sizeof p->account_id, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, sizeof p->slot, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof p->name, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_INT16, &p->class, sizeof p->class, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_INT, &p->class, sizeof p->class, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_INT, &p->base_level, sizeof p->base_level, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_INT, &p->job_level, sizeof p->job_level, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT64, &p->base_exp, sizeof p->base_exp, NULL, NULL)
@@ -1705,7 +1705,7 @@ static int char_check_char_name(const char *name, const char *esc_name)
* -5: 'Symbols in Character Names are forbidden'
* char_id: Success
**/
static int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, int16 starting_class, uint8 sex)
static int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, int starting_class, uint8 sex)
{
char name[NAME_LENGTH];
char esc_name[NAME_LENGTH*2+1];
@@ -149,7 +149,7 @@ struct char_interface {
int (*rename_char_sql) (struct char_session_data *sd, int char_id);
bool (*name_exists) (const char *name, const char *esc_name);
int (*check_char_name) (const char *name, const char *esc_name);
int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, short starting_job, uint8 sex);
int (*make_new_char_sql) (struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, int starting_job, uint8 sex);
int (*divorce_char_sql) (int partner_id1, int partner_id2);
int (*count_users) (void);
int (*mmo_char_tobuf) (uint8* buffer, struct mmo_charstatus* p);
@@ -1060,7 +1060,7 @@ static bool inter_guild_leave(int guild_id, int account_id, int char_id, int fla
}

// Change member info
static bool inter_guild_update_member_info_short(int guild_id, int account_id, int char_id, int online, int lv, int16 class)
static bool inter_guild_update_member_info_short(int guild_id, int account_id, int char_id, int online, int lv, int class)
{
// Could speed up by manipulating only guild_member
struct guild *g;
@@ -1602,7 +1602,7 @@ static int inter_guild_parse_frommap(int fd)
case 0x3032: mapif->parse_GuildAddMember(fd, RFIFOL(fd,4), RFIFOP(fd,8)); break;
case 0x3033: mapif->parse_GuildMasterChange(fd, RFIFOL(fd,4), RFIFOP(fd,8), RFIFOW(fd,2)-8); break;
case 0x3034: mapif->parse_GuildLeave(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOB(fd,14), RFIFOP(fd,15)); break;
case 0x3035: mapif->parse_GuildChangeMemberInfoShort(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),RFIFOW(fd,15),RFIFOW(fd,17)); break;
case 0x3035: mapif->parse_GuildChangeMemberInfoShort(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),RFIFOL(fd,15),RFIFOL(fd,19)); break;
case 0x3036: mapif->parse_BreakGuild(fd,RFIFOL(fd,2)); break;
case 0x3037: mapif->parse_GuildMessage(fd, RFIFOL(fd,4), RFIFOL(fd,8), RFIFOP(fd,12), RFIFOW(fd,2)-12); break;
case 0x3039: mapif->parse_GuildBasicInfoChange(fd, RFIFOL(fd,4), RFIFOW(fd,8), RFIFOP(fd,10), RFIFOW(fd,2)-10); break;
@@ -72,7 +72,7 @@ struct inter_guild_interface {
struct guild *(*create) (const char *name, const struct guild_member *master);
bool (*add_member) (int guild_id, const struct guild_member *member, int map_fd);
bool (*leave) (int guild_id, int account_id, int char_id, int flag, const char *mes, int map_fd);
bool (*update_member_info_short) (int guild_id, int account_id, int char_id, int online, int lv, int16 class);
bool (*update_member_info_short) (int guild_id, int account_id, int char_id, int online, int lv, int class);
bool (*update_member_info) (int guild_id, int account_id, int char_id, int type, const char *data, int len);
bool (*disband) (int guild_id);
bool (*update_basic_info) (int guild_id, int type, const void *data, int len);
@@ -160,7 +160,7 @@ static int inter_pet_delete(int pet_id)
return 0;
}
//------------------------------------------------------
static struct s_pet *inter_pet_create(int account_id, int char_id, short pet_class, short pet_lv, int pet_egg_id,
static struct s_pet *inter_pet_create(int account_id, int char_id, int pet_class, int pet_lv, int pet_egg_id,
int pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name)
{
nullpo_ret(pet_name);
@@ -37,7 +37,7 @@ struct inter_pet_interface {
int (*delete_) (int pet_id);
int (*parse_frommap) (int fd);

struct s_pet *(*create) (int account_id, int char_id, short pet_class, short pet_lv, int pet_egg_id,
struct s_pet *(*create) (int account_id, int char_id, int pet_class, int pet_lv, int pet_egg_id,
int pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name);
struct s_pet *(*load) (int account_id, int char_id, int pet_id);
};
@@ -268,7 +268,7 @@ static bool inter_rodex_hasnew(int char_id, int account_id)
}

/// Checks player name and retrieves some data
static bool inter_rodex_checkname(const char *name, int *target_char_id, short *target_class, int *target_level)
static bool inter_rodex_checkname(const char *name, int *target_char_id, int *target_class, int *target_level)
{
char esc_name[NAME_LENGTH * 2 + 1];
bool found = false;
@@ -286,7 +286,7 @@ static bool inter_rodex_checkname(const char *name, int *target_char_id, short *
if (SQL_SUCCESS == SQL->NextRow(inter->sql_handle)) {
char *data;
SQL->GetData(inter->sql_handle, 0, &data, NULL); *target_char_id = atoi(data);
SQL->GetData(inter->sql_handle, 1, &data, NULL); *target_class = (short)atoi(data);
SQL->GetData(inter->sql_handle, 1, &data, NULL); *target_class = atoi(data);
SQL->GetData(inter->sql_handle, 2, &data, NULL); *target_level = atoi(data);
found = true;
}
@@ -34,7 +34,7 @@ struct inter_rodex_interface {
int (*parse_frommap) (int fd);
int (*fromsql) (int char_id, int account_id, int8 opentype, int64 mail_id, struct rodex_maillist *mails);
bool (*hasnew) (int char_id, int account_id);
bool (*checkname) (const char *name, int *target_char_id, short *target_class, int *target_level);
bool (*checkname) (const char *name, int *target_char_id, int *target_class, int *target_level);
int64 (*savemessage) (struct rodex_message* msg);
bool (*updatemail) (int64 mail_id, int8 flag);
};
@@ -73,12 +73,12 @@ static int inter_recv_packet_length[] = {
-1,-1, 7,-1, -1,13,36, (2 + 4 + 4 + 4 + NAME_LENGTH), 0, 0, 0, 0, 0, 0, 0, 0, // 3000-
6,-1, 6,-1, 0, 0, 0, 0, 10,-1, 0, 0, 0, 0, 0, 0, // 3010- Account Storage, Achievements [Smokexyz]
-1,10,-1,14, 14,19, 6,-1, 14,14, 0, 0, 0, 0, 0, 0, // 3020- Party
-1, 6,-1,-1, 55,19, 6,-1, 14,-1,-1,-1, 18,19,186,-1, // 3030-
-1, 6,-1,-1, 55,23, 6,-1, 14,-1,-1,-1, 18,19,186,-1, // 3030-
-1, 9, 0, 0, 10,10, 0, 0, 7, 6,10,10, 10,-1, 0, 0, // 3040- Clan System(3044-3045)
-1,-1,10,10, 0,-1,12, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3050- Auction System [Zephyrus], Item Bound [Mhalicot]
6,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3060- Quest system [Kevin] [Inkfish]
-1,10, 6,-1, 0, 0, 0, 0, 0, 0, 0, 0, -1,10, 6,-1, // 3070- Mercenary packets [Zephyrus], Elemental packets [pakpil]
52,14,-1, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3080-
56,14,-1, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3080-
-1,10,-1, 6, 0, 20,10,11, -1,6 + NAME_LENGTH, 0, 0, 0, 0, 0, 0, // 3090- Homunculus packets [albator], RoDEX packets
};

@@ -578,9 +578,9 @@ static int mapif_guild_memberinfoshort(struct guild *g, int idx)
WBUFL(buf, 10) = g->member[idx].char_id;
WBUFB(buf, 14) = (unsigned char)g->member[idx].online;
WBUFW(buf, 15) = g->member[idx].lv;
WBUFW(buf, 17) = g->member[idx].class;
WBUFL(buf, 19) = g->member[idx].last_login;
mapif->sendall(buf, 23);
WBUFL(buf, 17) = g->member[idx].class;
WBUFL(buf, 21) = g->member[idx].last_login;
mapif->sendall(buf, 25);
return 0;
}

@@ -797,7 +797,7 @@ static int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char
}

// Change member info
static int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int16 class)
static int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int class)
{
inter_guild->update_member_info_short(guild_id, account_id, char_id, online, lv, class);
return 0;
@@ -1427,14 +1427,14 @@ static int mapif_pet_created(int fd, int account_id, struct s_pet *p)
WFIFOW(fd, 0) = 0x3880;
WFIFOL(fd, 2) = account_id;
if (p != NULL){
WFIFOW(fd, 6) = p->class_;
WFIFOL(fd, 8) = p->pet_id;
WFIFOL(fd, 6) = p->class_;
WFIFOL(fd, 10) = p->pet_id;
ShowInfo("int_pet: created pet %d - %s\n", p->pet_id, p->name);
} else {
WFIFOB(fd, 6) = 0;
WFIFOL(fd, 8) = 0;
WFIFOL(fd, 6) = 0;
WFIFOL(fd, 10) = 0;
}
WFIFOSET(fd, 12);
WFIFOSET(fd, 14);

return 0;
}
@@ -1521,15 +1521,15 @@ static int mapif_parse_CreatePet(int fd)
account_id = RFIFOL(fd, 2);
pet = inter_pet->create(account_id,
RFIFOL(fd, 6),
RFIFOW(fd, 10),
RFIFOW(fd, 12),
RFIFOL(fd, 10),
RFIFOL(fd, 14),
RFIFOL(fd, 18),
RFIFOW(fd, 22),
RFIFOW(fd, 24),
RFIFOB(fd, 26),
RFIFOB(fd, 27),
RFIFOP(fd, 28));
RFIFOL(fd, 22),
RFIFOW(fd, 26),
RFIFOW(fd, 28),
RFIFOB(fd, 30),
RFIFOB(fd, 31),
RFIFOP(fd, 32));

if (pet != NULL)
mapif->pet_created(fd, account_id, pet);
@@ -1789,7 +1789,7 @@ static void mapif_parse_rodex_checkname(int fd)
int reqchar_id = RFIFOL(fd, 2);
char name[NAME_LENGTH];
int target_char_id, target_level;
short target_class;
int target_class;

safestrncpy(name, RFIFOP(fd, 6), NAME_LENGTH);

@@ -1799,7 +1799,7 @@ static void mapif_parse_rodex_checkname(int fd)
mapif->rodex_checkname(fd, reqchar_id, 0, 0, 0, name);
}

static void mapif_rodex_checkname(int fd, int reqchar_id, int target_char_id, short target_class, int target_level, char *name)
static void mapif_rodex_checkname(int fd, int reqchar_id, int target_char_id, int target_class, int target_level, char *name)
{
nullpo_retv(name);
Assert_retv(reqchar_id > 0);
@@ -1809,10 +1809,10 @@ static void mapif_rodex_checkname(int fd, int reqchar_id, int target_char_id, sh
WFIFOW(fd, 0) = 0x3898;
WFIFOL(fd, 2) = reqchar_id;
WFIFOL(fd, 6) = target_char_id;
WFIFOW(fd, 10) = target_class;
WFIFOL(fd, 12) = target_level;
safestrncpy(WFIFOP(fd, 16), name, NAME_LENGTH);
WFIFOSET(fd, 16 + NAME_LENGTH);
WFIFOL(fd, 10) = target_class;
WFIFOL(fd, 14) = target_level;
safestrncpy(WFIFOP(fd, 18), name, NAME_LENGTH);
WFIFOSET(fd, 18 + NAME_LENGTH);
}

static int mapif_load_guild_storage(int fd, int account_id, int guild_id, char flag)
@@ -84,7 +84,7 @@ struct mapif_interface {
int (*parse_GuildInfo) (int fd, int guild_id);
int (*parse_GuildAddMember) (int fd, int guild_id, const struct guild_member *m);
int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes);
int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int16 class);
int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class);
int (*parse_BreakGuild) (int fd, int guild_id);
int (*parse_GuildMessage) (int fd, int guild_id, int account_id, const char *mes, int len);
int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len);
@@ -167,7 +167,7 @@ struct mapif_interface {
void (*parse_rodex_send) (int fd);
void (*rodex_send) (int fd, int sender_id, int receiver_id, int receiver_accountid, bool result);
void (*parse_rodex_checkname) (int fd);
void (*rodex_checkname) (int fd, int reqchar_id, int target_char_id, short target_class, int target_level, char *name);
void (*rodex_checkname) (int fd, int reqchar_id, int target_char_id, int target_class, int target_level, char *name);
int (*load_guild_storage) (int fd, int account_id, int guild_id, char flag);
int (*save_guild_storage_ack) (int fd, int account_id, int guild_id, int fail);
int (*parse_LoadGuildStorage) (int fd);
@@ -590,7 +590,7 @@ struct s_pet {
int account_id;
int char_id;
int pet_id;
short class_;
int class_;
short level;
int egg_id;//pet egg id
int equip;//pet equip name_id
@@ -606,8 +606,8 @@ struct s_homunculus { //[orn]
char name[NAME_LENGTH];
int hom_id;
int char_id;
short class_;
short prev_class;
int class_;
int prev_class;
int hp,max_hp,sp,max_sp;
unsigned int intimacy;
short hunger;
@@ -638,7 +638,7 @@ struct s_homunculus { //[orn]
struct s_mercenary {
int mercenary_id;
int char_id;
short class_;
int class_;
int hp, sp;
unsigned int kill_count;
unsigned int life_time;
@@ -647,7 +647,7 @@ struct s_mercenary {
struct s_elemental {
int elemental_id;
int char_id;
short class_;
int class_;
uint32 mode;
int hp, sp, max_hp, max_sp, matk, atk, atk2;
short hit, flee, amotion, def, mdef;
@@ -690,7 +690,7 @@ struct mmo_charstatus {
int zeny;
int bank_vault;

int16 class;
int class;
int status_point, skill_point;
int hp,max_hp,sp,max_sp;
unsigned int option;
@@ -805,7 +805,7 @@ struct party_member {
int account_id;
int char_id;
char name[NAME_LENGTH];
int16 class;
int class;
unsigned short map;
unsigned short lv;
unsigned leader : 1,
@@ -825,7 +825,7 @@ struct map_session_data;
struct guild_member {
int account_id, char_id;
short hair,hair_color,gender;
int16 class;
int class;
short lv;
uint64 exp;
int exp_payper;
@@ -2718,7 +2718,7 @@ ACMD(makeegg)
sd->catch_target_class = pet->db[pet_id].class_;
intif->create_pet(
sd->status.account_id, sd->status.char_id,
(short)pet->db[pet_id].class_, (short)mob->db(pet->db[pet_id].class_)->lv,
pet->db[pet_id].class_, mob->db(pet->db[pet_id].class_)->lv,
pet->db[pet_id].EggID, 0, (short)pet->db[pet_id].intimate,
100, 0, 1, pet->db[pet_id].jname);
} else {
@@ -1019,7 +1019,7 @@ static int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct
{
struct map_session_data *sd, *tsd;
int cardfix = 1000;
short t_class, s_class, s_race2, t_race2;
int t_class, s_class, s_race2, t_race2;
struct status_data *sstatus, *tstatus;
int i;

@@ -5552,7 +5552,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src, struct bl
#endif

if( flag.infdef ) { //Plants receive 1 damage when hit
short class_ = status->get_class(target);
int class_ = status->get_class(target);
if( flag.hit || wd.damage > 0 )
wd.damage = wd.div_; // In some cases, right hand no need to have a weapon to increase damage
if( flag.lh && (flag.hit || wd.damage2 > 0) )
@@ -14516,7 +14516,7 @@ static void clif_parse_pet_evolution(int fd, struct map_session_data *sd)

intif->create_pet(
sd->status.account_id, sd->status.char_id,
(short)pet->db[pet_id].class_, (short)mob->db(pet->db[pet_id].class_)->lv,
pet->db[pet_id].class_, mob->db(pet->db[pet_id].class_)->lv,
pet->db[pet_id].EggID, 0, (short)pet->db[pet_id].intimate,
100, 0, 1, pet->db[pet_id].jname);
clif->petEvolutionResult(fd, PET_EVOL_SUCCESS);
{
const struct PACKET_CZ_CHECKNAME *rPacket = RFIFOP(fd, 0);
int char_id = 0, base_level = 0;
short class = 0;
int class = 0;
char name[NAME_LENGTH];

safestrncpy(name, rPacket->Name, NAME_LENGTH);

rodex->check_player(sd, name, &base_level, &char_id, &class);
}

static void clif_rodex_checkname_result(struct map_session_data *sd, int char_id, short class_, int base_level, const char *name)
static void clif_rodex_checkname_result(struct map_session_data *sd, int char_id, int class_, int base_level, const char *name)
{
#if PACKETVER >= 20140521
struct PACKET_ZC_CHECKNAME *sPacket;
@@ -1543,7 +1543,7 @@ struct clif_interface {
void (*pRodexCancelWriteMail) (int fd, struct map_session_data *sd);
void (*pRodexOpenMailbox) (int fd, struct map_session_data *sd);
void (*pRodexCheckName) (int fd, struct map_session_data *sd);
void (*rodex_checkname_result) (struct map_session_data *sd, int char_id, short class_, int base_level, const char *name);
void (*rodex_checkname_result) (struct map_session_data *sd, int char_id, int class_, int base_level, const char *name);
void (*pRodexDeleteMail) (int fd, struct map_session_data *sd);
void (*rodex_delete_mail) (struct map_session_data *sd, int8 opentype, int64 mail_id);
void (*pRodexRefreshMaillist) (int fd, struct map_session_data *sd);
@@ -1018,7 +1018,7 @@ static int guild_send_memberinfoshort(struct map_session_data *sd, int online)
}

// cleaned up [LuzZza]
static int guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int16 class, uint32 last_login)
static int guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int class, uint32 last_login)
{
int i, alv, c, idx = INDEX_NOT_FOUND, om = 0, oldonline = -1;
struct guild *g = guild->search(guild_id);
@@ -126,7 +126,7 @@ struct guild_interface {
int (*check_alliance) (int guild_id1, int guild_id2, int flag);
/* */
int (*send_memberinfoshort) (struct map_session_data *sd,int online);
int (*recv_memberinfoshort) (int guild_id, int account_id, int char_id, int online, int lv, int16 class, uint32 last_login);
int (*recv_memberinfoshort) (int guild_id, int account_id, int char_id, int online, int lv, int class, uint32 last_login);
int (*change_memberposition) (int guild_id,int account_id,int char_id,short idx);
int (*memberposition_changed) (struct guild *g,int idx,int pos);
int (*change_position) (int guild_id,int idx,int mode,int exp_mode,const char *name);
@@ -411,7 +411,7 @@ static bool homunculus_levelup(struct homun_data *hd)
return true;
}

static int homunculus_change_class(struct homun_data *hd, short class_)
static int homunculus_change_class(struct homun_data *hd, int class_)
{
int i = homun->db_search(class_,HOMUNCULUS_CLASS);
nullpo_retr(0, hd);
Oops, something went wrong.

0 comments on commit 2d8a44b

Please sign in to comment.