Some more pointer casts and enum fixes.
This commit is contained in:
parent
a760e01c59
commit
a597e7bd34
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,6 +12,7 @@ Thumbs.db
|
||||
# /
|
||||
/*_fifo
|
||||
/*.exe
|
||||
/*.exe.*
|
||||
/*.ilk
|
||||
/*.log
|
||||
/*.ncb
|
||||
|
@ -282,7 +282,7 @@ int char_mmo_char_tosql(uint32 char_id, struct mmo_charstatus* p){
|
||||
|
||||
if (char_id!=p->char_id) return 0;
|
||||
|
||||
cp = idb_ensure(char_db_, char_id, char_create_charstatus);
|
||||
cp = (struct mmo_charstatus *)idb_ensure(char_db_, char_id, char_create_charstatus);
|
||||
|
||||
StringBuf_Init(&buf);
|
||||
memset(save_status, 0, sizeof(save_status));
|
||||
@ -1283,7 +1283,7 @@ int char_mmo_char_fromsql(uint32 char_id, struct mmo_charstatus* p, bool load_ev
|
||||
SqlStmt_Free(stmt);
|
||||
StringBuf_Destroy(&buf);
|
||||
|
||||
cp = idb_ensure(char_db_, char_id, char_create_charstatus);
|
||||
cp = (struct mmo_charstatus *)idb_ensure(char_db_, char_id, char_create_charstatus);
|
||||
memcpy(cp, p, sizeof(struct mmo_charstatus));
|
||||
StringBuf_Destroy(&msg_buf);
|
||||
return 1;
|
||||
@ -2121,7 +2121,7 @@ int char_chardb_waiting_disconnect(int tid, unsigned int tick, int id, intptr_t
|
||||
*/
|
||||
static int char_online_data_cleanup_sub(DBKey key, DBData *data, va_list ap)
|
||||
{
|
||||
struct online_char_data *character= db_data2ptr(data);
|
||||
struct online_char_data *character= (struct online_char_data *)db_data2ptr(data);
|
||||
if (character->fd != -1)
|
||||
return 0; //Character still connected
|
||||
if (character->server == -2) //Unknown server.. set them offline
|
||||
|
@ -82,7 +82,7 @@ void chlogif_pincode_start(int fd, struct char_session_data* sd){
|
||||
* @see DBApply
|
||||
*/
|
||||
static int chlogif_send_acc_tologin_sub(DBKey key, DBData *data, va_list ap) {
|
||||
struct online_char_data* character = db_data2ptr(data);
|
||||
struct online_char_data* character = (struct online_char_data*)db_data2ptr(data);
|
||||
int* i = va_arg(ap, int*);
|
||||
if(character->server > -1) {
|
||||
WFIFOL(login_fd,8+(*i)*4) = character->account_id;
|
||||
|
@ -361,7 +361,7 @@ int chmapif_parse_regmapuser(int fd, int id){
|
||||
for(i = 0; i < map_server[id].users; i++) {
|
||||
int aid = RFIFOL(fd,6+i*8);
|
||||
int cid = RFIFOL(fd,6+i*8+4);
|
||||
struct online_char_data* character = idb_ensure(online_char_db, aid, char_create_online_data);
|
||||
struct online_char_data* character = (struct online_char_data*)idb_ensure(online_char_db, aid, char_create_online_data);
|
||||
if( character->server > -1 && character->server != id )
|
||||
{
|
||||
ShowNotice("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n",
|
||||
@ -638,7 +638,7 @@ int chmapif_parse_reqchangemapserv(int fd){
|
||||
node->changing_mapservers = 1;
|
||||
idb_put(auth_db, aid, node);
|
||||
|
||||
data = idb_ensure(online_char_db, aid, char_create_online_data);
|
||||
data = (struct online_char_data*)idb_ensure(online_char_db, aid, char_create_online_data);
|
||||
data->char_id = char_data->char_id;
|
||||
data->server = map_id; //Update server where char is.
|
||||
|
||||
|
@ -30,7 +30,7 @@ static int auction_count(int char_id, bool buy)
|
||||
struct auction_data *auction;
|
||||
DBIterator *iter = db_iterator(auction_db_);
|
||||
|
||||
for( auction = dbi_first(iter); dbi_exists(iter); auction = dbi_next(iter) )
|
||||
for( auction = (struct auction_data *)dbi_first(iter); dbi_exists(iter); auction = (struct auction_data *)dbi_next(iter) )
|
||||
{
|
||||
if( (buy && auction->buyer_id == char_id) || (!buy && auction->seller_id == char_id) )
|
||||
i++;
|
||||
|
@ -54,7 +54,7 @@ static int guild_save_timer(int tid, unsigned int tick, int id, intptr_t data)
|
||||
if( last_id == 0 ) //Save the first guild in the list.
|
||||
state = 1;
|
||||
|
||||
for( g = db_data2ptr(iter->first(iter, &key)); dbi_exists(iter); g = db_data2ptr(iter->next(iter, &key)) )
|
||||
for( g = (struct guild*)db_data2ptr(iter->first(iter, &key)); dbi_exists(iter); g = (struct guild*)db_data2ptr(iter->next(iter, &key)) )
|
||||
{
|
||||
if( state == 0 && g->guild_id == last_id )
|
||||
state++; //Save next guild in the list.
|
||||
@ -547,7 +547,7 @@ static struct guild_castle* inter_guildcastle_fromsql(int castle_id)
|
||||
char *data;
|
||||
int i;
|
||||
StringBuf buf;
|
||||
struct guild_castle *gc = idb_get(castle_db, castle_id);
|
||||
struct guild_castle *gc = (struct guild_castle *)idb_get(castle_db, castle_id);
|
||||
|
||||
if (gc != NULL)
|
||||
return gc;
|
||||
@ -737,7 +737,7 @@ int inter_guild_sql_init(void)
|
||||
*/
|
||||
static int guild_db_final(DBKey key, DBData *data, va_list ap)
|
||||
{
|
||||
struct guild *g = db_data2ptr(data);
|
||||
struct guild *g = (struct guild*)db_data2ptr(data);
|
||||
if (g->save_flag&GS_MASK) {
|
||||
inter_guild_tosql(g, g->save_flag&GS_MASK);
|
||||
return 1;
|
||||
@ -1771,7 +1771,7 @@ int mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value)
|
||||
case 1:
|
||||
if (charserv_config.log_inter && gc->guild_id != value) {
|
||||
int gid = (value) ? value : gc->guild_id;
|
||||
struct guild *g = idb_get(guild_db_, gid);
|
||||
struct guild *g = (struct guild*)idb_get(guild_db_, gid);
|
||||
inter_log("guild %s (id=%d) %s castle id=%d\n",
|
||||
(g) ? g->name : "??", gid, (value) ? "occupy" : "abandon", castle_id);
|
||||
}
|
||||
|
@ -750,7 +750,7 @@ int mapif_parse_PartyShareLevel(int fd,unsigned int share_lvl)
|
||||
|
||||
party_share_level = share_lvl;
|
||||
|
||||
for(p = dbi_first(iter); dbi_exists(iter); p = dbi_next(iter)) { //Update online parties
|
||||
for(p = (struct party_data *)dbi_first(iter); dbi_exists(iter); p = (struct party_data *)dbi_next(iter)) { //Update online parties
|
||||
if(p->party.count > 1)
|
||||
int_party_calc_state(p);
|
||||
}
|
||||
|
@ -944,7 +944,7 @@ int mapif_disconnectplayer(int fd, uint32 account_id, uint32 char_id, int reason
|
||||
int check_ttl_wisdata_sub(DBKey key, DBData *data, va_list ap)
|
||||
{
|
||||
unsigned long tick;
|
||||
struct WisData *wd = db_data2ptr(data);
|
||||
struct WisData *wd = (struct WisData *)db_data2ptr(data);
|
||||
tick = va_arg(ap, unsigned long);
|
||||
|
||||
if (DIFF_TICK(tick, wd->tick) > WISDATA_TTL && wis_delnum < WISDELLIST_MAX)
|
||||
|
@ -92,7 +92,7 @@ DBData login_create_online_user(DBKey key, va_list args) {
|
||||
*/
|
||||
struct online_login_data* login_add_online_user(int char_server, uint32 account_id){
|
||||
struct online_login_data* p;
|
||||
p = idb_ensure(online_db, account_id, login_create_online_user);
|
||||
p = (struct online_login_data*)idb_ensure(online_db, account_id, login_create_online_user);
|
||||
p->char_server = char_server;
|
||||
if( p->waiting_disconnect != INVALID_TIMER ) {
|
||||
delete_timer(p->waiting_disconnect, login_waiting_disconnect_timer);
|
||||
@ -148,7 +148,7 @@ int login_waiting_disconnect_timer(int tid, unsigned int tick, int id, intptr_t
|
||||
* @see DBApply
|
||||
*/
|
||||
int login_online_db_setoffline(DBKey key, DBData *data, va_list ap) {
|
||||
struct online_login_data* p = db_data2ptr(data);
|
||||
struct online_login_data* p = (struct online_login_data*)db_data2ptr(data);
|
||||
int server = va_arg(ap, int);
|
||||
if( server == -1 ) {
|
||||
p->char_server = -1;
|
||||
@ -171,7 +171,7 @@ int login_online_db_setoffline(DBKey key, DBData *data, va_list ap) {
|
||||
* @see DBApply
|
||||
*/
|
||||
static int login_online_data_cleanup_sub(DBKey key, DBData *data, va_list ap) {
|
||||
struct online_login_data *character= db_data2ptr(data);
|
||||
struct online_login_data *character= (struct online_login_data*)db_data2ptr(data);
|
||||
if (character->char_server == -2) //Unknown server.. set them offline
|
||||
login_remove_online_user(character->account_id);
|
||||
return 0;
|
||||
|
@ -535,7 +535,7 @@ int logchrif_parse_updonlinedb(int fd, int id){
|
||||
users = RFIFOW(fd,4);
|
||||
for (i = 0; i < users; i++) {
|
||||
int aid = RFIFOL(fd,6+i*4);
|
||||
struct online_login_data *p = idb_ensure(online_db, aid, login_create_online_user);
|
||||
struct online_login_data *p = (struct online_login_data*)idb_ensure(online_db, aid, login_create_online_user);
|
||||
p->char_server = id;
|
||||
if (p->waiting_disconnect != INVALID_TIMER){
|
||||
delete_timer(p->waiting_disconnect, login_waiting_disconnect_timer);
|
||||
|
@ -1550,7 +1550,7 @@ ACMD_FUNC(help)
|
||||
StringBuf_AppendStr(&buf, msg_txt(sd,990)); // Available aliases:
|
||||
command_info = get_atcommandinfo_byname(command_name);
|
||||
iter = db_iterator(atcommand_alias_db);
|
||||
for (alias_info = dbi_first(iter); dbi_exists(iter); alias_info = dbi_next(iter)) {
|
||||
for (alias_info = (AliasInfo *)dbi_first(iter); dbi_exists(iter); alias_info = (AliasInfo *)dbi_next(iter)) {
|
||||
if (alias_info->command == command_info) {
|
||||
StringBuf_Printf(&buf, " %s", alias_info->alias);
|
||||
has_aliases = true;
|
||||
@ -8828,7 +8828,7 @@ static void atcommand_commands_sub(struct map_session_data* sd, const int fd, At
|
||||
|
||||
clif_displaymessage(fd, msg_txt(sd,273)); // "Commands available:"
|
||||
|
||||
for (cmd = dbi_first(iter); dbi_exists(iter); cmd = dbi_next(iter)) {
|
||||
for (cmd = (AtCommandInfo*)dbi_first(iter); dbi_exists(iter); cmd = (AtCommandInfo*)dbi_next(iter)) {
|
||||
unsigned int slen = 0;
|
||||
|
||||
switch( type ) {
|
||||
@ -10084,7 +10084,7 @@ static void atcommand_get_suggestions(struct map_session_data* sd, const char *n
|
||||
alias_iter = db_iterator(atcommand_alias_db);
|
||||
|
||||
// Build the matches
|
||||
for (command_info = dbi_first(atcommand_iter); dbi_exists(atcommand_iter); command_info = dbi_next(atcommand_iter)) {
|
||||
for (command_info = (AtCommandInfo*)dbi_first(atcommand_iter); dbi_exists(atcommand_iter); command_info = (AtCommandInfo*)dbi_next(atcommand_iter)) {
|
||||
match = strstr(command_info->command, name);
|
||||
can_use = pc_can_use_command(sd, command_info->command, type);
|
||||
if ( prefix_count < MAX_SUGGESTIONS && match == command_info->command && can_use ) {
|
||||
@ -10097,7 +10097,7 @@ static void atcommand_get_suggestions(struct map_session_data* sd, const char *n
|
||||
}
|
||||
}
|
||||
|
||||
for (alias_info = dbi_first(alias_iter); dbi_exists(alias_iter); alias_info = dbi_next(alias_iter)) {
|
||||
for (alias_info = (AliasInfo *)dbi_first(alias_iter); dbi_exists(alias_iter); alias_info = (AliasInfo *)dbi_next(alias_iter)) {
|
||||
match = strstr(alias_info->alias, name);
|
||||
can_use = pc_can_use_command(sd, alias_info->command->command, type);
|
||||
if ( prefix_count < MAX_SUGGESTIONS && match == alias_info->alias && can_use) {
|
||||
@ -10437,9 +10437,9 @@ void atcommand_db_load_groups(int* group_ids) {
|
||||
AtCommandInfo* cmd;
|
||||
int i;
|
||||
|
||||
for (cmd = dbi_first(iter); dbi_exists(iter); cmd = dbi_next(iter)) {
|
||||
cmd->at_groups = aMalloc( pc_group_max * sizeof(char) );
|
||||
cmd->char_groups = aMalloc( pc_group_max * sizeof(char) );
|
||||
for (cmd = (AtCommandInfo*)dbi_first(iter); dbi_exists(iter); cmd = (AtCommandInfo*)dbi_next(iter)) {
|
||||
cmd->at_groups = (char*)aMalloc( pc_group_max * sizeof(char) );
|
||||
cmd->char_groups = (char*)aMalloc( pc_group_max * sizeof(char) );
|
||||
for(i = 0; i < pc_group_max; i++) {
|
||||
if( pc_group_can_use_command(group_ids[i], cmd->command, COMMAND_ATCOMMAND ) )
|
||||
cmd->at_groups[i] = 1;
|
||||
@ -10462,7 +10462,7 @@ void atcommand_db_clear(void) {
|
||||
DBIterator *iter = db_iterator(atcommand_db);
|
||||
AtCommandInfo* cmd;
|
||||
|
||||
for (cmd = dbi_first(iter); dbi_exists(iter); cmd = dbi_next(iter)) {
|
||||
for (cmd = (AtCommandInfo*)dbi_first(iter); dbi_exists(iter); cmd = (AtCommandInfo*)dbi_next(iter)) {
|
||||
aFree(cmd->at_groups);
|
||||
aFree(cmd->char_groups);
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ int bg_send_message(struct map_session_data *sd, const char *mes, int len)
|
||||
*/
|
||||
int bg_send_xy_timer_sub(DBKey key, DBData *data, va_list ap)
|
||||
{
|
||||
struct battleground_data *bg = db_data2ptr(data);
|
||||
struct battleground_data *bg = (struct battleground_data *)db_data2ptr(data);
|
||||
struct map_session_data *sd;
|
||||
int i;
|
||||
|
||||
|
@ -586,7 +586,7 @@ void buyingstore_reopen( struct map_session_data* sd ){
|
||||
nullpo_retv(sd);
|
||||
|
||||
// Ready to open buyingstore for this char
|
||||
if ((at = uidb_get(buyingstore_autotrader_db, sd->status.char_id)) && at->count && at->entries) {
|
||||
if ((at = (struct s_autotrader *)uidb_get(buyingstore_autotrader_db, sd->status.char_id)) && at->count && at->entries) {
|
||||
uint8 *data, *p;
|
||||
uint16 j, count;
|
||||
|
||||
@ -704,7 +704,7 @@ void do_init_buyingstore_autotrade( void ) {
|
||||
|
||||
// Init items for each autotraders
|
||||
iter = db_iterator(buyingstore_autotrader_db);
|
||||
for (at = dbi_first(iter); dbi_exists(iter); at = dbi_next(iter)) {
|
||||
for (at = (struct s_autotrader *)dbi_first(iter); dbi_exists(iter); at = (struct s_autotrader *)dbi_next(iter)) {
|
||||
uint16 j = 0;
|
||||
|
||||
if (SQL_ERROR == Sql_Query(mmysql_handle,
|
||||
@ -779,7 +779,7 @@ static void buyingstore_autotrader_remove(struct s_autotrader *at, bool remove)
|
||||
* @author [Cydh]
|
||||
*/
|
||||
static int buyingstore_autotrader_free(DBKey key, DBData *data, va_list ap) {
|
||||
struct s_autotrader *at = db_data2ptr(data);
|
||||
struct s_autotrader *at = (struct s_autotrader *)db_data2ptr(data);
|
||||
if (at)
|
||||
buyingstore_autotrader_remove(at, false);
|
||||
return 0;
|
||||
|
@ -79,7 +79,7 @@ int channel_delete(struct Channel *channel) {
|
||||
if( db_size(channel->users)) {
|
||||
struct map_session_data *sd;
|
||||
DBIterator *iter = db_iterator(channel->users);
|
||||
for( sd = dbi_first(iter); dbi_exists(iter); sd = dbi_next(iter) ) { //for all users
|
||||
for( sd = (struct map_session_data *)dbi_first(iter); dbi_exists(iter); sd = (struct map_session_data *)dbi_next(iter) ) { //for all users
|
||||
channel_clean(channel,sd,1); //make all quit
|
||||
}
|
||||
dbi_destroy(iter);
|
||||
@ -525,7 +525,7 @@ int channel_display_list(struct map_session_data *sd, char *options){
|
||||
}
|
||||
}
|
||||
iter = db_iterator(channel_db);
|
||||
for(channel = dbi_first(iter); dbi_exists(iter); channel = dbi_next(iter)) {
|
||||
for(channel = (struct Channel *)dbi_first(iter); dbi_exists(iter); channel = (struct Channel *)dbi_next(iter)) {
|
||||
if( has_perm || channel->type == CHAN_TYPE_PUBLIC ) {
|
||||
sprintf(output, msg_txt(sd,1409), channel->name, db_size(channel->users));// - #%s (%d users)
|
||||
clif_displaymessage(sd->fd, output);
|
||||
@ -890,7 +890,7 @@ int channel_pcban(struct map_session_data *sd, char *chname, char *pname, int fl
|
||||
struct chan_banentry *cbe;
|
||||
sprintf(output, msg_txt(sd,1443), channel->name);// ---- '#%s' Ban List:
|
||||
clif_displaymessage(sd->fd, output);
|
||||
for( cbe = dbi_first(iter); dbi_exists(iter); cbe = dbi_next(iter) ) { //for all users
|
||||
for( cbe = (struct chan_banentry *)dbi_first(iter); dbi_exists(iter); cbe = (struct chan_banentry *)dbi_next(iter) ) { //for all users
|
||||
sprintf(output, "%d: %s",cbe->char_id,cbe->char_name);
|
||||
clif_displaymessage(sd->fd, output);
|
||||
}
|
||||
@ -1159,7 +1159,7 @@ void do_final_channel(void) {
|
||||
|
||||
//delete all in remaining chan db
|
||||
iter = db_iterator(channel_db);
|
||||
for( channel = dbi_first(iter); dbi_exists(iter); channel = dbi_next(iter) ) {
|
||||
for( channel = (struct Channel *)dbi_first(iter); dbi_exists(iter); channel = (struct Channel *)dbi_next(iter) ) {
|
||||
channel_delete(channel);
|
||||
}
|
||||
dbi_destroy(iter);
|
||||
|
@ -511,7 +511,7 @@ int chrif_connectack(int fd) {
|
||||
* @see DBApply
|
||||
*/
|
||||
static int chrif_reconnect(DBKey key, DBData *data, va_list ap) {
|
||||
struct auth_node *node = db_data2ptr(data);
|
||||
struct auth_node *node = (struct auth_node *)db_data2ptr(data);
|
||||
|
||||
switch (node->state) {
|
||||
case ST_LOGIN:
|
||||
@ -749,7 +749,7 @@ void chrif_authfail(int fd) {/* HELLO WORLD. ip in RFIFOL 15 is not being used (
|
||||
* @see DBApply
|
||||
*/
|
||||
int auth_db_cleanup_sub(DBKey key, DBData *data, va_list ap) {
|
||||
struct auth_node *node = db_data2ptr(data);
|
||||
struct auth_node *node = (struct auth_node *)db_data2ptr(data);
|
||||
|
||||
if(DIFF_TICK(gettick(),node->node_created)>60000) {
|
||||
const char* states[] = { "Login", "Logout", "Map change" };
|
||||
@ -1935,7 +1935,7 @@ int chrif_send_report(char* buf, int len) {
|
||||
* @see DBApply
|
||||
*/
|
||||
int auth_db_final(DBKey key, DBData *data, va_list ap) {
|
||||
struct auth_node *node = db_data2ptr(data);
|
||||
struct auth_node *node = (struct auth_node *)db_data2ptr(data);
|
||||
|
||||
if (node->char_dat)
|
||||
aFree(node->char_dat);
|
||||
|
@ -5884,7 +5884,7 @@ void clif_channel_msg(struct Channel *channel, struct map_session_data *sd, char
|
||||
safestrncpy((char*)WFIFOP(sd->fd,12), msg, msg_len);
|
||||
|
||||
iter = db_iterator(channel->users);
|
||||
for( user = dbi_first(iter); dbi_exists(iter); user = dbi_next(iter) ) {
|
||||
for( user = (struct map_session_data *)dbi_first(iter); dbi_exists(iter); user = (struct map_session_data *)dbi_next(iter) ) {
|
||||
if( user->fd == sd->fd )
|
||||
continue;
|
||||
WFIFOHEAD(user->fd,msg_len + 12);
|
||||
@ -6108,7 +6108,7 @@ void clif_wis_message(int fd, const char* nick, const char* mes, int mes_len)
|
||||
/// 3 = everyone ignored by target
|
||||
void clif_wis_end(int fd, int result)
|
||||
{
|
||||
struct map_session_data *sd = (session_isValid(fd) ? session[fd]->session_data : NULL);
|
||||
struct map_session_data *sd = (session_isValid(fd) ? (struct map_session_data *)session[fd]->session_data : NULL);
|
||||
|
||||
if (!sd)
|
||||
return;
|
||||
@ -17203,7 +17203,7 @@ void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) {
|
||||
return;
|
||||
|
||||
if( pc_istrading(sd) ) {
|
||||
clif_skill_fail(sd,sd->ud.skill_id,0,0);
|
||||
clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0);
|
||||
clif_menuskill_clear(sd);
|
||||
return;
|
||||
}
|
||||
|
@ -191,12 +191,12 @@ int elemental_delete(struct elemental_data *ed, int reply) {
|
||||
elemental_summon_stop(ed);
|
||||
|
||||
if( !sd )
|
||||
return unit_free(&ed->bl, 0);
|
||||
return unit_free(&ed->bl, CLR_OUTSIGHT);
|
||||
|
||||
sd->ed = NULL;
|
||||
sd->status.ele_id = 0;
|
||||
|
||||
return unit_remove_map(&ed->bl, 0);
|
||||
return unit_remove_map(&ed->bl, CLR_OUTSIGHT);
|
||||
}
|
||||
|
||||
void elemental_summon_init(struct elemental_data *ed) {
|
||||
|
@ -186,7 +186,7 @@ struct guild* guild_searchname(char* str) {
|
||||
struct guild* g;
|
||||
DBIterator *iter = db_iterator(guild_db);
|
||||
|
||||
for( g = dbi_first(iter); dbi_exists(iter); g = dbi_next(iter) ) {
|
||||
for( g = (struct guild*)dbi_first(iter); dbi_exists(iter); g = (struct guild*)dbi_next(iter) ) {
|
||||
if( strcmpi(g->name, str) == 0 )
|
||||
break;
|
||||
}
|
||||
@ -205,7 +205,7 @@ struct guild_castle* guild_mapindex2gc(short mapindex) {
|
||||
struct guild_castle* gc;
|
||||
DBIterator *iter = db_iterator(castle_db);
|
||||
|
||||
for( gc = dbi_first(iter); dbi_exists(iter); gc = dbi_next(iter) ) {
|
||||
for( gc = (struct guild_castle*)dbi_first(iter); dbi_exists(iter); gc = (struct guild_castle*)dbi_next(iter) ) {
|
||||
if( gc->mapindex == mapindex )
|
||||
break;
|
||||
}
|
||||
@ -279,7 +279,7 @@ int guild_payexp_timer_sub(DBKey key, DBData *data, va_list ap) {
|
||||
struct guild_expcache *c;
|
||||
struct guild *g;
|
||||
|
||||
c = db_data2ptr(data);
|
||||
c = (struct guild_expcache *)db_data2ptr(data);
|
||||
|
||||
if (
|
||||
(g = guild_search(c->guild_id)) == NULL ||
|
||||
@ -312,7 +312,7 @@ int guild_payexp_timer(int tid, unsigned int tick, int id, intptr_t data) {
|
||||
* @see DBApply
|
||||
*/
|
||||
int guild_send_xy_timer_sub(DBKey key, DBData *data, va_list ap) {
|
||||
struct guild *g = db_data2ptr(data);
|
||||
struct guild *g = (struct guild *)db_data2ptr(data);
|
||||
int i;
|
||||
|
||||
nullpo_ret(g);
|
||||
@ -413,7 +413,7 @@ int guild_npc_request_info(int guild_id,const char *event) {
|
||||
memcpy(ev->name,event,strlen(event));
|
||||
//The one in the db (if present) becomes the next event from this.
|
||||
if (guild_infoevent_db->put(guild_infoevent_db, db_i2key(guild_id), db_ptr2data(ev), &prev))
|
||||
ev->next = db_data2ptr(&prev);
|
||||
ev->next = (struct eventlist *)db_data2ptr(&prev);
|
||||
}
|
||||
|
||||
return guild_request_info(guild_id);
|
||||
@ -555,7 +555,7 @@ int guild_recv_info(struct guild *sg) {
|
||||
|
||||
//Occurrence of an event
|
||||
if (guild_infoevent_db->remove(guild_infoevent_db, db_i2key(sg->guild_id), &data)) {
|
||||
struct eventlist *ev = db_data2ptr(&data), *ev2;
|
||||
struct eventlist *ev = (struct eventlist *)db_data2ptr(&data), *ev2;
|
||||
while(ev) {
|
||||
npc_event_do(ev->name);
|
||||
ev2=ev->next;
|
||||
@ -1234,7 +1234,7 @@ unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp) {
|
||||
exp = exp * per / 100;
|
||||
//Otherwise tax everything.
|
||||
|
||||
c = db_data2ptr(guild_expcache_db->ensure(guild_expcache_db, db_i2key(sd->status.char_id), create_expcache, sd));
|
||||
c = (struct guild_expcache *)db_data2ptr(guild_expcache_db->ensure(guild_expcache_db, db_i2key(sd->status.char_id), create_expcache, sd));
|
||||
|
||||
if (c->exp > UINT64_MAX - exp)
|
||||
c->exp = UINT64_MAX;
|
||||
@ -1256,7 +1256,7 @@ int guild_getexp(struct map_session_data *sd,int exp) {
|
||||
if (sd->status.guild_id == 0 || sd->guild == NULL)
|
||||
return 0;
|
||||
|
||||
c = db_data2ptr(guild_expcache_db->ensure(guild_expcache_db, db_i2key(sd->status.char_id), create_expcache, sd));
|
||||
c = (struct guild_expcache *)db_data2ptr(guild_expcache_db->ensure(guild_expcache_db, db_i2key(sd->status.char_id), create_expcache, sd));
|
||||
if (c->exp > UINT64_MAX - exp)
|
||||
c->exp = UINT64_MAX;
|
||||
else
|
||||
@ -1646,7 +1646,7 @@ int guild_allianceack(int guild_id1,int guild_id2,uint32 account_id1,uint32 acco
|
||||
* @see DBApply
|
||||
*/
|
||||
int guild_broken_sub(DBKey key, DBData *data, va_list ap) {
|
||||
struct guild *g = db_data2ptr(data);
|
||||
struct guild *g = (struct guild *)db_data2ptr(data);
|
||||
int guild_id=va_arg(ap,int);
|
||||
int i,j;
|
||||
struct map_session_data *sd=NULL;
|
||||
@ -1671,7 +1671,7 @@ int guild_broken_sub(DBKey key, DBData *data, va_list ap) {
|
||||
*/
|
||||
int castle_guild_broken_sub(DBKey key, DBData *data, va_list ap)
|
||||
{
|
||||
struct guild_castle *gc = db_data2ptr(data);
|
||||
struct guild_castle *gc = (struct guild_castle *)db_data2ptr(data);
|
||||
int guild_id = va_arg(ap, int);
|
||||
|
||||
nullpo_ret(gc);
|
||||
@ -1881,7 +1881,7 @@ void guild_castle_map_init(void) {
|
||||
CREATE(castle_ids, int, num);
|
||||
cursor = castle_ids;
|
||||
iter = db_iterator(castle_db);
|
||||
for (gc = dbi_first(iter); dbi_exists(iter); gc = dbi_next(iter)) {
|
||||
for (gc = (struct guild_castle*)dbi_first(iter); dbi_exists(iter); gc = (struct guild_castle*)dbi_next(iter)) {
|
||||
*(cursor++) = gc->castle_id;
|
||||
}
|
||||
dbi_destroy(iter);
|
||||
@ -2068,7 +2068,7 @@ int guild_checkcastles(struct guild *g) {
|
||||
struct guild_castle* gc = NULL;
|
||||
DBIterator *iter = db_iterator(castle_db);
|
||||
|
||||
for (gc = dbi_first(iter); dbi_exists(iter); gc = dbi_next(iter)) {
|
||||
for (gc = (struct guild_castle*)dbi_first(iter); dbi_exists(iter); gc = (struct guild_castle*)dbi_next(iter)) {
|
||||
if (gc->guild_id == g->guild_id) {
|
||||
nb_cas++;
|
||||
}
|
||||
@ -2134,7 +2134,7 @@ void guild_flag_remove(struct npc_data *nd) {
|
||||
*/
|
||||
static int eventlist_db_final(DBKey key, DBData *data, va_list ap) {
|
||||
struct eventlist *next = NULL;
|
||||
struct eventlist *current = db_data2ptr(data);
|
||||
struct eventlist *current = (struct eventlist *)db_data2ptr(data);
|
||||
while (current != NULL) {
|
||||
next = current->next;
|
||||
aFree(current);
|
||||
@ -2155,7 +2155,7 @@ static int guild_expcache_db_final(DBKey key, DBData *data, va_list ap) {
|
||||
* @see DBApply
|
||||
*/
|
||||
static int guild_castle_db_final(DBKey key, DBData *data, va_list ap) {
|
||||
struct guild_castle* gc = db_data2ptr(data);
|
||||
struct guild_castle* gc = (struct guild_castle *)db_data2ptr(data);
|
||||
if( gc->temp_guardians )
|
||||
aFree(gc->temp_guardians);
|
||||
aFree(gc);
|
||||
@ -2211,7 +2211,7 @@ void do_final_guild(void) {
|
||||
DBIterator *iter = db_iterator(guild_db);
|
||||
struct guild *g;
|
||||
|
||||
for( g = dbi_first(iter); dbi_exists(iter); g = dbi_next(iter) ) {
|
||||
for( g = (struct guild *)dbi_first(iter); dbi_exists(iter); g = (struct guild *)dbi_next(iter) ) {
|
||||
channel_delete(g->channel);
|
||||
}
|
||||
dbi_destroy(iter);
|
||||
|
@ -388,7 +388,7 @@ int intif_saveregistry(struct map_session_data *sd)
|
||||
if( varname[0] == '@' ) // @string$ can get here, so we skip
|
||||
continue;
|
||||
|
||||
src = db_data2ptr(data);
|
||||
src = (struct script_reg_state *)db_data2ptr(data);
|
||||
|
||||
if( !src->update )
|
||||
continue;
|
||||
@ -2007,7 +2007,7 @@ void intif_parse_questlog(int fd)
|
||||
// sd->avail_quests and k didn't meet in the middle: some entries were skipped
|
||||
if(k < num_received) // Move the entries at the end to fill the gap
|
||||
memmove(&sd->quest_log[k], &sd->quest_log[sd->avail_quests], sizeof(struct quest) * (num_received - k));
|
||||
sd->quest_log = aRealloc(sd->quest_log, sizeof(struct quest) * sd->num_quests);
|
||||
sd->quest_log = (struct quest *)aRealloc(sd->quest_log, sizeof(struct quest) * sd->num_quests);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2938,7 +2938,7 @@ void intif_parse_MessageToFD(int fd) {
|
||||
|
||||
if( session[u_fd] && session[u_fd]->session_data ) { //check if the player still online
|
||||
int aid = RFIFOL(fd,8);
|
||||
struct map_session_data * sd = session[u_fd]->session_data;
|
||||
struct map_session_data * sd = (struct map_session_data *)session[u_fd]->session_data;
|
||||
/* matching e.g. previous fd owner didn't dc during request or is still the same */
|
||||
if( sd->bl.id == aid ) {
|
||||
char msg[512];
|
||||
|
@ -45,7 +45,7 @@ struct s_item_group_db *itemdb_group_exists(unsigned short group_id) {
|
||||
*/
|
||||
static int itemdb_searchname_sub(DBKey key, DBData *data, va_list ap)
|
||||
{
|
||||
struct item_data *item = db_data2ptr(data), **dst, **dst2;
|
||||
struct item_data *item = (struct item_data *)db_data2ptr(data), **dst, **dst2;
|
||||
char *str;
|
||||
str = va_arg(ap,char *);
|
||||
dst = va_arg(ap,struct item_data **);
|
||||
@ -79,7 +79,7 @@ struct item_data* itemdb_searchname(const char *str)
|
||||
*/
|
||||
static int itemdb_searchname_array_sub(DBKey key, DBData data, va_list ap)
|
||||
{
|
||||
struct item_data *item = db_data2ptr(&data);
|
||||
struct item_data *item = (struct item_data *)db_data2ptr(&data);
|
||||
char *str = va_arg(ap,char *);
|
||||
|
||||
if (stristr(item->jname,str))
|
||||
@ -103,7 +103,7 @@ int itemdb_searchname_array(struct item_data** data, int size, const char *str)
|
||||
|
||||
db_count = itemdb->getall(itemdb, (DBData**)&db_data, size, itemdb_searchname_array_sub, str);
|
||||
for (i = 0; i < db_count && count < size; i++)
|
||||
data[count++] = db_data2ptr(db_data[i]);
|
||||
data[count++] = (struct item_data*)db_data2ptr(db_data[i]);
|
||||
|
||||
return count;
|
||||
}
|
||||
@ -1018,7 +1018,7 @@ static void itemdb_read_combos(const char* basedir, bool silent) {
|
||||
RECREATE(id->combos, struct item_combo*, ++id->combos_count);
|
||||
}
|
||||
CREATE(id->combos[idx],struct item_combo,1);
|
||||
id->combos[idx]->nameid = aMalloc( retcount * sizeof(unsigned short) );
|
||||
id->combos[idx]->nameid = (unsigned short*)aMalloc( retcount * sizeof(unsigned short) );
|
||||
id->combos[idx]->count = retcount;
|
||||
id->combos[idx]->script = parse_script(str[1], path, lines, 0);
|
||||
id->combos[idx]->id = count;
|
||||
@ -1652,14 +1652,14 @@ static void destroy_item_data(struct item_data* self) {
|
||||
*/
|
||||
static int itemdb_final_sub(DBKey key, DBData *data, va_list ap)
|
||||
{
|
||||
struct item_data *id = db_data2ptr(data);
|
||||
struct item_data *id = (struct item_data *)db_data2ptr(data);
|
||||
|
||||
destroy_item_data(id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int itemdb_group_free(DBKey key, DBData *data, va_list ap) {
|
||||
struct s_item_group_db *group = db_data2ptr(data);
|
||||
struct s_item_group_db *group = (struct s_item_group_db *)db_data2ptr(data);
|
||||
uint8 j;
|
||||
if (!group)
|
||||
return 0;
|
||||
|
@ -1598,7 +1598,7 @@ void map_addnickdb(int charid, const char* nick)
|
||||
if( map_charid2sd(charid) )
|
||||
return;// already online
|
||||
|
||||
p = idb_ensure(nick_db, charid, create_charid2nick);
|
||||
p = (struct charid2nick*)idb_ensure(nick_db, charid, create_charid2nick);
|
||||
safestrncpy(p->nick, nick, sizeof(p->nick));
|
||||
|
||||
while( p->requests ) {
|
||||
@ -1620,7 +1620,7 @@ void map_delnickdb(int charid, const char* name)
|
||||
struct charid2nick* p;
|
||||
DBData data;
|
||||
|
||||
if (!nick_db->remove(nick_db, db_i2key(charid), &data) || (p = db_data2ptr(&data)) == NULL)
|
||||
if (!nick_db->remove(nick_db, db_i2key(charid), &data) || (p = (struct charid2nick*)db_data2ptr(&data)) == NULL)
|
||||
return;
|
||||
|
||||
while( p->requests ) {
|
||||
@ -1654,7 +1654,7 @@ void map_reqnickdb(struct map_session_data * sd, int charid)
|
||||
return;
|
||||
}
|
||||
|
||||
p = idb_ensure(nick_db, charid, create_charid2nick);
|
||||
p = (struct charid2nick*)idb_ensure(nick_db, charid, create_charid2nick);
|
||||
if( *p->nick )
|
||||
{
|
||||
clif_solved_charname(sd->fd, charid, p->nick);
|
||||
@ -1927,7 +1927,7 @@ const char* map_charid2nick(int charid)
|
||||
if( sd )
|
||||
return sd->status.name;// character is online, return it's name
|
||||
|
||||
p = idb_ensure(nick_db, charid, create_charid2nick);
|
||||
p = (struct charid2nick*)idb_ensure(nick_db, charid, create_charid2nick);
|
||||
if( *p->nick )
|
||||
return p->nick;// name in nick_db
|
||||
|
||||
@ -2043,7 +2043,7 @@ void map_foreachpc(int (*func)(struct map_session_data* sd, va_list args), ...)
|
||||
struct map_session_data* sd;
|
||||
|
||||
iter = db_iterator(pc_db);
|
||||
for( sd = dbi_first(iter); dbi_exists(iter); sd = dbi_next(iter) )
|
||||
for( sd = (struct map_session_data*)dbi_first(iter); dbi_exists(iter); sd = (struct map_session_data*)dbi_next(iter) )
|
||||
{
|
||||
va_list args;
|
||||
int ret;
|
||||
@ -2407,7 +2407,7 @@ static int map_instancemap_leave(struct block_list *bl, va_list ap)
|
||||
nullpo_retr(0, bl);
|
||||
nullpo_retr(0, sd = (struct map_session_data *)bl);
|
||||
|
||||
pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, 3);
|
||||
pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -2992,7 +2992,7 @@ void map_iwall_get(struct map_session_data *sd) {
|
||||
return;
|
||||
|
||||
iter = db_iterator(iwall_db);
|
||||
for( iwall = dbi_first(iter); dbi_exists(iter); iwall = dbi_next(iter) ) {
|
||||
for( iwall = (struct iwall_data *)dbi_first(iter); dbi_exists(iter); iwall = (struct iwall_data *)dbi_next(iter) ) {
|
||||
if( iwall->m != sd->bl.m )
|
||||
continue;
|
||||
|
||||
@ -3045,7 +3045,7 @@ int map_setipport(unsigned short mapindex, uint32 ip, uint16 port)
|
||||
{
|
||||
struct map_data_other_server *mdos;
|
||||
|
||||
mdos= uidb_ensure(map_db,(unsigned int)mapindex, create_map_data_other_server);
|
||||
mdos= (struct map_data_other_server *)uidb_ensure(map_db,(unsigned int)mapindex, create_map_data_other_server);
|
||||
|
||||
if(mdos->cell) //Local map,Do nothing. Give priority to our own local maps over ones from another server. [Skotlex]
|
||||
return 0;
|
||||
@ -3065,7 +3065,7 @@ int map_setipport(unsigned short mapindex, uint32 ip, uint16 port)
|
||||
*/
|
||||
int map_eraseallipport_sub(DBKey key, DBData *data, va_list va)
|
||||
{
|
||||
struct map_data_other_server *mdos = db_data2ptr(data);
|
||||
struct map_data_other_server *mdos = (struct map_data_other_server *)db_data2ptr(data);
|
||||
if(mdos->cell == NULL) {
|
||||
db_remove(map_db,key);
|
||||
aFree(mdos);
|
||||
@ -3929,7 +3929,7 @@ bool map_remove_questinfo(int m, struct npc_data *nd) {
|
||||
*/
|
||||
int map_db_final(DBKey key, DBData *data, va_list ap)
|
||||
{
|
||||
struct map_data_other_server *mdos = db_data2ptr(data);
|
||||
struct map_data_other_server *mdos = (struct map_data_other_server *)db_data2ptr(data);
|
||||
if(mdos && mdos->cell == NULL)
|
||||
aFree(mdos);
|
||||
return 0;
|
||||
@ -3940,7 +3940,7 @@ int map_db_final(DBKey key, DBData *data, va_list ap)
|
||||
*/
|
||||
int nick_db_final(DBKey key, DBData *data, va_list args)
|
||||
{
|
||||
struct charid2nick* p = db_data2ptr(data);
|
||||
struct charid2nick* p = (struct charid2nick*)db_data2ptr(data);
|
||||
struct charid_request* req;
|
||||
|
||||
if( p == NULL )
|
||||
@ -4047,7 +4047,7 @@ void map_skill_damage_add(struct map_data *m, uint16 skill_id, int pc, int mob,
|
||||
*/
|
||||
static int cleanup_db_sub(DBKey key, DBData *data, va_list va)
|
||||
{
|
||||
return cleanup_sub(db_data2ptr(data), va);
|
||||
return cleanup_sub((struct block_list *)db_data2ptr(data), va);
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
@ -4254,7 +4254,7 @@ void map_do_final_msg(void){
|
||||
DBIterator *iter = db_iterator(map_msg_db);
|
||||
struct msg_data *mdb;
|
||||
|
||||
for (mdb = dbi_first(iter); dbi_exists(iter); mdb = dbi_next(iter)) {
|
||||
for (mdb = (struct msg_data *)dbi_first(iter); dbi_exists(iter); mdb = (struct msg_data *)dbi_next(iter)) {
|
||||
_do_final_msg(MAP_MAX_MSG,mdb->msg);
|
||||
aFree(mdb);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ static bool mapreg_dirty = false; // Whether there are modified regs to be saved
|
||||
*/
|
||||
int mapreg_readreg(int64 uid)
|
||||
{
|
||||
struct mapreg_save *m = i64db_get(regs.vars, uid);
|
||||
struct mapreg_save *m = (struct mapreg_save *)i64db_get(regs.vars, uid);
|
||||
return m ? m->u.i : 0;
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ int mapreg_readreg(int64 uid)
|
||||
*/
|
||||
char* mapreg_readregstr(int64 uid)
|
||||
{
|
||||
struct mapreg_save *m = i64db_get(regs.vars, uid);
|
||||
struct mapreg_save *m = (struct mapreg_save *)i64db_get(regs.vars, uid);
|
||||
return m ? m->u.str : NULL;
|
||||
}
|
||||
|
||||
|
@ -4643,7 +4643,7 @@ static bool mob_readdb_itemratio(char* str[], int columns, int current)
|
||||
* Free drop ratio data
|
||||
**/
|
||||
static int mob_item_drop_ratio_free(DBKey key, DBData *data, va_list ap) {
|
||||
struct s_mob_item_drop_ratio *item_ratio = db_data2ptr(data);
|
||||
struct s_mob_item_drop_ratio *item_ratio = (struct s_mob_item_drop_ratio *)db_data2ptr(data);
|
||||
aFree(item_ratio);
|
||||
return 0;
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ int npc_event_doall_sub(DBKey key, DBData *data, va_list ap)
|
||||
const char* name;
|
||||
int rid;
|
||||
|
||||
nullpo_ret(ev = db_data2ptr(data));
|
||||
nullpo_ret(ev = (struct event_data*)db_data2ptr(data));
|
||||
nullpo_ret(c = va_arg(ap, int *));
|
||||
nullpo_ret(name = va_arg(ap, const char *));
|
||||
rid = va_arg(ap, int);
|
||||
@ -390,7 +390,7 @@ static int npc_event_do_sub(DBKey key, DBData *data, va_list ap)
|
||||
int* c, rid;
|
||||
const char* name;
|
||||
|
||||
nullpo_ret(ev = db_data2ptr(data));
|
||||
nullpo_ret(ev = (struct event_data*)db_data2ptr(data));
|
||||
nullpo_ret(c = va_arg(ap, int *));
|
||||
nullpo_ret(name = va_arg(ap, const char *));
|
||||
rid = va_arg(ap, int);
|
||||
@ -1961,7 +1961,7 @@ int npc_remove_map(struct npc_data* nd)
|
||||
*/
|
||||
static int npc_unload_ev(DBKey key, DBData *data, va_list ap)
|
||||
{
|
||||
struct event_data* ev = db_data2ptr(data);
|
||||
struct event_data* ev = (struct event_data*)db_data2ptr(data);
|
||||
char* npcname = va_arg(ap, char *);
|
||||
|
||||
if(strcmp(ev->nd->exname,npcname)==0){
|
||||
@ -2009,7 +2009,7 @@ int npc_unload(struct npc_data* nd, bool single) {
|
||||
if( single && nd->path ) {
|
||||
struct npc_path_data* npd = NULL;
|
||||
if( nd->path && nd->path != npc_last_ref ) {
|
||||
npd = strdb_get(npc_path_db, nd->path);
|
||||
npd = (struct npc_path_data*)strdb_get(npc_path_db, nd->path);
|
||||
}
|
||||
|
||||
if( npd && --npd->references == 0 ) {
|
||||
@ -2219,7 +2219,7 @@ static void npc_parsename(struct npc_data* nd, const char* name, const char* sta
|
||||
if( npc_last_path != filepath ) {
|
||||
struct npc_path_data * npd = NULL;
|
||||
|
||||
if( !(npd = strdb_get(npc_path_db,filepath) ) ) {
|
||||
if( !(npd = (struct npc_path_data *)strdb_get(npc_path_db,filepath) ) ) {
|
||||
CREATE(npd, struct npc_path_data, 1);
|
||||
strdb_put(npc_path_db, filepath, npd);
|
||||
|
||||
@ -4289,7 +4289,7 @@ void npc_read_event_script(void)
|
||||
for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) )
|
||||
{
|
||||
const char* p = key.str;
|
||||
struct event_data* ed = db_data2ptr(data);
|
||||
struct event_data* ed = (struct event_data*)db_data2ptr(data);
|
||||
unsigned char count = script_event[i].event_count;
|
||||
|
||||
if( count >= ARRAYLENGTH(script_event[i].event) )
|
||||
@ -4320,7 +4320,7 @@ void npc_clear_pathlist(void) {
|
||||
DBIterator *path_list = db_iterator(npc_path_db);
|
||||
|
||||
/* free all npc_path_data filepaths */
|
||||
for( npd = dbi_first(path_list); dbi_exists(path_list); npd = dbi_next(path_list) ) {
|
||||
for( npd = (struct npc_path_data *)dbi_first(path_list); dbi_exists(path_list); npd = (struct npc_path_data *)dbi_next(path_list) ) {
|
||||
if( npd->path )
|
||||
aFree(npd->path);
|
||||
}
|
||||
@ -4438,7 +4438,7 @@ bool npc_unloadfile( const char* path ) {
|
||||
struct npc_data* nd = NULL;
|
||||
bool found = false;
|
||||
|
||||
for( nd = dbi_first(iter); dbi_exists(iter); nd = dbi_next(iter) ) {
|
||||
for( nd = (struct npc_data*)dbi_first(iter); dbi_exists(iter); nd = (struct npc_data*)dbi_next(iter) ) {
|
||||
if( nd->path && strcasecmp(nd->path,path) == 0 ) {
|
||||
found = true;
|
||||
npc_unload_duplicates(nd);/* unload any npcs which could duplicate this but be in a different file */
|
||||
|
@ -126,7 +126,7 @@ struct party_data* party_searchname(const char* str)
|
||||
struct party_data* p;
|
||||
|
||||
DBIterator *iter = db_iterator(party_db);
|
||||
for( p = dbi_first(iter); dbi_exists(iter); p = dbi_next(iter) ) {
|
||||
for( p = (struct party_data*)dbi_first(iter); dbi_exists(iter); p = (struct party_data*)dbi_next(iter) ) {
|
||||
if( strncmpi(p->party.name,str,NAME_LENGTH) == 0 )
|
||||
break;
|
||||
}
|
||||
@ -968,7 +968,7 @@ int party_send_xy_timer(int tid, unsigned int tick, int id, intptr_t data)
|
||||
DBIterator *iter = db_iterator(party_db);
|
||||
|
||||
// for each existing party
|
||||
for( p = dbi_first(iter); dbi_exists(iter); p = dbi_next(iter) ) {
|
||||
for( p = (struct party_data*)dbi_first(iter); dbi_exists(iter); p = (struct party_data*)dbi_next(iter) ) {
|
||||
int i;
|
||||
|
||||
if( !p->party.count ) // no online party members so do not iterate
|
||||
@ -1311,7 +1311,7 @@ void party_booking_search(struct map_session_data *sd, short level, short mapid,
|
||||
|
||||
memset(result_list, 0, sizeof(result_list));
|
||||
|
||||
for( pb_ad = dbi_first(iter); dbi_exists(iter); pb_ad = dbi_next(iter) ) {
|
||||
for( pb_ad = (struct party_booking_ad_info*)dbi_first(iter); dbi_exists(iter); pb_ad = (struct party_booking_ad_info*)dbi_next(iter) ) {
|
||||
if (pb_ad->index < lastindex || (level && (pb_ad->p_detail.level < level-15 || pb_ad->p_detail.level > level)))
|
||||
continue;
|
||||
|
||||
|
24
src/map/pc.c
24
src/map/pc.c
@ -1257,7 +1257,7 @@ bool pc_authok(struct map_session_data *sd, uint32 login_id2, time_t expiration_
|
||||
|
||||
#ifdef BOUND_ITEMS
|
||||
// Party bound item check
|
||||
if(sd->status.party_id == 0 && (j = pc_bound_chk(sd,3,idxlist))) { // Party was deleted while character offline
|
||||
if(sd->status.party_id == 0 && (j = pc_bound_chk(sd,BOUND_PARTY,idxlist))) { // Party was deleted while character offline
|
||||
for(i=0;i<j;i++)
|
||||
pc_delitem(sd,idxlist[i],sd->status.inventory[idxlist[i]].amount,0,1,LOG_TYPE_OTHER);
|
||||
}
|
||||
@ -8602,7 +8602,7 @@ char* pc_readregstr(struct map_session_data* sd, int64 reg)
|
||||
{
|
||||
struct script_reg_str *p = NULL;
|
||||
|
||||
p = i64db_get(sd->regs.vars, reg);
|
||||
p = (struct script_reg_str *)i64db_get(sd->regs.vars, reg);
|
||||
|
||||
return p ? p->value : NULL;
|
||||
}
|
||||
@ -8625,7 +8625,7 @@ bool pc_setregstr(struct map_session_data* sd, int64 reg, const char* str)
|
||||
p->flag.type = 1;
|
||||
|
||||
if (sd->regs.vars->put(sd->regs.vars, db_i642key(reg), db_ptr2data(p), &prev)) {
|
||||
p = db_data2ptr(&prev);
|
||||
p = (struct script_reg_str *)db_data2ptr(&prev);
|
||||
if( p->value )
|
||||
aFree(p->value);
|
||||
ers_free(str_reg_ers, p);
|
||||
@ -8635,7 +8635,7 @@ bool pc_setregstr(struct map_session_data* sd, int64 reg, const char* str)
|
||||
}
|
||||
} else {
|
||||
if (sd->regs.vars->remove(sd->regs.vars, db_i642key(reg), &prev)) {
|
||||
p = db_data2ptr(&prev);
|
||||
p = (struct script_reg_str *)db_data2ptr(&prev);
|
||||
if( p->value )
|
||||
aFree(p->value);
|
||||
ers_free(str_reg_ers, p);
|
||||
@ -8665,7 +8665,7 @@ int pc_readregistry(struct map_session_data *sd, int64 reg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
p = i64db_get(sd->regs.vars, reg);
|
||||
p = (struct script_reg_num *)i64db_get(sd->regs.vars, reg);
|
||||
|
||||
return p ? p->value : 0;
|
||||
}
|
||||
@ -8688,7 +8688,7 @@ char* pc_readregistry_str(struct map_session_data *sd, int64 reg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p = i64db_get(sd->regs.vars, reg);
|
||||
p = (struct script_reg_str *)i64db_get(sd->regs.vars, reg);
|
||||
|
||||
return p ? p->value : NULL;
|
||||
}
|
||||
@ -8734,7 +8734,7 @@ int pc_setregistry(struct map_session_data *sd, int64 reg, int val)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((p = i64db_get(sd->regs.vars, reg))) {
|
||||
if ((p = (struct script_reg_num *)i64db_get(sd->regs.vars, reg))) {
|
||||
if( val ) {
|
||||
if( !p->value && index ) /* its a entry that was deleted, so we reset array */
|
||||
script_array_update(&sd->regs, reg, false);
|
||||
@ -8759,7 +8759,7 @@ int pc_setregistry(struct map_session_data *sd, int64 reg, int val)
|
||||
p->flag.update = 1;
|
||||
|
||||
if (sd->regs.vars->put(sd->regs.vars, db_i642key(reg), db_ptr2data(p), &prev)) {
|
||||
p = db_data2ptr(&prev);
|
||||
p = (struct script_reg_num *)db_data2ptr(&prev);
|
||||
ers_free(num_reg_ers, p);
|
||||
}
|
||||
}
|
||||
@ -8787,7 +8787,7 @@ int pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( (p = i64db_get(sd->regs.vars, reg) ) ) {
|
||||
if( (p = (struct script_reg_str *)i64db_get(sd->regs.vars, reg) ) ) {
|
||||
if( val[0] ) {
|
||||
if( p->value )
|
||||
aFree(p->value);
|
||||
@ -8815,7 +8815,7 @@ int pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val)
|
||||
p->flag.type = 1;
|
||||
|
||||
if( sd->regs.vars->put(sd->regs.vars, db_i642key(reg), db_ptr2data(p), &prev) ) {
|
||||
p = db_data2ptr(&prev);
|
||||
p = (struct script_reg_str *)db_data2ptr(&prev);
|
||||
if( p->value )
|
||||
aFree(p->value);
|
||||
ers_free(str_reg_ers, p);
|
||||
@ -10938,7 +10938,7 @@ void pc_itemcd_do(struct map_session_data *sd, bool load) {
|
||||
struct item_cd* cd = NULL;
|
||||
|
||||
if( load ) {
|
||||
if( !(cd = idb_get(itemcd_db, sd->status.char_id)) ) {
|
||||
if( !(cd = (struct item_cd*)idb_get(itemcd_db, sd->status.char_id)) ) {
|
||||
// no item cooldown is associated with this character
|
||||
return;
|
||||
}
|
||||
@ -10951,7 +10951,7 @@ void pc_itemcd_do(struct map_session_data *sd, bool load) {
|
||||
}
|
||||
idb_remove(itemcd_db,sd->status.char_id);
|
||||
} else {
|
||||
if( !(cd = idb_get(itemcd_db,sd->status.char_id)) ) {
|
||||
if( !(cd = (struct item_cd*)idb_get(itemcd_db,sd->status.char_id)) ) {
|
||||
// create a new skill cooldown object for map storage
|
||||
CREATE( cd, struct item_cd, 1 );
|
||||
idb_put( itemcd_db, sd->status.char_id, cd );
|
||||
|
@ -141,7 +141,7 @@ static void read_config(void)
|
||||
|
||||
// Check if all commands and permissions exist
|
||||
iter = db_iterator(pc_group_db);
|
||||
for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) {
|
||||
for (group_settings = (GroupSettings *)dbi_first(iter); dbi_exists(iter); group_settings = (GroupSettings *)dbi_next(iter)) {
|
||||
config_setting_t *commands = group_settings->commands, *permissions = group_settings->permissions;
|
||||
int count = 0, j;
|
||||
|
||||
@ -186,7 +186,7 @@ static void read_config(void)
|
||||
i = 0; // counter for processed groups
|
||||
while (i < group_count) {
|
||||
iter = db_iterator(pc_group_db);
|
||||
for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) {
|
||||
for (group_settings = (GroupSettings *)dbi_first(iter); dbi_exists(iter); group_settings = (GroupSettings *)dbi_next(iter)) {
|
||||
config_setting_t *inherit = NULL,
|
||||
*commands = group_settings->commands,
|
||||
*permissions = group_settings->permissions;
|
||||
@ -251,7 +251,7 @@ static void read_config(void)
|
||||
|
||||
// Pack permissions into GroupSettings.e_permissions for faster checking
|
||||
iter = db_iterator(pc_group_db);
|
||||
for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) {
|
||||
for (group_settings = (GroupSettings *)dbi_first(iter); dbi_exists(iter); group_settings = (GroupSettings *)dbi_next(iter)) {
|
||||
config_setting_t *permissions = group_settings->permissions;
|
||||
int c, count = config_setting_length(permissions);
|
||||
|
||||
@ -276,9 +276,9 @@ static void read_config(void)
|
||||
if( ( pc_group_max = group_count ) ) {
|
||||
DBIterator *iter = db_iterator(pc_group_db);
|
||||
GroupSettings *group_settings = NULL;
|
||||
int* group_ids = aMalloc( pc_group_max * sizeof(int) );
|
||||
int* group_ids = (int*)aMalloc( pc_group_max * sizeof(int) );
|
||||
int i = 0;
|
||||
for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) {
|
||||
for (group_settings = (GroupSettings *)dbi_first(iter); dbi_exists(iter); group_settings = (GroupSettings *)dbi_next(iter)) {
|
||||
group_ids[i++] = group_settings->id;
|
||||
}
|
||||
|
||||
|
@ -573,7 +573,7 @@ static void questdb_free_sub(struct quest_db *quest, bool free)
|
||||
*/
|
||||
static int questdb_free(DBKey key, DBData *data, va_list ap)
|
||||
{
|
||||
struct quest_db *quest = db_data2ptr(data);
|
||||
struct quest_db *quest = (struct quest_db *)db_data2ptr(data);
|
||||
|
||||
if (!quest)
|
||||
return 0;
|
||||
|
@ -207,7 +207,7 @@ void searchstore_query(struct map_session_data* sd, unsigned char type, unsigned
|
||||
s.max_price = max_price;
|
||||
iter = db_iterator((type == SEARCHTYPE_VENDING) ? vending_getdb() : buyingstore_getdb());
|
||||
|
||||
for( pl_sd = dbi_first(iter); dbi_exists(iter); pl_sd = dbi_next(iter) ) {
|
||||
for( pl_sd = (struct map_session_data*)dbi_first(iter); dbi_exists(iter); pl_sd = (struct map_session_data*)dbi_next(iter) ) {
|
||||
if( sd == pl_sd ) // skip own shop, if any
|
||||
continue;
|
||||
|
||||
|
@ -19433,7 +19433,7 @@ void skill_usave_add(struct map_session_data * sd, uint16 skill_id, uint16 skill
|
||||
void skill_usave_trigger(struct map_session_data *sd) {
|
||||
struct skill_usave * sus = NULL;
|
||||
|
||||
if( ! (sus = idb_get(skillusave_db,sd->status.char_id)) )
|
||||
if( ! (sus = (struct skill_usave *)idb_get(skillusave_db,sd->status.char_id)) )
|
||||
return;
|
||||
|
||||
skill_unitsetting(&sd->bl,sus->skill_id,sus->skill_lv,sd->bl.x,sd->bl.y,0);
|
||||
@ -20874,8 +20874,8 @@ void do_init_skill(void)
|
||||
skillunit_db = idb_alloc(DB_OPT_BASE);
|
||||
skillusave_db = idb_alloc(DB_OPT_RELEASE_DATA);
|
||||
bowling_db = idb_alloc(DB_OPT_BASE);
|
||||
skill_unit_ers = ers_new(sizeof(struct skill_unit_group),"skill.c::skill_unit_ers",ERS_OPT_CLEAN|ERS_OPT_FLEX_CHUNK);
|
||||
skill_timer_ers = ers_new(sizeof(struct skill_timerskill),"skill.c::skill_timer_ers",ERS_OPT_CLEAN|ERS_OPT_FLEX_CHUNK);
|
||||
skill_unit_ers = ers_new(sizeof(struct skill_unit_group),"skill.c::skill_unit_ers",ERS_CACHE_OPTIONS);
|
||||
skill_timer_ers = ers_new(sizeof(struct skill_timerskill),"skill.c::skill_timer_ers",ERS_CACHE_OPTIONS);
|
||||
|
||||
ers_chunk_size(skill_unit_ers, 150);
|
||||
ers_chunk_size(skill_timer_ers, 150);
|
||||
|
@ -84,7 +84,7 @@ void do_final_storage(void)
|
||||
*/
|
||||
static int storage_reconnect_sub(DBKey key, DBData *data, va_list ap)
|
||||
{
|
||||
struct guild_storage *stor = db_data2ptr(data);
|
||||
struct guild_storage *stor = (struct guild_storage *)db_data2ptr(data);
|
||||
|
||||
if (stor->dirty && stor->opened == 0) //Save closed storages.
|
||||
gstorage_storagesave(0, stor->guild_id,0);
|
||||
|
@ -467,7 +467,7 @@ void vending_reopen( struct map_session_data* sd )
|
||||
nullpo_retv(sd);
|
||||
|
||||
// Open vending for this autotrader
|
||||
if ((at = uidb_get(vending_autotrader_db, sd->status.char_id)) && at->count && at->entries) {
|
||||
if ((at = (struct s_autotrader *)uidb_get(vending_autotrader_db, sd->status.char_id)) && at->count && at->entries) {
|
||||
uint8 *data, *p;
|
||||
uint16 j, count;
|
||||
|
||||
@ -592,7 +592,7 @@ void do_init_vending_autotrade(void)
|
||||
|
||||
// Init items for each autotraders
|
||||
iter = db_iterator(vending_autotrader_db);
|
||||
for (at = dbi_first(iter); dbi_exists(iter); at = dbi_next(iter)) {
|
||||
for (at = (struct s_autotrader *)dbi_first(iter); dbi_exists(iter); at = (struct s_autotrader *)dbi_next(iter)) {
|
||||
uint16 j = 0;
|
||||
|
||||
if (SQL_ERROR == Sql_Query(mmysql_handle,
|
||||
@ -666,7 +666,7 @@ static void vending_autotrader_remove(struct s_autotrader *at, bool remove) {
|
||||
* @author [Cydh]
|
||||
*/
|
||||
static int vending_autotrader_free(DBKey key, DBData *data, va_list ap) {
|
||||
struct s_autotrader *at = db_data2ptr(data);
|
||||
struct s_autotrader *at = (struct s_autotrader *)db_data2ptr(data);
|
||||
if (at)
|
||||
vending_autotrader_remove(at, false);
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user