diff --git a/src/char/char.cpp b/src/char/char.cpp index 64cb13f0de..6b74b33f27 100644 --- a/src/char/char.cpp +++ b/src/char/char.cpp @@ -201,7 +201,7 @@ void char_set_char_offline(uint32 char_id, uint32 account_id){ } //Remove char if 1- Set all offline, or 2- character is no longer connected to char-server. - if (char_id == -1 || character == NULL || character->fd == -1){ + if (char_id == -1 || character == nullptr || character->fd == -1){ chlogif_send_setaccoffline(login_fd,account_id); } } @@ -594,27 +594,27 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, enum sto return 1; } - SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &item.id, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 1, SQLDT_UINT, &item.nameid, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 8, SQLDT_UINT, &item.bound, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, 0, NULL, NULL); - SqlStmt_BindColumn(stmt,10, SQLDT_INT8, &item.enchantgrade,0, NULL, NULL); + SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &item.id, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 1, SQLDT_UINT, &item.nameid, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 8, SQLDT_UINT, &item.bound, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt,10, SQLDT_INT8, &item.enchantgrade,0, nullptr, nullptr); if (tableswitch == TABLE_INVENTORY){ - SqlStmt_BindColumn(stmt, 11, SQLDT_CHAR, &item.favorite, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 12, SQLDT_UINT, &item.equipSwitch, 0, NULL, NULL); + SqlStmt_BindColumn(stmt, 11, SQLDT_CHAR, &item.favorite, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 12, SQLDT_UINT, &item.equipSwitch, 0, nullptr, nullptr); } for( i = 0; i < MAX_SLOTS; ++i ) - SqlStmt_BindColumn(stmt, 11+offset+i, SQLDT_UINT, &item.card[i], 0, NULL, NULL); + SqlStmt_BindColumn(stmt, 11+offset+i, SQLDT_UINT, &item.card[i], 0, nullptr, nullptr); for( i = 0; i < MAX_ITEM_RDM_OPT; ++i ) { - SqlStmt_BindColumn(stmt, 11+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].id, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 12+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].value, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 13+offset+MAX_SLOTS+i*3, SQLDT_CHAR, &item.option[i].param, 0, NULL, NULL); + SqlStmt_BindColumn(stmt, 11+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].id, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 12+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].value, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 13+offset+MAX_SLOTS+i*3, SQLDT_CHAR, &item.option[i].param, 0, nullptr, nullptr); } // bit array indicating which inventory items have already been matched flag = (bool*) aCalloc(max, sizeof(bool)); @@ -792,7 +792,7 @@ bool char_memitemdata_from_sql(struct s_storage* p, int max, int id, enum storag p->max_amount = max2; stmt = SqlStmt_Malloc(sql_handle); - if (stmt == NULL) { + if (stmt == nullptr) { SqlStmt_ShowDebug(stmt); return false; } @@ -822,27 +822,27 @@ bool char_memitemdata_from_sql(struct s_storage* p, int max, int id, enum storag return false; } - SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &item.id, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 1, SQLDT_UINT, &item.nameid, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 8, SQLDT_CHAR, &item.bound, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 9, SQLDT_ULONGLONG, &item.unique_id, 0, NULL, NULL); - SqlStmt_BindColumn(stmt,10, SQLDT_INT8, &item.enchantgrade, 0, NULL, NULL); + SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &item.id, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 1, SQLDT_UINT, &item.nameid, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 8, SQLDT_CHAR, &item.bound, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 9, SQLDT_ULONGLONG, &item.unique_id, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt,10, SQLDT_INT8, &item.enchantgrade, 0, nullptr, nullptr); if (tableswitch == TABLE_INVENTORY){ - SqlStmt_BindColumn(stmt, 11, SQLDT_CHAR, &item.favorite, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 12, SQLDT_UINT, &item.equipSwitch, 0, NULL, NULL); + SqlStmt_BindColumn(stmt, 11, SQLDT_CHAR, &item.favorite, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 12, SQLDT_UINT, &item.equipSwitch, 0, nullptr, nullptr); } for( i = 0; i < MAX_SLOTS; ++i ) - SqlStmt_BindColumn(stmt, 11+offset+i, SQLDT_UINT, &item.card[i], 0, NULL, NULL); + SqlStmt_BindColumn(stmt, 11+offset+i, SQLDT_UINT, &item.card[i], 0, nullptr, nullptr); for( i = 0; i < MAX_ITEM_RDM_OPT; ++i ) { - SqlStmt_BindColumn(stmt, 11+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].id, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 12+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].value, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 13+offset+MAX_SLOTS+i*3, SQLDT_CHAR, &item.option[i].param, 0, NULL, NULL); + SqlStmt_BindColumn(stmt, 11+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].id, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 12+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].value, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 13+offset+MAX_SLOTS+i*3, SQLDT_CHAR, &item.option[i].param, 0, nullptr, nullptr); } for( i = 0; i < max && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i ) @@ -916,7 +916,7 @@ int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf, uint8* coun char sex[2]; stmt = SqlStmt_Malloc(sql_handle); - if( stmt == NULL ) { + if( stmt == nullptr ) { SqlStmt_ShowDebug(stmt); return 0; } @@ -939,64 +939,64 @@ int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf, uint8* coun "`inventory_slots`,`body_direction`,`disable_call`" " FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", schema_config.char_db, sd->account_id, MAX_CHARS) || SQL_ERROR == SqlStmt_Execute(stmt) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_SHORT, &p.class_, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 4, SQLDT_UINT, &p.base_level, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 5, SQLDT_UINT, &p.job_level, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 6, SQLDT_UINT64, &p.base_exp, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 7, SQLDT_UINT64, &p.job_exp, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 8, SQLDT_INT, &p.zeny, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 9, SQLDT_SHORT, &p.str, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 10, SQLDT_SHORT, &p.agi, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 11, SQLDT_SHORT, &p.vit, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 12, SQLDT_SHORT, &p.int_, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 13, SQLDT_SHORT, &p.dex, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 14, SQLDT_SHORT, &p.luk, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 15, SQLDT_UINT, &p.max_hp, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 16, SQLDT_UINT, &p.hp, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 17, SQLDT_UINT, &p.max_sp, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 18, SQLDT_UINT, &p.sp, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 19, SQLDT_UINT, &p.status_point, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 20, SQLDT_UINT, &p.skill_point, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 21, SQLDT_UINT, &p.option, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 23, SQLDT_SHORT, &p.manner, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 24, SQLDT_SHORT, &p.hair, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 25, SQLDT_SHORT, &p.hair_color, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 27, SQLDT_SHORT, &p.body, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 28, SQLDT_SHORT, &p.weapon, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 29, SQLDT_SHORT, &p.shield, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 30, SQLDT_SHORT, &p.head_top, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 31, SQLDT_SHORT, &p.head_mid, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 32, SQLDT_SHORT, &p.head_bottom, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 33, SQLDT_STRING, &p.last_point.map, sizeof(p.last_point.map), NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 34, SQLDT_SHORT, &p.rename, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 35, SQLDT_UINT32, &p.delete_date, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 36, SQLDT_SHORT, &p.robe, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 37, SQLDT_UINT, &p.character_moves, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 38, SQLDT_LONG, &p.unban_time, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 39, SQLDT_UCHAR, &p.font, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 40, SQLDT_UINT, &p.uniqueitem_counter, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 41, SQLDT_ENUM, &sex, sizeof(sex), NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 42, SQLDT_UCHAR, &p.hotkey_rowshift, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 43, SQLDT_ULONG, &p.title_id, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 44, SQLDT_UINT16, &p.show_equip, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 45, SQLDT_UCHAR, &p.hotkey_rowshift2, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 46, SQLDT_UINT, &p.max_ap, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 47, SQLDT_UINT, &p.ap, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 48, SQLDT_UINT, &p.trait_point, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 49, SQLDT_SHORT, &p.pow, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 50, SQLDT_SHORT, &p.sta, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 51, SQLDT_SHORT, &p.wis, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 52, SQLDT_SHORT, &p.spl, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 53, SQLDT_SHORT, &p.con, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 54, SQLDT_SHORT, &p.crt, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 55, SQLDT_UINT16, &p.inventory_slots, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 56, SQLDT_UINT8, &p.body_direction, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 57, SQLDT_UINT16, &p.disable_call, 0, NULL, NULL) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_SHORT, &p.class_, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 4, SQLDT_UINT, &p.base_level, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 5, SQLDT_UINT, &p.job_level, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 6, SQLDT_UINT64, &p.base_exp, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 7, SQLDT_UINT64, &p.job_exp, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 8, SQLDT_INT, &p.zeny, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 9, SQLDT_SHORT, &p.str, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 10, SQLDT_SHORT, &p.agi, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 11, SQLDT_SHORT, &p.vit, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 12, SQLDT_SHORT, &p.int_, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 13, SQLDT_SHORT, &p.dex, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 14, SQLDT_SHORT, &p.luk, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 15, SQLDT_UINT, &p.max_hp, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 16, SQLDT_UINT, &p.hp, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 17, SQLDT_UINT, &p.max_sp, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 18, SQLDT_UINT, &p.sp, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 19, SQLDT_UINT, &p.status_point, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 20, SQLDT_UINT, &p.skill_point, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 21, SQLDT_UINT, &p.option, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 23, SQLDT_SHORT, &p.manner, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 24, SQLDT_SHORT, &p.hair, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 25, SQLDT_SHORT, &p.hair_color, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 27, SQLDT_SHORT, &p.body, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 28, SQLDT_SHORT, &p.weapon, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 29, SQLDT_SHORT, &p.shield, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 30, SQLDT_SHORT, &p.head_top, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 31, SQLDT_SHORT, &p.head_mid, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 32, SQLDT_SHORT, &p.head_bottom, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 33, SQLDT_STRING, &p.last_point.map, sizeof(p.last_point.map), nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 34, SQLDT_SHORT, &p.rename, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 35, SQLDT_UINT32, &p.delete_date, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 36, SQLDT_SHORT, &p.robe, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 37, SQLDT_UINT, &p.character_moves, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 38, SQLDT_LONG, &p.unban_time, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 39, SQLDT_UCHAR, &p.font, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 40, SQLDT_UINT, &p.uniqueitem_counter, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 41, SQLDT_ENUM, &sex, sizeof(sex), nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 42, SQLDT_UCHAR, &p.hotkey_rowshift, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 43, SQLDT_ULONG, &p.title_id, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 44, SQLDT_UINT16, &p.show_equip, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 45, SQLDT_UCHAR, &p.hotkey_rowshift2, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 46, SQLDT_UINT, &p.max_ap, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 47, SQLDT_UINT, &p.ap, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 48, SQLDT_UINT, &p.trait_point, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 49, SQLDT_SHORT, &p.pow, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 50, SQLDT_SHORT, &p.sta, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 51, SQLDT_SHORT, &p.wis, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 52, SQLDT_SHORT, &p.spl, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 53, SQLDT_SHORT, &p.con, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 54, SQLDT_SHORT, &p.crt, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 55, SQLDT_UINT16, &p.inventory_slots, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 56, SQLDT_UINT8, &p.body_direction, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 57, SQLDT_UINT16, &p.disable_call, 0, nullptr, nullptr) ) { SqlStmt_ShowDebug(stmt); @@ -1046,7 +1046,7 @@ int char_mmo_char_fromsql(uint32 char_id, struct mmo_charstatus* p, bool load_ev if (charserv_config.save_log) ShowInfo("Char load request (%d)\n", char_id); stmt = SqlStmt_Malloc(sql_handle); - if( stmt == NULL ) + if( stmt == nullptr ) { SqlStmt_ShowDebug(stmt); return 0; @@ -1065,82 +1065,82 @@ int char_mmo_char_fromsql(uint32 char_id, struct mmo_charstatus* p, bool load_ev " FROM `%s` WHERE `char_id`=? LIMIT 1", schema_config.char_db) || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0) || SQL_ERROR == SqlStmt_Execute(stmt) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &p->char_id, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 4, SQLDT_SHORT, &p->class_, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 5, SQLDT_UINT, &p->base_level, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 6, SQLDT_UINT, &p->job_level, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 7, SQLDT_UINT64, &p->base_exp, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 8, SQLDT_UINT64, &p->job_exp, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 9, SQLDT_INT, &p->zeny, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 10, SQLDT_SHORT, &p->str, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 11, SQLDT_SHORT, &p->agi, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 12, SQLDT_SHORT, &p->vit, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 13, SQLDT_SHORT, &p->int_, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 14, SQLDT_SHORT, &p->dex, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 15, SQLDT_SHORT, &p->luk, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 16, SQLDT_UINT, &p->max_hp, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 17, SQLDT_UINT, &p->hp, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 18, SQLDT_UINT, &p->max_sp, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 19, SQLDT_UINT, &p->sp, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 20, SQLDT_UINT, &p->status_point, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 21, SQLDT_UINT, &p->skill_point, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 22, SQLDT_UINT, &p->option, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 24, SQLDT_SHORT, &p->manner, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 25, SQLDT_INT, &p->party_id, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 26, SQLDT_INT, &p->guild_id, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 27, SQLDT_INT, &p->pet_id, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 28, SQLDT_INT, &p->hom_id, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 29, SQLDT_INT, &p->ele_id, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 30, SQLDT_SHORT, &p->hair, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 31, SQLDT_SHORT, &p->hair_color, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 33, SQLDT_SHORT, &p->body, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 34, SQLDT_SHORT, &p->weapon, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 35, SQLDT_SHORT, &p->shield, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 36, SQLDT_SHORT, &p->head_top, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 37, SQLDT_SHORT, &p->head_mid, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 38, SQLDT_SHORT, &p->head_bottom, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 39, SQLDT_STRING, &p->last_point.map, sizeof(p->last_point.map), NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 40, SQLDT_SHORT, &p->last_point.x, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 41, SQLDT_SHORT, &p->last_point.y, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 42, SQLDT_STRING, &p->save_point.map, sizeof(p->save_point.map), NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 43, SQLDT_SHORT, &p->save_point.x, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 44, SQLDT_SHORT, &p->save_point.y, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 45, SQLDT_UINT32, &p->partner_id, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 46, SQLDT_UINT32, &p->father, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 47, SQLDT_UINT32, &p->mother, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 48, SQLDT_UINT32, &p->child, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 49, SQLDT_INT, &p->fame, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 50, SQLDT_SHORT, &p->rename, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 51, SQLDT_UINT32, &p->delete_date, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 52, SQLDT_SHORT, &p->robe, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 53, SQLDT_UINT32, &p->character_moves, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 54, SQLDT_LONG, &p->unban_time, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 55, SQLDT_UCHAR, &p->font, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 56, SQLDT_UINT, &p->uniqueitem_counter, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 57, SQLDT_ENUM, &sex, sizeof(sex), NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 58, SQLDT_UCHAR, &p->hotkey_rowshift, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 59, SQLDT_INT, &p->clan_id, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 60, SQLDT_ULONG, &p->title_id, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 61, SQLDT_UINT16, &p->show_equip, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 62, SQLDT_UCHAR, &p->hotkey_rowshift2, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 63, SQLDT_UINT, &p->max_ap, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 64, SQLDT_UINT, &p->ap, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 65, SQLDT_UINT, &p->trait_point, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 66, SQLDT_SHORT, &p->pow, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 67, SQLDT_SHORT, &p->sta, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 68, SQLDT_SHORT, &p->wis, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 69, SQLDT_SHORT, &p->spl, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 70, SQLDT_SHORT, &p->con, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 71, SQLDT_SHORT, &p->crt, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 72, SQLDT_UINT16, &p->inventory_slots, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 73, SQLDT_UINT8, &p->body_direction, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 74, SQLDT_UINT8, &p->disable_call, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 75, SQLDT_INT, &p->last_point_instanceid, 0, NULL, NULL) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &p->char_id, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 4, SQLDT_SHORT, &p->class_, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 5, SQLDT_UINT, &p->base_level, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 6, SQLDT_UINT, &p->job_level, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 7, SQLDT_UINT64, &p->base_exp, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 8, SQLDT_UINT64, &p->job_exp, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 9, SQLDT_INT, &p->zeny, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 10, SQLDT_SHORT, &p->str, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 11, SQLDT_SHORT, &p->agi, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 12, SQLDT_SHORT, &p->vit, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 13, SQLDT_SHORT, &p->int_, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 14, SQLDT_SHORT, &p->dex, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 15, SQLDT_SHORT, &p->luk, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 16, SQLDT_UINT, &p->max_hp, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 17, SQLDT_UINT, &p->hp, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 18, SQLDT_UINT, &p->max_sp, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 19, SQLDT_UINT, &p->sp, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 20, SQLDT_UINT, &p->status_point, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 21, SQLDT_UINT, &p->skill_point, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 22, SQLDT_UINT, &p->option, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 24, SQLDT_SHORT, &p->manner, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 25, SQLDT_INT, &p->party_id, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 26, SQLDT_INT, &p->guild_id, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 27, SQLDT_INT, &p->pet_id, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 28, SQLDT_INT, &p->hom_id, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 29, SQLDT_INT, &p->ele_id, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 30, SQLDT_SHORT, &p->hair, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 31, SQLDT_SHORT, &p->hair_color, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 33, SQLDT_SHORT, &p->body, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 34, SQLDT_SHORT, &p->weapon, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 35, SQLDT_SHORT, &p->shield, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 36, SQLDT_SHORT, &p->head_top, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 37, SQLDT_SHORT, &p->head_mid, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 38, SQLDT_SHORT, &p->head_bottom, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 39, SQLDT_STRING, &p->last_point.map, sizeof(p->last_point.map), nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 40, SQLDT_SHORT, &p->last_point.x, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 41, SQLDT_SHORT, &p->last_point.y, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 42, SQLDT_STRING, &p->save_point.map, sizeof(p->save_point.map), nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 43, SQLDT_SHORT, &p->save_point.x, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 44, SQLDT_SHORT, &p->save_point.y, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 45, SQLDT_UINT32, &p->partner_id, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 46, SQLDT_UINT32, &p->father, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 47, SQLDT_UINT32, &p->mother, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 48, SQLDT_UINT32, &p->child, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 49, SQLDT_INT, &p->fame, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 50, SQLDT_SHORT, &p->rename, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 51, SQLDT_UINT32, &p->delete_date, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 52, SQLDT_SHORT, &p->robe, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 53, SQLDT_UINT32, &p->character_moves, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 54, SQLDT_LONG, &p->unban_time, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 55, SQLDT_UCHAR, &p->font, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 56, SQLDT_UINT, &p->uniqueitem_counter, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 57, SQLDT_ENUM, &sex, sizeof(sex), nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 58, SQLDT_UCHAR, &p->hotkey_rowshift, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 59, SQLDT_INT, &p->clan_id, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 60, SQLDT_ULONG, &p->title_id, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 61, SQLDT_UINT16, &p->show_equip, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 62, SQLDT_UCHAR, &p->hotkey_rowshift2, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 63, SQLDT_UINT, &p->max_ap, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 64, SQLDT_UINT, &p->ap, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 65, SQLDT_UINT, &p->trait_point, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 66, SQLDT_SHORT, &p->pow, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 67, SQLDT_SHORT, &p->sta, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 68, SQLDT_SHORT, &p->wis, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 69, SQLDT_SHORT, &p->spl, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 70, SQLDT_SHORT, &p->con, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 71, SQLDT_SHORT, &p->crt, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 72, SQLDT_UINT16, &p->inventory_slots, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 73, SQLDT_UINT8, &p->body_direction, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 74, SQLDT_UINT8, &p->disable_call, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 75, SQLDT_INT, &p->last_point_instanceid, 0, nullptr, nullptr) ) { SqlStmt_ShowDebug(stmt); @@ -1153,7 +1153,7 @@ int char_mmo_char_fromsql(uint32 char_id, struct mmo_charstatus* p, bool load_ev SqlStmt_Free(stmt); return 0; } - p->sex = char_mmo_gender(NULL, p, sex[0]); + p->sex = char_mmo_gender(nullptr, p, sex[0]); StringBuf_Init(&msg_buf); StringBuf_AppendStr(&msg_buf, " status"); @@ -1170,9 +1170,9 @@ int char_mmo_char_fromsql(uint32 char_id, struct mmo_charstatus* p, bool load_ev if( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT `map`,`x`,`y` FROM `%s` WHERE `char_id`=? ORDER by `memo_id` LIMIT %d", schema_config.memo_db, MAX_MEMOPOINTS) || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0) || SQL_ERROR == SqlStmt_Execute(stmt) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &tmp_point.map, sizeof(tmp_point.map), NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_SHORT, &tmp_point.x, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT, &tmp_point.y, 0, NULL, NULL) ) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &tmp_point.map, sizeof(tmp_point.map), nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_SHORT, &tmp_point.x, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT, &tmp_point.y, 0, nullptr, nullptr) ) SqlStmt_ShowDebug(stmt); for( i = 0; i < MAX_MEMOPOINTS && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i ) @@ -1186,9 +1186,9 @@ int char_mmo_char_fromsql(uint32 char_id, struct mmo_charstatus* p, bool load_ev if( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", schema_config.skill_db, MAX_SKILL) || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0) || SQL_ERROR == SqlStmt_Execute(stmt) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_UINT16, &tmp_skill.id , 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_UINT8 , &tmp_skill.lv , 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_UINT8 , &tmp_skill.flag, 0, NULL, NULL) ) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_UINT16, &tmp_skill.id , 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_UINT8 , &tmp_skill.lv , 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_UINT8 , &tmp_skill.flag, 0, nullptr, nullptr) ) SqlStmt_ShowDebug(stmt); if( tmp_skill.flag != SKILL_FLAG_PERM_GRANTED ) @@ -1209,9 +1209,9 @@ int char_mmo_char_fromsql(uint32 char_id, struct mmo_charstatus* p, bool load_ev if( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT c.`account_id`, c.`char_id`, c.`name` FROM `%s` c LEFT JOIN `%s` f ON f.`friend_id` = c.`char_id` WHERE f.`char_id`=? LIMIT %d", schema_config.char_db, schema_config.friend_db, MAX_FRIENDS) || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0) || SQL_ERROR == SqlStmt_Execute(stmt) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_INT, &tmp_friend.char_id, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_STRING, &tmp_friend.name, sizeof(tmp_friend.name), NULL, NULL) ) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_INT, &tmp_friend.char_id, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_STRING, &tmp_friend.name, sizeof(tmp_friend.name), nullptr, nullptr) ) SqlStmt_ShowDebug(stmt); for( i = 0; i < MAX_FRIENDS && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i ) @@ -1224,10 +1224,10 @@ int char_mmo_char_fromsql(uint32 char_id, struct mmo_charstatus* p, bool load_ev if( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT `hotkey`, `type`, `itemskill_id`, `skill_lvl` FROM `%s` WHERE `char_id`=?", schema_config.hotkey_db) || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0) || SQL_ERROR == SqlStmt_Execute(stmt) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &hotkey_num, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_UCHAR, &tmp_hotkey.type, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_UINT, &tmp_hotkey.id, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_USHORT, &tmp_hotkey.lv, 0, NULL, NULL) ) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &hotkey_num, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_UCHAR, &tmp_hotkey.type, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_UINT, &tmp_hotkey.id, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_USHORT, &tmp_hotkey.lv, 0, nullptr, nullptr) ) SqlStmt_ShowDebug(stmt); while( SQL_SUCCESS == SqlStmt_NextRow(stmt) ) @@ -1378,13 +1378,13 @@ int char_check_char_name(char * name, char * esc_name) if( charserv_config.char_config.char_name_option == 1 ) { // only letters/symbols in char_name_letters are authorised for( i = 0; i < NAME_LENGTH && name[i]; i++ ) - if( strchr(charserv_config.char_config.char_name_letters, name[i]) == NULL ) + if( strchr(charserv_config.char_config.char_name_letters, name[i]) == nullptr ) return -2; } else if( charserv_config.char_config.char_name_option == 2 ) { // letters/symbols in char_name_letters are forbidden for( i = 0; i < NAME_LENGTH && name[i]; i++ ) - if( strchr(charserv_config.char_config.char_name_letters, name[i]) != NULL ) + if( strchr(charserv_config.char_config.char_name_letters, name[i]) != nullptr ) return -2; } if( charserv_config.char_config.name_ignoring_case ) { @@ -1589,16 +1589,16 @@ enum e_char_del_response char_delete(struct char_session_data* sd, uint32 char_i } Sql_GetData(sql_handle, 0, &data, &len); safestrncpy(name, data, NAME_LENGTH); - Sql_GetData(sql_handle, 1, &data, NULL); account_id = atoi(data); - Sql_GetData(sql_handle, 2, &data, NULL); party_id = atoi(data); - Sql_GetData(sql_handle, 3, &data, NULL); guild_id = atoi(data); - Sql_GetData(sql_handle, 4, &data, NULL); base_level = atoi(data); - Sql_GetData(sql_handle, 5, &data, NULL); hom_id = atoi(data); - Sql_GetData(sql_handle, 6, &data, NULL); partner_id = atoi(data); - Sql_GetData(sql_handle, 7, &data, NULL); father_id = atoi(data); - Sql_GetData(sql_handle, 8, &data, NULL); mother_id = atoi(data); - Sql_GetData(sql_handle, 9, &data, NULL); elemental_id = atoi(data); - Sql_GetData(sql_handle,10, &data, NULL); delete_date = strtoul(data, NULL, 10); + Sql_GetData(sql_handle, 1, &data, nullptr); account_id = atoi(data); + Sql_GetData(sql_handle, 2, &data, nullptr); party_id = atoi(data); + Sql_GetData(sql_handle, 3, &data, nullptr); guild_id = atoi(data); + Sql_GetData(sql_handle, 4, &data, nullptr); base_level = atoi(data); + Sql_GetData(sql_handle, 5, &data, nullptr); hom_id = atoi(data); + Sql_GetData(sql_handle, 6, &data, nullptr); partner_id = atoi(data); + Sql_GetData(sql_handle, 7, &data, nullptr); father_id = atoi(data); + Sql_GetData(sql_handle, 8, &data, nullptr); mother_id = atoi(data); + Sql_GetData(sql_handle, 9, &data, nullptr); elemental_id = atoi(data); + Sql_GetData(sql_handle,10, &data, nullptr); delete_date = strtoul(data, nullptr, 10); Sql_EscapeStringLen(sql_handle, esc_name, name, zmin(len, NAME_LENGTH)); Sql_FreeResult(sql_handle); @@ -1623,7 +1623,7 @@ enum e_char_del_response char_delete(struct char_session_data* sd, uint32 char_i return CHAR_DELETE_PARTY; } - if( charserv_config.char_config.char_del_delay > 0 && ( !delete_date || delete_date > time(NULL) ) ){ // not queued or delay not yet passed + if( charserv_config.char_config.char_del_delay > 0 && ( !delete_date || delete_date > time(nullptr) ) ){ // not queued or delay not yet passed ShowInfo("Char deletion aborted: %s, Time was not set or has not been reached ye\n", name ); return CHAR_DELETE_TIME; } @@ -1792,7 +1792,7 @@ int char_count_users(void) // Used in packets 0x6b (chars info) and 0x6d (new char info) // Returns the size int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p){ - if( buffer == NULL || p == NULL ) + if( buffer == nullptr || p == nullptr ) return 0; struct CHARACTER_INFO* info = (struct CHARACTER_INFO*)buffer; @@ -1851,7 +1851,7 @@ int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p){ #endif #if PACKETVER >= 20100803 #if PACKETVER_CHAR_DELETEDATE - info->DelRevDate = ( p->delete_date ? TOL( p->delete_date - time( NULL ) ) : 0 ); + info->DelRevDate = ( p->delete_date ? TOL( p->delete_date - time( nullptr ) ) : 0 ); #else info->DelRevDate = TOL( p->delete_date ); #endif @@ -1887,7 +1887,7 @@ int char_married(int pl1, int pl2) { char* data; - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); if( pl2 == atoi(data) ) { Sql_FreeResult(sql_handle); @@ -1908,7 +1908,7 @@ int char_child(int parent_id, int child_id) { char* data; - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); if( child_id == atoi(data) ) { Sql_FreeResult(sql_handle); @@ -1932,9 +1932,9 @@ int char_family(int cid1, int cid2, int cid3) int childid; char* data; - Sql_GetData(sql_handle, 0, &data, NULL); charid = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); partnerid = atoi(data); - Sql_GetData(sql_handle, 2, &data, NULL); childid = atoi(data); + Sql_GetData(sql_handle, 0, &data, nullptr); charid = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); partnerid = atoi(data); + Sql_GetData(sql_handle, 2, &data, nullptr); childid = atoi(data); if( (cid1 == charid && ((cid2 == partnerid && cid3 == childid ) || (cid2 == childid && cid3 == partnerid))) || (cid1 == partnerid && ((cid2 == charid && cid3 == childid ) || (cid2 == childid && cid3 == charid ))) || @@ -2029,7 +2029,7 @@ void char_read_fame_list(void) for( i = 0; i < fame_list_size_smith && SQL_SUCCESS == Sql_NextRow(sql_handle); ++i ) { // char_id - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); smith_fame_list[i].id = atoi(data); // fame Sql_GetData(sql_handle, 1, &data, &len); @@ -2044,7 +2044,7 @@ void char_read_fame_list(void) for( i = 0; i < fame_list_size_chemist && SQL_SUCCESS == Sql_NextRow(sql_handle); ++i ) { // char_id - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); chemist_fame_list[i].id = atoi(data); // fame Sql_GetData(sql_handle, 1, &data, &len); @@ -2059,7 +2059,7 @@ void char_read_fame_list(void) for( i = 0; i < fame_list_size_taekwon && SQL_SUCCESS == Sql_NextRow(sql_handle); ++i ) { // char_id - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); taekwon_fame_list[i].id = atoi(data); // fame Sql_GetData(sql_handle, 1, &data, &len); @@ -2249,7 +2249,7 @@ int char_lan_config_read(const char *lancfgName) { int line_num = 0, s_subnet=ARRAYLENGTH(subnet); char line[1024], w1[64], w2[64], w3[64], w4[64]; - if((fp = fopen(lancfgName, "r")) == NULL) { + if((fp = fopen(lancfgName, "r")) == nullptr) { ShowWarning("LAN Support configuration file is not found: %s\n", lancfgName); return 1; } @@ -2567,7 +2567,7 @@ void char_sql_config_read(const char* cfgName) { char line[1024], w1[1024], w2[1024]; FILE* fp; - if ((fp = fopen(cfgName, "r")) == NULL) { + if ((fp = fopen(cfgName, "r")) == nullptr) { ShowError("File not found: %s\n", cfgName); return; } @@ -2826,17 +2826,17 @@ void char_config_split_startpoint( char* w1_value, char* w2_value, struct s_poin (*count) = 0; // Reset to begin reading fields = (char **)aMalloc(fields_length * sizeof(char *)); - if (fields == NULL) + if (fields == nullptr) return; // Failed to allocate memory. lineitem = strtok(w2_value, ":"); - while (lineitem != NULL && (*count) < MAX_STARTPOINT) { + while (lineitem != nullptr && (*count) < MAX_STARTPOINT) { bool error; size_t n = sv_split( lineitem, strlen( lineitem ), 0, ',', fields, fields_length, SV_NOESCAPE_NOTERMINATE, error ); if( error || ( n + 1 ) < fields_length ){ ShowDebug("%s: not enough arguments for %s! Skipping...\n", w1_value, lineitem); - lineitem = strtok(NULL, ":"); //next lineitem + lineitem = strtok(nullptr, ":"); //next lineitem continue; } @@ -2845,7 +2845,7 @@ void char_config_split_startpoint( char* w1_value, char* w2_value, struct s_poin start_point[i].y = max( 0, atoi( fields[3] ) ); (*count)++; - lineitem = strtok(NULL, ":"); //next lineitem + lineitem = strtok(nullptr, ":"); //next lineitem i++; } aFree(fields); @@ -2864,17 +2864,17 @@ void char_config_split_startitem(char *w1_value, char *w2_value, struct startite size_t fields_length = 3 + 1; fields = (char **)aMalloc(fields_length * sizeof(char *)); - if (fields == NULL) + if (fields == nullptr) return; // Failed to allocate memory. lineitem = strtok(w2_value, ":"); - while (lineitem != NULL && i < MAX_STARTITEM) { + while (lineitem != nullptr && i < MAX_STARTITEM) { bool error; size_t n = sv_split( lineitem, strlen( lineitem ), 0, ',', fields, fields_length, SV_NOESCAPE_NOTERMINATE, error ); if( error || ( n + 1 ) < fields_length ){ ShowDebug("%s: not enough arguments for %s! Skipping...\n", w1_value, lineitem); - lineitem = strtok(NULL, ":"); //next lineitem + lineitem = strtok(nullptr, ":"); //next lineitem continue; } @@ -2884,7 +2884,7 @@ void char_config_split_startitem(char *w1_value, char *w2_value, struct startite start_items[i].amount = min( (uint16)strtoul( fields[2], nullptr, 10 ), MAX_AMOUNT ); start_items[i].pos = strtoul( fields[3], nullptr, 10 ); - lineitem = strtok(NULL, ":"); //next lineitem + lineitem = strtok(nullptr, ":"); //next lineitem i++; } aFree(fields); @@ -2894,7 +2894,7 @@ bool char_config_read(const char* cfgName, bool normal){ char line[1024], w1[1024], w2[1024]; FILE* fp = fopen(cfgName, "r"); - if (fp == NULL) { + if (fp == nullptr) { ShowError("Configuration file not found: %s.\n", cfgName); return false; } @@ -3242,7 +3242,7 @@ bool CharacterServer::initialize( int argc, char *argv[] ){ ShowFatalError("char : A tables is missing in sql-server, please fix it, see (sql-files main.sql for structure) \n"); return false; } - //Cleaning the tables for NULL entrys @ startup [Sirius] + //Cleaning the tables for nullptr entrys @ startup [Sirius] //Chardb clean if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = '0'", schema_config.char_db) ) Sql_ShowDebug(sql_handle); diff --git a/src/char/char_clif.cpp b/src/char/char_clif.cpp index d75db18b00..a2ce8b4a7d 100644 --- a/src/char/char_clif.cpp +++ b/src/char/char_clif.cpp @@ -452,7 +452,7 @@ void chclif_char_delete2_ack(int fd, uint32 char_id, uint32 result, time_t delet WFIFOL(fd,2) = char_id; WFIFOL(fd,6) = result; #if PACKETVER_CHAR_DELETEDATE - WFIFOL(fd,10) = TOL(delete_date-time(NULL)); + WFIFOL(fd,10) = TOL(delete_date-time(nullptr)); #else WFIFOL(fd,10) = TOL(delete_date); #endif @@ -522,9 +522,9 @@ int chclif_parse_char_delete2_req(int fd, struct char_session_data* sd) { return 1; } - Sql_GetData(sql_handle, 0, &data, NULL); delete_date = strtoul(data, NULL, 10); - Sql_GetData(sql_handle, 1, &data, NULL); party_id = strtoul(data, NULL, 10); - Sql_GetData(sql_handle, 2, &data, NULL); guild_id = strtoul(data, NULL, 10); + Sql_GetData(sql_handle, 0, &data, nullptr); delete_date = strtoul(data, nullptr, 10); + Sql_GetData(sql_handle, 1, &data, nullptr); party_id = strtoul(data, nullptr, 10); + Sql_GetData(sql_handle, 2, &data, nullptr); guild_id = strtoul(data, nullptr, 10); if( delete_date ) {// character already queued for deletion chclif_char_delete2_ack(fd, char_id, 0, 0); @@ -544,7 +544,7 @@ int chclif_parse_char_delete2_req(int fd, struct char_session_data* sd) { } // success - delete_date = time(NULL)+(charserv_config.char_config.char_del_delay); + delete_date = time(nullptr)+(charserv_config.char_config.char_del_delay); if( SQL_SUCCESS != Sql_Query(sql_handle, "UPDATE `%s` SET `delete_date`='%lu' WHERE `char_id`='%d'", schema_config.char_db, (unsigned long)delete_date, char_id) ) { @@ -853,7 +853,7 @@ int chclif_parse_select_accessible_map( int fd, struct char_session_data* sd, ui } /* client doesn't let it get to this point if you're banned, so its a forged packet */ - if( sd->found_char[p.slot] == char_id && sd->unban_time[p.slot] > time(NULL) ) { + if( sd->found_char[p.slot] == char_id && sd->unban_time[p.slot] > time(nullptr) ) { chclif_reject( fd, 0 ); // rejected from server return 1; } @@ -1000,7 +1000,7 @@ int chclif_parse_charselect(int fd, struct char_session_data* sd,uint32 ipl){ // Check if the character exists and is not scheduled for deletion if ( SQL_SUCCESS != Sql_Query(sql_handle, "SELECT `char_id` FROM `%s` WHERE `account_id`='%d' AND `char_num`='%d' AND `delete_date` = 0", schema_config.char_db, sd->account_id, slot) || SQL_SUCCESS != Sql_NextRow(sql_handle) - || SQL_SUCCESS != Sql_GetData(sql_handle, 0, &data, NULL) ) + || SQL_SUCCESS != Sql_GetData(sql_handle, 0, &data, nullptr) ) { //Not found?? May be forged packet. Sql_ShowDebug(sql_handle); Sql_FreeResult(sql_handle); @@ -1018,7 +1018,7 @@ int chclif_parse_charselect(int fd, struct char_session_data* sd,uint32 ipl){ } /* client doesn't let it get to this point if you're banned, so its a forged packet */ - if( sd->found_char[slot] == char_id && sd->unban_time[slot] > time(NULL) ) { + if( sd->found_char[slot] == char_id && sd->unban_time[slot] > time(nullptr) ) { chclif_reject(fd, 0); // rejected from server return 1; } @@ -1087,7 +1087,7 @@ int chclif_parse_charselect(int fd, struct char_session_data* sd,uint32 ipl){ //Send NEW auth packet [Kevin] //FIXME: is this case even possible? [ultramage] - if ((map_fd = map_server[i].fd) < 1 || session[map_fd] == NULL) + if ((map_fd = map_server[i].fd) < 1 || session[map_fd] == nullptr) { ShowError("parse_char: Attempting to write to invalid session %d! Map Server #%d disconnected.\n", map_fd, i); map_server[i] = {}; @@ -1348,11 +1348,11 @@ int chclif_parse_reqrename( int fd, struct char_session_data* sd ){ TIMER_FUNC(charblock_timer){ - struct char_session_data* sd=NULL; + struct char_session_data* sd=nullptr; int i=0; ARR_FIND( 0, fd_max, i, session[i] && (sd = (struct char_session_data*)session[i]->session_data) && sd->account_id == id); - if(sd == NULL || sd->charblock_timer==INVALID_TIMER) //has disconected or was required to stop + if(sd == nullptr || sd->charblock_timer==INVALID_TIMER) //has disconected or was required to stop return 0; if (sd->charblock_timer != tid){ sd->charblock_timer = INVALID_TIMER; @@ -1368,7 +1368,7 @@ TIMER_FUNC(charblock_timer){ */ void chclif_block_character( int fd, struct char_session_data* sd){ int i=0, j=0, len=4; - time_t now = time(NULL); + time_t now = time(nullptr); WFIFOHEAD(fd, 4+MAX_CHARS*24); WFIFOW(fd, 0) = 0x20d; @@ -1532,7 +1532,7 @@ int chclif_parse(int fd) { set_eof(fd); if(session[fd]->flag.eof) { - if( sd != NULL && sd->auth ) { // already authed client + if( sd != nullptr && sd->auth ) { // already authed client std::shared_ptr data = util::umap_find( char_get_onlinedb(), sd->account_id ); if( data != nullptr && data->fd == fd ){ @@ -1596,7 +1596,7 @@ int chclif_parse(int fd) { break; // unknown packet received default: - ShowError("parse_char: Received unknown packet " CL_WHITE "0x%x" CL_RESET " from ip '" CL_WHITE "%s" CL_RESET "'! Disconnecting!\n", RFIFOW(fd,0), ip2str(ipl, NULL)); + ShowError("parse_char: Received unknown packet " CL_WHITE "0x%x" CL_RESET " from ip '" CL_WHITE "%s" CL_RESET "'! Disconnecting!\n", RFIFOW(fd,0), ip2str(ipl, nullptr)); set_eof(fd); return 0; } diff --git a/src/char/char_cnslif.cpp b/src/char/char_cnslif.cpp index 392f5b6b06..ea0187ff47 100644 --- a/src/char/char_cnslif.cpp +++ b/src/char/char_cnslif.cpp @@ -47,7 +47,7 @@ TIMER_FUNC(cnslif_console_timer){ memset(buf,0,MAX_CONSOLE_IN); //clear out buf if(cli_hasevent()){ - if(fgets(buf, MAX_CONSOLE_IN, stdin)==NULL) + if(fgets(buf, MAX_CONSOLE_IN, stdin)==nullptr) return -1; else if(strlen(buf)>MIN_CONSOLE_IN) cnslif_parse(buf); diff --git a/src/char/char_logif.cpp b/src/char/char_logif.cpp index 72db97c65b..1e0cf3c3b2 100644 --- a/src/char/char_logif.cpp +++ b/src/char/char_logif.cpp @@ -62,7 +62,7 @@ void chlogif_pincode_start(int fd, struct char_session_data* sd){ } }else{ if( !(charserv_config.pincode_config.pincode_changetime) - || ( sd->pincode_change + charserv_config.pincode_config.pincode_changetime ) > time(NULL) ){ + || ( sd->pincode_change + charserv_config.pincode_config.pincode_changetime ) > time(nullptr) ){ std::shared_ptr node = util::umap_find( char_get_onlinedb(), sd->account_id ); if( node != nullptr && node->pincode_success ){ @@ -491,9 +491,9 @@ int chlogif_parse_ackchangesex(int fd) SqlStmt_Free(stmt); } - SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &char_id, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 1, SQLDT_SHORT, &class_, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, NULL, NULL); + SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &char_id, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 1, SQLDT_SHORT, &class_, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, nullptr, nullptr); for (i = 0; i < MAX_CHARS && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i) { chlogif_parse_change_sex_sub(sex, acc, char_id, class_, guild_id); @@ -536,9 +536,9 @@ int chlogif_parse_ackchangecharsex(int char_id, int sex) return 1; } - Sql_GetData(sql_handle, 0, &data, NULL); account_id = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); class_ = atoi(data); - Sql_GetData(sql_handle, 2, &data, NULL); guild_id = atoi(data); + Sql_GetData(sql_handle, 0, &data, nullptr); account_id = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); class_ = atoi(data); + Sql_GetData(sql_handle, 2, &data, nullptr); guild_id = atoi(data); Sql_FreeResult(sql_handle); chlogif_parse_change_sex_sub(sex, account_id, char_id, class_, guild_id); @@ -722,7 +722,7 @@ int chlogif_parse_AccInfoAck(int fd) { else { int8 type = RFIFOB(fd, 18); if (type == 0 || RFIFOREST(fd) < 122+NAME_LENGTH) { - mapif_accinfo_ack(false, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), 0, -1, 0, 0, NULL, NULL, NULL, NULL, NULL); + mapif_accinfo_ack(false, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), 0, -1, 0, 0, nullptr, nullptr, nullptr, nullptr, nullptr); RFIFOSKIP(fd,19); return 1; } diff --git a/src/char/char_mapif.cpp b/src/char/char_mapif.cpp index a2c7282d9f..5e04a87669 100644 --- a/src/char/char_mapif.cpp +++ b/src/char/char_mapif.cpp @@ -305,12 +305,12 @@ int chmapif_parse_askscdata(int fd){ WFIFOL(fd,8) = cid; for( count = 0; count < 50 && SQL_SUCCESS == Sql_NextRow(sql_handle); ++count ) { - Sql_GetData(sql_handle, 0, &data, NULL); scdata.type = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); scdata.tick = strtoll( data, nullptr, 10 ); - Sql_GetData(sql_handle, 2, &data, NULL); scdata.val1 = atoi(data); - Sql_GetData(sql_handle, 3, &data, NULL); scdata.val2 = atoi(data); - Sql_GetData(sql_handle, 4, &data, NULL); scdata.val3 = atoi(data); - Sql_GetData(sql_handle, 5, &data, NULL); scdata.val4 = atoi(data); + Sql_GetData(sql_handle, 0, &data, nullptr); scdata.type = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); scdata.tick = strtoll( data, nullptr, 10 ); + Sql_GetData(sql_handle, 2, &data, nullptr); scdata.val1 = atoi(data); + Sql_GetData(sql_handle, 3, &data, nullptr); scdata.val2 = atoi(data); + Sql_GetData(sql_handle, 4, &data, nullptr); scdata.val3 = atoi(data); + Sql_GetData(sql_handle, 5, &data, nullptr); scdata.val4 = atoi(data); memcpy(WFIFOP(fd, 14+count*sizeof(struct status_change_data)), &scdata, sizeof(struct status_change_data)); } if (count >= 50) @@ -566,8 +566,8 @@ int chmapif_parse_req_skillcooldown(int fd){ WFIFOL(fd,8) = cid; for( count = 0; count < MAX_SKILLCOOLDOWN && SQL_SUCCESS == Sql_NextRow(sql_handle); ++count ) { - Sql_GetData(sql_handle, 0, &data, NULL); scd.skill_id = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); scd.tick = strtoll( data, nullptr, 10 ); + Sql_GetData(sql_handle, 0, &data, nullptr); scd.skill_id = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); scd.tick = strtoll( data, nullptr, 10 ); memcpy(WFIFOP(fd,14+count*sizeof(struct skill_cooldown_data)), &scd, sizeof(struct skill_cooldown_data)); } if( count >= MAX_SKILLCOOLDOWN ) @@ -780,8 +780,8 @@ int chmapif_parse_fwlog_changestatus(int fd){ int t_cid; // target char id char* data; - Sql_GetData(sql_handle, 0, &data, NULL); t_aid = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); t_cid = atoi(data); + Sql_GetData(sql_handle, 0, &data, nullptr); t_aid = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); t_cid = atoi(data); Sql_FreeResult(sql_handle); if(!chlogif_isconnected()) @@ -1049,8 +1049,8 @@ int chmapif_parse_reqauth(int fd, int id){ char_set_char_online(id, char_id, account_id); } else if( global_core->is_running() && - cd != NULL && - node != NULL && + cd != nullptr && + node != nullptr && node->account_id == account_id && node->char_id == char_id && node->login_id1 == login_id1 @@ -1128,7 +1128,7 @@ int chmapif_parse_updfamelist(int fd){ case RANK_BLACKSMITH: size = fame_list_size_smith; list = smith_fame_list; break; case RANK_ALCHEMIST: size = fame_list_size_chemist; list = chemist_fame_list; break; case RANK_TAEKWON: size = fame_list_size_taekwon; list = taekwon_fame_list; break; - default: size = 0; list = NULL; break; + default: size = 0; list = nullptr; break; } ARR_FIND(0, size, player_pos, list[player_pos].id == cid);// position of the player @@ -1206,12 +1206,12 @@ int chmapif_parse_reqcharban(int fd){ int t_cid=0,t_aid=0; char* data; time_t unban_time; - time_t now = time(NULL); + time_t now = time(nullptr); SqlStmt* stmt = SqlStmt_Malloc(sql_handle); - Sql_GetData(sql_handle, 0, &data, NULL); t_aid = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); t_cid = atoi(data); - Sql_GetData(sql_handle, 2, &data, NULL); unban_time = atol(data); + Sql_GetData(sql_handle, 0, &data, nullptr); t_aid = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); t_cid = atoi(data); + Sql_GetData(sql_handle, 2, &data, nullptr); unban_time = atol(data); Sql_FreeResult(sql_handle); if(timediff<0 && unban_time==0) @@ -1292,11 +1292,11 @@ int chmapif_bonus_script_get(int fd) { "SELECT `script`, `tick`, `flag`, `type`, `icon` FROM `%s` WHERE `char_id` = '%d' LIMIT %d", schema_config.bonus_script_db, cid, MAX_PC_BONUS_SCRIPT) || SQL_ERROR == SqlStmt_Execute(stmt) || - SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &tmp_bsdata.script_str, sizeof(tmp_bsdata.script_str), NULL, NULL) || - SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_INT64, &tmp_bsdata.tick, 0, NULL, NULL) || - SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_UINT16, &tmp_bsdata.flag, 0, NULL, NULL) || - SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_UINT8, &tmp_bsdata.type, 0, NULL, NULL) || - SQL_ERROR == SqlStmt_BindColumn(stmt, 4, SQLDT_INT16, &tmp_bsdata.icon, 0, NULL, NULL) + SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &tmp_bsdata.script_str, sizeof(tmp_bsdata.script_str), nullptr, nullptr) || + SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_INT64, &tmp_bsdata.tick, 0, nullptr, nullptr) || + SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_UINT16, &tmp_bsdata.flag, 0, nullptr, nullptr) || + SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_UINT8, &tmp_bsdata.type, 0, nullptr, nullptr) || + SQL_ERROR == SqlStmt_BindColumn(stmt, 4, SQLDT_INT16, &tmp_bsdata.icon, 0, nullptr, nullptr) ) { SqlStmt_ShowDebug(stmt); diff --git a/src/char/int_achievement.cpp b/src/char/int_achievement.cpp index 68c88238ec..f6d72fcc00 100644 --- a/src/char/int_achievement.cpp +++ b/src/char/int_achievement.cpp @@ -27,14 +27,14 @@ */ struct achievement *mapif_achievements_fromsql(uint32 char_id, int *count) { - struct achievement *achievelog = NULL; + struct achievement *achievelog = nullptr; struct achievement tmp_achieve; SqlStmt *stmt; StringBuf buf; int i; if (!count) - return NULL; + return nullptr; memset(&tmp_achieve, 0, sizeof(tmp_achieve)); @@ -52,14 +52,14 @@ struct achievement *mapif_achievements_fromsql(uint32 char_id, int *count) SqlStmt_Free(stmt); StringBuf_Destroy(&buf); *count = 0; - return NULL; + return nullptr; } - SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &tmp_achieve.achievement_id, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 1, SQLDT_INT, &tmp_achieve.completed, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 2, SQLDT_INT, &tmp_achieve.rewarded, 0, NULL, NULL); + SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &tmp_achieve.achievement_id, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 1, SQLDT_INT, &tmp_achieve.completed, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 2, SQLDT_INT, &tmp_achieve.rewarded, 0, nullptr, nullptr); for (i = 0; i < MAX_ACHIEVEMENT_OBJECTIVES; ++i) - SqlStmt_BindColumn(stmt, 3 + i, SQLDT_INT, &tmp_achieve.count[i], 0, NULL, NULL); + SqlStmt_BindColumn(stmt, 3 + i, SQLDT_INT, &tmp_achieve.count[i], 0, nullptr, nullptr); *count = (int)SqlStmt_NumRows(stmt); if (*count > 0) { @@ -209,7 +209,7 @@ int mapif_parse_achievement_save(int fd) { int i, j, k, old_n, new_n = (RFIFOW(fd, 2) - 8) / sizeof(struct achievement); uint32 char_id = RFIFOL(fd, 4); - struct achievement *old_ad = NULL, *new_ad = NULL; + struct achievement *old_ad = nullptr, *new_ad = nullptr; bool success = true; if (new_n > 0) @@ -257,7 +257,7 @@ int mapif_parse_achievement_save(int fd) * Sends the achievementlog of a character to the map-server. */ void mapif_achievement_load( int fd, uint32 char_id ){ - struct achievement *tmp_achievementlog = NULL; + struct achievement *tmp_achievementlog = nullptr; int num_achievements = 0; tmp_achievementlog = mapif_achievements_fromsql(char_id, &num_achievements); @@ -305,7 +305,7 @@ void mapif_achievement_reward( int fd, uint32 char_id, int32 achievement_id, tim * @see inter_parse_frommap */ int mapif_parse_achievement_reward(int fd){ - time_t current = time(NULL); + time_t current = time(nullptr); uint32 char_id = RFIFOL(fd, 2); int32 achievement_id = RFIFOL(fd, 6); diff --git a/src/char/int_auction.cpp b/src/char/int_auction.cpp index 24b4a0718d..ed3740ba17 100644 --- a/src/char/int_auction.cpp +++ b/src/char/int_auction.cpp @@ -88,7 +88,7 @@ uint32 auction_create( std::shared_ptr auction ){ if( !auction ) return false; - auction->timestamp = time(NULL) + (auction->hours * 3600); + auction->timestamp = time(nullptr) + (auction->hours * 3600); StringBuf_Init(&buf); StringBuf_Printf(&buf, "INSERT INTO `%s` (`seller_id`,`seller_name`,`buyer_id`,`buyer_name`,`price`,`buynow`,`hours`,`timestamp`,`nameid`,`item_name`,`type`,`refine`,`attribute`,`unique_id`,`enchantgrade`", schema_config.auction_db); @@ -159,7 +159,7 @@ TIMER_FUNC(auction_end_timer){ { mail_sendmail(0, msg_txt(200), auction->buyer_id, auction->buyer_name, msg_txt(201), msg_txt(202), 0, &auction->item, 1); mapif_Auction_message(auction->buyer_id, 6); // You have won the auction - mail_sendmail(0, msg_txt(200), auction->seller_id, auction->seller_name, msg_txt(201), msg_txt(203), auction->price, NULL, 0); + mail_sendmail(0, msg_txt(200), auction->seller_id, auction->seller_name, msg_txt(201), msg_txt(203), auction->price, nullptr, 0); } else mail_sendmail(0, msg_txt(200), auction->seller_id, auction->seller_name, msg_txt(201), msg_txt(204), 0, &auction->item, 1); @@ -191,7 +191,7 @@ void inter_auctions_fromsql(void) char *data; StringBuf buf; t_tick tick = gettick(), endtick; - time_t now = time(NULL); + time_t now = time(nullptr); StringBuf_Init(&buf); StringBuf_AppendStr(&buf, "SELECT `auction_id`,`seller_id`,`seller_name`,`buyer_id`,`buyer_name`," @@ -215,25 +215,25 @@ void inter_auctions_fromsql(void) struct item *item; std::shared_ptr auction = std::make_shared(); - Sql_GetData(sql_handle, 0, &data, NULL); auction->auction_id = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); auction->seller_id = atoi(data); - Sql_GetData(sql_handle, 2, &data, NULL); safestrncpy(auction->seller_name, data, NAME_LENGTH); - Sql_GetData(sql_handle, 3, &data, NULL); auction->buyer_id = atoi(data); - Sql_GetData(sql_handle, 4, &data, NULL); safestrncpy(auction->buyer_name, data, NAME_LENGTH); - Sql_GetData(sql_handle, 5, &data, NULL); auction->price = atoi(data); - Sql_GetData(sql_handle, 6, &data, NULL); auction->buynow = atoi(data); - Sql_GetData(sql_handle, 7, &data, NULL); auction->hours = atoi(data); - Sql_GetData(sql_handle, 8, &data, NULL); auction->timestamp = atoi(data); + Sql_GetData(sql_handle, 0, &data, nullptr); auction->auction_id = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); auction->seller_id = atoi(data); + Sql_GetData(sql_handle, 2, &data, nullptr); safestrncpy(auction->seller_name, data, NAME_LENGTH); + Sql_GetData(sql_handle, 3, &data, nullptr); auction->buyer_id = atoi(data); + Sql_GetData(sql_handle, 4, &data, nullptr); safestrncpy(auction->buyer_name, data, NAME_LENGTH); + Sql_GetData(sql_handle, 5, &data, nullptr); auction->price = atoi(data); + Sql_GetData(sql_handle, 6, &data, nullptr); auction->buynow = atoi(data); + Sql_GetData(sql_handle, 7, &data, nullptr); auction->hours = atoi(data); + Sql_GetData(sql_handle, 8, &data, nullptr); auction->timestamp = atoi(data); item = &auction->item; - Sql_GetData(sql_handle, 9, &data, NULL); item->nameid = strtoul(data, nullptr, 10); - Sql_GetData(sql_handle,10, &data, NULL); safestrncpy(auction->item_name, data, ITEM_NAME_LENGTH); - Sql_GetData(sql_handle,11, &data, NULL); auction->type = atoi(data); + Sql_GetData(sql_handle, 9, &data, nullptr); item->nameid = strtoul(data, nullptr, 10); + Sql_GetData(sql_handle,10, &data, nullptr); safestrncpy(auction->item_name, data, ITEM_NAME_LENGTH); + Sql_GetData(sql_handle,11, &data, nullptr); auction->type = atoi(data); - Sql_GetData(sql_handle,12, &data, NULL); item->refine = atoi(data); - Sql_GetData(sql_handle,13, &data, NULL); item->attribute = atoi(data); - Sql_GetData(sql_handle,14, &data, NULL); item->unique_id = strtoull(data, NULL, 10); - Sql_GetData(sql_handle,15, &data, NULL); item->enchantgrade = atoi(data); + Sql_GetData(sql_handle,12, &data, nullptr); item->refine = atoi(data); + Sql_GetData(sql_handle,13, &data, nullptr); item->attribute = atoi(data); + Sql_GetData(sql_handle,14, &data, nullptr); item->unique_id = strtoull(data, nullptr, 10); + Sql_GetData(sql_handle,15, &data, nullptr); item->enchantgrade = atoi(data); item->identify = 1; item->amount = 1; @@ -241,16 +241,16 @@ void inter_auctions_fromsql(void) for( i = 0; i < MAX_SLOTS; i++ ) { - Sql_GetData(sql_handle, 16 + i, &data, NULL); + Sql_GetData(sql_handle, 16 + i, &data, nullptr); item->card[i] = strtoul(data, nullptr, 10); } for (i = 0; i < MAX_ITEM_RDM_OPT; i++) { - Sql_GetData(sql_handle, 16 + MAX_SLOTS + i*3, &data, NULL); + Sql_GetData(sql_handle, 16 + MAX_SLOTS + i*3, &data, nullptr); item->option[i].id = atoi(data); - Sql_GetData(sql_handle, 17 + MAX_SLOTS + i*3, &data, NULL); + Sql_GetData(sql_handle, 17 + MAX_SLOTS + i*3, &data, nullptr); item->option[i].value = atoi(data); - Sql_GetData(sql_handle, 18 + MAX_SLOTS + i*3, &data, NULL); + Sql_GetData(sql_handle, 18 + MAX_SLOTS + i*3, &data, nullptr); item->option[i].param = atoi(data); } @@ -423,7 +423,7 @@ void mapif_parse_Auction_close(int fd) } // Send Money to Seller - mail_sendmail(0, msg_txt(200), auction->seller_id, auction->seller_name, msg_txt(201), msg_txt(206), auction->price, NULL, 0); + mail_sendmail(0, msg_txt(200), auction->seller_id, auction->seller_name, msg_txt(201), msg_txt(206), auction->price, nullptr, 0); // Send Item to Buyer mail_sendmail(0, msg_txt(200), auction->buyer_id, auction->buyer_name, msg_txt(201), msg_txt(207), 0, &auction->item, 1); mapif_Auction_message(auction->buyer_id, 6); // You have won the auction @@ -463,11 +463,11 @@ void mapif_parse_Auction_bid(int fd) { // Send Money back to the previous Buyer if( auction->buyer_id != char_id ) { - mail_sendmail(0, msg_txt(200), auction->buyer_id, auction->buyer_name, msg_txt(201), msg_txt(208), auction->price, NULL, 0); + mail_sendmail(0, msg_txt(200), auction->buyer_id, auction->buyer_name, msg_txt(201), msg_txt(208), auction->price, nullptr, 0); mapif_Auction_message(auction->buyer_id, 7); // You have failed to win the auction } else - mail_sendmail(0, msg_txt(200), auction->buyer_id, auction->buyer_name, msg_txt(201), msg_txt(209), auction->price, NULL, 0); + mail_sendmail(0, msg_txt(200), auction->buyer_id, auction->buyer_name, msg_txt(201), msg_txt(209), auction->price, nullptr, 0); } auction->buyer_id = char_id; @@ -480,7 +480,7 @@ void mapif_parse_Auction_bid(int fd) mail_sendmail(0, msg_txt(200), auction->buyer_id, auction->buyer_name, msg_txt(201), msg_txt(210), 0, &auction->item, 1); mapif_Auction_message(char_id, 6); // You have won the auction - mail_sendmail(0, msg_txt(200), auction->seller_id, auction->seller_name, msg_txt(201), msg_txt(211), auction->buynow, NULL, 0); + mail_sendmail(0, msg_txt(200), auction->seller_id, auction->seller_name, msg_txt(201), msg_txt(211), auction->buynow, nullptr, 0); auction_delete(auction); return; diff --git a/src/char/int_clan.cpp b/src/char/int_clan.cpp index e89dab519e..4359e1d23a 100644 --- a/src/char/int_clan.cpp +++ b/src/char/int_clan.cpp @@ -63,7 +63,7 @@ std::shared_ptr inter_clan_fromsql(int clan_id){ Sql_GetData(sql_handle, 0, &data, &len); memcpy(clan->name, data, min(len, NAME_LENGTH)); Sql_GetData(sql_handle, 1, &data, &len); memcpy(clan->master, data, min(len, NAME_LENGTH)); Sql_GetData(sql_handle, 2, &data, &len); memcpy(clan->map, data, min(len, MAP_NAME_LENGTH_EXT)); - Sql_GetData(sql_handle, 3, &data, NULL); clan->max_member = atoi(data); + Sql_GetData(sql_handle, 3, &data, nullptr); clan->max_member = atoi(data); clan->connect_member = 0; @@ -82,8 +82,8 @@ std::shared_ptr inter_clan_fromsql(int clan_id){ for( i = 0; i < MAX_CLANALLIANCE && SQL_SUCCESS == Sql_NextRow(sql_handle); i++ ){ struct clan_alliance* a = &clan->alliance[i]; - Sql_GetData(sql_handle, 0, &data, NULL); a->opposition = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); a->clan_id = atoi(data); + Sql_GetData(sql_handle, 0, &data, nullptr); a->opposition = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); a->clan_id = atoi(data); Sql_GetData(sql_handle, 2, &data, &len); memcpy(a->name, data, zmin(len, NAME_LENGTH)); } diff --git a/src/char/int_elemental.cpp b/src/char/int_elemental.cpp index 9037f5a1ac..3d1dfa346f 100644 --- a/src/char/int_elemental.cpp +++ b/src/char/int_elemental.cpp @@ -61,21 +61,21 @@ bool mapif_elemental_load(int ele_id, uint32 char_id, struct s_elemental *ele) { return false; } - Sql_GetData(sql_handle, 0, &data, NULL); ele->class_ = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); ele->mode = (e_mode)atoi(data); - Sql_GetData(sql_handle, 2, &data, NULL); ele->hp = atoi(data); - Sql_GetData(sql_handle, 3, &data, NULL); ele->sp = atoi(data); - Sql_GetData(sql_handle, 4, &data, NULL); ele->max_hp = atoi(data); - Sql_GetData(sql_handle, 5, &data, NULL); ele->max_sp = atoi(data); - Sql_GetData(sql_handle, 6, &data, NULL); ele->atk = atoi(data); - Sql_GetData(sql_handle, 7, &data, NULL); ele->atk2 = atoi(data); - Sql_GetData(sql_handle, 8, &data, NULL); ele->matk = atoi(data); - Sql_GetData(sql_handle, 9, &data, NULL); ele->amotion = atoi(data); - Sql_GetData(sql_handle, 10, &data, NULL); ele->def = atoi(data); - Sql_GetData(sql_handle, 11, &data, NULL); ele->mdef = atoi(data); - Sql_GetData(sql_handle, 12, &data, NULL); ele->flee = atoi(data); - Sql_GetData(sql_handle, 13, &data, NULL); ele->hit = atoi(data); - Sql_GetData(sql_handle, 14, &data, NULL); ele->life_time = strtoll( data, nullptr, 10 ); + Sql_GetData(sql_handle, 0, &data, nullptr); ele->class_ = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); ele->mode = (e_mode)atoi(data); + Sql_GetData(sql_handle, 2, &data, nullptr); ele->hp = atoi(data); + Sql_GetData(sql_handle, 3, &data, nullptr); ele->sp = atoi(data); + Sql_GetData(sql_handle, 4, &data, nullptr); ele->max_hp = atoi(data); + Sql_GetData(sql_handle, 5, &data, nullptr); ele->max_sp = atoi(data); + Sql_GetData(sql_handle, 6, &data, nullptr); ele->atk = atoi(data); + Sql_GetData(sql_handle, 7, &data, nullptr); ele->atk2 = atoi(data); + Sql_GetData(sql_handle, 8, &data, nullptr); ele->matk = atoi(data); + Sql_GetData(sql_handle, 9, &data, nullptr); ele->amotion = atoi(data); + Sql_GetData(sql_handle, 10, &data, nullptr); ele->def = atoi(data); + Sql_GetData(sql_handle, 11, &data, nullptr); ele->mdef = atoi(data); + Sql_GetData(sql_handle, 12, &data, nullptr); ele->flee = atoi(data); + Sql_GetData(sql_handle, 13, &data, nullptr); ele->hit = atoi(data); + Sql_GetData(sql_handle, 14, &data, nullptr); ele->life_time = strtoll( data, nullptr, 10 ); Sql_FreeResult(sql_handle); if( charserv_config.save_log ) ShowInfo("Elemental loaded (ID: %d / Class: %d / CID: %d).\n", ele->elemental_id, ele->class_, ele->char_id); diff --git a/src/char/int_guild.cpp b/src/char/int_guild.cpp index 0520f4deae..123ddbe580 100644 --- a/src/char/int_guild.cpp +++ b/src/char/int_guild.cpp @@ -368,23 +368,23 @@ std::shared_ptr inter_guild_fromsql( int32 guild_id ){ g->guild.guild_id = guild_id; Sql_GetData(sql_handle, 0, &data, &len); memcpy(g->guild.name, data, zmin(len, NAME_LENGTH)); Sql_GetData(sql_handle, 1, &data, &len); memcpy(g->guild.master, data, zmin(len, NAME_LENGTH)); - Sql_GetData(sql_handle, 2, &data, NULL); g->guild.guild_lv = atoi(data); - Sql_GetData(sql_handle, 3, &data, NULL); g->guild.connect_member = atoi(data); - Sql_GetData(sql_handle, 4, &data, NULL); g->guild.max_member = atoi(data); + Sql_GetData(sql_handle, 2, &data, nullptr); g->guild.guild_lv = atoi(data); + Sql_GetData(sql_handle, 3, &data, nullptr); g->guild.connect_member = atoi(data); + Sql_GetData(sql_handle, 4, &data, nullptr); g->guild.max_member = atoi(data); if( g->guild.max_member > MAX_GUILD ) { // Fix reduction of MAX_GUILD [PoW] ShowWarning("Guild %d:%s specifies higher capacity (%d) than MAX_GUILD (%d)\n", guild_id, g->guild.name, g->guild.max_member, MAX_GUILD); g->guild.max_member = MAX_GUILD; } - Sql_GetData(sql_handle, 5, &data, NULL); g->guild.average_lv = atoi(data); - Sql_GetData(sql_handle, 6, &data, NULL); g->guild.exp = strtoull(data, NULL, 10); - Sql_GetData(sql_handle, 7, &data, NULL); g->guild.next_exp = strtoull(data, nullptr, 10); - Sql_GetData(sql_handle, 8, &data, NULL); g->guild.skill_point = atoi(data); + Sql_GetData(sql_handle, 5, &data, nullptr); g->guild.average_lv = atoi(data); + Sql_GetData(sql_handle, 6, &data, nullptr); g->guild.exp = strtoull(data, nullptr, 10); + Sql_GetData(sql_handle, 7, &data, nullptr); g->guild.next_exp = strtoull(data, nullptr, 10); + Sql_GetData(sql_handle, 8, &data, nullptr); g->guild.skill_point = atoi(data); Sql_GetData(sql_handle, 9, &data, &len); memcpy(g->guild.mes1, data, zmin(len, sizeof(g->guild.mes1))); Sql_GetData(sql_handle, 10, &data, &len); memcpy(g->guild.mes2, data, zmin(len, sizeof(g->guild.mes2))); Sql_GetData(sql_handle, 11, &data, &len); g->guild.emblem_len = atoi(data); Sql_GetData(sql_handle, 12, &data, &len); g->guild.emblem_id = atoi(data); - Sql_GetData(sql_handle, 13, &data, NULL); g->guild.last_leader_change = atoi(data); + Sql_GetData(sql_handle, 13, &data, nullptr); g->guild.last_leader_change = atoi(data); Sql_GetData(sql_handle, 14, &data, &len); // convert emblem data from hexadecimal to binary //TODO: why not store it in the db as binary directly? [ultramage] @@ -419,11 +419,11 @@ std::shared_ptr inter_guild_fromsql( int32 guild_id ){ { struct guild_member* m = &g->guild.member[i]; - Sql_GetData(sql_handle, 0, &data, NULL); m->account_id = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); m->char_id = atoi(data); - Sql_GetData(sql_handle, 2, &data, NULL); m->hair = atoi(data); - Sql_GetData(sql_handle, 3, &data, NULL); m->hair_color = atoi(data); - Sql_GetData(sql_handle, 4, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); m->account_id = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); m->char_id = atoi(data); + Sql_GetData(sql_handle, 2, &data, nullptr); m->hair = atoi(data); + Sql_GetData(sql_handle, 3, &data, nullptr); m->hair_color = atoi(data); + Sql_GetData(sql_handle, 4, &data, nullptr); switch( *data ){ case 'F': m->gender = SEX_FEMALE; @@ -436,15 +436,15 @@ std::shared_ptr inter_guild_fromsql( int32 guild_id ){ m->gender = SEX_MALE; break; } - Sql_GetData(sql_handle, 5, &data, NULL); m->class_ = atoi(data); - Sql_GetData(sql_handle, 6, &data, NULL); m->lv = atoi(data); - Sql_GetData(sql_handle, 7, &data, NULL); m->exp = strtoull(data, NULL, 10); - Sql_GetData(sql_handle, 8, &data, NULL); m->online = atoi(data); - Sql_GetData(sql_handle, 9, &data, NULL); m->position = atoi(data); + Sql_GetData(sql_handle, 5, &data, nullptr); m->class_ = atoi(data); + Sql_GetData(sql_handle, 6, &data, nullptr); m->lv = atoi(data); + Sql_GetData(sql_handle, 7, &data, nullptr); m->exp = strtoull(data, nullptr, 10); + Sql_GetData(sql_handle, 8, &data, nullptr); m->online = atoi(data); + Sql_GetData(sql_handle, 9, &data, nullptr); m->position = atoi(data); if( m->position >= MAX_GUILDPOSITION ) // Fix reduction of MAX_GUILDPOSITION [PoW] m->position = MAX_GUILDPOSITION - 1; Sql_GetData(sql_handle, 10, &data, &len); memcpy(m->name, data, zmin(len, NAME_LENGTH)); - Sql_GetData(sql_handle, 11, &data, NULL); m->last_login = atoi(data); + Sql_GetData(sql_handle, 11, &data, nullptr); m->last_login = atoi(data); m->modified = GS_MEMBER_UNMODIFIED; } @@ -459,13 +459,13 @@ std::shared_ptr inter_guild_fromsql( int32 guild_id ){ int position; struct guild_position* gpos; - Sql_GetData(sql_handle, 0, &data, NULL); position = atoi(data); + Sql_GetData(sql_handle, 0, &data, nullptr); position = atoi(data); if( position < 0 || position >= MAX_GUILDPOSITION ) continue;// invalid position gpos = &g->guild.position[position]; Sql_GetData(sql_handle, 1, &data, &len); memcpy(gpos->name, data, zmin(len, NAME_LENGTH)); - Sql_GetData(sql_handle, 2, &data, NULL); gpos->mode = atoi(data); - Sql_GetData(sql_handle, 3, &data, NULL); gpos->exp_mode = atoi(data); + Sql_GetData(sql_handle, 2, &data, nullptr); gpos->mode = atoi(data); + Sql_GetData(sql_handle, 3, &data, nullptr); gpos->exp_mode = atoi(data); gpos->modified = GS_POSITION_UNMODIFIED; } @@ -479,8 +479,8 @@ std::shared_ptr inter_guild_fromsql( int32 guild_id ){ { struct guild_alliance* a = &g->guild.alliance[i]; - Sql_GetData(sql_handle, 0, &data, NULL); a->opposition = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); a->guild_id = atoi(data); + Sql_GetData(sql_handle, 0, &data, nullptr); a->opposition = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); a->guild_id = atoi(data); Sql_GetData(sql_handle, 2, &data, &len); memcpy(a->name, data, zmin(len, NAME_LENGTH)); } @@ -494,7 +494,7 @@ std::shared_ptr inter_guild_fromsql( int32 guild_id ){ { struct guild_expulsion *e = &g->guild.expulsion[i]; - Sql_GetData(sql_handle, 0, &data, NULL); e->account_id = atoi(data); + Sql_GetData(sql_handle, 0, &data, nullptr); e->account_id = atoi(data); Sql_GetData(sql_handle, 1, &data, &len); memcpy(e->name, data, zmin(len, NAME_LENGTH)); Sql_GetData(sql_handle, 2, &data, &len); memcpy(e->mes, data, zmin(len, sizeof(e->mes))); } @@ -514,10 +514,10 @@ std::shared_ptr inter_guild_fromsql( int32 guild_id ){ while( SQL_SUCCESS == Sql_NextRow(sql_handle) ) { int id; - Sql_GetData(sql_handle, 0, &data, NULL); id = atoi(data) - GD_SKILLBASE; + Sql_GetData(sql_handle, 0, &data, nullptr); id = atoi(data) - GD_SKILLBASE; if( id < 0 || id >= MAX_GUILDSKILL ) continue;// invalid guild skill - Sql_GetData(sql_handle, 1, &data, NULL); g->guild.skill[id].lv = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); g->guild.skill[id].lv = atoi(data); } Sql_FreeResult(sql_handle); @@ -602,7 +602,7 @@ std::shared_ptr inter_guildcastle_fromsql( int castle_id ){ if (SQL_ERROR == Sql_Query(sql_handle, StringBuf_Value(&buf))) { Sql_ShowDebug(sql_handle); StringBuf_Destroy(&buf); - return NULL; + return nullptr; } StringBuf_Destroy(&buf); @@ -611,17 +611,17 @@ std::shared_ptr inter_guildcastle_fromsql( int castle_id ){ gc->castle_id = castle_id; if (SQL_SUCCESS == Sql_NextRow(sql_handle)) { - Sql_GetData(sql_handle, CD_GUILD_ID, &data, NULL); gc->guild_id = atoi(data); - Sql_GetData(sql_handle, CD_CURRENT_ECONOMY, &data, NULL); gc->economy = atoi(data); - Sql_GetData(sql_handle, CD_CURRENT_DEFENSE, &data, NULL); gc->defense = atoi(data); - Sql_GetData(sql_handle, CD_INVESTED_ECONOMY, &data, NULL); gc->triggerE = atoi(data); - Sql_GetData(sql_handle, CD_INVESTED_DEFENSE, &data, NULL); gc->triggerD = atoi(data); - Sql_GetData(sql_handle, CD_NEXT_TIME, &data, NULL); gc->nextTime = atoi(data); - Sql_GetData(sql_handle, CD_PAY_TIME, &data, NULL); gc->payTime = atoi(data); - Sql_GetData(sql_handle, CD_CREATE_TIME, &data, NULL); gc->createTime = atoi(data); - Sql_GetData(sql_handle, CD_ENABLED_KAFRA, &data, NULL); gc->visibleC = atoi(data); + Sql_GetData(sql_handle, CD_GUILD_ID, &data, nullptr); gc->guild_id = atoi(data); + Sql_GetData(sql_handle, CD_CURRENT_ECONOMY, &data, nullptr); gc->economy = atoi(data); + Sql_GetData(sql_handle, CD_CURRENT_DEFENSE, &data, nullptr); gc->defense = atoi(data); + Sql_GetData(sql_handle, CD_INVESTED_ECONOMY, &data, nullptr); gc->triggerE = atoi(data); + Sql_GetData(sql_handle, CD_INVESTED_DEFENSE, &data, nullptr); gc->triggerD = atoi(data); + Sql_GetData(sql_handle, CD_NEXT_TIME, &data, nullptr); gc->nextTime = atoi(data); + Sql_GetData(sql_handle, CD_PAY_TIME, &data, nullptr); gc->payTime = atoi(data); + Sql_GetData(sql_handle, CD_CREATE_TIME, &data, nullptr); gc->createTime = atoi(data); + Sql_GetData(sql_handle, CD_ENABLED_KAFRA, &data, nullptr); gc->visibleC = atoi(data); for (i = CD_ENABLED_GUARDIAN00; i < CD_MAX; i++) { - Sql_GetData(sql_handle, i, &data, NULL); gc->guardian[i - CD_ENABLED_GUARDIAN00].visible = atoi(data); + Sql_GetData(sql_handle, i, &data, nullptr); gc->guardian[i - CD_ENABLED_GUARDIAN00].visible = atoi(data); } } Sql_FreeResult(sql_handle); @@ -651,7 +651,7 @@ int inter_guild_CharOnline(uint32 char_id, int guild_id) { char* data; - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); guild_id = atoi(data); } else @@ -702,7 +702,7 @@ int inter_guild_CharOffline(uint32 char_id, int guild_id) { char* data; - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); guild_id = atoi(data); } else @@ -838,7 +838,7 @@ int search_guildname(char *str) { char* data; - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); guild_id = atoi(data); } else @@ -935,7 +935,7 @@ int mapif_guild_created( int fd, uint32 account_id, struct mmo_guild *g ){ WFIFOHEAD(fd, 10); WFIFOW(fd,0)=0x3830; WFIFOL(fd,2)=account_id; - if(g != NULL) + if(g != nullptr) { WFIFOL(fd,6)=g->guild_id; ShowInfo("int_guild: Guild created (%d - %s)\n",g->guild_id,g->name); @@ -1191,20 +1191,20 @@ int mapif_parse_CreateGuild(int fd,uint32 account_id,char *name,struct guild_mem #endif if(search_guildname(name) != 0){ ShowInfo("int_guild: guild with same name exists [%s]\n",name); - mapif_guild_created(fd,account_id,NULL); + mapif_guild_created(fd,account_id,nullptr); return 0; } // Check Authorised letters/symbols in the name of the character if (charserv_config.char_config.char_name_option == 1) { // only letters/symbols in char_name_letters are authorised for (i = 0; i < NAME_LENGTH && name[i]; i++) - if (strchr(charserv_config.char_config.char_name_letters, name[i]) == NULL) { - mapif_guild_created(fd,account_id,NULL); + if (strchr(charserv_config.char_config.char_name_letters, name[i]) == nullptr) { + mapif_guild_created(fd,account_id,nullptr); return 0; } } else if (charserv_config.char_config.char_name_option == 2) { // letters/symbols in char_name_letters are forbidden for (i = 0; i < NAME_LENGTH && name[i]; i++) - if (strchr(charserv_config.char_config.char_name_letters, name[i]) != NULL) { - mapif_guild_created(fd,account_id,NULL); + if (strchr(charserv_config.char_config.char_name_letters, name[i]) != nullptr) { + mapif_guild_created(fd,account_id,nullptr); return 0; } } @@ -1239,7 +1239,7 @@ int mapif_parse_CreateGuild(int fd,uint32 account_id,char *name,struct guild_mem if (!inter_guild_tosql(g->guild,GS_BASIC|GS_POSITION|GS_SKILL|GS_MEMBER)) { //Failed to Create guild.... ShowError("Failed to create Guild %s (Guild Master: %s)\n", g->guild.name, g->guild.master); - mapif_guild_created(fd,account_id,NULL); + mapif_guild_created(fd,account_id,nullptr); return 0; } ShowInfo("Created Guild %d - %s (Guild Master: %s)\n", g->guild.guild_id, g->guild.name, g->guild.master); @@ -1887,7 +1887,7 @@ int mapif_parse_GuildMasterChange(int fd, int guild_id, const char* name, int le g->guild.member[0].modified = GS_MEMBER_MODIFIED; // Store changing time - g->guild.last_leader_change = time(NULL); + g->guild.last_leader_change = time(nullptr); safestrncpy(g->guild.master, name, len); if (len < NAME_LENGTH) diff --git a/src/char/int_homun.cpp b/src/char/int_homun.cpp index cce0feaedc..7f0b4021cd 100644 --- a/src/char/int_homun.cpp +++ b/src/char/int_homun.cpp @@ -50,7 +50,7 @@ void mapif_homunculus_loaded(int fd, uint32 account_id, struct s_homunculus *hd) WFIFOW(fd,0) = 0x3891; WFIFOW(fd,2) = sizeof(struct s_homunculus)+9; WFIFOL(fd,4) = account_id; - if( hd != NULL ) + if( hd != nullptr ) { WFIFOB(fd,8) = 1; // success memcpy(WFIFOP(fd,9), hd, sizeof(struct s_homunculus)); @@ -175,28 +175,28 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd) } hd->hom_id = homun_id; - Sql_GetData(sql_handle, 1, &data, NULL); hd->char_id = atoi(data); - Sql_GetData(sql_handle, 2, &data, NULL); hd->class_ = atoi(data); - Sql_GetData(sql_handle, 3, &data, NULL); hd->prev_class = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); hd->char_id = atoi(data); + Sql_GetData(sql_handle, 2, &data, nullptr); hd->class_ = atoi(data); + Sql_GetData(sql_handle, 3, &data, nullptr); hd->prev_class = atoi(data); Sql_GetData(sql_handle, 4, &data, &len); safestrncpy(hd->name, data, sizeof(hd->name)); - Sql_GetData(sql_handle, 5, &data, NULL); hd->level = atoi(data); - Sql_GetData(sql_handle, 6, &data, NULL); hd->exp = strtoull( data, nullptr, 10 ); - Sql_GetData(sql_handle, 7, &data, NULL); hd->intimacy = (unsigned int)strtoul(data, NULL, 10); - Sql_GetData(sql_handle, 8, &data, NULL); hd->hunger = atoi(data); - Sql_GetData(sql_handle, 9, &data, NULL); hd->str = atoi(data); - Sql_GetData(sql_handle, 10, &data, NULL); hd->agi = atoi(data); - Sql_GetData(sql_handle, 11, &data, NULL); hd->vit = atoi(data); - Sql_GetData(sql_handle, 12, &data, NULL); hd->int_ = atoi(data); - Sql_GetData(sql_handle, 13, &data, NULL); hd->dex = atoi(data); - Sql_GetData(sql_handle, 14, &data, NULL); hd->luk = atoi(data); - Sql_GetData(sql_handle, 15, &data, NULL); hd->hp = atoi(data); - Sql_GetData(sql_handle, 16, &data, NULL); hd->max_hp = atoi(data); - Sql_GetData(sql_handle, 17, &data, NULL); hd->sp = atoi(data); - Sql_GetData(sql_handle, 18, &data, NULL); hd->max_sp = atoi(data); - Sql_GetData(sql_handle, 19, &data, NULL); hd->skillpts = atoi(data); - Sql_GetData(sql_handle, 20, &data, NULL); hd->rename_flag = atoi(data); - Sql_GetData(sql_handle, 21, &data, NULL); hd->vaporize = atoi(data); - Sql_GetData(sql_handle, 22, &data, NULL); hd->autofeed = atoi(data) != 0; + Sql_GetData(sql_handle, 5, &data, nullptr); hd->level = atoi(data); + Sql_GetData(sql_handle, 6, &data, nullptr); hd->exp = strtoull( data, nullptr, 10 ); + Sql_GetData(sql_handle, 7, &data, nullptr); hd->intimacy = (unsigned int)strtoul(data, nullptr, 10); + Sql_GetData(sql_handle, 8, &data, nullptr); hd->hunger = atoi(data); + Sql_GetData(sql_handle, 9, &data, nullptr); hd->str = atoi(data); + Sql_GetData(sql_handle, 10, &data, nullptr); hd->agi = atoi(data); + Sql_GetData(sql_handle, 11, &data, nullptr); hd->vit = atoi(data); + Sql_GetData(sql_handle, 12, &data, nullptr); hd->int_ = atoi(data); + Sql_GetData(sql_handle, 13, &data, nullptr); hd->dex = atoi(data); + Sql_GetData(sql_handle, 14, &data, nullptr); hd->luk = atoi(data); + Sql_GetData(sql_handle, 15, &data, nullptr); hd->hp = atoi(data); + Sql_GetData(sql_handle, 16, &data, nullptr); hd->max_hp = atoi(data); + Sql_GetData(sql_handle, 17, &data, nullptr); hd->sp = atoi(data); + Sql_GetData(sql_handle, 18, &data, nullptr); hd->max_sp = atoi(data); + Sql_GetData(sql_handle, 19, &data, nullptr); hd->skillpts = atoi(data); + Sql_GetData(sql_handle, 20, &data, nullptr); hd->rename_flag = atoi(data); + Sql_GetData(sql_handle, 21, &data, nullptr); hd->vaporize = atoi(data); + Sql_GetData(sql_handle, 22, &data, nullptr); hd->autofeed = atoi(data) != 0; Sql_FreeResult(sql_handle); hd->intimacy = umin(hd->intimacy,100000); @@ -212,7 +212,7 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd) { int i; // id - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); i = atoi(data); if( i < HM_SKILLBASE || i >= HM_SKILLBASE + MAX_HOMUNSKILL ) continue;// invalid skill id @@ -220,7 +220,7 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd) hd->hskill[i].id = (unsigned short)atoi(data); // lv - Sql_GetData(sql_handle, 1, &data, NULL); + Sql_GetData(sql_handle, 1, &data, nullptr); hd->hskill[i].lv = (unsigned char)atoi(data); } Sql_FreeResult(sql_handle); @@ -251,13 +251,13 @@ bool mapif_homunculus_rename(char *name) if( charserv_config.char_config.char_name_option == 1 ) {// only letters/symbols in char_name_letters are authorised for( i = 0; i < NAME_LENGTH && name[i]; i++ ) - if( strchr(charserv_config.char_config.char_name_letters, name[i]) == NULL ) + if( strchr(charserv_config.char_config.char_name_letters, name[i]) == nullptr ) return false; } else if( charserv_config.char_config.char_name_option == 2 ) {// letters/symbols in char_name_letters are forbidden for( i = 0; i < NAME_LENGTH && name[i]; i++ ) - if( strchr(charserv_config.char_config.char_name_letters, name[i]) != NULL ) + if( strchr(charserv_config.char_config.char_name_letters, name[i]) != nullptr ) return false; } @@ -281,7 +281,7 @@ void mapif_parse_homunculus_load(int fd, uint32 account_id, int homun_id) { struct s_homunculus hd; bool result = mapif_homunculus_load(homun_id, &hd); - mapif_homunculus_loaded(fd, account_id, ( result ? &hd : NULL )); + mapif_homunculus_loaded(fd, account_id, ( result ? &hd : nullptr )); } void mapif_parse_homunculus_save(int fd, int len, uint32 account_id, struct s_homunculus* phd) diff --git a/src/char/int_mail.cpp b/src/char/int_mail.cpp index 37c8b0d89e..3060cf1444 100644 --- a/src/char/int_mail.cpp +++ b/src/char/int_mail.cpp @@ -42,7 +42,7 @@ int mail_fromsql(uint32 char_id, struct mail_data* md) md->full = (Sql_NumRows(sql_handle) > MAIL_MAX_INBOX); for( i = 0; i < MAIL_MAX_INBOX && SQL_SUCCESS == Sql_NextRow(sql_handle); i++ ){ - Sql_GetData(sql_handle, 0, &data, NULL); md->msg[i].id = atoi(data); + Sql_GetData(sql_handle, 0, &data, nullptr); md->msg[i].id = atoi(data); } md->amount = i; @@ -178,17 +178,17 @@ bool mail_loadmessage(int mail_id, struct mail_message* msg) Sql_FreeResult(sql_handle); return false; }else{ - Sql_GetData(sql_handle, 0, &data, NULL); msg->id = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); safestrncpy(msg->send_name, data, NAME_LENGTH); - Sql_GetData(sql_handle, 2, &data, NULL); msg->send_id = atoi(data); - Sql_GetData(sql_handle, 3, &data, NULL); safestrncpy(msg->dest_name, data, NAME_LENGTH); - Sql_GetData(sql_handle, 4, &data, NULL); msg->dest_id = atoi(data); - Sql_GetData(sql_handle, 5, &data, NULL); safestrncpy(msg->title, data, MAIL_TITLE_LENGTH); - Sql_GetData(sql_handle, 6, &data, NULL); safestrncpy(msg->body, data, MAIL_BODY_LENGTH); - Sql_GetData(sql_handle, 7, &data, NULL); msg->timestamp = atoi(data); - Sql_GetData(sql_handle, 8, &data, NULL); msg->status = (mail_status)atoi(data); - Sql_GetData(sql_handle, 9, &data, NULL); msg->zeny = atoi(data); - Sql_GetData(sql_handle,10, &data, NULL); msg->type = (mail_inbox_type)atoi(data); + Sql_GetData(sql_handle, 0, &data, nullptr); msg->id = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); safestrncpy(msg->send_name, data, NAME_LENGTH); + Sql_GetData(sql_handle, 2, &data, nullptr); msg->send_id = atoi(data); + Sql_GetData(sql_handle, 3, &data, nullptr); safestrncpy(msg->dest_name, data, NAME_LENGTH); + Sql_GetData(sql_handle, 4, &data, nullptr); msg->dest_id = atoi(data); + Sql_GetData(sql_handle, 5, &data, nullptr); safestrncpy(msg->title, data, MAIL_TITLE_LENGTH); + Sql_GetData(sql_handle, 6, &data, nullptr); safestrncpy(msg->body, data, MAIL_BODY_LENGTH); + Sql_GetData(sql_handle, 7, &data, nullptr); msg->timestamp = atoi(data); + Sql_GetData(sql_handle, 8, &data, nullptr); msg->status = (mail_status)atoi(data); + Sql_GetData(sql_handle, 9, &data, nullptr); msg->zeny = atoi(data); + Sql_GetData(sql_handle,10, &data, nullptr); msg->type = (mail_inbox_type)atoi(data); if( msg->type == MAIL_INBOX_NORMAL && charserv_config.mail_return_days > 0 ){ msg->scheduled_deletion = msg->timestamp + charserv_config.mail_return_days * 24 * 60 * 60; @@ -225,24 +225,24 @@ bool mail_loadmessage(int mail_id, struct mail_message* msg) memset(msg->item, 0, sizeof(struct item) * MAIL_MAX_ITEM); for( i = 0; i < MAIL_MAX_ITEM && SQL_SUCCESS == Sql_NextRow(sql_handle); i++ ){ - Sql_GetData(sql_handle,0, &data, NULL); msg->item[i].amount = (short)atoi(data); - Sql_GetData(sql_handle,1, &data, NULL); msg->item[i].nameid = strtoul(data, nullptr, 10); - Sql_GetData(sql_handle,2, &data, NULL); msg->item[i].refine = atoi(data); - Sql_GetData(sql_handle,3, &data, NULL); msg->item[i].attribute = atoi(data); - Sql_GetData(sql_handle,4, &data, NULL); msg->item[i].identify = atoi(data); - Sql_GetData(sql_handle,5, &data, NULL); msg->item[i].unique_id = strtoull(data, NULL, 10); - Sql_GetData(sql_handle,6, &data, NULL); msg->item[i].bound = atoi(data); - Sql_GetData(sql_handle,7, &data, NULL); msg->item[i].enchantgrade = atoi(data); + Sql_GetData(sql_handle,0, &data, nullptr); msg->item[i].amount = (short)atoi(data); + Sql_GetData(sql_handle,1, &data, nullptr); msg->item[i].nameid = strtoul(data, nullptr, 10); + Sql_GetData(sql_handle,2, &data, nullptr); msg->item[i].refine = atoi(data); + Sql_GetData(sql_handle,3, &data, nullptr); msg->item[i].attribute = atoi(data); + Sql_GetData(sql_handle,4, &data, nullptr); msg->item[i].identify = atoi(data); + Sql_GetData(sql_handle,5, &data, nullptr); msg->item[i].unique_id = strtoull(data, nullptr, 10); + Sql_GetData(sql_handle,6, &data, nullptr); msg->item[i].bound = atoi(data); + Sql_GetData(sql_handle,7, &data, nullptr); msg->item[i].enchantgrade = atoi(data); msg->item[i].expire_time = 0; for( j = 0; j < MAX_SLOTS; j++ ){ - Sql_GetData(sql_handle,8 + j, &data, NULL); msg->item[i].card[j] = strtoul(data, nullptr, 10); + Sql_GetData(sql_handle,8 + j, &data, nullptr); msg->item[i].card[j] = strtoul(data, nullptr, 10); } for( j = 0; j < MAX_ITEM_RDM_OPT; j++ ){ - Sql_GetData(sql_handle, 8 + MAX_SLOTS + j * 3, &data, NULL); msg->item[i].option[j].id = atoi(data); - Sql_GetData(sql_handle, 9 + MAX_SLOTS + j * 3, &data, NULL); msg->item[i].option[j].value = atoi(data); - Sql_GetData(sql_handle,10 + MAX_SLOTS + j * 3, &data, NULL); msg->item[i].option[j].param = atoi(data); + Sql_GetData(sql_handle, 8 + MAX_SLOTS + j * 3, &data, nullptr); msg->item[i].option[j].id = atoi(data); + Sql_GetData(sql_handle, 9 + MAX_SLOTS + j * 3, &data, nullptr); msg->item[i].option[j].value = atoi(data); + Sql_GetData(sql_handle,10 + MAX_SLOTS + j * 3, &data, nullptr); msg->item[i].option[j].param = atoi(data); } } @@ -291,10 +291,10 @@ int mail_timer_sub( int limit, enum mail_inbox_type type ){ for( int i = 0; i < MAIL_ITERATION_SIZE && SQL_SUCCESS == Sql_NextRow( sql_handle ); i++ ){ char* data; - Sql_GetData(sql_handle, 0, &data, NULL); mails[i].mail_id = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); mails[i].char_id = atoi(data); - Sql_GetData(sql_handle, 2, &data, NULL); mails[i].account_id = atoi(data); - Sql_GetData( sql_handle, 3, &data, NULL ); mails[i].account_id_sender = atoi( data ); + Sql_GetData(sql_handle, 0, &data, nullptr); mails[i].mail_id = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); mails[i].char_id = atoi(data); + Sql_GetData(sql_handle, 2, &data, nullptr); mails[i].account_id = atoi(data); + Sql_GetData( sql_handle, 3, &data, nullptr ); mails[i].account_id_sender = atoi( data ); } Sql_FreeResult(sql_handle); @@ -558,7 +558,7 @@ void mapif_Mail_return( int fd, uint32 char_id, int mail_id, uint32 account_id_r msg.status = MAIL_NEW; msg.type = MAIL_INBOX_RETURNED; - msg.timestamp = time( NULL ); + msg.timestamp = time( nullptr ); int new_mail = mail_savemessage( &msg ); mapif_Mail_new( &msg ); @@ -625,7 +625,7 @@ void mapif_parse_Mail_send(int fd) msg.dest_name[0] = '\0'; if( SQL_SUCCESS == Sql_NextRow(sql_handle) ){ - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); msg.dest_id = atoi(data); Sql_GetData(sql_handle, 1, &data, &len); safestrncpy(msg.dest_name, data, NAME_LENGTH); @@ -642,15 +642,15 @@ void mapif_parse_Mail_send(int fd) #if PACKETVER < 20150513 uint32 account_id = RFIFOL(fd,4); - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); if (atoi(data) != account_id) { // Cannot send mail to char in the same account - Sql_GetData(sql_handle, 1, &data, NULL); + Sql_GetData(sql_handle, 1, &data, nullptr); msg.dest_id = atoi(data); } #else // In RODEX you can even send mails to yourself - Sql_GetData(sql_handle, 1, &data, NULL); + Sql_GetData(sql_handle, 1, &data, nullptr); msg.dest_id = atoi(data); #endif } @@ -676,7 +676,7 @@ bool mail_sendmail(int send_id, const char* send_name, int dest_id, const char* safestrncpy(msg.title, title, MAIL_TITLE_LENGTH); safestrncpy(msg.body, body, MAIL_BODY_LENGTH); msg.zeny = zeny; - if( item != NULL ){ + if( item != nullptr ){ int i; for( i = 0; i < amount && i < MAIL_MAX_ITEM; i++ ){ @@ -684,7 +684,7 @@ bool mail_sendmail(int send_id, const char* send_name, int dest_id, const char* } } - msg.timestamp = time(NULL); + msg.timestamp = time(nullptr); msg.type = MAIL_INBOX_NORMAL; if( !mail_savemessage(&msg) ){ @@ -721,9 +721,9 @@ void mapif_parse_Mail_receiver_check( int fd ){ }else if( SQL_SUCCESS == Sql_NextRow(sql_handle) ){ char *data; - Sql_GetData(sql_handle, 0, &data, NULL); char_id = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); class_ = atoi(data); - Sql_GetData(sql_handle, 2, &data, NULL); base_level = atoi(data); + Sql_GetData(sql_handle, 0, &data, nullptr); char_id = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); class_ = atoi(data); + Sql_GetData(sql_handle, 2, &data, nullptr); base_level = atoi(data); } Sql_FreeResult(sql_handle); diff --git a/src/char/int_mercenary.cpp b/src/char/int_mercenary.cpp index e21995904e..ef229d20a6 100644 --- a/src/char/int_mercenary.cpp +++ b/src/char/int_mercenary.cpp @@ -31,13 +31,13 @@ bool mercenary_owner_fromsql(uint32 char_id, struct mmo_charstatus *status) return false; } - Sql_GetData(sql_handle, 0, &data, NULL); status->mer_id = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); status->arch_calls = atoi(data); - Sql_GetData(sql_handle, 2, &data, NULL); status->arch_faith = atoi(data); - Sql_GetData(sql_handle, 3, &data, NULL); status->spear_calls = atoi(data); - Sql_GetData(sql_handle, 4, &data, NULL); status->spear_faith = atoi(data); - Sql_GetData(sql_handle, 5, &data, NULL); status->sword_calls = atoi(data); - Sql_GetData(sql_handle, 6, &data, NULL); status->sword_faith = atoi(data); + Sql_GetData(sql_handle, 0, &data, nullptr); status->mer_id = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); status->arch_calls = atoi(data); + Sql_GetData(sql_handle, 2, &data, nullptr); status->arch_faith = atoi(data); + Sql_GetData(sql_handle, 3, &data, nullptr); status->spear_calls = atoi(data); + Sql_GetData(sql_handle, 4, &data, nullptr); status->spear_faith = atoi(data); + Sql_GetData(sql_handle, 5, &data, nullptr); status->sword_calls = atoi(data); + Sql_GetData(sql_handle, 6, &data, nullptr); status->sword_faith = atoi(data); Sql_FreeResult(sql_handle); return true; @@ -113,11 +113,11 @@ bool mapif_mercenary_load(int merc_id, uint32 char_id, struct s_mercenary *merc) return false; } - Sql_GetData(sql_handle, 0, &data, NULL); merc->class_ = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); merc->hp = atoi(data); - Sql_GetData(sql_handle, 2, &data, NULL); merc->sp = atoi(data); - Sql_GetData(sql_handle, 3, &data, NULL); merc->kill_count = atoi(data); - Sql_GetData(sql_handle, 4, &data, NULL); merc->life_time = strtoll( data, nullptr, 10 ); + Sql_GetData(sql_handle, 0, &data, nullptr); merc->class_ = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); merc->hp = atoi(data); + Sql_GetData(sql_handle, 2, &data, nullptr); merc->sp = atoi(data); + Sql_GetData(sql_handle, 3, &data, nullptr); merc->kill_count = atoi(data); + Sql_GetData(sql_handle, 4, &data, nullptr); merc->life_time = strtoll( data, nullptr, 10 ); Sql_FreeResult(sql_handle); if( charserv_config.save_log ) ShowInfo("Mercenary loaded (ID: %d / Class: %d / CID: %d).\n", merc->mercenary_id, merc->class_, merc->char_id); diff --git a/src/char/int_party.cpp b/src/char/int_party.cpp index 1943ab3478..5f1c38e4eb 100644 --- a/src/char/int_party.cpp +++ b/src/char/int_party.cpp @@ -121,7 +121,7 @@ int inter_party_tosql(struct party *p, int flag, int index) char esc_name[NAME_LENGTH*2+1];// escaped party name int32 party_id; - if( p == NULL || p->party_id == 0 ) + if( p == nullptr || p->party_id == 0 ) return 0; party_id = p->party_id; @@ -201,7 +201,7 @@ std::shared_ptr inter_party_fromsql( int party_id ){ ShowInfo("Load party request (" CL_BOLD "%d" CL_RESET ")\n", party_id); #endif if( party_id <= 0 ) - return NULL; + return nullptr; //Load from memory std::shared_ptr p = util::umap_find( party_db, party_id ); @@ -213,38 +213,38 @@ std::shared_ptr inter_party_fromsql( int party_id ){ if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `party_id`, `name`,`exp`,`item`, `leader_id`, `leader_char` FROM `%s` WHERE `party_id`='%d'", schema_config.party_db, party_id) ) { Sql_ShowDebug(sql_handle); - return NULL; + return nullptr; } if( SQL_SUCCESS != Sql_NextRow(sql_handle) ) - return NULL; + return nullptr; p = std::make_shared(); p->party.party_id = party_id; Sql_GetData(sql_handle, 1, &data, &len); memcpy(p->party.name, data, zmin(len, NAME_LENGTH)); - Sql_GetData(sql_handle, 2, &data, NULL); p->party.exp = (atoi(data) ? 1 : 0); - Sql_GetData(sql_handle, 3, &data, NULL); p->party.item = atoi(data); - Sql_GetData(sql_handle, 4, &data, NULL); leader_id = atoi(data); - Sql_GetData(sql_handle, 5, &data, NULL); leader_char = atoi(data); + Sql_GetData(sql_handle, 2, &data, nullptr); p->party.exp = (atoi(data) ? 1 : 0); + Sql_GetData(sql_handle, 3, &data, nullptr); p->party.item = atoi(data); + Sql_GetData(sql_handle, 4, &data, nullptr); leader_id = atoi(data); + Sql_GetData(sql_handle, 5, &data, nullptr); leader_char = atoi(data); Sql_FreeResult(sql_handle); // Load members if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `account_id`,`char_id`,`name`,`base_level`,`last_map`,`online`,`class` FROM `%s` WHERE `party_id`='%d'", schema_config.char_db, party_id) ) { Sql_ShowDebug(sql_handle); - return NULL; + return nullptr; } for( i = 0; i < MAX_PARTY && SQL_SUCCESS == Sql_NextRow(sql_handle); ++i ) { m = &p->party.member[i]; - Sql_GetData(sql_handle, 0, &data, NULL); m->account_id = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); m->char_id = atoi(data); + Sql_GetData(sql_handle, 0, &data, nullptr); m->account_id = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); m->char_id = atoi(data); Sql_GetData(sql_handle, 2, &data, &len); memcpy(m->name, data, zmin(len, NAME_LENGTH)); - Sql_GetData(sql_handle, 3, &data, NULL); m->lv = atoi(data); + Sql_GetData(sql_handle, 3, &data, nullptr); m->lv = atoi(data); Sql_GetData(sql_handle, 4, &data, &len); memcpy(m->map, data, zmin(len, sizeof(m->map))); - Sql_GetData(sql_handle, 5, &data, NULL); m->online = (atoi(data) ? 1 : 0); - Sql_GetData(sql_handle, 6, &data, NULL); m->class_ = atoi(data); + Sql_GetData(sql_handle, 5, &data, nullptr); m->online = (atoi(data) ? 1 : 0); + Sql_GetData(sql_handle, 6, &data, nullptr); m->class_ = atoi(data); m->leader = (m->account_id == leader_id && m->char_id == leader_char ? 1 : 0); } Sql_FreeResult(sql_handle); @@ -289,7 +289,7 @@ std::shared_ptr search_partyname( char* str ){ Sql_ShowDebug(sql_handle); else if( SQL_SUCCESS == Sql_NextRow(sql_handle) ) { - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); p = inter_party_fromsql(atoi(data)); } Sql_FreeResult(sql_handle); @@ -368,7 +368,7 @@ int mapif_party_created(int fd,uint32 account_id,uint32 char_id,struct party *p) WFIFOW(fd,0)=0x3820; WFIFOL(fd,2)=account_id; WFIFOL(fd,6)=char_id; - if(p!=NULL){ + if(p!=nullptr){ WFIFOB(fd,10)=0; WFIFOL(fd,11)=p->party_id; memcpy(WFIFOP(fd,15),p->name,NAME_LENGTH); @@ -507,27 +507,27 @@ int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct part std::shared_ptr p = search_partyname( name ); if( p != nullptr ){ - mapif_party_created(fd,leader->account_id,leader->char_id,NULL); + mapif_party_created(fd,leader->account_id,leader->char_id,nullptr); return 0; } // Check Authorised letters/symbols in the name of the character if (charserv_config.char_config.char_name_option == 1) { // only letters/symbols in char_name_letters are authorised for( int i = 0; i < NAME_LENGTH && name[i]; i++ ){ - if (strchr(charserv_config.char_config.char_name_letters, name[i]) == NULL) { + if (strchr(charserv_config.char_config.char_name_letters, name[i]) == nullptr) { if( name[i] == '"' ) { /* client-special-char */ normalize_name(name,"\""); mapif_parse_CreateParty(fd,name,item,item2,leader); return 0; } - mapif_party_created(fd,leader->account_id,leader->char_id,NULL); + mapif_party_created(fd,leader->account_id,leader->char_id,nullptr); return 0; } } } else if (charserv_config.char_config.char_name_option == 2) { // letters/symbols in char_name_letters are forbidden for( int i = 0; i < NAME_LENGTH && name[i]; i++ ){ - if (strchr(charserv_config.char_config.char_name_letters, name[i]) != NULL) { - mapif_party_created(fd,leader->account_id,leader->char_id,NULL); + if (strchr(charserv_config.char_config.char_name_letters, name[i]) != nullptr) { + mapif_party_created(fd,leader->account_id,leader->char_id,nullptr); return 0; } } @@ -552,7 +552,7 @@ int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct part mapif_party_created(fd,leader->account_id,leader->char_id,&p->party); }else{ // Failed to create party. - mapif_party_created(fd,leader->account_id,leader->char_id,NULL); + mapif_party_created(fd,leader->account_id,leader->char_id,nullptr); } return 0; @@ -851,7 +851,7 @@ int inter_party_CharOnline(uint32 char_id, int party_id) if( SQL_SUCCESS != Sql_NextRow(sql_handle) ) return 0; //Eh? No party? - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); party_id = atoi(data); Sql_FreeResult(sql_handle); } @@ -897,7 +897,7 @@ int inter_party_CharOffline(uint32 char_id, int party_id) { if( SQL_SUCCESS != Sql_NextRow(sql_handle) ) return 0; //Eh? No party? - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); party_id = atoi(data); Sql_FreeResult(sql_handle); } diff --git a/src/char/int_pet.cpp b/src/char/int_pet.cpp index 1f547ae76f..c5f4c4a95e 100644 --- a/src/char/int_pet.cpp +++ b/src/char/int_pet.cpp @@ -80,18 +80,18 @@ int inter_pet_fromsql(int pet_id, struct s_pet* p) if( SQL_SUCCESS == Sql_NextRow(sql_handle) ) { p->pet_id = pet_id; - Sql_GetData(sql_handle, 1, &data, NULL); p->class_ = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); p->class_ = atoi(data); Sql_GetData(sql_handle, 2, &data, &len); memcpy(p->name, data, zmin(len, NAME_LENGTH)); - Sql_GetData(sql_handle, 3, &data, NULL); p->account_id = atoi(data); - Sql_GetData(sql_handle, 4, &data, NULL); p->char_id = atoi(data); - Sql_GetData(sql_handle, 5, &data, NULL); p->level = atoi(data); - Sql_GetData(sql_handle, 6, &data, NULL); p->egg_id = strtoul(data, nullptr, 10); - Sql_GetData(sql_handle, 7, &data, NULL); p->equip = strtoul(data, nullptr, 10); - Sql_GetData(sql_handle, 8, &data, NULL); p->intimate = atoi(data); - Sql_GetData(sql_handle, 9, &data, NULL); p->hungry = atoi(data); - Sql_GetData(sql_handle, 10, &data, NULL); p->rename_flag = atoi(data); - Sql_GetData(sql_handle, 11, &data, NULL); p->incubate = atoi(data); - Sql_GetData(sql_handle, 12, &data, NULL); p->autofeed = atoi(data) != 0; + Sql_GetData(sql_handle, 3, &data, nullptr); p->account_id = atoi(data); + Sql_GetData(sql_handle, 4, &data, nullptr); p->char_id = atoi(data); + Sql_GetData(sql_handle, 5, &data, nullptr); p->level = atoi(data); + Sql_GetData(sql_handle, 6, &data, nullptr); p->egg_id = strtoul(data, nullptr, 10); + Sql_GetData(sql_handle, 7, &data, nullptr); p->equip = strtoul(data, nullptr, 10); + Sql_GetData(sql_handle, 8, &data, nullptr); p->intimate = atoi(data); + Sql_GetData(sql_handle, 9, &data, nullptr); p->hungry = atoi(data); + Sql_GetData(sql_handle, 10, &data, nullptr); p->rename_flag = atoi(data); + Sql_GetData(sql_handle, 11, &data, nullptr); p->incubate = atoi(data); + Sql_GetData(sql_handle, 12, &data, nullptr); p->autofeed = atoi(data) != 0; Sql_FreeResult(sql_handle); @@ -128,7 +128,7 @@ int mapif_pet_created(int fd, uint32 account_id, struct s_pet *p) WFIFOHEAD(fd, 12); WFIFOW(fd, 0) = 0x3880; WFIFOL(fd, 2) = account_id; - if(p!=NULL){ + if(p!=nullptr){ WFIFOW(fd, 6) = p->class_; WFIFOL(fd, 8) = p->pet_id; ShowInfo("int_pet: created pet %d - %s\n", p->pet_id, p->name); @@ -221,7 +221,7 @@ int mapif_create_pet(int fd, uint32 account_id, uint32 char_id, short pet_class, mapif_load_pet(fd, account_id, char_id, pet_pt->pet_id); } }else //Failed... - mapif_pet_created(fd, account_id, NULL); + mapif_pet_created(fd, account_id, nullptr); return 0; } @@ -231,7 +231,7 @@ int mapif_load_pet(int fd, uint32 account_id, uint32 char_id, int pet_id){ inter_pet_fromsql(pet_id, pet_pt); - if(pet_pt!=NULL) { + if(pet_pt!=nullptr) { if(pet_pt->incubate == 1) { pet_pt->account_id = pet_pt->char_id = 0; mapif_pet_info(fd, account_id, pet_pt); diff --git a/src/char/int_quest.cpp b/src/char/int_quest.cpp index 76bbaf2ef1..912325e5f8 100644 --- a/src/char/int_quest.cpp +++ b/src/char/int_quest.cpp @@ -24,18 +24,18 @@ * caller to aFree() it afterwards. */ struct quest *mapif_quests_fromsql(uint32 char_id, int *count) { - struct quest *questlog = NULL; + struct quest *questlog = nullptr; struct quest tmp_quest; SqlStmt *stmt; if( !count ) - return NULL; + return nullptr; stmt = SqlStmt_Malloc(sql_handle); - if( stmt == NULL ) { + if( stmt == nullptr ) { SqlStmt_ShowDebug(stmt); *count = 0; - return NULL; + return nullptr; } memset(&tmp_quest, 0, sizeof(struct quest)); @@ -43,17 +43,17 @@ struct quest *mapif_quests_fromsql(uint32 char_id, int *count) { if( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT `quest_id`, `state`, `time`, `count1`, `count2`, `count3` FROM `%s` WHERE `char_id`=? ", schema_config.quest_db) || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0) || SQL_ERROR == SqlStmt_Execute(stmt) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &tmp_quest.quest_id, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_INT, &tmp_quest.state, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_UINT, &tmp_quest.time, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_INT, &tmp_quest.count[0], 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 4, SQLDT_INT, &tmp_quest.count[1], 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 5, SQLDT_INT, &tmp_quest.count[2], 0, NULL, NULL) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &tmp_quest.quest_id, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_INT, &tmp_quest.state, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_UINT, &tmp_quest.time, 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_INT, &tmp_quest.count[0], 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 4, SQLDT_INT, &tmp_quest.count[1], 0, nullptr, nullptr) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 5, SQLDT_INT, &tmp_quest.count[2], 0, nullptr, nullptr) ) { SqlStmt_ShowDebug(stmt); SqlStmt_Free(stmt); *count = 0; - return NULL; + return nullptr; } *count = (int)SqlStmt_NumRows(stmt); @@ -138,7 +138,7 @@ bool mapif_quest_update(uint32 char_id, struct quest qd) { int mapif_parse_quest_save(int fd) { int i, j, k, old_n, new_n = (RFIFOW(fd,2) - 8) / sizeof(struct quest); uint32 char_id = RFIFOL(fd,4); - struct quest *old_qd = NULL, *new_qd = NULL; + struct quest *old_qd = nullptr, *new_qd = nullptr; bool success = true; if( new_n > 0 ) @@ -189,7 +189,7 @@ int mapif_parse_quest_save(int fd) { */ int mapif_parse_quest_load(int fd) { uint32 char_id = RFIFOL(fd,2); - struct quest *tmp_questlog = NULL; + struct quest *tmp_questlog = nullptr; int num_quests; tmp_questlog = mapif_quests_fromsql(char_id, &num_quests); diff --git a/src/char/int_storage.cpp b/src/char/int_storage.cpp index b0fd334152..16ede93957 100644 --- a/src/char/int_storage.cpp +++ b/src/char/int_storage.cpp @@ -355,23 +355,23 @@ bool mapif_parse_itembound_retrieve(int fd) return true; } - SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &item.id, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 1, SQLDT_UINT, &item.nameid, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 8, SQLDT_CHAR, &item.bound, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 9, SQLDT_ULONGLONG, &item.unique_id, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 10, SQLDT_INT8, &item.enchantgrade, 0, NULL, NULL); + SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &item.id, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 1, SQLDT_UINT, &item.nameid, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 8, SQLDT_CHAR, &item.bound, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 9, SQLDT_ULONGLONG, &item.unique_id, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 10, SQLDT_INT8, &item.enchantgrade, 0, nullptr, nullptr); for( j = 0; j < MAX_SLOTS; ++j ) - SqlStmt_BindColumn(stmt,11+j, SQLDT_UINT, &item.card[j], 0, NULL, NULL); + SqlStmt_BindColumn(stmt,11+j, SQLDT_UINT, &item.card[j], 0, nullptr, nullptr); for( j = 0; j < MAX_ITEM_RDM_OPT; ++j ) { - SqlStmt_BindColumn(stmt, 11+MAX_SLOTS+j*3, SQLDT_SHORT, &item.option[j].id, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 12+MAX_SLOTS+j*3, SQLDT_SHORT, &item.option[j].value, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 13+MAX_SLOTS+j*3, SQLDT_CHAR, &item.option[j].param, 0, NULL, NULL); + SqlStmt_BindColumn(stmt, 11+MAX_SLOTS+j*3, SQLDT_SHORT, &item.option[j].id, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 12+MAX_SLOTS+j*3, SQLDT_SHORT, &item.option[j].value, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 13+MAX_SLOTS+j*3, SQLDT_CHAR, &item.option[j].param, 0, nullptr, nullptr); } memset(&items, 0, sizeof(items)); while( SQL_SUCCESS == SqlStmt_NextRow(stmt) ) diff --git a/src/char/inter.cpp b/src/char/inter.cpp index 294c9be5c9..9777c9a451 100644 --- a/src/char/inter.cpp +++ b/src/char/inter.cpp @@ -44,7 +44,7 @@ InterServerDatabase interServerDb; #define WISDATA_TTL (60*1000) //Wis data Time To Live (60 seconds) -Sql* sql_handle = NULL; ///Link to mysql db, connection FD +Sql* sql_handle = nullptr; ///Link to mysql db, connection FD int char_server_port = 3306; std::string char_server_ip = "127.0.0.1"; @@ -512,7 +512,7 @@ void mapif_parse_accinfo(int fd) { } else { if( Sql_NumRows(sql_handle) == 1 ) {//we found a perfect match Sql_NextRow(sql_handle); - Sql_GetData(sql_handle, 0, &data, NULL); account_id = atoi(data); + Sql_GetData(sql_handle, 0, &data, nullptr); account_id = atoi(data); Sql_FreeResult(sql_handle); } else {// more than one, listing... [Dekamaster/Nightroad] inter_to_fd(fd, u_fd, u_aid, (char *)msg_txt(214),(int)Sql_NumRows(sql_handle)); @@ -521,12 +521,12 @@ void mapif_parse_accinfo(int fd) { short base_level, job_level, online; char name[NAME_LENGTH]; - Sql_GetData(sql_handle, 0, &data, NULL); account_id = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); safestrncpy(name, data, sizeof(name)); - Sql_GetData(sql_handle, 2, &data, NULL); class_ = atoi(data); - Sql_GetData(sql_handle, 3, &data, NULL); base_level = atoi(data); - Sql_GetData(sql_handle, 4, &data, NULL); job_level = atoi(data); - Sql_GetData(sql_handle, 5, &data, NULL); online = atoi(data); + Sql_GetData(sql_handle, 0, &data, nullptr); account_id = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); safestrncpy(name, data, sizeof(name)); + Sql_GetData(sql_handle, 2, &data, nullptr); class_ = atoi(data); + Sql_GetData(sql_handle, 3, &data, nullptr); base_level = atoi(data); + Sql_GetData(sql_handle, 4, &data, nullptr); job_level = atoi(data); + Sql_GetData(sql_handle, 5, &data, nullptr); online = atoi(data); inter_to_fd(fd, u_fd, u_aid, (char *)msg_txt(215), account_id, name, job_name(class_), base_level, job_level, online?"Online":"Offline"); } @@ -587,13 +587,13 @@ void mapif_accinfo_ack(bool success, int map_fd, int u_fd, int u_aid, int accoun char name[NAME_LENGTH]; char *data; - Sql_GetData(sql_handle, 0, &data, NULL); char_id = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); safestrncpy(name, data, sizeof(name)); - Sql_GetData(sql_handle, 2, &data, NULL); char_num = atoi(data); - Sql_GetData(sql_handle, 3, &data, NULL); class_ = atoi(data); - Sql_GetData(sql_handle, 4, &data, NULL); base_level = atoi(data); - Sql_GetData(sql_handle, 5, &data, NULL); job_level = atoi(data); - Sql_GetData(sql_handle, 6, &data, NULL); online = atoi(data); + Sql_GetData(sql_handle, 0, &data, nullptr); char_id = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); safestrncpy(name, data, sizeof(name)); + Sql_GetData(sql_handle, 2, &data, nullptr); char_num = atoi(data); + Sql_GetData(sql_handle, 3, &data, nullptr); class_ = atoi(data); + Sql_GetData(sql_handle, 4, &data, nullptr); base_level = atoi(data); + Sql_GetData(sql_handle, 5, &data, nullptr); job_level = atoi(data); + Sql_GetData(sql_handle, 6, &data, nullptr); online = atoi(data); inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(225), char_num, char_id, name, job_name(class_), base_level, job_level, online?"Online":"Offline"); } @@ -702,7 +702,7 @@ int inter_accreg_fromsql(uint32 account_id, uint32 char_id, int fd, int type) * { keyLength(B), key(), index(L), valLength(B), val() } **/ while ( SQL_SUCCESS == Sql_NextRow(sql_handle) ) { - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); len = strlen(data)+1; WFIFOB(fd, plen) = (unsigned char)len; // won't be higher; the column size is 32 @@ -711,12 +711,12 @@ int inter_accreg_fromsql(uint32 account_id, uint32 char_id, int fd, int type) safestrncpy(WFIFOCP(fd,plen), data, len); plen += len; - Sql_GetData(sql_handle, 1, &data, NULL); + Sql_GetData(sql_handle, 1, &data, nullptr); WFIFOL(fd, plen) = (uint32)atol(data); plen += 4; - Sql_GetData(sql_handle, 2, &data, NULL); + Sql_GetData(sql_handle, 2, &data, nullptr); len = strlen(data)+1; WFIFOB(fd, plen) = (unsigned char)len; // won't be higher; the column size is 254 @@ -782,7 +782,7 @@ int inter_accreg_fromsql(uint32 account_id, uint32 char_id, int fd, int type) * { keyLength(B), key(), index(L), value(L) } **/ while ( SQL_SUCCESS == Sql_NextRow(sql_handle) ) { - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); len = strlen(data)+1; WFIFOB(fd, plen) = (unsigned char)len;/* won't be higher; the column size is 32 */ @@ -791,14 +791,14 @@ int inter_accreg_fromsql(uint32 account_id, uint32 char_id, int fd, int type) safestrncpy(WFIFOCP(fd,plen), data, len); plen += len; - Sql_GetData(sql_handle, 1, &data, NULL); + Sql_GetData(sql_handle, 1, &data, nullptr); WFIFOL(fd, plen) = (uint32)atol(data); plen += 4; - Sql_GetData(sql_handle, 2, &data, NULL); + Sql_GetData(sql_handle, 2, &data, nullptr); - WFIFOQ(fd, plen) = strtoll(data,NULL,10); + WFIFOQ(fd, plen) = strtoll(data,nullptr,10); plen += 8; WFIFOW(fd, 14) += 1; @@ -837,7 +837,7 @@ int inter_config_read(const char* cfgName) FILE* fp; fp = fopen(cfgName, "r"); - if(fp == NULL) { + if(fp == nullptr) { ShowError("File not found: %s\n", cfgName); return 1; } @@ -1376,13 +1376,13 @@ int mapif_parse_NameChangeRequest(int fd) // Check Authorised letters/symbols in the name if (charserv_config.char_config.char_name_option == 1) { // only letters/symbols in char_name_letters are authorised for (i = 0; i < NAME_LENGTH && name[i]; i++) - if (strchr(charserv_config.char_config.char_name_letters, name[i]) == NULL) { + if (strchr(charserv_config.char_config.char_name_letters, name[i]) == nullptr) { mapif_namechange_ack(fd, account_id, char_id, type, 0, name); return 0; } } else if (charserv_config.char_config.char_name_option == 2) { // letters/symbols in char_name_letters are forbidden for (i = 0; i < NAME_LENGTH && name[i]; i++) - if (strchr(charserv_config.char_config.char_name_letters, name[i]) != NULL) { + if (strchr(charserv_config.char_config.char_name_letters, name[i]) != nullptr) { mapif_namechange_ack(fd, account_id, char_id, type, 0, name); return 0; } diff --git a/src/common/cli.cpp b/src/common/cli.cpp index b520cdbc11..6ccb5eaf5c 100644 --- a/src/common/cli.cpp +++ b/src/common/cli.cpp @@ -218,7 +218,7 @@ TIMER_FUNC(parse_console_timer){ memset(buf,0,MAX_CONSOLE_IN); //clear out buf if(cli_hasevent()){ - if(fgets(buf, MAX_CONSOLE_IN, stdin)==NULL) + if(fgets(buf, MAX_CONSOLE_IN, stdin)==nullptr) return -1; else if(strlen(buf)>MIN_CONSOLE_IN) parse_console(buf); diff --git a/src/common/conf.cpp b/src/common/conf.cpp index f075031d12..b24fa40c4b 100644 --- a/src/common/conf.cpp +++ b/src/common/conf.cpp @@ -33,7 +33,7 @@ void config_setting_copy_simple(config_setting_t *parent, const config_setting_t else { config_setting_t *set = config_setting_add(parent, config_setting_name(src), config_setting_type(src)); - if (set == NULL) + if (set == nullptr) return; if (CONFIG_TYPE_INT == config_setting_type(src)) { @@ -54,7 +54,7 @@ void config_setting_copy_simple(config_setting_t *parent, const config_setting_t void config_setting_copy_elem(config_setting_t *parent, const config_setting_t *src) { - config_setting_t *set = NULL; + config_setting_t *set = nullptr; if (config_setting_is_aggregate(src)) config_setting_copy_aggregate(parent, src); @@ -80,7 +80,7 @@ void config_setting_copy_aggregate(config_setting_t *parent, const config_settin newAgg = config_setting_add(parent, config_setting_name(src), config_setting_type(src)); - if (newAgg == NULL) + if (newAgg == nullptr) return; n = config_setting_length(src); diff --git a/src/common/core.cpp b/src/common/core.cpp index d295bf2030..1f947f5ff4 100644 --- a/src/common/core.cpp +++ b/src/common/core.cpp @@ -50,7 +50,7 @@ Core* global_core = nullptr; char db_path[12] = "db"; /// relative path for db from server char conf_path[12] = "conf"; /// relative path for conf from server -char *SERVER_NAME = NULL; +char *SERVER_NAME = nullptr; #ifndef MINICORE // minimalist Core // Added by Gabuzomeu @@ -177,7 +177,7 @@ const char* get_svn_revision(void) { // - ignores database file structure // - assumes the data in NODES.dav_cache column ends with "!svn/ver//)" // - since it's a cache column, the data might not even exist - if( (fp = fopen(".svn" PATHSEP_STR "wc.db", "rb")) != NULL || (fp = fopen(".." PATHSEP_STR ".svn" PATHSEP_STR "wc.db", "rb")) != NULL ) + if( (fp = fopen(".svn" PATHSEP_STR "wc.db", "rb")) != nullptr || (fp = fopen(".." PATHSEP_STR ".svn" PATHSEP_STR "wc.db", "rb")) != nullptr ) { #ifndef SVNNODEPATH //not sure how to handle branches, so i'll leave this overridable define until a better solution comes up @@ -220,7 +220,7 @@ const char* get_svn_revision(void) { } // subversion 1.6 and older? - if ((fp = fopen(".svn/entries", "r")) != NULL) + if ((fp = fopen(".svn/entries", "r")) != nullptr) { char line[1024]; int rev; @@ -239,8 +239,8 @@ const char* get_svn_revision(void) { else { // Bin File format - if ( fgets(line, sizeof(line), fp) == NULL ) { printf("Can't get bin name\n"); } // Get the name - if ( fgets(line, sizeof(line), fp) == NULL ) { printf("Can't get entries kind\n"); } // Get the entries kind + if ( fgets(line, sizeof(line), fp) == nullptr ) { printf("Can't get bin name\n"); } // Get the name + if ( fgets(line, sizeof(line), fp) == nullptr ) { printf("Can't get entries kind\n"); } // Get the entries kind if(fgets(line, sizeof(line), fp)) // Get the rev numver { snprintf(svn_version_buffer, sizeof(svn_version_buffer), "%d", atoi(line)); @@ -267,8 +267,8 @@ const char *get_git_hash (void) { if( GitHash[0] != '\0' ) return GitHash; - if( (fp = fopen(".git/refs/remotes/origin/master", "r")) != NULL || // Already pulled once - (fp = fopen(".git/refs/heads/master", "r")) != NULL ) { // Cloned only + if( (fp = fopen(".git/refs/remotes/origin/master", "r")) != nullptr || // Already pulled once + (fp = fopen(".git/refs/heads/master", "r")) != nullptr ) { // Cloned only char line[64]; char *rev = (char*)malloc(sizeof(char) * 50); @@ -340,8 +340,8 @@ int Core::start( int argc, char **argv ){ {// initialize program arguments char *p1; - if((p1 = strrchr(argv[0], '/')) != NULL || (p1 = strrchr(argv[0], '\\')) != NULL ){ - char *pwd = NULL; //path working directory + if((p1 = strrchr(argv[0], '/')) != nullptr || (p1 = strrchr(argv[0], '\\')) != nullptr ){ + char *pwd = nullptr; //path working directory SERVER_NAME = ++p1; size_t n = p1-argv[0]; //calc dir name len pwd = safestrncpy((char*)malloc(n + 1), argv[0], n); diff --git a/src/common/db.cpp b/src/common/db.cpp index a61f3b1019..d4348f84d0 100644 --- a/src/common/db.cpp +++ b/src/common/db.cpp @@ -30,7 +30,7 @@ * How to add new database types: * 1. Add the identifier of the new database type to the enum DBType * 2. If not already there, add the data type of the key to the union DBKey - * 3. If the key can be considered NULL, update the function db_is_key_null + * 3. If the key can be considered nullptr, update the function db_is_key_null * 4. If the key can be duplicated, update the functions db_dup_key and * db_dup_key_free * 5. Create a comparator and update the function db_default_cmp @@ -343,7 +343,7 @@ struct eri *db_alloc_ers; * db_rotate_right - Rotate a tree node to the right. * * db_rebalance - Rebalance the tree. * * db_rebalance_erase - Rebalance the tree after a BLACK node was erased. * - * db_is_key_null - Returns not 0 if the key is considered NULL. * + * db_is_key_null - Returns not 0 if the key is considered nullptr. * * db_dup_key - Duplicate a key for internal use. * * db_dup_key_free - Free the duplicated key. * * db_free_add - Add a node to the free_list of a database. * @@ -491,18 +491,18 @@ static void db_rebalance(DBNode *node, DBNode **root) static void db_rebalance_erase(DBNode *node, DBNode **root) { DBNode *y = node; - DBNode *x = NULL; - DBNode *x_parent = NULL; + DBNode *x = nullptr; + DBNode *x_parent = nullptr; DB_COUNTSTAT(db_rebalance_erase); // Select where to change the tree - if (y->left == NULL) { // no left + if (y->left == nullptr) { // no left x = y->right; - } else if (y->right == NULL) { // no right + } else if (y->right == nullptr) { // no right x = y->left; } else { // both exist, go to the leftmost node of the right sub-tree y = y->right; - while (y->left != NULL) + while (y->left != nullptr) y = y->left; x = y->right; } @@ -559,7 +559,7 @@ static void db_rebalance_erase(DBNode *node, DBNode **root) // Restore the RED-BLACK properties if (y->color != RED) { - while (x != *root && (x == NULL || x->color == BLACK)) { + while (x != *root && (x == nullptr || x->color == BLACK)) { DBNode *w; if (x == x_parent->left) { w = x_parent->right; @@ -569,13 +569,13 @@ static void db_rebalance_erase(DBNode *node, DBNode **root) db_rotate_left(x_parent, root); w = x_parent->right; } - if ((w->left == NULL || w->left->color == BLACK) && - (w->right == NULL || w->right->color == BLACK)) { + if ((w->left == nullptr || w->left->color == BLACK) && + (w->right == nullptr || w->right->color == BLACK)) { w->color = RED; x = x_parent; x_parent = x_parent->parent; } else { - if (w->right == NULL || w->right->color == BLACK) { + if (w->right == nullptr || w->right->color == BLACK) { if (w->left) w->left->color = BLACK; w->color = RED; db_rotate_right(w, root); @@ -595,13 +595,13 @@ static void db_rebalance_erase(DBNode *node, DBNode **root) db_rotate_right(x_parent, root); w = x_parent->left; } - if ((w->right == NULL || w->right->color == BLACK) && - (w->left == NULL || w->left->color == BLACK)) { + if ((w->right == nullptr || w->right->color == BLACK) && + (w->left == nullptr || w->left->color == BLACK)) { w->color = RED; x = x_parent; x_parent = x_parent->parent; } else { - if (w->left == NULL || w->left->color == BLACK) { + if (w->left == nullptr || w->left->color == BLACK) { if (w->right) w->right->color = BLACK; w->color = RED; db_rotate_left(w, root); @@ -620,10 +620,10 @@ static void db_rebalance_erase(DBNode *node, DBNode **root) } /** - * Returns not 0 if the key is considered to be NULL. + * Returns not 0 if the key is considered to be nullptr. * @param type Type of database * @param key Key being tested - * @return not 0 if considered NULL, 0 otherwise + * @return not 0 if considered nullptr, 0 otherwise * @private * @see #db_obj_get(DBMap*,DBKey) * @see #db_obj_put(DBMap*,DBKey,DBData) @@ -635,7 +635,7 @@ static int db_is_key_null(DBType type, DBKey key) switch (type) { case DB_STRING: case DB_ISTRING: - return (key.str == NULL); + return (key.str == nullptr); default: // Not a pointer return 0; @@ -1155,7 +1155,7 @@ static void db_release_data(DBKey key, DBData data, DBRelease which) DB_COUNTSTAT(db_release_data); if (which&DB_RELEASE_DATA && data.type == DB_DATA_PTR) { aFree(data.u.ptr); - data.u.ptr = NULL; + data.u.ptr = nullptr; } } @@ -1177,7 +1177,7 @@ static void db_release_both(DBKey key, DBData data, DBRelease which) if (which&DB_RELEASE_KEY) aFree((char*)key.str); // needs to be a pointer if (which&DB_RELEASE_DATA && data.type == DB_DATA_PTR) { aFree(data.u.ptr); - data.u.ptr = NULL; + data.u.ptr = nullptr; } } @@ -1217,7 +1217,7 @@ static void db_release_both(DBKey key, DBData data, DBRelease which) /** * Fetches the first entry in the database. * Returns the data of the entry. - * Puts the key in out_key, if out_key is not NULL. + * Puts the key in out_key, if out_key is not nullptr. * @param self Iterator * @param out_key Key of the entry * @return Data of the entry @@ -1231,7 +1231,7 @@ DBData* dbit_obj_first(DBIterator* self, DBKey* out_key) DB_COUNTSTAT(dbit_first); // position before the first entry it->ht_index = -1; - it->node = NULL; + it->node = nullptr; // get next entry return self->next(self, out_key); } @@ -1239,7 +1239,7 @@ DBData* dbit_obj_first(DBIterator* self, DBKey* out_key) /** * Fetches the last entry in the database. * Returns the data of the entry. - * Puts the key in out_key, if out_key is not NULL. + * Puts the key in out_key, if out_key is not nullptr. * @param self Iterator * @param out_key Key of the entry * @return Data of the entry @@ -1253,7 +1253,7 @@ DBData* dbit_obj_last(DBIterator* self, DBKey* out_key) DB_COUNTSTAT(dbit_last); // position after the last entry it->ht_index = HASH_SIZE; - it->node = NULL; + it->node = nullptr; // get previous entry return self->prev(self, out_key); } @@ -1261,7 +1261,7 @@ DBData* dbit_obj_last(DBIterator* self, DBKey* out_key) /** * Fetches the next entry in the database. * Returns the data of the entry. - * Puts the key in out_key, if out_key is not NULL. + * Puts the key in out_key, if out_key is not nullptr. * @param self Iterator * @param out_key Key of the entry * @return Data of the entry @@ -1279,17 +1279,17 @@ DBData* dbit_obj_next(DBIterator* self, DBKey* out_key) if( it->ht_index < 0 ) {// get first node it->ht_index = 0; - it->node = NULL; + it->node = nullptr; } node = it->node; memset(&fake, 0, sizeof(fake)); for( ; it->ht_index < HASH_SIZE; ++(it->ht_index) ) { // Iterate in the order: left tree, current node, right tree - if( node == NULL ) + if( node == nullptr ) {// prepare initial node of this hash node = it->db->ht[it->ht_index]; - if( node == NULL ) + if( node == nullptr ) continue;// next hash fake.right = node; node = &fake; @@ -1313,9 +1313,9 @@ DBData* dbit_obj_next(DBIterator* self, DBKey* out_key) node = parent; parent = node->parent; } - if( parent == NULL ) + if( parent == nullptr ) {// next hash - node = NULL; + node = nullptr; break; } node = parent; @@ -1330,14 +1330,14 @@ DBData* dbit_obj_next(DBIterator* self, DBKey* out_key) } } } - it->node = NULL; - return NULL;// not found + it->node = nullptr; + return nullptr;// not found } /** * Fetches the previous entry in the database. * Returns the data of the entry. - * Puts the key in out_key, if out_key is not NULL. + * Puts the key in out_key, if out_key is not nullptr. * @param self Iterator * @param out_key Key of the entry * @return Data of the entry @@ -1355,17 +1355,17 @@ DBData* dbit_obj_prev(DBIterator* self, DBKey* out_key) if( it->ht_index >= HASH_SIZE ) {// get last node it->ht_index = HASH_SIZE-1; - it->node = NULL; + it->node = nullptr; } node = it->node; memset(&fake, 0, sizeof(fake)); for( ; it->ht_index >= 0; --(it->ht_index) ) { // Iterate in the order: right tree, current node, left tree - if( node == NULL ) + if( node == nullptr ) {// prepare initial node of this hash node = it->db->ht[it->ht_index]; - if( node == NULL ) + if( node == nullptr ) continue;// next hash fake.left = node; node = &fake; @@ -1389,9 +1389,9 @@ DBData* dbit_obj_prev(DBIterator* self, DBKey* out_key) node = parent; parent = node->parent; } - if( parent == NULL ) + if( parent == nullptr ) {// next hash - node = NULL; + node = nullptr; break; } node = parent; @@ -1406,13 +1406,13 @@ DBData* dbit_obj_prev(DBIterator* self, DBKey* out_key) } } } - it->node = NULL; - return NULL;// not found + it->node = nullptr; + return nullptr;// not found } /** * Returns true if the fetched entry exists. - * The databases entries might have NULL data, so use this to to test if + * The databases entries might have nullptr data, so use this to to test if * the iterator is done. * @param self Iterator * @return true if the entry exists @@ -1431,7 +1431,7 @@ bool dbit_obj_exists(DBIterator* self) * Removes the current entry from the database. * NOTE: {@link DBIterator#exists} will return false until another entry * is fetched - * Puts data of the removed entry in out_data, if out_data is not NULL (unless data has been released) + * Puts data of the removed entry in out_data, if out_data is not nullptr (unless data has been released) * @param self Iterator * @param out_data Data of the removed entry. * @return 1 if entry was removed, 0 otherwise @@ -1451,7 +1451,7 @@ int dbit_obj_remove(DBIterator* self, DBData *out_data) { DBMap_impl* db = it->db; if( db->cache == node ) - db->cache = NULL; + db->cache = nullptr; db->release(node->key, node->data, DB_RELEASE_DATA); if( out_data ) memcpy(out_data, &node->data, sizeof(DBData)); @@ -1504,7 +1504,7 @@ static DBIterator* db_obj_iterator(DBMap* self) /* Initial state (before the first entry) */ it->db = db; it->ht_index = -1; - it->node = NULL; + it->node = nullptr; /* Lock the database */ db_free_lock(db); return &it->vtable; @@ -1525,7 +1525,7 @@ static bool db_obj_exists(DBMap* self, DBKey key) bool found = false; DB_COUNTSTAT(db_exists); - if (db == NULL) return false; // nullpo candidate + if (db == nullptr) return false; // nullpo candidate if (!(db->options&DB_OPT_ALLOW_NULL_KEY) && db_is_key_null(db->type, key)) { return false; // nullpo candidate } @@ -1564,7 +1564,7 @@ static bool db_obj_exists(DBMap* self, DBKey key) * Get the data of the entry identified by the key. * @param self Interface of the database * @param key Key that identifies the entry - * @return Data of the entry or NULL if not found + * @return Data of the entry or nullptr if not found * @protected * @see DBMap#get */ @@ -1572,20 +1572,20 @@ static DBData* db_obj_get(DBMap* self, DBKey key) { DBMap_impl* db = (DBMap_impl*)self; DBNode *node; - DBData *data = NULL; + DBData *data = nullptr; DB_COUNTSTAT(db_get); - if (db == NULL) return NULL; // nullpo candidate + if (db == nullptr) return nullptr; // nullpo candidate if (!(db->options&DB_OPT_ALLOW_NULL_KEY) && db_is_key_null(db->type, key)) { - ShowError("db_get: Attempted to retrieve non-allowed NULL key for db allocated at %s:%d\n",db->alloc_file, db->alloc_line); - return NULL; // nullpo candidate + ShowError("db_get: Attempted to retrieve non-allowed nullptr key for db allocated at %s:%d\n",db->alloc_file, db->alloc_line); + return nullptr; // nullpo candidate } if (db->cache && db->cmp(key, db->cache->key, db->maxlen) == 0) { #if defined(DEBUG) if (db->cache->deleted) { ShowDebug("db_get: Cache contains a deleted node. Please report this!!!\n"); - return NULL; + return nullptr; } #endif return &db->cache->data; // cache hit @@ -1614,7 +1614,7 @@ static DBData* db_obj_get(DBMap* self, DBKey key) /** * Get the data of the entries matched by match. * It puts a maximum of max entries into buf. - * If buf is NULL, it only counts the matches. + * If buf is nullptr, it only counts the matches. * Returns the number of entries that matched. * NOTE: if the value returned is greater than max, only the * first max entries found are put into the buffer. @@ -1636,8 +1636,8 @@ static unsigned int db_obj_vgetall(DBMap* self, DBData **buf, unsigned int max, unsigned int ret = 0; DB_COUNTSTAT(db_vgetall); - if (db == NULL) return 0; // nullpo candidate - if (match == NULL) return 0; // nullpo candidate + if (db == nullptr) return 0; // nullpo candidate + if (match == nullptr) return 0; // nullpo candidate db_free_lock(db); for (i = 0; i < HASH_SIZE; i++) { @@ -1685,7 +1685,7 @@ static unsigned int db_obj_vgetall(DBMap* self, DBData **buf, unsigned int max, * Just calls {@link DBMap#vgetall}. * Get the data of the entries matched by match. * It puts a maximum of max entries into buf. - * If buf is NULL, it only counts the matches. + * If buf is nullptr, it only counts the matches. * Returns the number of entries that matched. * NOTE: if the value returned is greater than max, only the * first max entries found are put into the buffer. @@ -1705,7 +1705,7 @@ static unsigned int db_obj_getall(DBMap* self, DBData **buf, unsigned int max, D unsigned int ret; DB_COUNTSTAT(db_getall); - if (self == NULL) return 0; // nullpo candidate + if (self == nullptr) return 0; // nullpo candidate va_start(args, match); ret = self->vgetall(self, buf, max, match, args); @@ -1729,20 +1729,20 @@ static DBData* db_obj_vensure(DBMap* self, DBKey key, DBCreateData create, va_li { DBMap_impl* db = (DBMap_impl*)self; DBNode *node; - DBNode *parent = NULL; + DBNode *parent = nullptr; unsigned int hash; int c = 0; - DBData *data = NULL; + DBData *data = nullptr; DB_COUNTSTAT(db_vensure); - if (db == NULL) return NULL; // nullpo candidate - if (create == NULL) { - ShowError("db_ensure: Create function is NULL for db allocated at %s:%d\n",db->alloc_file, db->alloc_line); - return NULL; // nullpo candidate + if (db == nullptr) return nullptr; // nullpo candidate + if (create == nullptr) { + ShowError("db_ensure: Create function is nullptr for db allocated at %s:%d\n",db->alloc_file, db->alloc_line); + return nullptr; // nullpo candidate } if (!(db->options&DB_OPT_ALLOW_NULL_KEY) && db_is_key_null(db->type, key)) { - ShowError("db_ensure: Attempted to use non-allowed NULL key for db allocated at %s:%d\n",db->alloc_file, db->alloc_line); - return NULL; // nullpo candidate + ShowError("db_ensure: Attempted to use non-allowed nullptr key for db allocated at %s:%d\n",db->alloc_file, db->alloc_line); + return nullptr; // nullpo candidate } if (db->cache && db->cmp(key, db->cache->key, db->maxlen) == 0) @@ -1763,23 +1763,23 @@ static DBData* db_obj_vensure(DBMap* self, DBKey key, DBCreateData create, va_li node = node->right; } // Create node if necessary - if (node == NULL) { + if (node == nullptr) { va_list argscopy; if (db->item_count == UINT32_MAX) { ShowError("db_vensure: item_count overflow, aborting item insertion.\n" "Database allocated at %s:%d", db->alloc_file, db->alloc_line); - return NULL; + return nullptr; } DB_COUNTSTAT(db_node_alloc); node = ers_alloc(db->nodes, struct dbn); - node->left = NULL; - node->right = NULL; + node->left = nullptr; + node->right = nullptr; node->deleted = 0; db->item_count++; if (c == 0) { // hash entry is empty node->color = BLACK; - node->parent = NULL; + node->parent = nullptr; db->ht[hash] = node; } else { node->color = RED; @@ -1828,10 +1828,10 @@ static DBData* db_obj_vensure(DBMap* self, DBKey key, DBCreateData create, va_li static DBData* db_obj_ensure(DBMap* self, DBKey key, DBCreateData create, ...) { va_list args; - DBData *ret = NULL; + DBData *ret = nullptr; DB_COUNTSTAT(db_ensure); - if (self == NULL) return NULL; // nullpo candidate + if (self == nullptr) return nullptr; // nullpo candidate va_start(args, create); ret = self->vensure(self, key, create, args); @@ -1841,7 +1841,7 @@ static DBData* db_obj_ensure(DBMap* self, DBKey key, DBCreateData create, ...) /** * Put the data identified by the key in the database. - * Puts the previous data in out_data, if out_data is not NULL. (unless data has been released) + * Puts the previous data in out_data, if out_data is not nullptr. (unless data has been released) * NOTE: Uses the new key, the old one is released. * @param self Interface of the database * @param key Key that identifies the data @@ -1858,12 +1858,12 @@ static int db_obj_put(DBMap* self, DBKey key, DBData data, DBData *out_data) { DBMap_impl* db = (DBMap_impl*)self; DBNode *node; - DBNode *parent = NULL; + DBNode *parent = nullptr; int c = 0, retval = 0; unsigned int hash; DB_COUNTSTAT(db_put); - if (db == NULL) return 0; // nullpo candidate + if (db == nullptr) return 0; // nullpo candidate if (db->global_lock) { ShowError("db_put: Database is being destroyed, aborting entry insertion.\n" "Database allocated at %s:%d\n", @@ -1871,11 +1871,11 @@ static int db_obj_put(DBMap* self, DBKey key, DBData data, DBData *out_data) return 0; // nullpo candidate } if (!(db->options&DB_OPT_ALLOW_NULL_KEY) && db_is_key_null(db->type, key)) { - ShowError("db_put: Attempted to use non-allowed NULL key for db allocated at %s:%d\n",db->alloc_file, db->alloc_line); + ShowError("db_put: Attempted to use non-allowed nullptr key for db allocated at %s:%d\n",db->alloc_file, db->alloc_line); return 0; // nullpo candidate } - if (!(db->options&DB_OPT_ALLOW_NULL_DATA) && (data.type == DB_DATA_PTR && data.u.ptr == NULL)) { - ShowError("db_put: Attempted to use non-allowed NULL data for db allocated at %s:%d\n",db->alloc_file, db->alloc_line); + if (!(db->options&DB_OPT_ALLOW_NULL_DATA) && (data.type == DB_DATA_PTR && data.u.ptr == nullptr)) { + ShowError("db_put: Attempted to use non-allowed nullptr data for db allocated at %s:%d\n",db->alloc_file, db->alloc_line); return 0; // nullpo candidate } @@ -1909,16 +1909,16 @@ static int db_obj_put(DBMap* self, DBKey key, DBData data, DBData *out_data) } } // allocate a new node if necessary - if (node == NULL) { + if (node == nullptr) { DB_COUNTSTAT(db_node_alloc); node = ers_alloc(db->nodes, struct dbn); - node->left = NULL; - node->right = NULL; + node->left = nullptr; + node->right = nullptr; node->deleted = 0; db->item_count++; if (c == 0) { // hash entry is empty node->color = BLACK; - node->parent = NULL; + node->parent = nullptr; db->ht[hash] = node; } else { node->color = RED; @@ -1949,7 +1949,7 @@ static int db_obj_put(DBMap* self, DBKey key, DBData data, DBData *out_data) /** * Remove an entry from the database. - * Puts the previous data in out_data, if out_data is not NULL. (unless data has been released) + * Puts the previous data in out_data, if out_data is not nullptr. (unless data has been released) * NOTE: The key (of the database) is released in {@link #db_free_add(DBMap_impl*,DBNode*,DBNode **)}. * @param self Interface of the database * @param key Key that identifies the entry @@ -1967,7 +1967,7 @@ static int db_obj_remove(DBMap* self, DBKey key, DBData *out_data) int retval = 0; DB_COUNTSTAT(db_remove); - if (db == NULL) return 0; // nullpo candidate + if (db == nullptr) return 0; // nullpo candidate if (db->global_lock) { ShowError("db_remove: Database is being destroyed. Aborting entry deletion.\n" "Database allocated at %s:%d\n", @@ -1975,7 +1975,7 @@ static int db_obj_remove(DBMap* self, DBKey key, DBData *out_data) return 0; // nullpo candidate } if (!(db->options&DB_OPT_ALLOW_NULL_KEY) && db_is_key_null(db->type, key)) { - ShowError("db_remove: Attempted to use non-allowed NULL key for db allocated at %s:%d\n",db->alloc_file, db->alloc_line); + ShowError("db_remove: Attempted to use non-allowed nullptr key for db allocated at %s:%d\n",db->alloc_file, db->alloc_line); return 0; // nullpo candidate } @@ -1986,7 +1986,7 @@ static int db_obj_remove(DBMap* self, DBKey key, DBData *out_data) if (c == 0) { if (!(node->deleted)) { if (db->cache == node) - db->cache = NULL; + db->cache = nullptr; db->release(node->key, node->data, DB_RELEASE_DATA); if (out_data) memcpy(out_data, &node->data, sizeof(*out_data)); @@ -2023,9 +2023,9 @@ static int db_obj_vforeach(DBMap* self, DBApply func, va_list args) DBNode *parent; DB_COUNTSTAT(db_vforeach); - if (db == NULL) return 0; // nullpo candidate - if (func == NULL) { - ShowError("db_foreach: Passed function is NULL for db allocated at %s:%d\n",db->alloc_file, db->alloc_line); + if (db == nullptr) return 0; // nullpo candidate + if (func == nullptr) { + ShowError("db_foreach: Passed function is nullptr for db allocated at %s:%d\n",db->alloc_file, db->alloc_line); return 0; // nullpo candidate } @@ -2080,7 +2080,7 @@ static int db_obj_foreach(DBMap* self, DBApply func, ...) int ret; DB_COUNTSTAT(db_foreach); - if (self == NULL) return 0; // nullpo candidate + if (self == nullptr) return 0; // nullpo candidate va_start(args, func); ret = self->vforeach(self, func, args); @@ -2109,14 +2109,14 @@ static int db_obj_vclear(DBMap* self, DBApply func, va_list args) DBNode *parent; DB_COUNTSTAT(db_vclear); - if (db == NULL) return 0; // nullpo candidate + if (db == nullptr) return 0; // nullpo candidate db_free_lock(db); - db->cache = NULL; + db->cache = nullptr; for (i = 0; i < HASH_SIZE; i++) { // Apply the func and delete in the order: left tree, right tree, current node node = db->ht[i]; - db->ht[i] = NULL; + db->ht[i] = nullptr; while (node) { parent = node->parent; if (node->left) { @@ -2143,14 +2143,14 @@ static int db_obj_vclear(DBMap* self, DBApply func, va_list args) DB_COUNTSTAT(db_node_free); if (parent) { if (parent->left == node) - parent->left = NULL; + parent->left = nullptr; else - parent->right = NULL; + parent->right = nullptr; } ers_free(db->nodes, node); node = parent; } - db->ht[i] = NULL; + db->ht[i] = nullptr; } db->free_count = 0; db->item_count = 0; @@ -2180,7 +2180,7 @@ static int db_obj_clear(DBMap* self, DBApply func, ...) int ret; DB_COUNTSTAT(db_clear); - if (self == NULL) return 0; // nullpo candidate + if (self == nullptr) return 0; // nullpo candidate va_start(args, func); ret = self->vclear(self, func, args); @@ -2207,7 +2207,7 @@ static int db_obj_vdestroy(DBMap* self, DBApply func, va_list args) int sum; DB_COUNTSTAT(db_vdestroy); - if (db == NULL) return 0; // nullpo candidate + if (db == nullptr) return 0; // nullpo candidate if (db->global_lock) { ShowError("db_vdestroy: Database is already locked for destruction. Aborting second database destruction.\n" "Database allocated at %s:%d\n", @@ -2233,7 +2233,7 @@ static int db_obj_vdestroy(DBMap* self, DBApply func, va_list args) db->global_lock = 1; sum = self->vclear(self, func, args); aFree(db->free_list); - db->free_list = NULL; + db->free_list = nullptr; db->free_max = 0; ers_destroy(db->nodes); db_free_unlock(db); @@ -2263,7 +2263,7 @@ static int db_obj_destroy(DBMap* self, DBApply func, ...) int ret; DB_COUNTSTAT(db_destroy); - if (self == NULL) return 0; // nullpo candidate + if (self == nullptr) return 0; // nullpo candidate va_start(args, func); ret = self->vdestroy(self, func, args); @@ -2285,7 +2285,7 @@ static unsigned int db_obj_size(DBMap* self) unsigned int item_count; DB_COUNTSTAT(db_size); - if (db == NULL) return 0; // nullpo candidate + if (db == nullptr) return 0; // nullpo candidate db_free_lock(db); item_count = db->item_count; @@ -2308,7 +2308,7 @@ static DBType db_obj_type(DBMap* self) DBType type; DB_COUNTSTAT(db_type); - if (db == NULL) return (DBType)-1; // nullpo candidate - TODO what should this return? + if (db == nullptr) return (DBType)-1; // nullpo candidate - TODO what should this return? db_free_lock(db); type = db->type; @@ -2331,7 +2331,7 @@ static DBOptions db_obj_options(DBMap* self) DBOptions options; DB_COUNTSTAT(db_options); - if (db == NULL) return DB_OPT_BASE; // nullpo candidate - TODO what should this return? + if (db == nullptr) return DB_OPT_BASE; // nullpo candidate - TODO what should this return? db_free_lock(db); options = db->options; @@ -2396,7 +2396,7 @@ DBOptions db_fix_options(DBType type, DBOptions options) /** * Returns the default comparator for the specified type of database. * @param type Type of database - * @return Comparator for the type of database or NULL if unknown database + * @return Comparator for the type of database or nullptr if unknown database * @public * @see #db_int_cmp(DBKey,DBKey,unsigned short) * @see #db_uint_cmp(DBKey,DBKey,unsigned short) @@ -2417,14 +2417,14 @@ DBComparator db_default_cmp(DBType type) case DB_UINT64: return &db_uint64_cmp; default: ShowError("db_default_cmp: Unknown database type %u\n", type); - return NULL; + return nullptr; } } /** * Returns the default hasher for the specified type of database. * @param type Type of database - * @return Hasher of the type of database or NULL if unknown database + * @return Hasher of the type of database or nullptr if unknown database * @public * @see #db_int_hash(DBKey,unsigned short) * @see #db_uint_hash(DBKey,unsigned short) @@ -2445,7 +2445,7 @@ DBHasher db_default_hash(DBType type) case DB_UINT64: return &db_uint64_hash; default: ShowError("db_default_hash: Unknown database type %u\n", type); - return NULL; + return nullptr; } } @@ -2499,7 +2499,7 @@ DBReleaser db_custom_release(DBRelease which) case DB_RELEASE_BOTH: return &db_release_both; default: ShowError("db_custom_release: Unknown release options %u\n", which); - return NULL; + return nullptr; } } @@ -2560,7 +2560,7 @@ DBMap* db_alloc(const char *file, const char *func, int line, DBType type, DBOpt db->alloc_file = file; db->alloc_line = line; /* Lock system */ - db->free_list = NULL; + db->free_list = nullptr; db->free_count = 0; db->free_max = 0; db->free_lock = 0; @@ -2571,8 +2571,8 @@ DBMap* db_alloc(const char *file, const char *func, int line, DBType type, DBOpt db->hash = db_default_hash(type); db->release = db_default_release(type, options); for (i = 0; i < HASH_SIZE; i++) - db->ht[i] = NULL; - db->cache = NULL; + db->ht[i] = nullptr; + db->cache = nullptr; db->type = type; db->options = options; db->item_count = 0; @@ -2756,7 +2756,7 @@ unsigned int db_data2ui(DBData *data) /** * Gets void* type data from struct DBData. - * If data is not void* type, returns NULL. + * If data is not void* type, returns nullptr. * @param data Data * @return Void* value of the data. * @public @@ -2766,7 +2766,7 @@ void* db_data2ptr(DBData *data) DB_COUNTSTAT(db_data2ptr); if (data && DB_DATA_PTR == data->type) return data->u.ptr; - return NULL; + return nullptr; } /** @@ -2904,13 +2904,13 @@ void db_final(void) void linkdb_insert( struct linkdb_node** head, void *key, void* data) { struct linkdb_node *node; - if( head == NULL ) return ; + if( head == nullptr ) return ; node = (struct linkdb_node*)aMalloc( sizeof(struct linkdb_node) ); - if( *head == NULL ) { + if( *head == nullptr ) { // first node *head = node; - node->prev = NULL; - node->next = NULL; + node->prev = nullptr; + node->next = nullptr; } else { // link nodes node->next = *head; @@ -2924,7 +2924,7 @@ void linkdb_insert( struct linkdb_node** head, void *key, void* data) void linkdb_vforeach( struct linkdb_node** head, LinkDBFunc func, va_list ap) { struct linkdb_node *node; - if( head == NULL ) return; + if( head == nullptr ) return; node = *head; while ( node ) { va_list argscopy; @@ -2946,7 +2946,7 @@ void* linkdb_search( struct linkdb_node** head, void *key) { int n = 0; struct linkdb_node *node; - if( head == NULL ) return NULL; + if( head == nullptr ) return nullptr; node = *head; while( node ) { if( node->key == key ) { @@ -2964,18 +2964,18 @@ void* linkdb_search( struct linkdb_node** head, void *key) node = node->next; n++; } - return NULL; + return nullptr; } void* linkdb_erase( struct linkdb_node** head, void *key) { struct linkdb_node *node; - if( head == NULL ) return NULL; + if( head == nullptr ) return nullptr; node = *head; while( node ) { if( node->key == key ) { void *data = node->data; - if( node->prev == NULL ) + if( node->prev == nullptr ) *head = node->next; else node->prev->next = node->next; @@ -2986,14 +2986,14 @@ void* linkdb_erase( struct linkdb_node** head, void *key) } node = node->next; } - return NULL; + return nullptr; } void linkdb_replace( struct linkdb_node** head, void *key, void *data ) { int n = 0; struct linkdb_node *node; - if( head == NULL ) return ; + if( head == nullptr ) return ; node = *head; while( node ) { if( node->key == key ) { @@ -3019,12 +3019,12 @@ void linkdb_replace( struct linkdb_node** head, void *key, void *data ) void linkdb_final( struct linkdb_node** head ) { struct linkdb_node *node, *node2; - if( head == NULL ) return ; + if( head == nullptr ) return ; node = *head; while( node ) { node2 = node->next; aFree( node ); node = node2; } - *head = NULL; + *head = nullptr; } diff --git a/src/common/db.hpp b/src/common/db.hpp index f5e4b09d48..7d982711ad 100644 --- a/src/common/db.hpp +++ b/src/common/db.hpp @@ -111,7 +111,7 @@ typedef enum DBType { * See {@link #db_fix_options(DBType,DBOptions)} for restrictions of the * types of databases. * @param DB_OPT_BASE Base options: does not duplicate keys, releases nothing - * and does not allow NULL keys or NULL data. + * and does not allow nullptr keys or nullptr data. * @param DB_OPT_DUP_KEY Duplicates the keys internally. If DB_OPT_RELEASE_KEY * is defined, the real key is freed as soon as the entry is added. * @param DB_OPT_RELEASE_KEY Releases the key. @@ -120,8 +120,8 @@ typedef enum DBType { * WARNING: for functions that return the data (like DBMap::remove), * a dangling pointer will be returned. * @param DB_OPT_RELEASE_BOTH Releases both key and data. - * @param DB_OPT_ALLOW_NULL_KEY Allow NULL keys in the database. - * @param DB_OPT_ALLOW_NULL_DATA Allow NULL data in the database. + * @param DB_OPT_ALLOW_NULL_KEY Allow nullptr keys in the database. + * @param DB_OPT_ALLOW_NULL_DATA Allow nullptr data in the database. * @public * @see #db_fix_options(DBType,DBOptions) * @see #db_default_release(DBType,DBOptions) @@ -295,7 +295,7 @@ struct DBIterator /** * Fetches the first entry in the database. * Returns the data of the entry. - * Puts the key in out_key, if out_key is not NULL. + * Puts the key in out_key, if out_key is not nullptr. * @param self Iterator * @param out_key Key of the entry * @return Data of the entry @@ -306,7 +306,7 @@ struct DBIterator /** * Fetches the last entry in the database. * Returns the data of the entry. - * Puts the key in out_key, if out_key is not NULL. + * Puts the key in out_key, if out_key is not nullptr. * @param self Iterator * @param out_key Key of the entry * @return Data of the entry @@ -317,7 +317,7 @@ struct DBIterator /** * Fetches the next entry in the database. * Returns the data of the entry. - * Puts the key in out_key, if out_key is not NULL. + * Puts the key in out_key, if out_key is not nullptr. * @param self Iterator * @param out_key Key of the entry * @return Data of the entry @@ -328,7 +328,7 @@ struct DBIterator /** * Fetches the previous entry in the database. * Returns the data of the entry. - * Puts the key in out_key, if out_key is not NULL. + * Puts the key in out_key, if out_key is not nullptr. * @param self Iterator * @param out_key Key of the entry * @return Data of the entry @@ -338,7 +338,7 @@ struct DBIterator /** * Returns true if the fetched entry exists. - * The databases entries might have NULL data, so use this to to test if + * The databases entries might have nullptr data, so use this to to test if * the iterator is done. * @param self Iterator * @return true is the entry exists @@ -350,7 +350,7 @@ struct DBIterator * Removes the current entry from the database. * NOTE: {@link DBIterator#exists} will return false until another entry * is fetched - * Puts data of the removed entry in out_data, if out_data is not NULL. + * Puts data of the removed entry in out_data, if out_data is not nullptr. * @param self Iterator * @param out_data Data of the removed entry. * @return 1 if entry was removed, 0 otherwise @@ -400,7 +400,7 @@ struct DBMap { * Get the data of the entry identified by the key. * @param self Database * @param key Key that identifies the entry - * @return Data of the entry or NULL if not found + * @return Data of the entry or nullptr if not found * @protected */ DBData* (*get)(DBMap* self, DBKey key); @@ -409,7 +409,7 @@ struct DBMap { * Just calls {@link DBMap#vgetall}. * Get the data of the entries matched by match. * It puts a maximum of max entries into buf. - * If buf is NULL, it only counts the matches. + * If buf is nullptr, it only counts the matches. * Returns the number of entries that matched. * NOTE: if the value returned is greater than max, only the * first max entries found are put into the buffer. @@ -427,7 +427,7 @@ struct DBMap { /** * Get the data of the entries matched by match. * It puts a maximum of max entries into buf. - * If buf is NULL, it only counts the matches. + * If buf is nullptr, it only counts the matches. * Returns the number of entries that matched. * NOTE: if the value returned is greater than max, only the * first max entries found are put into the buffer. @@ -473,7 +473,7 @@ struct DBMap { /** * Put the data identified by the key in the database. - * Puts the previous data in out_data, if out_data is not NULL. + * Puts the previous data in out_data, if out_data is not nullptr. * NOTE: Uses the new key, the old one is released. * @param self Database * @param key Key that identifies the data @@ -486,7 +486,7 @@ struct DBMap { /** * Remove an entry from the database. - * Puts the previous data in out_data, if out_data is not NULL. + * Puts the previous data in out_data, if out_data is not nullptr. * NOTE: The key (of the database) is released. * @param self Database * @param key Key that identifies the entry @@ -651,44 +651,44 @@ struct DBMap { #define ui64db_i64get(db,k) ( db_data2i64((db)->get((db),db_ui642key(k))) ) // Put pointer-type data into DBMaps of various key types -#define db_put(db,k,d) ( (db)->put((db),(k),db_ptr2data(d),NULL) ) -#define idb_put(db,k,d) ( (db)->put((db),db_i2key(k),db_ptr2data(d),NULL) ) -#define uidb_put(db,k,d) ( (db)->put((db),db_ui2key(k),db_ptr2data(d),NULL) ) -#define strdb_put(db,k,d) ( (db)->put((db),db_str2key(k),db_ptr2data(d),NULL) ) -#define i64db_put(db,k,d) ( (db)->put((db),db_i642key(k),db_ptr2data(d),NULL) ) -#define ui64db_put(db,k,d) ( (db)->put((db),db_ui642key(k),db_ptr2data(d),NULL) ) +#define db_put(db,k,d) ( (db)->put((db),(k),db_ptr2data(d),nullptr) ) +#define idb_put(db,k,d) ( (db)->put((db),db_i2key(k),db_ptr2data(d),nullptr) ) +#define uidb_put(db,k,d) ( (db)->put((db),db_ui2key(k),db_ptr2data(d),nullptr) ) +#define strdb_put(db,k,d) ( (db)->put((db),db_str2key(k),db_ptr2data(d),nullptr) ) +#define i64db_put(db,k,d) ( (db)->put((db),db_i642key(k),db_ptr2data(d),nullptr) ) +#define ui64db_put(db,k,d) ( (db)->put((db),db_ui642key(k),db_ptr2data(d),nullptr) ) // Put int-type data into DBMaps of various key types -#define db_iput(db,k,d) ( (db)->put((db),(k),db_i2data(d),NULL) ) -#define idb_iput(db,k,d) ( (db)->put((db),db_i2key(k),db_i2data(d),NULL) ) -#define uidb_iput(db,k,d) ( (db)->put((db),db_ui2key(k),db_i2data(d),NULL) ) -#define strdb_iput(db,k,d) ( (db)->put((db),db_str2key(k),db_i2data(d),NULL) ) -#define i64db_iput(db,k,d) ( (db)->put((db),db_i642key(k),db_i2data(d),NULL) ) -#define ui64db_iput(db,k,d) ( (db)->put((db),db_ui642key(k),db_i2data(d),NULL) ) +#define db_iput(db,k,d) ( (db)->put((db),(k),db_i2data(d),nullptr) ) +#define idb_iput(db,k,d) ( (db)->put((db),db_i2key(k),db_i2data(d),nullptr) ) +#define uidb_iput(db,k,d) ( (db)->put((db),db_ui2key(k),db_i2data(d),nullptr) ) +#define strdb_iput(db,k,d) ( (db)->put((db),db_str2key(k),db_i2data(d),nullptr) ) +#define i64db_iput(db,k,d) ( (db)->put((db),db_i642key(k),db_i2data(d),nullptr) ) +#define ui64db_iput(db,k,d) ( (db)->put((db),db_ui642key(k),db_i2data(d),nullptr) ) // Put uint-type data into DBMaps of various key types -#define db_uiput(db,k,d) ( (db)->put((db),(k),db_ui2data(d),NULL) ) -#define idb_uiput(db,k,d) ( (db)->put((db),db_i2key(k),db_ui2data(d),NULL) ) -#define uidb_uiput(db,k,d) ( (db)->put((db),db_ui2key(k),db_ui2data(d),NULL) ) -#define strdb_uiput(db,k,d) ( (db)->put((db),db_str2key(k),db_ui2data(d),NULL) ) -#define i64db_uiput(db,k,d) ( (db)->put((db),db_i642key(k),db_ui2data(d),NULL) ) -#define ui64db_uiput(db,k,d) ( (db)->put((db),db_ui642key(k),db_ui2data(d),NULL) ) +#define db_uiput(db,k,d) ( (db)->put((db),(k),db_ui2data(d),nullptr) ) +#define idb_uiput(db,k,d) ( (db)->put((db),db_i2key(k),db_ui2data(d),nullptr) ) +#define uidb_uiput(db,k,d) ( (db)->put((db),db_ui2key(k),db_ui2data(d),nullptr) ) +#define strdb_uiput(db,k,d) ( (db)->put((db),db_str2key(k),db_ui2data(d),nullptr) ) +#define i64db_uiput(db,k,d) ( (db)->put((db),db_i642key(k),db_ui2data(d),nullptr) ) +#define ui64db_uiput(db,k,d) ( (db)->put((db),db_ui642key(k),db_ui2data(d),nullptr) ) // Put int64 data into DBMaps of various key types -#define db_i64put(db,k,d) ( (db)->put((db),(k),db_i642data(d),NULL) ) -#define idb_i64put(db,k,d) ( (db)->put((db),db_i2key(k),db_i642data(d),NULL) ) -#define uidb_i64put(db,k,d) ( (db)->put((db),db_ui2key(k),db_i642data(d),NULL) ) -#define strdb_i64put(db,k,d) ( (db)->put((db),db_str2key(k),db_i642data(d),NULL) ) -#define i64db_i64put(db,k,d) ( (db)->put((db),db_i642key(k),db_i642data(d),NULL) ) -#define ui64db_i64put(db,k,d) ( (db)->put((db),db_ui642key(k),db_i642data(d),NULL) ) +#define db_i64put(db,k,d) ( (db)->put((db),(k),db_i642data(d),nullptr) ) +#define idb_i64put(db,k,d) ( (db)->put((db),db_i2key(k),db_i642data(d),nullptr) ) +#define uidb_i64put(db,k,d) ( (db)->put((db),db_ui2key(k),db_i642data(d),nullptr) ) +#define strdb_i64put(db,k,d) ( (db)->put((db),db_str2key(k),db_i642data(d),nullptr) ) +#define i64db_i64put(db,k,d) ( (db)->put((db),db_i642key(k),db_i642data(d),nullptr) ) +#define ui64db_i64put(db,k,d) ( (db)->put((db),db_ui642key(k),db_i642data(d),nullptr) ) // Remove entry from DBMaps of various key types -#define db_remove(db,k) ( (db)->remove((db),(k),NULL) ) -#define idb_remove(db,k) ( (db)->remove((db),db_i2key(k),NULL) ) -#define uidb_remove(db,k) ( (db)->remove((db),db_ui2key(k),NULL) ) -#define strdb_remove(db,k) ( (db)->remove((db),db_str2key(k),NULL) ) -#define i64db_remove(db,k) ( (db)->remove((db),db_i642key(k),NULL) ) -#define ui64db_remove(db,k) ( (db)->remove((db),db_ui642key(k),NULL) ) +#define db_remove(db,k) ( (db)->remove((db),(k),nullptr) ) +#define idb_remove(db,k) ( (db)->remove((db),db_i2key(k),nullptr) ) +#define uidb_remove(db,k) ( (db)->remove((db),db_ui2key(k),nullptr) ) +#define strdb_remove(db,k) ( (db)->remove((db),db_str2key(k),nullptr) ) +#define i64db_remove(db,k) ( (db)->remove((db),db_i642key(k),nullptr) ) +#define ui64db_remove(db,k) ( (db)->remove((db),db_ui642key(k),nullptr) ) //These are discarding the possible vargs you could send to the function, so those //that require vargs must not use these defines. @@ -706,16 +706,16 @@ struct DBMap { #define stridb_alloc(opt,maxlen) db_alloc(__FILE__,__func__,__LINE__,DB_ISTRING,(opt),(maxlen)) #define i64db_alloc(opt) db_alloc(__FILE__,__func__,__LINE__,DB_INT64,(opt),sizeof(int64)) #define ui64db_alloc(opt) db_alloc(__FILE__,__func__,__LINE__,DB_UINT64,(opt),sizeof(uint64)) -#define db_destroy(db) ( (db)->destroy((db),NULL) ) +#define db_destroy(db) ( (db)->destroy((db),nullptr) ) // Other macros -#define db_clear(db) ( (db)->clear((db),NULL) ) +#define db_clear(db) ( (db)->clear((db),nullptr) ) #define db_size(db) ( (db)->size(db) ) #define db_iterator(db) ( (db)->iterator(db) ) -#define dbi_first(dbi) ( db_data2ptr((dbi)->first((dbi),NULL)) ) -#define dbi_last(dbi) ( db_data2ptr((dbi)->last((dbi),NULL)) ) -#define dbi_next(dbi) ( db_data2ptr((dbi)->next((dbi),NULL)) ) -#define dbi_prev(dbi) ( db_data2ptr((dbi)->prev((dbi),NULL)) ) -#define dbi_remove(dbi) ( (dbi)->remove((dbi),NULL) ) +#define dbi_first(dbi) ( db_data2ptr((dbi)->first((dbi),nullptr)) ) +#define dbi_last(dbi) ( db_data2ptr((dbi)->last((dbi),nullptr)) ) +#define dbi_next(dbi) ( db_data2ptr((dbi)->next((dbi),nullptr)) ) +#define dbi_prev(dbi) ( db_data2ptr((dbi)->prev((dbi),nullptr)) ) +#define dbi_remove(dbi) ( (dbi)->remove((dbi),nullptr) ) #define dbi_exists(dbi) ( (dbi)->exists(dbi) ) #define dbi_destroy(dbi) ( (dbi)->destroy(dbi) ) @@ -760,7 +760,7 @@ DBOptions db_fix_options(DBType type, DBOptions options); /** * Returns the default comparator for the type of database. * @param type Type of database - * @return Comparator for the type of database or NULL if unknown database + * @return Comparator for the type of database or nullptr if unknown database * @public * @see #DBType * @see #DBComparator @@ -770,7 +770,7 @@ DBComparator db_default_cmp(DBType type); /** * Returns the default hasher for the specified type of database. * @param type Type of database - * @return Hasher of the type of database or NULL if unknown database + * @return Hasher of the type of database or nullptr if unknown database * @public * @see #DBType * @see #DBHasher @@ -920,7 +920,7 @@ unsigned int db_data2ui(DBData *data); /** * Gets void* type data from struct DBData. - * If data is not void* type, returns NULL. + * If data is not void* type, returns nullptr. * @param data Data * @return Void* value of the data. * @public @@ -1082,7 +1082,7 @@ void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); /// @param __type Type of data /// @param __var Variable name #define VECTOR_VAR(__type,__var) \ - VECTOR_DECL(__type) __var = {0,0,NULL} + VECTOR_DECL(__type) __var = {0,0,nullptr} @@ -1091,7 +1091,7 @@ void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); /// @param __name Structure name /// @param __var Variable name #define VECTOR_STRUCT_VAR(__name,__var) \ - struct __name __var = {0,0,NULL} + struct __name __var = {0,0,nullptr} @@ -1177,7 +1177,7 @@ void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); } \ else if( (__n) == 0 && VECTOR_CAPACITY(__vec) ) \ { /* clear vector */ \ - aFree(VECTOR_DATA(__vec)); VECTOR_DATA(__vec) = NULL; /* free data */ \ + aFree(VECTOR_DATA(__vec)); VECTOR_DATA(__vec) = nullptr; /* free data */ \ VECTOR_CAPACITY(__vec) = 0; /* clear capacity */ \ VECTOR_LENGTH(__vec) = 0; /* clear length */ \ } \ @@ -1368,7 +1368,7 @@ void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); do{ \ if( VECTOR_CAPACITY(__vec) ) \ { \ - aFree(VECTOR_DATA(__vec)); VECTOR_DATA(__vec) = NULL; /* clear allocated array */ \ + aFree(VECTOR_DATA(__vec)); VECTOR_DATA(__vec) = nullptr; /* clear allocated array */ \ VECTOR_CAPACITY(__vec) = 0; /* clear capacity */ \ VECTOR_LENGTH(__vec) = 0; /* clear length */ \ } \ diff --git a/src/common/ers.cpp b/src/common/ers.cpp index 17b63d1794..b6f3d2811d 100644 --- a/src/common/ers.cpp +++ b/src/common/ers.cpp @@ -118,8 +118,8 @@ struct ers_instance_t { // Array containing a pointer for all ers_cache structures -static ers_cache_t *CacheList = NULL; -static struct ers_instance_t *InstanceList = NULL; +static ers_cache_t *CacheList = nullptr; +static struct ers_instance_t *InstanceList = nullptr; /** * @param Options the options from the instance seeking a cache, we use it to give it a cache with matching configuration @@ -134,8 +134,8 @@ static ers_cache_t *ers_find_cache(unsigned int size, enum ERSOptions Options) { CREATE(cache, ers_cache_t, 1); cache->ObjectSize = size; cache->ReferenceCount = 0; - cache->ReuseList = NULL; - cache->Blocks = NULL; + cache->ReuseList = nullptr; + cache->Blocks = nullptr; cache->Free = 0; cache->Used = 0; cache->UsedObjs = 0; @@ -143,7 +143,7 @@ static ers_cache_t *ers_find_cache(unsigned int size, enum ERSOptions Options) { cache->ChunkSize = ERS_BLOCK_ENTRIES; cache->Options = (enum ERSOptions)(Options & ERS_CACHE_OPTIONS); - if (CacheList == NULL) + if (CacheList == nullptr) { CacheList = cache; } @@ -152,7 +152,7 @@ static ers_cache_t *ers_find_cache(unsigned int size, enum ERSOptions Options) { cache->Next = CacheList; cache->Next->Prev = cache; CacheList = cache; - CacheList->Prev = NULL; + CacheList->Prev = nullptr; } return cache; @@ -183,12 +183,12 @@ static void *ers_obj_alloc_entry(ERS *self) struct ers_instance_t *instance = (struct ers_instance_t *)self; void *ret; - if (instance == NULL) { - ShowError("ers_obj_alloc_entry: NULL object, aborting entry freeing.\n"); - return NULL; + if (instance == nullptr) { + ShowError("ers_obj_alloc_entry: nullptr object, aborting entry freeing.\n"); + return nullptr; } - if (instance->Cache->ReuseList != NULL) { + if (instance->Cache->ReuseList != nullptr) { ret = (void *)((unsigned char *)instance->Cache->ReuseList + sizeof(struct ers_list)); instance->Cache->ReuseList = instance->Cache->ReuseList->Next; } else if (instance->Cache->Free > 0) { @@ -218,11 +218,11 @@ static void ers_obj_free_entry(ERS *self, void *entry) struct ers_instance_t *instance = (struct ers_instance_t *)self; struct ers_list *reuse = (struct ers_list *)((unsigned char *)entry - sizeof(struct ers_list)); - if (instance == NULL) { - ShowError("ers_obj_free_entry: NULL object, aborting entry freeing.\n"); + if (instance == nullptr) { + ShowError("ers_obj_free_entry: nullptr object, aborting entry freeing.\n"); return; - } else if (entry == NULL) { - ShowError("ers_obj_free_entry: NULL entry, nothing to free.\n"); + } else if (entry == nullptr) { + ShowError("ers_obj_free_entry: nullptr entry, nothing to free.\n"); return; } @@ -239,8 +239,8 @@ static size_t ers_obj_entry_size(ERS *self) { struct ers_instance_t *instance = (struct ers_instance_t *)self; - if (instance == NULL) { - ShowError("ers_obj_entry_size: NULL object, aborting entry freeing.\n"); + if (instance == nullptr) { + ShowError("ers_obj_entry_size: nullptr object, aborting entry freeing.\n"); return 0; } @@ -251,8 +251,8 @@ static void ers_obj_destroy(ERS *self) { struct ers_instance_t *instance = (struct ers_instance_t *)self; - if (instance == NULL) { - ShowError("ers_obj_destroy: NULL object, aborting entry freeing.\n"); + if (instance == nullptr) { + ShowError("ers_obj_destroy: nullptr object, aborting entry freeing.\n"); return; } @@ -315,13 +315,13 @@ ERS *ers_new(uint32 size, const char *name, enum ERSOptions options) instance->Cache->ReferenceCount++; - if (InstanceList == NULL) { + if (InstanceList == nullptr) { InstanceList = instance; } else { instance->Next = InstanceList; instance->Next->Prev = instance; InstanceList = instance; - InstanceList->Prev = NULL; + InstanceList->Prev = nullptr; } instance->Count = 0; diff --git a/src/common/ers.hpp b/src/common/ers.hpp index 2b22105e92..810a552e17 100644 --- a/src/common/ers.hpp +++ b/src/common/ers.hpp @@ -138,7 +138,7 @@ typedef struct eri { # define ers_destroy(obj) # define ers_chunk_size(obj,size) // Disable the public functions -# define ers_new(size,name,options) NULL +# define ers_new(size,name,options) nullptr # define ers_report() # define ers_final() #else /* not DISABLE_ERS */ diff --git a/src/common/grfio.cpp b/src/common/grfio.cpp index a0793e555b..80d84b9414 100644 --- a/src/common/grfio.cpp +++ b/src/common/grfio.cpp @@ -44,12 +44,12 @@ typedef struct _FILELIST { // stores info about every loaded file -FILELIST* filelist = NULL; +FILELIST* filelist = nullptr; int filelist_entrys = 0; int filelist_maxentry = 0; // stores grf file names -char** gentry_table = NULL; +char** gentry_table = nullptr; int gentry_entrys = 0; int gentry_maxentry = 0; @@ -286,21 +286,21 @@ static FILELIST* filelist_find(const char* fname) int hash, index; if (!filelist) - return NULL; + return nullptr; hash = filelist_hash[filehash(fname)]; for (index = hash; index != -1; index = filelist[index].next) if(!strcmpi(filelist[index].fn, fname)) break; - return (index >= 0) ? &filelist[index] : NULL; + return (index >= 0) ? &filelist[index] : nullptr; } // returns the original file name char* grfio_find_file(const char* fname) { FILELIST *filelist_res = filelist_find(fname); - if (!filelist_res) return NULL; + if (!filelist_res) return nullptr; return (!filelist_res->fnd ? filelist_res->fn : filelist_res->fnd); } @@ -332,7 +332,7 @@ static FILELIST* filelist_add(FILELIST* entry) static FILELIST* filelist_modify(FILELIST* entry) { FILELIST* fentry = filelist_find(entry->fn); - if (fentry != NULL) { + if (fentry != nullptr) { int tmp = fentry->next; memcpy(fentry, entry, sizeof(FILELIST)); fentry->next = tmp; @@ -345,7 +345,7 @@ static FILELIST* filelist_modify(FILELIST* entry) // shrinks the file list array if too long static void filelist_compact(void) { - if (filelist == NULL) + if (filelist == nullptr) return; if (filelist_entrys < filelist_maxentry) { @@ -387,16 +387,16 @@ static void grfio_localpath_create(char* buffer, size_t size, const char* filena /// Reads a file into a newly allocated buffer (from grf or data directory). void* grfio_reads(const char* fname, int* size) { - unsigned char* buf2 = NULL; + unsigned char* buf2 = nullptr; FILELIST* entry = filelist_find(fname); - if( entry == NULL || entry->gentry <= 0 ) {// LocalFileCheck + if( entry == nullptr || entry->gentry <= 0 ) {// LocalFileCheck char lfname[256]; FILE* in; grfio_localpath_create(lfname, sizeof(lfname), ( entry && entry->fnd ) ? entry->fnd : fname); in = fopen(lfname, "rb"); - if( in != NULL ) { + if( in != nullptr ) { fseek(in,0,SEEK_END); size_t declen = ftell(in); fseek(in,0,SEEK_SET); @@ -407,19 +407,19 @@ void* grfio_reads(const char* fname, int* size) if( size ) *size = declen; } else { - if (entry != NULL && entry->gentry < 0) { + if (entry != nullptr && entry->gentry < 0) { entry->gentry = -entry->gentry; // local file checked } else { ShowError("grfio_reads: %s not found (local file: %s)\n", fname, lfname); - return NULL; + return nullptr; } } } - if( entry != NULL && entry->gentry > 0 ) {// Archive[GRF] File Read + if( entry != nullptr && entry->gentry > 0 ) {// Archive[GRF] File Read char* grfname = gentry_table[entry->gentry - 1]; FILE* in = fopen(grfname, "rb"); - if( in != NULL ) { + if( in != nullptr ) { size_t fsize = entry->srclen_aligned; unsigned char *buf = (unsigned char *)aMalloc(fsize); fseek(in, entry->srcpos, 0); @@ -437,7 +437,7 @@ void* grfio_reads(const char* fname, int* size) ShowError("decode_zip size mismatch err: %d != %d\n", (int)len, entry->declen); aFree(buf); aFree(buf2); - return NULL; + return nullptr; } } else {// directory? memcpy(buf2, buf, entry->declen); @@ -449,7 +449,7 @@ void* grfio_reads(const char* fname, int* size) aFree(buf); } else { ShowError("grfio_reads: %s not found (GRF file: %s)\n", fname, grfname); - return NULL; + return nullptr; } } @@ -510,7 +510,7 @@ static char* decode_filename(unsigned char* buf, int len) static bool isFullEncrypt(const char* fname) { const char* ext = strrchr(fname, '.'); - if( ext != NULL ) { + if( ext != nullptr ) { static const char extensions[4][5] = { ".gnd", ".gat", ".act", ".str" }; size_t i; for( i = 0; i < ARRAYLENGTH(extensions); ++i ) @@ -532,7 +532,7 @@ static int grfio_entryread(const char* grfname, int gentry) unsigned char *grf_filelist; FILE* fp = fopen(grfname, "rb"); - if( fp == NULL ) { + if( fp == nullptr ) { ShowWarning("GRF data file not found: '%s'\n",grfname); return 1; // 1:not found error } else @@ -584,7 +584,7 @@ static int grfio_entryread(const char* grfname, int gentry) aentry.srcpos = getlong(grf_filelist+ofs2+13)+0x2e; aentry.type = type; safestrncpy(aentry.fn, fname, sizeof(aentry.fn)); - aentry.fnd = NULL; + aentry.fnd = nullptr; #ifdef GRFIO_LOCAL aentry.gentry = -(gentry+1); // As Flag for making it a negative number carrying out the first time LocalFileCheck #else @@ -642,7 +642,7 @@ static int grfio_entryread(const char* grfname, int gentry) aentry.srcpos = getlong(grf_filelist+ofs2+13)+0x2e; aentry.type = type; safestrncpy(aentry.fn, fname, sizeof(aentry.fn)); - aentry.fnd = NULL; + aentry.fnd = nullptr; #ifdef GRFIO_LOCAL aentry.gentry = -(gentry+1); // As Flag for making it a negative number carrying out the first time LocalFileCheck #else @@ -677,14 +677,14 @@ static bool grfio_parse_restable_row(const char* row) if( sscanf(row, "%255[^#\r\n]#%255[^#\r\n]#", w1, w2) != 2 ) return false; - if( strstr(w2, ".gat") == NULL && strstr(w2, ".rsw") == NULL ) + if( strstr(w2, ".gat") == nullptr && strstr(w2, ".rsw") == nullptr ) return false; // we only need the maps' GAT and RSW files sprintf(src, "data\\%s", w1); sprintf(dst, "data\\%s", w2); entry = filelist_find(dst); - if( entry != NULL ) + if( entry != nullptr ) {// alias for GRF resource FILELIST fentry; memcpy(&fentry, entry, sizeof(FILELIST)); @@ -722,7 +722,7 @@ static void grfio_resourcecheck(void) grfio_localpath_create(restable, sizeof(restable), "data\\resnametable.txt"); fp = fopen(restable, "rb"); - if( fp != NULL ) + if( fp != nullptr ) { char line[256]; while( fgets(line, sizeof(line), fp) ) @@ -738,7 +738,7 @@ static void grfio_resourcecheck(void) // read resnametable from loaded GRF's, only if it cannot be loaded from the data directory buf = (char *)grfio_reads("data\\resnametable.txt", &size); - if( buf != NULL ) + if( buf != nullptr ) { char *ptr; buf[size] = '\0'; @@ -750,7 +750,7 @@ static void grfio_resourcecheck(void) ++i; ptr = strchr(ptr, '\n'); - if( ptr == NULL ) break; + if( ptr == nullptr ) break; ptr++; } @@ -781,25 +781,25 @@ static int grfio_add(const char* fname) /// Finalizes grfio. void grfio_final(void) { - if (filelist != NULL) { + if (filelist != nullptr) { int i; for (i = 0; i < filelist_entrys; i++) - if (filelist[i].fnd != NULL) + if (filelist[i].fnd != nullptr) aFree(filelist[i].fnd); aFree(filelist); - filelist = NULL; + filelist = nullptr; } filelist_entrys = filelist_maxentry = 0; - if (gentry_table != NULL) { + if (gentry_table != nullptr) { int i; for (i = 0; i < gentry_entrys; i++) - if (gentry_table[i] != NULL) + if (gentry_table[i] != nullptr) aFree(gentry_table[i]); aFree(gentry_table); - gentry_table = NULL; + gentry_table = nullptr; } gentry_entrys = gentry_maxentry = 0; } @@ -814,7 +814,7 @@ void grfio_init(const char* fname) hashinit(); // hash table initialization data_conf = fopen(fname, "r"); - if( data_conf != NULL ) + if( data_conf != nullptr ) { char line[1024]; while( fgets(line, sizeof(line), data_conf) ) diff --git a/src/common/grfio.hpp b/src/common/grfio.hpp index a39f2a158e..548d03ff8c 100644 --- a/src/common/grfio.hpp +++ b/src/common/grfio.hpp @@ -12,7 +12,7 @@ void grfio_init(const char* fname); void grfio_final(void); void* grfio_reads(const char* fname, int* size); char* grfio_find_file(const char* fname); -#define grfio_read(fn) grfio_reads(fn, NULL) +#define grfio_read(fn) grfio_reads(fn, nullptr) int32 grfio_read_rsw_water_level( const char* fname ); unsigned long grfio_crc32(const unsigned char *buf, unsigned int len); diff --git a/src/common/malloc.cpp b/src/common/malloc.cpp index 21212f65f3..4dcc4e2c71 100644 --- a/src/common/malloc.cpp +++ b/src/common/malloc.cpp @@ -56,7 +56,7 @@ # define STRDUP(p,file,line,func) GC_debug_strdup((p), RETURN_ADDR (file),(line)) # define FREE(p,file,line,func) GC_debug_free(p) # define MEMORY_USAGE() GC_get_heap_size() -# define MEMORY_VERIFY(ptr) (GC_base(ptr) != NULL) +# define MEMORY_VERIFY(ptr) (GC_base(ptr) != nullptr) # define MEMORY_CHECK() GC_gcollect() #else @@ -76,7 +76,7 @@ void* aMalloc_(size_t size, const char *file, int line, const char *func) { void *ret = MALLOC(size, file, line, func); // ShowMessage("%s:%d: in func %s: aMalloc %d\n",file,line,func,size); - if (ret == NULL){ + if (ret == nullptr){ ShowFatalError("%s:%d: in func %s: aMalloc error out of memory!\n",file,line,func); exit(EXIT_FAILURE); } @@ -87,7 +87,7 @@ void* aCalloc_(size_t num, size_t size, const char *file, int line, const char * { void *ret = CALLOC(num, size, file, line, func); // ShowMessage("%s:%d: in func %s: aCalloc %d %d\n",file,line,func,num,size); - if (ret == NULL){ + if (ret == nullptr){ ShowFatalError("%s:%d: in func %s: aCalloc error out of memory!\n", file, line, func); exit(EXIT_FAILURE); } @@ -97,7 +97,7 @@ void* aRealloc_(void *p, size_t size, const char *file, int line, const char *fu { void *ret = REALLOC(p, size, file, line, func); // ShowMessage("%s:%d: in func %s: aRealloc %p %d\n",file,line,func,p,size); - if (ret == NULL){ + if (ret == nullptr){ ShowFatalError("%s:%d: in func %s: aRealloc error out of memory!\n",file,line,func); exit(EXIT_FAILURE); } @@ -107,7 +107,7 @@ char* aStrdup_(const char *p, const char *file, int line, const char *func) { char *ret = STRDUP(p, file, line, func); // ShowMessage("%s:%d: in func %s: aStrdup %p\n",file,line,func,p); - if (ret == NULL){ + if (ret == nullptr){ ShowFatalError("%s:%d: in func %s: aStrdup error out of memory!\n", file, line, func); exit(EXIT_FAILURE); } @@ -195,7 +195,7 @@ struct unit_head_large { struct unit_head unit_head; }; -static struct unit_head_large *unit_head_large_first = NULL; +static struct unit_head_large *unit_head_large_first = nullptr; static struct block* block_malloc(unsigned short hash); static void block_free(struct block* p); @@ -239,18 +239,18 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func ) memmgr_usage_bytes += size; /* To ensure the area that exceeds the length of the block, using malloc () to */ - /* At that time, the distinction by assigning NULL to unit_head.block */ + /* At that time, the distinction by assigning nullptr to unit_head.block */ if(hash2size(size_hash) > BLOCK_DATA_SIZE - sizeof(struct unit_head)) { struct unit_head_large* p = (struct unit_head_large*)MALLOC(sizeof(struct unit_head_large)+size,file,line,func); - if(p != NULL) { + if(p != nullptr) { p->size = size; - p->unit_head.block = NULL; + p->unit_head.block = nullptr; p->unit_head.size = 0; p->unit_head.file = file; p->unit_head.line = line; - p->prev = NULL; - if (unit_head_large_first == NULL) - p->next = NULL; + p->prev = nullptr; + if (unit_head_large_first == nullptr) + p->next = nullptr; else { unit_head_large_first->prev = p; p->next = unit_head_large_first; @@ -294,7 +294,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func ) if( block->unfill_next ) { block->unfill_next->unfill_prev = block->unfill_prev; } - block->unfill_prev = NULL; + block->unfill_prev = nullptr; } #ifdef DEBUG_MEMMGR @@ -337,7 +337,7 @@ void* _mcalloc(size_t num, size_t size, const char *file, int line, const char * void* _mrealloc(void *memblock, size_t size, const char *file, int line, const char *func ) { size_t old_size; - if(memblock == NULL) { + if(memblock == nullptr) { return _mmalloc(size,file,line,func); } @@ -351,7 +351,7 @@ void* _mrealloc(void *memblock, size_t size, const char *file, int line, const c } else { // Size Large void *p = _mmalloc(size,file,line,func); - if(p != NULL) { + if(p != nullptr) { memcpy(p,memblock,old_size); } _mfree(memblock,file,line,func); @@ -361,8 +361,8 @@ void* _mrealloc(void *memblock, size_t size, const char *file, int line, const c char* _mstrdup(const char *p, const char *file, int line, const char *func ) { - if(p == NULL) { - return NULL; + if(p == nullptr) { + return nullptr; } else { size_t len = strlen(p); char *string = (char *)_mmalloc(len + 1,file,line,func); @@ -375,7 +375,7 @@ void _mfree(void *ptr, const char *file, int line, const char *func ) { struct unit_head *head; - if (ptr == NULL) + if (ptr == nullptr) return; head = (struct unit_head *)((char *)ptr - sizeof(struct unit_head) + sizeof(long)); @@ -409,13 +409,13 @@ void _mfree(void *ptr, const char *file, int line, const char *func ) struct block *block = head->block; if( (size_t)((char*)head - (char*)block) > sizeof(struct block) ) { ShowError("Memory manager: args of aFree 0x%p is invalid pointer %s line %d\n", ptr, file, line); - } else if(head->block == NULL) { + } else if(head->block == nullptr) { ShowError("Memory manager: args of aFree 0x%p is freed pointer %s:%d@%s\n", ptr, file, line, func); } else if(*(long*)((char*)head + sizeof(struct unit_head) - sizeof(long) + head->size) != FREED_POINTER) { ShowError("Memory manager: args of aFree 0x%p is overflowed pointer %s line %d\n", ptr, file, line); } else { memmgr_usage_bytes -= head->size; - head->block = NULL; + head->block = nullptr; #ifdef DEBUG_MEMMGR memset(ptr, 0xfd, block->unit_size - sizeof(struct unit_head) + sizeof(long) ); head->file = file; @@ -426,7 +426,7 @@ void _mfree(void *ptr, const char *file, int line, const char *func ) /* Release of the block */ block_free(block); } else { - if( block->unfill_prev == NULL) { + if( block->unfill_prev == nullptr) { // add to unfill list if( hash_unfill[ block->unit_hash ] ) { hash_unfill[ block->unit_hash ]->unfill_prev = block; @@ -446,7 +446,7 @@ void _mfree(void *ptr, const char *file, int line, const char *func ) static struct block* block_malloc(unsigned short hash) { struct block *p; - if(hash_unfill[0] != NULL) { + if(hash_unfill[0] != nullptr) { /* Space for the block has already been secured */ p = hash_unfill[0]; hash_unfill[0] = hash_unfill[0]->unfill_next; @@ -454,26 +454,26 @@ static struct block* block_malloc(unsigned short hash) int i; /* Newly allocated space for the block */ p = (struct block*)MALLOC(sizeof(struct block) * (BLOCK_ALLOC), __FILE__, __LINE__, __func__ ); - if(p == NULL) { + if(p == nullptr) { ShowFatalError("Memory manager::block_alloc failed.\n"); exit(EXIT_FAILURE); } - if(block_first == NULL) { + if(block_first == nullptr) { /* First ensure */ block_first = p; } else { block_last->block_next = p; } block_last = &p[BLOCK_ALLOC - 1]; - block_last->block_next = NULL; + block_last->block_next = nullptr; /* Linking the block */ for(i=0;iunfill_prev = &block_head; - p->unfill_next = NULL; + p->unfill_next = nullptr; p->unit_size = (unsigned short)(hash2size( hash ) + sizeof(struct unit_head)); p->unit_hash = hash; p->unit_count = BLOCK_DATA_SIZE / p->unit_size; @@ -510,7 +510,7 @@ static void block_free(struct block* p) if( p->unfill_next ) { p->unfill_next->unfill_prev = p->unfill_prev; } - p->unfill_prev = NULL; + p->unfill_prev = nullptr; } p->unfill_next = hash_unfill[0]; @@ -563,7 +563,7 @@ bool memmgr_verify(void* ptr) struct block* block = block_first; struct unit_head_large* large = unit_head_large_first; - if( ptr == NULL ) + if( ptr == nullptr ) return false;// never valid // search small blocks @@ -575,7 +575,7 @@ bool memmgr_verify(void* ptr) {// memory block is being used and ptr points to a sub-unit size_t i = (size_t)((char*)ptr - block->data)/block->unit_size; struct unit_head* head = block2unit(block, i); - if( i < block->unit_maxused && head->block != NULL ) + if( i < block->unit_maxused && head->block != nullptr ) {// memory unit is allocated, check if ptr points to the usable part return ( (char*)ptr >= ((char*)head) + sizeof(struct unit_head) - sizeof(long) && (char*)ptr < ((char*)head) + sizeof(struct unit_head) - sizeof(long) + head->size ); @@ -613,7 +613,7 @@ static void memmgr_final (void) int i; for (i = 0; i < block->unit_maxused; i++) { struct unit_head *head = block2unit(block, i); - if(head->block != NULL) { + if(head->block != nullptr) { char* ptr = (char *)head + sizeof(struct unit_head) - sizeof(long); #ifdef LOG_MEMMGR char buf[1024]; diff --git a/src/common/mapindex.cpp b/src/common/mapindex.cpp index 6871af4e96..3b1c134a25 100644 --- a/src/common/mapindex.cpp +++ b/src/common/mapindex.cpp @@ -23,7 +23,7 @@ int max_index = 0; /// Result gets placed either into 'buf' or in a static local buffer. const char* mapindex_getmapname(const char* string, char* output) { static char buf[MAP_NAME_LENGTH]; - char* dest = (output != NULL) ? output : buf; + char* dest = (output != nullptr) ? output : buf; size_t len = strnlen(string, MAP_NAME_LENGTH_EXT); if (len == MAP_NAME_LENGTH_EXT) { @@ -44,7 +44,7 @@ const char* mapindex_getmapname(const char* string, char* output) { /// Result gets placed either into 'buf' or in a static local buffer. const char* mapindex_getmapname_ext(const char* string, char* output) { static char buf[MAP_NAME_LENGTH_EXT]; - char* dest = (output != NULL) ? output : buf; + char* dest = (output != nullptr) ? output : buf; size_t len; @@ -146,7 +146,7 @@ void mapindex_init(void) { for( size_t i = 0; i < ARRAYLENGTH(mapindex_cfgfile); i++ ){ sprintf( path, "%s/%s", db_path, mapindex_cfgfile[i] ); - if( ( fp = fopen( path, "r" ) ) == NULL ){ + if( ( fp = fopen( path, "r" ) ) == nullptr ){ // It is only fatal if it is the main file if( i == 0 ){ ShowFatalError("Unable to read mapindex config file %s!\n", path ); @@ -182,7 +182,7 @@ void mapindex_init(void) { * @param mapname **/ void mapindex_check_mapdefault(const char *mapname) { - mapname = mapindex_getmapname(mapname, NULL); + mapname = mapindex_getmapname(mapname, nullptr); if( !strdb_iget(mapindex_db, mapname) ) { ShowError("mapindex_init: Default map '%s' not found in cache! Please change in (by default in) char_athena.conf!\n", mapname); } diff --git a/src/common/msg_conf.cpp b/src/common/msg_conf.cpp index 97bc89ba26..121c6e9ab9 100644 --- a/src/common/msg_conf.cpp +++ b/src/common/msg_conf.cpp @@ -18,7 +18,7 @@ const char* _msg_txt(int msg_number,int size, char ** msg_table) { if (msg_number >= 0 && msg_number < size && - msg_table[msg_number] != NULL && msg_table[msg_number][0] != '\0') + msg_table[msg_number] != nullptr && msg_table[msg_number][0] != '\0') return msg_table[msg_number]; return "??"; @@ -35,7 +35,7 @@ int _msg_config_read(const char* cfgName,int size, char ** msg_table) FILE *fp; static int called = 1; - if ((fp = fopen(cfgName, "r")) == NULL) { + if ((fp = fopen(cfgName, "r")) == nullptr) { ShowError("Messages file not found: %s\n", cfgName); return -1; } @@ -55,7 +55,7 @@ int _msg_config_read(const char* cfgName,int size, char ** msg_table) else { msg_number = atoi(w1); if (msg_number >= 0 && msg_number < size) { - if (msg_table[msg_number] != NULL) + if (msg_table[msg_number] != nullptr) aFree(msg_table[msg_number]); size_t len = strnlen(w2,sizeof(w2)) + 1; msg_table[msg_number] = (char *) aMalloc(len * sizeof (char)); diff --git a/src/common/nullpo.cpp b/src/common/nullpo.cpp index d8c8c36a42..519e911c2b 100644 --- a/src/common/nullpo.cpp +++ b/src/common/nullpo.cpp @@ -20,7 +20,7 @@ int nullpo_chk_f(const char *file, int line, const char *func, const void *targe { va_list ap; - if (target != NULL) + if (target != nullptr) return 0; va_start(ap, fmt); @@ -31,7 +31,7 @@ int nullpo_chk_f(const char *file, int line, const char *func, const void *targe int nullpo_chk(const char *file, int line, const char *func, const void *target) { - if (target != NULL) + if (target != nullptr) return 0; nullpo_info_core_(file, line, func); return 1; @@ -57,11 +57,11 @@ void nullpo_info(const char *file, int line, const char *func) } static void nullpo_info_core_(const char *file, int line, const char *func){ - if (file == NULL) + if (file == nullptr) file = "??"; func = - func == NULL ? "unknown": + func == nullptr ? "unknown": func[0] == '\0' ? "unknown": func; @@ -76,7 +76,7 @@ static void nullpo_info_core(const char *file, int line, const char *func, const char *fmt, va_list ap) { nullpo_info_core_(file,line,func); - if (fmt != NULL) + if (fmt != nullptr) { if (fmt[0] != '\0') { diff --git a/src/common/nullpo.hpp b/src/common/nullpo.hpp index 19a0ad2238..62de951cf6 100644 --- a/src/common/nullpo.hpp +++ b/src/common/nullpo.hpp @@ -16,13 +16,13 @@ #if defined(NULLPO_CHECK) /** - * Macros used to check for NULL pointer and output that information. + * Macros used to check for nullptr pointer and output that information. */ /** * Return 0 if pointer is not found. * @param t: Pointer to check - * @return 0 if t is NULL + * @return 0 if t is nullptr */ #define nullpo_ret(t) \ if (nullpo_chk(NLP_MARK, (void *)(t))) {return(0);} @@ -30,7 +30,7 @@ /** * Return void if pointer is not found. * @param t: Pointer to check - * @return void if t is NULL + * @return void if t is nullptr */ #define nullpo_retv(t) \ if (nullpo_chk(NLP_MARK, (void *)(t))) {return;} @@ -58,7 +58,7 @@ * Return 0 and display additional information if pointer is not found. * @param t: Pointer to check * @param fmt: Pass to vprintf, Format and arguments such as description - * @return 0 if t is NULL + * @return 0 if t is nullptr */ #define nullpo_ret_f(t, fmt, ...) \ if (nullpo_chk_f(NLP_MARK, (void *)(t), (fmt), __VA_ARGS__)) {return(0);} @@ -67,7 +67,7 @@ * Return void and display additional information if pointer is not found. * @param t: Pointer to check * @param fmt: Pass to vprintf, Format and arguments such as description - * @return void if t is NULL + * @return void if t is nullptr */ #define nullpo_retv_f(t, fmt, ...) \ if (nullpo_chk_f(NLP_MARK, (void *)(t), (fmt), __VA_ARGS__)) {return;} @@ -95,7 +95,7 @@ * Return 0 and display additional information if pointer is not found. * @param t: Pointer to check * @param fmt: Pass to vprintf, Format and arguments such as description - * @return 0 if t is NULL + * @return 0 if t is nullptr */ #define nullpo_ret_f(t, fmt, args...) \ if (nullpo_chk_f(NLP_MARK, (void *)(t), (fmt), ## args)) {return(0);} @@ -104,7 +104,7 @@ * Return void and display additional information if pointer is not found. * @param t: Pointer to check * @param fmt: Pass to vprintf, Format and arguments such as description - * @return void if t is NULL + * @return void if t is nullptr */ #define nullpo_retv_f(t, fmt, args...) \ if (nullpo_chk_f(NLP_MARK, (void *)(t), (fmt), ## args)) {return;} @@ -164,23 +164,23 @@ #endif /* NULLPO_CHECK */ /** - * Check for NULL pointer and output information. + * Check for nullptr pointer and output information. * @param file: __FILE__ * @param line: __LINE__ * @param func: __func__ (name of the function) [NLP_MARK] * @param target: Target to check - * @return 0 on success or 1 on NULL + * @return 0 on success or 1 on nullptr */ int nullpo_chk(const char *file, int line, const char *func, const void *target); /** - * Check for NULL pointer and output detailed information. + * Check for nullptr pointer and output detailed information. * @param file: __FILE__ * @param line: __LINE__ * @param func: __func__ (name of the function) [NLP_MARK] * @param target: Target to check * @param fmt: Passed to vprintf - * @return 0 on success or 1 on NULL + * @return 0 on success or 1 on nullptr */ int nullpo_chk_f(const char *file, int line, const char *func, const void *target, const char *fmt, ...) @@ -196,7 +196,7 @@ int nullpo_chk_f(const char *file, int line, const char *func, const void *targe void nullpo_info(const char *file, int line, const char *func); /** - * Check for NULL pointer and output detailed information. + * Check for nullptr pointer and output detailed information. * @param file: __FILE__ * @param line: __LINE__ * @param func: __func__ (name of the function) [NLP_MARK] diff --git a/src/common/showmsg.cpp b/src/common/showmsg.cpp index 9102d5851e..ed871007b7 100644 --- a/src/common/showmsg.cpp +++ b/src/common/showmsg.cpp @@ -62,7 +62,7 @@ char console_log_filepath[32] = "./log/unknown.log"; StringBuf *d_; \ char *v_; \ size_t l_; \ - } buf ={"",NULL,NULL,0}; \ + } buf ={"",nullptr,nullptr,0}; \ //define NEWBUF #define BUFVPRINTF(buf,fmt,args) \ @@ -87,9 +87,9 @@ char console_log_filepath[32] = "./log/unknown.log"; if( buf.d_ ) \ { \ StringBuf_Free(buf.d_); \ - buf.d_ = NULL; \ + buf.d_ = nullptr; \ } \ - buf.v_ = NULL; \ + buf.v_ = nullptr; \ //define FREEBUF /////////////////////////////////////////////////////////////////////////////// @@ -216,7 +216,7 @@ int VFPRINTF(HANDLE handle, const char *fmt, va_list argptr) // start with processing p = BUFVAL(tempbuf); - while ((q = strchr(p, 0x1b)) != NULL) + while ((q = strchr(p, 0x1b)) != nullptr) { // find the escape character if( 0==WriteConsole(handle, p, (DWORD)(q-p), &written, 0) ) // write up to the escape WriteFile(handle, p, (DWORD)(q-p), &written, 0); @@ -547,7 +547,7 @@ int VFPRINTF(FILE *file, const char *fmt, va_list argptr) // start with processing p = BUFVAL(tempbuf); - while ((q = strchr(p, 0x1b)) != NULL) + while ((q = strchr(p, 0x1b)) != nullptr) { // find the escape character fprintf(file, "%.*s", (int)(q-p), p); // write up to the escape if( q[1]!='[' ) @@ -688,7 +688,7 @@ int _vShowMessage(enum msg_type flag, const char *string, va_list ap) ( flag == MSG_WARNING && console_msg_log&1 ) || ( ( flag == MSG_ERROR || flag == MSG_SQL ) && console_msg_log&2 ) || ( flag == MSG_DEBUG && console_msg_log&4 ) ) {//[Ind] - FILE *log = NULL; + FILE *log = nullptr; if( (log = fopen(console_log_filepath, "a+")) ) { char timestring[255]; time_t curtime; @@ -720,7 +720,7 @@ int _vShowMessage(enum msg_type flag, const char *string, va_list ap) if (timestamp_format[0] && flag != MSG_NONE) { //Display time format. [Skotlex] - time_t t = time(NULL); + time_t t = time(nullptr); strftime(prefix, 80, timestamp_format, localtime(&t)); } else prefix[0]='\0'; @@ -775,7 +775,7 @@ int _vShowMessage(enum msg_type flag, const char *string, va_list ap) #if defined(DEBUGLOGMAP) || defined(DEBUGLOGCHAR) || defined(DEBUGLOGLOGIN) if(strlen(DEBUGLOGPATH) > 0) { fp=fopen(DEBUGLOGPATH,"a"); - if (fp == NULL) { + if (fp == nullptr) { FPRINTF(STDERR, CL_RED "[ERROR]" CL_RESET ": Could not open '" CL_WHITE "%s" CL_RESET "', access denied.\n", DEBUGLOGPATH); FFLUSH(STDERR); } else { diff --git a/src/common/socket.cpp b/src/common/socket.cpp index 3c8e8ec8ec..ed18a8b5e8 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -159,8 +159,8 @@ char* sErr(int code) { static char sbuf[512]; // strerror does not handle socket codes - if( FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, NULL, - code, MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), (LPTSTR)&sbuf, sizeof(sbuf), NULL) == 0 ) + if( FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, + code, MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), (LPTSTR)&sbuf, sizeof(sbuf), nullptr) == 0 ) snprintf(sbuf, sizeof(sbuf), "unknown error"); return sbuf; } @@ -456,7 +456,7 @@ int send_from_fifo(int fd) /// Best effort - there's no warranty that the data will be sent. void flush_fifo(int fd) { - if(session[fd] != NULL) + if(session[fd] != nullptr) session[fd]->func_send(fd); } @@ -650,7 +650,7 @@ int make_connection(uint32 ip, uint16 port, bool silent,int timeout) { tv.tv_sec = timeout; tv.tv_usec = 0; - result = sSelect(0, NULL, &writeSet, NULL, &tv); + result = sSelect(0, nullptr, &writeSet, nullptr, &tv); // Connection attempt timed out if( result == 0 ){ @@ -750,7 +750,7 @@ static void delete_session(int fd) aFree(session[fd]->wdata); aFree(session[fd]->session_data); aFree(session[fd]); - session[fd] = NULL; + session[fd] = nullptr; } } @@ -824,7 +824,7 @@ int WFIFOSET(int fd, size_t len) size_t newreserve; struct socket_data* s = session[fd]; - if( !session_isValid(fd) || s->wdata == NULL ) + if( !session_isValid(fd) || s->wdata == nullptr ) return 0; // we have written len bytes to the buffer already before calling WFIFOSET @@ -920,7 +920,7 @@ int do_sockets(t_tick next) timeout.tv_usec = (long)(next%1000*1000); memcpy(&rfd, &readfds, sizeof(rfd)); - ret = sSelect(fd_max, &rfd, NULL, NULL, &timeout); + ret = sSelect(fd_max, &rfd, nullptr, nullptr, &timeout); if( ret == SOCKET_ERROR ) { @@ -946,7 +946,7 @@ int do_sockets(t_tick next) } #endif - last_tick = time(NULL); + last_tick = time(nullptr); #if defined(WIN32) // on windows, enumerating all members of the fd_set is way faster if we access the internals @@ -1080,8 +1080,8 @@ enum _aco { ACO_MUTUAL_FAILURE }; -static AccessControl* access_allow = NULL; -static AccessControl* access_deny = NULL; +static AccessControl* access_allow = nullptr; +static AccessControl* access_deny = nullptr; static int access_order = ACO_DENY_ALLOW; static int access_allownum = 0; static int access_denynum = 0; @@ -1299,7 +1299,7 @@ int socket_config_read(const char* cfgName) FILE *fp; fp = fopen(cfgName, "r"); - if(fp == NULL) { + if(fp == nullptr) { ShowError("File not found: %s\n", cfgName); return 1; } @@ -1400,7 +1400,7 @@ void socket_final(void) aFree(session[0]->wdata); aFree(session[0]->session_data); aFree(session[0]); - session[0] = NULL; + session[0] = nullptr; #ifdef WIN32 // Shut down windows networking @@ -1449,7 +1449,7 @@ int socket_getips(uint32* ips, int max) { int num = 0; - if( ips == NULL || max <= 0 ) + if( ips == nullptr || max <= 0 ) return 0; #ifdef WIN32 @@ -1470,12 +1470,12 @@ int socket_getips(uint32* ips, int max) u_long** a; struct hostent* hent; hent = gethostbyname(fullhost); - if( hent == NULL ){ + if( hent == nullptr ){ ShowError("socket_getips: Cannot resolve our own hostname to an IP address\n"); return 0; } a = (u_long**)hent->h_addr_list; - for( ;num < max && a[num] != NULL; ++num) + for( ;num < max && a[num] != nullptr; ++num) ips[num] = (uint32)ntohl(*a[num]); } } @@ -1608,7 +1608,7 @@ void socket_init(void) socket_config_read(SOCKET_CONF_FILENAME); // initialise last send-receive tick - last_tick = time(NULL); + last_tick = time(nullptr); // session[0] is now currently used for disconnected sessions of the map server, and as such, // should hold enough buffer (it is a vacuum so to speak) as it is never flushed. [Skotlex] @@ -1639,7 +1639,7 @@ bool session_isActive(int fd) uint32 host2ip(const char* hostname) { struct hostent* h = gethostbyname(hostname); - return (h != NULL) ? ntohl(*(uint32*)h->h_addr) : 0; + return (h != nullptr) ? ntohl(*(uint32*)h->h_addr) : 0; } // Converts a numeric ip into a dot-formatted string. @@ -1648,7 +1648,7 @@ const char* ip2str(uint32 ip, char ip_str[16]) { struct in_addr addr; addr.s_addr = htonl(ip); - return (ip_str == NULL) ? inet_ntoa(addr) : strncpy(ip_str, inet_ntoa(addr), 16); + return (ip_str == nullptr) ? inet_ntoa(addr) : strncpy(ip_str, inet_ntoa(addr), 16); } // Converts a dot-formatted ip string into a numeric ip. diff --git a/src/common/sql.cpp b/src/common/sql.cpp index 14fef8e9a1..f086898bfa 100644 --- a/src/common/sql.cpp +++ b/src/common/sql.cpp @@ -85,8 +85,8 @@ Sql* Sql_Malloc(void) CREATE(self, Sql, 1); mysql_init(&self->handle); StringBuf_Init(&self->buf); - self->lengths = NULL; - self->result = NULL; + self->lengths = nullptr; + self->result = nullptr; self->keepalive = INVALID_TIMER; my_bool reconnect = 1; mysql_options(&self->handle, MYSQL_OPT_RECONNECT, &reconnect); @@ -117,7 +117,7 @@ static int Sql_P_Keepalive(Sql* self); */ int Sql_Connect(Sql* self, const char* user, const char* passwd, const char* host, uint16 port, const char* db) { - if( self == NULL ) + if( self == nullptr ) return SQL_ERROR; StringBuf_Clear(&self->buf); @@ -130,7 +130,7 @@ int Sql_Connect(Sql* self, const char* user, const char* passwd, const char* hos } #endif - if( !mysql_real_connect(&self->handle, host, user, passwd, db, (unsigned int)port, NULL/*unix_socket*/, 0/*clientflag*/) ) + if( !mysql_real_connect(&self->handle, host, user, passwd, db, (unsigned int)port, nullptr/*unix_socket*/, 0/*clientflag*/) ) { ShowSQL("%s\n", mysql_error(&self->handle)); return SQL_ERROR; @@ -158,7 +158,7 @@ int Sql_GetTimeout(Sql* self, uint32* out_timeout) if( SQL_SUCCESS == Sql_NextRow(self) && SQL_SUCCESS == Sql_GetData(self, 1, &data, &len) ) { - *out_timeout = (uint32)strtoul(data, NULL, 10); + *out_timeout = (uint32)strtoul(data, nullptr, 10); Sql_FreeResult(self); return SQL_SUCCESS; } @@ -176,7 +176,7 @@ int Sql_GetColumnNames(Sql* self, const char* table, char* out_buf, size_t buf_l size_t len; size_t off = 0; - if( self == NULL || SQL_ERROR == Sql_Query(self, "EXPLAIN `%s`", table) ) + if( self == nullptr || SQL_ERROR == Sql_Query(self, "EXPLAIN `%s`", table) ) return SQL_ERROR; out_buf[off] = '\0'; @@ -297,7 +297,7 @@ int Sql_Query(Sql* self, const char* query, ...) /// Executes a query. int Sql_QueryV(Sql* self, const char* query, va_list args) { - if( self == NULL ) + if( self == nullptr ) return SQL_ERROR; Sql_FreeResult(self); @@ -324,7 +324,7 @@ int Sql_QueryV(Sql* self, const char* query, va_list args) /// Executes a query. int Sql_QueryStr(Sql* self, const char* query) { - if( self == NULL ) + if( self == nullptr ) return SQL_ERROR; Sql_FreeResult(self); @@ -400,7 +400,7 @@ int Sql_NextRow(Sql* self) self->lengths = mysql_fetch_lengths(self->result); return SQL_SUCCESS; } - self->lengths = NULL; + self->lengths = nullptr; if( mysql_errno(&self->handle) == 0 ) return SQL_NO_DATA; } @@ -421,7 +421,7 @@ int Sql_GetData(Sql* self, size_t col, char** out_buf, size_t* out_len) } else {// out of range - ignore - if( out_buf ) *out_buf = NULL; + if( out_buf ) *out_buf = nullptr; if( out_len ) *out_len = 0; } return SQL_SUCCESS; @@ -437,9 +437,9 @@ void Sql_FreeResult(Sql* self) if( self && self->result ) { mysql_free_result(self->result); - self->result = NULL; - self->row = NULL; - self->lengths = NULL; + self->result = nullptr; + self->row = nullptr; + self->lengths = nullptr; } } @@ -454,8 +454,8 @@ void Sql_Close(Sql* self) { /// Shows debug information (last query). void Sql_ShowDebug_(Sql* self, const char* debug_file, const unsigned long debug_line) { - if( self == NULL ) - ShowDebug("at %s:%lu - self is NULL\n", debug_file, debug_line); + if( self == nullptr ) + ShowDebug("at %s:%lu - self is nullptr\n", debug_file, debug_line); else if( StringBuf_Length(&self->buf) > 0 ) ShowDebug("at %s:%lu - %s\n", debug_file, debug_line, StringBuf_Value(&self->buf)); else @@ -680,21 +680,21 @@ SqlStmt* SqlStmt_Malloc(Sql* sql) SqlStmt* self; MYSQL_STMT* stmt; - if( sql == NULL ) - return NULL; + if( sql == nullptr ) + return nullptr; stmt = mysql_stmt_init(&sql->handle); - if( stmt == NULL ) + if( stmt == nullptr ) { ShowSQL("DB error - %s\n", mysql_error(&sql->handle)); - return NULL; + return nullptr; } CREATE(self, SqlStmt, 1); StringBuf_Init(&self->buf); self->stmt = stmt; - self->params = NULL; - self->columns = NULL; - self->column_lengths = NULL; + self->params = nullptr; + self->columns = nullptr; + self->column_lengths = nullptr; self->max_params = 0; self->max_columns = 0; self->bind_params = false; @@ -723,7 +723,7 @@ int SqlStmt_Prepare(SqlStmt* self, const char* query, ...) /// Prepares the statement. int SqlStmt_PrepareV(SqlStmt* self, const char* query, va_list args) { - if( self == NULL ) + if( self == nullptr ) return SQL_ERROR; SqlStmt_FreeResult(self); @@ -745,7 +745,7 @@ int SqlStmt_PrepareV(SqlStmt* self, const char* query, va_list args) /// Prepares the statement. int SqlStmt_PrepareStr(SqlStmt* self, const char* query) { - if( self == NULL ) + if( self == nullptr ) return SQL_ERROR; SqlStmt_FreeResult(self); @@ -778,7 +778,7 @@ size_t SqlStmt_NumParams(SqlStmt* self) /// Binds a parameter to a buffer. int SqlStmt_BindParam(SqlStmt* self, size_t idx, enum SqlDataType buffer_type, void* buffer, size_t buffer_len) { - if( self == NULL ) + if( self == nullptr ) return SQL_ERROR; if( !self->bind_params ) @@ -798,7 +798,7 @@ int SqlStmt_BindParam(SqlStmt* self, size_t idx, enum SqlDataType buffer_type, v self->bind_params = true; } if( idx < self->max_params ) - return Sql_P_BindSqlDataType(self->params+idx, buffer_type, buffer, buffer_len, NULL, NULL); + return Sql_P_BindSqlDataType(self->params+idx, buffer_type, buffer, buffer_len, nullptr, nullptr); else return SQL_SUCCESS;// out of range - ignore } @@ -808,7 +808,7 @@ int SqlStmt_BindParam(SqlStmt* self, size_t idx, enum SqlDataType buffer_type, v /// Executes the prepared statement. int SqlStmt_Execute(SqlStmt* self) { - if( self == NULL ) + if( self == nullptr ) return SQL_ERROR; SqlStmt_FreeResult(self); @@ -857,7 +857,7 @@ size_t SqlStmt_NumColumns(SqlStmt* self) /// Binds the result of a column to a buffer. int SqlStmt_BindColumn(SqlStmt* self, size_t idx, enum SqlDataType buffer_type, void* buffer, size_t buffer_len, uint32* out_length, int8* out_is_null) { - if( self == NULL ) + if( self == nullptr ) return SQL_ERROR; if( buffer_type == SQLDT_STRING || buffer_type == SQLDT_ENUM ) @@ -918,7 +918,7 @@ int SqlStmt_NextRow(SqlStmt* self) size_t i; size_t cols; - if( self == NULL ) + if( self == nullptr ) return SQL_ERROR; // bind columns @@ -949,7 +949,7 @@ int SqlStmt_NextRow(SqlStmt* self) MYSQL_BIND* column = &self->columns[i]; column->error = &truncated; mysql_stmt_fetch_column(self->stmt, column, (unsigned int)i, 0); - column->error = NULL; + column->error = nullptr; if( truncated ) {// report truncated column SqlStmt_P_ShowDebugTruncatedColumn(self, i); @@ -1014,8 +1014,8 @@ void SqlStmt_FreeResult(SqlStmt* self) /// Shows debug information (with statement). void SqlStmt_ShowDebug_(SqlStmt* self, const char* debug_file, const unsigned long debug_line) { - if( self == NULL ) - ShowDebug("at %s:%lu - self is NULL\n", debug_file, debug_line); + if( self == nullptr ) + ShowDebug("at %s:%lu - self is nullptr\n", debug_file, debug_line); else if( StringBuf_Length(&self->buf) > 0 ) ShowDebug("at %s:%lu - %s\n", debug_file, debug_line, StringBuf_Value(&self->buf)); else @@ -1065,7 +1065,7 @@ void Sql_inter_server_read(const char* cfgName, bool first) { FILE* fp; fp = fopen(cfgName, "r"); - if(fp == NULL) { + if(fp == nullptr) { if( first ) { ShowFatalError("File not found: %s\n", cfgName); exit(EXIT_FAILURE); diff --git a/src/common/sql.hpp b/src/common/sql.hpp index 57db61de82..0759adfc8a 100644 --- a/src/common/sql.hpp +++ b/src/common/sql.hpp @@ -237,7 +237,7 @@ void Sql_Free(Sql* self); /// It uses the connection of the parent Sql handle. /// Queries in Sql and SqlStmt are independent and don't affect each other. /// -/// @return SqlStmt handle or NULL if an error occured +/// @return SqlStmt handle or nullptr if an error occured struct SqlStmt* SqlStmt_Malloc(Sql* sql); diff --git a/src/common/strlib.cpp b/src/common/strlib.cpp index 3f76aadb5e..ddcf462b3a 100644 --- a/src/common/strlib.cpp +++ b/src/common/strlib.cpp @@ -33,7 +33,7 @@ char* trim(char* str) size_t start; size_t end; - if( str == NULL ) + if( str == nullptr ) return str; // get start position @@ -62,7 +62,7 @@ char* normalize_name(char* str,const char* delims) char* out = str; int put_space = 0; - if( str == NULL || delims == NULL ) + if( str == nullptr || delims == nullptr ) return str; // trim start of string @@ -127,12 +127,12 @@ char* _strtok_r(char *s1, const char *s2, char **lasts) { char *ret; - if (s1 == NULL) + if (s1 == nullptr) s1 = *lasts; while(*s1 && strchr(s2, *s1)) ++s1; if(*s1 == '\0') - return NULL; + return nullptr; ret = s1; while(*s1 && !strchr(s2, *s1)) ++s1; @@ -210,7 +210,7 @@ int e_mail_check(char* email) return 0; // part of RFC limits (official reference of e-mail description) - if (strchr(email, '@') == NULL || email[len-1] == '@') + if (strchr(email, '@') == nullptr || email[len-1] == '@') return 0; if (email[len-1] == '.') @@ -218,14 +218,14 @@ int e_mail_check(char* email) last_arobas = strrchr(email, '@'); - if (strstr(last_arobas, "@.") != NULL || strstr(last_arobas, "..") != NULL) + if (strstr(last_arobas, "@.") != nullptr || strstr(last_arobas, "..") != nullptr) return 0; for(ch = 1; ch < 32; ch++) - if (strchr(last_arobas, ch) != NULL) + if (strchr(last_arobas, ch) != nullptr) return 0; - if (strchr(last_arobas, ' ') != NULL || strchr(last_arobas, ';') != NULL) + if (strchr(last_arobas, ' ') != nullptr || strchr(last_arobas, ';') != nullptr) return 0; // all correct @@ -243,7 +243,7 @@ int config_switch(const char* str) if (strcmpi(str, "off") == 0 || strcmpi(str, "no") == 0 || strcmpi(str, "non") == 0 || strcmpi(str, "nein") == 0 || strcmpi(str, "nao") == 0) return 0; - return (int)strtol(str, NULL, 0); + return (int)strtol(str, nullptr, 0); } /// strncpy that always nul-terminates the string @@ -270,7 +270,7 @@ char* safestrncpy(char* dst, const char* src, size_t n) /// doesn't crash on null pointer size_t safestrnlen(const char* string, size_t maxlen) { - return ( string != NULL ) ? strnlen(string, maxlen) : 0; + return ( string != nullptr ) ? strnlen(string, maxlen) : 0; } /// Works like snprintf, but always nul-terminates the buffer. @@ -305,14 +305,14 @@ int strline(const char* str, size_t pos) const char* target; int line; - if( str == NULL || pos == 0 ) + if( str == nullptr || pos == 0 ) return 1; target = str+pos; for( line = 1; ; ++line ) { str = strchr(str, '\n'); - if( str == NULL || target <= str ) + if( str == nullptr || target <= str ) break;// found target line ++str;// skip newline } @@ -376,7 +376,7 @@ int sv_parse_next( s_svstate& sv ){ return -1;// error } - if( sv.done || str == NULL ) + if( sv.done || str == nullptr ) { sv.done = true; return 0;// nothing to parse @@ -498,7 +498,7 @@ int sv_parse_next( s_svstate& sv ){ /// Other position pairs are the start and end of fields. /// Returns the number of fields found or -1 if an error occurs. /// -/// out_pos can be NULL. +/// out_pos can be nullptr. /// If a line terminator is found, the end position is placed there. /// out_pos[2] and out_pos[3] for the first field, out_pos[4] and out_pos[5] /// for the seconds field and so on. @@ -571,7 +571,7 @@ size_t sv_parse( const char* str, size_t len, size_t startoff, char delim, size_ /// Other entries are the start of fields (nul-teminated). /// Returns the number of fields found or -1 if an error occurs. /// -/// out_fields can be NULL. +/// out_fields can be nullptr. /// Fields that don't fit in out_fields are not nul-terminated. /// Extra entries in out_fields are filled with the end of the last field (empty string). /// @@ -676,14 +676,14 @@ size_t sv_escape_c(char* out_dest, const char* src, size_t len, const char* esca size_t i; size_t j; - if( out_dest == NULL ) + if( out_dest == nullptr ) return 0;// nothing to do - if( src == NULL ) + if( src == nullptr ) {// nothing to escape *out_dest = 0; return 0; } - if( escapes == NULL ) + if( escapes == nullptr ) escapes = ""; for( i = 0, j = 0; i < len; ++i ) @@ -814,7 +814,7 @@ size_t sv_unescape_c(char* out_dest, const char* src, size_t len) } else {// other escape sequence - if( strchr(SV_ESCAPE_C_SUPPORTED, src[i]) == NULL ) + if( strchr(SV_ESCAPE_C_SUPPORTED, src[i]) == nullptr ) ShowWarning("sv_unescape_c: unknown escape sequence \\%c\n", src[i]); switch( src[i] ) { @@ -896,7 +896,7 @@ bool sv_readdb( const char* directory, const char* filename, char delim, size_t // open file fp = fopen(path, "r"); - if( fp == NULL ) + if( fp == nullptr ) { if(silent == 0) ShowError("sv_readdb: can't read %s\n", path); return false; @@ -912,7 +912,7 @@ bool sv_readdb( const char* directory, const char* filename, char delim, size_t char *match; lines++; - if( ( match = strstr(line, "//") ) != NULL ) + if( ( match = strstr(line, "//") ) != nullptr ) {// strip comments match[0] = 0; } diff --git a/src/common/timer.cpp b/src/common/timer.cpp index 39531d69b3..6dbee552e2 100644 --- a/src/common/timer.cpp +++ b/src/common/timer.cpp @@ -25,12 +25,12 @@ const t_tick TIMER_MIN_INTERVAL = 20; const t_tick TIMER_MAX_INTERVAL = 1000; // timers (array) -static struct TimerData* timer_data = NULL; +static struct TimerData* timer_data = nullptr; static int timer_data_max = 0; static int timer_data_num = 0; // free timers (array) -static int* free_timer_list = NULL; +static int* free_timer_list = nullptr; static int free_timer_list_max = 0; static int free_timer_list_pos = 0; @@ -58,7 +58,7 @@ struct timer_func_list { struct timer_func_list* next; TimerFunc func; char* name; -} *tfl_root = NULL; +} *tfl_root = nullptr; /// Sets the name of a timer function. int add_timer_func_list(TimerFunc func, const char* name) @@ -66,7 +66,7 @@ int add_timer_func_list(TimerFunc func, const char* name) struct timer_func_list* tfl; if (name) { - for( tfl=tfl_root; tfl != NULL; tfl=tfl->next ) + for( tfl=tfl_root; tfl != nullptr; tfl=tfl->next ) {// check suspicious cases if( func == tfl->func ) ShowWarning("add_timer_func_list: duplicating function %p(%s) as %s.\n",tfl->func,tfl->name,name); @@ -87,7 +87,7 @@ const char* search_timer_func_list(TimerFunc func) { struct timer_func_list* tfl; - for( tfl=tfl_root; tfl != NULL; tfl=tfl->next ) + for( tfl=tfl_root; tfl != nullptr; tfl=tfl->next ) if (func == tfl->func) return tfl->name; @@ -154,7 +154,7 @@ static t_tick tick(void) return tval.tv_sec * 1000 + tval.tv_nsec / 1000000; #else struct timeval tval; - gettimeofday(&tval, NULL); + gettimeofday(&tval, nullptr); return tval.tv_sec * 1000 + tval.tv_usec / 1000; #endif } @@ -286,7 +286,7 @@ int add_timer_interval(t_tick tick, TimerFunc func, int id, intptr_t data, int i /// Retrieves internal timer data const struct TimerData* get_timer(int tid) { - return ( tid >= 0 && tid < timer_data_num ) ? &timer_data[tid] : NULL; + return ( tid >= 0 && tid < timer_data_num ) ? &timer_data[tid] : nullptr; } /// Marks a timer specified by 'id' for immediate deletion once it expires. @@ -305,7 +305,7 @@ int delete_timer(int tid, TimerFunc func) return -2; } - timer_data[tid].func = NULL; + timer_data[tid].func = nullptr; timer_data[tid].type = TIMER_ONCE_AUTODEL; return 0; @@ -406,7 +406,7 @@ t_tick do_timer(t_tick tick) unsigned long get_uptime(void) { - return (unsigned long)difftime(time(NULL), start_time); + return (unsigned long)difftime(time(nullptr), start_time); } /** @@ -460,7 +460,7 @@ void split_time(int timein, int* year, int* month, int* day, int* hour, int* min double solve_time(char* modif_p) { double totaltime = 0; struct tm then_tm; - time_t now = time(NULL); + time_t now = time(nullptr); time_t then = now; then_tm = *localtime(&then); @@ -521,7 +521,7 @@ void timer_final(void) struct timer_func_list *tfl; struct timer_func_list *next; - for( tfl=tfl_root; tfl != NULL; tfl = next ) { + for( tfl=tfl_root; tfl != nullptr; tfl = next ) { next = tfl->next; // copy next pointer aFree(tfl->name); // free structures aFree(tfl); diff --git a/src/common/utils.cpp b/src/common/utils.cpp index 14abb672d0..0337ffd096 100644 --- a/src/common/utils.cpp +++ b/src/common/utils.cpp @@ -87,7 +87,7 @@ void ShowDump(const void* buffer, size_t length) static char* checkpath(char *path, const char *srcpath) { // just make sure the char*path is not const char *p=path; - if(NULL!=path && NULL!=srcpath) + if(nullptr!=path && nullptr!=srcpath) while(*srcpath) { if (*srcpath=='/') { *p++ = '\\'; @@ -106,8 +106,8 @@ void findfile(const char *p, const char *pat, void (func)(const char*)) HANDLE hFind; char tmppath[MAX_PATH+1]; - const char *path = (p ==NULL)? "." : p; - const char *pattern = (pat==NULL)? "" : pat; + const char *path = (p ==nullptr)? "." : p; + const char *pattern = (pat==nullptr)? "" : pat; checkpath(tmppath,path); if( PATHSEP != tmppath[strlen(tmppath)-1]) @@ -198,7 +198,7 @@ int check_filepath(const char* filepath) static char* checkpath(char *path, const char*srcpath) { // just make sure the char*path is not const char *p=path; - if(NULL!=path && NULL!=srcpath) + if(nullptr!=path && nullptr!=srcpath) while(*srcpath) { if (*srcpath=='\\') { *p++ = '/'; @@ -218,8 +218,8 @@ void findfile(const char *p, const char *pat, void (func)(const char*)) struct stat dir_stat; // used by stat(). char tmppath[MAX_DIR_PATH * 2]; char path[MAX_DIR_PATH+1]= "."; - const char *pattern = (pat==NULL)? "" : pat; - if(p!=NULL) strcpy(path,p); + const char *pattern = (pat==nullptr)? "" : pat; + if(p!=nullptr) strcpy(path,p); // open the directory for reading dir = opendir( checkpath(path, path) ); diff --git a/src/common/winapi.cpp b/src/common/winapi.cpp index ad70e5f2b4..2953df8dd5 100644 --- a/src/common/winapi.cpp +++ b/src/common/winapi.cpp @@ -12,16 +12,16 @@ bool IsCurrentUserLocalAdministrator(void){ DWORD dwAccessDesired; DWORD dwACLSize; DWORD dwStructureSize = sizeof(PRIVILEGE_SET); - PACL pACL = NULL; - PSID psidAdmin = NULL; + PACL pACL = nullptr; + PSID psidAdmin = nullptr; - HANDLE hToken = NULL; - HANDLE hImpersonationToken = NULL; + HANDLE hToken = nullptr; + HANDLE hImpersonationToken = nullptr; PRIVILEGE_SET ps; GENERIC_MAPPING GenericMapping; - PSECURITY_DESCRIPTOR psdAdmin = NULL; + PSECURITY_DESCRIPTOR psdAdmin = nullptr; SID_IDENTIFIER_AUTHORITY SystemSidAuthority = SECURITY_NT_AUTHORITY; @@ -90,7 +90,7 @@ bool IsCurrentUserLocalAdministrator(void){ __leave; psdAdmin = LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH); - if (psdAdmin == NULL) + if (psdAdmin == nullptr) __leave; if (!InitializeSecurityDescriptor(psdAdmin, @@ -103,7 +103,7 @@ bool IsCurrentUserLocalAdministrator(void){ GetLengthSid(psidAdmin) - sizeof(DWORD); pACL = (PACL)LocalAlloc(LPTR, dwACLSize); - if (pACL == NULL) + if (pACL == nullptr) __leave; if (!InitializeAcl(pACL, dwACLSize, ACL_REVISION2)) diff --git a/src/login/account.cpp b/src/login/account.cpp index d1fe69a72d..c10b6efab5 100644 --- a/src/login/account.cpp +++ b/src/login/account.cpp @@ -85,7 +85,7 @@ AccountDB* account_db_sql(void) { db->vtable.iterator = &account_db_sql_iterator; // initialize to default values - db->accounts = NULL; + db->accounts = nullptr; // other settings db->case_sensitive = false; safestrncpy(db->account_db, "login", sizeof(db->account_db)); @@ -116,7 +116,7 @@ static bool account_db_sql_init(AccountDB* self) { db->db_username.c_str(), db->db_hostname.c_str(), db->db_port, db->db_database.c_str()); Sql_ShowDebug(sql_handle); Sql_Free(db->accounts); - db->accounts = NULL; + db->accounts = nullptr; return false; } @@ -140,7 +140,7 @@ static void account_db_sql_destroy(AccountDB* self){ } Sql_Free(db->accounts); - db->accounts = NULL; + db->accounts = nullptr; db->~AccountDB_SQL(); aFree(db); @@ -302,7 +302,7 @@ static bool account_db_sql_create(AccountDB* self, struct mmo_account* acc) { } Sql_GetData(sql_handle, 0, &data, &len); - account_id = ( data != NULL ) ? atoi(data) : 0; + account_id = ( data != nullptr ) ? atoi(data) : 0; Sql_FreeResult(sql_handle); account_id = max((uint32_t) START_ACCOUNT_NUM, account_id); } @@ -407,7 +407,7 @@ static bool account_db_sql_load_str(AccountDB* self, struct mmo_account* acc, co return false; } - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); account_id = atoi(data); return account_db_sql_load_num(self, acc, account_id); @@ -463,8 +463,8 @@ static bool account_db_sql_iter_next(AccountDBIterator* self, struct mmo_account } if( SQL_SUCCESS == Sql_NextRow(sql_handle) && - SQL_SUCCESS == Sql_GetData(sql_handle, 0, &data, NULL) && - data != NULL ) + SQL_SUCCESS == Sql_GetData(sql_handle, 0, &data, nullptr) && + data != nullptr ) {// get account data uint32 account_id; account_id = atoi(data); @@ -509,25 +509,25 @@ static bool mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, uint32 return false; } - Sql_GetData(sql_handle, 0, &data, NULL); acc->account_id = atoi(data); - Sql_GetData(sql_handle, 1, &data, NULL); safestrncpy(acc->userid, data, sizeof(acc->userid)); - Sql_GetData(sql_handle, 2, &data, NULL); safestrncpy(acc->pass, data, sizeof(acc->pass)); - Sql_GetData(sql_handle, 3, &data, NULL); acc->sex = data[0]; - Sql_GetData(sql_handle, 4, &data, NULL); safestrncpy(acc->email, data, sizeof(acc->email)); - Sql_GetData(sql_handle, 5, &data, NULL); acc->group_id = (unsigned int) atoi(data); - Sql_GetData(sql_handle, 6, &data, NULL); acc->state = (unsigned int) strtoul(data, NULL, 10); - Sql_GetData(sql_handle, 7, &data, NULL); acc->unban_time = atol(data); - Sql_GetData(sql_handle, 8, &data, NULL); acc->expiration_time = atol(data); - Sql_GetData(sql_handle, 9, &data, NULL); acc->logincount = (unsigned int) strtoul(data, NULL, 10); - Sql_GetData(sql_handle, 10, &data, NULL); safestrncpy(acc->lastlogin, data==NULL?"":data, sizeof(acc->lastlogin)); - Sql_GetData(sql_handle, 11, &data, NULL); safestrncpy(acc->last_ip, data, sizeof(acc->last_ip)); - Sql_GetData(sql_handle, 12, &data, NULL); safestrncpy(acc->birthdate, data==NULL?"":data, sizeof(acc->birthdate)); - Sql_GetData(sql_handle, 13, &data, NULL); acc->char_slots = (uint8) atoi(data); - Sql_GetData(sql_handle, 14, &data, NULL); safestrncpy(acc->pincode, data, sizeof(acc->pincode)); - Sql_GetData(sql_handle, 15, &data, NULL); acc->pincode_change = atol(data); + Sql_GetData(sql_handle, 0, &data, nullptr); acc->account_id = atoi(data); + Sql_GetData(sql_handle, 1, &data, nullptr); safestrncpy(acc->userid, data, sizeof(acc->userid)); + Sql_GetData(sql_handle, 2, &data, nullptr); safestrncpy(acc->pass, data, sizeof(acc->pass)); + Sql_GetData(sql_handle, 3, &data, nullptr); acc->sex = data[0]; + Sql_GetData(sql_handle, 4, &data, nullptr); safestrncpy(acc->email, data, sizeof(acc->email)); + Sql_GetData(sql_handle, 5, &data, nullptr); acc->group_id = (unsigned int) atoi(data); + Sql_GetData(sql_handle, 6, &data, nullptr); acc->state = (unsigned int) strtoul(data, nullptr, 10); + Sql_GetData(sql_handle, 7, &data, nullptr); acc->unban_time = atol(data); + Sql_GetData(sql_handle, 8, &data, nullptr); acc->expiration_time = atol(data); + Sql_GetData(sql_handle, 9, &data, nullptr); acc->logincount = (unsigned int) strtoul(data, nullptr, 10); + Sql_GetData(sql_handle, 10, &data, nullptr); safestrncpy(acc->lastlogin, data==nullptr?"":data, sizeof(acc->lastlogin)); + Sql_GetData(sql_handle, 11, &data, nullptr); safestrncpy(acc->last_ip, data, sizeof(acc->last_ip)); + Sql_GetData(sql_handle, 12, &data, nullptr); safestrncpy(acc->birthdate, data==nullptr?"":data, sizeof(acc->birthdate)); + Sql_GetData(sql_handle, 13, &data, nullptr); acc->char_slots = (uint8) atoi(data); + Sql_GetData(sql_handle, 14, &data, nullptr); safestrncpy(acc->pincode, data, sizeof(acc->pincode)); + Sql_GetData(sql_handle, 15, &data, nullptr); acc->pincode_change = atol(data); #ifdef VIP_ENABLE - Sql_GetData(sql_handle, 16, &data, NULL); acc->vip_time = atol(data); - Sql_GetData(sql_handle, 17, &data, NULL); acc->old_group = atoi(data); + Sql_GetData(sql_handle, 16, &data, nullptr); acc->vip_time = atol(data); + Sql_GetData(sql_handle, 17, &data, nullptr); acc->old_group = atoi(data); #endif Sql_FreeResult(sql_handle); acc->web_auth_token[0] = '\0'; @@ -783,7 +783,7 @@ void mmo_send_global_accreg(AccountDB* self, int fd, uint32 account_id, uint32 c * { keyLength(B), key(), index(L), valLength(B), val() } **/ while ( SQL_SUCCESS == Sql_NextRow(sql_handle) ) { - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); len = strlen(data)+1; WFIFOB(fd, plen) = (unsigned char)len; // won't be higher; the column size is 32 @@ -792,12 +792,12 @@ void mmo_send_global_accreg(AccountDB* self, int fd, uint32 account_id, uint32 c safestrncpy(WFIFOCP(fd,plen), data, len); plen += len; - Sql_GetData(sql_handle, 1, &data, NULL); + Sql_GetData(sql_handle, 1, &data, nullptr); WFIFOL(fd, plen) = (uint32)atol(data); plen += 4; - Sql_GetData(sql_handle, 2, &data, NULL); + Sql_GetData(sql_handle, 2, &data, nullptr); len = strlen(data)+1; WFIFOB(fd, plen) = (unsigned char)len; // won't be higher; the column size is 254 @@ -850,7 +850,7 @@ void mmo_send_global_accreg(AccountDB* self, int fd, uint32 account_id, uint32 c * { keyLength(B), key(), index(L), value(L) } **/ while ( SQL_SUCCESS == Sql_NextRow(sql_handle) ) { - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); len = strlen(data)+1; WFIFOB(fd, plen) = (unsigned char)len; // won't be higher; the column size is 32 @@ -859,14 +859,14 @@ void mmo_send_global_accreg(AccountDB* self, int fd, uint32 account_id, uint32 c safestrncpy(WFIFOCP(fd,plen), data, len); plen += len; - Sql_GetData(sql_handle, 1, &data, NULL); + Sql_GetData(sql_handle, 1, &data, nullptr); WFIFOL(fd, plen) = (uint32)atol(data); plen += 4; - Sql_GetData(sql_handle, 2, &data, NULL); + Sql_GetData(sql_handle, 2, &data, nullptr); - WFIFOQ(fd, plen) = strtoll(data,NULL,10); + WFIFOQ(fd, plen) = strtoll(data,nullptr,10); plen += 8; WFIFOW(fd, 14) += 1; diff --git a/src/login/ipban.cpp b/src/login/ipban.cpp index 4b0e3c53c9..1f2942f1f8 100644 --- a/src/login/ipban.cpp +++ b/src/login/ipban.cpp @@ -25,7 +25,7 @@ std::string ipban_codepage = ""; std::string ipban_table = "ipbanlist"; // globals -static Sql* sql_handle = NULL; +static Sql* sql_handle = nullptr; static int cleanup_timer_id = INVALID_TIMER; static bool ipban_inited = false; @@ -39,7 +39,7 @@ TIMER_FUNC(ipban_cleanup); */ bool ipban_check(uint32 ip) { uint8* p = (uint8*)&ip; - char* data = NULL; + char* data = nullptr; int matches; if( !login_config.ipban ) @@ -56,7 +56,7 @@ bool ipban_check(uint32 ip) { if( SQL_ERROR == Sql_NextRow(sql_handle) ) return true;// Shouldn't happen, but just in case... - Sql_GetData(sql_handle, 0, &data, NULL); + Sql_GetData(sql_handle, 0, &data, nullptr); matches = atoi(data); Sql_FreeResult(sql_handle); @@ -226,5 +226,5 @@ void ipban_final(void) { // close connections Sql_Free(sql_handle); - sql_handle = NULL; + sql_handle = nullptr; } diff --git a/src/login/login.cpp b/src/login/login.cpp index 59f486f68b..5e5c818ccf 100644 --- a/src/login/login.cpp +++ b/src/login/login.cpp @@ -44,7 +44,7 @@ std::unordered_map online_db; std::unordered_map auth_db; // account database -AccountDB* accounts = NULL; +AccountDB* accounts = nullptr; // Advanced subnet check [LuzZza] struct s_subnet { uint32 mask; @@ -251,7 +251,7 @@ int login_mmo_auth_new(const char* userid, const char* pass, const char sex, con safestrncpy(acc.pass, pass, sizeof(acc.pass)); acc.sex = sex; safestrncpy(acc.email, "a@a.com", sizeof(acc.email)); - acc.expiration_time = ( login_config.start_limited_time != -1 ) ? time(NULL) + login_config.start_limited_time : 0; + acc.expiration_time = ( login_config.start_limited_time != -1 ) ? time(nullptr) + login_config.start_limited_time : 0; safestrncpy(acc.lastlogin, "", sizeof(acc.lastlogin)); safestrncpy(acc.last_ip, last_ip, sizeof(acc.last_ip)); safestrncpy(acc.birthdate, "", sizeof(acc.birthdate)); @@ -305,7 +305,7 @@ int login_mmo_auth(struct login_session_data* sd, bool isServer) { sprintf(r_ip, "%u.%u.%u.%u", sin_addr[0], sin_addr[1], sin_addr[2], sin_addr[3]); - for( dnsbl_serv = strtok(login_config.dnsbl_servs,","); dnsbl_serv != NULL; dnsbl_serv = strtok(NULL,",") ) { + for( dnsbl_serv = strtok(login_config.dnsbl_servs,","); dnsbl_serv != nullptr; dnsbl_serv = strtok(nullptr,",") ) { sprintf(ip_dnsbl, "%s.%s", r_ip, trim(dnsbl_serv)); if( host2ip(ip_dnsbl) ) { ShowInfo("DNSBL: (%s) Blacklisted. User Kicked.\n", r_ip); @@ -354,12 +354,12 @@ int login_mmo_auth(struct login_session_data* sd, bool isServer) { return 1; // 1 = Incorrect Password } - if( acc.expiration_time != 0 && acc.expiration_time < time(NULL) ) { + if( acc.expiration_time != 0 && acc.expiration_time < time(nullptr) ) { ShowNotice("Connection refused (account: %s, expired ID, ip: %s)\n", sd->userid, ip); return 2; // 2 = This ID is expired } - if( acc.unban_time != 0 && acc.unban_time > time(NULL) ) { + if( acc.unban_time != 0 && acc.unban_time > time(nullptr) ) { char tmpstr[24]; timestamp2string(tmpstr, sizeof(tmpstr), acc.unban_time, login_config.date_format); ShowNotice("Connection refused (account: %s, banned until %s, ip: %s)\n", sd->userid, tmpstr, ip); @@ -372,7 +372,7 @@ int login_mmo_auth(struct login_session_data* sd, bool isServer) { } if( login_config.client_hash_check && !isServer ) { - struct client_hash_node *node = NULL; + struct client_hash_node *node = nullptr; bool match = false; for( node = login_config.client_hash_nodes; node; node = node->next ) { @@ -414,7 +414,7 @@ int login_mmo_auth(struct login_session_data* sd, bool isServer) { sd->group_id = acc.group_id; // update account data - timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time(NULL), "%Y-%m-%d %H:%M:%S"); + timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time(nullptr), "%Y-%m-%d %H:%M:%S"); safestrncpy(acc.last_ip, ip, sizeof(acc.last_ip)); acc.unban_time = 0; acc.logincount++; @@ -536,7 +536,7 @@ int login_lan_config_read(const char *lancfgName) { int line_num = 0, s_subnet=ARRAYLENGTH(subnet); char line[1024], w1[64], w2[64], w3[64], w4[64]; - if((fp = fopen(lancfgName, "r")) == NULL) { + if((fp = fopen(lancfgName, "r")) == nullptr) { ShowWarning("LAN Support configuration file is not found: %s\n", lancfgName); return 1; } @@ -588,7 +588,7 @@ int login_lan_config_read(const char *lancfgName) { bool login_config_read(const char* cfgName, bool normal) { char line[1024], w1[32], w2[1024]; FILE* fp = fopen(cfgName, "r"); - if (fp == NULL) { + if (fp == nullptr) { ShowError("Configuration file (%s) not found.\n", cfgName); return false; } @@ -767,7 +767,7 @@ void login_set_defaults() { login_config.time_allowed = 10; //in second login_config.client_hash_check = 0; - login_config.client_hash_nodes = NULL; + login_config.client_hash_nodes = nullptr; login_config.usercount_disable = false; login_config.usercount_low = 200; login_config.usercount_medium = 500; @@ -819,10 +819,10 @@ void LoginServer::finalize(){ if (db) { // destroy account engine db->destroy(db); - db = NULL; + db = nullptr; } - accounts = NULL; // destroyed in account_engine + accounts = nullptr; // destroyed in account_engine online_db.clear(); auth_db.clear(); @@ -880,7 +880,7 @@ bool LoginServer::initialize( int argc, char* argv[] ){ add_timer_interval(gettick() + 600*1000, login_online_data_cleanup, 0, 0, 600*1000); // Account database init - if( accounts == NULL ) { + if( accounts == nullptr ) { ShowFatalError("do_init: account engine not found.\n"); return false; } else { diff --git a/src/login/loginchrif.cpp b/src/login/loginchrif.cpp index 7ffceedf02..9954caca7d 100644 --- a/src/login/loginchrif.cpp +++ b/src/login/loginchrif.cpp @@ -180,7 +180,7 @@ int logchrif_send_accdata(int fd, uint32 aid) { #ifdef VIP_ENABLE char_vip = login_config.vip_sys.char_increase; - if( acc.vip_time > time(NULL) ) { + if( acc.vip_time > time(nullptr) ) { isvip = true; char_slots += char_vip; } @@ -368,14 +368,14 @@ int logchrif_parse_reqbanacc(int fd, int id, char* ip){ ShowNotice("Char-server '%s': Error of ban request (account: %d not found, ip: %s).\n", ch_server[id].name, account_id, ip); else{ time_t timestamp; - if (acc.unban_time == 0 || acc.unban_time < time(NULL)) - timestamp = time(NULL); // new ban + if (acc.unban_time == 0 || acc.unban_time < time(nullptr)) + timestamp = time(nullptr); // new ban else timestamp = acc.unban_time; // add to existing ban timestamp += timediff; if (timestamp == -1) ShowNotice("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s).\n", ch_server[id].name, account_id, ip); - else if( timestamp <= time(NULL) || timestamp == 0 ) + else if( timestamp <= time(nullptr) || timestamp == 0 ) ShowNotice("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s).\n", ch_server[id].name, account_id, ip); else{ uint8 buf[11]; @@ -609,7 +609,7 @@ int logchrif_parse_updpincode(int fd){ if( accounts->load_num(accounts, &acc, RFIFOL(fd,4) ) ){ strncpy( acc.pincode, RFIFOCP(fd,8), PINCODE_LENGTH+1 ); - acc.pincode_change = time( NULL ); + acc.pincode_change = time( nullptr ); accounts->save(accounts, &acc, false); } RFIFOSKIP(fd,8 + PINCODE_LENGTH+1); @@ -667,7 +667,7 @@ int logchrif_parse_reqvipdata(int fd) { RFIFOSKIP(fd,15); if( accounts->load_num(accounts, &acc, aid ) ) { - time_t now = time(NULL); + time_t now = time(nullptr); time_t vip_time = acc.vip_time; bool isvip = false; diff --git a/src/login/loginclif.cpp b/src/login/loginclif.cpp index c01bf726e6..c2e7ef9739 100644 --- a/src/login/loginclif.cpp +++ b/src/login/loginclif.cpp @@ -103,7 +103,7 @@ static void logclif_auth_ok(struct login_session_data* sd) { // wipe previous session login_remove_auth_node(sd->account_id); login_remove_online_user(sd->account_id); - data = NULL; + data = nullptr; } } } diff --git a/src/login/loginlog.cpp b/src/login/loginlog.cpp index aaeab55d84..4daccdb373 100644 --- a/src/login/loginlog.cpp +++ b/src/login/loginlog.cpp @@ -22,7 +22,7 @@ std::string log_db_database = "ragnarok"; std::string log_login_db = "loginlog"; std::string log_codepage = ""; -static Sql* sql_handle = NULL; +static Sql* sql_handle = nullptr; static bool enabled = false; @@ -39,14 +39,14 @@ unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes) { return 0; if( SQL_ERROR == Sql_Query(sql_handle, "SELECT count(*) FROM `%s` WHERE `ip` = '%s' AND (`rcode` = '0' OR `rcode` = '1') AND `time` > NOW() - INTERVAL %d MINUTE", - log_login_db.c_str(), ip2str(ip,NULL), minutes) )// how many times failed account? in one ip. + log_login_db.c_str(), ip2str(ip,nullptr), minutes) )// how many times failed account? in one ip. Sql_ShowDebug(sql_handle); if( SQL_SUCCESS == Sql_NextRow(sql_handle) ) { char* data; - Sql_GetData(sql_handle, 0, &data, NULL); - failures = strtoul(data, NULL, 10); + Sql_GetData(sql_handle, 0, &data, nullptr); + failures = strtoul(data, nullptr, 10); Sql_FreeResult(sql_handle); } return failures; @@ -73,7 +73,7 @@ void login_log(uint32 ip, const char* username, int rcode, const char* message) retcode = Sql_Query(sql_handle, "INSERT INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%s', '%s', '%d', '%s')", - log_login_db.c_str(), ip2str(ip,NULL), esc_username, rcode, esc_message); + log_login_db.c_str(), ip2str(ip,nullptr), esc_username, rcode, esc_message); if( retcode != SQL_SUCCESS ) Sql_ShowDebug(sql_handle); @@ -90,7 +90,7 @@ bool loginlog_config_read(const char* key, const char* value) { log_db_hostname = value; else if( strcmpi(key, "log_db_port") == 0 ) - log_db_port = (uint16)strtoul(value, NULL, 10); + log_db_port = (uint16)strtoul(value, nullptr, 10); else if( strcmpi(key, "log_db_id") == 0 ) log_db_username = value; @@ -148,6 +148,6 @@ bool loginlog_init(void) { */ bool loginlog_final(void) { Sql_Free(sql_handle); - sql_handle = NULL; + sql_handle = nullptr; return true; } diff --git a/src/map/achievement.cpp b/src/map/achievement.cpp index 933ae0997b..944d44bd12 100644 --- a/src/map/achievement.cpp +++ b/src/map/achievement.cpp @@ -437,13 +437,13 @@ AchievementLevelDatabase achievement_level_db; * Add an achievement to the player's log * @param sd: Player data * @param achievement_id: Achievement to add - * @return NULL on failure, achievement data on success + * @return nullptr on failure, achievement data on success */ struct achievement *achievement_add(map_session_data *sd, int achievement_id) { int i, index; - nullpo_retr(NULL, sd); + nullpo_retr(nullptr, sd); std::shared_ptr adb = achievement_db.find( achievement_id ); @@ -455,7 +455,7 @@ struct achievement *achievement_add(map_session_data *sd, int achievement_id) ARR_FIND(0, sd->achievement_data.count, i, sd->achievement_data.achievements[i].achievement_id == achievement_id); if (i < sd->achievement_data.count) { ShowError("achievement_add: Character %d already has achievement %d.\n", sd->status.char_id, achievement_id); - return NULL; + return nullptr; } index = sd->achievement_data.incompleteCount; @@ -512,7 +512,7 @@ bool achievement_remove(map_session_data *sd, int achievement_id) sd->achievement_data.count--; if( sd->achievement_data.count == 0 ){ aFree(sd->achievement_data.achievements); - sd->achievement_data.achievements = NULL; + sd->achievement_data.achievements = nullptr; }else{ RECREATE(sd->achievement_data.achievements, struct achievement, sd->achievement_data.count); } @@ -577,7 +577,7 @@ static int achievement_check_groups(map_session_data *sd, struct s_achievement_d { int i; - if (ad == NULL || sd == NULL) + if (ad == nullptr || sd == nullptr) return 0; if (ad->group != AG_BATTLE && ad->group != AG_TAMING && ad->group != AG_ADVENTURE) @@ -630,7 +630,7 @@ bool achievement_update_achievement(map_session_data *sd, int achievement_id, bo sd->achievement_data.achievements[i].count[it.first] = it.second->count; } - sd->achievement_data.achievements[i].completed = time(NULL); + sd->achievement_data.achievements[i].completed = time(nullptr); if (i < (--sd->achievement_data.incompleteCount)) { // The achievement needs to be moved to the completed achievements block at the end of the array struct achievement tmp_ach; @@ -763,7 +763,7 @@ void achievement_free(map_session_data *sd) if (sd->achievement_data.count) { aFree(sd->achievement_data.achievements); - sd->achievement_data.achievements = NULL; + sd->achievement_data.achievements = nullptr; sd->achievement_data.count = sd->achievement_data.incompleteCount = 0; } } @@ -938,7 +938,7 @@ static bool achievement_update_objectives(map_session_data *sd, std::shared_ptr< if (group != ad->group) return false; - struct achievement *entry = NULL; + struct achievement *entry = nullptr; bool isNew = false, changed = false, complete = false; std::array current_count = {}; // Player's current objective values int i; diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index fe9d780556..8b6d8bd165 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -88,7 +88,7 @@ struct s_atcommand_alias_info{ char atcommand_symbol = '@'; // first char of the commands char charcommand_symbol = '#'; -static DBMap* atcommand_db = NULL; //name -> AtCommandInfo +static DBMap* atcommand_db = nullptr; //name -> AtCommandInfo static AtCommandInfo* get_atcommandinfo_byname( const char* name ); @@ -206,14 +206,14 @@ struct atcmd_binding_data* get_atcommandbind_byname(const char* name) { ARR_FIND( 0, atcmd_binding_count, i, strcmpi(atcmd_binding[i]->command, name) == 0 ); - return ( i < atcmd_binding_count ) ? atcmd_binding[i] : NULL; + return ( i < atcmd_binding_count ) ? atcmd_binding[i] : nullptr; } /** * retrieves the help string associated with a given command. * * @param name the name of the command to retrieve help information for - * @return the string associated with the command, or NULL + * @return the string associated with the command, or nullptr */ static const char* atcommand_help_string( const char* command ){ // remove the prefix symbol for the raw name of the command @@ -611,7 +611,7 @@ ACMD_FUNC(mapmove) if ((x || y) && map_getcell(m, x, y, CELL_CHKNOPASS)) { //This is to prevent the pc_setpos call from printing an error. clif_displaymessage(fd, msg_txt(sd,2)); // Invalid coordinates, using random target cell. - if (!map_search_freecell(NULL, m, &x, &y, 10, 10, 1)) + if (!map_search_freecell(nullptr, m, &x, &y, 10, 10, 1)) x = y = 0; //Invalid cell, use random spot. } if ((map_getmapflag(m, MF_NOWARPTO) && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) || !pc_job_can_entermap((enum e_job)sd->status.class_, m, pc_get_group_level(sd))) { @@ -647,7 +647,7 @@ ACMD_FUNC(where) } pl_sd = map_nick2sd(atcmd_player_name,true); - if (pl_sd == NULL || + if (pl_sd == nullptr || strncmp(pl_sd->status.name, atcmd_player_name, NAME_LENGTH) != 0 || (pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) && pc_get_group_level(pl_sd) > pc_get_group_level(sd) && !pc_has_permission(sd, PC_PERM_WHO_DISPLAY_AID)) ) { @@ -677,7 +677,7 @@ ACMD_FUNC(jumpto) return -1; } - if((pl_sd=map_nick2sd(atcmd_player_name,true)) == NULL && (pl_sd=map_charid2sd(atoi(atcmd_player_name))) == NULL) + if((pl_sd=map_nick2sd(atcmd_player_name,true)) == nullptr && (pl_sd=map_charid2sd(atoi(atcmd_player_name))) == nullptr) { clif_displaymessage(fd, msg_txt(sd,3)); // Character not found. return -1; @@ -735,7 +735,7 @@ ACMD_FUNC(jump) if ((x || y) && map_getcell(sd->bl.m, x, y, CELL_CHKNOPASS)) { //This is to prevent the pc_setpos call from printing an error. clif_displaymessage(fd, msg_txt(sd,2)); // Invalid coordinates, using random target cell. - if (!map_search_freecell(NULL, sd->bl.m, &x, &y, 10, 10, 1)) + if (!map_search_freecell(nullptr, sd->bl.m, &x, &y, 10, 10, 1)) x = y = 0; //Invalid cell, use random spot. } @@ -751,7 +751,7 @@ ACMD_FUNC(jump) *------------------------------------------*/ ACMD_FUNC(who) { map_session_data* pl_sd = nullptr;; - struct s_mapiterator *iter = NULL; + struct s_mapiterator *iter = nullptr; char player_name[NAME_LENGTH] = ""; int count = 0; int level = 0; @@ -766,7 +766,7 @@ ACMD_FUNC(who) { nullpo_retr(-1, sd); - if (strstr(command, "map") != NULL) { + if (strstr(command, "map") != nullptr) { char map_name[MAP_NAME_LENGTH_EXT] = ""; if (sscanf(message, "%15s %23s", map_name, player_name) < 1 || (map_id = map_mapname2mapid(map_name)) < 0) map_id = sd->bl.m; @@ -774,9 +774,9 @@ ACMD_FUNC(who) { sscanf(message, "%23s", player_name); } - if (strstr(command, "2") != NULL) + if (strstr(command, "2") != nullptr) display_type = 2; - else if (strstr(command, "3") != NULL) + else if (strstr(command, "3") != nullptr) display_type = 3; level = pc_get_group_level(sd); @@ -785,7 +785,7 @@ ACMD_FUNC(who) { iter = mapit_getallusers(); for (pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter)) { if (!((pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) || pc_isinvisible(pl_sd)) && pc_get_group_level(pl_sd) > level)) { // you can look only lower or same level - if (stristr(pl_sd->status.name, player_name) == NULL // search with no case sensitive + if (stristr(pl_sd->status.name, player_name) == nullptr // search with no case sensitive || (map_id >= 0 && pl_sd->bl.m != map_id)) continue; switch (display_type) { @@ -813,9 +813,9 @@ ACMD_FUNC(who) { StringBuf_Printf(&buf, msg_txt(sd,343), pl_sd->status.name); // "Name: %s " if (pc_get_group_id(pl_sd) > 0) // Player title, if exists StringBuf_Printf(&buf, msg_txt(sd,344), pl_sd->group->name.c_str()); // "(%s) " - if (p != NULL) + if (p != nullptr) StringBuf_Printf(&buf, msg_txt(sd,345), p->party.name); // " | Party: '%s'" - if (g != NULL) + if (g != nullptr) StringBuf_Printf(&buf, msg_txt(sd,346), g->guild.name); // " | Guild: '%s'" break; } @@ -889,7 +889,7 @@ ACMD_FUNC(whogm) for (j = 0; player_name[j]; j++) player_name[j] = TOLOWER(player_name[j]); // search with no case sensitive - if (strstr(player_name, match_text) == NULL) + if (strstr(player_name, match_text) == nullptr) continue; } if (pl_level > level) { @@ -1262,7 +1262,7 @@ ACMD_FUNC(kami) } sscanf(message, "%255[^\n]", atcmd_output); - if (strstr(command, "l") != NULL) + if (strstr(command, "l") != nullptr) clif_broadcast(&sd->bl, atcmd_output, strlen(atcmd_output) + 1, BC_DEFAULT, ALL_SAMEMAP); else intif_broadcast(atcmd_output, strlen(atcmd_output) + 1, (*(command + 5) == 'b' || *(command + 5) == 'B') ? BC_BLUE : BC_DEFAULT); @@ -1312,7 +1312,7 @@ ACMD_FUNC(heal) } if ( hp < 0 && sp <= 0 ) { - status_damage(NULL, &sd->bl, -hp, -sp, 0, 0, 0); + status_damage(nullptr, &sd->bl, -hp, -sp, 0, 0, 0); clif_damage(&sd->bl,&sd->bl, gettick(), 0, 0, -hp, 0, DMG_ENDURE, 0, false); clif_displaymessage(fd, msg_txt(sd,156)); // HP or/and SP modified. return 0; @@ -1323,7 +1323,7 @@ ACMD_FUNC(heal) if (hp > 0) status_heal(&sd->bl, hp, 0, 0); else { - status_damage(NULL, &sd->bl, -hp, 0, 0, 0, 0); + status_damage(nullptr, &sd->bl, -hp, 0, 0, 0, 0); clif_damage(&sd->bl,&sd->bl, gettick(), 0, 0, -hp, 0, DMG_ENDURE, 0, false); } } @@ -1332,7 +1332,7 @@ ACMD_FUNC(heal) if (sp > 0) status_heal(&sd->bl, 0, sp, 0); else - status_damage(NULL, &sd->bl, 0, -sp, 0, 0, 0); + status_damage(nullptr, &sd->bl, 0, -sp, 0, 0, 0); } clif_displaymessage(fd, msg_txt(sd,156)); // HP or/and SP modified. @@ -1365,7 +1365,7 @@ ACMD_FUNC(healap) clif_displaymessage(fd, msg_txt(sd, 821));// AP recovered. return 0; }else{ - status_damage(NULL, &sd->bl, 0, 0, -ap, 0, 0, 0); + status_damage(nullptr, &sd->bl, 0, 0, -ap, 0, 0, 0); clif_displaymessage(fd, msg_txt(sd, 822));// AP modified. return 0; } @@ -1424,7 +1424,7 @@ ACMD_FUNC(item) } items.push_back( item ); - itemlist = strtok(NULL, ":"); //next itemline + itemlist = strtok(nullptr, ":"); //next itemline } if (number <= 0) @@ -3271,7 +3271,7 @@ ACMD_FUNC(recall) { return -1; } - if((pl_sd=map_nick2sd(atcmd_player_name,true)) == NULL && (pl_sd=map_charid2sd(atoi(atcmd_player_name))) == NULL) + if((pl_sd=map_nick2sd(atcmd_player_name,true)) == nullptr && (pl_sd=map_charid2sd(atoi(atcmd_player_name))) == nullptr) { clif_displaymessage(fd, msg_txt(sd,3)); // Character not found. return -1; @@ -3607,7 +3607,7 @@ ACMD_FUNC(kick) return -1; } - if((pl_sd=map_nick2sd(atcmd_player_name,false)) == NULL && (pl_sd=map_charid2sd(atoi(atcmd_player_name))) == NULL) + if((pl_sd=map_nick2sd(atcmd_player_name,false)) == nullptr && (pl_sd=map_charid2sd(atoi(atcmd_player_name))) == nullptr) { clif_displaymessage(fd, msg_txt(sd,3)); // Character not found. return -1; @@ -3638,7 +3638,7 @@ ACMD_FUNC(kickall) { if (pc_get_group_level(sd) >= pc_get_group_level(pl_sd)) { // you can kick only lower or same gm level if (sd->status.account_id != pl_sd->status.account_id) - clif_GM_kick(NULL, pl_sd); + clif_GM_kick(nullptr, pl_sd); } } mapit_free(iter); @@ -4156,8 +4156,8 @@ ACMD_FUNC(partyrecall) return -1; } - if ((p = party_searchname(party_name)) == NULL && // name first to avoid error when name begin with a number - (p = party_search(atoi(message))) == NULL) + if ((p = party_searchname(party_name)) == nullptr && // name first to avoid error when name begin with a number + (p = party_search(atoi(message))) == nullptr) { clif_displaymessage(fd, msg_txt(sd,96)); // Incorrect name or ID, or no one from the party is online. return -1; @@ -4369,7 +4369,7 @@ ACMD_FUNC(partysharelvl) { ACMD_FUNC(mapinfo) { map_session_data* pl_sd; struct s_mapiterator* iter; - struct chat_data *cd = NULL; + struct chat_data *cd = nullptr; char direction[12]; int i, m_id, chat_num = 0, list = 0, vend_num = 0; unsigned short m_index; @@ -4410,7 +4410,7 @@ ACMD_FUNC(mapinfo) { if( pl_sd->mapindex == m_index ) { if( pl_sd->state.vending ) vend_num++; - else if( (cd = (struct chat_data*)map_id2bl(pl_sd->chatID)) != NULL && cd->usersd[0] == pl_sd ) + else if( (cd = (struct chat_data*)map_id2bl(pl_sd->chatID)) != nullptr && cd->usersd[0] == pl_sd ) chat_num++; } } @@ -4673,7 +4673,7 @@ ACMD_FUNC(mapinfo) { iter = mapit_getallusers(); for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) ) { - if ((cd = (struct chat_data*)map_id2bl(pl_sd->chatID)) != NULL && + if ((cd = (struct chat_data*)map_id2bl(pl_sd->chatID)) != nullptr && pl_sd->mapindex == m_index && cd->usersd[0] == pl_sd) { @@ -4843,8 +4843,8 @@ ACMD_FUNC(partyspy) return -1; } - if ((p = party_searchname(party_name)) != NULL || // name first to avoid error when name begin with a number - (p = party_search(atoi(message))) != NULL) { + if ((p = party_searchname(party_name)) != nullptr || // name first to avoid error when name begin with a number + (p = party_search(atoi(message))) != nullptr) { if (sd->partyspy == p->party.party_id) { sd->partyspy = 0; sprintf(atcmd_output, msg_txt(sd,105), p->party.name); // No longer spying on the %s party. @@ -4880,8 +4880,8 @@ ACMD_FUNC(clanspy){ return -1; } - if ((c = clan_searchname(clan_name)) != NULL || // name first to avoid error when name begin with a number - (c = clan_search(atoi(message))) != NULL) { + if ((c = clan_searchname(clan_name)) != nullptr || // name first to avoid error when name begin with a number + (c = clan_search(atoi(message))) != nullptr) { if (sd->clanspy == c->id) { sd->clanspy = 0; sprintf(atcmd_output, msg_txt(sd, 1500), c->name); // No longer spying on the %s clan. @@ -4945,7 +4945,7 @@ ACMD_FUNC(nuke) return -1; } - if ((pl_sd = map_nick2sd(atcmd_player_name,false)) != NULL) { + if ((pl_sd = map_nick2sd(atcmd_player_name,false)) != nullptr) { if (pc_get_group_level(sd) >= pc_get_group_level(pl_sd)) { // you can kill only lower or same GM level skill_castend_nodamage_id(&pl_sd->bl, &pl_sd->bl, NPC_SELFDESTRUCTION, 99, gettick(), 0); clif_displaymessage(fd, msg_txt(sd,109)); // Player has been nuked! @@ -4978,7 +4978,7 @@ ACMD_FUNC(tonpc) return -1; } - if ((nd = npc_name2id(npcname)) != NULL) { + if ((nd = npc_name2id(npcname)) != nullptr) { if (pc_setpos(sd, map_id2index(nd->bl.m), nd->bl.x, nd->bl.y, CLR_TELEPORT) == SETPOS_OK) clif_displaymessage(fd, msg_txt(sd,0)); // Warped. else @@ -5080,7 +5080,7 @@ ACMD_FUNC(unloadnpc) return -1; } - if ((nd = npc_name2id(NPCname)) == NULL) { + if ((nd = npc_name2id(NPCname)) == nullptr) { clif_displaymessage(fd, msg_txt(sd,111)); // This NPC doesn't exist. return -1; } @@ -5138,21 +5138,21 @@ char* txt_time(t_tick duration_) seconds = duration - (60 * minutes); if (days == 1) - sprintf(temp, msg_txt(NULL,219), days); // %d day + sprintf(temp, msg_txt(nullptr,219), days); // %d day else if (days > 1) - sprintf(temp, msg_txt(NULL,220), days); // %d days + sprintf(temp, msg_txt(nullptr,220), days); // %d days if (hours == 1) - sprintf(temp1, msg_txt(NULL,221), temp, hours); // %s %d hour + sprintf(temp1, msg_txt(nullptr,221), temp, hours); // %s %d hour else if (hours > 1) - sprintf(temp1, msg_txt(NULL,222), temp, hours); // %s %d hours + sprintf(temp1, msg_txt(nullptr,222), temp, hours); // %s %d hours if (minutes < 2) - sprintf(temp, msg_txt(NULL,223), temp1, minutes); // %s %d minute + sprintf(temp, msg_txt(nullptr,223), temp1, minutes); // %s %d minute else - sprintf(temp, msg_txt(NULL,224), temp1, minutes); // %s %d minutes + sprintf(temp, msg_txt(nullptr,224), temp1, minutes); // %s %d minutes if (seconds == 1) - sprintf(temp1, msg_txt(NULL,225), temp, seconds); // %s and %d second + sprintf(temp1, msg_txt(nullptr,225), temp, seconds); // %s and %d second else if (seconds > 1) - sprintf(temp1, msg_txt(NULL,226), temp, seconds); // %s and %d seconds + sprintf(temp1, msg_txt(nullptr,226), temp, seconds); // %s and %d seconds return temp1; } @@ -5253,7 +5253,7 @@ ACMD_FUNC(jail) return -1; } - if ((pl_sd = map_nick2sd(atcmd_player_name,false)) == NULL) { + if ((pl_sd = map_nick2sd(atcmd_player_name,false)) == nullptr) { clif_displaymessage(fd, msg_txt(sd,3)); // Character not found. return -1; } @@ -5289,7 +5289,7 @@ ACMD_FUNC(unjail) return -1; } - if ((pl_sd = map_nick2sd(atcmd_player_name,false)) == NULL) { + if ((pl_sd = map_nick2sd(atcmd_player_name,false)) == nullptr) { clif_displaymessage(fd, msg_txt(sd,3)); // Character not found. return -1; } @@ -5337,7 +5337,7 @@ ACMD_FUNC(jailfor) { return -1; } - if ((pl_sd = map_nick2sd(atcmd_player_name,false)) == NULL) { + if ((pl_sd = map_nick2sd(atcmd_player_name,false)) == nullptr) { clif_displaymessage(fd, msg_txt(sd,3)); // Character not found. return -1; } @@ -5357,7 +5357,7 @@ ACMD_FUNC(jailfor) { } else { int year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0; char timestr[21]; - time_t now=time(NULL); + time_t now=time(nullptr); split_time(jailtime*60,&year,&month,&day,&hour,&minute,&second); sprintf(atcmd_output,msg_txt(sd,402),msg_txt(sd,1137),year,month,day,hour,minute); // %s in jail for %d years, %d months, %d days, %d hours and %d minutes clif_displaymessage(pl_sd->fd, atcmd_output); @@ -5382,7 +5382,7 @@ ACMD_FUNC(jailfor) { ACMD_FUNC(jailtime){ int year, month, day, hour, minute, second; char timestr[21]; - time_t now = time(NULL); + time_t now = time(nullptr); nullpo_retr(-1, sd); @@ -5433,7 +5433,7 @@ ACMD_FUNC(disguise) if ((id = mobdb_searchname(message)) == 0) { struct npc_data* nd = npc_name2id(message); - if (nd != NULL) + if (nd != nullptr) id = nd->class_; } } @@ -5515,7 +5515,7 @@ ACMD_FUNC(disguiseguild) } else { if( (id = mobdb_searchname(monster)) == 0 ) { struct npc_data* nd = npc_name2id(monster); - if( nd != NULL ) + if( nd != nullptr ) id = nd->class_; } } @@ -5815,7 +5815,7 @@ ACMD_FUNC(npcmove) return -1; } - if ((nd = npc_name2id(npc_name)) == NULL) + if ((nd = npc_name2id(npc_name)) == nullptr) { clif_displaymessage(fd, msg_txt(sd,111)); // This NPC doesn't exist. return -1; @@ -5859,7 +5859,7 @@ ACMD_FUNC(addwarp) } nd = npc_add_warp(warpname, sd->bl.m, sd->bl.x, sd->bl.y, 2, 2, m, x, y); - if( nd == NULL ) + if( nd == nullptr ) return -1; sprintf(atcmd_output, msg_txt(sd,1158), nd->exname); // New warp NPC '%s' created. @@ -5887,7 +5887,7 @@ ACMD_FUNC(follow) return 0; } - if ( (pl_sd = map_nick2sd(atcmd_player_name,true)) == NULL ) + if ( (pl_sd = map_nick2sd(atcmd_player_name,true)) == nullptr ) { clif_displaymessage(fd, msg_txt(sd,3)); // Character not found. return -1; @@ -6101,7 +6101,7 @@ ACMD_FUNC(cleargstorage) } gstorage = guild2storage2(sd->status.guild_id); - if (gstorage == NULL) { // Doesn't have opened @gstorage yet, so we skip the deletion since *shouldn't* have any item there. + if (gstorage == nullptr) { // Doesn't have opened @gstorage yet, so we skip the deletion since *shouldn't* have any item there. return -1; } @@ -6217,7 +6217,7 @@ ACMD_FUNC(useskill) if(!strcmp(atcmd_player_name,"self")) pl_sd = sd; //quick keyword - else if ( (pl_sd = map_nick2sd(atcmd_player_name,true)) == NULL ){ + else if ( (pl_sd = map_nick2sd(atcmd_player_name,true)) == nullptr ){ clif_displaymessage(fd, msg_txt(sd,3)); // Character not found. return -1; } @@ -6342,7 +6342,7 @@ ACMD_FUNC(skilltree) return -1; } - if ( (pl_sd = map_nick2sd(atcmd_player_name,true)) == NULL ) + if ( (pl_sd = map_nick2sd(atcmd_player_name,true)) == nullptr ) { clif_displaymessage(fd, msg_txt(sd,3)); // Character not found. return -1; @@ -6415,7 +6415,7 @@ ACMD_FUNC(marry) return -1; } - if ((pl_sd = map_nick2sd(atcmd_player_name,false)) == NULL) { + if ((pl_sd = map_nick2sd(atcmd_player_name,false)) == nullptr) { clif_displaymessage(fd, msg_txt(sd,3)); // Character not found. return -1; } @@ -6513,7 +6513,7 @@ ACMD_FUNC(autotrade) { if( battle_config.at_timeout ) { int timeout = atoi(message); - status_change_start(NULL,&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, SCSTART_NONE); + status_change_start(nullptr,&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, SCSTART_NONE); } if (battle_config.at_logout_event) @@ -6538,7 +6538,7 @@ ACMD_FUNC(changegm) memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); - if (sd->status.guild_id == 0 || sd->guild == NULL || strcmp(sd->guild->guild.master,sd->status.name)) { + if (sd->status.guild_id == 0 || sd->guild == nullptr || strcmp(sd->guild->guild.master,sd->status.name)) { clif_displaymessage(fd, msg_txt(sd,1181)); // You need to be a Guild Master to use this command. return -1; } @@ -6553,7 +6553,7 @@ ACMD_FUNC(changegm) return -1; } - if((pl_sd=map_nick2sd(atcmd_player_name,false)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) { + if((pl_sd=map_nick2sd(atcmd_player_name,false)) == nullptr || pl_sd->status.guild_id != sd->status.guild_id) { clif_displaymessage(fd, msg_txt(sd,1184)); // Target character must be online and be a guild member. return -1; } @@ -6567,7 +6567,7 @@ ACMD_FUNC(changegm) return -1; } - if( battle_config.guild_leaderchange_delay && DIFF_TICK(time(NULL),sd->guild->guild.last_leader_change) < battle_config.guild_leaderchange_delay ){ + if( battle_config.guild_leaderchange_delay && DIFF_TICK(time(nullptr),sd->guild->guild.last_leader_change) < battle_config.guild_leaderchange_delay ){ #if PACKETVER >= 20151001 clif_msg(sd, GUILD_MASTER_DELAY); #else @@ -6595,7 +6595,7 @@ ACMD_FUNC(changeleader) return -1; } - party_changeleader(sd, map_nick2sd(atcmd_player_name,false),NULL); + party_changeleader(sd, map_nick2sd(atcmd_player_name,false),nullptr); return 0; } @@ -6610,7 +6610,7 @@ ACMD_FUNC(partyoption) char w1[16], w2[16]; nullpo_retr(-1, sd); - if (sd->status.party_id == 0 || (p = party_search(sd->status.party_id)) == NULL) + if (sd->status.party_id == 0 || (p = party_search(sd->status.party_id)) == nullptr) { clif_displaymessage(fd, msg_txt(sd,282)); // You need to be a party leader to use this command. return -1; @@ -7073,7 +7073,7 @@ ACMD_FUNC(sound) return -1; } - if(strstr(sound_file, ".wav") == NULL) + if(strstr(sound_file, ".wav") == nullptr) strcat(sound_file, ".wav"); clif_soundeffect( sd->bl, sound_file, 0, AREA ); @@ -7118,7 +7118,7 @@ ACMD_FUNC(mobsearch) for(;;) { TBL_MOB* md = (TBL_MOB*)mapit_next(it); - if( md == NULL ) + if( md == nullptr ) break;// no more mobs if( md->bl.m != sd->bl.m ) @@ -7261,11 +7261,11 @@ ACMD_FUNC(pettalk) if( i == ET_DICE1 ) i = rnd_value(ET_DICE1, ET_DICE6); // randomize /dice if( i < ARRAYLENGTH(emo) ) { - if (sd->emotionlasttime + 1 >= time(NULL)) { // not more than 1 per second - sd->emotionlasttime = time(NULL); + if (sd->emotionlasttime + 1 >= time(nullptr)) { // not more than 1 per second + sd->emotionlasttime = time(nullptr); return 0; } - sd->emotionlasttime = time(NULL); + sd->emotionlasttime = time(nullptr); clif_emotion(&pd->bl, i); return 0; @@ -7296,7 +7296,7 @@ ACMD_FUNC(users) for(;;) { map_session_data* sd2 = (map_session_data*)mapit_next(iter); - if( sd2 == NULL ) + if( sd2 == nullptr ) break;// no more users if( sd2->mapindex >= MAX_MAPINDEX ) @@ -7378,7 +7378,7 @@ ACMD_FUNC(summon) md->deletetimer=add_timer(tick+(duration*60000),mob_timer_delete,md->bl.id,0); clif_specialeffect(&md->bl,EF_ENTRY2,AREA); mob_spawn(md); - sc_start4(NULL,&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000); + sc_start4(nullptr,&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000); clif_skill_poseffect(&sd->bl,AM_CALLHOMUN,1,md->bl.x,md->bl.y,tick); clif_displaymessage(fd, msg_txt(sd,39)); // All monster summoned! @@ -7428,7 +7428,7 @@ ACMD_FUNC(trade) return -1; } - if ( (pl_sd = map_nick2sd(atcmd_player_name,true)) == NULL ) + if ( (pl_sd = map_nick2sd(atcmd_player_name,true)) == nullptr ) { clif_displaymessage(fd, msg_txt(sd,3)); // Character not found. return -1; @@ -7482,7 +7482,7 @@ ACMD_FUNC(unmute) return -1; } - if ( (pl_sd = map_nick2sd(atcmd_player_name,false)) == NULL ) + if ( (pl_sd = map_nick2sd(atcmd_player_name,false)) == nullptr ) { clif_displaymessage(fd, msg_txt(sd,3)); // Character not found. return -1; @@ -7581,7 +7581,7 @@ ACMD_FUNC(mute) return -1; } - if ( (pl_sd = map_nick2sd(atcmd_player_name,false)) == NULL ) + if ( (pl_sd = map_nick2sd(atcmd_player_name,false)) == nullptr ) { clif_displaymessage(fd, msg_txt(sd,3)); // Character not found. return -1; @@ -7598,7 +7598,7 @@ ACMD_FUNC(mute) if( pl_sd->status.manner < manner ) { pl_sd->status.manner -= manner; - sc_start(NULL,&pl_sd->bl,SC_NOCHAT,100,0,0); + sc_start(nullptr,&pl_sd->bl,SC_NOCHAT,100,0,0); } else { pl_sd->status.manner = 0; status_change_end(&pl_sd->bl, SC_NOCHAT); @@ -7674,7 +7674,7 @@ ACMD_FUNC(gmotd) { FILE* fp; - if( ( fp = fopen(motd_txt, "r") ) != NULL ) + if( ( fp = fopen(motd_txt, "r") ) != nullptr ) { char buf[CHAT_SIZE_MAX]; size_t len; @@ -7930,7 +7930,7 @@ ACMD_FUNC(showmobs) for(;;) { TBL_MOB* md = (TBL_MOB*)mapit_next(it); - if( md == NULL ) + if( md == nullptr ) break;// no more mobs if( md->bl.m != sd->bl.m ) @@ -8309,7 +8309,7 @@ ACMD_FUNC(iteminfo) sprintf(atcmd_output, msg_txt(sd,1277), // Item: '%s'/'%s' (%u) Type: %s | Extra Effect: %s item_data->name.c_str(), item_db.create_item_link( item_data ).c_str(),item_data->nameid, (item_data->type != IT_AMMO) ? itemdb_typename((enum item_types)item_data->type) : itemdb_typename_ammo((e_ammo_type)item_data->subtype), - (item_data->script==NULL)? msg_txt(sd,1278) : msg_txt(sd,1279) // None / With script + (item_data->script==nullptr)? msg_txt(sd,1278) : msg_txt(sd,1279) // None / With script ); clif_displaymessage(fd, atcmd_output); @@ -8468,7 +8468,7 @@ static int atcommand_mutearea_sub(struct block_list *bl,va_list ap) int time, id; map_session_data *pl_sd = (map_session_data *)bl; - if (pl_sd == NULL) + if (pl_sd == nullptr) return 0; id = va_arg(ap, int); @@ -8477,7 +8477,7 @@ static int atcommand_mutearea_sub(struct block_list *bl,va_list ap) if (id != bl->id && !pc_get_group_level(pl_sd)) { pl_sd->status.manner -= time; if (pl_sd->status.manner < 0) - sc_start(NULL,&pl_sd->bl,SC_NOCHAT,100,0,0); + sc_start(nullptr,&pl_sd->bl,SC_NOCHAT,100,0,0); else status_change_end(&pl_sd->bl, SC_NOCHAT); } @@ -8865,7 +8865,7 @@ ACMD_FUNC(showdelay) ACMD_FUNC(invite) { unsigned int did = sd->duel_group; - map_session_data *target_sd = NULL; + map_session_data *target_sd = nullptr; memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); memset(atcmd_output, '\0', sizeof(atcmd_output)); @@ -8886,7 +8886,7 @@ ACMD_FUNC(invite) return 0; } - if((target_sd = map_nick2sd(atcmd_player_name, true)) == NULL) { + if((target_sd = map_nick2sd(atcmd_player_name, true)) == nullptr) { clif_displaymessage(fd, msg_txt(sd,352)); // "Duel: Player not found." return 0; } @@ -8937,7 +8937,7 @@ ACMD_FUNC(duel) } duel_create(sd, maxpl); } else { - map_session_data *target_sd = NULL; + map_session_data *target_sd = nullptr; memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); memset(atcmd_output, '\0', sizeof(atcmd_output)); @@ -8950,7 +8950,7 @@ ACMD_FUNC(duel) target_sd = map_nick2sd(atcmd_player_name,true); - if(target_sd != NULL) { + if(target_sd != nullptr) { unsigned int newduel; if((newduel = duel_create(sd, 2)) != -1) { if(target_sd->duel_group > 0 || target_sd->duel_invite > 0) { @@ -9094,7 +9094,7 @@ ACMD_FUNC(cash) ACMD_FUNC(clone) { int x=0,y=0,flag=0,master=0,i=0; - map_session_data *pl_sd=NULL; + map_session_data *pl_sd=nullptr; memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); @@ -9103,7 +9103,7 @@ ACMD_FUNC(clone) return 0; } - if((pl_sd=map_nick2sd(atcmd_player_name,true)) == NULL && (pl_sd=map_charid2sd(atoi(atcmd_player_name))) == NULL) { + if((pl_sd=map_nick2sd(atcmd_player_name,true)) == nullptr && (pl_sd=map_charid2sd(atoi(atcmd_player_name))) == nullptr) { clif_displaymessage(fd, msg_txt(sd,3)); // Character not found. return 0; } @@ -9497,7 +9497,7 @@ ACMD_FUNC(stats) int value; } output_table[] = { { "Base Level - %d", 0 }, - { NULL, 0 }, + { nullptr, 0 }, { "Hp - %d", 0 }, { "MaxHp - %d", 0 }, { "Sp - %d", 0 }, @@ -9523,7 +9523,7 @@ ACMD_FUNC(stats) { "JobChangeLvl (2nd) - %d", 0 }, { "JobChangeLvl (3rd) - %d", 0 }, { "JobChangeLvl (4th) - %d", 0 }, - { NULL, 0 } + { nullptr, 0 } }; memset(job_jobname, '\0', sizeof(job_jobname)); @@ -9564,7 +9564,7 @@ ACMD_FUNC(stats) clif_displaymessage(fd, output); - for (i = 0; output_table[i].format != NULL; i++) { + for (i = 0; output_table[i].format != nullptr; i++) { sprintf(output, output_table[i].format, output_table[i].value); clif_displaymessage(fd, output); } @@ -9773,7 +9773,7 @@ ACMD_FUNC(mount2) { clif_displaymessage(sd->fd,msg_txt(sd,1362)); // NOTICE: If you crash with mount your LUA is outdated. if (!sd->sc.getSCE(SC_ALL_RIDING)) { clif_displaymessage(sd->fd,msg_txt(sd,1363)); // You have mounted. - sc_start(NULL, &sd->bl, SC_ALL_RIDING, 10000, 1, INFINITE_TICK); + sc_start(nullptr, &sd->bl, SC_ALL_RIDING, 10000, 1, INFINITE_TICK); } else { clif_displaymessage(sd->fd,msg_txt(sd,1364)); // You have released your mount. status_change_end(&sd->bl, SC_ALL_RIDING); @@ -9855,9 +9855,9 @@ ACMD_FUNC(set) { // Only set the variable if there is a value for it if( toset >= 2 ){ if( is_str ){ - setd_sub_str( NULL, sd, name, index, val, NULL ); + setd_sub_str( nullptr, sd, name, index, val, nullptr ); }else{ - setd_sub_num( NULL, sd, name, index, strtoll( val, NULL, 10 ), NULL ); + setd_sub_num( nullptr, sd, name, index, strtoll( val, nullptr, 10 ), nullptr ); } } @@ -9884,7 +9884,7 @@ ACMD_FUNC(set) { break; } - if( value == NULL || *value == '\0' ){// empty string + if( value == nullptr || *value == '\0' ){// empty string sprintf(atcmd_output,msg_txt(sd,1375),reg); // %s is empty }else{ sprintf(atcmd_output,msg_txt(sd,1374),reg,value); // %s value is now: %s @@ -10172,11 +10172,11 @@ ACMD_FUNC(channel) { } else if ( strcmpi(key,"kick") == 0 ) { return channel_pckick(sd,sub1,sub2); } else if ( strcmpi(key,"banlist") == 0 ) { - return channel_pcban(sd,sub1,NULL,3); + return channel_pcban(sd,sub1,nullptr,3); } else if ( strcmpi(key,"unban") == 0 ) { return channel_pcban(sd,sub1,sub2,1); } else if ( strcmpi(key,"unbanall") == 0 ) { - return channel_pcban(sd,sub1,NULL,2); + return channel_pcban(sd,sub1,nullptr,2); } else { char sub3[CHAN_NAME_LENGTH], sub4[CHAN_NAME_LENGTH]; sub3[0] = sub4[0] = '\0'; @@ -10261,7 +10261,7 @@ ACMD_FUNC(vip) { map_session_data* pl_sd = nullptr;; char * modif_p; int32 vipdifftime = 0; - time_t now=time(NULL); + time_t now=time(nullptr); nullpo_retr(-1, sd); @@ -10282,7 +10282,7 @@ ACMD_FUNC(vip) { return -1; } - if ((pl_sd = map_nick2sd(atcmd_player_name,false)) == NULL) { + if ((pl_sd = map_nick2sd(atcmd_player_name,false)) == nullptr) { clif_displaymessage(fd, msg_txt(sd,3)); // Character not found. return -1; } @@ -10347,7 +10347,7 @@ ACMD_FUNC(fullstrip) { return -1; } - if((tsd=map_nick2sd(atcmd_player_name,false)) == NULL && (tsd=map_id2sd(atoi(atcmd_player_name))) == NULL){ + if((tsd=map_nick2sd(atcmd_player_name,false)) == nullptr && (tsd=map_id2sd(atoi(atcmd_player_name))) == nullptr){ clif_displaymessage(fd, msg_txt(sd,3)); // Character not found. return -1; } @@ -10640,7 +10640,7 @@ ACMD_FUNC(adopt) return -1; } - if ((b_sd = map_nick2sd(atcmd_player_name,false)) == NULL) { + if ((b_sd = map_nick2sd(atcmd_player_name,false)) == nullptr) { clif_displaymessage(fd, msg_txt(sd, 3)); // Character not found. return -1; } @@ -10961,11 +10961,11 @@ ACMD_FUNC(setcard) /** * Fills the reference of available commands in atcommand DBMap **/ -#define ACMD_DEF(x) { #x, atcommand_ ## x, NULL, NULL, 0 } -#define ACMD_DEF2(x2, x) { x2, atcommand_ ## x, NULL, NULL, 0 } +#define ACMD_DEF(x) { #x, atcommand_ ## x, nullptr, nullptr, 0 } +#define ACMD_DEF2(x2, x) { x2, atcommand_ ## x, nullptr, nullptr, 0 } // Define with restriction -#define ACMD_DEFR(x, r) { #x, atcommand_ ## x, NULL, NULL, r } -#define ACMD_DEF2R(x2, x, r) { x2, atcommand_ ## x, NULL, NULL, r } +#define ACMD_DEFR(x, r) { #x, atcommand_ ## x, nullptr, nullptr, r } +#define ACMD_DEF2R(x2, x, r) { x2, atcommand_ ## x, nullptr, nullptr, r } void atcommand_basecommands(void) { /** * Command reference list, place the base of your commands here @@ -11314,13 +11314,13 @@ static AtCommandInfo* get_atcommandinfo_byname(const char *name) { if (strdb_exists(atcommand_db, name)) return (AtCommandInfo*)strdb_get(atcommand_db, name); - return NULL; + return nullptr; } /// AtCommand suggestion static void atcommand_get_suggestions(map_session_data* sd, const char *name, bool atcommand) { DBIterator* atcommand_iter; - AtCommandInfo* command_info = NULL; + AtCommandInfo* command_info = nullptr; AtCommandType type = atcommand ? COMMAND_ATCOMMAND : COMMAND_CHARCOMMAND; char* full_match[MAX_SUGGESTIONS]; char* suggestions[MAX_SUGGESTIONS]; @@ -11341,7 +11341,7 @@ static void atcommand_get_suggestions(map_session_data* sd, const char *name, bo suggestions[prefix_count] = command_info->command; ++prefix_count; } - if ( full_count < MAX_SUGGESTIONS && match != NULL && match != command_info->command && can_use ) { + if ( full_count < MAX_SUGGESTIONS && match != nullptr && match != command_info->command && can_use ) { full_match[full_count] = command_info->command; ++full_count; } @@ -11361,7 +11361,7 @@ static void atcommand_get_suggestions(map_session_data* sd, const char *name, bo ++prefix_count; } - if( full_count < MAX_SUGGESTIONS && match != NULL && match != alias ){ + if( full_count < MAX_SUGGESTIONS && match != nullptr && match != alias ){ full_match[full_count] = alias; ++full_count; } @@ -11413,7 +11413,7 @@ bool is_atcommand(const int fd, map_session_data* sd, const char* message, int t //Reconstructed message char atcmd_msg[CHAT_SIZE_MAX * 2]; - TBL_PC * ssd = NULL; //sd for target + TBL_PC * ssd = nullptr; //sd for target AtCommandInfo * info; bool is_atcommand = true; // false if it's a charcommand @@ -11478,7 +11478,7 @@ bool is_atcommand(const int fd, map_session_data* sd, const char* message, int t } ssd = map_nick2sd(charname,true); - if (ssd == NULL) { + if (ssd == nullptr) { sprintf(output, msg_txt(sd,1389), command); // %s failed. Player not found. clif_displaymessage(fd, output); return true; @@ -11515,8 +11515,8 @@ bool is_atcommand(const int fd, map_session_data* sd, const char* message, int t if((type == 1 || type == 3) && atcmd_binding_count > 0) { struct atcmd_binding_data *binding = get_atcommandbind_byname(command); - // Check if the binding isn't NULL and there is a NPC event, level of usage met, et cetera - if( binding != NULL && binding->npc_event[0] && + // Check if the binding isn't nullptr and there is a NPC event, level of usage met, et cetera + if( binding != nullptr && binding->npc_event[0] && ((is_atcommand && pc_get_group_level(sd) >= binding->level) || (!is_atcommand && pc_get_group_level(sd) >= binding->level2))) { @@ -11528,7 +11528,7 @@ bool is_atcommand(const int fd, map_session_data* sd, const char* message, int t //Grab the command information and check for the proper GM level required to use it or if the command exists info = get_atcommandinfo_byname(atcommand_alias_db.checkAlias(command + 1)); - if (info == NULL) { + if (info == nullptr) { if (pc_get_group_level(sd) == 0) // TODO: remove or replace with proper permission return false; @@ -11594,7 +11594,7 @@ void atcommand_db_load_groups(){ } void atcommand_db_clear(void) { - if (atcommand_db != NULL) { + if (atcommand_db != nullptr) { DBIterator *iter = db_iterator(atcommand_db); AtCommandInfo* cmd; diff --git a/src/map/battle.cpp b/src/map/battle.cpp index b8eb7acbde..a109731842 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -107,12 +107,12 @@ struct block_list* battle_gettargeted(struct block_list *target) { struct block_list *bl_list[24]; int c = 0; - nullpo_retr(NULL, target); + nullpo_retr(nullptr, target); memset(bl_list, 0, sizeof(bl_list)); map_foreachinallrange(battle_gettargeted_sub, target, AREA_SIZE, BL_CHAR, bl_list, &c, target->id); if ( c == 0 ) - return NULL; + return nullptr; if( c > 24 ) c = 24; return bl_list[rnd()%c]; @@ -189,7 +189,7 @@ struct block_list* battle_getenemy(struct block_list *target, int type, int rang map_foreachinallrange(battle_getenemy_sub, target, range, type, bl_list, &c, target); if ( c == 0 ) - return NULL; + return nullptr; if( c > 24 ) c = 24; @@ -249,7 +249,7 @@ struct block_list* battle_getenemyarea(struct block_list *src, int x, int y, int map_foreachinallarea(battle_getenemyarea_sub, src->m, x - range, y - range, x + range, y + range, type, bl_list, &c, src, ignore_id); if( c == 0 ) - return NULL; + return nullptr; if( c >= 24 ) c = 23; @@ -362,8 +362,8 @@ int battle_delay_damage(t_tick tick, int amotion, struct block_list *src, struct { struct delay_damage *dat; status_change *sc; - struct block_list *d_tbl = NULL; - struct block_list *e_tbl = NULL; + struct block_list *d_tbl = nullptr; + struct block_list *e_tbl = nullptr; nullpo_ret(src); nullpo_ret(target); @@ -429,7 +429,7 @@ int battle_fix_damage(struct block_list* src, struct block_list* target, int64 d /** * Does attribute fix modifiers. * Added passing of the chars so that the status changes can affect it. [Skotlex] - * Note: Passing src/target == NULL is perfectly valid, it skips SC_ checks. + * Note: Passing src/target == nullptr is perfectly valid, it skips SC_ checks. * @param src * @param target * @param damage @@ -441,7 +441,7 @@ int battle_fix_damage(struct block_list* src, struct block_list* target, int64 d */ int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 damage,int atk_elem,int def_type, int def_lv, int flag) { - status_change *sc = NULL, *tsc = NULL; + status_change *sc = nullptr, *tsc = nullptr; int ratio; if (src) sc = status_get_sc(src); @@ -495,8 +495,8 @@ int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 d std::shared_ptr sg; struct block_list *src2; - if( !su || !su->alive || (sg = su->group) == NULL || !sg || sg->val3 == -1 || - (src2 = map_id2bl(sg->src_id)) == NULL || status_isdead(src2) ) + if( !su || !su->alive || (sg = su->group) == nullptr || !sg || sg->val3 == -1 || + (src2 = map_id2bl(sg->src_id)) == nullptr || status_isdead(src2) ) return 0; if( sg->unit_id != UNT_FIREWALL ) { @@ -1531,7 +1531,7 @@ bool battle_status_block_damage(struct block_list *src, struct block_list *targe */ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int64 damage,uint16 skill_id,uint16 skill_lv) { - map_session_data *sd = NULL, *tsd = BL_CAST(BL_PC, src); + map_session_data *sd = nullptr, *tsd = BL_CAST(BL_PC, src); struct status_change_entry *sce; int div_ = d->div_, flag = d->flag; @@ -2456,7 +2456,7 @@ static int battle_calc_base_weapon_attack(struct block_list *src, struct status_ * Calculates the standard damage of a normal attack assuming it hits * This applies to pre-renewal and non-sd in renewal *------------------------------------------ - * Pass damage2 as NULL to not calc it. + * Pass damage2 as nullptr to not calc it. * Flag values (see e_base_damage_flag): * &1 : Critical hit * &2 : Arrow attack @@ -2474,7 +2474,7 @@ static int64 battle_calc_base_damage(struct block_list *src, struct status_data unsigned int atkmin = 0, atkmax = 0; short type = 0; int64 damage = 0; - map_session_data *sd = NULL; + map_session_data *sd = nullptr; nullpo_retr(damage, src); @@ -2870,7 +2870,7 @@ bool is_infinite_defense(struct block_list *target, int flag) */ static bool is_skill_using_arrow(struct block_list *src, int skill_id) { - if(src != NULL) { + if(src != nullptr) { struct status_data *sstatus = status_get_status_data(src); map_session_data *sd = BL_CAST(BL_PC, src); @@ -2890,7 +2890,7 @@ static bool is_skill_using_arrow(struct block_list *src, int skill_id) */ static bool is_attack_right_handed(struct block_list *src, int skill_id) { - if(src != NULL) { + if(src != nullptr) { map_session_data *sd = BL_CAST(BL_PC, src); //Skills ALWAYS use ONLY your right-hand weapon (tested on Aegis 10.2) @@ -2910,7 +2910,7 @@ static bool is_attack_right_handed(struct block_list *src, int skill_id) */ static bool is_attack_left_handed(struct block_list *src, int skill_id) { - if(src != NULL) { + if(src != nullptr) { //Skills ALWAYS use ONLY your right-hand weapon (tested on Aegis 10.2) if(!skill_id) { map_session_data *sd = BL_CAST(BL_PC, src); @@ -3058,7 +3058,7 @@ static int is_attack_piercing(struct Damage* wd, struct block_list *src, struct if (skill_id == MO_INVESTIGATE || skill_id == RL_MASS_SPIRAL) return 2; - if(src != NULL) { + if(src != nullptr) { map_session_data *sd = BL_CAST(BL_PC, src); struct status_data *tstatus = status_get_status_data(target); @@ -3413,7 +3413,7 @@ static bool battle_skill_stacks_masteries_vvs(uint16 skill_id, e_bonus_chk_flag */ static int battle_calc_equip_attack(struct block_list *src, int skill_id) { - if(src != NULL) { + if(src != nullptr) { int eatk = 0; struct status_data *status = status_get_status_data(src); map_session_data *sd = BL_CAST(BL_PC, src); @@ -6863,10 +6863,10 @@ static void battle_calc_attack_left_right_hands(struct Damage* wd, struct block_ /** * Check if bl is devoted by someone * @param bl -* @return 'd_bl' if devoted or NULL if not devoted +* @return 'd_bl' if devoted or nullptr if not devoted */ struct block_list *battle_check_devotion(struct block_list *bl) { - struct block_list *d_bl = NULL; + struct block_list *d_bl = nullptr; if (battle_config.devotion_rdamage && battle_config.devotion_rdamage > rnd() % 100) { status_change *sc = status_get_sc(bl); @@ -7301,7 +7301,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src, struct bl memset(&wd,0,sizeof(wd)); - if (src == NULL || target == NULL) { + if (src == nullptr || target == nullptr) { nullpo_info(NLP_MARK); return wd; } @@ -7312,9 +7312,9 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src, struct bl left_element = battle_get_weapon_element(&wd, src, target, skill_id, skill_lv, EQI_HAND_L, false); if (sc && !sc->count) - sc = NULL; //Skip checking as there are no status changes active. + sc = nullptr; //Skip checking as there are no status changes active. if (tsc && !tsc->count) - tsc = NULL; //Skip checking as there are no status changes active. + tsc = nullptr; //Skip checking as there are no status changes active. sd = BL_CAST(BL_PC, src); tsd = BL_CAST(BL_PC, target); @@ -7711,7 +7711,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list memset(&ad,0,sizeof(ad)); memset(&flag,0,sizeof(flag)); - if (src == NULL || target == NULL) { + if (src == nullptr || target == nullptr) { nullpo_info(NLP_MARK); return ad; } @@ -8951,7 +8951,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * memset(&md,0,sizeof(md)); - if (src == NULL || target == NULL) { + if (src == nullptr || target == nullptr) { nullpo_info(NLP_MARK); return md; } @@ -9750,7 +9750,7 @@ void battle_autocast_elembuff_skill(map_session_data* sd, struct block_list* tar * Do a basic physical attack (call through unit_attack_timer) *------------------------------------------*/ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* target, t_tick tick, int flag) { - map_session_data *sd = NULL, *tsd = NULL; + map_session_data *sd = nullptr, *tsd = nullptr; struct status_data *sstatus, *tstatus; status_change *sc, *tsc; int64 damage; @@ -9761,7 +9761,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t nullpo_retr(ATK_NONE, src); nullpo_retr(ATK_NONE, target); - if (src->prev == NULL || target->prev == NULL) + if (src->prev == nullptr || target->prev == nullptr) return ATK_NONE; sd = BL_CAST(BL_PC, src); @@ -9774,9 +9774,9 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t tsc = status_get_sc(target); if (sc && !sc->count) //Avoid sc checks when there's none to check for. [Skotlex] - sc = NULL; + sc = nullptr; if (tsc && !tsc->count) - tsc = NULL; + tsc = nullptr; if (sd) { @@ -9852,7 +9852,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t #ifndef RENEWAL status_get_class_(src) != CLASS_BOSS && #endif - (src->type == BL_PC || tsd == NULL || distance_bl(src, target) <= (tsd->status.weapon == W_FIST ? 1 : 2)) ) + (src->type == BL_PC || tsd == nullptr || distance_bl(src, target) <= (tsd->status.weapon == W_FIST ? 1 : 2)) ) { uint16 skill_lv = tsc->getSCE(SC_BLADESTOP_WAIT)->val1; int duration = skill_get_time2(MO_BLADESTOP,skill_lv); @@ -10471,7 +10471,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f int state = 0; //Initial state none int strip_enemy = 1; //Flag which marks whether to remove the BCT_ENEMY status if it's also friend/ally. struct block_list *s_bl = src, *t_bl = target; - struct unit_data *ud = NULL; + struct unit_data *ud = nullptr; nullpo_ret(src); nullpo_ret(target); @@ -10481,10 +10481,10 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f //t_bl/s_bl hold the 'master' of the attack, while src/target are the actual //objects involved. - if( (t_bl = battle_get_master(target)) == NULL ) + if( (t_bl = battle_get_master(target)) == nullptr ) t_bl = target; - if( (s_bl = battle_get_master(src)) == NULL ) + if( (s_bl = battle_get_master(src)) == nullptr ) s_bl = src; if ( s_bl->type == BL_PC ) { @@ -10598,7 +10598,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f switch( t_bl->type ) { //Checks on target master case BL_PC: { map_session_data *sd; - status_change *sc = NULL; + status_change *sc = nullptr; if( t_bl == s_bl ) break; @@ -10834,7 +10834,7 @@ bool battle_check_range(struct block_list *src, struct block_list *bl, int range if( d > AREA_SIZE ) return false; // Avoid targetting objects beyond your range of sight. - return path_search_long(NULL,src->m,src->x,src->y,bl->x,bl->y,CELL_CHKWALL); + return path_search_long(nullptr,src->m,src->x,src->y,bl->x,bl->y,CELL_CHKWALL); } /*============================================= @@ -11714,7 +11714,7 @@ int battle_config_read(const char* cfgName) count++; fp = fopen(cfgName,"r"); - if (fp == NULL) + if (fp == nullptr) ShowError("File not found: %s\n", cfgName); else { char line[1024], w1[1024], w2[1024]; diff --git a/src/map/buyingstore.cpp b/src/map/buyingstore.cpp index ab84dea1ac..4e03d54a89 100644 --- a/src/map/buyingstore.cpp +++ b/src/map/buyingstore.cpp @@ -110,7 +110,7 @@ int8 buyingstore_setup(map_session_data* sd, unsigned char slots){ * @param storename * @param *itemlist { .W, .W, .L }* * @param count Number of item on the itemlist -* @param at Autotrader info, or NULL if requetsed not from autotrade persistance +* @param at Autotrader info, or nullptr if requetsed not from autotrade persistance * @return 0 If success, 1 - Cannot open, 2 - Manner penalty, 3 - Mapflag restiction, 4 - Cell restriction, 5 - Invalid count/result, 6 - Cannot give item, 7 - Will be overweight */ int8 buyingstore_create( map_session_data* sd, int zenylimit, unsigned char result, const char* storename, const struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub* itemlist, unsigned int count, struct s_autotrader *at ){ @@ -302,7 +302,7 @@ void buyingstore_open(map_session_data* sd, uint32 account_id) return; } - if( ( pl_sd = map_id2sd(account_id) ) == NULL || !pl_sd->state.buyingstore ) + if( ( pl_sd = map_id2sd(account_id) ) == nullptr || !pl_sd->state.buyingstore ) {// not online or not buying return; } @@ -348,7 +348,7 @@ void buyingstore_trade( map_session_data* sd, uint32 account_id, unsigned int bu return; } - if( ( pl_sd = map_id2sd(account_id) ) == NULL || !pl_sd->state.buyingstore || pl_sd->buyer_id != buyer_id ) + if( ( pl_sd = map_id2sd(account_id) ) == nullptr || !pl_sd->state.buyingstore || pl_sd->buyer_id != buyer_id ) {// not online, not buying or not same store clif_buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, 0); return; @@ -385,7 +385,7 @@ void buyingstore_trade( map_session_data* sd, uint32 account_id, unsigned int bu int index = item->index - 2; // TODO: clif::server_index // invalid input - if( index < 0 || index >= ARRAYLENGTH( sd->inventory.u.items_inventory ) || sd->inventory_data[index] == NULL || sd->inventory.u.items_inventory[index].nameid != item->itemId || sd->inventory.u.items_inventory[index].amount < item->amount ){ + if( index < 0 || index >= ARRAYLENGTH( sd->inventory.u.items_inventory ) || sd->inventory_data[index] == nullptr || sd->inventory.u.items_inventory[index].nameid != item->itemId || sd->inventory.u.items_inventory[index].amount < item->amount ){ clif_buyingstore_trade_failed_seller( sd, BUYINGSTORE_TRADE_SELLER_FAILED, item->itemId ); return; } @@ -597,7 +597,7 @@ bool buyingstore_searchall(map_session_data* sd, const struct s_search_store_sea * @param sd Player as autotrader */ void buyingstore_reopen( map_session_data* sd ){ - struct s_autotrader *at = NULL; + struct s_autotrader *at = nullptr; int8 fail = -1; nullpo_retv(sd); @@ -673,25 +673,25 @@ void do_init_buyingstore_autotrade( void ) { if( Sql_NumRows(mmysql_handle) > 0 ) { uint16 items = 0; - DBIterator *iter = NULL; - struct s_autotrader *at = NULL; + DBIterator *iter = nullptr; + struct s_autotrader *at = nullptr; // Init each autotrader data while (SQL_SUCCESS == Sql_NextRow(mmysql_handle)) { size_t len; char* data; - at = NULL; + at = nullptr; CREATE(at, struct s_autotrader, 1); - Sql_GetData(mmysql_handle, 0, &data, NULL); at->id = atoi(data); - Sql_GetData(mmysql_handle, 1, &data, NULL); at->account_id = atoi(data); - Sql_GetData(mmysql_handle, 2, &data, NULL); at->char_id = atoi(data); - Sql_GetData(mmysql_handle, 3, &data, NULL); at->sex = (data[0] == 'F') ? SEX_FEMALE : SEX_MALE; + Sql_GetData(mmysql_handle, 0, &data, nullptr); at->id = atoi(data); + Sql_GetData(mmysql_handle, 1, &data, nullptr); at->account_id = atoi(data); + Sql_GetData(mmysql_handle, 2, &data, nullptr); at->char_id = atoi(data); + Sql_GetData(mmysql_handle, 3, &data, nullptr); at->sex = (data[0] == 'F') ? SEX_FEMALE : SEX_MALE; Sql_GetData(mmysql_handle, 4, &data, &len); safestrncpy(at->title, data, zmin(len + 1, MESSAGE_SIZE)); - Sql_GetData(mmysql_handle, 5, &data, NULL); at->limit = atoi(data); - Sql_GetData(mmysql_handle, 6, &data, NULL); at->dir = atoi(data); - Sql_GetData(mmysql_handle, 7, &data, NULL); at->head_dir = atoi(data); - Sql_GetData(mmysql_handle, 8, &data, NULL); at->sit = atoi(data); + Sql_GetData(mmysql_handle, 5, &data, nullptr); at->limit = atoi(data); + Sql_GetData(mmysql_handle, 6, &data, nullptr); at->dir = atoi(data); + Sql_GetData(mmysql_handle, 7, &data, nullptr); at->head_dir = atoi(data); + Sql_GetData(mmysql_handle, 8, &data, nullptr); at->sit = atoi(data); at->count = 0; if (battle_config.feature_autotrade_direction >= 0) @@ -744,9 +744,9 @@ void do_init_buyingstore_autotrade( void ) { while (SQL_SUCCESS == Sql_NextRow(mmysql_handle) && j < at->count) { char *data; CREATE(at->entries[j], struct s_autotrade_entry, 1); - Sql_GetData(mmysql_handle, 0, &data, NULL); at->entries[j]->item_id = strtoul(data, nullptr, 10); - Sql_GetData(mmysql_handle, 1, &data, NULL); at->entries[j]->amount = atoi(data); - Sql_GetData(mmysql_handle, 2, &data, NULL); at->entries[j]->price = atoi(data); + Sql_GetData(mmysql_handle, 0, &data, nullptr); at->entries[j]->item_id = strtoul(data, nullptr, 10); + Sql_GetData(mmysql_handle, 1, &data, nullptr); at->entries[j]->amount = atoi(data); + Sql_GetData(mmysql_handle, 2, &data, nullptr); at->entries[j]->price = atoi(data); j++; } items += j; diff --git a/src/map/cashshop.cpp b/src/map/cashshop.cpp index ba587bc3e2..4d98fe5bf9 100644 --- a/src/map/cashshop.cpp +++ b/src/map/cashshop.cpp @@ -141,8 +141,8 @@ CashShopDatabase cash_shop_db; static bool sale_parse_dbrow( char* fields[], int columns, int current ){ t_itemid nameid = strtoul(fields[0], nullptr, 10); int start = atoi(fields[1]), end = atoi(fields[2]), amount = atoi(fields[3]); - time_t now = time(NULL); - struct sale_item_data* sale_item = NULL; + time_t now = time(nullptr); + struct sale_item_data* sale_item = nullptr; if( !item_db.exists(nameid) ){ ShowWarning( "sale_parse_dbrow: Invalid ID %u in line '%d', skipping...\n", nameid, current ); @@ -170,7 +170,7 @@ static bool sale_parse_dbrow( char* fields[], int columns, int current ){ // Check if there is already an entry sale_item = sale_find_item(nameid,false); - if( sale_item == NULL ){ + if( sale_item == nullptr ){ RECREATE(sale_items.item, struct sale_item_data *, ++sale_items.count); CREATE(sale_items.item[sale_items.count - 1], struct sale_item_data, 1); sale_item = sale_items.item[sale_items.count - 1]; @@ -202,9 +202,9 @@ static void sale_read_db_sql( void ){ lines++; for( i = 0; i < 4; i++ ){ - Sql_GetData( mmysql_handle, i, &str[i], NULL ); + Sql_GetData( mmysql_handle, i, &str[i], nullptr ); - if( str[i] == NULL ){ + if( str[i] == nullptr ){ str[i] = dummy; } } @@ -229,7 +229,7 @@ static TIMER_FUNC(sale_end_timer){ delete_timer( sale_item->timer_end, sale_end_timer ); sale_item->timer_end = INVALID_TIMER; - clif_sale_end( sale_item, NULL, ALL_CLIENT ); + clif_sale_end( sale_item, nullptr, ALL_CLIENT ); sale_remove_item( sale_item->nameid ); @@ -239,8 +239,8 @@ static TIMER_FUNC(sale_end_timer){ static TIMER_FUNC(sale_start_timer){ struct sale_item_data* sale_item = (struct sale_item_data*)data; - clif_sale_start( sale_item, NULL, ALL_CLIENT ); - clif_sale_amount( sale_item, NULL, ALL_CLIENT ); + clif_sale_start( sale_item, nullptr, ALL_CLIENT ); + clif_sale_amount( sale_item, nullptr, ALL_CLIENT ); // Clear the start timer if( sale_item->timer_start != INVALID_TIMER ){ @@ -249,7 +249,7 @@ static TIMER_FUNC(sale_start_timer){ } // Init sale end - sale_item->timer_end = add_timer( gettick() + (unsigned int)( sale_item->end - time(NULL) ) * 1000, sale_end_timer, 0, (intptr_t)sale_item ); + sale_item->timer_end = add_timer( gettick() + (unsigned int)( sale_item->end - time(nullptr) ) * 1000, sale_end_timer, 0, (intptr_t)sale_item ); return 1; } @@ -261,7 +261,7 @@ enum e_sale_add_result sale_add_item( t_itemid nameid, int32 count, time_t from, } // Adding a sale in the past is not possible - if( from < time(NULL) ){ + if( from < time(nullptr) ){ return SALE_ADD_FAILED; } @@ -293,7 +293,7 @@ enum e_sale_add_result sale_add_item( t_itemid nameid, int32 count, time_t from, sale_item->start = from; sale_item->end = to; sale_item->amount = count; - sale_item->timer_start = add_timer( gettick() + (unsigned int)(from - time(NULL)) * 1000, sale_start_timer, 0, (intptr_t)sale_item ); + sale_item->timer_start = add_timer( gettick() + (unsigned int)(from - time(nullptr)) * 1000, sale_start_timer, 0, (intptr_t)sale_item ); sale_item->timer_end = INVALID_TIMER; return SALE_ADD_SUCCESS; @@ -306,7 +306,7 @@ bool sale_remove_item( t_itemid nameid ){ // Check if there is an entry for this item id sale_item = sale_find_item(nameid, false); - if( sale_item == NULL ){ + if( sale_item == nullptr ){ return false; } @@ -327,7 +327,7 @@ bool sale_remove_item( t_itemid nameid ){ sale_item->timer_end = INVALID_TIMER; // Notify all clients that the sale has ended - clif_sale_end(sale_item, NULL, ALL_CLIENT); + clif_sale_end(sale_item, nullptr, ALL_CLIENT); } // Find the original pointer in the array @@ -346,7 +346,7 @@ bool sale_remove_item( t_itemid nameid ){ }else{ aFree(sale_items.item[0]); aFree(sale_items.item); - sale_items.item = NULL; + sale_items.item = nullptr; } return true; @@ -355,13 +355,13 @@ bool sale_remove_item( t_itemid nameid ){ struct sale_item_data* sale_find_item( t_itemid nameid, bool onsale ){ int i; struct sale_item_data* sale_item; - time_t now = time(NULL); + time_t now = time(nullptr); ARR_FIND( 0, sale_items.count, i, sale_items.item[i]->nameid == nameid ); // No item with the specified item id was found if( i == sale_items.count ){ - return NULL; + return nullptr; } sale_item = sale_items.item[i]; @@ -373,17 +373,17 @@ struct sale_item_data* sale_find_item( t_itemid nameid, bool onsale ){ // The sale is in the future if( sale_items.item[i]->start > now ){ - return NULL; + return nullptr; } // The sale was in the past if( sale_items.item[i]->end < now ){ - return NULL; + return nullptr; } // The amount has been used up already if( sale_items.item[i]->amount == 0 ){ - return NULL; + return nullptr; } // Return the sale item @@ -407,7 +407,7 @@ static void cashshop_read_db( void ){ #if PACKETVER_SUPPORTS_SALES int i; - time_t now = time(NULL); + time_t now = time(nullptr); sale_read_db_sql(); @@ -421,7 +421,7 @@ static void cashshop_read_db( void ){ struct sale_item_data* it = sale_items.item[i]; if( it->start > now ){ - it->timer_start = add_timer( gettick() + (unsigned int)( it->start - time(NULL) ) * 1000, sale_start_timer, 0, (intptr_t)it ); + it->timer_start = add_timer( gettick() + (unsigned int)( it->start - time(nullptr) ) * 1000, sale_start_timer, 0, (intptr_t)it ); }else{ sale_start_timer( 0, gettick(), 0, (intptr_t)it ); } @@ -443,7 +443,7 @@ bool cashshop_buylist( map_session_data* sd, uint32 kafrapoints, int n, struct P uint32 totalweight = 0; int i,new_; - if( sd == NULL || item_list == NULL ){ + if( sd == nullptr || item_list == nullptr ){ clif_cashshop_result( sd, 0, CASHSHOP_RESULT_ERROR_UNKNOWN ); return false; }else if( sd->state.trading ){ @@ -488,7 +488,7 @@ bool cashshop_buylist( map_session_data* sd, uint32 kafrapoints, int n, struct P #if PACKETVER_SUPPORTS_SALES struct sale_item_data* sale = sale_find_item( nameid, true ); - if( sale == NULL ){ + if( sale == nullptr ){ // Client tried to buy an item from sale that was not even on sale clif_cashshop_result( sd, nameid, CASHSHOP_RESULT_ERROR_UNKNOWN ); return false; @@ -613,7 +613,7 @@ bool cashshop_buylist( map_session_data* sd, uint32 kafrapoints, int n, struct P sale->amount = new_amount; - clif_sale_amount(sale, NULL, ALL_CLIENT); + clif_sale_amount(sale, nullptr, ALL_CLIENT); } } #endif @@ -658,7 +658,7 @@ void do_final_cashshop( void ){ aFree(sale_items.item); - sale_items.item = NULL; + sale_items.item = nullptr; sale_items.count = 0; } #endif diff --git a/src/map/channel.cpp b/src/map/channel.cpp index 359dd494cc..53055260e2 100644 --- a/src/map/channel.cpp +++ b/src/map/channel.cpp @@ -34,13 +34,13 @@ DBMap* channel_get_db(void){ return channel_db; } * @param pass: Channel password, can be null * @param color: Display color * @param chantype: Channel type - * @return NULL on failure or Channel on success + * @return nullptr on failure or Channel on success */ struct Channel* channel_create(struct Channel *tmp_chan) { struct Channel* channel; if (!tmp_chan->name[0]) - return NULL; + return nullptr; CREATE(channel, struct Channel, 1); //will exit on fail allocation //channel->id = tmp_chan->id; @@ -84,7 +84,7 @@ struct Channel* channel_create(struct Channel *tmp_chan) { * @param pass: Channel password, can be null * @param chantype: Channel type * @param owner: Owner ID - * @return NULL on failure or Channel on success + * @return nullptr on failure or Channel on success */ struct Channel* channel_create_simple(char *name, char *pass, enum Channel_Type chantype, unsigned int owner) { struct Channel tmp_chan; @@ -125,7 +125,7 @@ struct Channel* channel_create_simple(char *name, char *pass, enum Channel_Type tmp_chan.char_id = owner; break; default: - return NULL; + return nullptr; } return channel_create(&tmp_chan); @@ -164,16 +164,16 @@ int channel_delete(struct Channel *channel, bool force) { db_destroy(channel->banned); if (channel->groups) aFree(channel->groups); - channel->groups = NULL; + channel->groups = nullptr; channel->group_count = 0; switch(channel->type){ case CHAN_TYPE_MAP: - map_getmapdata(channel->m)->channel = NULL; + map_getmapdata(channel->m)->channel = nullptr; aFree(channel); break; case CHAN_TYPE_ALLY: { auto g = guild_search(channel->gid); - if(g) g->channel = NULL; + if(g) g->channel = nullptr; aFree(channel); break; } @@ -259,7 +259,7 @@ int channel_mjoin(map_session_data *sd) { struct map_data *mapdata = map_getmapdata(sd->bl.m); if( !mapdata->channel ) { - mapdata->channel = channel_create_simple(NULL,NULL,CHAN_TYPE_MAP,sd->bl.m); + mapdata->channel = channel_create_simple(nullptr,nullptr,CHAN_TYPE_MAP,sd->bl.m); } if( mapdata->channel->opt & CHAN_OPT_ANNOUNCE_SELF ) { @@ -317,7 +317,7 @@ int channel_gjoin(map_session_data *sd, int flag){ channel = g->channel; if(!channel){ - channel = channel_create_simple(NULL,NULL,CHAN_TYPE_ALLY,g->guild.guild_id); + channel = channel_create_simple(nullptr,nullptr,CHAN_TYPE_ALLY,g->guild.guild_id); g->channel = channel; channel_ajoin(*g); } @@ -353,15 +353,15 @@ int channel_clean(struct Channel *channel, map_session_data *sd, int flag) { return -1; if( channel == sd->gcbind ) - sd->gcbind = NULL; + sd->gcbind = nullptr; ARR_FIND(0, sd->channel_count, i, sd->channels[i] == channel); if( i < sd->channel_count ) { unsigned char cursor = i; - sd->channels[i] = NULL; + sd->channels[i] = nullptr; sd->channel_tick[i] = 0; for(; i < sd->channel_count; i++ ) { //slice move list down - if( sd->channels[i] == NULL ) + if( sd->channels[i] == nullptr ) continue; if(i != cursor) { sd->channels[cursor] = sd->channels[i]; @@ -372,8 +372,8 @@ int channel_clean(struct Channel *channel, map_session_data *sd, int flag) { if ( !(sd->channel_count = cursor) ) { //if in no more chan delete db aFree(sd->channels); aFree(sd->channel_tick); - sd->channels = NULL; - sd->channel_tick = NULL; + sd->channels = nullptr; + sd->channel_tick = nullptr; } } @@ -501,26 +501,26 @@ int channel_chk(char *chname, char *chpass, int type){ /** * Lookup a channel name * @param chname: Channel name - * @param sd: Player data, can be NULL, used to solve #map and #ally cases + * @param sd: Player data, can be nullptr, used to solve #map and #ally cases * @param flag: Lookup types (1 - Create channel if it does not exist (map or ally only), 2 - Join the channel if not joined yet (map or ally only)) - * @return NULL on channel not found or channel data on success + * @return nullptr on channel not found or channel data on success */ struct Channel* channel_name2channel(char *chname, map_session_data *sd, int flag){ - if(channel_chk(chname, NULL, 1)) - return NULL; + if(channel_chk(chname, nullptr, 1)) + return nullptr; - struct map_data *mapdata = sd ? map_getmapdata(sd->bl.m) : NULL; + struct map_data *mapdata = sd ? map_getmapdata(sd->bl.m) : nullptr; if(sd && strcmpi(chname + 1,channel_config.map_tmpl.name) == 0){ if(flag&1 && !mapdata->channel) - mapdata->channel = channel_create_simple(NULL,NULL,CHAN_TYPE_MAP,sd->bl.m); + mapdata->channel = channel_create_simple(nullptr,nullptr,CHAN_TYPE_MAP,sd->bl.m); if(flag&2 && channel_pc_haschan(sd,mapdata->channel) < 1) channel_mjoin(sd); return mapdata->channel; } else if(sd && (strcmpi(chname + 1,channel_config.ally_tmpl.name) == 0) && sd->guild){ if(flag&1 && !sd->guild->channel) - sd->guild->channel = channel_create_simple(NULL,NULL,CHAN_TYPE_ALLY,sd->guild->guild.guild_id); + sd->guild->channel = channel_create_simple(nullptr,nullptr,CHAN_TYPE_ALLY,sd->guild->guild.guild_id); if(flag&2 && channel_pc_haschan(sd,mapdata->channel) < 1) channel_gjoin(sd,3); return sd->guild->channel; @@ -699,7 +699,7 @@ int channel_pcdelete(map_session_data *sd, char *chname){ if(!sd || !chname) return 0; - if( channel_chk(chname,NULL,1) ) { + if( channel_chk(chname,nullptr,1) ) { clif_displaymessage(sd->fd, msg_txt(sd,1405));// Channel name must start with '#'. return -1; } @@ -731,7 +731,7 @@ int channel_pcleave(map_session_data *sd, char *chname){ if(!sd || !chname) return 0; - if( channel_chk(chname,NULL,1) ) { + if( channel_chk(chname,nullptr,1) ) { clif_displaymessage(sd->fd, msg_txt(sd,1405));// Channel name must start with '#'. return -1; } @@ -779,7 +779,7 @@ int channel_pcjoin(map_session_data *sd, char *chname, char *pass){ if(!sd || !chname) return 0; - if( channel_chk(chname,NULL,1) ) { + if( channel_chk(chname,nullptr,1) ) { clif_displaymessage(sd->fd, msg_txt(sd,1405));// Channel name must start with '#'. return -1; } @@ -845,7 +845,7 @@ int channel_pccolor(map_session_data *sd, char *chname, char *color){ if(!sd) return 0; - if( channel_chk(chname,NULL,1) ) { + if( channel_chk(chname,nullptr,1) ) { clif_displaymessage(sd->fd, msg_txt(sd,1405));// Channel name must start with '#'. return -1; } @@ -897,7 +897,7 @@ int channel_pcbind(map_session_data *sd, char *chname){ if(!sd) return 0; - if( channel_chk(chname,NULL,1) ) { + if( channel_chk(chname,nullptr,1) ) { clif_displaymessage(sd->fd, msg_txt(sd,1405));// Channel name must start with '#'. return -1; } @@ -925,13 +925,13 @@ int channel_pcunbind(map_session_data *sd){ if(!sd) return 0; - if( sd->gcbind == NULL ) { + if( sd->gcbind == nullptr ) { clif_displaymessage(sd->fd, msg_txt(sd,1432));// Your global chat is not binded to any channel. return -1; } sprintf(output, msg_txt(sd,1433),sd->gcbind->name); // Your global chat is now unbinded from the '#%s' channel. clif_displaymessage(sd->fd, output); - sd->gcbind = NULL; + sd->gcbind = nullptr; return 0; } @@ -948,7 +948,7 @@ int channel_pcban(map_session_data *sd, char *chname, char *pname, int flag){ char output[CHAT_SIZE_MAX]; map_session_data *tsd = map_nick2sd(pname,false); - if( channel_chk(chname,NULL,1) ) { + if( channel_chk(chname,nullptr,1) ) { clif_displaymessage(sd->fd, msg_txt(sd,1405));// Channel name must start with '#'. return -1; } @@ -1057,7 +1057,7 @@ int channel_pckick(map_session_data *sd, char *chname, char *pname) { char output[CHAT_SIZE_MAX]; map_session_data *tsd = map_nick2sd(pname,false); - if( channel_chk(chname,NULL,1) ) { + if( channel_chk(chname,nullptr,1) ) { clif_displaymessage(sd->fd, msg_txt(sd,1405));// Channel name must start with '#'. return -1; } @@ -1135,7 +1135,7 @@ int channel_pcsetopt(map_session_data *sd, char *chname, const char *option, con "Autojoin", }; - if( channel_chk(chname,NULL,1) ) { + if( channel_chk(chname,nullptr,1) ) { clif_displaymessage(sd->fd, msg_txt(sd,1405));// Channel name must start with '#'. return -1; } @@ -1271,7 +1271,7 @@ bool channel_pccheckgroup(struct Channel *channel, int group_id) { */ int channel_pcautojoin_sub(DBKey key, DBData *data, va_list ap) { struct Channel *channel = (struct Channel *)db_data2ptr(data); - map_session_data *sd = NULL; + map_session_data *sd = nullptr; char channame[CHAN_NAME_LENGTH+1]; nullpo_ret(channel); @@ -1284,7 +1284,7 @@ int channel_pcautojoin_sub(DBKey key, DBData *data, va_list ap) { if (!pc_has_permission(sd, PC_PERM_CHANNEL_ADMIN) && !channel_pccheckgroup(channel, sd->group_id)) return 0; safesnprintf(channame, sizeof(channame), "#%s", channel->name); - channel_pcjoin(sd, channame, NULL); + channel_pcjoin(sd, channame, nullptr); return 1; } @@ -1322,14 +1322,14 @@ unsigned long channel_getColor(const char *color_str) { * @return True on success or false on failure */ bool channel_read_sub(config_setting_t *chan, struct Channel *tmp_chan, uint8 i) { - config_setting_t *group_list = NULL; + config_setting_t *group_list = nullptr; int delay = 1000, autojoin = 0, leave = 1, chat = 1, color_override = 0, self_notif = 1, join_notif = 0, leave_notif = 0; int64 type = CHAN_TYPE_PUBLIC; int group_count = 0; - const char *name = NULL, *password = NULL, *alias = NULL, *color_str = "Default", *type_str = NULL; + const char *name = nullptr, *password = nullptr, *alias = nullptr, *color_str = "Default", *type_str = nullptr; - if (tmp_chan == NULL) + if (tmp_chan == nullptr) return false; if (!config_setting_lookup_string(chan, "name", &name)) { @@ -1389,7 +1389,7 @@ bool channel_read_sub(config_setting_t *chan, struct Channel *tmp_chan, uint8 i) */ void channel_read_config(void) { config_t channels_conf; - config_setting_t *chan_setting = NULL; + config_setting_t *chan_setting = nullptr; if (conf_read_file(&channels_conf, channel_conf)) { ShowError("Cannot read file '%s' for channel connfig.\n", channel_conf); @@ -1397,12 +1397,12 @@ void channel_read_config(void) { } chan_setting = config_lookup(&channels_conf, "channel_config"); - if (chan_setting != NULL) { - config_setting_t *colors, *private_channel = NULL, *channels = NULL; + if (chan_setting != nullptr) { + config_setting_t *colors, *private_channel = nullptr, *channels = nullptr; int count = 0, channel_count = 0; colors = config_setting_get_member(chan_setting, "colors"); - if (colors != NULL) { + if (colors != nullptr) { int i, color_count = config_setting_length(colors); CREATE(channel_config.colors, unsigned long, color_count); @@ -1412,14 +1412,14 @@ void channel_read_config(void) { CREATE(channel_config.colors_name[i], char, CHAN_NAME_LENGTH); safestrncpy(channel_config.colors_name[i], config_setting_name(color), CHAN_NAME_LENGTH); - channel_config.colors[i] = strtoul(config_setting_get_string_elem(colors,i),NULL,0); + channel_config.colors[i] = strtoul(config_setting_get_string_elem(colors,i),nullptr,0); channel_config.colors[i] = (channel_config.colors[i] & 0x0000FF) << 16 | (channel_config.colors[i] & 0x00FF00) | (channel_config.colors[i] & 0xFF0000) >> 16;//RGB to BGR } channel_config.colors_count = color_count; } private_channel = config_setting_get_member(chan_setting, "private_channel"); - if (private_channel != NULL) { + if (private_channel != nullptr) { int allow = 1, ban = 1, kick = 1, color_override = 0, change_delay = 0, self_notif = 1, join_notif = 0, leave_notif = 0, delay = 1000, max_member = 1000; @@ -1453,22 +1453,22 @@ void channel_read_config(void) { } channels = config_setting_get_member(chan_setting, "ally"); - if (channels != NULL) { + if (channels != nullptr) { memset(&channel_config.ally_tmpl, 0, sizeof(struct Channel)); channel_read_sub(channels, &channel_config.ally_tmpl, 0); } channels = config_setting_get_member(chan_setting, "map"); - if (channels != NULL) { + if (channels != nullptr) { memset(&channel_config.map_tmpl, 0, sizeof(struct Channel)); channel_read_sub(channels, &channel_config.map_tmpl, 0); } channels = config_setting_get_member(chan_setting, "channels"); - if (channels != NULL && (count = config_setting_length(channels)) > 0) { + if (channels != nullptr && (count = config_setting_length(channels)) > 0) { int i; for (i = 0; i < count; i++) { config_setting_t *chan = config_setting_get_elem(channels, i); - struct Channel *channel = NULL, tmp_chan; + struct Channel *channel = nullptr, tmp_chan; memset(&tmp_chan, 0, sizeof(struct Channel)); if (!channel_read_sub(chan, &tmp_chan, i)) diff --git a/src/map/chat.cpp b/src/map/chat.cpp index 7874d1d4e1..384b0b1775 100644 --- a/src/map/chat.cpp +++ b/src/map/chat.cpp @@ -24,11 +24,11 @@ int chat_triggerevent(struct chat_data *cd); // forward declaration /// Initializes a chatroom object (common functionality for both pc and npc chatrooms). -/// Returns a chatroom object on success, or NULL on failure. +/// Returns a chatroom object on success, or nullptr on failure. static struct chat_data* chat_createchat(struct block_list* bl, const char* title, const char* pass, int limit, bool pub, int trigger, const char* ev, int zeny, int minLvl, int maxLvl) { struct chat_data* cd; - nullpo_retr(NULL, bl); + nullpo_retr(nullptr, bl); cd = (struct chat_data *) aMalloc(sizeof(struct chat_data)); @@ -50,11 +50,11 @@ static struct chat_data* chat_createchat(struct block_list* bl, const char* titl cd->bl.x = bl->x; cd->bl.y = bl->y; cd->bl.type = BL_CHAT; - cd->bl.next = cd->bl.prev = NULL; + cd->bl.next = cd->bl.prev = nullptr; if( cd->bl.id == 0 ) { aFree(cd); - cd = NULL; + cd = nullptr; } map_addiddb(&cd->bl); @@ -133,7 +133,7 @@ int chat_joinchat(map_session_data* sd, int chatid, const char* pass) cd = (struct chat_data*)map_id2bl(chatid); - if( cd == NULL || cd->bl.type != BL_CHAT || cd->bl.m != sd->bl.m || sd->state.vending || sd->state.buyingstore || sd->chatID || ((cd->owner->type == BL_NPC) ? cd->users+1 : cd->users) >= cd->limit ) { + if( cd == nullptr || cd->bl.type != BL_CHAT || cd->bl.m != sd->bl.m || sd->state.vending || sd->state.buyingstore || sd->chatID || ((cd->owner->type == BL_NPC) ? cd->users+1 : cd->users) >= cd->limit ) { clif_joinchatfail(sd,0); return 0; } @@ -196,7 +196,7 @@ int chat_leavechat(map_session_data* sd, bool kicked) cd = (struct chat_data*)map_id2bl(sd->chatID); - if( cd == NULL ) { + if( cd == nullptr ) { pc_setchatid(sd, 0); return 1; } @@ -267,7 +267,7 @@ int chat_changechatowner(map_session_data* sd, const char* nextownername) cd = (struct chat_data*)map_id2bl(sd->chatID); - if( cd == NULL || (struct block_list*) sd != cd->owner ) + if( cd == nullptr || (struct block_list*) sd != cd->owner ) return 1; ARR_FIND( 1, cd->users, i, strncmp(cd->usersd[i]->status.name, nextownername, NAME_LENGTH) == 0 ); @@ -317,7 +317,7 @@ int chat_changechatstatus(map_session_data* sd, const char* title, const char* p cd = (struct chat_data*)map_id2bl(sd->chatID); - if( cd == NULL || (struct block_list *)sd != cd->owner ) + if( cd == nullptr || (struct block_list *)sd != cd->owner ) return 1; safestrncpy(cd->title, title, CHATROOM_TITLE_SIZE); @@ -364,7 +364,7 @@ int chat_kickchat(map_session_data* sd, const char* kickusername) cd = (struct chat_data *)map_id2bl(sd->chatID); - if( cd == NULL || (struct block_list *)sd != cd->owner ) + if( cd == nullptr || (struct block_list *)sd != cd->owner ) return -1; ARR_FIND( 0, cd->users, i, strncmp(cd->usersd[i]->status.name, kickusername, NAME_LENGTH) == 0 ); @@ -432,7 +432,7 @@ int chat_deletenpcchat(struct npc_data* nd) cd = (struct chat_data*)map_id2bl(nd->chat_id); - if( cd == NULL ) + if( cd == nullptr ) return 0; chat_npckickall(cd); diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp index 29f7c4bd08..178dbaa3e7 100644 --- a/src/map/chrif.cpp +++ b/src/map/chrif.cpp @@ -130,7 +130,7 @@ struct auth_node* chrif_search(uint32 account_id) { struct auth_node* chrif_auth_check(uint32 account_id, uint32 char_id, enum sd_state state) { struct auth_node *node = chrif_search(account_id); - return ( node && node->char_id == char_id && node->state == state ) ? node : NULL; + return ( node && node->char_id == char_id && node->state == state ) ? node : nullptr; } bool chrif_auth_delete(uint32 account_id, uint32 char_id, enum sd_state state) { @@ -140,7 +140,7 @@ bool chrif_auth_delete(uint32 account_id, uint32 char_id, enum sd_state state) { int fd = node->sd ? node->sd->fd : node->fd; if ( session[fd] && session[fd]->session_data == node->sd ) - session[fd]->session_data = NULL; + session[fd]->session_data = nullptr; if ( node->char_dat ) aFree(node->char_dat); @@ -197,7 +197,7 @@ static bool chrif_auth_logout(TBL_PC* sd, enum sd_state state) { if(sd->fd && state == ST_LOGOUT) { //Disassociate player, and free it after saving ack returns. [Skotlex] //fd info must not be lost for ST_MAPCHANGE as a final packet needs to be sent to the player. if ( session[sd->fd] ) - session[sd->fd]->session_data = NULL; + session[sd->fd]->session_data = nullptr; sd->fd = 0; } @@ -208,7 +208,7 @@ bool chrif_auth_finished(map_session_data* sd) { struct auth_node *node= chrif_search(sd->status.account_id); if ( node && node->sd == sd && node->state == ST_LOGIN ) { - node->sd = NULL; + node->sd = nullptr; return chrif_auth_delete(node->account_id, node->char_id, ST_LOGIN); } @@ -509,7 +509,7 @@ static int chrif_reconnect(DBKey key, DBData *data, va_list ap) { switch (node->state) { case ST_LOGIN: - if ( node->sd && node->char_dat == NULL ) {//Since there is no way to request the char auth, make it fail. + if ( node->sd && node->char_dat == nullptr ) {//Since there is no way to request the char auth, make it fail. pc_authfail(node->sd); chrif_char_offline(node->sd); chrif_auth_delete(node->account_id, node->char_id, ST_LOGIN); @@ -627,7 +627,7 @@ int chrif_skillcooldown_request(uint32 account_id, uint32 char_id) { void chrif_authreq(map_session_data *sd, bool autotrade) { struct auth_node *node= chrif_search(sd->bl.id); - if( node != NULL || !chrif_isconnected() ) { + if( node != nullptr || !chrif_isconnected() ) { set_eof(sd->fd); return; } @@ -673,16 +673,16 @@ void chrif_authok(int fd) { //Check if we don't already have player data in our server //Causes problems if the currently connected player tries to quit or this data belongs to an already connected player which is trying to re-auth. - if ( ( sd = map_id2sd(account_id) ) != NULL ) + if ( ( sd = map_id2sd(account_id) ) != nullptr ) return; - if ( ( node = chrif_search(account_id) ) == NULL ) + if ( ( node = chrif_search(account_id) ) == nullptr ) return; // should not happen if ( node->state != ST_LOGIN ) return; //character in logout phase, do not touch that data. - if ( node->sd == NULL ) { + if ( node->sd == nullptr ) { /* //When we receive double login info and the client has not connected yet, //discard the older one and keep the new one. @@ -694,7 +694,7 @@ void chrif_authok(int fd) { sd = node->sd; if( global_core->is_running() && - node->char_dat == NULL && + node->char_dat == nullptr && node->account_id == account_id && node->char_id == char_id && node->login_id1 == login_id1 ) @@ -723,7 +723,7 @@ void chrif_authfail(int fd) {/* HELLO WORLD. ip in RFIFOL 15 is not being used ( node = chrif_search(account_id); - if( node != NULL && + if( node != nullptr && node->account_id == account_id && node->char_id == char_id && node->login_id1 == login_id1 && @@ -906,7 +906,7 @@ static void chrif_ack_login_req(int aid, const char* player_name, uint16 type, u sd = map_id2sd(aid); - if( aid < 0 || sd == NULL ) { + if( aid < 0 || sd == nullptr ) { ShowError("chrif_ack_login_req failed - player not online.\n"); return; } @@ -1037,14 +1037,14 @@ int chrif_divorceack(uint32 char_id, int partner_id) { if( !char_id || !partner_id ) return 0; - if( ( sd = map_charid2sd(char_id) ) != NULL && sd->status.partner_id == partner_id ) { + if( ( sd = map_charid2sd(char_id) ) != nullptr && sd->status.partner_id == partner_id ) { sd->status.partner_id = 0; for(i = 0; i < MAX_INVENTORY; i++) if (sd->inventory.u.items_inventory[i].nameid == WEDDING_RING_M || sd->inventory.u.items_inventory[i].nameid == WEDDING_RING_F) pc_delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER); } - if( ( sd = map_charid2sd(partner_id) ) != NULL && sd->status.partner_id == char_id ) { + if( ( sd = map_charid2sd(partner_id) ) != nullptr && sd->status.partner_id == char_id ) { sd->status.partner_id = 0; for(i = 0; i < MAX_INVENTORY; i++) if (sd->inventory.u.items_inventory[i].nameid == WEDDING_RING_M || sd->inventory.u.items_inventory[i].nameid == WEDDING_RING_F) @@ -1060,7 +1060,7 @@ int chrif_deadopt(uint32 father_id, uint32 mother_id, uint32 child_id) { map_session_data* sd; uint16 idx = skill_get_index(WE_CALLBABY); - if( father_id && ( sd = map_charid2sd(father_id) ) != NULL && sd->status.child == child_id ) { + if( father_id && ( sd = map_charid2sd(father_id) ) != nullptr && sd->status.child == child_id ) { sd->status.child = 0; sd->status.skill[idx].id = 0; sd->status.skill[idx].lv = 0; @@ -1068,7 +1068,7 @@ int chrif_deadopt(uint32 father_id, uint32 mother_id, uint32 child_id) { clif_deleteskill(sd,WE_CALLBABY); } - if( mother_id && ( sd = map_charid2sd(mother_id) ) != NULL && sd->status.child == child_id ) { + if( mother_id && ( sd = map_charid2sd(mother_id) ) != nullptr && sd->status.child == child_id ) { sd->status.child = 0; sd->status.skill[idx].id = 0; sd->status.skill[idx].lv = 0; @@ -1095,7 +1095,7 @@ int chrif_ban(int fd) { if(res==2) sd = map_charid2sd(id); else sd = map_id2sd(id); - if ( id < 0 || sd == NULL ) { + if ( id < 0 || sd == nullptr ) { //nothing to do on map if player not connected return 0; } @@ -1154,10 +1154,10 @@ int chrif_disconnectplayer(int fd) { uint32 account_id = RFIFOL(fd, 2); sd = map_id2sd(account_id); - if( sd == NULL ) { + if( sd == nullptr ) { struct auth_node* auth = chrif_search(account_id); - if( auth != NULL && chrif_auth_delete(account_id, auth->char_id, ST_LOGIN) ) + if( auth != nullptr && chrif_auth_delete(account_id, auth->char_id, ST_LOGIN) ) return 0; return -1; @@ -1292,7 +1292,7 @@ int chrif_save_scdata(map_session_data *sd) { //parses the sc_data of the player continue; if (sce->timer != INVALID_TIMER) { timer = get_timer(sce->timer); - if (timer == NULL || timer->func != status_change_timer) + if (timer == nullptr || timer->func != status_change_timer) continue; if (DIFF_TICK(timer->tick,tick) > 0) data.tick = DIFF_TICK(timer->tick,tick); //Duration that is left before ending. @@ -1338,7 +1338,7 @@ int chrif_skillcooldown_save(map_session_data *sd) { continue; timer = get_timer(sd->scd[i]->timer); - if (timer == NULL || timer->func != skill_blockpc_end || DIFF_TICK(timer->tick, tick) < 0) + if (timer == nullptr || timer->func != skill_blockpc_end || DIFF_TICK(timer->tick, tick) < 0) continue; data.tick = DIFF_TICK(timer->tick, tick); @@ -1383,7 +1383,7 @@ int chrif_load_scdata(int fd) { for (i = 0; i < count; i++) { struct status_change_data *data = (struct status_change_data*)RFIFOP(fd,14 + i*sizeof(struct status_change_data)); - status_change_start(NULL,&sd->bl, (sc_type)data->type, 10000, data->val1, data->val2, data->val3, data->val4, data->tick, SCSTART_NOAVOID|SCSTART_NOTICKDEF|SCSTART_LOADED|SCSTART_NORATEDEF); + status_change_start(nullptr,&sd->bl, (sc_type)data->type, 10000, data->val1, data->val2, data->val3, data->val4, data->tick, SCSTART_NOAVOID|SCSTART_NOTICKDEF|SCSTART_LOADED|SCSTART_NORATEDEF); } pc_scdata_received(sd); @@ -1549,7 +1549,7 @@ void chrif_parse_ack_vipActive(int fd) { TBL_PC *sd = map_id2sd(aid); bool changed = false; - if(sd == NULL) return; + if(sd == nullptr) return; sd->group_id = groupid; pc_group_pc_load(sd); @@ -1633,10 +1633,10 @@ int chrif_bsdata_save(map_session_data *sd, bool quit) { if (sd->bonus_script.count) { t_tick tick = gettick(); - struct linkdb_node *node = NULL; + struct linkdb_node *node = nullptr; for (node = sd->bonus_script.head; node && i < MAX_PC_BONUS_SCRIPT; node = node->next) { - const struct TimerData *timer = NULL; + const struct TimerData *timer = nullptr; struct bonus_script_data bs; struct s_bonus_script_entry *entry = (struct s_bonus_script_entry *)node->data; @@ -1690,7 +1690,7 @@ int chrif_bsdata_received(int fd) { for (i = 0; i < count; i++) { struct bonus_script_data *bs = (struct bonus_script_data*)RFIFOP(fd,9 + i*sizeof(struct bonus_script_data)); - struct s_bonus_script_entry *entry = NULL; + struct s_bonus_script_entry *entry = nullptr; if (bs->script_str[0] == '\0' || !bs->tick) continue; @@ -1847,7 +1847,7 @@ int send_users_tochar(void) { *------------------------------------------*/ static TIMER_FUNC(check_connect_char_server){ static int displayed = 0; - if ( char_fd <= 0 || session[char_fd] == NULL ) { + if ( char_fd <= 0 || session[char_fd] == nullptr ) { if ( !displayed ) { ShowStatus("Attempting to connect to Char Server. Please wait.\n"); displayed = 1; diff --git a/src/map/clan.cpp b/src/map/clan.cpp index 0836da95ea..cdbdf9d5e1 100644 --- a/src/map/clan.cpp +++ b/src/map/clan.cpp @@ -40,7 +40,7 @@ void clan_load_clandata( int count, struct clan* clans ){ clanCopy = (struct clan*)aMalloc( sizeof( struct clan ) ); - if( clanCopy == NULL ){ + if( clanCopy == nullptr ){ ShowError("Memory could not be allocated for a clan.\n"); break; } @@ -76,10 +76,10 @@ struct clan* clan_searchname( const char* name ){ map_session_data* clan_getavailablesd( struct clan* clan ){ int i; - nullpo_retr(NULL, clan); + nullpo_retr(nullptr, clan); - ARR_FIND( 0, clan->max_member, i, clan->members[i] != NULL ); - return ( i < clan->max_member ) ? clan->members[i] : NULL; + ARR_FIND( 0, clan->max_member, i, clan->members[i] != nullptr ); + return ( i < clan->max_member ) ? clan->members[i] : nullptr; } int clan_getMemberIndex( struct clan* clan, uint32 account_id ){ @@ -87,7 +87,7 @@ int clan_getMemberIndex( struct clan* clan, uint32 account_id ){ nullpo_retr(-1,clan); - ARR_FIND( 0, clan->max_member, i, clan->members[i] != NULL && clan->members[i]->status.account_id == account_id ); + ARR_FIND( 0, clan->max_member, i, clan->members[i] != nullptr && clan->members[i]->status.account_id == account_id ); if( i == clan->max_member ){ return -1; @@ -101,7 +101,7 @@ int clan_getNextFreeMemberIndex( struct clan* clan ){ nullpo_retr(-1,clan); - ARR_FIND( 0, clan->max_member, i, clan->members[i] == NULL ); + ARR_FIND( 0, clan->max_member, i, clan->members[i] == nullptr ); if( i == clan->max_member ){ return -1; @@ -144,7 +144,7 @@ void clan_member_left( map_session_data* sd ){ nullpo_retv(clan = sd->clan); if( ( index = clan_getMemberIndex(clan,sd->status.account_id) ) >= 0 ){ - clan->members[index] = NULL; + clan->members[index] = nullptr; clan->connect_member--; intif_clan_member_left(clan->id); @@ -157,7 +157,7 @@ bool clan_member_join( map_session_data *sd, int clan_id, uint32 account_id, uin nullpo_ret(sd); - if( ( clan = clan_search( clan_id ) ) == NULL ){ + if( ( clan = clan_search( clan_id ) ) == nullptr ){ return false; } @@ -177,13 +177,13 @@ bool clan_member_leave( map_session_data* sd, int clan_id, uint32 account_id, ui nullpo_ret(sd); - if( sd->status.account_id != account_id || sd->status.char_id != char_id || sd->status.clan_id != clan_id || ( clan = sd->clan ) == NULL ){ + if( sd->status.account_id != account_id || sd->status.char_id != char_id || sd->status.clan_id != clan_id || ( clan = sd->clan ) == nullptr ){ return false; } clan_member_left(sd); - sd->clan = NULL; + sd->clan = nullptr; sd->status.clan_id = 0; clif_clan_leave(sd); @@ -205,7 +205,7 @@ void clan_send_message( map_session_data *sd, const char *mes, int len ){ intif_clan_message(sd->status.clan_id,sd->status.account_id,mes,len); clan_recv_message(sd->status.clan_id,sd->status.account_id,mes,len); - log_chat( LOG_CHAT_CLAN, sd->status.clan_id, sd->status.char_id, sd->status.account_id, mapindex_id2name( sd->mapindex ), sd->bl.x, sd->bl.y, NULL, mes ); + log_chat( LOG_CHAT_CLAN, sd->status.clan_id, sd->status.char_id, sd->status.account_id, mapindex_id2name( sd->mapindex ), sd->bl.x, sd->bl.y, nullptr, mes ); } int clan_get_alliance_count( struct clan *clan, int flag ){ diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 14ca3ee613..d30fb3a2bb 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -486,7 +486,7 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target { int i; map_session_data *sd, *tsd; - struct party_data *p = NULL; + struct party_data *p = nullptr; std::shared_ptr bg; int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd; struct s_mapiterator* iter; @@ -524,7 +524,7 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target case AREA: case AREA_WOSC: - if (sd && bl->prev == NULL) //Otherwise source misses the packet.[Skotlex] + if (sd && bl->prev == nullptr) //Otherwise source misses the packet.[Skotlex] clif_send (buf, len, bl, SELF); [[fallthrough]]; case AREA_WOC: @@ -546,7 +546,7 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target } else if (bl->type == BL_CHAT) { cd = (struct chat_data*)bl; } else break; - if (cd == NULL) + if (cd == nullptr) break; for(i = 0; i < cd->users; i++) { if (type == CHAT_WOS && cd->usersd[i] == sd) @@ -576,7 +576,7 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target if (p) { for(i=0;idata[i].sd) == NULL ) + if( (sd = p->data[i].sd) == nullptr ) continue; if( !session_isActive( fd = sd->fd ) ) @@ -858,7 +858,7 @@ void clif_charselectok(int id, uint8 ok) map_session_data* sd; int fd; - if ((sd = map_id2sd(id)) == NULL || !session_isValid(sd->fd)) + if ((sd = map_id2sd(id)) == nullptr || !session_isValid(sd->fd)) return; fd = sd->fd; @@ -1535,7 +1535,7 @@ void clif_class_change_target(struct block_list *bl,int class_,int type, enum se WBUFL(buf,2)=bl->id; WBUFB(buf,6)=type; WBUFL(buf,7)=class_; - clif_send(buf,packet_len(0x1b0),(sd == NULL ? bl : &(sd->bl)),target); + clif_send(buf,packet_len(0x1b0),(sd == nullptr ? bl : &(sd->bl)),target); } } @@ -1654,7 +1654,7 @@ static void clif_weather_check(map_session_data *sd) void clif_weather(int16 m) { struct s_mapiterator* iter; - map_session_data *sd=NULL; + map_session_data *sd=nullptr; iter = mapit_getallusers(); for( sd = (map_session_data*)mapit_first(iter); mapit_exists(iter); sd = (map_session_data*)mapit_next(iter) ) @@ -1982,7 +1982,7 @@ void clif_walkok(map_session_data *sd) static void clif_move2( struct block_list *bl, struct view_data *vd, struct unit_data *ud ){ - status_change *sc = NULL; + status_change *sc = nullptr; if ((sc = status_get_sc(bl)) && sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE|OPTION_CHASEWALK)) clif_ally_only = true; @@ -2033,7 +2033,7 @@ void clif_move(struct unit_data *ud) unsigned char buf[16]; struct view_data* vd; struct block_list* bl = ud->bl; - status_change *sc = NULL; + status_change *sc = nullptr; vd = status_get_viewdata(bl); if (!vd ) @@ -2083,10 +2083,10 @@ void clif_move(struct unit_data *ud) * Delays the map_quit of a player after they are disconnected. [Skotlex] *------------------------------------------*/ static TIMER_FUNC(clif_delayquit){ - map_session_data *sd = NULL; + map_session_data *sd = nullptr; //Remove player from map server - if ((sd = map_id2sd(id)) != NULL && sd->fd == 0) //Should be a disconnected player. + if ((sd = map_id2sd(id)) != nullptr && sd->fd == 0) //Should be a disconnected player. map_quit(sd); return 0; } @@ -2102,7 +2102,7 @@ void clif_quitsave(int fd,map_session_data *sd) { else if (session_isValid(sd->fd)) { //Disassociate session from player (session is deleted after this function was called) //And set a timer to make him quit later. - session[sd->fd]->session_data = NULL; + session[sd->fd]->session_data = nullptr; sd->fd = 0; add_timer(gettick() + 10000, clif_delayquit, sd->bl.id, 0); } @@ -2251,7 +2251,7 @@ void clif_selllist(map_session_data *sd) struct npc_data *nd; nullpo_retv(sd); - if (!sd->npc_shopid || (nd = map_id2nd(sd->npc_shopid)) == NULL) + if (!sd->npc_shopid || (nd = map_id2nd(sd->npc_shopid)) == nullptr) return; fd=sd->fd; @@ -2561,7 +2561,7 @@ void clif_scriptmenu(map_session_data* sd, int npcid, const char* mes) int fd = sd->fd; int16 slen; slen = static_cast( strlen(mes) + 9 ); - struct block_list *bl = NULL; + struct block_list *bl = nullptr; if (!sd->state.using_fake_npc && (npcid == fake_nd->bl.id || ((bl = map_id2bl(npcid)) && (bl->m!=sd->bl.m || bl->xbl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 || @@ -2591,7 +2591,7 @@ void clif_scriptmenu(map_session_data* sd, int npcid, const char* mes) void clif_scriptinput(map_session_data *sd, int npcid) { int fd; - struct block_list *bl = NULL; + struct block_list *bl = nullptr; nullpo_retv(sd); @@ -2622,7 +2622,7 @@ void clif_scriptinput(map_session_data *sd, int npcid) void clif_scriptinputstr(map_session_data *sd, int npcid) { int fd; - struct block_list *bl = NULL; + struct block_list *bl = nullptr; nullpo_retv(sd); @@ -3089,7 +3089,7 @@ void clif_inventorylist( map_session_data *sd ){ /* on 20120925 onwards this is a field on clif_item_equip/normal */ #if PACKETVER >= 20111122 && PACKETVER < 20120925 for( int i = 0; i < MAX_INVENTORY; i++ ){ - if( sd->inventory.u.items_inventory[i].nameid == 0 || sd->inventory_data[i] == NULL ) + if( sd->inventory.u.items_inventory[i].nameid == 0 || sd->inventory_data[i] == nullptr ) continue; if ( sd->inventory.u.items_inventory[i].favorite != 0 ) @@ -3845,7 +3845,7 @@ void clif_updatestatus(map_session_data *sd,int type) struct party_data* p; int i; - if( ( p = party_search( sd->status.party_id ) ) != NULL ){ + if( ( p = party_search( sd->status.party_id ) ) != nullptr ){ ARR_FIND(0, MAX_PARTY, i, p->party.member[i].char_id == sd->status.char_id); if( i < MAX_PARTY ){ @@ -4506,7 +4506,7 @@ void clif_dispchat(struct chat_data* cd, int fd) unsigned char buf[128]; uint8 type; - if( cd == NULL || cd->owner == NULL ) + if( cd == nullptr || cd->owner == nullptr ) return; type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 @@ -4544,7 +4544,7 @@ void clif_changechatstatus(struct chat_data* cd) unsigned char buf[128]; uint8 type; - if( cd == NULL || cd->usersd[0] == NULL ) + if( cd == nullptr || cd->usersd[0] == nullptr ) return; type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0 @@ -5016,7 +5016,7 @@ static void clif_getareachar_pc(map_session_data* sd,map_session_data* dstsd) int i; if( dstsd->chatID ) { - struct chat_data *cd = NULL; + struct chat_data *cd = nullptr; if( (cd = (struct chat_data*)map_id2bl(dstsd->chatID)) && cd->usersd[0]==dstsd) clif_dispchat(cd,sd->fd); } else if( dstsd->state.vending ) @@ -5051,7 +5051,7 @@ static void clif_getareachar_pc(map_session_data* sd,map_session_data* dstsd) if( i < MAX_DEVOTION ) clif_devotion(&dstsd->bl, sd); // display link (dstsd - crusader) to sd - if( dstsd->sc.getSCE(SC_DEVOTION) && (d_bl = map_id2bl(dstsd->sc.getSCE(SC_DEVOTION)->val1)) != NULL ) + if( dstsd->sc.getSCE(SC_DEVOTION) && (d_bl = map_id2bl(dstsd->sc.getSCE(SC_DEVOTION)->val1)) != nullptr ) clif_devotion(d_bl, sd); } @@ -6551,7 +6551,7 @@ void clif_status_change_sub(struct block_list *bl, int id, int type, int flag, t * @param val3 */ void clif_status_change(struct block_list *bl, int type, int flag, t_tick tick, int val1, int val2, int val3) { - map_session_data *sd = NULL; + map_session_data *sd = nullptr; if (type == EFST_BLANK) //It shows nothing on the client... return; @@ -6617,7 +6617,7 @@ void clif_efst_status_change_sub(struct block_list *tbl, struct block_list *bl, for (i = 0; i < sc_display_count; i++) { enum sc_type type = sc_display[i]->type; status_change *sc = status_get_sc(bl); - const struct TimerData *td = (sc && sc->getSCE(type) ? get_timer(sc->getSCE(type)->timer) : NULL); + const struct TimerData *td = (sc && sc->getSCE(type) ? get_timer(sc->getSCE(type)->timer) : nullptr); t_tick tick = 0; if (td) @@ -6699,7 +6699,7 @@ void clif_displaymessage(const int fd, const char* mes) message = aStrdup(mes); line = strtok(message, "\n"); - while(line != NULL) { + while(line != nullptr) { #if PACKETVER == 20141022 /** for some reason game client crashes depending on message pattern (only for this packet) **/ /** so we redirect to ZC_NPC_CHAT **/ @@ -6725,12 +6725,12 @@ void clif_displaymessage(const int fd, const char* mes) if (len > 0) { // don't send a void message (it's not displaying on the client chat). @help can send void line. WFIFOHEAD(fd, 5 + len); WFIFOW(fd,0) = 0x8e; - WFIFOW(fd,2) = 5 + len; // 4 + len + NULL teminate + WFIFOW(fd,2) = 5 + len; // 4 + len + nullptr teminate safestrncpy(WFIFOCP(fd,4), line, len + 1); WFIFOSET(fd, 5 + len); } #endif - line = strtok(NULL, "\n"); + line = strtok(nullptr, "\n"); } aFree(message); } @@ -7071,7 +7071,7 @@ void clif_wis_message(map_session_data* sd, const char* nick, const char* mes, s /// 3 = everyone ignored by target void clif_wis_end(int fd, int result) { - map_session_data *sd = (session_isActive(fd) ? (map_session_data *)session[fd]->session_data : NULL); + map_session_data *sd = (session_isActive(fd) ? (map_session_data *)session[fd]->session_data : nullptr); #if PACKETVER < 20131223 const int cmd = 0x98; #else @@ -7134,7 +7134,7 @@ void clif_use_card(map_session_data *sd,int idx) for(i=c=0;iinventory_data[i] == NULL) + if(sd->inventory_data[i] == nullptr) continue; if(sd->inventory_data[i]->type!=IT_WEAPON && sd->inventory_data[i]->type!=IT_ARMOR) continue; @@ -7882,7 +7882,7 @@ void clif_vendingreport(map_session_data* sd, int index, int amount, uint32 char WFIFOW(fd,4) = amount; #if PACKETVER >= 20141016 WFIFOL(fd,6) = char_id; // GID - WFIFOL(fd,10) = (int)time(NULL); // Date + WFIFOL(fd,10) = (int)time(nullptr); // Date WFIFOL(fd,14) = zeny; // zeny #endif WFIFOSET(fd,packet_len(cmd)); @@ -8366,7 +8366,7 @@ void clif_sendegg(map_session_data *sd) WFIFOHEAD(fd, MAX_INVENTORY * 2 + 4); WFIFOW(fd,0)=0x1a6; for(i=0,n=0;iinventory.u.items_inventory[i].nameid == 0 || sd->inventory_data[i] == NULL || + if(sd->inventory.u.items_inventory[i].nameid == 0 || sd->inventory_data[i] == nullptr || sd->inventory_data[i]->type != IT_PETEGG || sd->inventory.u.items_inventory[i].amount <= 0) continue; @@ -8592,7 +8592,7 @@ void clif_devotion(struct block_list *src, map_session_data *tsd) { int i; map_session_data *sd = BL_CAST(BL_PC,src); - if( sd == NULL ) + if( sd == nullptr ) return; for( i = 0; i < 5 /*MAX_DEVOTION*/; i++ ) // Client only able show to 5 links @@ -8799,14 +8799,14 @@ void clif_guild_memberlogin_notice(const struct mmo_guild &g,int idx,int flag) WBUFL(buf, 6)=g.member[idx].char_id; WBUFL(buf,10)=flag; - if( ( sd = g.member[idx].sd ) != NULL ) + if( ( sd = g.member[idx].sd ) != nullptr ) { WBUFW(buf,14) = sd->status.sex; WBUFW(buf,16) = sd->status.hair; WBUFW(buf,18) = sd->status.hair_color; clif_send(buf,packet_len(0x1f2),&sd->bl,GUILD_WOS); } - else if( ( sd = guild_getavailablesd(g) ) != NULL ) + else if( ( sd = guild_getavailablesd(g) ) != nullptr ) { WBUFW(buf,14) = 0; WBUFW(buf,16) = 0; @@ -9080,7 +9080,7 @@ void clif_guild_positionchanged(const struct mmo_guild &g,int idx) WBUFL(buf,16)=g.position[idx].exp_mode; safestrncpy(WBUFCP(buf,20),g.position[idx].name,NAME_LENGTH); // }* - if( (sd=guild_getavailablesd(g))!=NULL ) + if( (sd=guild_getavailablesd(g))!=nullptr ) clif_send(buf,WBUFW(buf,2),&sd->bl,GUILD); } @@ -9102,7 +9102,7 @@ void clif_guild_memberpositionchanged(const struct mmo_guild &g, int idx) WBUFL(buf, 8)=g.member[idx].char_id; WBUFL(buf,12)=g.member[idx].position; // }* - if( (sd=guild_getavailablesd(g))!=NULL ) + if( (sd=guild_getavailablesd(g))!=nullptr ) clif_send(buf,WBUFW(buf,2),&sd->bl,GUILD); } @@ -9342,7 +9342,7 @@ void clif_guild_message(const struct mmo_guild &g,uint32 account_id,const char * WBUFW(buf, 2) = len + 5; safestrncpy(WBUFCP(buf,4), mes, len+1); - if ((sd = guild_getavailablesd(g)) != NULL) + if ((sd = guild_getavailablesd(g)) != nullptr) clif_send(buf, WBUFW(buf,2), &sd->bl, GUILD_NOBG); } @@ -9627,7 +9627,7 @@ void clif_GM_kick(map_session_data *sd, map_session_data *tsd) { nullpo_retv(tsd); - if (sd == NULL) + if (sd == nullptr) tsd->state.keepshop = true; if (session_isActive(tsd->fd)) @@ -9877,7 +9877,7 @@ void clif_messagecolor_target(struct block_list *bl, unsigned long color, const WBUFL(buf,8) = color; memcpy(WBUFCP(buf,12), msg, msg_len); - clif_send(buf, WBUFW(buf,2), (sd == NULL ? bl : &(sd->bl)), type); + clif_send(buf, WBUFW(buf,2), (sd == nullptr ? bl : &(sd->bl)), type); } /** @@ -10436,7 +10436,7 @@ void clif_viewequip_ack( map_session_data* sd, map_session_data* tsd ){ int k = tsd->equip_index[i]; if( k >= 0 ){ - if( tsd->inventory.u.items_inventory[k].nameid == 0 || tsd->inventory_data[k] == NULL ){ // Item doesn't exist + if( tsd->inventory.u.items_inventory[k].nameid == 0 || tsd->inventory_data[k] == nullptr ){ // Item doesn't exist continue; } @@ -10833,7 +10833,7 @@ void clif_parse_LoadEndAck(int fd,map_session_data *sd) { bool guild_notice = false; - if(sd->bl.prev != NULL) + if(sd->bl.prev != nullptr) return; // Autotraders should ignore this entirely, clif_parse_LoadEndAck is always invoked manually for them @@ -11230,7 +11230,7 @@ void clif_parse_LoadEndAck(int fd,map_session_data *sd) #if PACKETVER >= 20150513 if( sd->mail.inbox.unread ){ - clif_Mail_new(sd, 0, NULL, NULL); + clif_Mail_new(sd, 0, nullptr, nullptr); } #endif @@ -11451,7 +11451,7 @@ void clif_parse_WalkToXY(int fd, map_session_data *sd) if(sd->sc.getSCE(SC_RUN) || sd->sc.getSCE(SC_WUGDASH)) return; - RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[0], &x, &y, NULL); + RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[0], &x, &y, nullptr); //A move command one cell west is only valid if the target cell is free if(battle_config.official_cell_stack_limit > 0 @@ -11532,7 +11532,7 @@ void clif_parse_GetCharNameRequest(int fd, map_session_data *sd) id = sd->bl.id; bl = map_id2bl(id); - if( bl == NULL ) + if( bl == nullptr ) return; // Lagged clients could request names of already gone mobs/players. [Skotlex] if( sd->bl.m != bl->m || !check_distance_bl(&sd->bl, bl, AREA_SIZE) ) @@ -11593,7 +11593,7 @@ void clif_parse_GlobalMessage(int fd, map_session_data* sd) #endif // Chat logging type 'O' / Global Chat - log_chat(LOG_CHAT_GLOBAL, 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, message); + log_chat(LOG_CHAT_GLOBAL, 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, nullptr, message); //achievement_update_objective(sd, AG_CHAT, 1, sd->bl.m); //! TODO: What's the official use of this achievement type? } @@ -11684,12 +11684,12 @@ void clif_parse_Emotion(int fd, map_session_data *sd){ return; } // fix flood of emotion icon (ro-proxy): flood only the hacker player - if (sd->emotionlasttime + 1 >= time(NULL)) { // not more than 1 per second - sd->emotionlasttime = time(NULL); + if (sd->emotionlasttime + 1 >= time(nullptr)) { // not more than 1 per second + sd->emotionlasttime = time(nullptr); clif_skill_fail( *sd, 1, USESKILL_FAIL_LEVEL, 1 ); return; } - sd->emotionlasttime = time(NULL); + sd->emotionlasttime = time(nullptr); if (battle_config.idletime_option&IDLE_EMOTION) sd->idletime = last_tick; @@ -11927,7 +11927,7 @@ void clif_parse_WisMessage(int fd, map_session_data* sd) str += 3; for( i = 0; i < NUM_WHISPER_VAR; ++i ) {// Splits the message using '#' as separators split = strchr(str,'#'); - if( split == NULL ) { // use the remaining string + if( split == nullptr ) { // use the remaining string safestrncpy(split_data[i], str, ARRAYLENGTH(split_data[i])); for( ++i; i < NUM_WHISPER_VAR; ++i ) split_data[i][0] = '\0'; @@ -11950,7 +11950,7 @@ void clif_parse_WisMessage(int fd, map_session_data* sd) return; } } else if( target[0] == '#' ) { - struct Channel *channel = NULL; + struct Channel *channel = nullptr; char* chname = target; channel = channel_name2channel(chname,sd,3); @@ -11972,7 +11972,7 @@ void clif_parse_WisMessage(int fd, map_session_data* sd) // searching destination character dstsd = map_nick2sd(target,false); - if (dstsd == NULL || strcmp(dstsd->status.name, target) != 0) { + if (dstsd == nullptr || strcmp(dstsd->status.name, target) != 0) { // player is not on this map-server // At this point, don't send wisp/page if it's not exactly the same name, because (example) // if there are 'Test' player on an other map-server and 'test' player on this map-server, @@ -12051,7 +12051,7 @@ void clif_parse_TakeItem(int fd, map_session_data *sd) break; } - if (fitem == NULL || fitem->bl.type != BL_ITEM || fitem->bl.m != sd->bl.m) + if (fitem == nullptr || fitem->bl.type != BL_ITEM || fitem->bl.m != sd->bl.m) break; if (pc_cant_act(sd)) @@ -13348,7 +13348,7 @@ void clif_parse_NpcSelectMenu(int fd,map_session_data *sd){ if( (select > sd->npc_menu && select != 0xff) || select == 0 ) { TBL_NPC* nd = map_id2nd(npc_id); ShowWarning("Invalid menu selection on npc %d:'%s' - got %d, valid range is [%d..%d] (player AID:%d, CID:%d, name:'%s')!\n", npc_id, (nd)?nd->name:"invalid npc id", select, 1, sd->npc_menu, sd->bl.id, sd->status.char_id, sd->status.name); - clif_GM_kick(NULL,sd); + clif_GM_kick(nullptr,sd); return; } @@ -13446,7 +13446,7 @@ void clif_parse_ItemIdentify(int fd,map_session_data *sd) { // - Invalid item ID or item doesn't exist // - Item is already identified if (idx < 0 || idx >= MAX_INVENTORY || - sd->inventory.u.items_inventory[idx].nameid == 0 || sd->inventory_data[idx] == NULL || + sd->inventory.u.items_inventory[idx].nameid == 0 || sd->inventory_data[idx] == nullptr || sd->inventory.u.items_inventory[idx].identify) {// cancel pressed sd->state.workinprogress = WIP_DISABLE_NONE; clif_menuskill_clear(sd); @@ -13904,7 +13904,7 @@ void clif_parse_PartyChangeOption(int fd, map_session_data *sd) return; p = party_search(sd->status.party_id); - if( p == NULL ) + if( p == nullptr ) return; ARR_FIND( 0, MAX_PARTY, i, p->data[i].sd == sd ); if( i == MAX_PARTY ) @@ -13939,7 +13939,7 @@ void clif_parse_PartyMessage(int fd, map_session_data* sd){ /// Changes Party Leader (CZ_CHANGE_GROUP_MASTER). /// 07da .L void clif_parse_PartyChangeLeader(int fd, map_session_data* sd){ - party_changeleader(sd, map_id2sd(RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0])),NULL); + party_changeleader(sd, map_id2sd(RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0])),nullptr); } @@ -14072,7 +14072,7 @@ void clif_PartyBookingInsertNotify(map_session_data* sd, struct party_booking_ad int i; uint8 buf[38+MAX_PARTY_BOOKING_JOBS*2]; - if(pb_ad == NULL) return; + if(pb_ad == nullptr) return; WBUFW(buf,0) = 0x809; WBUFL(buf,2) = pb_ad->index; @@ -14094,7 +14094,7 @@ void clif_PartyBookingUpdateNotify(map_session_data* sd, struct party_booking_ad int i; uint8 buf[6+MAX_PARTY_BOOKING_JOBS*2]; - if(pb_ad == NULL) return; + if(pb_ad == nullptr) return; WBUFW(buf,0) = 0x80a; WBUFL(buf,2) = pb_ad->index; @@ -14207,7 +14207,7 @@ void clif_parse_OpenVending(int fd, map_session_data* sd){ if( message[0] == '\0' ) // invalid input return; - vending_openvending(*sd, message, data, len/8, NULL); + vending_openvending(*sd, message, data, len/8, nullptr); } @@ -14469,7 +14469,7 @@ void clif_parse_GuildChangeNotice(int fd, map_session_data* sd){ // Helper function for guild invite functions int clif_sub_guild_invite(int fd, map_session_data *sd, map_session_data *t_sd) { - if (t_sd == NULL) // not online or does not exist + if (t_sd == nullptr) // not online or does not exist return 1; if (map_getmapflag(sd->bl.m, MF_GUILDLOCK)) {//Guild locked. @@ -14850,7 +14850,7 @@ void clif_parse_GMRemove2(int fd, map_session_data* sd) map_session_data* pl_sd; account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); - if( (pl_sd = map_id2sd(account_id)) != NULL ) { + if( (pl_sd = map_id2sd(account_id)) != nullptr ) { char command[NAME_LENGTH+8]; safesnprintf(command,sizeof(command),"%cjumpto %s", atcommand_symbol, pl_sd->status.name); is_atcommand(fd, sd, command, 1); @@ -14887,7 +14887,7 @@ void clif_parse_GMRecall2(int fd, map_session_data* sd) map_session_data* pl_sd; account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); - if( (pl_sd = map_id2sd(account_id)) != NULL ) { + if( (pl_sd = map_id2sd(account_id)) != nullptr ) { char command[NAME_LENGTH+8]; safesnprintf(command,sizeof(command),"%crecall %s", atcommand_symbol, pl_sd->status.name); is_atcommand(fd, sd, command, 1); @@ -15010,7 +15010,7 @@ void clif_parse_GMReqNoChat(int fd,map_session_data *sd) return; dstsd = map_id2sd(id); - if( dstsd == NULL ) + if( dstsd == nullptr ) return; safesnprintf(command,sizeof(command),"%cmute %d %s", atcommand_symbol, value, dstsd->status.name); @@ -15375,7 +15375,7 @@ void clif_parse_FriendsListAdd(int fd, map_session_data *sd) f_sd = map_nick2sd(RFIFOCP(fd,packet_db[RFIFOW(fd,0)].pos[0]),false); // Friend doesn't exist (no player with this name) - if (f_sd == NULL) { + if (f_sd == nullptr) { clif_displaymessage(fd, msg_txt(sd,3)); return; } @@ -15439,7 +15439,7 @@ void clif_parse_FriendsListReply(int fd, map_session_data *sd) } f_sd = map_id2sd(account_id); //The account id is the same as the bl.id of players. - if (f_sd == NULL) + if (f_sd == nullptr) return; if (reply == 0 || !( sd->friend_req == f_sd->status.char_id && f_sd->friend_req == sd->status.char_id ) ) @@ -15490,7 +15490,7 @@ void clif_parse_FriendsListReply(int fd, map_session_data *sd) /// 0203 .L .L void clif_parse_FriendsListRemove(int fd, map_session_data *sd) { - map_session_data *f_sd = NULL; + map_session_data *f_sd = nullptr; uint32 account_id, char_id; int i, j; struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; @@ -15633,8 +15633,8 @@ void clif_parse_ChangeHomunculusName(int fd, map_session_data *sd){ /// 0234 .L void clif_parse_HomMoveToMaster(int fd, map_session_data *sd){ int id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); // Mercenary or Homunculus - struct block_list *bl = NULL; - struct unit_data *ud = NULL; + struct block_list *bl = nullptr; + struct unit_data *ud = nullptr; if( sd->md && sd->md->bl.id == id ) bl = &sd->md->bl; @@ -15654,10 +15654,10 @@ void clif_parse_HomMoveToMaster(int fd, map_session_data *sd){ void clif_parse_HomMoveTo(int fd, map_session_data *sd){ struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; int id = RFIFOL(fd,info->pos[0]); // Mercenary or Homunculus - struct block_list *bl = NULL; + struct block_list *bl = nullptr; short x, y; - RFIFOPOS(fd, info->pos[1], &x, &y, NULL); + RFIFOPOS(fd, info->pos[1], &x, &y, nullptr); if( sd->md && sd->md->bl.id == id ) bl = &sd->md->bl; // Moving Mercenary @@ -15676,7 +15676,7 @@ void clif_parse_HomMoveTo(int fd, map_session_data *sd){ /// always 0 void clif_parse_HomAttack(int fd,map_session_data *sd) { - struct block_list *bl = NULL; + struct block_list *bl = nullptr; struct s_packet_db* info = &packet_db[RFIFOW(fd,0)]; int id = RFIFOL(fd,info->pos[0]); int target_id = RFIFOL(fd,info->pos[1]); @@ -15774,7 +15774,7 @@ void clif_parse_Check(int fd, map_session_data *sd) safestrncpy(charname, RFIFOCP(fd,packet_db[RFIFOW(fd,0)].pos[0]), sizeof(charname)); - if( ( pl_sd = map_nick2sd(charname,false) ) == NULL || pc_get_group_level(sd) < pc_get_group_level(pl_sd) ) + if( ( pl_sd = map_nick2sd(charname,false) ) == nullptr || pc_get_group_level(sd) < pc_get_group_level(pl_sd) ) { return; } @@ -16039,7 +16039,7 @@ void clif_Mail_refreshinbox(map_session_data *sd,enum mail_inbox_type type,int64 struct mail_message *msg; int i, j, k, offset, titleLength; uint8 mailType, amount, remaining; - uint32 now = (uint32)time(NULL); + uint32 now = (uint32)time(nullptr); #if PACKETVER >= 20170419 int cmd = 0xac2; #elif PACKETVER >= 20160601 @@ -16615,7 +16615,7 @@ void clif_parse_Mail_delete(int fd, map_session_data *sd){ if( intif_Mail_delete(sd->status.char_id, mail_id) && msg->status == MAIL_UNREAD ){ sd->mail.inbox.unread--; - clif_Mail_new(sd,0,NULL,NULL); + clif_Mail_new(sd,0,nullptr,nullptr); } } } @@ -17546,7 +17546,7 @@ void clif_parse_Adopt_reply(int fd, map_session_data *sd){ int pid = sd->adopt_invite; sd->adopt_invite = 0; - if( p1_sd == NULL || p2_sd == NULL ) + if( p1_sd == nullptr || p2_sd == nullptr ) return; // Both players need to be online if( pid != p1_sd->status.account_id ) @@ -18121,7 +18121,7 @@ void clif_mercenary_updatestatus(map_session_data *sd, int type) s_mercenary_data *md; struct status_data *status; int fd; - if( !clif_session_isValid(sd) || (md = sd->md) == NULL ) + if( !clif_session_isValid(sd) || (md = sd->md) == nullptr ) return; fd = sd->fd; @@ -18191,7 +18191,7 @@ void clif_mercenary_info(map_session_data *sd) struct status_data *status; int atk; - if( !clif_session_isValid(sd) || (md = sd->md) == NULL ) + if( !clif_session_isValid(sd) || (md = sd->md) == nullptr ) return; fd = sd->fd; @@ -18217,7 +18217,7 @@ void clif_mercenary_info(map_session_data *sd) WFIFOL(fd,52) = status->max_hp; WFIFOL(fd,56) = status->sp; WFIFOL(fd,60) = status->max_sp; - WFIFOL(fd,64) = client_tick(time(NULL) + (mercenary_get_lifetime(md) / 1000)); + WFIFOL(fd,64) = client_tick(time(nullptr) + (mercenary_get_lifetime(md) / 1000)); WFIFOW(fd,68) = mercenary_get_faith(md); WFIFOL(fd,70) = mercenary_get_calls(md); WFIFOL(fd,74) = md->mercenary.kill_count; @@ -18233,7 +18233,7 @@ void clif_mercenary_skillblock(map_session_data *sd) s_mercenary_data *md; int fd, len = 4; - if( sd == NULL || (md = sd->md) == NULL ) + if( sd == nullptr || (md = sd->md) == nullptr ) return; fd = sd->fd; @@ -18269,7 +18269,7 @@ void clif_mercenary_skillblock(map_session_data *sd) void clif_parse_mercenary_action(int fd, map_session_data* sd) { int option = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); - if( sd->md == NULL ) + if( sd->md == nullptr ) return; if( option == 2 ) mercenary_delete(sd->md, 2); @@ -18708,7 +18708,7 @@ void clif_font(map_session_data *sd) void clif_instance_create(int instance_id, int num) { #if PACKETVER >= 20071128 - map_session_data *sd = NULL; + map_session_data *sd = nullptr; enum send_target target = PARTY; unsigned char buf[65]; @@ -18736,7 +18736,7 @@ void clif_instance_create(int instance_id, int num) void clif_instance_changewait(int instance_id, int num) { #if PACKETVER >= 20071128 - map_session_data *sd = NULL; + map_session_data *sd = nullptr; enum send_target target = PARTY; unsigned char buf[4]; @@ -18758,7 +18758,7 @@ void clif_instance_changewait(int instance_id, int num) void clif_instance_status(int instance_id, unsigned int limit1, unsigned int limit2) { #if PACKETVER >= 20071128 - map_session_data *sd = NULL; + map_session_data *sd = nullptr; enum send_target target = PARTY; unsigned char buf[71]; @@ -18792,7 +18792,7 @@ void clif_instance_status(int instance_id, unsigned int limit1, unsigned int lim void clif_instance_changestatus(int instance_id, e_instance_notify type, unsigned int limit) { #if PACKETVER >= 20071128 - map_session_data *sd = NULL; + map_session_data *sd = nullptr; enum send_target target = PARTY; unsigned char buf[10]; @@ -19003,7 +19003,7 @@ void clif_elemental_updatestatus(map_session_data *sd, int type) { struct status_data *status; int fd; - if( !clif_session_isValid(sd) || (ed = sd->ed) == NULL ) + if( !clif_session_isValid(sd) || (ed = sd->ed) == nullptr ) return; fd = sd->fd; @@ -19033,7 +19033,7 @@ void clif_elemental_info(map_session_data *sd) { s_elemental_data *ed; struct status_data *status; - if( !clif_session_isValid(sd) || (ed = sd->ed) == NULL ) + if( !clif_session_isValid(sd) || (ed = sd->ed) == nullptr ) return; fd = sd->fd; @@ -19102,7 +19102,7 @@ static void clif_parse_ReqOpenBuyingStore( int fd, map_session_data* sd ){ return; } - buyingstore_create( sd, p->zenyLimit, p->result, storename, p->items, packet_len / sizeof( struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub ), NULL ); + buyingstore_create( sd, p->zenyLimit, p->result, storename, p->items, packet_len / sizeof( struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub ), nullptr ); } @@ -19305,7 +19305,7 @@ void clif_buyingstore_update_item( map_session_data* sd, t_itemid nameid, unsign #if PACKETVER >= 20141016 p.zeny = zeny; p.charId = char_id; // GID - p.updateTime = (int)time(NULL); + p.updateTime = (int)time(nullptr); #endif clif_send( &p, sizeof( p ), &sd->bl, SELF ); @@ -19922,7 +19922,7 @@ void clif_sub_ranklist(unsigned char *buf,int idx,map_session_data* sd, enum e_r case RANK_ALCHEMIST: list = chemist_fame_list; break; case RANK_TAEKWON: list = taekwon_fame_list; break; // PK currently unsupported - case RANK_KILLER: list = NULL; size = 0; break; + case RANK_KILLER: list = nullptr; size = 0; break; default: ShowError( "clif_sub_ranklist: Unsupported ranking type '%d'. Please report this.\n", rankingtype ); return; @@ -19933,7 +19933,7 @@ void clif_sub_ranklist(unsigned char *buf,int idx,map_session_data* sd, enum e_r if (list[i].id > 0) { const char* name; if (strcmp(list[i].name, "-") == 0 && - (name = map_charid2nick(list[i].id)) != NULL) + (name = map_charid2nick(list[i].id)) != nullptr) { safestrncpy(WBUFCP(buf,idx + NAME_LENGTH * i), name, NAME_LENGTH); } else { @@ -20359,7 +20359,7 @@ void clif_clan_message(struct clan *clan,const char *mes,int len){ //safestrncpy(WBUFCP(buf,4), sendername, NAME_LENGTH); safestrncpy(WBUFCP(buf,4+NAME_LENGTH), mes, len+1); - if((sd = clan_getavailablesd(clan)) != NULL) + if((sd = clan_getavailablesd(clan)) != nullptr) clif_send(buf, WBUFW(buf,2), &sd->bl, CLAN); #endif } @@ -20447,7 +20447,7 @@ void clif_clan_onlinecount( struct clan* clan ){ WBUFW(buf,2) = clan->connect_member; WBUFW(buf,4) = clan->max_member; - if((sd = clan_getavailablesd(clan)) != NULL) + if((sd = clan_getavailablesd(clan)) != nullptr) clif_send(buf, 6, &sd->bl, CLAN); #endif } @@ -20542,7 +20542,7 @@ void DumpUnknown(int fd,TBL_PC *sd,int cmd,int packet_len) strftime(datestr, sizeof(datestr)-1, "%A, %B %d %Y %X.", datetime); // Server time (normal time): %A, %B %d %Y %X. - if( ( fp = fopen( packet_txt , "a" ) ) != NULL ) { + if( ( fp = fopen( packet_txt , "a" ) ) != nullptr ) { if( sd ) { fprintf(fp, "Unknown packet 0x%04X (length %d), %s session #%d, %d/%d (AID/CID) at %s \n", cmd, packet_len, sd->state.active ? "authed" : "unauthed", fd, sd->status.account_id, sd->status.char_id,datestr); } else { @@ -21151,7 +21151,7 @@ void clif_broadcast_obtain_special_item( const char *char_name, t_itemid nameid, p.PacketLength = 8 + p.len + p.monsterNameLen; #endif - clif_send( &p, p.PacketLength, NULL, ALL_CLIENT ); + clif_send( &p, p.PacketLength, nullptr, ALL_CLIENT ); } break; } @@ -21185,7 +21185,7 @@ void clif_parse_Oneclick_Itemidentify(int fd, map_session_data *sd) { // - Invalid item ID or item doesn't exist // - Item is already identified if (idx < 0 || idx >= MAX_INVENTORY || - sd->inventory.u.items_inventory[idx].nameid == 0 || sd->inventory_data[idx] == NULL || + sd->inventory.u.items_inventory[idx].nameid == 0 || sd->inventory_data[idx] == nullptr || sd->inventory.u.items_inventory[idx].identify) return; @@ -21299,7 +21299,7 @@ void clif_sale_start( struct sale_item_data* sale_item, struct block_list* bl, e p.packetType = HEADER_ZC_NOTIFY_BARGAIN_SALE_SELLING; p.itemId = client_nameid( sale_item->nameid ); - p.remainingTime = (uint32)(sale_item->end - time(NULL)); // time in S + p.remainingTime = (uint32)(sale_item->end - time(nullptr)); // time in S clif_send( &p, sizeof( p ), bl, target ); #endif @@ -21346,7 +21346,7 @@ void clif_parse_sale_refresh( int fd, map_session_data* sd ){ sale = sale_find_item( p->itemId, true ); - if( sale == NULL ){ + if( sale == nullptr ){ return; } @@ -21435,7 +21435,7 @@ void clif_sale_search_reply( map_session_data* sd, std::shared_ptr p.packetType = HEADER_ZC_ACK_CASH_BARGAIN_SALE_ITEM_INFO; - if( item != NULL ){ + if( item != nullptr ){ p.result = 0; p.itemId = client_nameid( item->nameid ); p.price = item->price; @@ -22308,7 +22308,7 @@ void clif_refineui_info( map_session_data* sd, uint16 index ){ struct item_data* id = sd->inventory_data[index]; // No item data was found - if( id == NULL ){ + if( id == nullptr ){ return; } @@ -22316,7 +22316,7 @@ void clif_refineui_info( map_session_data* sd, uint16 index ){ struct item* item = &sd->inventory.u.items_inventory[index]; // No item was found at the given index - if( item == NULL ){ + if( item == nullptr ){ return; } @@ -22414,7 +22414,7 @@ void clif_parse_refineui_refine( int fd, map_session_data* sd ){ struct item_data* id = sd->inventory_data[index]; // No item data was found - if( id == NULL ){ + if( id == nullptr ){ return; } @@ -22422,7 +22422,7 @@ void clif_parse_refineui_refine( int fd, map_session_data* sd ){ struct item* item = &sd->inventory.u.items_inventory[index]; // No item was found at the given index - if( item == NULL ){ + if( item == nullptr ){ return; } @@ -25304,7 +25304,7 @@ static int clif_parse(int fd) if (sd) { if (sd->state.autotrade) { //Disassociate character from the socket connection. - session[fd]->session_data = NULL; + session[fd]->session_data = nullptr; sd->fd = 0; ShowInfo("Character '" CL_WHITE "%s" CL_RESET "' logged off (using @autotrade).\n", sd->status.name); } else @@ -25318,7 +25318,7 @@ static int clif_parse(int fd) map_quit(sd); } } else { - ShowInfo("Closed connection from '" CL_WHITE "%s" CL_RESET "'.\n", ip2str(session[fd]->client_addr, NULL)); + ShowInfo("Closed connection from '" CL_WHITE "%s" CL_RESET "'.\n", ip2str(session[fd]->client_addr, nullptr)); } do_close(fd); return 0; @@ -25406,11 +25406,11 @@ static int clif_parse(int fd) if( packet_db[cmd].func == clif_parse_debug ) packet_db[cmd].func(fd, sd); - else if( packet_db[cmd].func != NULL ) { + else if( packet_db[cmd].func != nullptr ) { if( !sd && packet_db[cmd].func != clif_parse_WantToConnection ) ; //Only valid packet when there is no session else - if( sd && sd->bl.prev == NULL && packet_db[cmd].func != clif_parse_LoadEndAck ) + if( sd && sd->bl.prev == nullptr && packet_db[cmd].func != clif_parse_LoadEndAck ) ; //Only valid packet when player is not on a map else packet_db[cmd].func(fd, sd); diff --git a/src/map/clif.hpp b/src/map/clif.hpp index db76b8f287..af593f4dd0 100644 --- a/src/map/clif.hpp +++ b/src/map/clif.hpp @@ -679,7 +679,7 @@ void clif_equipitemack( map_session_data& sd, uint8 flag, int index, int pos = 0 void clif_unequipitemack(map_session_data *sd,int n,int pos,int ok); // self void clif_misceffect(struct block_list* bl,int type); // area void clif_changeoption_target(struct block_list* bl, struct block_list* target); -#define clif_changeoption(bl) clif_changeoption_target(bl, NULL) // area +#define clif_changeoption(bl) clif_changeoption_target(bl, nullptr) // area void clif_changeoption2(struct block_list* bl); // area void clif_useitemack(map_session_data *sd,int index,int amount,bool ok); // self void clif_GlobalMessage(struct block_list* bl, const char* message,enum send_target target); @@ -727,7 +727,7 @@ int clif_insight(struct block_list *bl,va_list ap); // map_forallinmovearea call int clif_outsight(struct block_list *bl,va_list ap); // map_forallinmovearea callback void clif_class_change_target(struct block_list *bl,int class_, int type, enum send_target target, map_session_data *sd); -#define clif_class_change(bl, class_, type) clif_class_change_target(bl, class_, type, AREA, NULL) +#define clif_class_change(bl, class_, type) clif_class_change_target(bl, class_, type, AREA, nullptr) #define clif_mob_class_change(md, class_) clif_class_change(&md->bl, class_, 1) void clif_skillinfoblock(map_session_data *sd); @@ -918,8 +918,8 @@ void clif_sendegg(map_session_data *sd); void clif_send_petstatus(map_session_data *sd); void clif_send_petdata(map_session_data* sd, struct pet_data* pd, int type, int param); #define clif_pet_equip(sd, pd) clif_send_petdata(sd, pd, 3, (pd)->vd.head_bottom) -#define clif_pet_equip_area(pd) clif_send_petdata(NULL, pd, 3, (pd)->vd.head_bottom) -#define clif_pet_performance(pd, param) clif_send_petdata(NULL, pd, 4, param) +#define clif_pet_equip_area(pd) clif_send_petdata(nullptr, pd, 3, (pd)->vd.head_bottom) +#define clif_pet_performance(pd, param) clif_send_petdata(nullptr, pd, 4, param) void clif_pet_emotion(struct pet_data *pd,int param); void clif_pet_food(map_session_data *sd,int foodid,int fail); void clif_pet_autofeed_status(map_session_data* sd, bool force); @@ -934,7 +934,7 @@ void clif_specialeffect(struct block_list* bl, int type, enum send_target target void clif_specialeffect_single(struct block_list* bl, int type, int fd); void clif_specialeffect_remove(struct block_list* bl_src, int effect, enum send_target e_target, struct block_list* bl_target); void clif_messagecolor_target(struct block_list *bl, unsigned long color, const char *msg, bool rgb2bgr, enum send_target type, map_session_data *sd); -#define clif_messagecolor(bl, color, msg, rgb2bgr, type) clif_messagecolor_target(bl, color, msg, rgb2bgr, type, NULL) // Mob/Npc color talk [SnakeDrak] +#define clif_messagecolor(bl, color, msg, rgb2bgr, type) clif_messagecolor_target(bl, color, msg, rgb2bgr, type, nullptr) // Mob/Npc color talk [SnakeDrak] void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, send_target target); void clif_GM_kickack(map_session_data *sd, int id); @@ -1040,7 +1040,7 @@ void clif_party_show_picker(map_session_data * sd, struct item * item_data); void clif_progressbar(map_session_data * sd, unsigned long color, unsigned int second); void clif_progressbar_abort(map_session_data * sd); void clif_progressbar_npc(struct npc_data *nd, map_session_data* sd); -#define clif_progressbar_npc_area(nd) clif_progressbar_npc((nd),NULL) +#define clif_progressbar_npc_area(nd) clif_progressbar_npc((nd),nullptr) void clif_PartyBookingRegisterAck(map_session_data *sd, int flag); void clif_PartyBookingDeleteAck(map_session_data* sd, int flag); diff --git a/src/map/clif_packetdb.hpp b/src/map/clif_packetdb.hpp index f63f9d6a51..89df91c9eb 100644 --- a/src/map/clif_packetdb.hpp +++ b/src/map/clif_packetdb.hpp @@ -4,7 +4,7 @@ #ifndef CLIF_PACKETDB_HPP #define CLIF_PACKETDB_HPP - #define packet(cmd,length) packetdb_addpacket(cmd,length,NULL,0) + #define packet(cmd,length) packetdb_addpacket(cmd,length,nullptr,0) #define parseable_packet(cmd,length,func,...) packetdb_addpacket(cmd,length,func,__VA_ARGS__,0) packet(0x0064,55); @@ -1880,19 +1880,19 @@ packet(0x08ec,73); packet(0x08ed,43); packet(0x08ee,6); - parseable_packet(0x08ef,6,NULL,2); + parseable_packet(0x08ef,6,nullptr,2); packet(0x08f0,6); - parseable_packet(0x08f1,6,NULL,2); + parseable_packet(0x08f1,6,nullptr,2); packet(0x08f2,36); packet(0x08f3,-1); packet(0x08f4,6); - parseable_packet(0x08f5,-1,NULL,2,4); + parseable_packet(0x08f5,-1,nullptr,2,4); packet(0x08f6,22); packet(0x08f7,3); packet(0x08f8,7); packet(0x08f9,6); packet(0x08fa,6); - parseable_packet(0x08fb,6,NULL,2); + parseable_packet(0x08fb,6,nullptr,2); parseable_packet( HEADER_CZ_INVENTORY_TAB, sizeof( PACKET_CZ_INVENTORY_TAB ), clif_parse_MoveItem, 0 ); parseable_packet(0x08D7,28,clif_parse_bg_queue_apply_request,2,4); packet(0x08D8,27); diff --git a/src/map/clif_shuffle.hpp b/src/map/clif_shuffle.hpp index 3f2d151075..830ad63387 100644 --- a/src/map/clif_shuffle.hpp +++ b/src/map/clif_shuffle.hpp @@ -21,10 +21,10 @@ parseable_packet(0x0835,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083C,10,clif_parse_UseSkillToId,2,4,6); - //parseable_packet(0x0862,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0862,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0887,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x08A1,6,clif_parse_TakeItem,2); - //parseable_packet(0x08AA,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x08AA,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x08AC,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x092D,18,clif_parse_PartyBookingRegisterReq,2,4,6); parseable_packet(0x0931,5,clif_parse_HomMenu,2,4); @@ -52,7 +52,7 @@ parseable_packet(0x089C,6,clif_parse_DropItem,2,4); parseable_packet(0x08A2,7,clif_parse_ActionRequest,2,6); parseable_packet(0x08A9,19,clif_parse_WantToConnection,2,6,10,14,18); - //parseable_packet(0x08AC,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x08AC,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x08a3,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x08a6,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x08aa,2,clif_parse_SearchStoreInfoNextPage,0); @@ -65,7 +65,7 @@ parseable_packet(0x095E,6,clif_parse_TakeItem,2); parseable_packet(0x095b,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); parseable_packet(0x0964,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); - //parseable_packet(0x0965,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0965,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD // 2013-05-29Ragexe #elif PACKETVER == 20130529 parseable_packet(0x023B,5,clif_parse_HomMenu,2,4); @@ -77,8 +77,8 @@ parseable_packet(0x0874,18,clif_parse_PartyBookingRegisterReq,2); parseable_packet(0x0876,5,clif_parse_WalkToXY,2); parseable_packet(0x0877,26,clif_parse_FriendsListAdd,2); - //parseable_packet(0x0888,4,NULL,0); // CZ_GANGSI_RANK - //parseable_packet(0x088E,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0888,4,nullptr,0); // CZ_GANGSI_RANK + //parseable_packet(0x088E,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0890,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0892,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0895,6,clif_parse_TakeItem,2); @@ -107,13 +107,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4,6); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07E4,6,clif_parse_TakeItem,2); @@ -134,13 +134,13 @@ parseable_packet(0x035F,6,clif_parse_TickSend,2); parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4,6); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07E4,6,clif_parse_TakeItem,2); @@ -167,8 +167,8 @@ parseable_packet(0x085A,2,clif_parse_ReqCloseBuyingStore,0); parseable_packet(0x0862,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0864,36,clif_parse_StoragePassword,2,4,20); - //parseable_packet(0x0878,4,NULL,0); // CZ_GANGSI_RANK - //parseable_packet(0x087A,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0878,4,nullptr,0); // CZ_GANGSI_RANK + //parseable_packet(0x087A,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0885,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0887,26,clif_parse_PartyInvite2,2); parseable_packet(0x0889,7,clif_parse_ActionRequest,2,6); @@ -207,10 +207,10 @@ parseable_packet(0x0835,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083C,10,clif_parse_UseSkillToId,2,4,6); - //parseable_packet(0x0860,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0860,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x088B,6,clif_parse_TakeItem,2); parseable_packet(0x088C,19,clif_parse_WantToConnection,2,6,10,14,18); - //parseable_packet(0x088F,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x088F,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0894,18,clif_parse_PartyBookingRegisterReq,2,4,6); parseable_packet(0x0895,26,clif_parse_PartyInvite2,2); parseable_packet(0x08A5,-1,clif_parse_ItemListWindowSelected,2,4,8,12); @@ -229,13 +229,13 @@ parseable_packet(0x035F,6,clif_parse_TickSend,2); parseable_packet(0x0360,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4,6); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07E4,6,clif_parse_TakeItem,2); @@ -262,13 +262,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4,6); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07E4,6,clif_parse_TakeItem,2); @@ -291,14 +291,14 @@ parseable_packet(0x0862,18,clif_parse_PartyBookingRegisterReq,2,4,6); parseable_packet(0x0863,26,clif_parse_FriendsListAdd,2); parseable_packet(0x086B,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); - //parseable_packet(0x086C,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x086C,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0882,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x088A,5,clif_parse_HomMenu,2,4); parseable_packet(0x088C,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0897,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x0898,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x089B,8,clif_parse_MoveToKafra,2,4); - //parseable_packet(0x08A6,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x08A6,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x08A9,6,clif_parse_TakeItem,2); parseable_packet(0x08AA,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); parseable_packet(0x0917,6,clif_parse_DropItem,2,4); @@ -324,13 +324,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4,6); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07E4,6,clif_parse_TakeItem,2); @@ -355,13 +355,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4,6); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07E4,6,clif_parse_TakeItem,2); @@ -383,7 +383,7 @@ parseable_packet(0x035F,6,clif_parse_TickSend,2); parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,5,clif_parse_HomMenu,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); @@ -402,7 +402,7 @@ parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083C,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x086E,19,clif_parse_WantToConnection,2,6,10,14,18); - //parseable_packet(0x0922,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0922,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0936,36,clif_parse_StoragePassword,0); parseable_packet(0x094B,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0967,5,clif_parse_ChangeDir,2,4); @@ -429,10 +429,10 @@ parseable_packet(0x0896,26,clif_parse_PartyInvite2,2); parseable_packet(0x0899,5,clif_parse_HomMenu,2,4); parseable_packet(0x08aa,8,clif_parse_MoveFromKafra,2,4); - //parseable_packet(0x08ab,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x08ab,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x08ad,5,clif_parse_ChangeDir,2,4); parseable_packet(0x091a,26,clif_parse_FriendsListAdd,2); - //parseable_packet(0x092b,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x092b,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x093b,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x0940,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x094e,6,clif_parse_TakeItem,2); @@ -444,13 +444,13 @@ parseable_packet(0x035f,6,clif_parse_TickSend,2); parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -475,7 +475,7 @@ parseable_packet(0x035f,6,clif_parse_TickSend,2); parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); @@ -497,7 +497,7 @@ parseable_packet(0x0868,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0899,5,clif_parse_HomMenu,2,4); parseable_packet(0x0946,36,clif_parse_StoragePassword,0); - //parseable_packet(0x0955,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0955,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0957,5,clif_parse_ChangeDir,2,4); parseable_packet(0x096a,6,clif_parse_GetCharNameRequest,2); // 2015-01-28aRagexe @@ -506,7 +506,7 @@ parseable_packet(0x023b,5,clif_parse_ChangeDir,2,4); parseable_packet(0x035f,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0365,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); - //parseable_packet(0x0368,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0368,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0838,7,clif_parse_ActionRequest,2,6); parseable_packet(0x085a,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); parseable_packet(0x0864,10,clif_parse_UseSkillToPos,2,4,6,8); @@ -523,7 +523,7 @@ parseable_packet(0x0927,26,clif_parse_PartyInvite2,2); parseable_packet(0x0929,36,clif_parse_StoragePassword,0); parseable_packet(0x092d,2,clif_parse_SearchStoreInfoNextPage,0); - //parseable_packet(0x0938,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0938,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x093a,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0944,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x094d,2,clif_parse_ReqCloseBuyingStore,0); @@ -541,13 +541,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -581,9 +581,9 @@ parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083c,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0867,18,clif_parse_PartyBookingRegisterReq,2,4); - //parseable_packet(0x0885,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0885,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0896,-1,clif_parse_ItemListWindowSelected,2,4,8,12); - //parseable_packet(0x089b,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x089b,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x089c,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x08a4,36,clif_parse_StoragePassword,0); parseable_packet(0x0940,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); @@ -614,11 +614,11 @@ parseable_packet(0x08a6,26,clif_parse_FriendsListAdd,2); parseable_packet(0x091c,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0928,5,clif_parse_ChangeDir,2,4); - //parseable_packet(0x092a,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x092a,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x092e,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x093b,26,clif_parse_PartyInvite2,2); parseable_packet(0x0943,6,clif_parse_SolveCharName,2); - //parseable_packet(0x0946,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0946,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0957,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0958,6,clif_parse_TickSend,2); parseable_packet(0x095b,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); @@ -630,7 +630,7 @@ parseable_packet(0x0363,6,clif_parse_DropItem,2,4); parseable_packet(0x0365,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0438,2,clif_parse_SearchStoreInfoNextPage,0); - //parseable_packet(0x0802,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0802,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0819,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x085d,6,clif_parse_SolveCharName,2); parseable_packet(0x086f,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); @@ -639,7 +639,7 @@ parseable_packet(0x0883,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x0885,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x0891,6,clif_parse_GetCharNameRequest,2); - //parseable_packet(0x0893,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0893,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0897,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x0899,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x08a1,7,clif_parse_ActionRequest,2,6); @@ -664,7 +664,7 @@ parseable_packet(0x085e,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x086f,5,clif_parse_WalkToXY,2); parseable_packet(0x0875,-1,clif_parse_ItemListWindowSelected,2,4,8,12); - //parseable_packet(0x087e,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x087e,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x088c,6,clif_parse_DropItem,2,4); parseable_packet(0x088f,6,clif_parse_TickSend,2); parseable_packet(0x0895,8,clif_parse_MoveFromKafra,2,4); @@ -680,7 +680,7 @@ parseable_packet(0x093a,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x093b,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x093e,2,clif_parse_SearchStoreInfoNextPage,0); - //parseable_packet(0x0946,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0946,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0949,6,clif_parse_TakeItem,2); parseable_packet(0x094b,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0953,26,clif_parse_FriendsListAdd,2); @@ -696,13 +696,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -741,8 +741,8 @@ parseable_packet(0x0894,6,clif_parse_DropItem,2,4); parseable_packet(0x0899,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x089f,-1,clif_parse_ItemListWindowSelected,2,4,8,12); - //parseable_packet(0x08a6,8,NULL,0); // CZ_JOIN_BATTLE_FIELD - //parseable_packet(0x08a8,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x08a6,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x08a8,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x08ad,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0929,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x093d,26,clif_parse_FriendsListAdd,2); @@ -768,13 +768,13 @@ parseable_packet(0x083c,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x085a,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0864,26,clif_parse_PartyInvite2,2); - //parseable_packet(0x0887,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0887,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0889,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0924,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x092e,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x093b,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0941,8,clif_parse_MoveFromKafra,2,4); - //parseable_packet(0x0942,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0942,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0953,36,clif_parse_StoragePassword,0); parseable_packet(0x0955,6,clif_parse_DropItem,2,4); parseable_packet(0x0958,26,clif_parse_FriendsListAdd,2); @@ -782,7 +782,7 @@ // 2015-05-13aRagexe #elif PACKETVER == 20150513 parseable_packet(0x022D,2,clif_parse_ReqCloseBuyingStore,0); - //parseable_packet(0x02C4,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x02C4,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x035F,6,clif_parse_TickSend,2); parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0363,19,clif_parse_WantToConnection,2,6,10,14,18); @@ -805,7 +805,7 @@ parseable_packet(0x08A8,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0923,36,clif_parse_StoragePassword,2,4,20); parseable_packet(0x0924,5,clif_parse_ChangeDir,2,4); - //parseable_packet(0x0927,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0927,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x094A,26,clif_parse_PartyInvite2,2); parseable_packet(0x0958,6,clif_parse_TakeItem,2); parseable_packet(0x0960,-1,clif_parse_ItemListWindowSelected,2,4,8,12); @@ -820,13 +820,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -855,7 +855,7 @@ parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07ec,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); - //parseable_packet(0x0811,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0811,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0815,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); parseable_packet(0x0817,2,clif_parse_ReqCloseBuyingStore,0); parseable_packet(0x0819,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); @@ -868,7 +868,7 @@ parseable_packet(0x0870,26,clif_parse_PartyInvite2,2); parseable_packet(0x087a,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0886,5,clif_parse_HomMenu,2,4); - //parseable_packet(0x0894,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0894,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0940,6,clif_parse_DropItem,2,4); parseable_packet(0x094e,26,clif_parse_FriendsListAdd,2); parseable_packet(0x096a,6,clif_parse_GetCharNameRequest,2); @@ -882,7 +882,7 @@ parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x0811,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); @@ -892,7 +892,7 @@ parseable_packet(0x0835,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x085d,8,clif_parse_MoveFromKafra,2,4); - //parseable_packet(0x0862,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0862,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0865,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0871,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0888,5,clif_parse_HomMenu,2,4); @@ -910,7 +910,7 @@ parseable_packet(0x0436,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x07ec,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0819,6,clif_parse_ReqClickBuyingStore,2); - //parseable_packet(0x0861,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0861,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0865,5,clif_parse_WalkToXY,2); parseable_packet(0x086b,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x0870,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); @@ -932,7 +932,7 @@ parseable_packet(0x0951,6,clif_parse_TickSend,2); parseable_packet(0x0959,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x0964,19,clif_parse_WantToConnection,2,6,10,14,18); - //parseable_packet(0x0968,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0968,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0969,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); // 2015-09-16Ragexe #elif PACKETVER == 20150916 @@ -955,12 +955,12 @@ parseable_packet(0x092F,6,clif_parse_DropItem,2,4); parseable_packet(0x0934,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0936,5,clif_parse_ChangeDir,2,4); - //parseable_packet(0x0938,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0938,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x093E,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0941,36,clif_parse_StoragePassword,2,4,20); parseable_packet(0x0942,6,clif_parse_SolveCharName,2); parseable_packet(0x0948,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); - //parseable_packet(0x094F,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x094F,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x095A,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x0960,5,clif_parse_HomMenu,2,4); parseable_packet(0x0961,-1,clif_parse_ItemListWindowSelected,2,4,8,12); @@ -975,13 +975,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); - parseable_packet(0x0365,18,NULL,2,4,6); - parseable_packet(0x0366,90,NULL,2,4,6,8,10); + parseable_packet(0x0365,18,nullptr,2,4,6); + parseable_packet(0x0366,90,nullptr,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -1003,7 +1003,7 @@ parseable_packet(0x035f,6,clif_parse_TickSend,2); parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); @@ -1021,7 +1021,7 @@ parseable_packet(0x0835,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083c,10,clif_parse_UseSkillToId,2,4,6); - //parseable_packet(0x0862,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0862,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x093f,5,clif_parse_HomMenu,2,4); parseable_packet(0x095f,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0961,19,clif_parse_WantToConnection,2,6,10,14,18); @@ -1043,8 +1043,8 @@ parseable_packet(0x0883,6,clif_parse_TickSend,2); parseable_packet(0x0884,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x0889,6,clif_parse_ReqClickBuyingStore,2); - //parseable_packet(0x088e,8,NULL,0); // CZ_JOIN_BATTLE_FIELD - //parseable_packet(0x089a,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x088e,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x089a,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x089b,2,clif_parse_ReqCloseBuyingStore,0); parseable_packet(0x089f,5,clif_parse_WalkToXY,2); parseable_packet(0x08aa,6,clif_parse_TakeItem,2); @@ -1067,13 +1067,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07E4,6,clif_parse_TakeItem,2); @@ -1099,13 +1099,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -1130,13 +1130,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07E4,6,clif_parse_TakeItem,2); @@ -1175,10 +1175,10 @@ parseable_packet(0x0887,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x088B,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x088D,5,clif_parse_HomMenu,2,4); - //parseable_packet(0x08A3,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x08A3,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x08A5,26,clif_parse_PartyInvite2,2); parseable_packet(0x0928,5,clif_parse_ChangeDir,2,4); - //parseable_packet(0x0939,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0939,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x093A,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x0940,36,clif_parse_StoragePassword,2,4,20); parseable_packet(0x0964,6,clif_parse_TakeItem,2); @@ -1193,7 +1193,7 @@ parseable_packet(0x0369,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); - //parseable_packet(0x0802,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0802,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0811,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x0815,26,clif_parse_PartyInvite2,2); parseable_packet(0x0817,2,clif_parse_ReqCloseBuyingStore,0); @@ -1208,7 +1208,7 @@ parseable_packet(0x089C,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0942,18,clif_parse_PartyBookingRegisterReq,2,4,6); parseable_packet(0x094A,6,clif_parse_TakeItem,2); - //parseable_packet(0x0958,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0958,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0966,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0967,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x0969,36,clif_parse_StoragePassword,2,4,20); @@ -1237,11 +1237,11 @@ parseable_packet(0x0921,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0925,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x092e,5,clif_parse_ChangeDir,2,4); - //parseable_packet(0x092f,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x092f,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x093c,6,clif_parse_DropItem,2,4); parseable_packet(0x0943,6,clif_parse_TakeItem,2); parseable_packet(0x0946,-1,clif_parse_ItemListWindowSelected,2,4,8,12); - //parseable_packet(0x0957,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0957,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x095c,18,clif_parse_PartyBookingRegisterReq,2,4,6); parseable_packet(0x096a,6,clif_parse_GetCharNameRequest,2); // 2015-11-25dRagexeRE @@ -1258,7 +1258,7 @@ parseable_packet(0x0863,2,clif_parse_ReqCloseBuyingStore,0); parseable_packet(0x0883,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0884,36,clif_parse_StoragePassword,2,4,20); - //parseable_packet(0x0885,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0885,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x088C,6,clif_parse_TickSend,2); parseable_packet(0x088D,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x0899,26,clif_parse_FriendsListAdd,2); @@ -1273,7 +1273,7 @@ parseable_packet(0x093E,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x0951,5,clif_parse_HomMenu,2,4); parseable_packet(0x0956,26,clif_parse_PartyInvite2,2); - //parseable_packet(0x0957,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0957,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0959,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); // 2015-12-02bRagexeRE #elif PACKETVER == 20151202 @@ -1285,13 +1285,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4,6); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -1323,7 +1323,7 @@ parseable_packet(0x087A,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x087F,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x088E,10,clif_parse_UseSkillToId,2,4,6); - //parseable_packet(0x088F,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x088F,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0894,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x08A1,5,clif_parse_HomMenu,2,4); parseable_packet(0x0920,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); @@ -1334,7 +1334,7 @@ parseable_packet(0x0948,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x094A,18,clif_parse_PartyBookingRegisterReq,2,4,6); parseable_packet(0x0956,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); - //parseable_packet(0x095C,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x095C,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0961,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0964,26,clif_parse_FriendsListAdd,2); // 2015-12-16aRagexeRE @@ -1342,7 +1342,7 @@ parseable_packet(0x022D,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0361,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0362,5,clif_parse_HomMenu,2,4); - //parseable_packet(0x0364,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0364,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0436,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083C,2,clif_parse_ReqCloseBuyingStore,0); @@ -1350,7 +1350,7 @@ parseable_packet(0x0864,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0865,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x086E,26,clif_parse_PartyInvite2,2); - //parseable_packet(0x086a,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x086a,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0870,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); parseable_packet(0x0874,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0885,36,clif_parse_StoragePassword,0); @@ -1371,9 +1371,9 @@ // 2015-12-23bRagexeRE #elif PACKETVER == 20151223 parseable_packet(0x02c4,8,clif_parse_MoveToKafra,2,4); - //parseable_packet(0x0362,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0362,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,6,clif_parse_TakeItem,2); - //parseable_packet(0x0802,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0802,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0815,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); parseable_packet(0x0864,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x0866,19,clif_parse_WantToConnection,2,6,10,14,18); @@ -1418,7 +1418,7 @@ parseable_packet(0x083c,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0861,6,clif_parse_TakeItem,2); parseable_packet(0x086a,6,clif_parse_DropItem,2,4); - //parseable_packet(0x086c,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x086c,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0878,36,clif_parse_StoragePassword,0); parseable_packet(0x087a,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x087f,19,clif_parse_WantToConnection,2,6,10,14,18); @@ -1428,7 +1428,7 @@ parseable_packet(0x0891,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x08a0,26,clif_parse_FriendsListAdd,2); parseable_packet(0x091d,-1,clif_parse_ItemListWindowSelected,2,4,8,12); - //parseable_packet(0x0940,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0940,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x096a,6,clif_parse_GetCharNameRequest,2); // 2016-01-13cRagexeRE #elif PACKETVER == 20160113 @@ -1439,7 +1439,7 @@ parseable_packet(0x085b,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0864,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x086d,5,clif_parse_HomMenu,2,4); - //parseable_packet(0x0873,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0873,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0875,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x0888,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x088b,26,clif_parse_PartyInvite2,2); @@ -1459,7 +1459,7 @@ parseable_packet(0x093c,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0941,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x094d,19,clif_parse_WantToConnection,2,6,10,14,18); - //parseable_packet(0x094f,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x094f,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0967,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); // 2016-01-20aRagexeRE #elif PACKETVER == 20160120 @@ -1471,13 +1471,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -1499,13 +1499,13 @@ parseable_packet(0x035f,6,clif_parse_TickSend,2); parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -1545,8 +1545,8 @@ parseable_packet(0x086c,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0872,5,clif_parse_HomMenu,2,4); parseable_packet(0x0873,36,clif_parse_StoragePassword,0); - //parseable_packet(0x088c,4,NULL,0); // CZ_GANGSI_RANK - //parseable_packet(0x0918,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x088c,4,nullptr,0); // CZ_GANGSI_RANK + //parseable_packet(0x0918,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x093e,26,clif_parse_PartyInvite2,2); parseable_packet(0x0940,5,clif_parse_WalkToXY,2); parseable_packet(0x0947,6,clif_parse_DropItem,2,4); @@ -1562,13 +1562,13 @@ parseable_packet(0x035f,6,clif_parse_TickSend,2); parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,36,clif_parse_StoragePassword,0); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -1598,7 +1598,7 @@ parseable_packet(0x0888,6,clif_parse_TickSend,2); parseable_packet(0x088d,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x088f,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0899,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0899,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x08a0,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x08a9,26,clif_parse_PartyInvite2,2); parseable_packet(0x08ac,18,clif_parse_PartyBookingRegisterReq,2,4); @@ -1611,7 +1611,7 @@ parseable_packet(0x093e,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); parseable_packet(0x0941,6,clif_parse_TakeItem,2); parseable_packet(0x094a,10,clif_parse_UseSkillToPos,2,4,6,8); - //parseable_packet(0x094f,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x094f,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x095e,36,clif_parse_StoragePassword,0); parseable_packet(0x0966,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x0967,6,clif_parse_SolveCharName,2); @@ -1634,12 +1634,12 @@ parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083c,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0861,19,clif_parse_WantToConnection,2,6,10,14,18); - //parseable_packet(0x086b,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x086b,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0884,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0885,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0888,5,clif_parse_WalkToXY,2); parseable_packet(0x08a9,26,clif_parse_FriendsListAdd,2); - //parseable_packet(0x0920,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0920,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0929,5,clif_parse_ChangeDir,2,4); parseable_packet(0x092f,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x0936,36,clif_parse_StoragePassword,0); @@ -1667,11 +1667,11 @@ parseable_packet(0x08a9,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x091a,6,clif_parse_DropItem,2,4); parseable_packet(0x0927,6,clif_parse_TakeItem,2); - //parseable_packet(0x092d,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x092d,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x092f,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0945,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x094e,36,clif_parse_StoragePassword,0); - //parseable_packet(0x0950,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0950,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0957,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x095a,6,clif_parse_TickSend,2); parseable_packet(0x0960,8,clif_parse_MoveToKafra,2,4); @@ -1692,7 +1692,7 @@ parseable_packet(0x085f,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0866,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x086a,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); - //parseable_packet(0x0873,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0873,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x087c,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x087e,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x089b,-1,clif_parse_ItemListWindowSelected,2,4,8,12); @@ -1701,7 +1701,7 @@ parseable_packet(0x091d,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x0920,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0922,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); - //parseable_packet(0x0929,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0929,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x092a,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x092e,2,clif_parse_ReqCloseBuyingStore,0); parseable_packet(0x0932,5,clif_parse_HomMenu,2,4); @@ -1719,13 +1719,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -1757,7 +1757,7 @@ parseable_packet(0x0835,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083c,10,clif_parse_UseSkillToId,2,4,6); - //parseable_packet(0x0867,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0867,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0869,6,clif_parse_TakeItem,2); parseable_packet(0x086a,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0872,36,clif_parse_StoragePassword,0); @@ -1765,7 +1765,7 @@ parseable_packet(0x0883,26,clif_parse_PartyInvite2,2); parseable_packet(0x0896,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x089a,5,clif_parse_HomMenu,2,4); - //parseable_packet(0x091b,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x091b,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0926,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0927,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0933,5,clif_parse_ChangeDir,2,4); @@ -1789,11 +1789,11 @@ parseable_packet(0x083c,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0867,26,clif_parse_PartyInvite2,2); parseable_packet(0x086d,6,clif_parse_TakeItem,2); - //parseable_packet(0x0878,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0878,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x087f,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0889,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x088b,5,clif_parse_HomMenu,2,4); - //parseable_packet(0x088d,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x088d,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0918,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0925,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x092a,-1,clif_parse_ItemListWindowSelected,2,4,8,12); @@ -1821,7 +1821,7 @@ parseable_packet(0x089e,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x08a1,7,clif_parse_ActionRequest,2,6); parseable_packet(0x08a9,2,clif_parse_ReqCloseBuyingStore,0); - //parseable_packet(0x08ac,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x08ac,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0927,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x092d,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x0933,5,clif_parse_ChangeDir,2,4); @@ -1832,7 +1832,7 @@ parseable_packet(0x0953,36,clif_parse_StoragePassword,0); parseable_packet(0x095d,5,clif_parse_HomMenu,2,4); parseable_packet(0x095f,5,clif_parse_WalkToXY,2); - //parseable_packet(0x0962,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0962,4,nullptr,0); // CZ_GANGSI_RANK // 2016-04-14bRagexeRE #elif PACKETVER == 20160414 parseable_packet(0x035f,6,clif_parse_TickSend,2); @@ -1852,11 +1852,11 @@ parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083c,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0862,19,clif_parse_WantToConnection,2,6,10,14,18); - //parseable_packet(0x087a,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x087a,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0880,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0885,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x089e,26,clif_parse_PartyInvite2,2); - //parseable_packet(0x0918,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0918,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0922,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0927,36,clif_parse_StoragePassword,0); parseable_packet(0x0931,6,clif_parse_DropItem,2,4); @@ -1883,7 +1883,7 @@ parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083c,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0864,6,clif_parse_TakeItem,2); - //parseable_packet(0x0870,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0870,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0872,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0874,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0884,6,clif_parse_DropItem,2,4); @@ -1893,7 +1893,7 @@ parseable_packet(0x092f,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0935,26,clif_parse_FriendsListAdd,2); parseable_packet(0x094e,-1,clif_parse_ItemListWindowSelected,2,4,8,12); - //parseable_packet(0x095c,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x095c,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x096a,6,clif_parse_GetCharNameRequest,2); // 2016-04-27aRagexeRE #elif PACKETVER == 20160427 @@ -1905,13 +1905,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -1930,7 +1930,7 @@ #elif PACKETVER == 20160504 parseable_packet(0x0202,5,clif_parse_HomMenu,2,4); parseable_packet(0x0363,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); - //parseable_packet(0x0365,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0365,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x083c,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x085f,7,clif_parse_ActionRequest,2,6); parseable_packet(0x086b,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); @@ -1943,7 +1943,7 @@ parseable_packet(0x088f,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x0890,6,clif_parse_DropItem,2,4); parseable_packet(0x0893,18,clif_parse_PartyBookingRegisterReq,2,4); - //parseable_packet(0x0898,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0898,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x089d,6,clif_parse_SolveCharName,2); parseable_packet(0x08ad,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0918,6,clif_parse_TickSend,2); @@ -1963,7 +1963,7 @@ parseable_packet(0x035f,6,clif_parse_TickSend,2); parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); @@ -1983,7 +1983,7 @@ parseable_packet(0x083c,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x085e,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0894,26,clif_parse_FriendsListAdd,2); - //parseable_packet(0x089b,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x089b,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0918,5,clif_parse_HomMenu,2,4); parseable_packet(0x0920,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x0940,36,clif_parse_StoragePassword,0); @@ -1994,13 +1994,13 @@ parseable_packet(0x035f,6,clif_parse_TickSend,2); parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -2035,7 +2035,7 @@ parseable_packet(0x0835,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083c,10,clif_parse_UseSkillToId,2,4,6); - //parseable_packet(0x085a,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x085a,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x085e,6,clif_parse_DropItem,2,4); parseable_packet(0x0867,5,clif_parse_HomMenu,2,4); parseable_packet(0x086a,19,clif_parse_WantToConnection,2,6,10,14,18); @@ -2046,7 +2046,7 @@ parseable_packet(0x0937,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x0945,26,clif_parse_PartyInvite2,2); parseable_packet(0x094a,8,clif_parse_MoveToKafra,2,4); - //parseable_packet(0x094e,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x094e,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0951,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0956,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x096a,6,clif_parse_GetCharNameRequest,2); @@ -2074,9 +2074,9 @@ parseable_packet(0x088d,6,clif_parse_DropItem,2,4); parseable_packet(0x088f,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0895,5,clif_parse_HomMenu,2,4); - //parseable_packet(0x08a7,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x08a7,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x08ac,19,clif_parse_WantToConnection,2,6,10,14,18); - //parseable_packet(0x0924,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0924,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x095b,5,clif_parse_ChangeDir,2,4); parseable_packet(0x095f,36,clif_parse_StoragePassword,0); parseable_packet(0x0961,18,clif_parse_PartyBookingRegisterReq,2,4); @@ -2100,13 +2100,13 @@ parseable_packet(0x0835,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083c,10,clif_parse_UseSkillToId,2,4,6); - //parseable_packet(0x085c,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x085c,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0885,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0889,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x0899,6,clif_parse_TakeItem,2); parseable_packet(0x089b,5,clif_parse_HomMenu,2,4); parseable_packet(0x08a6,8,clif_parse_MoveFromKafra,2,4); - //parseable_packet(0x093b,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x093b,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x094d,6,clif_parse_DropItem,2,4); parseable_packet(0x0958,36,clif_parse_StoragePassword,0); parseable_packet(0x095b,8,clif_parse_MoveToKafra,2,4); @@ -2120,11 +2120,11 @@ parseable_packet(0x0369,5,clif_parse_HomMenu,2,4); parseable_packet(0x083c,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x0866,5,clif_parse_WalkToXY,2); - //parseable_packet(0x0870,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0870,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x087d,6,clif_parse_SolveCharName,2); parseable_packet(0x087e,6,clif_parse_TakeItem,2); parseable_packet(0x087f,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); - //parseable_packet(0x0884,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0884,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0887,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x0888,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x088a,6,clif_parse_TickSend,2); @@ -2152,8 +2152,8 @@ parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x07e4,5,clif_parse_HomMenu,2,4); parseable_packet(0x0861,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); - //parseable_packet(0x0865,4,NULL,0); // CZ_GANGSI_RANK - //parseable_packet(0x0867,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0865,4,nullptr,0); // CZ_GANGSI_RANK + //parseable_packet(0x0867,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0880,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); parseable_packet(0x0887,2,clif_parse_ReqCloseBuyingStore,0); parseable_packet(0x0890,26,clif_parse_FriendsListAdd,2); @@ -2178,11 +2178,11 @@ #elif PACKETVER == 20160629 || PACKETVER == 20160630 parseable_packet(0x0202,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x022d,5,clif_parse_WalkToXY,2); - //parseable_packet(0x035f,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x035f,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0363,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0368,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x085c,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); - //parseable_packet(0x085e,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x085e,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0860,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); parseable_packet(0x0861,6,clif_parse_DropItem,2,4); parseable_packet(0x0863,6,clif_parse_SolveCharName,2); @@ -2214,7 +2214,7 @@ parseable_packet(0x0869,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x086b,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); parseable_packet(0x0884,26,clif_parse_FriendsListAdd,2); - //parseable_packet(0x0886,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0886,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0889,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); parseable_packet(0x0892,5,clif_parse_HomMenu,2,4); parseable_packet(0x0899,10,clif_parse_UseSkillToId,2,4,6); @@ -2230,7 +2230,7 @@ parseable_packet(0x092d,5,clif_parse_WalkToXY,2); parseable_packet(0x0939,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x093d,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0944,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0944,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0945,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x094c,36,clif_parse_StoragePassword,0); parseable_packet(0x0952,2,clif_parse_ReqCloseBuyingStore,0); @@ -2252,7 +2252,7 @@ parseable_packet(0x088d,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0892,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x089a,26,clif_parse_PartyInvite2,2); - //parseable_packet(0x089f,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x089f,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x08a2,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x08a4,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x091c,5,clif_parse_WalkToXY,2); @@ -2266,7 +2266,7 @@ parseable_packet(0x0945,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0947,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0957,6,clif_parse_DropItem,2,4); - //parseable_packet(0x095b,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x095b,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD // 2016-07-20aRagexeRE #elif PACKETVER == 20160720 parseable_packet(0x0362,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); @@ -2287,27 +2287,27 @@ parseable_packet(0x089e,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x08a0,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x08aa,-1,clif_parse_ItemListWindowSelected,2,4,8,12); - //parseable_packet(0x0917,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0917,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x091c,6,clif_parse_TakeItem,2); parseable_packet(0x092a,26,clif_parse_FriendsListAdd,2); parseable_packet(0x093b,5,clif_parse_ChangeDir,2,4); parseable_packet(0x093e,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); parseable_packet(0x0946,6,clif_parse_TickSend,2); parseable_packet(0x094d,6,clif_parse_SolveCharName,2); - //parseable_packet(0x0953,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0953,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x095b,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0960,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0969,26,clif_parse_PartyInvite2,2); // 2016-07-27bRagexeRE #elif PACKETVER == 20160727 parseable_packet(0x0202,5,clif_parse_ChangeDir,2,4); - //parseable_packet(0x023b,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x023b,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0362,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); parseable_packet(0x0363,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0436,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0438,6,clif_parse_TickSend,2); parseable_packet(0x07ec,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0866,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0866,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0868,26,clif_parse_PartyInvite2,2); parseable_packet(0x0869,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x0874,6,clif_parse_ReqClickBuyingStore,2); @@ -2333,7 +2333,7 @@ #elif PACKETVER == 20160803 parseable_packet(0x0364,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x085d,6,clif_parse_ReqClickBuyingStore,2); - //parseable_packet(0x0878,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0878,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x087f,5,clif_parse_WalkToXY,2); parseable_packet(0x0881,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0886,8,clif_parse_MoveToKafra,2,4); @@ -2351,7 +2351,7 @@ parseable_packet(0x0932,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0934,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0937,10,clif_parse_UseSkillToPos,2,4,6,8); - //parseable_packet(0x093a,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x093a,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x093e,6,clif_parse_TickSend,2); parseable_packet(0x093f,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); parseable_packet(0x0952,5,clif_parse_HomMenu,2,4); @@ -2382,7 +2382,7 @@ parseable_packet(0x091a,6,clif_parse_TakeItem,2); parseable_packet(0x091b,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x091c,10,clif_parse_UseSkillToId,2,4,6); - //parseable_packet(0x0926,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0926,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x092b,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x092d,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0935,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); @@ -2390,7 +2390,7 @@ parseable_packet(0x094b,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x0959,2,clif_parse_ReqCloseBuyingStore,0); parseable_packet(0x095b,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0967,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0967,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD // 2016-08-31bRagexeRE #elif PACKETVER == 20160831 parseable_packet(0x022d,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); @@ -2401,13 +2401,13 @@ parseable_packet(0x086d,2,clif_parse_ReqCloseBuyingStore,0); parseable_packet(0x0870,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0874,26,clif_parse_PartyInvite2,2); - //parseable_packet(0x0876,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0876,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0878,7,clif_parse_ActionRequest,2,6); parseable_packet(0x087c,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x08a8,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x08a9,6,clif_parse_TickSend,2); parseable_packet(0x0917,36,clif_parse_StoragePassword,0); - //parseable_packet(0x091b,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x091b,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x092c,26,clif_parse_FriendsListAdd,2); parseable_packet(0x092e,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x0938,2,clif_parse_SearchStoreInfoNextPage,0); @@ -2432,13 +2432,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -2462,7 +2462,7 @@ parseable_packet(0x0874,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0875,6,clif_parse_TickSend,2); parseable_packet(0x0879,6,clif_parse_DropItem,2,4); - //parseable_packet(0x087a,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x087a,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x087b,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x0887,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x0889,6,clif_parse_TakeItem,2); @@ -2481,7 +2481,7 @@ parseable_packet(0x0950,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0952,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x0954,5,clif_parse_WalkToXY,2); - //parseable_packet(0x0962,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0962,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0963,6,clif_parse_SolveCharName,2); parseable_packet(0x0968,2,clif_parse_ReqCloseBuyingStore,0); // 2016-09-21bRagexeRE @@ -2494,13 +2494,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -2521,7 +2521,7 @@ parseable_packet(0x035f,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x0366,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); parseable_packet(0x0436,6,clif_parse_ReqClickBuyingStore,2); - //parseable_packet(0x0811,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0811,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0838,26,clif_parse_PartyInvite2,2); parseable_packet(0x0864,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0866,2,clif_parse_SearchStoreInfoNextPage,0); @@ -2545,7 +2545,7 @@ parseable_packet(0x0953,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x0955,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0957,6,clif_parse_TakeItem,2); - //parseable_packet(0x095a,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x095a,4,nullptr,0); // CZ_GANGSI_RANK // 2016-10-05aRagexeRE #elif PACKETVER == 20161005 parseable_packet(0x0202,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); @@ -2563,7 +2563,7 @@ parseable_packet(0x08ad,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x0918,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x0919,6,clif_parse_SolveCharName,2); - //parseable_packet(0x091e,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x091e,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x092b,6,clif_parse_TickSend,2); parseable_packet(0x0931,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0932,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); @@ -2573,7 +2573,7 @@ parseable_packet(0x0945,5,clif_parse_WalkToXY,2); parseable_packet(0x094a,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); parseable_packet(0x094d,5,clif_parse_HomMenu,2,4); - //parseable_packet(0x0952,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0952,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x095a,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x095b,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x0967,10,clif_parse_UseSkillToId,2,4,6); @@ -2586,7 +2586,7 @@ parseable_packet(0x0369,26,clif_parse_PartyInvite2,2); parseable_packet(0x07ec,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); parseable_packet(0x0819,26,clif_parse_FriendsListAdd,2); - //parseable_packet(0x085b,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x085b,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x085e,2,clif_parse_ReqCloseBuyingStore,0); parseable_packet(0x0863,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0868,6,clif_parse_TakeItem,2); @@ -2602,7 +2602,7 @@ parseable_packet(0x0939,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x0943,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0944,8,clif_parse_MoveFromKafra,2,4); - //parseable_packet(0x094f,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x094f,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0951,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x095c,5,clif_parse_HomMenu,2,4); parseable_packet(0x0962,10,clif_parse_UseSkillToId,2,4,6); @@ -2616,7 +2616,7 @@ parseable_packet(0x0360,5,clif_parse_HomMenu,2,4); parseable_packet(0x0361,5,clif_parse_WalkToXY,2); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); @@ -2635,7 +2635,7 @@ parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083c,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0889,36,clif_parse_StoragePassword,0); - //parseable_packet(0x0892,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0892,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0946,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x0963,26,clif_parse_FriendsListAdd,2); parseable_packet(0x096a,6,clif_parse_GetCharNameRequest,2); @@ -2650,9 +2650,9 @@ parseable_packet(0x0862,6,clif_parse_TickSend,2); parseable_packet(0x086a,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x086c,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); - //parseable_packet(0x086e,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x086e,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x087a,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); - //parseable_packet(0x087c,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x087c,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x087f,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x0886,6,clif_parse_DropItem,2,4); parseable_packet(0x0891,6,clif_parse_ReqClickBuyingStore,2); @@ -2673,7 +2673,7 @@ // 2016-11-02aRagexeRE or 2016-11-03aRagexeRE #elif PACKETVER == 20161102 || PACKETVER == 20161103 parseable_packet(0x0361,8,clif_parse_MoveFromKafra,2,4); - //parseable_packet(0x0367,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0367,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0436,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0802,6,clif_parse_TakeItem,2); parseable_packet(0x0838,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); @@ -2681,7 +2681,7 @@ parseable_packet(0x085f,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0869,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x086c,2,clif_parse_SearchStoreInfoNextPage,0); - //parseable_packet(0x086f,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x086f,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0874,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); parseable_packet(0x0886,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x088f,5,clif_parse_HomMenu,2,4); @@ -2716,14 +2716,14 @@ parseable_packet(0x086d,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x0870,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x0876,6,clif_parse_ReqClickBuyingStore,2); - //parseable_packet(0x087a,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x087a,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0881,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x088e,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x0891,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x0898,6,clif_parse_TakeItem,2); parseable_packet(0x089a,6,clif_parse_DropItem,2,4); parseable_packet(0x089d,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); - //parseable_packet(0x089f,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x089f,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x08a7,5,clif_parse_HomMenu,2,4); parseable_packet(0x08ad,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x0927,26,clif_parse_PartyInvite2,2); @@ -2760,9 +2760,9 @@ parseable_packet(0x0952,2,clif_parse_ReqCloseBuyingStore,0); parseable_packet(0x0957,6,clif_parse_SolveCharName,2); parseable_packet(0x095b,36,clif_parse_StoragePassword,0); - //parseable_packet(0x095d,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x095d,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x095f,2,clif_parse_SearchStoreInfoNextPage,0); - //parseable_packet(0x0967,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0967,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD // 2016-11-23aRagexeRE #elif PACKETVER == 20161123 parseable_packet(0x0281,-1,clif_parse_ItemListWindowSelected,2,4,8,12); @@ -2774,7 +2774,7 @@ parseable_packet(0x0862,2,clif_parse_ReqCloseBuyingStore,0); parseable_packet(0x0866,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x086f,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0871,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0871,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x087f,26,clif_parse_PartyInvite2,2); parseable_packet(0x0880,36,clif_parse_StoragePassword,0); parseable_packet(0x0882,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); @@ -2790,7 +2790,7 @@ parseable_packet(0x0941,26,clif_parse_FriendsListAdd,2); parseable_packet(0x094d,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x094f,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); - //parseable_packet(0x095a,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x095a,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x095b,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0962,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x096a,6,clif_parse_SolveCharName,2); @@ -2801,7 +2801,7 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,6,clif_parse_TickSend,2); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); @@ -2819,7 +2819,7 @@ parseable_packet(0x0835,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083c,10,clif_parse_UseSkillToId,2,4,6); - //parseable_packet(0x088f,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x088f,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0931,5,clif_parse_HomMenu,2,4); parseable_packet(0x0943,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x0954,36,clif_parse_StoragePassword,0); @@ -2843,7 +2843,7 @@ parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083c,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0867,26,clif_parse_FriendsListAdd,2); - //parseable_packet(0x0868,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0868,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0875,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x087e,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x0886,7,clif_parse_ActionRequest,2,6); @@ -2852,7 +2852,7 @@ parseable_packet(0x08ad,6,clif_parse_DropItem,2,4); parseable_packet(0x0918,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x091d,8,clif_parse_MoveFromKafra,2,4); - //parseable_packet(0x0943,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0943,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x095d,36,clif_parse_StoragePassword,0); parseable_packet(0x0965,26,clif_parse_PartyInvite2,2); parseable_packet(0x096a,6,clif_parse_GetCharNameRequest,2); @@ -2873,7 +2873,7 @@ parseable_packet(0x0811,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x0815,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); parseable_packet(0x0817,2,clif_parse_ReqCloseBuyingStore,0); - //parseable_packet(0x0819,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0819,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0835,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083c,10,clif_parse_UseSkillToId,2,4,6); @@ -2881,7 +2881,7 @@ parseable_packet(0x0862,26,clif_parse_FriendsListAdd,2); parseable_packet(0x086d,26,clif_parse_PartyInvite2,2); parseable_packet(0x0887,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0895,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0895,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0899,36,clif_parse_StoragePassword,0); parseable_packet(0x08a6,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x092e,6,clif_parse_TakeItem,2); @@ -2898,11 +2898,11 @@ parseable_packet(0x0866,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); parseable_packet(0x0876,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x0881,6,clif_parse_GetCharNameRequest,2); - //parseable_packet(0x0884,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0884,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0885,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x088c,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x0890,36,clif_parse_StoragePassword,0); - //parseable_packet(0x0899,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0899,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x089a,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x089b,7,clif_parse_ActionRequest,2,6); parseable_packet(0x08aa,6,clif_parse_TickSend,2); @@ -2945,8 +2945,8 @@ parseable_packet(0x0929,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x092c,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x0934,26,clif_parse_PartyInvite2,2); - //parseable_packet(0x0935,8,NULL,0); // CZ_JOIN_BATTLE_FIELD - //parseable_packet(0x0938,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0935,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0938,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x093d,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0944,6,clif_parse_TickSend,2); // 2017-01-04bRagexeRE @@ -2955,13 +2955,13 @@ parseable_packet(0x035f,6,clif_parse_TickSend,2); parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -2987,7 +2987,7 @@ parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0436,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x0811,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); @@ -2999,7 +2999,7 @@ parseable_packet(0x083c,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x085d,5,clif_parse_HomMenu,2,4); parseable_packet(0x0877,26,clif_parse_FriendsListAdd,2); - //parseable_packet(0x087f,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x087f,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x088a,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x08a1,5,clif_parse_ChangeDir,2,4); parseable_packet(0x08a3,6,clif_parse_TakeItem,2); @@ -3033,11 +3033,11 @@ parseable_packet(0x0862,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0865,5,clif_parse_ChangeDir,2,4); parseable_packet(0x086f,6,clif_parse_TakeItem,2); - //parseable_packet(0x0873,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0873,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x089e,26,clif_parse_PartyInvite2,2); parseable_packet(0x08ad,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x091f,18,clif_parse_PartyBookingRegisterReq,2,4); - //parseable_packet(0x0927,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0927,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0933,6,clif_parse_DropItem,2,4); parseable_packet(0x0958,36,clif_parse_StoragePassword,0); parseable_packet(0x0962,26,clif_parse_FriendsListAdd,2); @@ -3053,9 +3053,9 @@ parseable_packet(0x087b,6,clif_parse_TakeItem,2); parseable_packet(0x087d,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x0881,5,clif_parse_ChangeDir,2,4); - //parseable_packet(0x0884,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0884,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0893,36,clif_parse_StoragePassword,0); - //parseable_packet(0x0894,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0894,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0895,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x0898,6,clif_parse_SolveCharName,2); parseable_packet(0x089b,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); @@ -3089,13 +3089,13 @@ parseable_packet(0x085d,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x085e,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0875,6,clif_parse_TakeItem,2); - //parseable_packet(0x0879,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0879,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0881,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0884,5,clif_parse_WalkToXY,2); parseable_packet(0x0885,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0886,36,clif_parse_StoragePassword,0); parseable_packet(0x088b,6,clif_parse_DropItem,2,4); - //parseable_packet(0x08a4,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x08a4,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0919,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0920,26,clif_parse_PartyInvite2,2); parseable_packet(0x0938,5,clif_parse_HomMenu,2,4); @@ -3106,7 +3106,7 @@ parseable_packet(0x096a,6,clif_parse_GetCharNameRequest,2); // 2017-02-08aRagexeRE #elif PACKETVER == 20170208 - //parseable_packet(0x02c4,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x02c4,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x035f,6,clif_parse_TickSend,2); parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); @@ -3124,7 +3124,7 @@ parseable_packet(0x083c,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x085c,26,clif_parse_PartyInvite2,2); parseable_packet(0x0860,5,clif_parse_ChangeDir,2,4); - //parseable_packet(0x087a,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x087a,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x088c,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x0892,26,clif_parse_FriendsListAdd,2); parseable_packet(0x08a1,18,clif_parse_PartyBookingRegisterReq,2,4); @@ -3148,12 +3148,12 @@ parseable_packet(0x087d,5,clif_parse_ChangeDir,2,4); parseable_packet(0x087e,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0883,6,clif_parse_SolveCharName,2); - //parseable_packet(0x0884,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0884,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x088a,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x088b,26,clif_parse_PartyInvite2,2); parseable_packet(0x088c,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); parseable_packet(0x0890,10,clif_parse_UseSkillToPos,2,4,6,8); - //parseable_packet(0x0896,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0896,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x089b,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x08a2,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x08a8,18,clif_parse_PartyBookingRegisterReq,2,4); @@ -3185,8 +3185,8 @@ parseable_packet(0x085f,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0866,6,clif_parse_DropItem,2,4); parseable_packet(0x0870,18,clif_parse_PartyBookingRegisterReq,2,4); - //parseable_packet(0x0871,4,NULL,0); // CZ_GANGSI_RANK - //parseable_packet(0x0877,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0871,4,nullptr,0); // CZ_GANGSI_RANK + //parseable_packet(0x0877,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0889,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); parseable_packet(0x0894,6,clif_parse_TakeItem,2); parseable_packet(0x08a3,5,clif_parse_ChangeDir,2,4); @@ -3216,13 +3216,13 @@ parseable_packet(0x089e,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x08a0,26,clif_parse_FriendsListAdd,2); parseable_packet(0x08a2,36,clif_parse_StoragePassword,0); - //parseable_packet(0x08a6,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x08a6,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x08a7,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x091f,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x092a,6,clif_parse_TakeItem,2); parseable_packet(0x092e,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x0937,6,clif_parse_TickSend,2); - //parseable_packet(0x093e,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x093e,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0944,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0947,6,clif_parse_SolveCharName,2); parseable_packet(0x0948,26,clif_parse_PartyInvite2,2); @@ -3238,13 +3238,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -3268,14 +3268,14 @@ parseable_packet(0x0367,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0436,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x07ec,6,clif_parse_TickSend,2); - //parseable_packet(0x085c,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x085c,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0863,5,clif_parse_HomMenu,2,4); parseable_packet(0x086a,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0872,26,clif_parse_FriendsListAdd,2); parseable_packet(0x087b,26,clif_parse_PartyInvite2,2); parseable_packet(0x0884,7,clif_parse_ActionRequest,2,6); parseable_packet(0x088b,18,clif_parse_PartyBookingRegisterReq,2,4); - //parseable_packet(0x088d,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x088d,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x088f,5,clif_parse_WalkToXY,2); parseable_packet(0x0892,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x089c,2,clif_parse_ReqCloseBuyingStore,0); @@ -3300,13 +3300,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -3343,14 +3343,14 @@ parseable_packet(0x087a,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0888,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); parseable_packet(0x08a8,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0917,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0917,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0926,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0929,6,clif_parse_TakeItem,2); parseable_packet(0x092e,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x0937,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x0939,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0949,8,clif_parse_MoveFromKafra,2,4); - //parseable_packet(0x095f,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x095f,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x096a,6,clif_parse_GetCharNameRequest,2); // 2017-04-05bRagexeRE #elif PACKETVER == 20170405 @@ -3359,7 +3359,7 @@ parseable_packet(0x035f,6,clif_parse_TickSend,2); parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0362,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0363,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0363,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,6,clif_parse_TakeItem,2); @@ -3380,7 +3380,7 @@ parseable_packet(0x0893,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x08a5,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x094c,36,clif_parse_StoragePassword,0); - //parseable_packet(0x094f,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x094f,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0964,6,clif_parse_DropItem,2,4); parseable_packet(0x096a,6,clif_parse_GetCharNameRequest,2); // 2017-04-12aRagexeRE @@ -3391,7 +3391,7 @@ parseable_packet(0x0869,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x086d,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0878,5,clif_parse_WalkToXY,2); - //parseable_packet(0x0879,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0879,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x087b,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x088b,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); parseable_packet(0x0890,-1,clif_parse_ItemListWindowSelected,2,4,8,12); @@ -3403,7 +3403,7 @@ parseable_packet(0x091a,5,clif_parse_ChangeDir,2,4); parseable_packet(0x091e,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x0929,6,clif_parse_TickSend,2); - //parseable_packet(0x092e,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x092e,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0938,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0942,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0945,8,clif_parse_MoveToKafra,2,4); @@ -3424,7 +3424,7 @@ parseable_packet(0x0862,26,clif_parse_PartyInvite2,2); parseable_packet(0x0868,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); parseable_packet(0x086a,18,clif_parse_PartyBookingRegisterReq,2,4); - //parseable_packet(0x0872,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0872,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0881,36,clif_parse_StoragePassword,0); parseable_packet(0x088d,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x088f,5,clif_parse_HomMenu,2,4); @@ -3443,7 +3443,7 @@ parseable_packet(0x0942,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x095c,6,clif_parse_TakeItem,2); parseable_packet(0x095d,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); - //parseable_packet(0x0963,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0963,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0965,6,clif_parse_ReqClickBuyingStore,2); // 2017-04-26dRagexeRE #elif PACKETVER == 20170426 @@ -3463,14 +3463,14 @@ parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083c,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0866,-1,clif_parse_ItemListWindowSelected,2,4,8,12); - //parseable_packet(0x086f,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x086f,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x087a,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0887,6,clif_parse_SolveCharName,2); parseable_packet(0x0899,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x089c,5,clif_parse_HomMenu,2,4); parseable_packet(0x08a2,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x08a4,6,clif_parse_TakeItem,2); - //parseable_packet(0x091f,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x091f,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0927,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0940,6,clif_parse_DropItem,2,4); parseable_packet(0x0958,26,clif_parse_FriendsListAdd,2); @@ -3482,13 +3482,13 @@ parseable_packet(0x035f,6,clif_parse_TickSend,2); parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07e4,6,clif_parse_TakeItem,2); @@ -3509,7 +3509,7 @@ parseable_packet(0x096a,6,clif_parse_GetCharNameRequest,2); // 2017-05-17aRagexeRE #elif PACKETVER == 20170517 - //parseable_packet(0x0364,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0364,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0367,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); parseable_packet(0x0437,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0802,18,clif_parse_PartyBookingRegisterReq,2,4); @@ -3524,7 +3524,7 @@ parseable_packet(0x0894,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x0896,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x0899,26,clif_parse_PartyInvite2,2); - //parseable_packet(0x089e,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x089e,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x089f,2,clif_parse_ReqCloseBuyingStore,0); parseable_packet(0x08a2,6,clif_parse_TickSend,2); parseable_packet(0x08a8,5,clif_parse_WalkToXY,2); @@ -3558,12 +3558,12 @@ parseable_packet(0x0894,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x089c,5,clif_parse_WalkToXY,2); parseable_packet(0x08a1,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); - //parseable_packet(0x091e,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x091e,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0923,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x0925,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0934,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0946,10,clif_parse_UseSkillToPos,2,4,6,8); - //parseable_packet(0x0958,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0958,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x095a,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x095b,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0964,2,clif_parse_ReqCloseBuyingStore,0); @@ -3576,10 +3576,10 @@ parseable_packet(0x07e4,5,clif_parse_WalkToXY,2); parseable_packet(0x07ec,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x0819,6,clif_parse_TickSend,2); - //parseable_packet(0x085b,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x085b,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x085f,6,clif_parse_SolveCharName,2); parseable_packet(0x0861,26,clif_parse_FriendsListAdd,2); - //parseable_packet(0x0868,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0868,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0873,2,clif_parse_ReqCloseBuyingStore,0); parseable_packet(0x0875,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x0878,26,clif_parse_PartyInvite2,2); @@ -3611,7 +3611,7 @@ parseable_packet(0x0863,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0864,6,clif_parse_DropItem,2,4); parseable_packet(0x0871,19,clif_parse_WantToConnection,2,6,10,14,18); - //parseable_packet(0x0873,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0873,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0875,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x0885,26,clif_parse_FriendsListAdd,2); parseable_packet(0x088a,8,clif_parse_MoveFromKafra,2,4); @@ -3624,7 +3624,7 @@ parseable_packet(0x0919,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x0925,26,clif_parse_PartyInvite2,2); parseable_packet(0x0927,10,clif_parse_UseSkillToPos,2,4,6,8); - //parseable_packet(0x0931,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0931,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0934,5,clif_parse_WalkToXY,2); parseable_packet(0x0938,7,clif_parse_ActionRequest,2,6); parseable_packet(0x093d,2,clif_parse_ReqCloseBuyingStore,0); @@ -3641,7 +3641,7 @@ parseable_packet(0x0838,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x083C,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0860,6,clif_parse_ReqClickBuyingStore,2); - //parseable_packet(0x0865,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0865,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0866,6,clif_parse_TickSend,2); parseable_packet(0x0867,26,clif_parse_FriendsListAdd,2); parseable_packet(0x086B,2,clif_parse_ReqCloseBuyingStore,0); @@ -3660,7 +3660,7 @@ parseable_packet(0x092F,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x0936,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x0944,19,clif_parse_WantToConnection,2,6,10,14,18); - //parseable_packet(0x0957,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0957,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0963,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); // 2017-06-21aRagexeRE #elif PACKETVER == 20170621 @@ -3687,9 +3687,9 @@ parseable_packet(0x0885,26,clif_parse_PartyInvite2,2); parseable_packet(0x0889,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x08A8,5,clif_parse_HomMenu,2,4); - //parseable_packet(0x0956,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0956,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0957,36,clif_parse_StoragePassword,0); - //parseable_packet(0x095B,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x095B,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x095C,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0961,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x096A,6,clif_parse_GetCharNameRequest,2); @@ -3703,13 +3703,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07E4,6,clif_parse_TakeItem,2); @@ -3744,12 +3744,12 @@ parseable_packet(0x083C,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0879,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0886,26,clif_parse_FriendsListAdd,2); - //parseable_packet(0x088D,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x088D,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x088E,26,clif_parse_PartyInvite2,2); parseable_packet(0x089A,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x089D,6,clif_parse_DropItem,2,4); parseable_packet(0x091A,5,clif_parse_ChangeDir,2,4); - //parseable_packet(0x092F,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x092F,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0930,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x0932,6,clif_parse_TakeItem,2); parseable_packet(0x0934,8,clif_parse_MoveFromKafra,2,4); @@ -3765,13 +3765,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07E4,6,clif_parse_TakeItem,2); @@ -3790,7 +3790,7 @@ #elif PACKETVER == 20170719 parseable_packet(0x022D,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0367,2,clif_parse_ReqCloseBuyingStore,0); - //parseable_packet(0x0368,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0368,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0369,5,clif_parse_HomMenu,2,4); parseable_packet(0x07E4,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x085A,6,clif_parse_TickSend,2); @@ -3813,7 +3813,7 @@ parseable_packet(0x092E,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x092F,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x093D,5,clif_parse_WalkToXY,2); - //parseable_packet(0x093E,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x093E,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0944,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0946,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0966,8,clif_parse_MoveToKafra,2,4); @@ -3828,10 +3828,10 @@ parseable_packet(0x0873,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0874,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x0878,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0881,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0881,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0888,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x088E,5,clif_parse_WalkToXY,2); - //parseable_packet(0x08A3,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x08A3,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x08A7,36,clif_parse_StoragePassword,0); parseable_packet(0x08AA,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x08AB,6,clif_parse_TakeItem,2); @@ -3856,7 +3856,7 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x0362,5,clif_parse_HomMenu,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); @@ -3875,7 +3875,7 @@ parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083C,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x087D,36,clif_parse_StoragePassword,0); - //parseable_packet(0x08A6,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x08A6,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x094F,26,clif_parse_FriendsListAdd,2); parseable_packet(0x095A,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x096A,6,clif_parse_GetCharNameRequest,2); @@ -3894,11 +3894,11 @@ parseable_packet(0x087E,6,clif_parse_TakeItem,2); parseable_packet(0x0881,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x0882,36,clif_parse_StoragePassword,0); - //parseable_packet(0x0884,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0884,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0888,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0889,6,clif_parse_TickSend,2); parseable_packet(0x08A3,26,clif_parse_FriendsListAdd,2); - //parseable_packet(0x08A7,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x08A7,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x08A9,5,clif_parse_WalkToXY,2); parseable_packet(0x08AC,5,clif_parse_HomMenu,2,4); parseable_packet(0x091C,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); @@ -3919,13 +3919,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,26,clif_parse_PartyInvite2,2); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07E4,6,clif_parse_TakeItem,2); @@ -3948,11 +3948,11 @@ parseable_packet(0x0281,5,clif_parse_ChangeDir,2,4); parseable_packet(0x02C4,6,clif_parse_TakeItem,2); parseable_packet(0x0363,18,clif_parse_PartyBookingRegisterReq,2,4); - //parseable_packet(0x0364,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0364,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0860,2,clif_parse_ReqCloseBuyingStore,0); parseable_packet(0x0865,5,clif_parse_WalkToXY,2); parseable_packet(0x086A,26,clif_parse_PartyInvite2,2); - //parseable_packet(0x0875,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0875,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0884,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x0885,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0888,10,clif_parse_UseSkillToId,2,4,6); @@ -3976,7 +3976,7 @@ parseable_packet(0x0959,10,clif_parse_UseSkillToPos,2,4,6,8); // 2017-09-06cRagexeRE #elif PACKETVER == 20170906 - //parseable_packet(0x0202,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0202,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0281,36,clif_parse_StoragePassword,0); parseable_packet(0x02C4,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x035F,6,clif_parse_TickSend,2); @@ -3996,7 +3996,7 @@ parseable_packet(0x083C,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0860,6,clif_parse_DropItem,2,4); parseable_packet(0x0866,-1,clif_parse_ItemListWindowSelected,2,4,8,12); - //parseable_packet(0x086C,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x086C,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x087B,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x08A2,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x08A3,26,clif_parse_FriendsListAdd,2); @@ -4023,14 +4023,14 @@ parseable_packet(0x0891,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0892,36,clif_parse_StoragePassword,0); parseable_packet(0x08A6,6,clif_parse_ReqClickBuyingStore,2); - //parseable_packet(0x08A7,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x08A7,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x08AA,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x08AB,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x08AC,5,clif_parse_ChangeDir,2,4); parseable_packet(0x08AD,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x091B,6,clif_parse_TickSend,2); parseable_packet(0x091D,6,clif_parse_DropItem,2,4); - //parseable_packet(0x091E,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x091E,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0920,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x0923,5,clif_parse_WalkToXY,2); parseable_packet(0x0925,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); @@ -4050,12 +4050,12 @@ parseable_packet(0x086A,26,clif_parse_PartyInvite2,2); parseable_packet(0x086C,6,clif_parse_DropItem,2,4); parseable_packet(0x0874,2,clif_parse_ReqCloseBuyingStore,0); - //parseable_packet(0x0875,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0875,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0889,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x088E,6,clif_parse_TickSend,2); parseable_packet(0x089B,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0919,10,clif_parse_UseSkillToPos,2,4,6,8); - //parseable_packet(0x091E,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x091E,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0921,6,clif_parse_SolveCharName,2); parseable_packet(0x0923,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x0926,8,clif_parse_MoveToKafra,2,4); @@ -4072,7 +4072,7 @@ #elif PACKETVER == 20170927 parseable_packet(0x02C4,5,clif_parse_HomMenu,2,4); parseable_packet(0x035F,6,clif_parse_GetCharNameRequest,2); - //parseable_packet(0x0361,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0361,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0362,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); parseable_packet(0x0366,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x085C,10,clif_parse_UseSkillToId,2,4,6); @@ -4086,7 +4086,7 @@ parseable_packet(0x089B,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x08A3,2,clif_parse_ReqCloseBuyingStore,0); parseable_packet(0x08A5,-1,clif_parse_ItemListWindowSelected,2,4,8,12); - //parseable_packet(0x08A6,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x08A6,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x08AD,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); parseable_packet(0x091E,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0922,26,clif_parse_PartyInvite2,2); @@ -4126,9 +4126,9 @@ parseable_packet(0x0934,36,clif_parse_StoragePassword,0); parseable_packet(0x093B,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x093D,6,clif_parse_TakeItem,2); - //parseable_packet(0x093E,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x093E,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0943,26,clif_parse_PartyInvite2,2); - //parseable_packet(0x095F,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x095F,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x096A,6,clif_parse_GetCharNameRequest,2); // 2017-10-11bRagexeRE #elif PACKETVER == 20171011 @@ -4137,13 +4137,13 @@ parseable_packet(0x035F,6,clif_parse_TickSend,2); parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,36,clif_parse_StoragePassword,0); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07E4,6,clif_parse_TakeItem,2); @@ -4180,8 +4180,8 @@ parseable_packet(0x0835,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083C,10,clif_parse_UseSkillToId,2,4,6); - //parseable_packet(0x086A,4,NULL,0); // CZ_GANGSI_RANK - //parseable_packet(0x087A,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x086A,4,nullptr,0); // CZ_GANGSI_RANK + //parseable_packet(0x087A,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x087E,5,clif_parse_HomMenu,2,4); parseable_packet(0x0889,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x089A,6,clif_parse_DropItem,2,4); @@ -4202,13 +4202,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07E4,6,clif_parse_TakeItem,2); @@ -4235,10 +4235,10 @@ parseable_packet(0x086C,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0872,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0876,5,clif_parse_ChangeDir,2,4); - //parseable_packet(0x0886,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0886,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x088E,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0890,2,clif_parse_SearchStoreInfoNextPage,0); - //parseable_packet(0x0895,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0895,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0899,26,clif_parse_PartyInvite2,2); parseable_packet(0x089B,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); parseable_packet(0x089C,18,clif_parse_PartyBookingRegisterReq,2,4); @@ -4267,7 +4267,7 @@ parseable_packet(0x0878,26,clif_parse_FriendsListAdd,2); parseable_packet(0x087E,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x0884,-1,clif_parse_ItemListWindowSelected,2,4,8,12); - //parseable_packet(0x0896,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0896,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0897,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); parseable_packet(0x08A2,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x08A9,5,clif_parse_HomMenu,2,4); @@ -4277,7 +4277,7 @@ parseable_packet(0x0940,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0941,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0945,6,clif_parse_TakeItem,2); - //parseable_packet(0x0947,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0947,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0949,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x094E,26,clif_parse_PartyInvite2,2); parseable_packet(0x0958,18,clif_parse_PartyBookingRegisterReq,2,4); @@ -4304,10 +4304,10 @@ parseable_packet(0x0835,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083C,10,clif_parse_UseSkillToId,2,4,6); - //parseable_packet(0x086D,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x086D,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x086F,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x087E,8,clif_parse_MoveFromKafra,2,4); - //parseable_packet(0x0883,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0883,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x088B,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0890,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0898,36,clif_parse_StoragePassword,0); @@ -4320,14 +4320,14 @@ #elif PACKETVER == 20171122 parseable_packet(0x0281,6,clif_parse_SolveCharName,2); parseable_packet(0x02C4,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); - //parseable_packet(0x035F,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x035F,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0838,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x083C,5,clif_parse_HomMenu,2,4); parseable_packet(0x085B,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x0862,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x0867,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x0877,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); - //parseable_packet(0x0885,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0885,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0890,6,clif_parse_TickSend,2); parseable_packet(0x0891,6,clif_parse_TakeItem,2); parseable_packet(0x0893,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); @@ -4368,13 +4368,13 @@ parseable_packet(0x083C,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0862,6,clif_parse_TakeItem,2); parseable_packet(0x086D,18,clif_parse_PartyBookingRegisterReq,2,4); - //parseable_packet(0x0876,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0876,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0878,36,clif_parse_StoragePassword,0); parseable_packet(0x088A,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x089C,5,clif_parse_HomMenu,2,4); parseable_packet(0x08A5,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0940,6,clif_parse_TickSend,2); - //parseable_packet(0x094B,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x094B,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0953,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0966,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x096A,6,clif_parse_GetCharNameRequest,2); @@ -4393,7 +4393,7 @@ parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083C,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0867,6,clif_parse_DropItem,2,4); - //parseable_packet(0x086A,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x086A,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x086E,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0885,6,clif_parse_TickSend,2); parseable_packet(0x0888,2,clif_parse_SearchStoreInfoNextPage,0); @@ -4403,7 +4403,7 @@ parseable_packet(0x08A4,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x091D,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0923,8,clif_parse_MoveToKafra,2,4); - //parseable_packet(0x092E,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x092E,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0936,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0942,5,clif_parse_HomMenu,2,4); parseable_packet(0x0958,-1,clif_parse_ItemListWindowSelected,2,4,8,12); @@ -4416,7 +4416,7 @@ parseable_packet(0x035F,6,clif_parse_TickSend,2); parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); @@ -4435,7 +4435,7 @@ parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083C,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x0860,19,clif_parse_WantToConnection,2,6,10,14,18); - //parseable_packet(0x0881,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0881,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0890,36,clif_parse_StoragePassword,0); parseable_packet(0x091A,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0957,5,clif_parse_HomMenu,2,4); @@ -4465,8 +4465,8 @@ parseable_packet(0x0933,5,clif_parse_ChangeDir,2,4); parseable_packet(0x093E,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0941,6,clif_parse_ReqClickBuyingStore,2); - //parseable_packet(0x0946,4,NULL,0); // CZ_GANGSI_RANK - //parseable_packet(0x094E,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0946,4,nullptr,0); // CZ_GANGSI_RANK + //parseable_packet(0x094E,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0951,5,clif_parse_HomMenu,2,4); parseable_packet(0x0957,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0960,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); @@ -4491,12 +4491,12 @@ parseable_packet(0x083C,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x087D,36,clif_parse_StoragePassword,0); parseable_packet(0x0888,8,clif_parse_MoveFromKafra,2,4); - //parseable_packet(0x088A,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x088A,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x088D,6,clif_parse_TakeItem,2); parseable_packet(0x08A0,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x08A5,5,clif_parse_HomMenu,2,4); parseable_packet(0x092C,19,clif_parse_WantToConnection,2,6,10,14,18); - //parseable_packet(0x092E,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x092E,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0938,26,clif_parse_PartyInvite2,2); parseable_packet(0x0945,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x0946,26,clif_parse_FriendsListAdd,2); @@ -4507,7 +4507,7 @@ parseable_packet(0x02C4,8,clif_parse_MoveToKafra,2,4); parseable_packet(0x0363,26,clif_parse_PartyInvite2,2); parseable_packet(0x0811,19,clif_parse_WantToConnection,2,6,10,14,18); - //parseable_packet(0x0865,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0865,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x086B,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); parseable_packet(0x086D,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x0872,6,clif_parse_ReqClickBuyingStore,2); @@ -4521,7 +4521,7 @@ parseable_packet(0x08AC,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x091D,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0922,2,clif_parse_SearchStoreInfoNextPage,0); - //parseable_packet(0x0926,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0926,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0927,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x092C,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0935,6,clif_parse_TakeItem,2); @@ -4543,13 +4543,13 @@ parseable_packet(0x0360,6,clif_parse_ReqClickBuyingStore,2); parseable_packet(0x0361,5,clif_parse_HomMenu,2,4); parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); parseable_packet(0x0368,6,clif_parse_SolveCharName,2); parseable_packet(0x0369,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0436,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0436,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0437,5,clif_parse_WalkToXY,2); parseable_packet(0x0438,10,clif_parse_UseSkillToPos,2,4,6,8); parseable_packet(0x07E4,6,clif_parse_TakeItem,2); @@ -4582,9 +4582,9 @@ parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,0); parseable_packet(0x083C,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x085F,36,clif_parse_StoragePassword,0); - //parseable_packet(0x0868,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0868,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x086A,18,clif_parse_PartyBookingRegisterReq,2,4); - //parseable_packet(0x086F,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x086F,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x087A,26,clif_parse_PartyInvite2,2); parseable_packet(0x0888,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x0890,8,clif_parse_MoveFromKafra,2,4); @@ -4599,9 +4599,9 @@ #elif PACKETVER == 20180207 parseable_packet(0x0281,-1,clif_parse_ItemListWindowSelected,2,4,8,12); parseable_packet(0x035F,6,clif_parse_ReqClickBuyingStore,2); - //parseable_packet(0x0360,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0360,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0362,6,clif_parse_DropItem,2,4); - //parseable_packet(0x0363,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0363,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0364,8,clif_parse_MoveFromKafra,2,4); parseable_packet(0x0365,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0366,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); @@ -4641,7 +4641,7 @@ parseable_packet(0x088C,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); parseable_packet(0x0892,6,clif_parse_TakeItem,2); parseable_packet(0x0898,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); - //parseable_packet(0x089C,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x089C,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x08A3,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x08A5,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); parseable_packet(0x08A9,2,clif_parse_ReqCloseBuyingStore,0); @@ -4649,7 +4649,7 @@ parseable_packet(0x0917,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0922,5,clif_parse_WalkToXY,2); parseable_packet(0x0924,10,clif_parse_UseSkillToPos,2,4,6,8); - //parseable_packet(0x0926,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0926,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0933,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0936,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x093C,6,clif_parse_GetCharNameRequest,2); @@ -4660,7 +4660,7 @@ // 2018-02-21aRagexeRE or 2018-02-21bRagexeRE #elif PACKETVER == 20180221 parseable_packet(0x0202,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10); - //parseable_packet(0x0366,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0366,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0436,26,clif_parse_FriendsListAdd,2); parseable_packet(0x0838,5,clif_parse_ChangeDir,2,4); parseable_packet(0x0867,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15); @@ -4674,7 +4674,7 @@ parseable_packet(0x0881,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0883,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12); parseable_packet(0x088F,6,clif_parse_SolveCharName,2); - //parseable_packet(0x0891,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0891,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x0897,19,clif_parse_WantToConnection,2,6,10,14,18); parseable_packet(0x0899,2,clif_parse_SearchStoreInfoNextPage,0); parseable_packet(0x089D,6,clif_parse_TickSend,2); @@ -4714,17 +4714,17 @@ parseable_packet(0x0941,6,clif_parse_GetCharNameRequest,2); parseable_packet(0x0944,5,clif_parse_HomMenu,2,4); parseable_packet(0x0948,26,clif_parse_PartyInvite2,2); - //parseable_packet(0x0951,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x0951,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0954,6,clif_parse_TakeItem,2); parseable_packet(0x0957,6,clif_parse_SolveCharName,2); parseable_packet(0x0969,7,clif_parse_ActionRequest,2,6); - //parseable_packet(0x0281,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0281,4,nullptr,0); // CZ_GANGSI_RANK // Clients after 2018-03-07bRagexeRE do not have shuffled packets anymore #elif PACKETVER > 20180307 parseable_packet(0x0202,26,clif_parse_FriendsListAdd,2); parseable_packet(0x022D,5,clif_parse_HomMenu,2,4); parseable_packet(0x023B,36,clif_parse_StoragePassword,0); - //parseable_packet(0x0281,4,NULL,0); // CZ_GANGSI_RANK + //parseable_packet(0x0281,4,nullptr,0); // CZ_GANGSI_RANK parseable_packet(0x02C4,26,clif_parse_PartyInvite2,2); parseable_packet(0x035F,5,clif_parse_WalkToXY,2); parseable_packet(0x0360,6,clif_parse_TickSend,2); @@ -4749,7 +4749,7 @@ parseable_packet(0x0437,7,clif_parse_ActionRequest,2,6); parseable_packet(0x0438,10,clif_parse_UseSkillToId,2,4,6); parseable_packet(0x07E4,-1,clif_parse_ItemListWindowSelected,2,4,8,12); - //parseable_packet(0x07EC,8,NULL,0); // CZ_JOIN_BATTLE_FIELD + //parseable_packet(0x07EC,8,nullptr,0); // CZ_JOIN_BATTLE_FIELD parseable_packet(0x0802,18,clif_parse_PartyBookingRegisterReq,2,4); parseable_packet(0x0811,-1,clif_parse_ReqOpenBuyingStore,2,4,8,9,89); parseable_packet(0x0815,2,clif_parse_ReqCloseBuyingStore,0); diff --git a/src/map/date.cpp b/src/map/date.cpp index 178a17af88..310126479d 100644 --- a/src/map/date.cpp +++ b/src/map/date.cpp @@ -12,7 +12,7 @@ int date_get_year(void) { time_t t; struct tm * lt; - t = time(NULL); + t = time(nullptr); lt = localtime(&t); return lt->tm_year+1900; } @@ -24,7 +24,7 @@ enum e_month date_get_month(void) { time_t t; struct tm * lt; - t = time(NULL); + t = time(nullptr); lt = localtime(&t); return (enum e_month)(lt->tm_mon+1); } @@ -36,7 +36,7 @@ int date_get_dayofmonth(void) { time_t t; struct tm * lt; - t = time(NULL); + t = time(nullptr); lt = localtime(&t); return lt->tm_mday; } @@ -48,7 +48,7 @@ enum e_dayofweek date_get_dayofweek(void) { time_t t; struct tm * lt; - t = time(NULL); + t = time(nullptr); lt = localtime(&t); return (enum e_dayofweek)lt->tm_wday; } @@ -60,7 +60,7 @@ int date_get_dayofyear(void) { time_t t; struct tm * lt; - t = time(NULL); + t = time(nullptr); lt = localtime(&t); return lt->tm_yday; } @@ -72,7 +72,7 @@ int date_get_hour(void) { time_t t; struct tm * lt; - t = time(NULL); + t = time(nullptr); lt = localtime(&t); return lt->tm_hour; } @@ -84,7 +84,7 @@ int date_get_min(void) { time_t t; struct tm * lt; - t = time(NULL); + t = time(nullptr); lt = localtime(&t); return lt->tm_min; } @@ -96,7 +96,7 @@ int date_get_sec(void) { time_t t; struct tm * lt; - t = time(NULL); + t = time(nullptr); lt = localtime(&t); return lt->tm_sec; } diff --git a/src/map/elemental.cpp b/src/map/elemental.cpp index 457eba1b0e..d09ade8718 100644 --- a/src/map/elemental.cpp +++ b/src/map/elemental.cpp @@ -139,11 +139,11 @@ int elemental_create(map_session_data *sd, int class_, unsigned int lifetime) { } t_tick elemental_get_lifetime(s_elemental_data *ed) { - if( ed == NULL || ed->summon_timer == INVALID_TIMER ) + if( ed == nullptr || ed->summon_timer == INVALID_TIMER ) return 0; const struct TimerData * td = get_timer(ed->summon_timer); - return (td != NULL) ? DIFF_TICK(td->tick, gettick()) : 0; + return (td != nullptr) ? DIFF_TICK(td->tick, gettick()) : 0; } int elemental_save(s_elemental_data *ed) { @@ -167,12 +167,12 @@ int elemental_save(s_elemental_data *ed) { static TIMER_FUNC(elemental_summon_end){ map_session_data *sd; - if( (sd = map_id2sd(id)) == NULL ) + if( (sd = map_id2sd(id)) == nullptr ) return 1; s_elemental_data *ed; - if( (ed = sd->ed) == NULL ) + if( (ed = sd->ed) == nullptr ) return 1; if( ed->summon_timer != tid ) { @@ -205,7 +205,7 @@ int elemental_delete(s_elemental_data *ed) { if( !sd ) return unit_free(&ed->bl, CLR_OUTSIGHT); - sd->ed = NULL; + sd->ed = nullptr; sd->status.ele_id = 0; return unit_remove_map(&ed->bl, CLR_OUTSIGHT); @@ -228,7 +228,7 @@ int elemental_data_received(s_elemental *ele, bool flag) { map_session_data *sd; t_tick tick = gettick(); - if( (sd = map_charid2sd(ele->char_id)) == NULL ) + if( (sd = map_charid2sd(ele->char_id)) == nullptr ) return 0; std::shared_ptr db = elemental_db.find(ele->class_); @@ -277,7 +277,7 @@ int elemental_data_received(s_elemental *ele, bool flag) { sd->status.ele_id = ele->elemental_id; - if( ed->bl.prev == NULL && sd->bl.prev != NULL ) { + if( ed->bl.prev == nullptr && sd->bl.prev != nullptr ) { if(map_addblock(&ed->bl)) return 0; clif_spawn(&ed->bl); @@ -438,7 +438,7 @@ int elemental_change_mode(s_elemental_data *ed, int mode) { } void elemental_heal(s_elemental_data *ed, int hp, int sp) { - if (ed->master == NULL) + if (ed->master == nullptr) return; if( hp ) clif_elemental_updatestatus(ed->master, SP_HP); @@ -541,7 +541,7 @@ static int elemental_ai_sub_timer(s_elemental_data *ed, map_session_data *sd, t_ nullpo_ret(ed); nullpo_ret(sd); - if( ed->bl.prev == NULL || sd == NULL || sd->bl.prev == NULL ) + if( ed->bl.prev == nullptr || sd == nullptr || sd->bl.prev == nullptr ) return 0; // Check if caster can sustain the summoned elemental @@ -611,7 +611,7 @@ static int elemental_ai_sub_timer(s_elemental_data *ed, map_session_data *sd, t_ return 0; } - block_list *target = NULL; + block_list *target = nullptr; if( mode == EL_MODE_AGGRESSIVE ) { target = map_id2bl(ed->ud.target); diff --git a/src/map/guild.cpp b/src/map/guild.cpp index 78a15d6704..d963dad2da 100644 --- a/src/map/guild.cpp +++ b/src/map/guild.cpp @@ -219,12 +219,12 @@ static TBL_PC* guild_sd_check(int guild_id, uint32 account_id, uint32 char_id) { TBL_PC* sd = map_id2sd(account_id); if (!(sd && sd->status.char_id == char_id)) - return NULL; + return nullptr; if (sd->status.guild_id != guild_id) { //If player belongs to a different guild, kick him out. intif_guild_leave(guild_id,account_id,char_id,0,"** Guild Mismatch **"); - return NULL; + return nullptr; } return sd; @@ -575,8 +575,8 @@ std::shared_ptr CastleDatabase::find_by_clientid( uint16 client_id map_session_data* guild_getavailablesd(const struct mmo_guild &g) { int i; - ARR_FIND( 0, g.max_member, i, g.member[i].sd != NULL ); - return( i < g.max_member ) ? g.member[i].sd : NULL; + ARR_FIND( 0, g.max_member, i, g.member[i].sd != nullptr ); + return( i < g.max_member ) ? g.member[i].sd : nullptr; } /// lookup: player AID/CID -> member index @@ -616,7 +616,7 @@ void guild_makemember(struct guild_member *m,map_session_data *sd) { m->online = 1; m->position = MAX_GUILDPOSITION-1; safestrncpy(m->name,sd->status.name,NAME_LENGTH); - m->last_login = (uint32)time(NULL); + m->last_login = (uint32)time(nullptr); } /** @@ -663,7 +663,7 @@ int guild_send_xy_timer_sub(const struct mmo_guild& g) { for (int i = 0; i < g.max_member; i++) { map_session_data* sd = g.member[i].sd; - if( sd != NULL && sd->fd && (sd->guild_x != sd->bl.x || sd->guild_y != sd->bl.y) && !sd->bg_id ) { + if( sd != nullptr && sd->fd && (sd->guild_x != sd->bl.x || sd->guild_y != sd->bl.y) && !sd->bg_id ) { clif_guild_xy(sd); sd->guild_x = sd->bl.x; sd->guild_y = sd->bl.y; @@ -720,7 +720,7 @@ int guild_create(map_session_data *sd, const char *name) { int guild_created(uint32 account_id,int guild_id) { map_session_data *sd=map_id2sd(account_id); - if(sd==NULL) + if(sd==nullptr) return 0; if(!guild_id) { clif_guild_created(sd, 2); // Creation failure (presence of the same name Guild) @@ -792,7 +792,7 @@ int guild_check_member(const struct mmo_guild &g) { i = guild_getindex(g,sd->status.account_id,sd->status.char_id); if (i < 0) { - sd->guild = NULL; + sd->guild = nullptr; sd->status.guild_id=0; sd->guild_emblem_id=0; ShowWarning("guild: check_member %d[%s] is not member\n",sd->status.account_id,sd->status.name); @@ -835,7 +835,7 @@ int guild_recv_info(const struct mmo_guild &sg) { before = sg; //Perform the check on the user because the first load guild_check_member(sg); - if ((sd = map_nick2sd(sg.master,false)) != NULL) { + if ((sd = map_nick2sd(sg.master,false)) != nullptr) { #ifndef RENEWAL //If the guild master is online the first time the guild_info is received, //that means he was the first to join, so apply guild skill blocking here. @@ -865,14 +865,14 @@ int guild_recv_info(const struct mmo_guild &sg) { if (sd) clif_name_area(&sd->bl); // [LuzZza] m++; }else - g->guild.member[i].sd=NULL; + g->guild.member[i].sd=nullptr; if(before.member[i].account_id>0) bm++; } for (i = 0; i < g->guild.max_member; i++) { //Transmission of information at all members sd = g->guild.member[i].sd; - if( sd==NULL ) + if( sd==nullptr ) continue; sd->guild = g; if(channel_config.ally_tmpl.name[0] && (channel_config.ally_tmpl.opt&CHAN_OPT_AUTOJOIN)) { @@ -925,7 +925,7 @@ int guild_invite(map_session_data *sd, map_session_data *tsd) { auto &g = sd->guild; - if(tsd==NULL || g==NULL) + if(tsd==nullptr || g==nullptr) return 0; if( (i=guild_getposition(*sd))<0 || !(g->guild.position[i].mode&GUILD_PERM_INVITE) ) @@ -977,7 +977,7 @@ int guild_reply_invite(map_session_data* sd, int guild_id, int flag) { return 0; // mismatch // look up the person who sent the invite - //NOTE: this can be NULL because the person might have logged off in the meantime + //NOTE: this can be nullptr because the person might have logged off in the meantime tsd = map_id2sd(sd->guild_invite_account); if ( sd->status.guild_id > 0 ) { @@ -1058,7 +1058,7 @@ int guild_member_added(int guild_id,uint32 account_id,uint32 char_id,int flag) { if (!g) return 0; - if(sd==NULL || sd->guild_invite==0){ + if(sd==nullptr || sd->guild_invite==0){ // cancel if player not present or invalide guild_id invitation if (flag == 0) { ShowError("guild: member added error %d is not online\n",account_id); @@ -1071,7 +1071,7 @@ int guild_member_added(int guild_id,uint32 account_id,uint32 char_id,int flag) { sd->guild_invite_account = 0; if (flag == 1) { //failure - if( sd2!=NULL ) + if( sd2!=nullptr ) clif_guild_inviteack(sd2,3); return 0; } @@ -1086,7 +1086,7 @@ int guild_member_added(int guild_id,uint32 account_id,uint32 char_id,int flag) { //TODO: send new emblem info to others - if( sd2!=NULL ) + if( sd2!=nullptr ) clif_guild_inviteack(sd2,2); //Next line commented because it do nothing, look at guild_recv_info [LuzZza] @@ -1182,7 +1182,7 @@ int guild_member_withdraw(int guild_id, uint32 account_id, uint32 char_id, int f #endif online_member_sd = guild_getavailablesd(g->guild); - if(online_member_sd == NULL) + if(online_member_sd == nullptr) return 0; // noone online to inform @@ -1196,14 +1196,14 @@ int guild_member_withdraw(int guild_id, uint32 account_id, uint32 char_id, int f clif_guild_memberlist( *online_member_sd ); // update char, if online - if(sd != NULL && sd->status.guild_id == guild_id) { + if(sd != nullptr && sd->status.guild_id == guild_id) { // do stuff that needs the guild_id first, BEFORE we wipe it if (sd->state.storage_flag == 2) //Close the guild storage. storage_guild_storageclose(sd); guild_send_dot_remove(sd); channel_pcquit(sd,3); //leave guild and ally chan sd->status.guild_id = 0; - sd->guild = NULL; + sd->guild = nullptr; sd->guild_emblem_id = 0; if (g->instance_id) { @@ -1292,7 +1292,7 @@ int guild_send_memberinfoshort(map_session_data *sd,int online) { // cleaned up if(!online){ int i=guild_getindex(g->guild, sd->status.account_id,sd->status.char_id); if(i>=0) - g->guild.member[i].sd=NULL; + g->guild.member[i].sd=nullptr; else ShowError("guild_send_memberinfoshort: Failed to locate member %d:%d in guild %d!\n", sd->status.account_id, sd->status.char_id, g->guild.guild_id); return 0; @@ -1310,7 +1310,7 @@ int guild_recv_memberinfoshort(int guild_id,uint32 account_id,uint32 char_id,int int i,alv,c,idx=-1,om=0,oldonline=-1; auto g = guild_search(guild_id); - if(g == NULL) + if(g == nullptr) return 0; for(i=0,alv=0,c=0,om=0;iguild.max_member;i++){ @@ -1379,7 +1379,7 @@ int guild_send_message(map_session_data *sd, const char *mes, size_t len) { guild_recv_message(sd->status.guild_id,sd->status.account_id,mes,len); // Chat logging type 'G' / Guild Chat - log_chat(LOG_CHAT_GUILD, sd->status.guild_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes); + log_chat(LOG_CHAT_GUILD, sd->status.guild_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, nullptr, mes); return 0; } @@ -1411,7 +1411,7 @@ int guild_memberposition_changed(struct mmo_guild &g,int idx,int pos) { clif_guild_memberpositionchanged(g,idx); // Update char position in client [LuzZza] - if(g.member[idx].sd != NULL) + if(g.member[idx].sd != nullptr) clif_name_area(&g.member[idx].sd->bl); return 0; } @@ -1435,14 +1435,14 @@ int guild_change_position(int guild_id,int idx, int mode, int exp_mode, const ch int guild_position_changed(int guild_id,int idx,struct guild_position *p) { auto g = guild_search(guild_id); int i; - if(g==NULL) + if(g==nullptr) return 0; memcpy(&g->guild.position[idx],p,sizeof(struct guild_position)); clif_guild_positionchanged(g->guild,idx); // Update char name in client [LuzZza] for(i=0;iguild.max_member;i++) - if(g->guild.member[i].position == idx && g->guild.member[i].sd != NULL) + if(g->guild.member[i].position == idx && g->guild.member[i].sd != nullptr) clif_name_area(&g->guild.member[i].sd->bl); return 0; } @@ -1472,7 +1472,7 @@ int guild_notice_changed(int guild_id,const char *mes1,const char *mes2) { for(i=0;iguild.max_member;i++){ map_session_data *sd = g->guild.member[i].sd; - if(sd != NULL) + if(sd != nullptr) clif_guild_notice(sd); } return 0; @@ -1530,7 +1530,7 @@ int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data) { g->guild.emblem_id=emblem_id; for(i=0;iguild.max_member;i++){ - if((sd=g->guild.member[i].sd)!=NULL){ + if((sd=g->guild.member[i].sd)!=nullptr){ sd->guild_emblem_id=emblem_id; clif_guild_belonginfo( *sd ); clif_guild_emblem(*sd, g->guild); @@ -1544,8 +1544,8 @@ int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data) { // update permanent guardians for( i = 0; i < ARRAYLENGTH(it.second->guardian); ++i ) { - TBL_MOB* md = (it.second->guardian[i].id ? map_id2md(it.second->guardian[i].id) : NULL); - if( md == NULL || md->guardian_data == NULL ) + TBL_MOB* md = (it.second->guardian[i].id ? map_id2md(it.second->guardian[i].id) : nullptr); + if( md == nullptr || md->guardian_data == nullptr ) continue; md->guardian_data->emblem_id = emblem_id; clif_guild_emblem_area(&md->bl); @@ -1553,8 +1553,8 @@ int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data) { // update temporary guardians for( i = 0; i < it.second->temp_guardians_max; ++i ) { - TBL_MOB* md = (it.second->temp_guardians[i] ? map_id2md(it.second->temp_guardians[i]) : NULL); - if( md == NULL || md->guardian_data == NULL ) + TBL_MOB* md = (it.second->temp_guardians[i] ? map_id2md(it.second->temp_guardians[i]) : nullptr); + if( md == nullptr || md->guardian_data == nullptr ) continue; md->guardian_data->emblem_id = emblem_id; clif_guild_emblem_area(&md->bl); @@ -1624,7 +1624,7 @@ t_exp guild_getexp(map_session_data *sd,t_exp exp) { struct guild_expcache *c; nullpo_ret(sd); - if (sd->status.guild_id == 0 || sd->guild == NULL) + if (sd->status.guild_id == 0 || sd->guild == nullptr) return 0; c = (struct guild_expcache *)db_data2ptr(guild_expcache_db->ensure(guild_expcache_db, db_i2key(sd->status.char_id), create_expcache, sd)); @@ -1668,9 +1668,9 @@ int guild_skillupack(int guild_id,uint16 skill_id,uint32 account_id) { int i; short idx = guild_skill_get_index(skill_id); - if (g == NULL || idx == -1) + if (g == nullptr || idx == -1) return 0; - if (sd != NULL) { + if (sd != nullptr) { int lv = g->guild.skill[idx].lv; int range = skill_get_range(skill_id, lv); clif_skillup(sd,skill_id,lv,range,1); @@ -1688,7 +1688,7 @@ int guild_skillupack(int guild_id,uint16 skill_id,uint32 account_id) { // Inform all members for (i = 0; i < g->guild.max_member; i++) - if ((sd = g->guild.member[i].sd) != NULL) + if ((sd = g->guild.member[i].sd) != nullptr) clif_guild_skillinfo(sd); return 0; @@ -1711,7 +1711,7 @@ void guild_guildaura_refresh(map_session_data *sd, uint16 skill_id, uint16 skill std::shared_ptr group = skill_unitsetting(&sd->bl,skill_id,skill_lv,sd->bl.x,sd->bl.y,0); if( group ) - sc_start4(NULL,&sd->bl,type,100,(battle_config.guild_aura&16)?0:skill_lv,0,0,group->group_id,600000);//duration doesn't matter these status never end with val4 + sc_start4(nullptr,&sd->bl,type,100,(battle_config.guild_aura&16)?0:skill_lv,0,0,group->group_id,600000);//duration doesn't matter these status never end with val4 return; } @@ -1751,7 +1751,7 @@ int guild_check_alliance(int guild_id1, int guild_id2, int flag) { int i; auto g = guild_search(guild_id1); - if (g == NULL) + if (g == nullptr) return 0; ARR_FIND( 0, MAX_GUILDALLIANCE, i, g->guild.alliance[i].guild_id == guild_id2 && g->guild.alliance[i].opposition == flag ); @@ -1772,7 +1772,7 @@ int guild_reqalliance(map_session_data *sd,map_session_data *tsd) { nullpo_ret(sd); - if(tsd==NULL || tsd->status.guild_id<=0) + if(tsd==nullptr || tsd->status.guild_id<=0) return 0; // Check, is tsd guild master, if not - cancel alliance. [f0und3r] @@ -1784,7 +1784,7 @@ int guild_reqalliance(map_session_data *sd,map_session_data *tsd) { auto &g = sd->guild; auto &tg = tsd->guild; - if(g==NULL || tg==NULL) + if(g==nullptr || tg==nullptr) return 0; // Prevent creation alliance with same guilds [LuzZza] @@ -1873,7 +1873,7 @@ int guild_reply_reqalliance(map_session_data *sd,uint32 account_id,int flag) { } else { // deny sd->guild_alliance=0; sd->guild_alliance_account=0; - if(tsd!=NULL) + if(tsd!=nullptr) clif_guild_allianceack(tsd,3); } return 0; @@ -1903,7 +1903,7 @@ int guild_opposition(map_session_data *sd,map_session_data *tsd) { nullpo_ret(sd); auto &g = sd->guild; - if(g==NULL || tsd==NULL) + if(g==nullptr || tsd==nullptr) return 0; // Prevent creation opposition with same guilds [LuzZza] @@ -1956,21 +1956,21 @@ int guild_allianceack(int guild_id1,int guild_id2,uint32 account_id1,uint32 acco g[0] = &guild_search(guild_id1)->guild; g[1] = &guild_search(guild_id2)->guild; - if(sd[0]!=NULL && (flag&0x0f)==0){ + if(sd[0]!=nullptr && (flag&0x0f)==0){ sd[0]->guild_alliance=0; sd[0]->guild_alliance_account=0; } if (flag & 0x70) { // failure for(i=0;i<2-(flag&1);i++) - if( sd[i]!=NULL ) + if( sd[i]!=nullptr ) clif_guild_allianceack(sd[i],((flag>>4)==i+1)?3:4); return 0; } if (!(flag & 0x08)) { // new relationship for(i=0;i<2-(flag&1);i++) { - if(g[i]!=NULL) { + if(g[i]!=nullptr) { ARR_FIND( 0, MAX_GUILDALLIANCE, j, g[i]->alliance[j].guild_id == 0 ); if( j < MAX_GUILDALLIANCE ) { g[i]->alliance[j].guild_id=guild_id[1-i]; @@ -1981,31 +1981,31 @@ int guild_allianceack(int guild_id1,int guild_id2,uint32 account_id1,uint32 acco } } else { // remove relationship for(i=0;i<2-(flag&1);i++) { - if(g[i]!=NULL) { + if(g[i]!=nullptr) { for(j=0;jmax_member;j++) channel_pcquit(g[i]->member[j].sd,2); //leave all alliance chan ARR_FIND( 0, MAX_GUILDALLIANCE, j, g[i]->alliance[j].guild_id == guild_id[1-i] && g[i]->alliance[j].opposition == (flag&1) ); if( j < MAX_GUILDALLIANCE ) g[i]->alliance[j].guild_id = 0; } - if (sd[i] != NULL) // notify players + if (sd[i] != nullptr) // notify players clif_guild_delalliance(sd[i],guild_id[1-i],(flag&1)); } } if ((flag & 0x0f) == 0) { // alliance notification - if( sd[1]!=NULL ) + if( sd[1]!=nullptr ) clif_guild_allianceack(sd[1],2); } else if ((flag & 0x0f) == 1) { // enemy notification - if( sd[0]!=NULL ) + if( sd[0]!=nullptr ) clif_guild_oppositionack(sd[0],0); } for (i = 0; i < 2 - (flag & 1); i++) { // Retransmission of the relationship list to all members - if(g[i]!=NULL) + if(g[i]!=nullptr) for(j=0;jmax_member;j++) { map_session_data *sd_mem = g[i]->member[j].sd; - if( sd_mem!=NULL){ + if( sd_mem!=nullptr){ clif_guild_allianceinfo(sd_mem); // join ally channel @@ -2061,16 +2061,16 @@ int guild_broken(int guild_id,int flag) { auto g = guild_search(guild_id); int i; - if (flag != 0 || g == NULL) + if (flag != 0 || g == nullptr) return 0; for (i = 0; i < g->guild.max_member; i++){ // Destroy all relationships map_session_data *sd = g->guild.member[i].sd; - if(sd != NULL){ + if(sd != nullptr){ if(sd->state.storage_flag == 2) storage_guild_storage_quit(sd,1); sd->status.guild_id=0; - sd->guild = NULL; + sd->guild = nullptr; sd->state.gmaster_flag = 0; clif_guild_broken(g->guild.member[i].sd,0); clif_name_area(&sd->bl); // [LuzZza] @@ -2293,7 +2293,7 @@ int guild_castledatasave(int castle_id, int index, int value) { gc->guild_id = value; for (i = 0; i < MAX_GUARDIANS; i++){ struct mob_data *gd; - if (gc->guardian[i].visible && (gd = map_id2md(gc->guardian[i].id)) != NULL) + if (gc->guardian[i].visible && (gd = map_id2md(gc->guardian[i].id)) != nullptr) mob_guardian_guildchange(gd); } break; @@ -2306,7 +2306,7 @@ int guild_castledatasave(int castle_id, int index, int value) { gc->defense = value; for (i = 0; i < MAX_GUARDIANS; i++){ struct mob_data *gd; - if (gc->guardian[i].visible && (gd = map_id2md(gc->guardian[i].id)) != NULL) + if (gc->guardian[i].visible && (gd = map_id2md(gc->guardian[i].id)) != nullptr) status_calc_mob(gd, SCO_NONE); } break; @@ -2354,7 +2354,7 @@ void guild_castle_reconnect_sub(void *key, void *data, va_list ap) { * @param value */ void guild_castle_reconnect(int castle_id, int index, int value) { - static struct linkdb_node *gc_save_pending = NULL; + static struct linkdb_node *gc_save_pending = nullptr; if (castle_id < 0) { // char-server reconnected linkdb_foreach(&gc_save_pending, guild_castle_reconnect_sub); @@ -2552,14 +2552,14 @@ void guild_flag_remove(struct npc_data *nd) { /* find it */ for( i = 0; i < guild_flags_count; i++ ) { if( guild_flags[i] && guild_flags[i]->bl.id == nd->bl.id ) {/* found */ - guild_flags[i] = NULL; + guild_flags[i] = nullptr; break; } } /* compact list */ for( i = 0, cursor = 0; i < guild_flags_count; i++ ) { - if( guild_flags[i] == NULL ) + if( guild_flags[i] == nullptr ) continue; if( cursor != i ) { @@ -2574,9 +2574,9 @@ void guild_flag_remove(struct npc_data *nd) { * @see DBApply */ static int eventlist_db_final(DBKey key, DBData *data, va_list ap) { - struct eventlist *next = NULL; + struct eventlist *next = nullptr; struct eventlist *current = (struct eventlist *)db_data2ptr(data); - while (current != NULL) { + while (current != nullptr) { next = current->next; aFree(current); current = next; @@ -2597,7 +2597,7 @@ void guild_flags_clear(void) { int i; for( i = 0; i < guild_flags_count; i++ ) { if( guild_flags[i] ) - guild_flags[i] = NULL; + guild_flags[i] = nullptr; } guild_flags_count = 0; diff --git a/src/map/homunculus.cpp b/src/map/homunculus.cpp index 144d452538..a64fdb389c 100644 --- a/src/map/homunculus.cpp +++ b/src/map/homunculus.cpp @@ -130,7 +130,7 @@ struct view_data* hom_get_viewdata(int class_) { //Returns the viewdata for homunculus if (homdb_checkid(class_)) return &hom_viewdb[class_-HM_CLASS_BASE]; - return NULL; + return nullptr; } /** @@ -840,7 +840,7 @@ void hom_save(struct homun_data *hd) void hom_menu(map_session_data *sd, int type) { nullpo_retv(sd); - if (sd->hd == NULL) + if (sd->hd == nullptr) return; switch(type) { @@ -1124,7 +1124,7 @@ bool hom_call(map_session_data *sd) hom_init_timers(hd); hd->homunculus.vaporize = HOM_ST_ACTIVE; - if (hd->bl.prev == NULL) + if (hd->bl.prev == nullptr) { //Spawn him hd->bl.x = sd->bl.x; hd->bl.y = sd->bl.y; @@ -1191,7 +1191,7 @@ int hom_recv_data(uint32 account_id, struct s_homunculus *sh, int flag) if (created) status_percent_heal(&hd->bl, 100, 100); - if(hd && hd->homunculus.hp && !hd->homunculus.vaporize && hd->bl.prev == NULL && sd->bl.prev != NULL) + if(hd && hd->homunculus.hp && !hd->homunculus.vaporize && hd->bl.prev == nullptr && sd->bl.prev != nullptr) { if(map_addblock(&hd->bl)) return 0; diff --git a/src/map/instance.cpp b/src/map/instance.cpp index e6e034abb9..d75a6abb65 100644 --- a/src/map/instance.cpp +++ b/src/map/instance.cpp @@ -1024,7 +1024,7 @@ bool instance_destroy(int instance_id) if( idata->regs.vars ) { db_destroy(idata->regs.vars); - idata->regs.vars = NULL; + idata->regs.vars = nullptr; } if( idata->regs.arrays ) diff --git a/src/map/intif.cpp b/src/map/intif.cpp index 7722241a82..5acede764c 100644 --- a/src/map/intif.cpp +++ b/src/map/intif.cpp @@ -60,18 +60,18 @@ extern int char_fd; // inter server Fd used for char_fd */ int CheckForCharServer(void) { - return ((char_fd <= 0) || session[char_fd] == NULL || session[char_fd]->wdata == NULL); + return ((char_fd <= 0) || session[char_fd] == nullptr || session[char_fd]->wdata == nullptr); } /** * Get sd from pc_db (map_id2db) or auth_db (in case if parsing packet from inter-server when sd not added to pc_db yet) * @param account_id * @param char_id - * @return sd Found sd or NULL if not found + * @return sd Found sd or nullptr if not found */ map_session_data *inter_search_sd(uint32 account_id, uint32 char_id) { - map_session_data *sd = NULL; + map_session_data *sd = nullptr; struct auth_node *node = chrif_auth_check(account_id, char_id, ST_LOGIN); if (node) sd = node->sd; @@ -213,7 +213,7 @@ int intif_broadcast(const char* mes, int len, int type) int lp = (type|BC_COLOR_MASK) ? 4 : 0; // Send to the local players - clif_broadcast(NULL, mes, len, type, ALL_CLIENT); + clif_broadcast(nullptr, mes, len, type, ALL_CLIENT); if (CheckForCharServer()) return 0; @@ -256,7 +256,7 @@ int intif_broadcast2(const char* mes, int len, unsigned long fontColor, short fo return 0; // Send to the local players - clif_broadcast2(NULL, mes, len, fontColor, fontType, fontSize, fontAlign, fontY, ALL_CLIENT); + clif_broadcast2(nullptr, mes, len, fontColor, fontType, fontSize, fontAlign, fontY, ALL_CLIENT); if (CheckForCharServer()) return 0; @@ -296,7 +296,7 @@ int intif_main_message(map_session_data* sd, const char* message) intif_broadcast2( output, strlen(output) + 1, 0xFE000000, 0, 0, 0, 0 ); // log the chat message - log_chat( LOG_CHAT_MAINCHAT, 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, message ); + log_chat( LOG_CHAT_MAINCHAT, 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, nullptr, message ); return 1; } @@ -415,8 +415,8 @@ int intif_saveregistry(map_session_data *sd) iter = db_iterator(sd->regs.vars); for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) ) { - const char *varname = NULL; - struct script_reg_state *src = NULL; + const char *varname = nullptr; + struct script_reg_state *src = nullptr; bool lValid = false; if( data->type != DB_DATA_PTR ) // it's a @number @@ -1290,7 +1290,7 @@ int intif_parse_WisMessage(int fd) safestrncpy(name, RFIFOCP(fd,12+NAME_LENGTH), NAME_LENGTH); sd = map_nick2sd(name,false); - if(sd == NULL || strcmp(sd->status.name, name) != 0) + if(sd == nullptr || strcmp(sd->status.name, name) != 0) { //Not found intif_wis_reply(id,1); return 0; @@ -1328,7 +1328,7 @@ int intif_parse_WisEnd(int fd) if (battle_config.etc_log) ShowInfo("intif_parse_wisend: player: %s, flag: %d\n", RFIFOP(fd,2), RFIFOB(fd,26)); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target sd = (map_session_data *)map_nick2sd(RFIFOCP(fd,2),false); - if (sd != NULL) + if (sd != nullptr) clif_wis_end(sd->fd, RFIFOB(fd,26)); return 1; @@ -1450,7 +1450,7 @@ void intif_parse_Registers(int fd) safestrncpy(sval, RFIFOCP(fd, cursor + 1), RFIFOB(fd, cursor)); cursor += RFIFOB(fd, cursor) + 1; - set_reg_str( NULL, sd, reference_uid( add_str( key ), index ), key, sval, NULL ); + set_reg_str( nullptr, sd, reference_uid( add_str( key ), index ), key, sval, nullptr ); } /** * Vessel! @@ -1470,7 +1470,7 @@ void intif_parse_Registers(int fd) ival = RFIFOQ(fd, cursor); cursor += 8; - set_reg_num( NULL, sd, reference_uid( add_str( key ), index ), key, ival, NULL ); + set_reg_num( nullptr, sd, reference_uid( add_str( key ), index ), key, ival, nullptr ); } } } @@ -1499,7 +1499,7 @@ int intif_parse_LoadGuildStorage(int fd) sd = map_id2sd( RFIFOL(fd,4) ); if (flag){ //If flag != 0, we attach a player and open the storage - if(sd == NULL){ + if(sd == nullptr){ ShowError("intif_parse_LoadGuildStorage: user not found (AID: %d)\n",RFIFOL(fd,4)); return 0; } @@ -1732,7 +1732,7 @@ int intif_parse_GuildBasicInfoChanged(int fd) //void* data = RFIFOP(fd,10); auto g = guild_search(guild_id); - if( g == NULL ) + if( g == nullptr ) return 0; switch(type) { @@ -1941,8 +1941,8 @@ int intif_parse_DeletePetOk(int fd) */ int intif_parse_ChangeNameOk(int fd) { - map_session_data *sd = NULL; - if((sd=map_id2sd(RFIFOL(fd,2)))==NULL || + map_session_data *sd = nullptr; + if((sd=map_id2sd(RFIFOL(fd,2)))==nullptr || sd->status.char_id != RFIFOL(fd,6)) return 0; @@ -2064,7 +2064,7 @@ void intif_parse_questlog(int fd) if(num_received == 0) { if(sd->quest_log) { aFree(sd->quest_log); - sd->quest_log = NULL; + sd->quest_log = nullptr; } } else { struct quest *received = (struct quest *)RFIFOP(fd,8); @@ -2171,7 +2171,7 @@ void intif_parse_achievements(int fd) if (num_received == 0) { if (sd->achievement_data.achievements) { aFree(sd->achievement_data.achievements); - sd->achievement_data.achievements = NULL; + sd->achievement_data.achievements = nullptr; sd->achievement_data.incompleteCount = 0; sd->achievement_data.count = 0; } @@ -2215,7 +2215,7 @@ void intif_parse_achievements(int fd) achievement_level(sd, false); // Calculate level info but don't give any AG_GOAL_ACHIEVE achievements achievement_get_titles(sd->status.char_id); // Populate the title list for completed achievements - clif_achievement_update(sd, NULL, 0); + clif_achievement_update(sd, nullptr, 0); clif_achievement_list_all(sd); } @@ -2338,7 +2338,7 @@ int intif_parse_Mail_inboxreceived(int fd) sd = map_charid2sd(RFIFOL(fd,4)); - if (sd == NULL) + if (sd == nullptr) { ShowError("intif_parse_Mail_inboxreceived: char not found %d\n",RFIFOL(fd,4)); return 0; @@ -2356,7 +2356,7 @@ int intif_parse_Mail_inboxreceived(int fd) #if PACKETVER >= 20150513 // Refresh top right icon - clif_Mail_new(sd, 0, NULL, NULL); + clif_Mail_new(sd, 0, nullptr, nullptr); #endif if (flag){ @@ -2428,7 +2428,7 @@ int intif_parse_Mail_getattach(int fd) sd = map_charid2sd( RFIFOL(fd,4) ); - if (sd == NULL) + if (sd == nullptr) { ShowError("intif_parse_Mail_getattach: char not found %d\n",RFIFOL(fd,4)); return 0; @@ -2480,7 +2480,7 @@ int intif_parse_Mail_delete(int fd) bool failed = RFIFOB(fd,10) > 0; map_session_data *sd = map_charid2sd(char_id); - if (sd == NULL) + if (sd == nullptr) { ShowError("intif_parse_Mail_delete: char not found %d\n", char_id); return 0; @@ -2540,7 +2540,7 @@ int intif_parse_Mail_return(int fd) int mail_id = RFIFOL(fd,6); short fail = RFIFOB(fd,10); - if( sd == NULL ) + if( sd == nullptr ) { ShowError("intif_parse_Mail_return: char not found %d\n",RFIFOL(fd,2)); return 1; @@ -2613,7 +2613,7 @@ static void intif_parse_Mail_send(int fd) // notify sender sd = map_charid2sd(msg.send_id); - if( sd != NULL ) + if( sd != nullptr ) { if( fail ) mail_deliveryfail(sd, &msg); @@ -2637,7 +2637,7 @@ static void intif_parse_Mail_new(int fd) const char* sender_name = RFIFOCP(fd,10); const char* title = RFIFOCP(fd,34); - if( sd == NULL ) + if( sd == nullptr ) return; sd->mail.changed = true; sd->mail.inbox.unread++; @@ -2667,7 +2667,7 @@ bool intif_mail_checkreceiver( map_session_data* sd, char* name ){ sd->mail.dest_id = 0; // If the target player is online on this map-server - if( tsd != NULL ){ + if( tsd != nullptr ){ clif_Mail_Receiver_Ack( sd, tsd->status.char_id, tsd->status.class_, tsd->status.base_level, name ); sd->mail.dest_id = tsd->status.char_id; return true; @@ -2730,7 +2730,7 @@ static void intif_parse_Auction_results(int fd) short pages = RFIFOW(fd,10); uint8* data = RFIFOP(fd,12); - if( sd == NULL ) + if( sd == nullptr ) return; clif_Auction_results(sd, count, pages, data); @@ -2773,7 +2773,7 @@ static void intif_parse_Auction_register(int fd) } memcpy(&auction, RFIFOP(fd,4), sizeof(struct auction_data)); - if( (sd = map_charid2sd(auction.seller_id)) == NULL ) + if( (sd = map_charid2sd(auction.seller_id)) == nullptr ) return; if( auction.auction_id > 0 ) @@ -2822,7 +2822,7 @@ static void intif_parse_Auction_cancel(int fd) map_session_data *sd = map_charid2sd(RFIFOL(fd,2)); int result = RFIFOB(fd,6); - if( sd == NULL ) + if( sd == nullptr ) return; switch( result ) @@ -2863,7 +2863,7 @@ static void intif_parse_Auction_close(int fd) map_session_data *sd = map_charid2sd(RFIFOL(fd,2)); unsigned char result = RFIFOB(fd,6); - if( sd == NULL ) + if( sd == nullptr ) return; clif_Auction_close(sd->fd, result); @@ -2913,7 +2913,7 @@ static void intif_parse_Auction_bid(int fd) int bid = RFIFOL(fd,6); unsigned char result = RFIFOB(fd,10); - if( sd == NULL ) + if( sd == nullptr ) return; clif_Auction_message(sd->fd, result); @@ -2937,7 +2937,7 @@ static void intif_parse_Auction_message(int fd) map_session_data *sd = map_charid2sd(RFIFOL(fd,2)); unsigned char result = RFIFOB(fd,6); - if( sd == NULL ) + if( sd == nullptr ) return; clif_Auction_message(sd->fd, result); @@ -3740,7 +3740,7 @@ int intif_clan_member_joined( int clan_id ){ int intif_parse_clan_onlinecount( int fd ){ struct clan* clan = clan_search(RFIFOL(fd,2)); - if( clan == NULL ){ + if( clan == nullptr ){ return 0; } @@ -3784,9 +3784,9 @@ int intif_parse(int fd) switch(cmd){ case 0x3800: if (RFIFOL(fd,4) == 0xFF000000) //Normal announce. - clif_broadcast(NULL, RFIFOCP(fd,16), packet_len-16, BC_DEFAULT, ALL_CLIENT); + clif_broadcast(nullptr, RFIFOCP(fd,16), packet_len-16, BC_DEFAULT, ALL_CLIENT); else //Color announce. - clif_broadcast2(NULL, RFIFOCP(fd,16), packet_len-16, RFIFOL(fd,4), RFIFOW(fd,8), RFIFOW(fd,10), RFIFOW(fd,12), RFIFOW(fd,14), ALL_CLIENT); + clif_broadcast2(nullptr, RFIFOCP(fd,16), packet_len-16, RFIFOL(fd,4), RFIFOW(fd,8), RFIFOW(fd,10), RFIFOW(fd,12), RFIFOW(fd,14), ALL_CLIENT); break; case 0x3801: intif_parse_WisMessage(fd); break; case 0x3802: intif_parse_WisEnd(fd); break; diff --git a/src/map/itemdb.cpp b/src/map/itemdb.cpp index d55c4a7af0..f876249421 100644 --- a/src/map/itemdb.cpp +++ b/src/map/itemdb.cpp @@ -2883,7 +2883,7 @@ std::shared_ptr get_random_itemsubgroup(std::shared_ptr ItemGroupDatabase::get_random_entry(uint16 group_id, uint8 sub_group) { std::shared_ptr group = this->find(group_id); @@ -2930,7 +2930,7 @@ static void itemdb_pc_get_itemgroup_sub(map_session_data *sd, bool identify, std tmp.nameid = data->nameid; tmp.bound = data->bound; tmp.identify = identify ? identify : itemdb_isidentified(data->nameid); - tmp.expire_time = (data->duration) ? (unsigned int)(time(NULL) + data->duration*60) : 0; + tmp.expire_time = (data->duration) ? (unsigned int)(time(nullptr) + data->duration*60) : 0; if (data->isNamed) { tmp.card[0] = itemdb_isequip(data->nameid) ? CARD0_FORGE : CARD0_CREATE; tmp.card[1] = 0; @@ -3019,7 +3019,7 @@ uint8 ItemGroupDatabase::pc_get_itemgroup(uint16 group_id, bool identify, map_se /** Searches for the item_data. Use this to check if item exists or not. * @param nameid -* @return *item_data if item is exist, or NULL if not +* @return *item_data if item is exist, or nullptr if not */ std::shared_ptr itemdb_exists(t_itemid nameid) { return item_db.find(nameid); @@ -3757,10 +3757,10 @@ bool itemdb_parse_roulette_db(void) unsigned short amount; int level, flag; - Sql_GetData(mmysql_handle, 1, &data, NULL); level = atoi(data); - Sql_GetData(mmysql_handle, 2, &data, NULL); item_id = strtoul(data, nullptr, 10); - Sql_GetData(mmysql_handle, 3, &data, NULL); amount = atoi(data); - Sql_GetData(mmysql_handle, 4, &data, NULL); flag = atoi(data); + Sql_GetData(mmysql_handle, 1, &data, nullptr); level = atoi(data); + Sql_GetData(mmysql_handle, 2, &data, nullptr); item_id = strtoul(data, nullptr, 10); + Sql_GetData(mmysql_handle, 3, &data, nullptr); amount = atoi(data); + Sql_GetData(mmysql_handle, 4, &data, nullptr); flag = atoi(data); if (!item_db.exists(item_id)) { ShowWarning("itemdb_parse_roulette_db: Unknown item ID '%u' in level '%d'\n", item_id, level); @@ -3839,9 +3839,9 @@ static void itemdb_roulette_free(void) { aFree(rd.qty[i]); if (rd.flag[i]) aFree(rd.flag[i]); - rd.nameid[i] = NULL; - rd.qty[i] = NULL; - rd.flag[i] = NULL; + rd.nameid[i] = nullptr; + rd.qty[i] = nullptr; + rd.flag[i] = nullptr; rd.items[i] = 0; } } diff --git a/src/map/log.cpp b/src/map/log.cpp index 2c13785fe6..5b1428c86f 100644 --- a/src/map/log.cpp +++ b/src/map/log.cpp @@ -196,7 +196,7 @@ void log_branch(map_session_data* sd) time_t curtime; FILE* logfp; - if( ( logfp = fopen(log_config.log_branch, "a") ) == NULL ) + if( ( logfp = fopen(log_config.log_branch, "a") ) == nullptr ) return; time(&curtime); strftime(timestring, sizeof(timestring), log_timestamp_format, localtime(&curtime)); @@ -253,7 +253,7 @@ void log_pick(int id, int16 m, e_log_pick_type type, int amount, struct item* it time_t curtime; FILE* logfp; - if( ( logfp = fopen(log_config.log_pick, "a") ) == NULL ) + if( ( logfp = fopen(log_config.log_pick, "a") ) == nullptr ) return; time(&curtime); strftime(timestring, sizeof(timestring), log_timestamp_format, localtime(&curtime)); @@ -299,7 +299,7 @@ void log_zeny(const map_session_data &target_sd, e_log_pick_type type, uint32 sr time_t curtime; FILE* logfp; - if( ( logfp = fopen(log_config.log_zeny, "a") ) == NULL ) + if( ( logfp = fopen(log_config.log_zeny, "a") ) == nullptr ) return; time(&curtime); strftime(timestring, sizeof(timestring), log_timestamp_format, localtime(&curtime)); @@ -332,7 +332,7 @@ void log_mvpdrop(map_session_data* sd, int monster_id, t_itemid nameid, t_exp ex time_t curtime; FILE* logfp; - if( ( logfp = fopen(log_config.log_mvpdrop,"a") ) == NULL ) + if( ( logfp = fopen(log_config.log_mvpdrop,"a") ) == nullptr ) return; time(&curtime); strftime(timestring, sizeof(timestring), log_timestamp_format, localtime(&curtime)); @@ -373,7 +373,7 @@ void log_atcommand(map_session_data* sd, const char* message) time_t curtime; FILE* logfp; - if( ( logfp = fopen(log_config.log_gm, "a") ) == NULL ) + if( ( logfp = fopen(log_config.log_gm, "a") ) == nullptr ) return; time(&curtime); strftime(timestring, sizeof(timestring), log_timestamp_format, localtime(&curtime)); @@ -410,7 +410,7 @@ void log_npc( struct npc_data* nd, const char* message ){ time_t curtime; FILE* logfp; - if( ( logfp = fopen(log_config.log_npc, "a") ) == NULL ) + if( ( logfp = fopen(log_config.log_npc, "a") ) == nullptr ) return; time(&curtime); strftime(timestring, sizeof(timestring), log_timestamp_format, localtime(&curtime)); @@ -448,7 +448,7 @@ void log_npc(map_session_data* sd, const char* message) time_t curtime; FILE* logfp; - if( ( logfp = fopen(log_config.log_npc, "a") ) == NULL ) + if( ( logfp = fopen(log_config.log_npc, "a") ) == nullptr ) return; time(&curtime); strftime(timestring, sizeof(timestring), log_timestamp_format, localtime(&curtime)); @@ -496,7 +496,7 @@ void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid, time_t curtime; FILE* logfp; - if( ( logfp = fopen(log_config.log_chat, "a") ) == NULL ) + if( ( logfp = fopen(log_config.log_chat, "a") ) == nullptr ) return; time(&curtime); strftime(timestring, sizeof(timestring), log_timestamp_format, localtime(&curtime)); @@ -524,7 +524,7 @@ void log_cash( map_session_data* sd, e_log_pick_type type, e_log_cash_type cash_ time_t curtime; FILE* logfp; - if( ( logfp = fopen( log_config.log_cash, "a" ) ) == NULL ) + if( ( logfp = fopen( log_config.log_cash, "a" ) ) == nullptr ) return; time( &curtime ); strftime( timestring, sizeof( timestring ), log_timestamp_format, localtime( &curtime ) ); @@ -577,7 +577,7 @@ void log_feeding(map_session_data *sd, e_log_feeding_type type, t_itemid nameid) time_t curtime; FILE* logfp; - if ((logfp = fopen(log_config.log_feeding, "a")) == NULL) + if ((logfp = fopen(log_config.log_feeding, "a")) == nullptr) return; time(&curtime); strftime(timestring, sizeof(timestring), log_timestamp_format, localtime(&curtime)); @@ -609,7 +609,7 @@ int log_config_read(const char* cfgName) if( count++ == 0 ) log_set_defaults(); - if( ( fp = fopen(cfgName, "r") ) == NULL ) + if( ( fp = fopen(cfgName, "r") ) == nullptr ) { ShowError("Log configuration file not found at: %s\n", cfgName); return 1; diff --git a/src/map/mail.cpp b/src/map/mail.cpp index 8005f8c599..ade79fbf0a 100644 --- a/src/map/mail.cpp +++ b/src/map/mail.cpp @@ -477,7 +477,7 @@ void mail_send(map_session_data *sd, const char *dest_name, const char *title, c mail_refresh_remaining_amount(sd); // After calling mail_refresh_remaining_amount the status should always be there - if( sd->sc.getSCE(SC_DAILYSENDMAILCNT) == NULL || sd->sc.getSCE(SC_DAILYSENDMAILCNT)->val2 >= battle_config.mail_daily_count ){ + if( sd->sc.getSCE(SC_DAILYSENDMAILCNT) == nullptr || sd->sc.getSCE(SC_DAILYSENDMAILCNT)->val2 >= battle_config.mail_daily_count ){ clif_Mail_send(sd, WRITE_MAIL_FAILED_CNT); return; }else{ @@ -516,7 +516,7 @@ void mail_send(map_session_data *sd, const char *dest_name, const char *title, c else memset(msg.body, 0x00, MAIL_BODY_LENGTH); - msg.timestamp = time(NULL); + msg.timestamp = time(nullptr); if( !intif_Mail_send(sd->status.account_id, &msg) ) mail_deliveryfail(sd, &msg); @@ -529,7 +529,7 @@ void mail_refresh_remaining_amount( map_session_data* sd ){ nullpo_retv(sd); // If it was not yet started or it was started on another day - if( sd->sc.getSCE(SC_DAILYSENDMAILCNT) == NULL || sd->sc.getSCE(SC_DAILYSENDMAILCNT)->val1 != doy ){ + if( sd->sc.getSCE(SC_DAILYSENDMAILCNT) == nullptr || sd->sc.getSCE(SC_DAILYSENDMAILCNT)->val1 != doy ){ sc_start2( &sd->bl, &sd->bl, SC_DAILYSENDMAILCNT, 100, doy, 0, INFINITE_TICK ); } } diff --git a/src/map/map.cpp b/src/map/map.cpp index 0f12974904..7183b7fb2c 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -105,15 +105,15 @@ Sql* logmysql_handle; struct inter_conf inter_config {}; // DBMap declaration -static DBMap* id_db=NULL; /// int id -> struct block_list* -static DBMap* pc_db=NULL; /// int id -> map_session_data* -static DBMap* mobid_db=NULL; /// int id -> struct mob_data* -static DBMap* bossid_db=NULL; /// int id -> struct mob_data* (MVP db) -static DBMap* map_db=NULL; /// unsigned int mapindex -> struct map_data* -static DBMap* nick_db=NULL; /// uint32 char_id -> struct charid2nick* (requested names of offline characters) -static DBMap* charid_db=NULL; /// uint32 char_id -> map_session_data* -static DBMap* regen_db=NULL; /// int id -> struct block_list* (status_natural_heal processing) -static DBMap* map_msg_db=NULL; +static DBMap* id_db=nullptr; /// int id -> struct block_list* +static DBMap* pc_db=nullptr; /// int id -> map_session_data* +static DBMap* mobid_db=nullptr; /// int id -> struct mob_data* +static DBMap* bossid_db=nullptr; /// int id -> struct mob_data* (MVP db) +static DBMap* map_db=nullptr; /// unsigned int mapindex -> struct map_data* +static DBMap* nick_db=nullptr; /// uint32 char_id -> struct charid2nick* (requested names of offline characters) +static DBMap* charid_db=nullptr; /// uint32 char_id -> map_session_data* +static DBMap* regen_db=nullptr; /// int id -> struct block_list* (status_natural_heal processing) +static DBMap* map_msg_db=nullptr; static int map_users=0; @@ -238,7 +238,7 @@ int map_freeblock (struct block_list *bl) if (block_free_lock == 0 || block_free_count >= block_free_max) { aFree(bl); - bl = NULL; + bl = nullptr; if (block_free_count >= block_free_max) ShowWarning("map_freeblock: too many free block! %d %d\n", block_free_count, block_free_lock); } else @@ -264,7 +264,7 @@ int map_freeblock_unlock (void) for (i = 0; i < block_free_count; i++) { aFree(block_free[i]); - block_free[i] = NULL; + block_free[i] = nullptr; } block_free_count = 0; } else if (block_free_lock < 0) { @@ -332,8 +332,8 @@ int map_addblock(struct block_list* bl) nullpo_ret(bl); - if (bl->prev != NULL) { - ShowError("map_addblock: bl->prev != NULL\n"); + if (bl->prev != nullptr) { + ShowError("map_addblock: bl->prev != nullptr\n"); return 1; } @@ -388,10 +388,10 @@ int map_delblock(struct block_list* bl) nullpo_ret(bl); // blocklist (2ways chainlist) - if (bl->prev == NULL) { - if (bl->next != NULL) { + if (bl->prev == nullptr) { + if (bl->next != nullptr) { // can't delete block (already at the beginning of the chain) - ShowError("map_delblock error : bl->next!=NULL\n"); + ShowError("map_delblock error : bl->next!=nullptr\n"); } return 0; } @@ -420,8 +420,8 @@ int map_delblock(struct block_list* bl) } else { bl->prev->next = bl->next; } - bl->next = NULL; - bl->prev = NULL; + bl->next = nullptr; + bl->prev = nullptr; return 0; } @@ -441,7 +441,7 @@ int map_moveblock(struct block_list *bl, int x1, int y1, t_tick tick) nullpo_ret(bl); int x0 = bl->x, y0 = bl->y; - status_change *sc = NULL; + status_change *sc = nullptr; int moveblock = ( x0/BLOCK_SIZE != x1/BLOCK_SIZE || y0/BLOCK_SIZE != y1/BLOCK_SIZE); if (!bl->prev) { @@ -494,7 +494,7 @@ int map_moveblock(struct block_list *bl, int x1, int y1, t_tick tick) if( bl->type == BL_PC && ((TBL_PC*)bl)->shadowform_id ) {//Shadow Form Target Moving struct block_list *d_bl; - if( (d_bl = map_id2bl(((TBL_PC*)bl)->shadowform_id)) == NULL || !check_distance_bl(bl,d_bl,10) ) { + if( (d_bl = map_id2bl(((TBL_PC*)bl)->shadowform_id)) == nullptr || !check_distance_bl(bl,d_bl,10) ) { if( d_bl ) status_change_end(d_bl,SC__SHADOWFORM); ((TBL_PC*)bl)->shadowform_id = 0; @@ -505,7 +505,7 @@ int map_moveblock(struct block_list *bl, int x1, int y1, t_tick tick) if (sc->getSCE(SC_DANCING)) skill_unit_move_unit_group(skill_id2group(sc->getSCE(SC_DANCING)->val2), bl->m, x1-x0, y1-y0); else { - if (sc->getSCE(SC_CLOAKING) && sc->getSCE(SC_CLOAKING)->val1 < 3 && !skill_check_cloaking(bl, NULL)) + if (sc->getSCE(SC_CLOAKING) && sc->getSCE(SC_CLOAKING)->val1 < 3 && !skill_check_cloaking(bl, nullptr)) status_change_end(bl, SC_CLOAKING); if (sc->getSCE(SC_WARM)) skill_unit_move_unit_group(skill_id2group(sc->getSCE(SC_WARM)->val4), bl->m, x1-x0, y1-y0); @@ -519,16 +519,16 @@ int map_moveblock(struct block_list *bl, int x1, int y1, t_tick tick) if( sc->getSCE(SC__SHADOWFORM) ) {//Shadow Form Caster Moving struct block_list *d_bl; - if( (d_bl = map_id2bl(sc->getSCE(SC__SHADOWFORM)->val2)) == NULL || !check_distance_bl(bl,d_bl,10) ) + if( (d_bl = map_id2bl(sc->getSCE(SC__SHADOWFORM)->val2)) == nullptr || !check_distance_bl(bl,d_bl,10) ) status_change_end(bl,SC__SHADOWFORM); } if (sc->getSCE(SC_PROPERTYWALK) && sc->getSCE(SC_PROPERTYWALK)->val3 < skill_get_maxcount(sc->getSCE(SC_PROPERTYWALK)->val1,sc->getSCE(SC_PROPERTYWALK)->val2) - && map_find_skill_unit_oncell(bl,bl->x,bl->y,SO_ELECTRICWALK,NULL,0) == NULL - && map_find_skill_unit_oncell(bl,bl->x,bl->y,NPC_ELECTRICWALK,NULL,0) == NULL - && map_find_skill_unit_oncell(bl,bl->x,bl->y,SO_FIREWALK,NULL,0) == NULL - && map_find_skill_unit_oncell(bl,bl->x,bl->y,NPC_FIREWALK,NULL,0) == NULL + && map_find_skill_unit_oncell(bl,bl->x,bl->y,SO_ELECTRICWALK,nullptr,0) == nullptr + && map_find_skill_unit_oncell(bl,bl->x,bl->y,NPC_ELECTRICWALK,nullptr,0) == nullptr + && map_find_skill_unit_oncell(bl,bl->x,bl->y,SO_FIREWALK,nullptr,0) == nullptr + && map_find_skill_unit_oncell(bl,bl->x,bl->y,NPC_FIREWALK,nullptr,0) == nullptr && skill_unitsetting(bl,sc->getSCE(SC_PROPERTYWALK)->val1,sc->getSCE(SC_PROPERTYWALK)->val2,x0, y0,0)) { sc->getSCE(SC_PROPERTYWALK)->val3++; } @@ -573,7 +573,7 @@ int map_count_oncell(int16 m, int16 x, int16 y, int type, int flag) by = y/BLOCK_SIZE; if (type&~BL_MOB) - for( bl = mapdata->block[bx+by*mapdata->bxs] ; bl != NULL ; bl = bl->next ) + for( bl = mapdata->block[bx+by*mapdata->bxs] ; bl != nullptr ; bl = bl->next ) if(bl->x == x && bl->y == y && bl->type&type) { if (bl->type == BL_NPC) { // Don't count hidden or invisible npc. Cloaked npc are counted npc_data *nd = BL_CAST(BL_NPC, bl); @@ -590,7 +590,7 @@ int map_count_oncell(int16 m, int16 x, int16 y, int type, int flag) } if (type&BL_MOB) - for( bl = mapdata->block_mob[bx+by*mapdata->bxs] ; bl != NULL ; bl = bl->next ) + for( bl = mapdata->block_mob[bx+by*mapdata->bxs] ; bl != nullptr ; bl = bl->next ) if(bl->x == x && bl->y == y) { if(flag&1) { struct unit_data *ud = unit_bl2ud(bl); @@ -615,12 +615,12 @@ struct skill_unit* map_find_skill_unit_oncell(struct block_list* target,int16 x, struct map_data *mapdata = map_getmapdata(target->m); if (x < 0 || y < 0 || (x >= mapdata->xs) || (y >= mapdata->ys)) - return NULL; + return nullptr; bx = x/BLOCK_SIZE; by = y/BLOCK_SIZE; - for( bl = mapdata->block[bx+by*mapdata->bxs] ; bl != NULL ; bl = bl->next ) + for( bl = mapdata->block[bx+by*mapdata->bxs] ; bl != nullptr ; bl = bl->next ) { if (bl->x != x || bl->y != y || bl->type != BL_SKILL) continue; @@ -631,7 +631,7 @@ struct skill_unit* map_find_skill_unit_oncell(struct block_list* target,int16 x, if( !(flag&1) || battle_check_target(&unit->bl,target,unit->group->target_flag) > 0 ) return unit; } - return NULL; + return nullptr; } /*========================================== @@ -664,13 +664,13 @@ int map_foreachinrangeV(int (*func)(struct block_list*,va_list),struct block_lis if ( type&~BL_MOB ) { for( by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++ ) { for( bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++ ) { - for(bl = mapdata->block[ bx + by * mapdata->bxs ]; bl != NULL; bl = bl->next ) { + for(bl = mapdata->block[ bx + by * mapdata->bxs ]; bl != nullptr; bl = bl->next ) { if( bl->type&type && bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1 #ifdef CIRCULAR_AREA && check_distance_bl(center, bl, range) #endif - && ( !wall_check || path_search_long(NULL, center->m, center->x, center->y, bl->x, bl->y, CELL_CHKWALL) ) + && ( !wall_check || path_search_long(nullptr, center->m, center->x, center->y, bl->x, bl->y, CELL_CHKWALL) ) && bl_list_count < BL_LIST_MAX ) bl_list[ bl_list_count++ ] = bl; } @@ -681,12 +681,12 @@ int map_foreachinrangeV(int (*func)(struct block_list*,va_list),struct block_lis if ( type&BL_MOB ) { for( by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++ ) { for( bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++ ) { - for(bl = mapdata->block_mob[ bx + by * mapdata->bxs ]; bl != NULL; bl = bl->next ) { + for(bl = mapdata->block_mob[ bx + by * mapdata->bxs ]; bl != nullptr; bl = bl->next ) { if( bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1 #ifdef CIRCULAR_AREA && check_distance_bl(center, bl, range) #endif - && ( !wall_check || path_search_long(NULL, center->m, center->x, center->y, bl->x, bl->y, CELL_CHKWALL) ) + && ( !wall_check || path_search_long(nullptr, center->m, center->x, center->y, bl->x, bl->y, CELL_CHKWALL) ) && bl_list_count < BL_LIST_MAX ) bl_list[ bl_list_count++ ] = bl; } @@ -792,10 +792,10 @@ int map_foreachinareaV(int(*func)(struct block_list*, va_list), int16 m, int16 x if( type&~BL_MOB ) { for (by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++) { for (bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++) { - for(bl = mapdata->block[bx + by * mapdata->bxs]; bl != NULL; bl = bl->next) { + for(bl = mapdata->block[bx + by * mapdata->bxs]; bl != nullptr; bl = bl->next) { if ( bl->type&type && bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1 - && ( !wall_check || path_search_long(NULL, m, cx, cy, bl->x, bl->y, CELL_CHKWALL) ) + && ( !wall_check || path_search_long(nullptr, m, cx, cy, bl->x, bl->y, CELL_CHKWALL) ) && bl_list_count < BL_LIST_MAX ) bl_list[bl_list_count++] = bl; } @@ -806,9 +806,9 @@ int map_foreachinareaV(int(*func)(struct block_list*, va_list), int16 m, int16 x if( type&BL_MOB ) { for (by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++) { for (bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++) { - for(bl = mapdata->block_mob[bx + by * mapdata->bxs]; bl != NULL; bl = bl->next) { + for(bl = mapdata->block_mob[bx + by * mapdata->bxs]; bl != nullptr; bl = bl->next) { if ( bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1 - && ( !wall_check || path_search_long(NULL, m, cx, cy, bl->x, bl->y, CELL_CHKWALL) ) + && ( !wall_check || path_search_long(nullptr, m, cx, cy, bl->x, bl->y, CELL_CHKWALL) ) && bl_list_count < BL_LIST_MAX ) bl_list[bl_list_count++] = bl; } @@ -892,7 +892,7 @@ int map_forcountinrange(int (*func)(struct block_list*,va_list), struct block_li if ( type&~BL_MOB ) for ( by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++ ) { for( bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++ ) { - for( bl = mapdata->block[ bx + by * mapdata->bxs ]; bl != NULL; bl = bl->next ) { + for( bl = mapdata->block[ bx + by * mapdata->bxs ]; bl != nullptr; bl = bl->next ) { if( bl->type&type && bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1 #ifdef CIRCULAR_AREA @@ -906,7 +906,7 @@ int map_forcountinrange(int (*func)(struct block_list*,va_list), struct block_li if( type&BL_MOB ) for( by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++ ) { for( bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++ ){ - for( bl = mapdata->block_mob[ bx + by * mapdata->bxs ]; bl != NULL; bl = bl->next ) { + for( bl = mapdata->block_mob[ bx + by * mapdata->bxs ]; bl != nullptr; bl = bl->next ) { if( bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1 #ifdef CIRCULAR_AREA && check_distance_bl(center, bl, range) @@ -966,14 +966,14 @@ int map_forcountinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x if ( type&~BL_MOB ) for( by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++ ) for( bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++ ) - for( bl = mapdata->block[ bx + by * mapdata->bxs ]; bl != NULL; bl = bl->next ) + for( bl = mapdata->block[ bx + by * mapdata->bxs ]; bl != nullptr; bl = bl->next ) if( bl->type&type && bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1 && bl_list_count < BL_LIST_MAX ) bl_list[ bl_list_count++ ] = bl; if( type&BL_MOB ) for( by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++ ) for( bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++ ) - for( bl = mapdata->block_mob[ bx + by * mapdata->bxs ]; bl != NULL; bl = bl->next ) + for( bl = mapdata->block_mob[ bx + by * mapdata->bxs ]; bl != nullptr; bl = bl->next ) if( bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1 && bl_list_count < BL_LIST_MAX ) bl_list[ bl_list_count++ ] = bl; @@ -1053,7 +1053,7 @@ int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_ for( by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++ ) { for( bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++ ) { if ( type&~BL_MOB ) { - for( bl = mapdata->block[ bx + by * mapdata->bxs ]; bl != NULL; bl = bl->next ) { + for( bl = mapdata->block[ bx + by * mapdata->bxs ]; bl != nullptr; bl = bl->next ) { if( bl->type&type && bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1 && @@ -1062,7 +1062,7 @@ int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_ } } if ( type&BL_MOB ) { - for( bl = mapdata->block_mob[ bx + by * mapdata->bxs ]; bl != NULL; bl = bl->next ) { + for( bl = mapdata->block_mob[ bx + by * mapdata->bxs ]; bl != nullptr; bl = bl->next ) { if( bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1 && bl_list_count < BL_LIST_MAX ) @@ -1080,7 +1080,7 @@ int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_ for( by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++ ) { for( bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++ ) { if ( type & ~BL_MOB ) { - for( bl = mapdata->block[ bx + by * mapdata->bxs ]; bl != NULL; bl = bl->next ) { + for( bl = mapdata->block[ bx + by * mapdata->bxs ]; bl != nullptr; bl = bl->next ) { if( bl->type&type && bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1 && @@ -1093,7 +1093,7 @@ int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_ } } if ( type&BL_MOB ) { - for( bl = mapdata->block_mob[ bx + by * mapdata->bxs ]; bl != NULL; bl = bl->next ) { + for( bl = mapdata->block_mob[ bx + by * mapdata->bxs ]; bl != nullptr; bl = bl->next ) { if( bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1 && bl_list_count < BL_LIST_MAX) @@ -1150,11 +1150,11 @@ int map_foreachincell(int (*func)(struct block_list*,va_list), int16 m, int16 x, bx = x / BLOCK_SIZE; if( type&~BL_MOB ) - for( bl = mapdata->block[ bx + by * mapdata->bxs ]; bl != NULL; bl = bl->next ) + for( bl = mapdata->block[ bx + by * mapdata->bxs ]; bl != nullptr; bl = bl->next ) if( bl->type&type && bl->x == x && bl->y == y && bl_list_count < BL_LIST_MAX ) bl_list[ bl_list_count++ ] = bl; if( type&BL_MOB ) - for( bl = mapdata->block_mob[ bx + by * mapdata->bxs]; bl != NULL; bl = bl->next ) + for( bl = mapdata->block_mob[ bx + by * mapdata->bxs]; bl != nullptr; bl = bl->next ) if( bl->x == x && bl->y == y && bl_list_count < BL_LIST_MAX) bl_list[ bl_list_count++ ] = bl; @@ -1280,7 +1280,7 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int16 m,int16 x0,i if ( type&~BL_MOB ) for ( by = my0 / BLOCK_SIZE; by <= my1 / BLOCK_SIZE; by++ ) { for( bx = mx0 / BLOCK_SIZE; bx <= mx1 / BLOCK_SIZE; bx++ ) { - for( bl = mapdata->block[ bx + by * mapdata->bxs ]; bl != NULL; bl = bl->next ) { + for( bl = mapdata->block[ bx + by * mapdata->bxs ]; bl != nullptr; bl = bl->next ) { if( bl->prev && bl->type&type && bl_list_count < BL_LIST_MAX ) { xi = bl->x; yi = bl->y; @@ -1290,7 +1290,7 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int16 m,int16 x0,i if ( k < 0 || k > len_limit ) //Since more skills use this, check for ending point as well. continue; - if ( k > magnitude2 && !path_search_long(NULL, m, x0, y0, xi, yi, CELL_CHKWALL) ) + if ( k > magnitude2 && !path_search_long(nullptr, m, x0, y0, xi, yi, CELL_CHKWALL) ) continue; //Targets beyond the initial ending point need the wall check. //All these shifts are to increase the precision of the intersection point and distance considering how it's @@ -1314,7 +1314,7 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int16 m,int16 x0,i if( type&BL_MOB ) for( by = my0 / BLOCK_SIZE; by <= my1 / BLOCK_SIZE; by++ ) { for( bx = mx0 / BLOCK_SIZE; bx <= mx1 / BLOCK_SIZE; bx++ ) { - for( bl = mapdata->block_mob[ bx + by * mapdata->bxs ]; bl != NULL; bl = bl->next ) { + for( bl = mapdata->block_mob[ bx + by * mapdata->bxs ]; bl != nullptr; bl = bl->next ) { if( bl->prev && bl_list_count < BL_LIST_MAX ) { xi = bl->x; yi = bl->y; @@ -1323,7 +1323,7 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int16 m,int16 x0,i if ( k < 0 || k > len_limit ) continue; - if ( k > magnitude2 && !path_search_long(NULL, m, x0, y0, xi, yi, CELL_CHKWALL) ) + if ( k > magnitude2 && !path_search_long(nullptr, m, x0, y0, xi, yi, CELL_CHKWALL) ) continue; //Targets beyond the initial ending point need the wall check. k = ( k << 4 ) / magnitude2; //k will be between 1~16 instead of 0~1 @@ -1440,7 +1440,7 @@ int map_foreachindir(int(*func)(struct block_list*, va_list), int16 m, int16 x0, if (type&~BL_MOB) { for (by = my0 / BLOCK_SIZE; by <= my1 / BLOCK_SIZE; by++) { for (bx = mx0 / BLOCK_SIZE; bx <= mx1 / BLOCK_SIZE; bx++) { - for (bl = mapdata->block[bx + by * mapdata->bxs]; bl != NULL; bl = bl->next) { + for (bl = mapdata->block[bx + by * mapdata->bxs]; bl != nullptr; bl = bl->next) { if (bl->prev && bl->type&type && bl_list_count < BL_LIST_MAX) { //Check if inside search area if (bl->x < mx0 || bl->x > mx1 || bl->y < my0 || bl->y > my1) @@ -1464,7 +1464,7 @@ int map_foreachindir(int(*func)(struct block_list*, va_list), int16 m, int16 x0, continue; } //Everything else ok, check for line of sight from source - if (!path_search_long(NULL, m, x0, y0, bl->x, bl->y, CELL_CHKWALL)) + if (!path_search_long(nullptr, m, x0, y0, bl->x, bl->y, CELL_CHKWALL)) continue; //All checks passed, add to list bl_list[bl_list_count++] = bl; @@ -1476,7 +1476,7 @@ int map_foreachindir(int(*func)(struct block_list*, va_list), int16 m, int16 x0, if (type&BL_MOB) { for (by = my0 / BLOCK_SIZE; by <= my1 / BLOCK_SIZE; by++) { for (bx = mx0 / BLOCK_SIZE; bx <= mx1 / BLOCK_SIZE; bx++) { - for (bl = mapdata->block_mob[bx + by * mapdata->bxs]; bl != NULL; bl = bl->next) { + for (bl = mapdata->block_mob[bx + by * mapdata->bxs]; bl != nullptr; bl = bl->next) { if (bl->prev && bl_list_count < BL_LIST_MAX) { //Check if inside search area if (bl->x < mx0 || bl->x > mx1 || bl->y < my0 || bl->y > my1) @@ -1500,7 +1500,7 @@ int map_foreachindir(int(*func)(struct block_list*, va_list), int16 m, int16 x0, continue; } //Everything else ok, check for line of sight from source - if (!path_search_long(NULL, m, x0, y0, bl->x, bl->y, CELL_CHKWALL)) + if (!path_search_long(nullptr, m, x0, y0, bl->x, bl->y, CELL_CHKWALL)) continue; //All checks passed, add to list bl_list[bl_list_count++] = bl; @@ -1546,13 +1546,13 @@ int map_foreachinmap(int (*func)(struct block_list*,va_list), int16 m, int type, if( type&~BL_MOB ) for( b = 0; b < bsize; b++ ) - for( bl = mapdata->block[ b ]; bl != NULL; bl = bl->next ) + for( bl = mapdata->block[ b ]; bl != nullptr; bl = bl->next ) if( bl->type&type && bl_list_count < BL_LIST_MAX ) bl_list[ bl_list_count++ ] = bl; if( type&BL_MOB ) for( b = 0; b < bsize; b++ ) - for( bl = mapdata->block_mob[ b ]; bl != NULL; bl = bl->next ) + for( bl = mapdata->block_mob[ b ]; bl != nullptr; bl = bl->next ) if( bl_list_count < BL_LIST_MAX ) bl_list[ bl_list_count++ ] = bl; @@ -1613,7 +1613,7 @@ int map_get_new_object_id(void) TIMER_FUNC(map_clearflooritem_timer){ struct flooritem_data* fitem = (struct flooritem_data*)idb_get(id_db, id); - if (fitem == NULL || fitem->bl.type != BL_ITEM || (fitem->cleartimer != tid)) { + if (fitem == nullptr || fitem->bl.type != BL_ITEM || (fitem->cleartimer != tid)) { ShowError("map_clearflooritem_timer : error\n"); return 1; } @@ -1706,7 +1706,7 @@ int map_search_freecell(struct block_list *src, int16 m, int16 *x,int16 *y, int1 if( !src && (!(flag&1) || flag&2) ) { - ShowDebug("map_search_freecell: Incorrect usage! When src is NULL, flag has to be &1 and can't have &2\n"); + ShowDebug("map_search_freecell: Incorrect usage! When src is nullptr, flag has to be &1 and can't have &2\n"); return 0; } @@ -1864,7 +1864,7 @@ bool map_closest_freecell(int16 m, int16 *x, int16 *y, int type, int flag) *------------------------------------------*/ int map_addflooritem(struct item *item, int amount, int16 m, int16 x, int16 y, int first_charid, int second_charid, int third_charid, int flags, unsigned short mob_id, bool canShowEffect) { - struct flooritem_data *fitem = NULL; + struct flooritem_data *fitem = nullptr; nullpo_ret(item); @@ -1876,7 +1876,7 @@ int map_addflooritem(struct item *item, int amount, int16 m, int16 x, int16 y, i CREATE(fitem, struct flooritem_data, 1); fitem->bl.type=BL_ITEM; - fitem->bl.prev = fitem->bl.next = NULL; + fitem->bl.prev = fitem->bl.next = nullptr; fitem->bl.m=m; fitem->bl.x=x; fitem->bl.y=y; @@ -1949,7 +1949,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 = (struct charid2nick*)db_data2ptr(&data)) == NULL) + if (!nick_db->remove(nick_db, db_i2key(charid), &data) || (p = (struct charid2nick*)db_data2ptr(&data)) == nullptr) return; while( p->requests ) { @@ -2168,12 +2168,12 @@ int map_quit(map_session_data *sd) { * Lookup, id to session (player,mob,npc,homon,merc..) *------------------------------------------*/ map_session_data * map_id2sd(int id){ - if (id <= 0) return NULL; + if (id <= 0) return nullptr; return (map_session_data*)idb_get(pc_db,id); } struct mob_data * map_id2md(int id){ - if (id <= 0) return NULL; + if (id <= 0) return nullptr; return (struct mob_data*)idb_get(mobid_db,id); } @@ -2207,7 +2207,7 @@ struct chat_data* map_id2cd(int id){ return BL_CAST(BL_CHAT, bl); } -/// Returns the nick of the target charid or NULL if unknown (requests the nick to the char server). +/// Returns the nick of the target charid or nullptr if unknown (requests the nick to the char server). const char* map_charid2nick(int charid) { struct charid2nick *p; @@ -2222,10 +2222,10 @@ const char* map_charid2nick(int charid) return p->nick;// name in nick_db chrif_searchcharid(charid);// request the name - return NULL; + return nullptr; } -/// Returns the map_session_data of the charid or NULL if the char is not online. +/// Returns the map_session_data of the charid or nullptr if the char is not online. map_session_data* map_charid2sd(int charid) { return (map_session_data*)uidb_get(charid_db, charid); @@ -2234,7 +2234,7 @@ map_session_data* map_charid2sd(int charid) /*========================================== * Search session data from a nick name * (without sensitive case if necessary) - * return map_session_data pointer or NULL + * return map_session_data pointer or nullptr *------------------------------------------*/ map_session_data * map_nick2sd(const char *nick, bool allow_partial) { @@ -2244,13 +2244,13 @@ map_session_data * map_nick2sd(const char *nick, bool allow_partial) size_t nicklen; int qty = 0; - if( nick == NULL ) - return NULL; + if( nick == nullptr ) + return nullptr; nicklen = strlen(nick); iter = mapit_getallusers(); - found_sd = NULL; + found_sd = nullptr; for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) ) { if( allow_partial && battle_config.partial_name_scan ) @@ -2278,13 +2278,13 @@ map_session_data * map_nick2sd(const char *nick, bool allow_partial) mapit_free(iter); if( battle_config.partial_name_scan && qty != 1 ) - found_sd = NULL; + found_sd = nullptr; return found_sd; } /*========================================== - * Looksup id_db DBMap and returns BL pointer of 'id' or NULL if not found + * Looksup id_db DBMap and returns BL pointer of 'id' or nullptr if not found *------------------------------------------*/ struct block_list * map_id2bl(int id) { return (struct block_list*)idb_get(id_db,id); @@ -2303,7 +2303,7 @@ bool map_blid_exists( int id ) { struct mob_data * map_getmob_boss(int16 m) { DBIterator* iter; - struct mob_data *md = NULL; + struct mob_data *md = nullptr; bool found = false; iter = db_iterator(bossid_db); @@ -2317,12 +2317,12 @@ struct mob_data * map_getmob_boss(int16 m) } dbi_destroy(iter); - return (found)? md : NULL; + return (found)? md : nullptr; } struct mob_data * map_id2boss(int id) { - if (id <= 0) return NULL; + if (id <= 0) return nullptr; return (struct mob_data*)idb_get(bossid_db,id); } @@ -2492,17 +2492,17 @@ void mapit_free(struct s_mapiterator* mapit) } /// Returns the first block_list that matches the description. -/// Returns NULL if not found. +/// Returns nullptr if not found. /// /// @param mapit Iterator -/// @return first block_list or NULL +/// @return first block_list or nullptr struct block_list* mapit_first(struct s_mapiterator* mapit) { struct block_list* bl; - nullpo_retr(NULL,mapit); + nullpo_retr(nullptr,mapit); - for( bl = (struct block_list*)dbi_first(mapit->dbi); bl != NULL; bl = (struct block_list*)dbi_next(mapit->dbi) ) + for( bl = (struct block_list*)dbi_first(mapit->dbi); bl != nullptr; bl = (struct block_list*)dbi_next(mapit->dbi) ) { if( MAPIT_MATCHES(mapit,bl) ) break;// found match @@ -2511,17 +2511,17 @@ struct block_list* mapit_first(struct s_mapiterator* mapit) } /// Returns the last block_list that matches the description. -/// Returns NULL if not found. +/// Returns nullptr if not found. /// /// @param mapit Iterator -/// @return last block_list or NULL +/// @return last block_list or nullptr struct block_list* mapit_last(struct s_mapiterator* mapit) { struct block_list* bl; - nullpo_retr(NULL,mapit); + nullpo_retr(nullptr,mapit); - for( bl = (struct block_list*)dbi_last(mapit->dbi); bl != NULL; bl = (struct block_list*)dbi_prev(mapit->dbi) ) + for( bl = (struct block_list*)dbi_last(mapit->dbi); bl != nullptr; bl = (struct block_list*)dbi_prev(mapit->dbi) ) { if( MAPIT_MATCHES(mapit,bl) ) break;// found match @@ -2530,20 +2530,20 @@ struct block_list* mapit_last(struct s_mapiterator* mapit) } /// Returns the next block_list that matches the description. -/// Returns NULL if not found. +/// Returns nullptr if not found. /// /// @param mapit Iterator -/// @return next block_list or NULL +/// @return next block_list or nullptr struct block_list* mapit_next(struct s_mapiterator* mapit) { struct block_list* bl; - nullpo_retr(NULL,mapit); + nullpo_retr(nullptr,mapit); for( ; ; ) { bl = (struct block_list*)dbi_next(mapit->dbi); - if( bl == NULL ) + if( bl == nullptr ) break;// end if( MAPIT_MATCHES(mapit,bl) ) break;// found a match @@ -2553,20 +2553,20 @@ struct block_list* mapit_next(struct s_mapiterator* mapit) } /// Returns the previous block_list that matches the description. -/// Returns NULL if not found. +/// Returns nullptr if not found. /// /// @param mapit Iterator -/// @return previous block_list or NULL +/// @return previous block_list or nullptr struct block_list* mapit_prev(struct s_mapiterator* mapit) { struct block_list* bl; - nullpo_retr(NULL,mapit); + nullpo_retr(nullptr,mapit); for( ; ; ) { bl = (struct block_list*)dbi_prev(mapit->dbi); - if( bl == NULL ) + if( bl == nullptr ) break;// end if( MAPIT_MATCHES(mapit,bl) ) break;// found a match @@ -2825,7 +2825,7 @@ int map_addmobtolist(unsigned short m, struct spawn_data *spawn) size_t i; struct map_data *mapdata = map_getmapdata(m); - ARR_FIND( 0, MAX_MOB_LIST_PER_MAP, i, mapdata->moblist[i] == NULL ); + ARR_FIND( 0, MAX_MOB_LIST_PER_MAP, i, mapdata->moblist[i] == nullptr ); if( i < MAX_MOB_LIST_PER_MAP ) { mapdata->moblist[i] = spawn; @@ -2846,7 +2846,7 @@ void map_spawnmobs(int16 m) return; } for(i=0; imoblist[i]!=NULL) + if(mapdata->moblist[i]!=nullptr) { k+=mapdata->moblist[i]->num; npc_parse_mob2(mapdata->moblist[i]); @@ -2974,13 +2974,13 @@ int16 map_mapname2mapid(const char* name) *------------------------------------------*/ int16 map_mapindex2mapid(unsigned short mapindex) { - struct map_data *md=NULL; + struct map_data *md=nullptr; if (!mapindex) return -1; md = (struct map_data*)uidb_get(map_db,(unsigned int)mapindex); - if(md==NULL || md->cell==NULL) + if(md==nullptr || md->cell==nullptr) return -1; return md->m; } @@ -2993,7 +2993,7 @@ int map_mapname2ipport(unsigned short name, uint32* ip, uint16* port) struct map_data_other_server *mdos; mdos = (struct map_data_other_server*)uidb_get(map_db,(unsigned int)name); - if(mdos==NULL || mdos->cell) //If gat isn't null, this is a local map. + if(mdos==nullptr || mdos->cell) //If gat isn't null, this is a local map. return -1; *ip=mdos->ip; *port=mdos->port; @@ -3098,7 +3098,7 @@ int map_random_dir(struct block_list *bl, int16 *x, int16 *y) segment = (short)sqrt((float)(dist2 - segment*segment)); //The complement of the previously picked segment yi = bl->y + segment*diry[j]; } while ( - (map_getcell(bl->m,xi,yi,CELL_CHKNOPASS) || !path_search(NULL,bl->m,bl->x,bl->y,xi,yi,1,CELL_CHKNOREACH)) + (map_getcell(bl->m,xi,yi,CELL_CHKNOPASS) || !path_search(nullptr,bl->m,bl->x,bl->y,xi,yi,1,CELL_CHKNOREACH)) && (++i)<100 ); if (i < 100) { @@ -3314,7 +3314,7 @@ bool map_iwall_set(int16 m, int16 x, int16 y, int size, int8 dir, bool shootable if( size < 1 || !wall_name ) return false; - if( (iwall = (struct iwall_data *)strdb_get(iwall_db, wall_name)) != NULL ) + if( (iwall = (struct iwall_data *)strdb_get(iwall_db, wall_name)) != nullptr ) return false; // Already Exists if( map_getcell(m, x, y, CELL_CHKNOREACH) ) @@ -3377,7 +3377,7 @@ bool map_iwall_remove(const char *wall_name) struct iwall_data *iwall; int16 i, x1, y1; - if( (iwall = (struct iwall_data *)strdb_get(iwall_db, wall_name)) == NULL ) + if( (iwall = (struct iwall_data *)strdb_get(iwall_db, wall_name)) == nullptr ) return false; // Nothing to do for( i = 0; i < iwall->size; i++ ) { @@ -3435,7 +3435,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 = (struct map_data_other_server *)db_data2ptr(data); - if(mdos->cell == NULL) { + if(mdos->cell == nullptr) { db_remove(map_db,key); aFree(mdos); } @@ -3492,7 +3492,7 @@ static char *map_init_mapcache(FILE *fp) // Read file into buffer.. if(fread(buffer, 1, size, fp) != size) { ShowError("map_init_mapcache: Could not read entire mapcache file\n"); - return NULL; + return nullptr; } return buffer; @@ -3506,7 +3506,7 @@ int map_readfromcache(struct map_data *m, char *buffer, char *decode_buffer) { int i; struct map_cache_main_header *header = (struct map_cache_main_header *)buffer; - struct map_cache_map_info *info = NULL; + struct map_cache_map_info *info = nullptr; char *p = buffer + sizeof(struct map_cache_main_header); for(i = 0; i < header->map_count; i++) { @@ -3695,7 +3695,7 @@ int map_readgat (struct map_data* m) sprintf(filename, "data\\%s.gat", m->name); gat = (uint8 *) grfio_read(filename); - if (gat == NULL) + if (gat == nullptr) return 0; m->xs = *(int32*)(gat+6); @@ -3814,11 +3814,11 @@ int map_readallmaps (void) mapdata->index = idx; - if (uidb_get(map_db,(unsigned int)mapdata->index) != NULL) { + if (uidb_get(map_db,(unsigned int)mapdata->index) != nullptr) { ShowWarning("Map %s already loaded!" CL_CLL "\n", mapdata->name); if (mapdata->cell) { aFree(mapdata->cell); - mapdata->cell = NULL; + mapdata->cell = nullptr; } map_delmapid(i); maps_removed++; @@ -3841,7 +3841,7 @@ int map_readallmaps (void) memset(&mapdata->save, 0, sizeof(struct point)); mapdata->damage_adjust = {}; - mapdata->channel = NULL; + mapdata->channel = nullptr; } // intialization and configuration-dependent adjustments of mapflags @@ -3950,7 +3950,7 @@ int map_config_read(const char *cfgName) FILE *fp; fp = fopen(cfgName,"r"); - if( fp == NULL ) + if( fp == nullptr ) { ShowError("Map configuration file not found at: %s\n", cfgName); return 1; @@ -3962,7 +3962,7 @@ int map_config_read(const char *cfgName) if( line[0] == '/' && line[1] == '/' ) continue; - if( (ptr = strstr(line, "//")) != NULL ) + if( (ptr = strstr(line, "//")) != nullptr ) *ptr = '\n'; //Strip comments if( sscanf(line, "%31[^:]: %1023[^\t\r\n]", w1, w2) < 2 ) continue; @@ -4052,7 +4052,7 @@ void map_reloadnpc_sub(const char *cfgName) FILE *fp; fp = fopen(cfgName,"r"); - if( fp == NULL ) + if( fp == nullptr ) { ShowError("Map configuration file not found at: %s\n", cfgName); return; @@ -4064,7 +4064,7 @@ void map_reloadnpc_sub(const char *cfgName) if( line[0] == '/' && line[1] == '/' ) continue; - if( (ptr = strstr(line, "//")) != NULL ) + if( (ptr = strstr(line, "//")) != nullptr ) *ptr = '\n'; //Strip comments if( sscanf(line, "%1023[^:]: %1023[^\t\r\n]", w1, w2) < 2 ) continue; @@ -4106,7 +4106,7 @@ int inter_config_read(const char *cfgName) FILE *fp; fp=fopen(cfgName,"r"); - if(fp==NULL){ + if(fp==nullptr){ ShowError("File not found: %s\n",cfgName); return 1; } @@ -4260,14 +4260,14 @@ int map_sql_close(void) ShowStatus("Close Map DB Connection....\n"); Sql_Free(mmysql_handle); Sql_Free(qsmysql_handle); - mmysql_handle = NULL; - qsmysql_handle = NULL; + mmysql_handle = nullptr; + qsmysql_handle = nullptr; if (log_config.sql_logs) { ShowStatus("Close Log DB Connection....\n"); Sql_Free(logmysql_handle); - logmysql_handle = NULL; + logmysql_handle = nullptr; } return 0; @@ -4326,7 +4326,7 @@ static void map_free_questinfo(struct map_data *mapdata) { int map_db_final(DBKey key, DBData *data, va_list ap) { struct map_data_other_server *mdos = (struct map_data_other_server *)db_data2ptr(data); - if(mdos && mdos->cell == NULL) + if(mdos && mdos->cell == nullptr) aFree(mdos); return 0; } @@ -4339,7 +4339,7 @@ int nick_db_final(DBKey key, DBData *data, va_list args) struct charid2nick* p = (struct charid2nick*)db_data2ptr(data); struct charid_request* req; - if( p == NULL ) + if( p == nullptr ) return 0; while( p->requests ) { @@ -4491,7 +4491,7 @@ bool map_getmapflag_name( enum e_mapflag mapflag, char* output ){ constant = script_get_constant_str( prefix, mapflag ); // Should never happen - if (constant == NULL) + if (constant == nullptr) return false; // Begin copy after the prefix @@ -4654,7 +4654,7 @@ bool map_setmapflag_sub(int16 m, enum e_mapflag mapflag, bool status, union u_ma if (mapdata->getMapFlag(MF_PVP)) { mapdata->setMapFlag(MF_PVP, false); if (!battle_config.pk_mode) - ShowWarning("npc_parse_mapflag: Unable to set PvP and GvG%s Castle flags for the same map! Removing PvP flag from %s.\n", (mapflag == MF_GVG_CASTLE ? NULL : " TE"), mapdata->name); + ShowWarning("npc_parse_mapflag: Unable to set PvP and GvG%s Castle flags for the same map! Removing PvP flag from %s.\n", (mapflag == MF_GVG_CASTLE ? nullptr : " TE"), mapdata->name); } } mapdata->setMapFlag(mapflag, status); @@ -4917,14 +4917,14 @@ void MapServer::finalize(){ if(enable_grf) grfio_final(); - id_db->destroy(id_db, NULL); - pc_db->destroy(pc_db, NULL); - mobid_db->destroy(mobid_db, NULL); - bossid_db->destroy(bossid_db, NULL); + id_db->destroy(id_db, nullptr); + pc_db->destroy(pc_db, nullptr); + mobid_db->destroy(mobid_db, nullptr); + bossid_db->destroy(bossid_db, nullptr); nick_db->destroy(nick_db, nick_db_final); - charid_db->destroy(charid_db, NULL); - iwall_db->destroy(iwall_db, NULL); - regen_db->destroy(regen_db, NULL); + charid_db->destroy(charid_db, nullptr); + iwall_db->destroy(iwall_db, nullptr); + regen_db->destroy(regen_db, nullptr); map_sql_close(); @@ -5026,7 +5026,7 @@ void map_do_final_msg(void){ aFree(mdb); } dbi_destroy(iter); - map_msg_db->destroy(map_msg_db, NULL); + map_msg_db->destroy(map_msg_db, nullptr); } void map_msg_reload(void){ map_do_final_msg(); //clear data @@ -5035,7 +5035,7 @@ void map_msg_reload(void){ int map_msg_config_read(const char *cfgName, int lang){ struct msg_data *mdb; - if( (mdb = map_lang2msgdb(lang)) == NULL ) + if( (mdb = map_lang2msgdb(lang)) == nullptr ) CREATE(mdb, struct msg_data, 1); else idb_remove(map_msg_db, lang); @@ -5052,14 +5052,14 @@ const char* map_msg_txt(map_session_data *sd, int msg_number){ uint8 lang = 0; //default if(sd && sd->langtype) lang = sd->langtype; - if( (mdb = map_lang2msgdb(lang)) != NULL){ + if( (mdb = map_lang2msgdb(lang)) != nullptr){ const char *tmp = _msg_txt(msg_number,MAP_MAX_MSG,mdb->msg); if(strcmp(tmp,"??")) //to verify result return tmp; ShowDebug("Message #%d not found for langtype %d.\n",msg_number,lang); } ShowDebug("Selected langtype %d not loaded, trying fallback...\n",lang); - if(lang != 0 && (mdb = map_lang2msgdb(0)) != NULL) //fallback + if(lang != 0 && (mdb = map_lang2msgdb(0)) != nullptr) //fallback return _msg_txt(msg_number,MAP_MAX_MSG,mdb->msg); return "??"; } @@ -5142,7 +5142,7 @@ void MapServer::handle_shutdown(){ map_session_data* sd; struct s_mapiterator* iter = mapit_getallusers(); for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) ) - clif_GM_kick(NULL, sd); + clif_GM_kick(nullptr, sd); mapit_free(iter); flush_fifos(); } diff --git a/src/map/map.hpp b/src/map/map.hpp index e9666520f0..ba39d91c27 100644 --- a/src/map/map.hpp +++ b/src/map/map.hpp @@ -797,7 +797,7 @@ struct iwall_data { struct map_data { char name[MAP_NAME_LENGTH]; uint16 index; // The map index used by the mapindex* functions. - struct mapcell* cell; // Holds the information of each map cell (NULL if the map is not on this map-server). + struct mapcell* cell; // Holds the information of each map cell (nullptr if the map is not on this map-server). struct block_list **block; struct block_list **block_mob; int16 m; @@ -856,7 +856,7 @@ private: struct map_data_other_server { char name[MAP_NAME_LENGTH]; unsigned short index; //Index is the map index used by the mapindex* functions. - struct mapcell* cell; // If this is NULL, the map is not on this map-server + struct mapcell* cell; // If this is nullptr, the map is not on this map-server uint32 ip; uint16 port; }; @@ -1233,8 +1233,8 @@ enum e_mapflag map_getmapflag_by_name(char* name); bool map_getmapflag_name(enum e_mapflag mapflag, char* output); int map_getmapflag_sub(int16 m, enum e_mapflag mapflag, union u_mapflag_args *args); bool map_setmapflag_sub(int16 m, enum e_mapflag mapflag, bool status, union u_mapflag_args *args); -#define map_getmapflag(m, mapflag) map_getmapflag_sub(m, mapflag, NULL) -#define map_setmapflag(m, mapflag, status) map_setmapflag_sub(m, mapflag, status, NULL) +#define map_getmapflag(m, mapflag) map_getmapflag_sub(m, mapflag, nullptr) +#define map_setmapflag(m, mapflag, status) map_setmapflag_sub(m, mapflag, status, nullptr) #define CHK_ELEMENT(ele) ((ele) > ELE_NONE && (ele) < ELE_MAX) /// Check valid Element #define CHK_ELEMENT_LEVEL(lv) ((lv) >= 1 && (lv) <= MAX_ELE_LEVEL) /// Check valid element level @@ -1266,7 +1266,7 @@ typedef struct s_mercenary_data TBL_MER; typedef struct s_elemental_data TBL_ELEM; #define BL_CAST(type_, bl) \ - ( ((bl) == (struct block_list*)NULL || (bl)->type != (type_)) ? (T ## type_ *)NULL : (T ## type_ *)(bl) ) + ( ((bl) == (struct block_list*)nullptr || (bl)->type != (type_)) ? (T ## type_ *)nullptr : (T ## type_ *)(bl) ) #include diff --git a/src/map/mapreg.cpp b/src/map/mapreg.cpp index c79a91fa92..b16506c1b5 100644 --- a/src/map/mapreg.cpp +++ b/src/map/mapreg.cpp @@ -49,7 +49,7 @@ int64 mapreg_readreg(int64 uid) char* mapreg_readregstr(int64 uid) { struct mapreg_save *m = (struct mapreg_save *)i64db_get(regs.vars, uid); - return m ? m->u.str : NULL; + return m ? m->u.str : nullptr; } /** @@ -125,7 +125,7 @@ bool mapreg_setregstr(int64 uid, const char* str) uint32 i = script_getvaridx(uid); const char* name = get_str(num); - if (str == NULL || *str == 0) { + if (str == nullptr || *str == 0) { if (i) script_array_update(®s, uid, true); if (name[1] != '@') { @@ -135,14 +135,14 @@ bool mapreg_setregstr(int64 uid, const char* str) Sql_ShowDebug(mmysql_handle); } if ((m = static_cast(i64db_get(regs.vars, uid)))) { - if (m->u.str != NULL) + if (m->u.str != nullptr) aFree(m->u.str); ers_free(mapreg_ers, m); } i64db_remove(regs.vars, uid); } else { if ((m = static_cast(i64db_get(regs.vars, uid)))) { - if (m->u.str != NULL) + if (m->u.str != nullptr) aFree(m->u.str); m->u.str = aStrdup(str); if (name[1] != '@') { @@ -202,9 +202,9 @@ static void script_load_mapreg(void) skip_insert = true; - SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &varname[0], sizeof(varname), &length, NULL); - SqlStmt_BindColumn(stmt, 1, SQLDT_UINT32, &index, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 2, SQLDT_STRING, &value[0], sizeof(value), NULL, NULL); + SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &varname[0], sizeof(varname), &length, nullptr); + SqlStmt_BindColumn(stmt, 1, SQLDT_UINT32, &index, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 2, SQLDT_STRING, &value[0], sizeof(value), nullptr, nullptr); while ( SQL_SUCCESS == SqlStmt_NextRow(stmt) ) { int s = add_str(varname); @@ -217,7 +217,7 @@ static void script_load_mapreg(void) if( varname[length-1] == '$' ) { mapreg_setregstr(uid, value); } else { - mapreg_setreg(uid, strtoll(value,NULL,10)); + mapreg_setreg(uid, strtoll(value,nullptr,10)); } } @@ -276,7 +276,7 @@ static TIMER_FUNC(script_autosave_mapreg){ */ int mapreg_destroyreg(DBKey key, DBData *data, va_list ap) { - struct mapreg_save *m = NULL; + struct mapreg_save *m = nullptr; if (data->type != DB_DATA_PTR) // Sanity check return 0; @@ -306,7 +306,7 @@ void mapreg_reload(void) if (regs.arrays) { regs.arrays->destroy(regs.arrays, script_free_array_db); - regs.arrays = NULL; + regs.arrays = nullptr; } script_load_mapreg(); @@ -336,7 +336,7 @@ void mapreg_init(void) mapreg_ers = ers_new(sizeof(struct mapreg_save), "mapreg.cpp:mapreg_ers", ERS_OPT_CLEAN); skip_insert = false; - regs.arrays = NULL; + regs.arrays = nullptr; script_load_mapreg(); diff --git a/src/map/mercenary.cpp b/src/map/mercenary.cpp index bdd6b1b035..ac56b2a2b1 100644 --- a/src/map/mercenary.cpp +++ b/src/map/mercenary.cpp @@ -83,11 +83,11 @@ bool mercenary_create(map_session_data *sd, uint16 class_, unsigned int lifetime * @return The Lifetime **/ t_tick mercenary_get_lifetime(s_mercenary_data *md) { - if( md == NULL || md->contract_timer == INVALID_TIMER ) + if( md == nullptr || md->contract_timer == INVALID_TIMER ) return 0; const struct TimerData *td = get_timer(md->contract_timer); - return (td != NULL) ? DIFF_TICK(td->tick, gettick()) : 0; + return (td != nullptr) ? DIFF_TICK(td->tick, gettick()) : 0; } /** @@ -96,7 +96,7 @@ t_tick mercenary_get_lifetime(s_mercenary_data *md) { * @return enum e_MercGuildType **/ e_MercGuildType mercenary_get_guild(s_mercenary_data *md){ - if( md == NULL || md->db == NULL ) + if( md == nullptr || md->db == nullptr ) return NONE_MERC_GUILD; uint16 class_ = md->db->class_; @@ -119,7 +119,7 @@ e_MercGuildType mercenary_get_guild(s_mercenary_data *md){ int mercenary_get_faith(s_mercenary_data *md) { map_session_data *sd; - if( md == NULL || md->db == NULL || (sd = md->master) == NULL ) + if( md == nullptr || md->db == nullptr || (sd = md->master) == nullptr ) return 0; e_MercGuildType guild = mercenary_get_guild(md); @@ -145,7 +145,7 @@ int mercenary_get_faith(s_mercenary_data *md) { void mercenary_set_faith(s_mercenary_data *md, int value) { map_session_data *sd; - if( md == NULL || md->db == NULL || (sd = md->master) == NULL ) + if( md == nullptr || md->db == nullptr || (sd = md->master) == nullptr ) return; e_MercGuildType guild = mercenary_get_guild(md); @@ -178,7 +178,7 @@ void mercenary_set_faith(s_mercenary_data *md, int value) { int mercenary_get_calls(s_mercenary_data *md) { map_session_data *sd; - if( md == NULL || md->db == NULL || (sd = md->master) == NULL ) + if( md == nullptr || md->db == nullptr || (sd = md->master) == nullptr ) return 0; e_MercGuildType guild = mercenary_get_guild(md); @@ -204,7 +204,7 @@ int mercenary_get_calls(s_mercenary_data *md) { void mercenary_set_calls(s_mercenary_data *md, int value) { map_session_data *sd; - if( md == NULL || md->db == NULL || (sd = md->master) == NULL ) + if( md == nullptr || md->db == nullptr || (sd = md->master) == nullptr ) return; e_MercGuildType guild = mercenary_get_guild(md); @@ -247,9 +247,9 @@ static TIMER_FUNC(merc_contract_end){ map_session_data *sd; s_mercenary_data *md; - if( (sd = map_id2sd(id)) == NULL ) + if( (sd = map_id2sd(id)) == nullptr ) return 1; - if( (md = sd->md) == NULL ) + if( (md = sd->md) == nullptr ) return 1; if( md->contract_timer != tid ) @@ -327,7 +327,7 @@ bool mercenary_recv_data(s_mercenary *merc, bool flag) map_session_data *sd; t_tick tick = gettick(); - if( (sd = map_charid2sd(merc->char_id)) == NULL ) + if( (sd = map_charid2sd(merc->char_id)) == nullptr ) return false; std::shared_ptr db = mercenary_db.find(merc->class_); @@ -378,7 +378,7 @@ bool mercenary_recv_data(s_mercenary *merc, bool flag) mercenary_set_calls(md, 1); sd->status.mer_id = merc->mercenary_id; - if( md && md->bl.prev == NULL && sd->bl.prev != NULL ) { + if( md && md->bl.prev == nullptr && sd->bl.prev != nullptr ) { if(map_addblock(&md->bl)) return false; clif_spawn(&md->bl); @@ -396,7 +396,7 @@ bool mercenary_recv_data(s_mercenary *merc, bool flag) * @param sp SP amount **/ void mercenary_heal(s_mercenary_data *md, int hp, int sp) { - if (md->master == NULL) + if (md->master == nullptr) return; if( hp ) clif_mercenary_updatestatus(md->master, SP_HP); diff --git a/src/map/mob.cpp b/src/map/mob.cpp index ecfe87d8bc..5692a20607 100644 --- a/src/map/mob.cpp +++ b/src/map/mob.cpp @@ -203,7 +203,7 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time) nd->bl.y = md->bl.y; nd->bl.type = BL_NPC; - safestrncpy(nd->name, msg_txt(NULL,656), sizeof(nd->name)); + safestrncpy(nd->name, msg_txt(nullptr,656), sizeof(nd->name)); nd->class_ = 565; nd->speed = 200; @@ -246,7 +246,7 @@ void mvptomb_destroy(struct mob_data *md) { if( !(i == mapdata->npc_num) ) { mapdata->npc_num--; mapdata->npc[i] = mapdata->npc[mapdata->npc_num]; - mapdata->npc[mapdata->npc_num] = NULL; + mapdata->npc[mapdata->npc_num] = nullptr; } map_deliddb(&nd->bl); aFree(nd); @@ -277,9 +277,9 @@ static bool mobdb_searchname_sub(uint16 mob_id, const char * const str, bool ful return true; } else { // str must be in the db value - if( stristr(mob->name.c_str(), str) != NULL || - stristr(mob->jname.c_str(), str) != NULL || - stristr(mob->sprite.c_str(), str) != NULL ) + if( stristr(mob->name.c_str(), str) != nullptr || + stristr(mob->jname.c_str(), str) != nullptr || + stristr(mob->sprite.c_str(), str) != nullptr ) return true; } return false; @@ -414,7 +414,7 @@ void mob_free_dynamic_viewdata( struct mob_data* md ){ aFree( md->vd ); // Remove the reference - md->vd = NULL; + md->vd = nullptr; // Unflag it as changed md->vd_changed = false; @@ -588,7 +588,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target) (sce->val2 == 3 && sce->val4 && sce->val4 != t_sd->status.guild_id)) ) break; - if( (pl_sd = map_id2sd(sce->val1)) == NULL || pl_sd->bl.m != md->bl.m ) + if( (pl_sd = map_id2sd(sce->val1)) == nullptr || pl_sd->bl.m != md->bl.m ) break; if( !pl_sd->state.noks ) @@ -649,7 +649,7 @@ struct mob_data *mob_once_spawn_sub(struct block_list *bl, int16 m, int16 x, int struct map_data *mapdata = map_getmapdata(m); // if none found, pick random position on map if (x <= 0 || x >= mapdata->xs || y <= 0 || y >= mapdata->ys) - map_search_freecell(NULL, m, &x, &y, -1, -1, 1); + map_search_freecell(nullptr, m, &x, &y, -1, -1, 1); data.x = x; data.y = y; @@ -676,7 +676,7 @@ int mob_once_spawn(map_session_data* sd, int16 m, int16 x, int16 y, const char* for (count = 0; count < amount; count++) { int c = (mob_id >= 0) ? mob_id : mob_get_random_id(-mob_id - 1, (battle_config.random_monster_checklv) ? static_cast(RMF_DB_RATE|RMF_CHECK_MOB_LV) : RMF_DB_RATE, lv); - md = mob_once_spawn_sub((sd) ? &sd->bl : NULL, m, x, y, mobname, c, event, size, ai); + md = mob_once_spawn_sub((sd) ? &sd->bl : nullptr, m, x, y, mobname, c, event, size, ai); if (!md) continue; @@ -707,7 +707,7 @@ int mob_once_spawn(map_session_data* sd, int16 m, int16 x, int16 y, const char* if (mob_id < 0 && battle_config.dead_branch_active) //Behold Aegis's masterful decisions yet again... //"I understand the "Aggressive" part, but the "Can Move" and "Can Attack" is just stupid" - Poki#3 - sc_start4(NULL,&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE|MD_CANATTACK|MD_CANMOVE|MD_ANGRY, 0, 60000); + sc_start4(nullptr,&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE|MD_CANATTACK|MD_CANMOVE|MD_ANGRY, 0, 60000); } return (md) ? md->bl.id : 0; // id of last spawned mob @@ -855,7 +855,7 @@ int mob_spawn_guardian(const char* mapname, int16 x, int16 y, const char* mobnam return 0; } - if((x<=0 || y<=0) && !map_search_freecell(NULL, m, &x, &y, -1,-1, 1)) + if((x<=0 || y<=0) && !map_search_freecell(nullptr, m, &x, &y, -1,-1, 1)) { ShowWarning("mob_spawn_guardian: Couldn't locate a spawn cell for guardian class %d (index %d) at castle map %s\n",mob_id, guardian, mapname); return 0; @@ -947,7 +947,7 @@ int mob_spawn_bg(const char* mapname, int16 x, int16 y, const char* mobname, int } data.id = mob_id; - if( (x <= 0 || y <= 0) && !map_search_freecell(NULL, m, &x, &y, -1,-1, 1) ) + if( (x <= 0 || y <= 0) && !map_search_freecell(nullptr, m, &x, &y, -1,-1, 1) ) { ShowWarning("mob_spawn_bg: Couldn't locate a spawn cell for guardian class %d (bg_id %d) at map %s\n",mob_id, bg_id, mapname); return 0; @@ -991,7 +991,7 @@ int mob_can_reach(struct mob_data *md,struct block_list *bl,int range) { nullpo_ret(md); nullpo_ret(bl); - return unit_can_reach_bl(&md->bl, bl, range, 0, NULL, NULL); + return unit_can_reach_bl(&md->bl, bl, range, 0, nullptr, nullptr); } /*========================================== @@ -1105,7 +1105,7 @@ int mob_spawn (struct mob_data *md) t_tick tick = gettick(); md->last_thinktime = tick; - if (md->bl.prev != NULL) + if (md->bl.prev != nullptr) unit_remove_map(&md->bl,CLR_RESPAWN); else if (md->spawn && md->mob_id != md->spawn->id) @@ -1740,7 +1740,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, t_tick tick) if (tbl && md->ud.walktimer != INVALID_TIMER && (!can_move || md->ud.walkpath.path_pos <= battle_config.mob_chase_refresh)) return true; //Walk at least "mob_chase_refresh" cells before dropping the target unless target is non-existent mob_unlocktarget(md, tick); //Unlock target - tbl = NULL; + tbl = nullptr; } } @@ -1770,7 +1770,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, t_tick tick) if( (abl = map_id2bl(md->attacked_id)) && (!tbl || mob_can_changetarget(md, abl, mode)) ) { int dist; - if( md->bl.m != abl->m || abl->prev == NULL + if( md->bl.m != abl->m || abl->prev == nullptr || (dist = distance_bl(&md->bl, abl)) >= MAX_MINCHASE // Attacker longer than visual area || battle_check_target(&md->bl, abl, BCT_ENEMY) <= 0 // Attacker is not enemy of mob || (battle_config.mob_ai&0x2 && !status_check_skilluse(&md->bl, abl, 0, 0)) // Cannot normal attack back to Attacker @@ -1866,7 +1866,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, t_tick tick) struct flooritem_data *fitem; if (md->ud.target == tbl->id && md->ud.walktimer != INVALID_TIMER) return true; //Already locked. - if (md->lootitems == NULL) + if (md->lootitems == nullptr) { //Can't loot... mob_unlocktarget(md, tick); return true; @@ -2025,7 +2025,7 @@ static int mob_ai_sub_lazy(struct mob_data *md, va_list args) { nullpo_ret(md); - if(md->bl.prev == NULL) + if(md->bl.prev == nullptr) return 0; // Monsters force-walked by script commands should not be searching for targets. @@ -2037,7 +2037,7 @@ static int mob_ai_sub_lazy(struct mob_data *md, va_list args) if (battle_config.mob_ai&0x20 && map_getmapdata(md->bl.m)->users>0) return (int)mob_ai_sub_hard(md, tick); - if (md->bl.prev==NULL || md->status.hp == 0) + if (md->bl.prev==nullptr || md->status.hp == 0) return 1; if(battle_config.mob_active_time && @@ -2154,7 +2154,7 @@ static struct item_drop* mob_setdropitem(struct s_mob_drop *mobdrop, int qty, un drop->item_data.identify = itemdb_isidentified(mobdrop->nameid); mob_setdropitem_option(&drop->item_data, mobdrop); drop->mob_id = mob_id; - drop->next = NULL; + drop->next = nullptr; return drop; } @@ -2173,7 +2173,7 @@ static struct item_drop* mob_setlootitem(struct s_mob_lootitem *item, unsigned s **/ drop->mob_id = item->mob_id; - drop->next = NULL; + drop->next = nullptr; return drop; } @@ -2215,8 +2215,8 @@ static void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, str log_pick_mob(md, loot?LOG_TYPE_LOOT:LOG_TYPE_PICKDROP_MONSTER, -ditem->item_data.amount, &ditem->item_data); sd = map_charid2sd(dlist->first_charid); - if( sd == NULL ) sd = map_charid2sd(dlist->second_charid); - if( sd == NULL ) sd = map_charid2sd(dlist->third_charid); + if( sd == nullptr ) sd = map_charid2sd(dlist->second_charid); + if( sd == nullptr ) sd = map_charid2sd(dlist->third_charid); test_autoloot = sd && (drop_rate <= sd->state.autoloot || pc_isautolooting(sd, ditem->item_data.nameid)) && (flag ? ((battle_config.homunculus_autoloot ? (battle_config.hom_idle_no_share == 0 || !pc_isidle_hom(sd)) : 0) || (battle_config.mercenary_autoloot ? (battle_config.mer_idle_no_share == 0 || !pc_isidle_mer(sd)) : 0)) : @@ -2549,8 +2549,8 @@ int mob_getdroprate(struct block_list *src, std::shared_ptr mob, int b int mob_dead(struct mob_data *md, struct block_list *src, int type) { struct status_data *status; - map_session_data *sd = NULL, *tmpsd[DAMAGELOG_SIZE]; - map_session_data *mvp_sd = NULL, *second_sd = NULL, *third_sd = NULL; + map_session_data *sd = nullptr, *tmpsd[DAMAGELOG_SIZE]; + map_session_data *mvp_sd = nullptr, *second_sd = nullptr, *third_sd = nullptr; struct { struct party_data *p; @@ -2591,14 +2591,14 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) // filter out entries not eligible for exp distribution memset(tmpsd,0,sizeof(tmpsd)); for(i = 0, count = 0, mvp_damage = 0; i < DAMAGELOG_SIZE && md->dmglog[i].id; i++) { - map_session_data* tsd = NULL; + map_session_data* tsd = nullptr; if (md->dmglog[i].flag == MDLF_SELF) { //Self damage counts as exp tap count++; continue; } tsd = map_charid2sd(md->dmglog[i].id); - if (tsd == NULL) + if (tsd == nullptr) continue; // skip empty entries if (tsd->bl.m != m) continue; // skip players not on this map @@ -2816,7 +2816,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) dlist->first_charid = (mvp_sd ? mvp_sd->status.char_id : 0); dlist->second_charid = (second_sd ? second_sd->status.char_id : 0); dlist->third_charid = (third_sd ? third_sd->status.char_id : 0); - dlist->item = NULL; + dlist->item = nullptr; for (i = 0; i < MAX_MOB_DROP_TOTAL; i++) { if (md->db->dropitem[i].nameid == 0) @@ -2843,7 +2843,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) //A Rare Drop Global Announce by Lupus if( mvp_sd && md->db->dropitem[i].rate <= battle_config.rare_drop_announce ) { char message[128]; - sprintf (message, msg_txt(NULL,541), mvp_sd->status.name, md->name, it->ename.c_str(), (float)drop_rate/100); + sprintf (message, msg_txt(nullptr,541), mvp_sd->status.name, md->name, it->ename.c_str(), (float)drop_rate/100); //MSG: "'%s' won %s's %s (chance: %0.02f%%)" intif_broadcast(message,strlen(message)+1,BC_DEFAULT); } @@ -2952,7 +2952,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) dlist->first_charid = (mvp_sd ? mvp_sd->status.char_id : 0); dlist->second_charid = (second_sd ? second_sd->status.char_id : 0); dlist->third_charid = (third_sd ? third_sd->status.char_id : 0); - dlist->item = NULL; + dlist->item = nullptr; for (i = 0; i < md->lootitem_count; i++) mob_item_drop(md, dlist, mob_setlootitem(&md->lootitems[i], md->mob_id), 1, 10000, homkillonly || merckillonly); add_timer(tick + (!battle_config.delay_battle_damage?500:0), mob_delay_item_drop, 0, (intptr_t)dlist); @@ -3049,7 +3049,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) //A Rare MVP Drop Global Announce by Lupus if(temp<=battle_config.rare_drop_announce) { char message[128]; - sprintf (message, msg_txt(NULL,541), mvp_sd->status.name, md->name, i_data->ename.c_str(), temp/100.); + sprintf (message, msg_txt(nullptr,541), mvp_sd->status.name, md->name, i_data->ename.c_str(), temp/100.); //MSG: "'%s' won %s's %s (chance: %0.02f%%)" intif_broadcast(message,strlen(message)+1,BC_DEFAULT); } @@ -3078,7 +3078,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) if (type&2 && !sd && md->mob_id == MOBID_EMPERIUM) //Emperium destroyed by script. Discard mvp character. [Skotlex] - mvp_sd = NULL; + mvp_sd = nullptr; rebirth = ( md->sc.getSCE(SC_KAIZEL) || md->sc.getSCE(SC_ULTIMATE_S) || (md->sc.getSCE(SC_REBIRTH) && !md->state.rebirth) ); if( !rebirth ) { // Only trigger event on final kill @@ -3184,7 +3184,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) // MvP tomb [GreenBox] if (battle_config.mvp_tomb_enabled && md->spawn->state.boss && map_getmapflag(md->bl.m, MF_NOTOMB) != 1) - mvptomb_create(md, mvp_sd ? mvp_sd->status.name : NULL, time(NULL)); + mvptomb_create(md, mvp_sd ? mvp_sd->status.name : nullptr, time(nullptr)); if( !rebirth ) mob_setdelayspawn(md); //Set respawning. @@ -3242,7 +3242,7 @@ int mob_guardian_guildchange(struct mob_data *md) } auto g = guild_search(md->guardian_data->castle->guild_id); - if (g == NULL) + if (g == nullptr) { //Properly remove guardian info from Castle data. ShowError("mob_guardian_guildchange: New Guild (id %d) does not exists!\n", md->guardian_data->guild_id); if (md->guardian_data->number >= 0 && md->guardian_data->number < MAX_GUARDIANS) @@ -3347,7 +3347,7 @@ int mob_class_change (struct mob_data *md, int mob_id) nullpo_ret(md); - if( md->bl.prev == NULL ) + if( md->bl.prev == nullptr ) return 0; if (!mob_id || !mobdb_checkid(mob_id)) @@ -3400,7 +3400,7 @@ int mob_class_change (struct mob_data *md, int mob_id) for(i=0;iskilldelay[i] = c; - if (md->lootitems == NULL && status_has_mode(&md->db->status,MD_LOOTER)) + if (md->lootitems == nullptr && status_has_mode(&md->db->status,MD_LOOTER)) md->lootitems = (struct s_mob_lootitem *)aCalloc(LOOTITEM_SIZE,sizeof(struct s_mob_lootitem)); //Targets should be cleared no morph @@ -3613,7 +3613,7 @@ int mob_getfriendhprate_sub(struct block_list *bl,va_list ap) if( md->bl.id == bl->id && !(battle_config.mob_ai&0x10)) return 0; - if ((*fr) != NULL) //A friend was already found. + if ((*fr) != nullptr) //A friend was already found. return 0; if (battle_check_target(&md->bl,bl,BCT_ENEMY)>0) @@ -3627,10 +3627,10 @@ int mob_getfriendhprate_sub(struct block_list *bl,va_list ap) } static struct block_list *mob_getfriendhprate(struct mob_data *md,int64 min_rate,int64 max_rate) { - struct block_list *fr=NULL; + struct block_list *fr=nullptr; int type = BL_MOB; - nullpo_retr(NULL, md); + nullpo_retr(nullptr, md); if (md->special_state.ai) //Summoned creatures. [Skotlex] type = BL_PC; @@ -3650,7 +3650,7 @@ struct block_list *mob_getmasterhpltmaxrate(struct mob_data *md,int64 rate) return bl; } - return NULL; + return nullptr; } bool mob_getstatus_sub( struct mob_data& md, e_mob_skill_condition condition, sc_type type ){ @@ -3709,7 +3709,7 @@ int mob_getfriendstatus_sub( struct block_list *bl, va_list ap ){ struct mob_data *mob_getfriendstatus(struct mob_data *md,int64 cond1,int64 cond2) { - struct mob_data* fr = NULL; + struct mob_data* fr = nullptr; nullpo_ret(md); map_foreachinallrange(mob_getfriendstatus_sub, &md->bl, 8,BL_MOB, md,cond1,cond2,&fr); @@ -3739,9 +3739,9 @@ bool mob_chat_display_message(mob_data &md, uint16 msg_id) { *------------------------------------------*/ int mobskill_use(struct mob_data *md, t_tick tick, int event, int64 damage) { - struct block_list *fbl = NULL; //Friend bl, which can either be a BL_PC or BL_MOB depending on the situation. [Skotlex] + struct block_list *fbl = nullptr; //Friend bl, which can either be a BL_PC or BL_MOB depending on the situation. [Skotlex] struct block_list *bl; - struct mob_data *fmd = NULL; + struct mob_data *fmd = nullptr; int i,j,n; short skill_target; @@ -3813,12 +3813,12 @@ int mobskill_use(struct mob_data *md, t_tick tick, int event, int64 damage) } break; case MSC_FRIENDHPLTMAXRATE: // friend HP < maxhp% - flag = ((fbl = mob_getfriendhprate(md, 0, ms[i]->cond2)) != NULL); break; + flag = ((fbl = mob_getfriendhprate(md, 0, ms[i]->cond2)) != nullptr); break; case MSC_FRIENDHPINRATE : - flag = ((fbl = mob_getfriendhprate(md, ms[i]->cond2, ms[i]->val[0])) != NULL); break; + flag = ((fbl = mob_getfriendhprate(md, ms[i]->cond2, ms[i]->val[0])) != nullptr); break; case MSC_FRIENDSTATUSON: // friend status[num] on case MSC_FRIENDSTATUSOFF: // friend status[num] off - flag = ((fmd = mob_getfriendstatus(md, ms[i]->cond1, ms[i]->cond2)) != NULL); break; + flag = ((fmd = mob_getfriendstatus(md, ms[i]->cond1, ms[i]->cond2)) != nullptr); break; case MSC_SLAVELT: // slave < num flag = (mob_countslave(&md->bl) < c2 ); break; case MSC_ATTACKPCGT: // attack pc > num @@ -3834,7 +3834,7 @@ int mobskill_use(struct mob_data *md, t_tick tick, int event, int64 damage) if (flag) md->state.attacked_count = 0; //Rude attacked count should be reset after the skill condition is met. Thanks to Komurka [Skotlex] break; case MSC_MASTERHPLTMAXRATE: - flag = ((fbl = mob_getmasterhpltmaxrate(md, ms[i]->cond2)) != NULL); break; + flag = ((fbl = mob_getmasterhpltmaxrate(md, ms[i]->cond2)) != nullptr); break; case MSC_MASTERATTACKED: flag = (md->master_id > 0 && (fbl=map_id2bl(md->master_id)) && unit_counttargeted(fbl) > 0); break; case MSC_ALCHEMIST: @@ -3978,7 +3978,7 @@ int mobskill_event(struct mob_data *md, struct block_list *src, t_tick tick, int { int target_id, res = 0; - if(md->bl.prev == NULL || md->status.hp == 0) + if(md->bl.prev == nullptr || md->status.hp == 0) return 0; target_id = md->target_id; @@ -4251,8 +4251,8 @@ int mob_clone_delete(struct mob_data *md){ if (mob_is_clone(mob_id)) { mob_db.erase(mob_id); //Clear references to the db - md->db = NULL; - md->vd = NULL; + md->db = nullptr; + md->vd = nullptr; return 1; } return 0; @@ -5956,11 +5956,11 @@ static bool mob_parse_row_mobskilldb( char** str, size_t columns, size_t current if( j < ARRAYLENGTH(cond2) ) ms->cond2 = cond2[j].id; - ms->val[0] = (int)strtol(str[12],NULL,0); - ms->val[1] = (int)strtol(str[13],NULL,0); - ms->val[2] = (int)strtol(str[14],NULL,0); - ms->val[3] = (int)strtol(str[15],NULL,0); - ms->val[4] = (int)strtol(str[16],NULL,0); + ms->val[0] = (int)strtol(str[12],nullptr,0); + ms->val[1] = (int)strtol(str[13],nullptr,0); + ms->val[2] = (int)strtol(str[14],nullptr,0); + ms->val[3] = (int)strtol(str[15],nullptr,0); + ms->val[4] = (int)strtol(str[16],nullptr,0); if(ms->skill_id == NPC_EMOTION && mob_id > 0 && ms->val[1] == mob->status.mode) @@ -6049,9 +6049,9 @@ static int mob_read_sqlskilldb(void) ++lines; for( i = 0; i < 19; ++i ) { - Sql_GetData(mmysql_handle, i, &str[i], NULL); - if( str[i] == NULL ) - str[i] = dummy; // get rid of NULL columns + Sql_GetData(mmysql_handle, i, &str[i], nullptr); + if( str[i] == nullptr ) + str[i] = dummy; // get rid of nullptr columns } if (!mob_parse_row_mobskilldb(str, 19, count)) diff --git a/src/map/navi.cpp b/src/map/navi.cpp index ca64f24ef0..59e06507ff 100644 --- a/src/map/navi.cpp +++ b/src/map/navi.cpp @@ -156,7 +156,7 @@ bool navi_path_search(struct navi_walkpath_data *wpd, const struct navi_pos *fro struct map_data *mapdata = map_getmapdata(from->m); struct navi_walkpath_data s_wpd; - if (wpd == NULL) + if (wpd == nullptr) wpd = &s_wpd; // use dummy output variable if (from->m != dest->m) @@ -195,7 +195,7 @@ bool navi_path_search(struct navi_walkpath_data *wpd, const struct navi_pos *fro // Start node i = calc_index(from->x, from->y); - tp[i].parent = NULL; + tp[i].parent = nullptr; tp[i].x = from->x; tp[i].y = from->y; tp[i].g_cost = 0; @@ -264,7 +264,7 @@ bool navi_path_search(struct navi_walkpath_data *wpd, const struct navi_pos *fro } } - for (it = current; it->parent != NULL; it = it->parent, len++); + for (it = current; it->parent != nullptr; it = it->parent, len++); if (len > sizeof(wpd->path)) { return false; } diff --git a/src/map/npc.cpp b/src/map/npc.cpp index 1613519537..06c05e96f0 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -1099,11 +1099,11 @@ struct npc_data* npc_name2id(const char* name) * Timer to check for idle time and timeout the dialog if necessary **/ TIMER_FUNC(npc_secure_timeout_timer){ - map_session_data* sd = NULL; + map_session_data* sd = nullptr; unsigned int timeout = NPC_SECURE_TIMEOUT_NEXT; t_tick cur_tick = gettick(); //ensure we are on last tick - if ((sd = map_id2sd(id)) == NULL || !sd->npc_id || sd->state.ignoretimeout) { + if ((sd = map_id2sd(id)) == nullptr || !sd->npc_id || sd->state.ignoretimeout) { if( sd && sd->npc_idle_timer != INVALID_TIMER ){ delete_timer( sd->npc_idle_timer, npc_secure_timeout_timer ); sd->npc_idle_timer = INVALID_TIMER; @@ -1151,7 +1151,7 @@ int npc_event_dequeue(map_session_data* sd,bool free_script_stack) } if (free_script_stack&&sd->st) { script_free_state(sd->st); - sd->st = NULL; + sd->st = nullptr; } sd->npc_id = 0; } @@ -1338,11 +1338,11 @@ TIMER_FUNC(npc_event_do_clock){ char buf[EVENT_NAME_LENGTH]; int c = 0; - timer = time(NULL); + timer = time(nullptr); t = localtime(&timer); if (t->tm_min != ev_tm_b.tm_min ) { - const char* day = NULL; + const char* day = nullptr; safesnprintf(buf,EVENT_NAME_LENGTH,"%s%02d",script_config.timer_minute_event_name,t->tm_min); c += npc_event_doall(buf); @@ -1360,7 +1360,7 @@ TIMER_FUNC(npc_event_do_clock){ case SATURDAY: day = script_config.timer_saturday_event_name; break; } - if( day != NULL ){ + if( day != nullptr ){ safesnprintf(buf,EVENT_NAME_LENGTH,"%s%02d%02d",day,t->tm_hour,t->tm_min); c += npc_event_doall(buf); } @@ -1406,7 +1406,7 @@ int npc_timerevent_export(struct npc_data *nd, int i) // Timer event struct npc_timerevent_list *te = nd->u.scr.timer_event; int j, k2 = nd->u.scr.timeramount; - if (te == NULL) + if (te == nullptr) te = (struct npc_timerevent_list *)aMalloc(sizeof(struct npc_timerevent_list)); else te = (struct npc_timerevent_list *)aRealloc( te, sizeof(struct npc_timerevent_list) * (k2+1) ); @@ -1440,9 +1440,9 @@ TIMER_FUNC(npc_timerevent){ struct npc_data* nd=(struct npc_data *)map_id2bl(id); struct npc_timerevent_list *te; struct timer_event_data *ted = (struct timer_event_data*)data; - map_session_data *sd=NULL; + map_session_data *sd=nullptr; - if( nd == NULL ) + if( nd == nullptr ) { ShowError("npc_timerevent: NPC not found??\n"); return 0; @@ -1509,7 +1509,7 @@ int npc_timerevent_start(struct npc_data* nd, int rid) { int j; t_tick tick = gettick(); - map_session_data *sd = NULL; //Player to whom script is attached. + map_session_data *sd = nullptr; //Player to whom script is attached. nullpo_ret(nd); @@ -1564,7 +1564,7 @@ int npc_timerevent_start(struct npc_data* nd, int rid) *------------------------------------------*/ int npc_timerevent_stop(struct npc_data* nd) { - map_session_data *sd = NULL; + map_session_data *sd = nullptr; int *tid; nullpo_ret(nd); @@ -1582,7 +1582,7 @@ int npc_timerevent_stop(struct npc_data* nd) // Delete timer if ( *tid != INVALID_TIMER ) { - const struct TimerData *td = NULL; + const struct TimerData *td = nullptr; td = get_timer(*tid); if( td && td->data ) @@ -1634,7 +1634,7 @@ void npc_timerevent_quit(map_session_data* sd) if( ev && ev->nd != nd ) { ShowWarning("npc_timerevent_quit: Unable to execute \"%s\", two NPCs have the same event name [%s]!\n",script_config.timer_quit_event_name,buf); - ev = NULL; + ev = nullptr; } if( ev ) { @@ -1688,7 +1688,7 @@ int npc_settimerevent_tick(struct npc_data* nd, int newtimer) { bool flag; int old_rid; - //map_session_data *sd = NULL; + //map_session_data *sd = nullptr; nullpo_ret(nd); @@ -1764,7 +1764,7 @@ int npc_event(map_session_data* sd, const char* eventname, int ontouch) nullpo_ret(sd); - if( ev == NULL || (nd = ev->nd) == NULL ) + if( ev == nullptr || (nd = ev->nd) == nullptr ) { if( !ontouch ) ShowError("npc_event: event not found [%s]\n", eventname); @@ -2012,12 +2012,12 @@ int npc_touch_areanpc2(struct mob_data *md) if( mapdata->npc[i]->bl.id == md->areanpc_id ) break; // Already touch this NPC safesnprintf(eventname, ARRAYLENGTH(eventname), "%s::%s", mapdata->npc[i]->exname, script_config.ontouchnpc_event_name); - if( (ev = (struct event_data*)strdb_get(ev_db, eventname)) == NULL || ev->nd == NULL ) + if( (ev = (struct event_data*)strdb_get(ev_db, eventname)) == nullptr || ev->nd == nullptr ) break; // No OnTouchNPC Event md->areanpc_id = mapdata->npc[i]->bl.id; id = md->bl.id; // Stores Unique ID run_script(ev->nd->u.scr.script, ev->pos, md->bl.id, ev->nd->bl.id); - if( map_id2md(id) == NULL ) return 1; // Not Warped, but killed + if( map_id2md(id) == nullptr ) return 1; // Not Warped, but killed break; } @@ -2104,15 +2104,15 @@ int npc_check_areanpc(int flag, int16 m, int16 x, int16 y, int16 range) /*========================================== * Chk if player not too far to access the npc. - * Returns npc_data (success) or NULL (fail). + * Returns npc_data (success) or nullptr (fail). *------------------------------------------*/ struct npc_data* npc_checknear(map_session_data* sd, struct block_list* bl) { struct npc_data *nd; - nullpo_retr(NULL, sd); - if(bl == NULL) return NULL; - if(bl->type != BL_NPC) return NULL; + nullpo_retr(nullptr, sd); + if(bl == nullptr) return nullptr; + if(bl->type != BL_NPC) return nullptr; nd = (TBL_NPC*)bl; if(sd->state.using_fake_npc && sd->npc_id == bl->id) @@ -2124,7 +2124,7 @@ struct npc_data* npc_checknear(map_session_data* sd, struct block_list* bl) if (bl->m!=sd->bl.m || bl->xbl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 || bl->ybl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1) - return NULL; + return nullptr; return nd; } @@ -2185,7 +2185,7 @@ int npc_click(map_session_data* sd, struct npc_data* nd) } if(!nd) return 1; - if ((nd = npc_checknear(sd,&nd->bl)) == NULL) + if ((nd = npc_checknear(sd,&nd->bl)) == nullptr) return 1; //Hidden/Disabled npc. if (nd->class_ < 0 || nd->sc.option&OPTION_HIDE) @@ -2276,7 +2276,7 @@ bool npc_scriptcont(map_session_data* sd, int id, bool closing){ } if(id != fake_nd->bl.id) { // Not item script - if ((npc_checknear(sd, target)) == NULL) { + if ((npc_checknear(sd, target)) == nullptr) { ShowWarning("npc_scriptcont: failed npc_checknear test.\n"); return true; } @@ -2356,7 +2356,7 @@ int npc_buysellsel(map_session_data* sd, int id, int type) nullpo_retr(1, sd); - if ((nd = npc_checknear(sd,map_id2bl(id))) == NULL) + if ((nd = npc_checknear(sd,map_id2bl(id))) == nullptr) return 1; if (nd->subtype != NPCTYPE_SHOP) { @@ -2425,7 +2425,7 @@ static enum e_CASHSHOP_ACK npc_cashshop_process_payment(struct npc_data *nd, int struct item *it; int amount = 0; - if (sd->inventory.u.items_inventory[i].nameid == 0 || sd->inventory_data[i] == NULL || !(it = &sd->inventory.u.items_inventory[i]) || it->nameid != nd->u.shop.itemshop_nameid) + if (sd->inventory.u.items_inventory[i].nameid == 0 || sd->inventory_data[i] == nullptr || !(it = &sd->inventory.u.items_inventory[i]) || it->nameid != nd->u.shop.itemshop_nameid) continue; if (!pc_can_sell_item(sd, it, nd->subtype)) continue; @@ -2760,7 +2760,7 @@ static int npc_buylist_sub(map_session_data* sd, std::vector& it */ e_purchase_result npc_buylist( map_session_data* sd, std::vector& item_list ){ struct npc_data* nd; - struct npc_item_list *shop = NULL; + struct npc_item_list *shop = nullptr; double z; int j,k,w,skill,new_; uint8 market_index[MAX_INVENTORY]; @@ -2768,7 +2768,7 @@ e_purchase_result npc_buylist( map_session_data* sd, std::vector nullpo_retr(e_purchase_result::PURCHASE_FAIL_COUNT, sd); nd = npc_checknear(sd,map_id2bl(sd->npc_shopid)); - if( nd == NULL ) + if( nd == nullptr ) return e_purchase_result::PURCHASE_FAIL_COUNT; if( nd->subtype != NPCTYPE_SHOP && nd->subtype != NPCTYPE_MARKETSHOP ) return e_purchase_result::PURCHASE_FAIL_COUNT; @@ -2905,7 +2905,7 @@ e_purchase_result npc_buylist( map_session_data* sd, std::vector z = z * (double)skill * (double)battle_config.shop_exp/10000.; if( z < 1 ) z = 1; - pc_gainexp(sd,NULL,0,(int)z, 0); + pc_gainexp(sd,nullptr,0,(int)z, 0); } } @@ -3006,7 +3006,7 @@ uint8 npc_selllist(map_session_data* sd, int list_length, PACKET_CZ_PC_SELL_ITEM nullpo_retr(1, sd); nullpo_retr(1, item_list); - if( ( nd = npc_checknear(sd, map_id2bl(sd->npc_shopid)) ) == NULL || nd->subtype != NPCTYPE_SHOP ) + if( ( nd = npc_checknear(sd, map_id2bl(sd->npc_shopid)) ) == nullptr || nd->subtype != NPCTYPE_SHOP ) { return 1; } @@ -3099,7 +3099,7 @@ uint8 npc_selllist(map_session_data* sd, int list_length, PACKET_CZ_PC_SELL_ITEM z = z * (double)skill * (double)battle_config.shop_exp/10000.; if( z < 1 ) z = 1; - pc_gainexp(sd, NULL, 0, (int)z, 0); + pc_gainexp(sd, nullptr, 0, (int)z, 0); } } @@ -3374,7 +3374,7 @@ int npc_remove_map(struct npc_data* nd) int i; nullpo_retr(1, nd); - if(nd->bl.prev == NULL || nd->bl.m < 0) + if(nd->bl.prev == nullptr || nd->bl.m < 0) return 1; //Not assigned to a map. struct map_data *mapdata = map_getmapdata(nd->bl.m); @@ -3403,7 +3403,7 @@ int npc_remove_map(struct npc_data* nd) mapdata->npc[ mapdata->npc_num_warp ] = mapdata->npc[ mapdata->npc_num_area ]; mapdata->npc[ mapdata->npc_num_area ] = mapdata->npc[ mapdata->npc_num ]; } - mapdata->npc[ mapdata->npc_num ] = NULL; + mapdata->npc[ mapdata->npc_num ] = nullptr; return 0; } @@ -3459,7 +3459,7 @@ int npc_unload(struct npc_data* nd, bool single) { #endif if( single && nd->path ) { - struct npc_path_data* npd = NULL; + struct npc_path_data* npd = nullptr; if( nd->path ) { npd = (struct npc_path_data*)strdb_get(npc_path_db, nd->path); } @@ -3469,8 +3469,8 @@ int npc_unload(struct npc_data* nd, bool single) { aFree(nd->path);/* remove now that no other instances exist */ if (npd == npc_last_npd) { - npc_last_npd = NULL; - npc_last_path = NULL; + npc_last_npd = nullptr; + npc_last_path = nullptr; } } } @@ -3516,11 +3516,11 @@ int npc_unload(struct npc_data* nd, bool single) { if (nd->src_id == 0) { if(nd->u.scr.script) { script_free_code(nd->u.scr.script); - nd->u.scr.script = NULL; + nd->u.scr.script = nullptr; } if (nd->u.scr.label_list) { aFree(nd->u.scr.label_list); - nd->u.scr.label_list = NULL; + nd->u.scr.label_list = nullptr; nd->u.scr.label_list_num = 0; } } @@ -3533,7 +3533,7 @@ int npc_unload(struct npc_data* nd, bool single) { ers_free(npc_sc_display_ers, nd->sc_display[i]); nd->sc_display_count = 0; aFree(nd->sc_display); - nd->sc_display = NULL; + nd->sc_display = nullptr; } } @@ -3662,13 +3662,13 @@ static void npc_parsename(struct npc_data* nd, const char* name, const char* sta safestrncpy(nd->exname, name, sizeof(nd->exname)); } - if( *nd->exname == '\0' || strstr(nd->exname,"::") != NULL ) {// invalid + if( *nd->exname == '\0' || strstr(nd->exname,"::") != nullptr ) {// invalid snprintf(newname, ARRAYLENGTH(newname), "0_%d_%d_%d", nd->bl.m, nd->bl.x, nd->bl.y); ShowWarning("npc_parsename: Invalid unique name in file '%s', line'%d'. Renaming '%s' to '%s'.\n", filepath, strline(buffer,start-buffer), nd->exname, newname); safestrncpy(nd->exname, newname, sizeof(nd->exname)); } - if( (dnd=npc_name2id(nd->exname)) != NULL ) {// duplicate unique name, generate new one + if( (dnd=npc_name2id(nd->exname)) != nullptr ) {// duplicate unique name, generate new one char this_mapname[MAP_NAME_LENGTH_EXT]; char other_mapname[MAP_NAME_LENGTH_EXT]; int i = 0; @@ -3676,7 +3676,7 @@ static void npc_parsename(struct npc_data* nd, const char* name, const char* sta do { ++i; snprintf(newname, ARRAYLENGTH(newname), "%d_%d_%d_%d", i, nd->bl.m, nd->bl.x, nd->bl.y); - } while( npc_name2id(newname) != NULL ); + } while( npc_name2id(newname) != nullptr ); strcpy(this_mapname, (nd->bl.m==-1?"(not on a map)":mapindex_id2name(map_getmapdata(nd->bl.m)->index))); strcpy(other_mapname, (dnd->bl.m==-1?"(not on a map)":mapindex_id2name(map_getmapdata(dnd->bl.m)->index))); @@ -3688,7 +3688,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; + struct npc_path_data * npd = nullptr; if( !(npd = (struct npc_path_data *)strdb_get(npc_path_db,filepath) ) ) { CREATE(npd, struct npc_path_data, 1); @@ -3799,7 +3799,7 @@ struct npc_data *npc_create_npc(int16 m, int16 x, int16 y){ * @param to_mapindex : mapid to warp to * @param to_x : x coordinate to warp to * @param to_y : y coordinate to warp to - * @return NULL:failed creation, npc_data* new warp + * @return nullptr:failed creation, npc_data* new warp */ struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short from_y, short xs, short ys, unsigned short to_mapindex, short to_x, short to_y) { @@ -3809,13 +3809,13 @@ struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short nd = npc_create_npc(from_mapid, from_x, from_y); safestrncpy(nd->exname, name, ARRAYLENGTH(nd->exname)); - if (npc_name2id(nd->exname) != NULL) + if (npc_name2id(nd->exname) != nullptr) flag = 1; if (flag == 1) snprintf(nd->exname, ARRAYLENGTH(nd->exname), "warp_%d_%d_%d", from_mapid, from_x, from_y); - for( i = 0; npc_name2id(nd->exname) != NULL; ++i ) + for( i = 0; npc_name2id(nd->exname) != nullptr; ++i ) snprintf(nd->exname, ARRAYLENGTH(nd->exname), "warp%d_%d_%d_%d", i, from_mapid, from_x, from_y); safestrncpy(nd->name, nd->exname, ARRAYLENGTH(nd->name)); @@ -3836,7 +3836,7 @@ struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short map_addnpc(from_mapid, nd); npc_setcells(nd); if(map_addblock(&nd->bl)) - return NULL; + return nullptr; status_set_viewdata(&nd->bl, nd->class_); status_change_init(&nd->bl); unit_dataset(&nd->bl); @@ -3988,7 +3988,7 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const {// w1=,,, char mapname[MAP_NAME_LENGTH_EXT]; if( sscanf(w1, "%15[^,],%6hd,%6hd,%4hd", mapname, &x, &y, &dir) != 4 - || strchr(w4, ',') == NULL ) + || strchr(w4, ',') == nullptr ) { ShowError("npc_parse_shop: Invalid shop definition in file '%s', line '%d'.\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4); return strchr(start,'\n');// skip and continue @@ -4084,7 +4084,7 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const int value; bool skip = false; - if( p == NULL ) + if( p == nullptr ) break; switch(type) { case NPCTYPE_MARKETSHOP: @@ -4263,7 +4263,7 @@ int npc_convertlabel_db(DBKey key, DBData *data, va_list ap) return 0; } - if( *label_list == NULL ) + if( *label_list == nullptr ) { *label_list = (struct npc_label_list *) aCalloc (1, sizeof(struct npc_label_list)); *label_list_num = 0; @@ -4284,15 +4284,15 @@ static const char* npc_skip_script(const char* start, const char* buffer, const const char* p; int curly_count; - if( start == NULL ) - return NULL;// nothing to skip + if( start == nullptr ) + return nullptr;// nothing to skip // initial bracket (assumes the previous part is ok) p = strchr(start,'{'); - if( p == NULL ) + if( p == nullptr ) { ShowError("npc_skip_script: Missing left curly in file '%s', line'%d'.", filepath, strline(buffer,start-buffer)); - return NULL;// can't continue + return nullptr;// can't continue } // skip everything @@ -4316,19 +4316,19 @@ static const char* npc_skip_script(const char* start, const char* buffer, const else if( *p == '\0' ) { script_error(buffer, filepath, 0, "Unexpected end of string.", p); - return NULL;// can't continue + return nullptr;// can't continue } else if( *p == '\n' ) { script_error(buffer, filepath, 0, "Unexpected newline at string.", p); - return NULL;// can't continue + return nullptr;// can't continue } } } else if( *p == '\0' ) {// end of buffer ShowError("Missing %d right curlys at file '%s', line '%d'.\n", curly_count, filepath, strline(buffer,p-buffer)); - return NULL;// can't continue + return nullptr;// can't continue } } @@ -4374,26 +4374,26 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons if( sscanf(w1, "%15[^,],%6hd,%6hd,%4hd", mapname, &x, &y, &dir) != 4 ) { ShowError("npc_parse_script: Invalid placement format for a script in file '%s', line '%d'. Skipping the rest of file...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4); - return NULL;// unknown format, don't continue + return nullptr;// unknown format, don't continue } m = map_mapname2mapid(mapname); } script_start = strstr(start,",{"); end = strchr(start,'\n'); - if( strstr(w4,",{") == NULL || script_start == NULL || (end != NULL && script_start > end) ) + if( strstr(w4,",{") == nullptr || script_start == nullptr || (end != nullptr && script_start > end) ) { ShowError("npc_parse_script: Missing left curly ',{' in file '%s', line '%d'. Skipping the rest of the file.\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4); - return NULL;// can't continue + return nullptr;// can't continue } ++script_start; end = npc_skip_script(script_start, buffer, filepath); - if( end == NULL ) - return NULL;// (simple) parse error, don't continue + if( end == nullptr ) + return nullptr;// (simple) parse error, don't continue script = parse_script(script_start, filepath, strline(buffer,script_start-buffer), SCRIPT_USE_LABEL_DB); - label_list = NULL; + label_list = nullptr; label_list_num = 0; if( script ) { @@ -4434,7 +4434,7 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons nd->ud.dir = (uint8)dir; npc_setcells(nd); if(map_addblock(&nd->bl)) - return NULL; + return nullptr; if( nd->class_ != JT_FAKENPC ) { status_set_viewdata(&nd->bl, nd->class_); @@ -4519,7 +4519,7 @@ const char* npc_parse_duplicate( char* w1, char* w2, char* w3, char* w4, const c safestrncpy(srcname, w2+10, length-10); dnd = npc_name2id(srcname); - if( dnd == NULL) { + if( dnd == nullptr) { ShowError("npc_parse_script: original npc not found for duplicate in file '%s', line '%d' : %s\n", filepath, strline(buffer,start-buffer), srcname); return end;// next line, try to continue } @@ -4658,13 +4658,13 @@ int npc_duplicate4instance(struct npc_data *snd, int16 m) { return 1; snprintf(newname, ARRAYLENGTH(newname), "dup_%d_%d", mapdata->instance_id, snd->bl.id); - if( npc_name2id(newname) != NULL ) { // Name already in use + if( npc_name2id(newname) != nullptr ) { // Name already in use ShowError("npc_duplicate4instance: the npcname (%s) is already in use while trying to duplicate npc %s in instance %d.\n", newname, snd->exname, mapdata->instance_id); return 1; } if( snd->subtype == NPCTYPE_WARP ) { // Adjust destination, if instanced - struct npc_data *wnd = NULL; // New NPC + struct npc_data *wnd = nullptr; // New NPC std::shared_ptr idata = util::umap_find(instances, mapdata->instance_id); int dm = map_mapindex2mapid(snd->u.warp.mapindex), imap = 0; @@ -4800,7 +4800,7 @@ void npc_market_delfromsql_(const char *exname, t_itemid nameid, bool clear) { **/ static int npc_market_checkall_sub(DBKey key, DBData *data, va_list ap) { struct s_npc_market *market = (struct s_npc_market *)db_data2ptr(data); - struct npc_data *nd = NULL; + struct npc_data *nd = nullptr; uint16 i; if (!market) @@ -4870,7 +4870,7 @@ static int npc_market_free(DBKey key, DBData *data, va_list ap) { return 0; if (market->list) { aFree(market->list); - market->list = NULL; + market->list = nullptr; } aFree(market); return 1; @@ -4907,7 +4907,7 @@ static void npc_market_fromsql(void) { struct s_npc_market *market; struct npc_item_list list; - Sql_GetData(mmysql_handle, 0, &data, NULL); + Sql_GetData(mmysql_handle, 0, &data, nullptr); if (!(market = (struct s_npc_market *)strdb_get(NPCMarketDB,data))) { CREATE(market, struct s_npc_market, 1); @@ -4916,10 +4916,10 @@ static void npc_market_fromsql(void) { strdb_put(NPCMarketDB, market->exname, market); } - Sql_GetData(mmysql_handle, 1, &data, NULL); list.nameid = strtoul(data, nullptr, 10); - Sql_GetData(mmysql_handle, 2, &data, NULL); list.value = atoi(data); - Sql_GetData(mmysql_handle, 3, &data, NULL); list.qty = atoi(data); - Sql_GetData(mmysql_handle, 4, &data, NULL); list.flag = atoi(data); + Sql_GetData(mmysql_handle, 1, &data, nullptr); list.nameid = strtoul(data, nullptr, 10); + Sql_GetData(mmysql_handle, 2, &data, nullptr); list.value = atoi(data); + Sql_GetData(mmysql_handle, 3, &data, nullptr); list.qty = atoi(data); + Sql_GetData(mmysql_handle, 4, &data, nullptr); list.flag = atoi(data); std::shared_ptr id = item_db.find(list.nameid); @@ -5021,7 +5021,7 @@ void npc_unsetcells(struct npc_data* nd) bool npc_movenpc(struct npc_data* nd, int16 x, int16 y) { - if (nd->bl.m < 0 || nd->bl.prev == NULL) + if (nd->bl.m < 0 || nd->bl.prev == nullptr) return false; //Not on a map. struct map_data *mapdata = map_getmapdata(nd->bl.m); @@ -5076,7 +5076,7 @@ int npc_do_atcmd_event(map_session_data* sd, const char* command, const char* me nullpo_ret(sd); - if( ev == NULL || (nd = ev->nd) == NULL ) { + if( ev == nullptr || (nd = ev->nd) == nullptr ) { ShowError("npc_event: event not found [%s]\n", eventname); return 0; } @@ -5099,7 +5099,7 @@ int npc_do_atcmd_event(map_session_data* sd, const char* command, const char* me } st = script_alloc_state(ev->nd->u.scr.script, ev->pos, sd->bl.id, ev->nd->bl.id); - setd_sub_str( st, NULL, ".@atcmd_command$", 0, command, NULL ); + setd_sub_str( st, nullptr, ".@atcmd_command$", 0, command, nullptr ); // split atcmd parameters based on spaces @@ -5113,7 +5113,7 @@ int npc_do_atcmd_event(map_session_data* sd, const char* command, const char* me temp[k] = '\0'; k = 0; if( temp[0] != '\0' ) { - setd_sub_str( st, NULL, ".@atcmd_parameters$", j++, temp, NULL ); + setd_sub_str( st, nullptr, ".@atcmd_parameters$", j++, temp, nullptr ); } } else { temp[k] = message[i]; @@ -5121,7 +5121,7 @@ int npc_do_atcmd_event(map_session_data* sd, const char* command, const char* me } } - setd_sub_num( st, NULL, ".@atcmd_numparameters", 0, j, NULL ); + setd_sub_num( st, nullptr, ".@atcmd_numparameters", 0, j, nullptr ); aFree(temp); run_script_main(st); @@ -5140,18 +5140,18 @@ static const char* npc_parse_function(char* w1, char* w2, char* w3, char* w4, co script_start = strstr(start,"\t{"); end = strchr(start,'\n'); - if (*w4 != '{' || script_start == NULL || (end != NULL && script_start > end)) { + if (*w4 != '{' || script_start == nullptr || (end != nullptr && script_start > end)) { ShowError("npc_parse_function: Missing left curly '%%TAB%%{' in file '%s', line '%d'. Skipping the rest of the file.\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4); - return NULL;// can't continue + return nullptr;// can't continue } ++script_start; end = npc_skip_script(script_start,buffer,filepath); - if( end == NULL ) - return NULL;// (simple) parse error, don't continue + if( end == nullptr ) + return nullptr;// (simple) parse error, don't continue script = parse_script(script_start, filepath, strline(buffer,start-buffer), SCRIPT_RETURN_EMPTY_SCRIPT); - if( script == NULL )// parse error, continue + if( script == nullptr )// parse error, continue return end; func_db = script_get_userfunc_db(); @@ -5755,7 +5755,7 @@ int npc_script_event(map_session_data* sd, enum npce_event type){ if (type == NPCE_MAX) return 0; if (!sd) { - ShowError("npc_script_event: NULL sd. Event Type %d\n", type); + ShowError("npc_script_event: nullptr sd. Event Type %d\n", type); return 0; } @@ -5929,7 +5929,7 @@ const char *npc_get_script_event_name(int npce_index) return script_config.kill_mob_event_name; default: ShowError("npc_get_script_event_name: npce_index is outside the array limits: %d (max: %d).\n", npce_index, NPCE_MAX); - return NULL; + return nullptr; } } @@ -5974,7 +5974,7 @@ void npc_read_event_script(void) } void npc_clear_pathlist(void) { - struct npc_path_data *npd = NULL; + struct npc_path_data *npd = nullptr; DBIterator *path_list = db_iterator(npc_path_db); /* free all npc_path_data filepaths */ @@ -6028,9 +6028,9 @@ int npc_reload(void) { for( int16 j = 0; j < MAX_MOB_LIST_PER_MAP; j++ ){ struct map_data *mapdata = map_getmapdata(i); - if (mapdata->moblist[j] != NULL) { + if (mapdata->moblist[j] != nullptr) { aFree(mapdata->moblist[j]); - mapdata->moblist[j] = NULL; + mapdata->moblist[j] = nullptr; } if( mapdata->mob_delete_timer != INVALID_TIMER ) { // Mobs were removed anyway,so delete the timer [Inkfish] @@ -6087,7 +6087,7 @@ int npc_reload(void) { //Unload all npc in the given file bool npc_unloadfile( const char* path ) { DBIterator * iter = db_iterator(npcname_db); - struct npc_data* nd = NULL; + struct npc_data* nd = nullptr; bool found = false; for( nd = (struct npc_data*)dbi_first(iter); dbi_exists(iter); nd = (struct npc_data*)dbi_next(iter) ) { @@ -6119,9 +6119,9 @@ void do_clear_npc(void) { void do_final_npc(void) { npc_clear_pathlist(); script_event.clear(); - ev_db->destroy(ev_db, NULL); - npcname_db->destroy(npcname_db, NULL); - npc_path_db->destroy(npc_path_db, NULL); + ev_db->destroy(ev_db, nullptr); + npcname_db->destroy(npcname_db, nullptr); + npc_path_db->destroy(npc_path_db, nullptr); #if PACKETVER >= 20131223 NPCMarketDB->destroy(NPCMarketDB, npc_market_free); #endif diff --git a/src/map/npc_chat.cpp b/src/map/npc_chat.cpp index df4248e57b..1716913b90 100644 --- a/src/map/npc_chat.cpp +++ b/src/map/npc_chat.cpp @@ -114,29 +114,29 @@ static struct pcrematch_set* lookup_pcreset(struct npc_data* nd, int64 setid) { struct pcrematch_set *pcreset; struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb; - if (npcParse == NULL) + if (npcParse == nullptr) nd->chatdb = npcParse = (struct npc_parse *) aCalloc(sizeof(struct npc_parse), 1); pcreset = npcParse->active; - while (pcreset != NULL) { + while (pcreset != nullptr) { if (pcreset->setid == setid) break; pcreset = pcreset->next; } - if (pcreset == NULL) + if (pcreset == nullptr) pcreset = npcParse->inactive; - while (pcreset != NULL) { + while (pcreset != nullptr) { if (pcreset->setid == setid) break; pcreset = pcreset->next; } - if (pcreset == NULL) { + if (pcreset == nullptr) { pcreset = (struct pcrematch_set *) aCalloc(sizeof(struct pcrematch_set), 1); pcreset->next = npcParse->inactive; - if (pcreset->next != NULL) + if (pcreset->next != nullptr) pcreset->next->prev = pcreset; pcreset->prev = 0; npcParse->inactive = pcreset; @@ -155,26 +155,26 @@ static void activate_pcreset(struct npc_data* nd, int64 setid) { struct pcrematch_set *pcreset; struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb; - if (npcParse == NULL) + if (npcParse == nullptr) return; // Nothing to activate... pcreset = npcParse->inactive; - while (pcreset != NULL) { + while (pcreset != nullptr) { if (pcreset->setid == setid) break; pcreset = pcreset->next; } - if (pcreset == NULL) + if (pcreset == nullptr) return; // not in inactive list - if (pcreset->next != NULL) + if (pcreset->next != nullptr) pcreset->next->prev = pcreset->prev; - if (pcreset->prev != NULL) + if (pcreset->prev != nullptr) pcreset->prev->next = pcreset->next; else npcParse->inactive = pcreset->next; - pcreset->prev = NULL; + pcreset->prev = nullptr; pcreset->next = npcParse->active; - if (pcreset->next != NULL) + if (pcreset->next != nullptr) pcreset->next->prev = pcreset; npcParse->active = pcreset; } @@ -188,31 +188,31 @@ static void deactivate_pcreset(struct npc_data* nd, int64 setid) { struct pcrematch_set *pcreset; struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb; - if (npcParse == NULL) + if (npcParse == nullptr) return; // Nothing to deactivate... if (setid == -1) { - while(npcParse->active != NULL) + while(npcParse->active != nullptr) deactivate_pcreset(nd, npcParse->active->setid); return; } pcreset = npcParse->active; - while (pcreset != NULL) { + while (pcreset != nullptr) { if (pcreset->setid == setid) break; pcreset = pcreset->next; } - if (pcreset == NULL) + if (pcreset == nullptr) return; // not in active list - if (pcreset->next != NULL) + if (pcreset->next != nullptr) pcreset->next->prev = pcreset->prev; - if (pcreset->prev != NULL) + if (pcreset->prev != nullptr) pcreset->prev->next = pcreset->next; else npcParse->active = pcreset->next; - pcreset->prev = NULL; + pcreset->prev = nullptr; pcreset->next = npcParse->inactive; - if (pcreset->next != NULL) + if (pcreset->next != nullptr) pcreset->next->prev = pcreset; npcParse->inactive = pcreset; } @@ -225,29 +225,29 @@ static void delete_pcreset(struct npc_data* nd, int64 setid) int active = 1; struct pcrematch_set *pcreset; struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb; - if (npcParse == NULL) + if (npcParse == nullptr) return; // Nothing to deactivate... pcreset = npcParse->active; - while (pcreset != NULL) { + while (pcreset != nullptr) { if (pcreset->setid == setid) break; pcreset = pcreset->next; } - if (pcreset == NULL) { + if (pcreset == nullptr) { active = 0; pcreset = npcParse->inactive; - while (pcreset != NULL) { + while (pcreset != nullptr) { if (pcreset->setid == setid) break; pcreset = pcreset->next; } } - if (pcreset == NULL) + if (pcreset == nullptr) return; - if (pcreset->next != NULL) + if (pcreset->next != nullptr) pcreset->next->prev = pcreset->prev; - if (pcreset->prev != NULL) + if (pcreset->prev != nullptr) pcreset->prev->next = pcreset->next; if(active) @@ -255,8 +255,8 @@ static void delete_pcreset(struct npc_data* nd, int64 setid) else npcParse->inactive = pcreset->next; - pcreset->prev = NULL; - pcreset->next = NULL; + pcreset->prev = nullptr; + pcreset->next = nullptr; while (pcreset->head) { struct pcrematch_entry* n = pcreset->head->next; @@ -282,17 +282,17 @@ static struct pcrematch_entry* create_pcrematch_entry(struct pcrematch_set* set) // items defined later. as a result, we have to do some work up front. /* if we are the first pattern, stick us at the end */ - if (last == NULL) { + if (last == nullptr) { set->head = e; return e; } /* Look for the last entry */ - while (last->next != NULL) + while (last->next != nullptr) last = last->next; last->next = e; - e->next = NULL; + e->next = nullptr; return e; } @@ -309,7 +309,7 @@ void npc_chat_def_pattern(struct npc_data* nd, int64 setid, const char* pattern, struct pcrematch_entry *e = create_pcrematch_entry(s); e->pattern = aStrdup(pattern); e->label = aStrdup(label); - e->pcre_ = pcre_compile(pattern, PCRE_CASELESS, &err, &erroff, NULL); + e->pcre_ = pcre_compile(pattern, PCRE_CASELESS, &err, &erroff, nullptr); e->pcre_extra_ = pcre_study(e->pcre_, 0, &err); } @@ -322,7 +322,7 @@ void npc_chat_def_pattern(struct npc_data* nd, int64 setid, const char* pattern, void npc_chat_finalize(struct npc_data* nd) { struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb; - if (npcParse == NULL) + if (npcParse == nullptr) return; while(npcParse->active) @@ -350,7 +350,7 @@ int npc_chat_sub(struct block_list* bl, va_list ap) struct pcrematch_entry* e; // Not interested in anything you might have to say... - if (npcParse == NULL || npcParse->active == NULL) + if (npcParse == nullptr || npcParse->active == nullptr) return 0; msg = va_arg(ap,char*); @@ -358,10 +358,10 @@ int npc_chat_sub(struct block_list* bl, va_list ap) sd = va_arg(ap,map_session_data *); // iterate across all active sets - for (pcreset = npcParse->active; pcreset != NULL; pcreset = pcreset->next) + for (pcreset = npcParse->active; pcreset != nullptr; pcreset = pcreset->next) { // interate across all patterns in that set - for (e = pcreset->head; e != NULL; e = e->next) + for (e = pcreset->head; e != nullptr; e = e->next) { int offsets[2*10 + 10]; // 1/3 reserved for temp space requred by pcre_exec diff --git a/src/map/party.cpp b/src/map/party.cpp index 1dd38ce30d..09a9cd7161 100644 --- a/src/map/party.cpp +++ b/src/map/party.cpp @@ -58,7 +58,7 @@ int party_getmemberid(struct party_data* p, map_session_data* sd) { int member_id; nullpo_retr(-1, p); - if( sd == NULL ) + if( sd == nullptr ) return -1;// no player ARR_FIND(0, MAX_PARTY, member_id, p->party.member[member_id].account_id == sd->status.account_id && @@ -74,9 +74,9 @@ int party_getmemberid(struct party_data* p, map_session_data* sd) map_session_data* party_getavailablesd(struct party_data *p) { int i; - nullpo_retr(NULL, p); - ARR_FIND(0, MAX_PARTY, i, p->data[i].sd != NULL); - return( i < MAX_PARTY ) ? p->data[i].sd : NULL; + nullpo_retr(nullptr, p); + ARR_FIND(0, MAX_PARTY, i, p->data[i].sd != nullptr); + return( i < MAX_PARTY ) ? p->data[i].sd : nullptr; } /*========================================== @@ -88,14 +88,14 @@ static TBL_PC* party_sd_check(int party_id, uint32 account_id, uint32 char_id) TBL_PC* sd = map_id2sd(account_id); if (!(sd && sd->status.char_id == char_id)) - return NULL; + return nullptr; if( sd->status.party_id == 0 ) sd->status.party_id = party_id;// auto-join if not in a party if (sd->status.party_id != party_id) { //If player belongs to a different party, kick him out. intif_party_leave(party_id,account_id,char_id,sd->status.name,PARTY_MEMBER_WITHDRAW_LEAVE); - return NULL; + return nullptr; } return sd; @@ -107,8 +107,8 @@ static TBL_PC* party_sd_check(int party_id, uint32 account_id, uint32 char_id) *------------------------------------------*/ void do_final_party(void) { - party_db->destroy(party_db,NULL); - party_booking_db->destroy(party_booking_db,NULL); // Party Booking [Spiria] + party_db->destroy(party_db,nullptr); + party_booking_db->destroy(party_booking_db,nullptr); // Party Booking [Spiria] } // Constructor, init vars void do_init_party(void) @@ -123,7 +123,7 @@ void do_init_party(void) struct party_data* party_search(int party_id) { if(!party_id) - return NULL; + return nullptr; return (struct party_data*)idb_get(party_db,party_id); } @@ -284,7 +284,7 @@ int party_recv_info(struct party* sp, uint32 char_id) p = (struct party_data*)idb_get(party_db, sp->party_id); - if( p != NULL ) { // diff members + if( p != nullptr ) { // diff members int i; for( member_id = 0; member_id < MAX_PARTY; ++member_id ) { @@ -329,7 +329,7 @@ int party_recv_info(struct party* sp, uint32 char_id) member_id = removed[--removed_count]; sd = p->data[member_id].sd; - if( sd == NULL ) + if( sd == nullptr ) continue; // not online party_member_withdraw(sp->party_id, sd->status.account_id, sd->status.char_id, sd->status.name, PARTY_MEMBER_WITHDRAW_LEAVE); @@ -352,7 +352,7 @@ int party_recv_info(struct party* sp, uint32 char_id) member_id = added[--added_count]; sd = p->data[member_id].sd; - if( sd == NULL ) + if( sd == nullptr ) continue;// not online clif_name_area(&sd->bl); //Update other people's display. [Skotlex] @@ -390,7 +390,7 @@ int party_invite(map_session_data *sd,map_session_data *tsd) nullpo_ret(sd); - if( ( p = party_search(sd->status.party_id) ) == NULL ) + if( ( p = party_search(sd->status.party_id) ) == nullptr ) return 0; // confirm if this player is a party leader @@ -423,7 +423,7 @@ int party_invite(map_session_data *sd,map_session_data *tsd) return 0; } - if( tsd == NULL) { + if( tsd == nullptr) { clif_party_invite_reply( *sd, "", PARTY_REPLY_OFFLINE ); return 0; } @@ -582,7 +582,7 @@ int party_reply_invite(map_session_data *sd,int party_id,int flag) sd->party_invite = 0; sd->party_invite_account = 0; - if( tsd != NULL ) + if( tsd != nullptr ) clif_party_invite_reply( *tsd, sd->status.name, PARTY_REPLY_REJECTED ); } @@ -619,7 +619,7 @@ int party_member_added(int party_id,uint32 account_id,uint32 char_id, int flag) struct party_data *p = party_search(party_id); int i; - if(sd == NULL || sd->status.char_id != char_id || !sd->party_joining ) { + if(sd == nullptr || sd->status.char_id != char_id || !sd->party_joining ) { if (!flag) //Char logged off before being accepted into party. intif_party_leave(party_id,account_id,char_id,"",PARTY_MEMBER_WITHDRAW_LEAVE); return 0; @@ -638,7 +638,7 @@ int party_member_added(int party_id,uint32 account_id,uint32 char_id, int flag) } if( flag ) { // failed - if( sd2 != NULL ) + if( sd2 != nullptr ) clif_party_invite_reply( *sd2, sd->status.name, PARTY_REPLY_FULL ); return 0; } @@ -649,7 +649,7 @@ int party_member_added(int party_id,uint32 account_id,uint32 char_id, int flag) clif_party_option(p,sd,0x100); clif_party_info( *p, sd ); - if( sd2 != NULL ) + if( sd2 != nullptr ) clif_party_invite_reply( *sd2, sd->status.name, PARTY_REPLY_ACCEPTED ); for( i = 0; i < ARRAYLENGTH(p->data); ++i ) { // hp of the other party members @@ -677,7 +677,7 @@ int party_removemember(map_session_data* sd, uint32 account_id, char* name) p = party_search(sd->status.party_id); - if( p == NULL ) + if( p == nullptr ) return 0; // check the requesting char's party membership @@ -729,7 +729,7 @@ int party_leave(map_session_data *sd) p = party_search(sd->status.party_id); - if( p == NULL ) + if( p == nullptr ) return 0; ARR_FIND( 0, MAX_PARTY, i, p->party.member[i].account_id == sd->status.account_id && p->party.member[i].char_id == sd->status.char_id ); @@ -801,7 +801,7 @@ int party_broken(int party_id) p = party_search(party_id); - if( p == NULL ) + if( p == nullptr ) return 0; if( p->instance_id ) @@ -867,7 +867,7 @@ int party_optionchanged(int party_id,uint32 account_id,int exp,int item,int flag struct party_data *p; map_session_data *sd=map_id2sd(account_id); - if( (p = party_search(party_id)) == NULL) + if( (p = party_search(party_id)) == nullptr) return 0; //Flag&1: Exp change denied. Flag&2: Item change denied. @@ -900,7 +900,7 @@ int party_changeleader(map_session_data *sd, map_session_data *tsd, struct party return 0; } - if ((p = party_search(sd->status.party_id)) == NULL ) + if ((p = party_search(sd->status.party_id)) == nullptr ) return -1; ARR_FIND( 0, MAX_PARTY, mi, p->data[mi].sd == sd ); @@ -958,7 +958,7 @@ int party_recv_movemap( int party_id, uint32 account_id, uint32 char_id, int onl p = party_search(party_id); - if( p == NULL ) + if( p == nullptr ) return 0; ARR_FIND( 0, MAX_PARTY, i, p->party.member[i].account_id == account_id && p->party.member[i].char_id == char_id ); @@ -1047,7 +1047,7 @@ int party_send_message(map_session_data *sd,const char *mes, size_t len) party_recv_message(sd->status.party_id,sd->status.account_id,mes,len); // Chat logging type 'P' / Party Chat - log_chat(LOG_CHAT_PARTY, sd->status.party_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes); + log_chat(LOG_CHAT_PARTY, sd->status.party_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, nullptr, mes); return 0; } @@ -1055,7 +1055,7 @@ int party_send_message(map_session_data *sd,const char *mes, size_t len) int party_recv_message(int party_id,uint32 account_id,const char *mes,int len) { struct party_data *p; - if( (p=party_search(party_id))==NULL) + if( (p=party_search(party_id))==nullptr) return 0; clif_party_message( *p, account_id, mes, len ); return 0; @@ -1067,7 +1067,7 @@ int party_skill_check(map_session_data *sd, int party_id, uint16 skill_id, uint1 map_session_data *p_sd; int i; - if(!party_id || (p = party_search(party_id)) == NULL) + if(!party_id || (p = party_search(party_id)) == nullptr) return 0; party_check_state(p); switch(skill_id) { @@ -1086,7 +1086,7 @@ int party_skill_check(map_session_data *sd, int party_id, uint16 skill_id, uint1 } for(i = 0; i < MAX_PARTY; i++) { - if ((p_sd = p->data[i].sd) == NULL) + if ((p_sd = p->data[i].sd) == nullptr) continue; if (sd->bl.m != p_sd->bl.m) @@ -1192,7 +1192,7 @@ void party_exp_share(struct party_data* p, struct block_list* src, t_exp base_ex // count the number of players eligible for exp sharing for (i = c = 0; i < MAX_PARTY; i++) { - if( (sd[c] = p->data[i].sd) == NULL || sd[c]->bl.m != src->m || pc_isdead(sd[c]) || (battle_config.idle_no_share && pc_isidle_party(sd[c])) ) + if( (sd[c] = p->data[i].sd) == nullptr || sd[c]->bl.m != src->m || pc_isdead(sd[c]) || (battle_config.idle_no_share && pc_isidle_party(sd[c])) ) continue; c++; } @@ -1239,7 +1239,7 @@ void party_exp_share(struct party_data* p, struct block_list* src, t_exp base_ex //Does party loot. first_charid holds the charid of the player who has time priority to take the item. int party_share_loot(struct party_data* p, map_session_data* sd, struct item* item, int first_charid) { - TBL_PC* target = NULL; + TBL_PC* target = nullptr; int i; if (p && p->party.item&2 && (first_charid || !(battle_config.party_share_type&1))) { @@ -1254,7 +1254,7 @@ int party_share_loot(struct party_data* p, map_session_data* sd, struct item* it if (i >= MAX_PARTY) i = 0; // reset counter to 1st person in party so it'll stop when it reaches "itemc" - if( (psd = p->data[i].sd) == NULL || sd->bl.m != psd->bl.m || pc_isdead(psd) || (battle_config.idle_no_share && pc_isidle_party(psd)) ) + if( (psd = p->data[i].sd) == nullptr || sd->bl.m != psd->bl.m || pc_isdead(psd) || (battle_config.idle_no_share && pc_isidle_party(psd)) ) continue; if (pc_additem(psd,item,item->amount,LOG_TYPE_PICKDROP_PLAYER)) @@ -1271,7 +1271,7 @@ int party_share_loot(struct party_data* p, map_session_data* sd, struct item* it //Collect pick candidates for (i = 0; i < MAX_PARTY; i++) { - if( (psd[count] = p->data[i].sd) == NULL || psd[count]->bl.m != sd->bl.m || pc_isdead(psd[count]) || (battle_config.idle_no_share && pc_isidle_party(psd[count])) ) + if( (psd[count] = p->data[i].sd) == nullptr || psd[count]->bl.m != sd->bl.m || pc_isdead(psd[count]) || (battle_config.idle_no_share && pc_isidle_party(psd[count])) ) continue; count++; @@ -1364,7 +1364,7 @@ int party_foreachsamemap(int (*func)(struct block_list*,va_list),map_session_dat nullpo_ret(sd); - if((p = party_search(sd->status.party_id)) == NULL) + if((p = party_search(sd->status.party_id)) == nullptr) return 0; x0 = sd->bl.x-range; @@ -1423,7 +1423,7 @@ void party_booking_register(map_session_data *sd, short level, short mapid, shor pb_ad = (struct party_booking_ad_info*)idb_get(party_booking_db, sd->status.char_id); - if( pb_ad == NULL ) { + if( pb_ad == nullptr ) { pb_ad = create_party_booking_data(); idb_put(party_booking_db, sd->status.char_id, pb_ad); } else { // already registered @@ -1432,7 +1432,7 @@ void party_booking_register(map_session_data *sd, short level, short mapid, shor } memcpy(pb_ad->charname,sd->status.name,NAME_LENGTH); - pb_ad->starttime = (int)time(NULL); + pb_ad->starttime = (int)time(nullptr); pb_ad->p_detail.level = level; pb_ad->p_detail.mapid = mapid; @@ -1452,10 +1452,10 @@ void party_booking_update(map_session_data *sd, short* job) pb_ad = (struct party_booking_ad_info*)idb_get(party_booking_db, sd->status.char_id); - if( pb_ad == NULL ) + if( pb_ad == nullptr ) return; - pb_ad->starttime = (int)time(NULL);// Update time. + pb_ad->starttime = (int)time(nullptr);// Update time. for(i = 0; i < MAX_PARTY_BOOKING_JOBS; i++) if(job[i] != 0xFF) @@ -1508,7 +1508,7 @@ bool party_booking_delete(map_session_data *sd) { struct party_booking_ad_info* pb_ad; - if((pb_ad = (struct party_booking_ad_info*)idb_get(party_booking_db, sd->status.char_id)) != NULL) { + if((pb_ad = (struct party_booking_ad_info*)idb_get(party_booking_db, sd->status.char_id)) != nullptr) { clif_PartyBookingDeleteNotify(sd, pb_ad->index); idb_remove(party_booking_db,sd->status.char_id); } diff --git a/src/map/path.cpp b/src/map/path.cpp index 4c1ce67ba3..fc157d7d76 100644 --- a/src/map/path.cpp +++ b/src/map/path.cpp @@ -137,7 +137,7 @@ bool path_search_long(struct shootpath_data *spd,int16 m,int16 x0,int16 y0,int16 struct map_data *mapdata = map_getmapdata(m); struct shootpath_data s_spd; - if( spd == NULL ) + if( spd == nullptr ) spd = &s_spd; // use dummy output variable if (!mapdata->cell) @@ -273,9 +273,9 @@ bool path_search(struct walkpath_data *wpd, int16 m, int16 x0, int16 y0, int16 x struct walkpath_data s_wpd; if (flag&2) - return path_search_long(NULL, m, x0, y0, x1, y1, cell); + return path_search_long(nullptr, m, x0, y0, x1, y1, cell); - if (wpd == NULL) + if (wpd == nullptr) wpd = &s_wpd; // use dummy output variable if (!mapdata->cell) @@ -343,7 +343,7 @@ bool path_search(struct walkpath_data *wpd, int16 m, int16 x0, int16 y0, int16 x // Start node i = calc_index(x0, y0); - tp[i].parent = NULL; + tp[i].parent = nullptr; tp[i].x = x0; tp[i].y = y0; tp[i].g_cost = 0; @@ -411,7 +411,7 @@ bool path_search(struct walkpath_data *wpd, int16 m, int16 x0, int16 y0, int16 x } } - for (it = current; it->parent != NULL; it = it->parent, len++); + for (it = current; it->parent != nullptr; it = it->parent, len++); if (len > sizeof(wpd->path)) return false; diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 3fa1834d7f..1298a8d4a8 100755 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -84,7 +84,7 @@ SkillTreeDatabase skill_tree_db; int day_timer_tid = INVALID_TIMER; int night_timer_tid = INVALID_TIMER; -struct eri *pc_sc_display_ers = NULL; +struct eri *pc_sc_display_ers = nullptr; struct eri *num_reg_ers; struct eri *str_reg_ers; int pc_expiration_tid = INVALID_TIMER; @@ -669,7 +669,7 @@ void pc_set_reg_load( bool val ){ * to keep cooldowns in memory between player log-ins. * All cooldowns are reset when server is restarted. **/ -DBMap* itemcd_db = NULL; // char_id -> struct item_cd +DBMap* itemcd_db = nullptr; // char_id -> struct item_cd struct item_cd { t_tick tick[MAX_ITEMDELAYS]; //tick t_itemid nameid[MAX_ITEMDELAYS]; //item id @@ -756,7 +756,7 @@ void pc_delete_bg_queue_timer(map_session_data *sd) { static TIMER_FUNC(pc_invincible_timer){ map_session_data *sd; - if( (sd=(map_session_data *)map_id2sd(id)) == NULL || sd->bl.type!=BL_PC ) + if( (sd=(map_session_data *)map_id2sd(id)) == nullptr || sd->bl.type!=BL_PC ) return 1; if(sd->invincible_timer != tid){ @@ -793,7 +793,7 @@ static TIMER_FUNC(pc_spiritball_timer){ map_session_data *sd; int i; - if( (sd=(map_session_data *)map_id2sd(id)) == NULL || sd->bl.type!=BL_PC ) + if( (sd=(map_session_data *)map_id2sd(id)) == nullptr || sd->bl.type!=BL_PC ) return 1; if( sd->spiritball <= 0 ) @@ -1109,7 +1109,7 @@ void pc_setrestartvalue(map_session_data *sd, char type) { TIMER_FUNC(pc_inventory_rental_end){ map_session_data *sd = map_id2sd(id); - if( sd == NULL ) + if( sd == nullptr ) return 0; if( tid != sd->rental_timer ) { ShowError("pc_inventory_rental_end: invalid timer id.\n"); @@ -1146,13 +1146,13 @@ void pc_inventory_rentals(map_session_data *sd) continue; // Nothing here if( sd->inventory.u.items_inventory[i].expire_time == 0 ) continue; - if( sd->inventory.u.items_inventory[i].expire_time <= time(NULL) ) { + if( sd->inventory.u.items_inventory[i].expire_time <= time(nullptr) ) { if (sd->inventory_data[i]->unequip_script) run_script(sd->inventory_data[i]->unequip_script, 0, sd->bl.id, fake_nd->bl.id); clif_rental_expired(sd, i, sd->inventory.u.items_inventory[i].nameid); pc_delitem(sd, i, sd->inventory.u.items_inventory[i].amount, 0, 0, LOG_TYPE_OTHER); } else { - unsigned int expire_tick = (unsigned int)(sd->inventory.u.items_inventory[i].expire_time - time(NULL)); + unsigned int expire_tick = (unsigned int)(sd->inventory.u.items_inventory[i].expire_time - time(nullptr)); clif_rental_time(sd, sd->inventory.u.items_inventory[i].nameid, (int)expire_tick); next_tick = umin(expire_tick * 1000U, next_tick); @@ -1175,7 +1175,7 @@ void pc_inventory_rental_add(map_session_data *sd, unsigned int seconds) { t_tick tick = seconds * 1000; - if( sd == NULL ) + if( sd == nullptr ) return; if( sd->rental_timer != INVALID_TIMER ) { @@ -1198,7 +1198,7 @@ void pc_inventory_rental_add(map_session_data *sd, unsigned int seconds) * @return bool 'true' is sellable, 'false' otherwise */ bool pc_can_sell_item(map_session_data *sd, struct item *item, enum npc_subtype shoptype) { - if (sd == NULL || item == NULL) + if (sd == nullptr || item == nullptr) return false; if (!pc_can_give_items(sd)) @@ -1446,7 +1446,7 @@ void pc_setinventorydata(map_session_data *sd) for(i = 0; i < MAX_INVENTORY; i++) { t_itemid id = sd->inventory.u.items_inventory[i].nameid; - sd->inventory_data[i] = id?itemdb_search(id):NULL; + sd->inventory_data[i] = id?itemdb_search(id):nullptr; } } @@ -1559,7 +1559,7 @@ void pc_setequipindex(map_session_data *sd) // if( item->card[MAX_SLOTS - 1] && s < MAX_SLOTS - 1 ) // s = MAX_SLOTS - 1; // -// ARR_FIND( 0, s, i, item->card[i] && (data = item_db.find(item->card[i])) != NULL && data->flag.no_equip&flag ); +// ARR_FIND( 0, s, i, item->card[i] && (data = item_db.find(item->card[i])) != nullptr && data->flag.no_equip&flag ); // return( i < s ) ? 0 : 1; //} @@ -1799,7 +1799,7 @@ uint8 pc_isequip(map_session_data *sd,int n) if(pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT)) return ITEM_EQUIP_ACK_OK; - if(item == NULL) + if(item == nullptr) return ITEM_EQUIP_ACK_FAIL; if(item->elv && sd->status.base_level < (unsigned int)item->elv) return ITEM_EQUIP_ACK_FAILLEVEL; @@ -2133,7 +2133,7 @@ bool pc_authok(map_session_data *sd, uint32 login_id2, time_t expiration_time, i for( int i = 0; i < 3; i++ ) sd->hate_mob[i] = -1; - sd->quest_log = NULL; + sd->quest_log = nullptr; sd->num_quests = 0; sd->avail_quests = 0; sd->save_quest = false; @@ -2143,7 +2143,7 @@ bool pc_authok(map_session_data *sd, uint32 login_id2, time_t expiration_time, i sd->mail.pending_slots = 0; sd->regs.vars = i64db_alloc(DB_OPT_BASE); - sd->regs.arrays = NULL; + sd->regs.arrays = nullptr; sd->vars_dirty = false; sd->vars_ok = false; sd->vars_received = 0x0; @@ -2210,7 +2210,7 @@ bool pc_authok(map_session_data *sd, uint32 login_id2, time_t expiration_time, i pc_validate_skill(sd); /* [Ind] */ - sd->sc_display = NULL; + sd->sc_display = nullptr; sd->sc_display_count = 0; // Player has not yet received the CashShop list @@ -2218,7 +2218,7 @@ bool pc_authok(map_session_data *sd, uint32 login_id2, time_t expiration_time, i sd->last_addeditem_index = -1; - sd->bonus_script.head = NULL; + sd->bonus_script.head = nullptr; sd->bonus_script.count = 0; // Initialize BG queue @@ -2427,7 +2427,7 @@ void pc_reg_received(map_session_data *sd) sd->achievement_data.save = false; sd->achievement_data.count = 0; sd->achievement_data.incompleteCount = 0; - sd->achievement_data.achievements = NULL; + sd->achievement_data.achievements = nullptr; intif_request_achievements(sd->status.char_id); } @@ -3001,7 +3001,7 @@ int pc_disguise(map_session_data *sd, int class_) return 2; } - if (sd->bl.prev != NULL) { + if (sd->bl.prev != nullptr) { pc_stop_walking(sd, 0); clif_clearunit_area(&sd->bl, CLR_OUTSIGHT); } @@ -3015,7 +3015,7 @@ int pc_disguise(map_session_data *sd, int class_) status_set_viewdata(&sd->bl, class_); clif_changeoption(&sd->bl); - if (sd->bl.prev != NULL) { + if (sd->bl.prev != nullptr) { clif_spawn(&sd->bl); if (class_ == sd->status.class_ && pc_iscarton(sd)) { //It seems the cart info is lost on undisguise. @@ -3024,7 +3024,7 @@ int pc_disguise(map_session_data *sd, int class_) } if (sd->chatID) { struct chat_data* cd; - if ((cd = (struct chat_data*)map_id2bl(sd->chatID)) != NULL) + if ((cd = (struct chat_data*)map_id2bl(sd->chatID)) != nullptr) clif_dispchat(cd,0); } } @@ -3349,7 +3349,7 @@ bool pc_addautobonus(std::vector> &bonus, const cha entry->atk_type = flag; entry->pos = pos; entry->bonus_script = aStrdup(script); - entry->other_script = (other_script ? aStrdup(other_script) : NULL); + entry->other_script = (other_script ? aStrdup(other_script) : nullptr); bonus.push_back(entry); @@ -5959,11 +5959,11 @@ enum e_additem_result pc_additem(map_session_data *sd,struct item *item,int amou /* rental item check */ if( item->expire_time ) { - if( time(NULL) > item->expire_time ) { + if( time(nullptr) > item->expire_time ) { clif_rental_expired(sd, i, sd->inventory.u.items_inventory[i].nameid); pc_delitem(sd, i, sd->inventory.u.items_inventory[i].amount, 1, 0, LOG_TYPE_OTHER); } else { - unsigned int seconds = (unsigned int)( item->expire_time - time(NULL) ); + unsigned int seconds = (unsigned int)( item->expire_time - time(nullptr) ); clif_rental_time(sd, sd->inventory.u.items_inventory[i].nameid, seconds); pc_inventory_rental_add(sd, seconds); } @@ -5989,7 +5989,7 @@ char pc_delitem(map_session_data *sd,int n,int amount,int type, short reason, e_ { nullpo_retr(1, sd); - if(n < 0 || sd->inventory.u.items_inventory[n].nameid == 0 || amount <= 0 || sd->inventory.u.items_inventory[n].amountinventory_data[n] == NULL) + if(n < 0 || sd->inventory.u.items_inventory[n].nameid == 0 || amount <= 0 || sd->inventory.u.items_inventory[n].amountinventory_data[n] == nullptr) return 1; log_pick_pc(sd, log_type, -amount, &sd->inventory.u.items_inventory[n]); @@ -6000,7 +6000,7 @@ char pc_delitem(map_session_data *sd,int n,int amount,int type, short reason, e_ if(sd->inventory.u.items_inventory[n].equip) pc_unequipitem(sd,n,2|(!(type&4) ? 1 : 0)); memset(&sd->inventory.u.items_inventory[n],0,sizeof(sd->inventory.u.items_inventory[0])); - sd->inventory_data[n] = NULL; + sd->inventory_data[n] = nullptr; } if(!(type&1)) clif_delitem(sd,n,amount,reason); @@ -6071,7 +6071,7 @@ bool pc_takeitem(map_session_data *sd,struct flooritem_data *fitem) { int flag = 0; t_tick tick = gettick(); - struct party_data *p = NULL; + struct party_data *p = nullptr; nullpo_ret(sd); nullpo_ret(fitem); @@ -6152,7 +6152,7 @@ bool pc_isUseitem(map_session_data *sd,int n) item = sd->inventory_data[n]; nameid = sd->inventory.u.items_inventory[n].nameid; - if( item == NULL ) + if( item == nullptr ) return false; //Not consumable item if( item->type != IT_HEALING && item->type != IT_USABLE && item->type != IT_CASH ) @@ -6239,7 +6239,7 @@ bool pc_isUseitem(map_session_data *sd,int n) case ITEMID_M_CENTER_POTION: case ITEMID_M_AWAKENING_POTION: case ITEMID_M_BERSERK_POTION: - if( sd->md == NULL || sd->md->db == NULL ) + if( sd->md == nullptr || sd->md->db == nullptr ) return false; if( sd->md->sc.cant.consume ) return false; @@ -6255,7 +6255,7 @@ bool pc_isUseitem(map_session_data *sd,int n) break; } - if( itemdb_group.item_exists(IG_MERCENARY, nameid) && sd->md != NULL ) + if( itemdb_group.item_exists(IG_MERCENARY, nameid) && sd->md != nullptr ) return false; // Mercenary Scrolls if( item->flag.group || item->type == IT_CASH) { //safe check type cash disappear when overweight [Napster] @@ -6951,7 +6951,7 @@ enum e_setpos pc_setpos(map_session_data* sd, unsigned short mapindex, int x, in buyingstore_close(sd); } - if(sd->bl.prev != NULL){ + if(sd->bl.prev != nullptr){ unit_remove_map_pc(sd,clrtype); clif_changemap(sd,m,x,y); // [MouseJstr] } else if(sd->state.active) //Tag player for rewarping after map-loading is done. [Skotlex] @@ -7153,7 +7153,7 @@ int pc_get_skillcooldown(map_session_data *sd, uint16 skill_id, uint16 skill_lv) uint8 pc_checkskill(map_session_data *sd, uint16 skill_id) { uint16 idx = 0; - if (sd == NULL) + if (sd == nullptr) return 0; #ifdef RENEWAL @@ -7708,7 +7708,7 @@ const char* job_name(int class_) case JOB_ACOLYTE: case JOB_MERCHANT: case JOB_THIEF: - return msg_txt(NULL,550 - JOB_NOVICE+class_); + return msg_txt(nullptr,550 - JOB_NOVICE+class_); case JOB_KNIGHT: case JOB_PRIEST: @@ -7716,10 +7716,10 @@ const char* job_name(int class_) case JOB_BLACKSMITH: case JOB_HUNTER: case JOB_ASSASSIN: - return msg_txt(NULL,557 - JOB_KNIGHT+class_); + return msg_txt(nullptr,557 - JOB_KNIGHT+class_); case JOB_KNIGHT2: - return msg_txt(NULL,557); + return msg_txt(nullptr,557); case JOB_CRUSADER: case JOB_MONK: @@ -7728,27 +7728,27 @@ const char* job_name(int class_) case JOB_ALCHEMIST: case JOB_BARD: case JOB_DANCER: - return msg_txt(NULL,563 - JOB_CRUSADER+class_); + return msg_txt(nullptr,563 - JOB_CRUSADER+class_); case JOB_CRUSADER2: - return msg_txt(NULL,563); + return msg_txt(nullptr,563); case JOB_WEDDING: case JOB_SUPER_NOVICE: case JOB_GUNSLINGER: case JOB_NINJA: case JOB_XMAS: - return msg_txt(NULL,570 - JOB_WEDDING+class_); + return msg_txt(nullptr,570 - JOB_WEDDING+class_); case JOB_SUMMER: case JOB_SUMMER2: - return msg_txt(NULL,621); + return msg_txt(nullptr,621); case JOB_HANBOK: - return msg_txt(NULL,694); + return msg_txt(nullptr,694); case JOB_OKTOBERFEST: - return msg_txt(NULL,696); + return msg_txt(nullptr,696); case JOB_NOVICE_HIGH: case JOB_SWORDMAN_HIGH: @@ -7757,7 +7757,7 @@ const char* job_name(int class_) case JOB_ACOLYTE_HIGH: case JOB_MERCHANT_HIGH: case JOB_THIEF_HIGH: - return msg_txt(NULL,575 - JOB_NOVICE_HIGH+class_); + return msg_txt(nullptr,575 - JOB_NOVICE_HIGH+class_); case JOB_LORD_KNIGHT: case JOB_HIGH_PRIEST: @@ -7765,10 +7765,10 @@ const char* job_name(int class_) case JOB_WHITESMITH: case JOB_SNIPER: case JOB_ASSASSIN_CROSS: - return msg_txt(NULL,582 - JOB_LORD_KNIGHT+class_); + return msg_txt(nullptr,582 - JOB_LORD_KNIGHT+class_); case JOB_LORD_KNIGHT2: - return msg_txt(NULL,582); + return msg_txt(nullptr,582); case JOB_PALADIN: case JOB_CHAMPION: @@ -7777,10 +7777,10 @@ const char* job_name(int class_) case JOB_CREATOR: case JOB_CLOWN: case JOB_GYPSY: - return msg_txt(NULL,588 - JOB_PALADIN + class_); + return msg_txt(nullptr,588 - JOB_PALADIN + class_); case JOB_PALADIN2: - return msg_txt(NULL,588); + return msg_txt(nullptr,588); case JOB_BABY: case JOB_BABY_SWORDMAN: @@ -7789,7 +7789,7 @@ const char* job_name(int class_) case JOB_BABY_ACOLYTE: case JOB_BABY_MERCHANT: case JOB_BABY_THIEF: - return msg_txt(NULL,595 - JOB_BABY + class_); + return msg_txt(nullptr,595 - JOB_BABY + class_); case JOB_BABY_KNIGHT: case JOB_BABY_PRIEST: @@ -7797,10 +7797,10 @@ const char* job_name(int class_) case JOB_BABY_BLACKSMITH: case JOB_BABY_HUNTER: case JOB_BABY_ASSASSIN: - return msg_txt(NULL,602 - JOB_BABY_KNIGHT + class_); + return msg_txt(nullptr,602 - JOB_BABY_KNIGHT + class_); case JOB_BABY_KNIGHT2: - return msg_txt(NULL,602); + return msg_txt(nullptr,602); case JOB_BABY_CRUSADER: case JOB_BABY_MONK: @@ -7809,26 +7809,26 @@ const char* job_name(int class_) case JOB_BABY_ALCHEMIST: case JOB_BABY_BARD: case JOB_BABY_DANCER: - return msg_txt(NULL,608 - JOB_BABY_CRUSADER + class_); + return msg_txt(nullptr,608 - JOB_BABY_CRUSADER + class_); case JOB_BABY_CRUSADER2: - return msg_txt(NULL,608); + return msg_txt(nullptr,608); case JOB_SUPER_BABY: - return msg_txt(NULL,615); + return msg_txt(nullptr,615); case JOB_TAEKWON: - return msg_txt(NULL,616); + return msg_txt(nullptr,616); case JOB_STAR_GLADIATOR: case JOB_STAR_GLADIATOR2: - return msg_txt(NULL,617); + return msg_txt(nullptr,617); case JOB_SOUL_LINKER: - return msg_txt(NULL,618); + return msg_txt(nullptr,618); case JOB_GANGSI: case JOB_DEATH_KNIGHT: case JOB_DARK_COLLECTOR: - return msg_txt(NULL,622 - JOB_GANGSI+class_); + return msg_txt(nullptr,622 - JOB_GANGSI+class_); case JOB_RUNE_KNIGHT: case JOB_WARLOCK: @@ -7836,7 +7836,7 @@ const char* job_name(int class_) case JOB_ARCH_BISHOP: case JOB_MECHANIC: case JOB_GUILLOTINE_CROSS: - return msg_txt(NULL,625 - JOB_RUNE_KNIGHT+class_); + return msg_txt(nullptr,625 - JOB_RUNE_KNIGHT+class_); case JOB_RUNE_KNIGHT_T: case JOB_WARLOCK_T: @@ -7844,7 +7844,7 @@ const char* job_name(int class_) case JOB_ARCH_BISHOP_T: case JOB_MECHANIC_T: case JOB_GUILLOTINE_CROSS_T: - return msg_txt(NULL,681 - JOB_RUNE_KNIGHT_T+class_); + return msg_txt(nullptr,681 - JOB_RUNE_KNIGHT_T+class_); case JOB_ROYAL_GUARD: case JOB_SORCERER: @@ -7853,7 +7853,7 @@ const char* job_name(int class_) case JOB_SURA: case JOB_GENETIC: case JOB_SHADOW_CHASER: - return msg_txt(NULL,631 - JOB_ROYAL_GUARD+class_); + return msg_txt(nullptr,631 - JOB_ROYAL_GUARD+class_); case JOB_ROYAL_GUARD_T: case JOB_SORCERER_T: @@ -7862,23 +7862,23 @@ const char* job_name(int class_) case JOB_SURA_T: case JOB_GENETIC_T: case JOB_SHADOW_CHASER_T: - return msg_txt(NULL,687 - JOB_ROYAL_GUARD_T+class_); + return msg_txt(nullptr,687 - JOB_ROYAL_GUARD_T+class_); case JOB_RUNE_KNIGHT2: case JOB_RUNE_KNIGHT_T2: - return msg_txt(NULL,625); + return msg_txt(nullptr,625); case JOB_ROYAL_GUARD2: case JOB_ROYAL_GUARD_T2: - return msg_txt(NULL,631); + return msg_txt(nullptr,631); case JOB_RANGER2: case JOB_RANGER_T2: - return msg_txt(NULL,627); + return msg_txt(nullptr,627); case JOB_MECHANIC2: case JOB_MECHANIC_T2: - return msg_txt(NULL,629); + return msg_txt(nullptr,629); case JOB_BABY_RUNE_KNIGHT: case JOB_BABY_WARLOCK: @@ -7893,37 +7893,37 @@ const char* job_name(int class_) case JOB_BABY_SURA: case JOB_BABY_GENETIC: case JOB_BABY_SHADOW_CHASER: - return msg_txt(NULL,638 - JOB_BABY_RUNE_KNIGHT+class_); + return msg_txt(nullptr,638 - JOB_BABY_RUNE_KNIGHT+class_); case JOB_BABY_RUNE_KNIGHT2: - return msg_txt(NULL,638); + return msg_txt(nullptr,638); case JOB_BABY_ROYAL_GUARD2: - return msg_txt(NULL,644); + return msg_txt(nullptr,644); case JOB_BABY_RANGER2: - return msg_txt(NULL,640); + return msg_txt(nullptr,640); case JOB_BABY_MECHANIC2: - return msg_txt(NULL,642); + return msg_txt(nullptr,642); case JOB_SUPER_NOVICE_E: case JOB_SUPER_BABY_E: - return msg_txt(NULL,651 - JOB_SUPER_NOVICE_E+class_); + return msg_txt(nullptr,651 - JOB_SUPER_NOVICE_E+class_); case JOB_KAGEROU: case JOB_OBORO: - return msg_txt(NULL,653 - JOB_KAGEROU+class_); + return msg_txt(nullptr,653 - JOB_KAGEROU+class_); case JOB_REBELLION: - return msg_txt(NULL,695); + return msg_txt(nullptr,695); case JOB_SUMMONER: - return msg_txt(NULL,697); + return msg_txt(nullptr,697); case JOB_BABY_SUMMONER: - return msg_txt(NULL,698); + return msg_txt(nullptr,698); case JOB_BABY_NINJA: - return msg_txt(NULL,699); + return msg_txt(nullptr,699); case JOB_BABY_KAGEROU: case JOB_BABY_OBORO: @@ -7932,22 +7932,22 @@ const char* job_name(int class_) case JOB_BABY_SOUL_LINKER: case JOB_BABY_GUNSLINGER: case JOB_BABY_REBELLION: - return msg_txt(NULL,753 - JOB_BABY_KAGEROU+class_); + return msg_txt(nullptr,753 - JOB_BABY_KAGEROU+class_); case JOB_BABY_STAR_GLADIATOR2: - return msg_txt(NULL,756); + return msg_txt(nullptr,756); case JOB_STAR_EMPEROR: case JOB_SOUL_REAPER: case JOB_BABY_STAR_EMPEROR: case JOB_BABY_SOUL_REAPER: - return msg_txt(NULL,782 - JOB_STAR_EMPEROR + class_); + return msg_txt(nullptr,782 - JOB_STAR_EMPEROR + class_); case JOB_STAR_EMPEROR2: - return msg_txt(NULL,782); + return msg_txt(nullptr,782); case JOB_BABY_STAR_EMPEROR2: - return msg_txt(NULL,784); + return msg_txt(nullptr,784); case JOB_DRAGON_KNIGHT: case JOB_MEISTER: @@ -7989,7 +7989,7 @@ const char* job_name(int class_) return msg_txt( nullptr, 813 ); default: - return msg_txt(NULL,655); + return msg_txt(nullptr,655); } } @@ -8015,7 +8015,7 @@ TIMER_FUNC(pc_follow_timer){ sd->followtimer = INVALID_TIMER; tbl = map_id2bl(sd->followtarget); - if (tbl == NULL || pc_isdead(sd)) + if (tbl == nullptr || pc_isdead(sd)) { pc_stop_following(sd); return 0; @@ -8023,10 +8023,10 @@ TIMER_FUNC(pc_follow_timer){ // either player or target is currently detached from map blocks (could be teleporting), // but still connected to this map, so we'll just increment the timer and check back later - if (sd->bl.prev != NULL && tbl->prev != NULL && + if (sd->bl.prev != nullptr && tbl->prev != nullptr && sd->ud.skilltimer == INVALID_TIMER && sd->ud.attacktimer == INVALID_TIMER && sd->ud.walktimer == INVALID_TIMER) { - if((sd->bl.m == tbl->m) && unit_can_reach_bl(&sd->bl,tbl, AREA_SIZE, 0, NULL, NULL)) { + if((sd->bl.m == tbl->m) && unit_can_reach_bl(&sd->bl,tbl, AREA_SIZE, 0, nullptr, nullptr)) { if (!check_distance_bl(&sd->bl, tbl, 5)) unit_walktobl(&sd->bl, tbl, 5, 0); } else @@ -8057,7 +8057,7 @@ int pc_stop_following (map_session_data *sd) int pc_follow(map_session_data *sd,int target_id) { struct block_list *bl = map_id2bl(target_id); - if (bl == NULL /*|| bl->type != BL_PC*/) + if (bl == nullptr /*|| bl->type != BL_PC*/) return 1; if (sd->followtimer != INVALID_TIMER) pc_stop_following(sd); @@ -8215,7 +8215,7 @@ static void pc_calcexp(map_session_data *sd, t_exp *base_exp, t_exp *job_exp, st } } - // Give EXPBOOST for quests even if src is NULL. + // Give EXPBOOST for quests even if src is nullptr. if (sd->sc.getSCE(SC_EXPBOOST)) { bonus += sd->sc.getSCE(SC_EXPBOOST)->val1; if (battle_config.vip_bm_increase && pc_isvip(sd)) // Increase Battle Manual EXP rate for VIP @@ -8230,7 +8230,7 @@ static void pc_calcexp(map_session_data *sd, t_exp *base_exp, t_exp *job_exp, st *base_exp = cap_value(exp, 1, MAX_EXP); } - // Give JEXPBOOST for quests even if src is NULL. + // Give JEXPBOOST for quests even if src is nullptr. if (sd->sc.getSCE(SC_JEXPBOOST)) bonus += sd->sc.getSCE(SC_JEXPBOOST)->val1; @@ -8282,7 +8282,7 @@ void pc_gainexp(map_session_data *sd, struct block_list *src, t_exp base_exp, t_ nullpo_retv(sd); - if(sd->bl.prev == NULL || pc_isdead(sd)) + if(sd->bl.prev == nullptr || pc_isdead(sd)) return; if (!(exp_flag&2)) { @@ -9493,7 +9493,7 @@ void pc_respawn(map_session_data* sd, clr_type clrtype) static TIMER_FUNC(pc_respawn_timer){ map_session_data *sd = map_id2sd(id); - if( sd != NULL ) + if( sd != nullptr ) { sd->pvp_point=0; sd->respawn_tid = INVALID_TIMER; @@ -9581,7 +9581,7 @@ void pc_close_npc(map_session_data *sd,int flag) } if (sd->st->state == END) { // free attached scripts that are waiting script_free_state(sd->st); - sd->st = NULL; + sd->st = nullptr; sd->npc_id = 0; } } @@ -10272,14 +10272,14 @@ bool pc_setparam(map_session_data *sd,int64 type,int64 val_tmp) if (val_tmp < sd->status.base_exp) // Lost pc_lostexp(sd, sd->status.base_exp - val_tmp, 0); else // Gained - pc_gainexp(sd, NULL, val_tmp - sd->status.base_exp, 0, 2); + pc_gainexp(sd, nullptr, val_tmp - sd->status.base_exp, 0, 2); return true; case SP_JOBEXP: val_tmp = cap_value(val_tmp, 0, pc_is_maxjoblv(sd) ? MAX_LEVEL_JOB_EXP : MAX_EXP); if (val_tmp < sd->status.job_exp) // Lost pc_lostexp(sd, 0, sd->status.job_exp - val_tmp); else // Gained - pc_gainexp(sd, NULL, 0, val_tmp - sd->status.job_exp, 2); + pc_gainexp(sd, nullptr, 0, val_tmp - sd->status.job_exp, 2); return true; case SP_SEX: sd->status.sex = val ? SEX_MALE : SEX_FEMALE; @@ -10372,7 +10372,7 @@ bool pc_setparam(map_session_data *sd,int64 type,int64 val_tmp) case SP_MANNER: sd->status.manner = val; if( val < 0 ) - sc_start(NULL, &sd->bl, SC_NOCHAT, 100, 0, 0); + sc_start(nullptr, &sd->bl, SC_NOCHAT, 100, 0, 0); else { status_change_end(&sd->bl, SC_NOCHAT); clif_manner_message(sd, 5); @@ -10616,21 +10616,21 @@ int pc_percentheal(map_session_data *sd,int hp,int sp) return status_percent_heal(&sd->bl, hp, sp); if(hp <= 0 && sp <= 0) //Damage (negative rates indicate % of max rather than current), and only kill target IF the specified amount is 100% - return status_percent_damage(NULL, &sd->bl, hp, sp, hp==-100); + return status_percent_damage(nullptr, &sd->bl, hp, sp, hp==-100); //Crossed signs if(hp) { if(hp > 0) status_percent_heal(&sd->bl, hp, 0); else - status_percent_damage(NULL, &sd->bl, hp, 0, hp==-100); + status_percent_damage(nullptr, &sd->bl, hp, 0, hp==-100); } if(sp) { if(sp > 0) status_percent_heal(&sd->bl, 0, sp); else - status_percent_damage(NULL, &sd->bl, 0, sp, false); + status_percent_damage(nullptr, &sd->bl, 0, sp, false); } return 0; } @@ -10872,7 +10872,7 @@ bool pc_jobchange(map_session_data *sd,int job, char upper) if( sd->status.party_id ){ struct party_data* p; - if( ( p = party_search( sd->status.party_id ) ) != NULL ){ + if( ( p = party_search( sd->status.party_id ) ) != nullptr ){ ARR_FIND(0, MAX_PARTY, i, p->party.member[i].char_id == sd->status.char_id); if( i < MAX_PARTY ){ @@ -11209,11 +11209,11 @@ bool pc_setreg(map_session_data* sd, int64 reg, int64 val) *------------------------------------------*/ char* pc_readregstr(map_session_data* sd, int64 reg) { - struct script_reg_str *p = NULL; + struct script_reg_str *p = nullptr; p = (struct script_reg_str *)i64db_get(sd->regs.vars, reg); - return p ? p->value : NULL; + return p ? p->value : nullptr; } /*========================================== @@ -11221,7 +11221,7 @@ char* pc_readregstr(map_session_data* sd, int64 reg) *------------------------------------------*/ bool pc_setregstr(map_session_data* sd, int64 reg, const char* str) { - struct script_reg_str *p = NULL; + struct script_reg_str *p = nullptr; unsigned int index = script_getvaridx(reg); DBData prev; @@ -11264,7 +11264,7 @@ bool pc_setregstr(map_session_data* sd, int64 reg, const char* str) **/ int64 pc_readregistry(map_session_data *sd, int64 reg) { - struct script_reg_num *p = NULL; + struct script_reg_num *p = nullptr; if (!sd->vars_ok) { ShowError("pc_readregistry: Trying to read reg %s before it's been loaded!\n", get_str(script_getvarid(reg))); @@ -11287,19 +11287,19 @@ int64 pc_readregistry(map_session_data *sd, int64 reg) **/ char* pc_readregistry_str(map_session_data *sd, int64 reg) { - struct script_reg_str *p = NULL; + struct script_reg_str *p = nullptr; if (!sd->vars_ok) { ShowError("pc_readregistry_str: Trying to read reg %s before it's been loaded!\n", get_str(script_getvarid(reg))); //This really shouldn't happen, so it's possible the data was lost somewhere, we should request it again. //intif->request_registry(sd,type==3?4:type); set_eof(sd->fd); - return NULL; + return nullptr; } p = (struct script_reg_str *)i64db_get(sd->regs.vars, reg); - return p ? p->value : NULL; + return p ? p->value : nullptr; } /** @@ -11310,7 +11310,7 @@ char* pc_readregistry_str(map_session_data *sd, int64 reg) **/ bool pc_setregistry(map_session_data *sd, int64 reg, int64 val) { - struct script_reg_num *p = NULL; + struct script_reg_num *p = nullptr; const char *regname = get_str(script_getvarid(reg)); uint32 index = script_getvaridx(reg); @@ -11363,7 +11363,7 @@ bool pc_setregistry(map_session_data *sd, int64 reg, int64 val) **/ bool pc_setregistry_str(map_session_data *sd, int64 reg, const char *val) { - struct script_reg_str *p = NULL; + struct script_reg_str *p = nullptr; const char *regname = get_str(script_getvarid(reg)); unsigned int index = script_getvaridx(reg); size_t vlen = 0; @@ -11389,7 +11389,7 @@ bool pc_setregistry_str(map_session_data *sd, int64 reg, const char *val) } else { if (p->value) aFree(p->value); - p->value = NULL; + p->value = nullptr; if( index ) script_array_update(&sd->regs, reg, true); } @@ -11498,7 +11498,7 @@ static TIMER_FUNC(pc_eventtimer){ map_session_data *sd=map_id2sd(id); char *p = (char *)data; int i; - if(sd==NULL) + if(sd==nullptr) return 0; ARR_FIND( 0, MAX_EVENTTIMER, i, sd->eventtimer[i] == tid ); @@ -11538,7 +11538,7 @@ bool pc_addeventtimer(map_session_data *sd,int tick,const char *name) *------------------------------------------*/ bool pc_deleventtimer(map_session_data *sd,const char *name) { - char* p = NULL; + char* p = nullptr; int i; nullpo_retr(false,sd); @@ -11548,7 +11548,7 @@ bool pc_deleventtimer(map_session_data *sd,const char *name) // find the named event timer ARR_FIND( 0, MAX_EVENTTIMER, i, sd->eventtimer[i] != INVALID_TIMER && - (p = (char *)(get_timer(sd->eventtimer[i])->data)) != NULL && + (p = (char *)(get_timer(sd->eventtimer[i])->data)) != nullptr && strcmp(p, name) == 0 ); if( i == MAX_EVENTTIMER ) @@ -12590,7 +12590,7 @@ TIMER_FUNC(pc_calc_pvprank_timer){ map_session_data *sd; sd=map_id2sd(id); - if(sd==NULL) + if(sd==nullptr) return 0; sd->pvp_timer = INVALID_TIMER; @@ -12612,7 +12612,7 @@ TIMER_FUNC(pc_calc_pvprank_timer){ *------------------------------------------*/ int pc_ismarried(map_session_data *sd) { - if(sd == NULL) + if(sd == nullptr) return -1; if(sd->status.partner_id > 0) return sd->status.partner_id; @@ -12627,7 +12627,7 @@ int pc_ismarried(map_session_data *sd) *------------------------------------------*/ bool pc_marriage(map_session_data *sd,map_session_data *dstsd) { - if(sd == NULL || dstsd == NULL || + if(sd == nullptr || dstsd == nullptr || sd->status.partner_id > 0 || dstsd->status.partner_id > 0 || (sd->class_&JOBL_BABY) || (dstsd->class_&JOBL_BABY)) return false; @@ -12651,13 +12651,13 @@ bool pc_divorce(map_session_data *sd) map_session_data *p_sd; int i; - if( sd == NULL || !pc_ismarried(sd) ) + if( sd == nullptr || !pc_ismarried(sd) ) return false; if( !sd->status.partner_id ) return false; // Char is not married - if( (p_sd = map_charid2sd(sd->status.partner_id)) == NULL ) + if( (p_sd = map_charid2sd(sd->status.partner_id)) == nullptr ) { // Lets char server do the divorce if( chrif_divorce(sd->status.char_id, sd->status.partner_id) ) return false; // No char server connected @@ -12685,33 +12685,33 @@ bool pc_divorce(map_session_data *sd) /** * Get the partner map_session_data of a player * @param sd : the husband|wife session - * @return partner session or NULL + * @return partner session or nullptr */ map_session_data *pc_get_partner(map_session_data *sd){ if (!sd || !pc_ismarried(sd)) - return NULL; + return nullptr; return map_charid2sd(sd->status.partner_id); } /** * Get the father map_session_data of a player * @param sd : the baby session - * @return father session or NULL + * @return father session or nullptr */ map_session_data *pc_get_father (map_session_data *sd){ if (!sd || !(sd->class_&JOBL_BABY) || !sd->status.father) - return NULL; + return nullptr; return map_charid2sd(sd->status.father); } /** * Get the mother map_session_data of a player * @param sd : the baby session - * @return mother session or NULL + * @return mother session or nullptr */ map_session_data *pc_get_mother (map_session_data *sd){ if (!sd || !(sd->class_&JOBL_BABY) || !sd->status.mother) - return NULL; + return nullptr; return map_charid2sd(sd->status.mother); } @@ -12721,8 +12721,8 @@ map_session_data *pc_get_mother (map_session_data *sd){ map_session_data *pc_get_child (map_session_data *sd) { if (!sd || !pc_ismarried(sd) || !sd->status.child) - // charid2sd returns NULL if not found - return NULL; + // charid2sd returns nullptr if not found + return nullptr; return map_charid2sd(sd->status.child); } @@ -12883,7 +12883,7 @@ TIMER_FUNC(map_day_timer){ night_flag = 0; // 0=day, 1=night [Yor] map_foreachpc(pc_daynight_timer_sub); - strcpy(tmp_soutput, (data == 0) ? msg_txt(NULL,502) : msg_txt(NULL,60)); // The day has arrived! + strcpy(tmp_soutput, (data == 0) ? msg_txt(nullptr,502) : msg_txt(nullptr,60)); // The day has arrived! intif_broadcast(tmp_soutput, strlen(tmp_soutput) + 1, BC_DEFAULT); return 0; } @@ -12903,7 +12903,7 @@ TIMER_FUNC(map_night_timer){ night_flag = 1; // 0=day, 1=night [Yor] map_foreachpc(pc_daynight_timer_sub); - strcpy(tmp_soutput, (data == 0) ? msg_txt(NULL,503) : msg_txt(NULL,59)); // The night has fallen... + strcpy(tmp_soutput, (data == 0) ? msg_txt(nullptr,503) : msg_txt(nullptr,59)); // The night has fallen... intif_broadcast(tmp_soutput, strlen(tmp_soutput) + 1, BC_DEFAULT); return 0; } @@ -13006,7 +13006,7 @@ static TIMER_FUNC(pc_spiritcharm_timer){ map_session_data *sd; int i; - if ((sd = (map_session_data *)map_id2sd(id)) == NULL || sd->bl.type != BL_PC) + if ((sd = (map_session_data *)map_id2sd(id)) == nullptr || sd->bl.type != BL_PC) return 1; if (sd->spiritcharm <= 0) { @@ -14304,7 +14304,7 @@ int pc_read_motd(void) memset(motd_text, 0, sizeof(motd_text)); // read current MOTD - if( ( fp = fopen(motd_txt, "r") ) != NULL ) + if( ( fp = fopen(motd_txt, "r") ) != nullptr ) { unsigned int entries = 0; char buf[CHAT_SIZE_MAX]; @@ -14322,7 +14322,7 @@ int pc_read_motd(void) if( len ) { char * ptr; buf[len] = 0; - if( ( ptr = strstr(buf, " :") ) != NULL && ptr-buf >= NAME_LENGTH ) // crashes newer clients + if( ( ptr = strstr(buf, " :") ) != nullptr && ptr-buf >= NAME_LENGTH ) // crashes newer clients ShowWarning("Found sequence '" CL_WHITE " :" CL_RESET "' on line '" CL_WHITE "%u" CL_RESET "' in '" CL_WHITE "%s" CL_RESET "'. This can cause newer clients to crash.\n", lines, motd_txt); } else {// empty line @@ -14343,7 +14343,7 @@ int pc_read_motd(void) void pc_itemcd_do(map_session_data *sd, bool load) { int i,cursor = 0; - struct item_cd* cd = NULL; + struct item_cd* cd = nullptr; if( load ) { if( !(cd = (struct item_cd*)idb_get(itemcd_db, sd->status.char_id)) ) { @@ -14431,7 +14431,7 @@ uint8 pc_itemcd_add(map_session_data *sd, struct item_data *id, t_tick tick, uns * 1: Has delay, cancel consumption. **/ uint8 pc_itemcd_check(map_session_data *sd, struct item_data *id, t_tick tick, unsigned short n) { - status_change *sc = NULL; + status_change *sc = nullptr; nullpo_retr(0, sd); nullpo_retr(0, id); @@ -14500,7 +14500,7 @@ void pc_damage_log_add(map_session_data *sd, int id) void pc_damage_log_clear(map_session_data *sd, int id) { uint8 i; - struct mob_data *md = NULL; + struct mob_data *md = nullptr; if (!sd) return; @@ -14633,7 +14633,7 @@ void pc_expire_check(map_session_data *sd) { return; /* not within the next 24h, enable the global check */ - if( sd->expiration_time > (time(NULL) + ((60 * 60) * 24)) ) { + if( sd->expiration_time > (time(nullptr) + ((60 * 60) * 24)) ) { /* global check not running, enable */ if( pc_expiration_tid == INVALID_TIMER ) /* Starts in 1h, repeats every hour */ @@ -14642,7 +14642,7 @@ void pc_expire_check(map_session_data *sd) { return; } - sd->expiration_tid = add_timer(gettick() + (unsigned int)(sd->expiration_time - time(NULL)) * 1000, pc_expiration_timer, sd->bl.id, 0); + sd->expiration_tid = add_timer(gettick() + (unsigned int)(sd->expiration_time - time(nullptr)) * 1000, pc_expiration_timer, sd->bl.id, 0); } /** @@ -14714,7 +14714,7 @@ void pc_crimson_marker_clear(map_session_data *sd) { return; for (i = 0; i < MAX_SKILL_CRIMSON_MARKER; i++) { - struct block_list *bl = NULL; + struct block_list *bl = nullptr; if (sd->c_marker[i] && (bl = map_id2bl(sd->c_marker[i]))) status_change_end(bl,SC_C_MARKER); sd->c_marker[i] = 0; @@ -14748,13 +14748,13 @@ void pc_show_version(map_session_data *sd) { **/ void pc_bonus_script(map_session_data *sd) { t_tick now = gettick(); - struct linkdb_node *node = NULL, *next = NULL; + struct linkdb_node *node = nullptr, *next = nullptr; if (!sd || !(node = sd->bonus_script.head)) return; while (node) { - struct s_bonus_script_entry *entry = NULL; + struct s_bonus_script_entry *entry = nullptr; next = node->next; if ((entry = (struct s_bonus_script_entry *)node->data)) { @@ -14785,20 +14785,20 @@ void pc_bonus_script(map_session_data *sd) { * @param icon EFST * @param flag Flags @see enum e_bonus_script_flags * @param type 0 - None, 1 - Buff, 2 - Debuff - * @return New created entry pointer or NULL if failed or NULL if duplicate fail + * @return New created entry pointer or nullptr if failed or nullptr if duplicate fail * @author [Cydh] **/ struct s_bonus_script_entry *pc_bonus_script_add(map_session_data *sd, const char *script_str, t_tick dur, enum efst_type icon, uint16 flag, uint8 type) { - struct script_code *script = NULL; - struct linkdb_node *node = NULL; - struct s_bonus_script_entry *entry = NULL; + struct script_code *script = nullptr; + struct linkdb_node *node = nullptr; + struct s_bonus_script_entry *entry = nullptr; if (!sd) - return NULL; + return nullptr; if (!(script = parse_script(script_str, "bonus_script", 0, SCRIPT_IGNORE_EXTERNAL_BRACKETS))) { ShowError("pc_bonus_script_add: Failed to parse script '%s' (CID:%d).\n", script_str, sd->status.char_id); - return NULL; + return nullptr; } // Duplication checks @@ -14810,13 +14810,13 @@ struct s_bonus_script_entry *pc_bonus_script_add(map_session_data *sd, const cha if (flag&BSF_FORCE_REPLACE && entry->tick < newdur) { // Change duration settick_timer(entry->tid, newdur); script_free_code(script); - return NULL; + return nullptr; } else if (flag&BSF_FORCE_DUPLICATE) // Allow duplicate break; else { // No duplicate bonus script_free_code(script); - return NULL; + return nullptr; } } node = node->next; @@ -14895,7 +14895,7 @@ TIMER_FUNC(pc_bonus_script_timer){ if (tid == INVALID_TIMER) return 0; - if (!sd->bonus_script.head || entry == NULL) { + if (!sd->bonus_script.head || entry == nullptr) { ShowError("pc_bonus_script_timer: Invalid entry pointer %p!\n", entry); return 0; } @@ -14914,7 +14914,7 @@ TIMER_FUNC(pc_bonus_script_timer){ * @author [Cydh] **/ void pc_bonus_script_clear(map_session_data *sd, uint32 flag) { - struct linkdb_node *node = NULL; + struct linkdb_node *node = nullptr; uint16 count = 0; if (!sd || !(node = sd->bonus_script.head)) @@ -15232,7 +15232,7 @@ bool pc_job_can_entermap(enum e_job jobid, int m, int group_lv) { **/ void pc_set_costume_view(map_session_data *sd) { int i = -1, head_low = 0, head_mid = 0, head_top = 0, robe = 0; - struct item_data *id = NULL; + struct item_data *id = nullptr; nullpo_retv(sd); @@ -15405,7 +15405,7 @@ void pc_attendance_claim_reward( map_session_data* sd ){ msg.status = MAIL_NEW; msg.type = MAIL_INBOX_NORMAL; - msg.timestamp = time(NULL); + msg.timestamp = time(nullptr); intif_Mail_send(0, &msg); diff --git a/src/map/pc.hpp b/src/map/pc.hpp index 22e2c8a66c..6750de619d 100644 --- a/src/map/pc.hpp +++ b/src/map/pc.hpp @@ -1174,7 +1174,7 @@ static bool pc_cant_act( map_session_data* sd ){ #define pc_is90overweight(sd) ( (sd)->weight * 10 >= (sd)->max_weight * 9 ) static inline bool pc_hasprogress(map_session_data *sd, enum e_wip_block progress) { - return sd == NULL || (sd->state.workinprogress&progress) == progress; + return sd == nullptr || (sd->state.workinprogress&progress) == progress; } uint16 pc_maxparameter(map_session_data *sd, e_params param); diff --git a/src/map/pet.cpp b/src/map/pet.cpp index fe58325018..3f5e29d188 100644 --- a/src/map/pet.cpp +++ b/src/map/pet.cpp @@ -489,7 +489,7 @@ void pet_clear_support_bonuses(map_session_data *sd) { if (pd->a_skill) { aFree(pd->a_skill); - pd->a_skill = NULL; + pd->a_skill = nullptr; } if (pd->s_skill) { @@ -501,7 +501,7 @@ void pet_clear_support_bonuses(map_session_data *sd) { } aFree(pd->s_skill); - pd->s_skill = NULL; + pd->s_skill = nullptr; } if (pd->recovery) { @@ -509,7 +509,7 @@ void pet_clear_support_bonuses(map_session_data *sd) { delete_timer(pd->recovery->timer, pet_recovery_timer); aFree(pd->recovery); - pd->recovery = NULL; + pd->recovery = nullptr; } if (pd->bonus) { @@ -517,7 +517,7 @@ void pet_clear_support_bonuses(map_session_data *sd) { delete_timer(pd->bonus->timer, pet_skill_bonus_timer); aFree(pd->bonus); - pd->bonus = NULL; + pd->bonus = nullptr; } if (pd->loot) { @@ -527,7 +527,7 @@ void pet_clear_support_bonuses(map_session_data *sd) { aFree(pd->loot->item); aFree(pd->loot); - pd->loot = NULL; + pd->loot = nullptr; } } @@ -715,7 +715,7 @@ int pet_attackskill(struct pet_data *pd, int target_id) bl = map_id2bl(target_id); - if(bl == NULL || pd->bl.m != bl->m || bl->prev == NULL || status_isdead(bl) || + if(bl == nullptr || pd->bl.m != bl->m || bl->prev == nullptr || status_isdead(bl) || !check_distance_bl(&pd->bl, bl, pd->db->range3)) return 0; @@ -746,7 +746,7 @@ int pet_target_check(struct pet_data *pd,struct block_list *bl,int type) Assert((pd->master == 0) || (pd->master->pd == pd)); - if(bl == NULL || bl->type != BL_MOB || bl->prev == NULL || + if(bl == nullptr || bl->type != BL_MOB || bl->prev == nullptr || pd->pet.intimate < battle_config.pet_support_min_friendly || pd->pet.hungry <= PET_HUNGRY_NONE || pd->pet.class_ == status_get_class(bl)) @@ -803,9 +803,9 @@ int pet_sc_check(map_session_data *sd, int type) pd = sd->pd; - if( pd == NULL + if( pd == nullptr || (battle_config.pet_equip_required && pd->pet.equip == 0) - || pd->recovery == NULL + || pd->recovery == nullptr || pd->recovery->timer != INVALID_TIMER || pd->recovery->type != type ) return 1; @@ -886,7 +886,7 @@ static TIMER_FUNC(pet_hungry){ * Search pet database for given value and type. * @param key : value to search for * @param type : pet type to search for (Catch, Egg, Equip, Food) - * @return Pet DB pointer on success, NULL on failure + * @return Pet DB pointer on success, nullptr on failure */ std::shared_ptr pet_db_search( int key, enum e_pet_itemtype type ){ for( auto &pair : pet_db ){ @@ -942,7 +942,7 @@ static int pet_performance(map_session_data *sd, struct pet_data *pd) pet_stop_walking(pd,2000<<8); clif_pet_performance(pd, rnd_value(1, val)); - pet_lootitem_drop(pd,NULL); + pet_lootitem_drop(pd,nullptr); return 1; } @@ -1104,7 +1104,7 @@ int pet_birth_process(map_session_data *sd, struct s_pet *pet) if (save_settings&CHARSAVE_PET) chrif_save(sd, CSAVE_INVENTORY); //is it REALLY Needed to save the char for hatching a pet? [Skotlex] - if(sd->bl.prev != NULL) { + if(sd->bl.prev != nullptr) { if(map_addblock(&sd->pd->bl)) return 1; @@ -1137,7 +1137,7 @@ int pet_recv_petdata(uint32 account_id,struct s_pet *p,int flag) sd = map_id2sd(account_id); - if(sd == NULL) + if(sd == nullptr) return 1; if(flag == 1) { @@ -1165,7 +1165,7 @@ int pet_recv_petdata(uint32 account_id,struct s_pet *p,int flag) } else { pet_data_init(sd,p); - if(sd->pd && sd->bl.prev != NULL) { + if(sd->pd && sd->bl.prev != nullptr) { if(map_addblock(&sd->pd->bl)) return 1; @@ -1246,7 +1246,7 @@ int pet_catch_process2(map_session_data* sd, int target_id) md = (struct mob_data*)map_id2bl(target_id); - if(!md || md->bl.type != BL_MOB || md->bl.prev == NULL) { // Invalid inputs/state, abort capture. + if(!md || md->bl.type != BL_MOB || md->bl.prev == nullptr) { // Invalid inputs/state, abort capture. clif_pet_roulette(sd,0); sd->catch_target_class = PET_CATCH_FAIL; sd->itemid = 0; @@ -1350,7 +1350,7 @@ bool pet_get_egg(uint32 account_id, short pet_class, int pet_id ) { sd = map_id2sd(account_id); - if( sd == NULL ) + if( sd == nullptr ) return false; // i = pet_search_petDB_index(sd->catch_target_class,PET_CLASS); @@ -1397,7 +1397,7 @@ int pet_menu(map_session_data *sd,int menunum) { nullpo_ret(sd); - if (sd->pd == NULL) + if (sd->pd == nullptr) return 1; //You lost the pet already. @@ -1440,7 +1440,7 @@ int pet_change_name(map_session_data *sd,char *name) pd = sd->pd; - if((pd == NULL) || (pd->pet.rename_flag == 1 && !battle_config.pet_rename)) + if((pd == nullptr) || (pd->pet.rename_flag == 1 && !battle_config.pet_rename)) return 1; for(i = 0; i < NAME_LENGTH && name[i]; i++) { @@ -1718,9 +1718,9 @@ static int pet_randomwalk(struct pet_data *pd,t_tick tick) */ static int pet_ai_sub_hard(struct pet_data *pd, map_session_data *sd, t_tick tick) { - struct block_list *target = NULL; + struct block_list *target = nullptr; - if(pd->bl.prev == NULL || sd == NULL || sd->bl.prev == NULL) + if(pd->bl.prev == nullptr || sd == nullptr || sd->bl.prev == nullptr) return 0; if(DIFF_TICK(tick,pd->last_thinktime) < MIN_PETTHINKTIME) @@ -1777,7 +1777,7 @@ static int pet_ai_sub_hard(struct pet_data *pd, map_session_data *sd, t_tick tic if (!target || pd->bl.m != target->m || status_isdead(target) || !check_distance_bl(&pd->bl, target, pd->db->range3)) { - target = NULL; + target = nullptr; pet_unlocktarget(pd); } } @@ -1893,8 +1893,8 @@ static int pet_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap) if(sd_charid && sd_charid != pd->master->status.char_id) return 0; - if(unit_can_reach_bl(&pd->bl,bl, pd->db->range2, 1, NULL, NULL) && - ((*target) == NULL || //New target closer than previous one. + if(unit_can_reach_bl(&pd->bl,bl, pd->db->range2, 1, nullptr, nullptr) && + ((*target) == nullptr || //New target closer than previous one. !check_distance_bl(&pd->bl, *target, distance_bl(&pd->bl, bl)))) { (*target) = bl; pd->target_id = bl->id; @@ -1957,7 +1957,7 @@ int pet_lootitem_drop(struct pet_data *pd,map_session_data *sd) dlist->first_charid = 0; dlist->second_charid = 0; dlist->third_charid = 0; - dlist->item = NULL; + dlist->item = nullptr; for(i = 0; i < pd->loot->count; i++) { struct item *it; @@ -2009,7 +2009,7 @@ TIMER_FUNC(pet_skill_bonus_timer){ int bonus; int timer = 0; - if(sd == NULL || sd->pd==NULL || sd->pd->bonus == NULL) + if(sd == nullptr || sd->pd==nullptr || sd->pd->bonus == nullptr) return 1; pd = sd->pd; @@ -2055,7 +2055,7 @@ TIMER_FUNC(pet_recovery_timer){ map_session_data *sd = map_id2sd(id); struct pet_data *pd; - if(sd == NULL || sd->pd == NULL || sd->pd->recovery == NULL) + if(sd == nullptr || sd->pd == nullptr || sd->pd->recovery == nullptr) return 1; pd = sd->pd; @@ -2089,7 +2089,7 @@ TIMER_FUNC(pet_heal_timer){ struct pet_data *pd; unsigned int rate = 100; - if(sd == NULL || sd->pd == NULL || sd->pd->s_skill == NULL) + if(sd == nullptr || sd->pd == nullptr || sd->pd->s_skill == nullptr) return 1; pd = sd->pd; @@ -2132,7 +2132,7 @@ TIMER_FUNC(pet_skill_support_timer){ struct status_data *status; short rate = 100; - if(sd == NULL || sd->pd == NULL || sd->pd->s_skill == NULL) + if(sd == nullptr || sd->pd == nullptr || sd->pd->s_skill == nullptr) return 1; pd = sd->pd; diff --git a/src/map/quest.cpp b/src/map/quest.cpp index 26fb580b8d..a5644fd95f 100644 --- a/src/map/quest.cpp +++ b/src/map/quest.cpp @@ -701,7 +701,7 @@ int quest_delete(map_session_data *sd, int quest_id) if (sd->num_quests == 0) { aFree(sd->quest_log); - sd->quest_log = NULL; + sd->quest_log = nullptr; } else RECREATE(sd->quest_log, struct quest, sd->num_quests); diff --git a/src/map/script.cpp b/src/map/script.cpp index 6408d60aa2..40a4f1ac8f 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -193,7 +193,7 @@ static bool script_rid2bl_(struct script_state *st, uint8 loc, struct block_list /// temporary buffer for passing around compiled bytecode /// @see add_scriptb, set_label, parse_script -static unsigned char* script_buf = NULL; +static unsigned char* script_buf = nullptr; static int script_pos = 0, script_size = 0; static inline int GETVALUE(const unsigned char* buf, int i) @@ -237,8 +237,8 @@ int str_hash[SCRIPT_HASH_SIZE]; //#define SCRIPT_HASH_SDBM #define SCRIPT_HASH_ELF -static DBMap* scriptlabel_db = NULL; // const char* label_name -> int script_pos -static DBMap* userfunc_db = NULL; // const char* func_name -> struct script_code* +static DBMap* scriptlabel_db = nullptr; // const char* label_name -> int script_pos +static DBMap* userfunc_db = nullptr; // const char* func_name -> struct script_code* static int parse_options = 0; DBMap* script_get_label_db(void) { return scriptlabel_db; } DBMap* script_get_userfunc_db(void) { return userfunc_db; } @@ -251,7 +251,7 @@ static int buildin_getelementofarray_ref = 0; // Caches compiled autoscript item code. // Note: This is not cleared when reloading itemdb. -static DBMap* autobonus_db = NULL; // char* script -> char* bytecode +static DBMap* autobonus_db = nullptr; // char* script -> char* bytecode struct Script_Config script_config = { 1, // warn_func_mismatch_argtypes @@ -363,7 +363,7 @@ extern unsigned int current_equip_combo_pos; int potion_flag=0; //For use on Alchemist improved potions/Potion Pitcher. [Skotlex] int potion_hp=0, potion_per_hp=0, potion_sp=0, potion_per_sp=0; int potion_target = 0; -unsigned int *generic_ui_array = NULL; +unsigned int *generic_ui_array = nullptr; unsigned int generic_ui_array_size = 0; @@ -519,7 +519,7 @@ static void script_reportsrc(struct script_state *st) /// Reports on the console information about the script data. static void script_reportdata(struct script_data* data) { - if( data == NULL ) + if( data == nullptr ) return; switch( data->type ) { case C_NOP:// no value @@ -533,7 +533,7 @@ static void script_reportdata(struct script_data* data) if( data->u.str ) { ShowDebug("Data: string value=\"%s\"\n", data->u.str); } else { - ShowDebug("Data: string value=NULL\n"); + ShowDebug("Data: string value=nullptr\n"); } break; case C_NAME:// reference @@ -746,7 +746,7 @@ int add_str(const char* p) str_data[str_num].type = C_NOP; str_data[str_num].str = str_pos; str_data[str_num].next = 0; - str_data[str_num].func = NULL; + str_data[str_num].func = nullptr; str_data[str_num].backpatch = -1; str_data[str_num].label = -1; str_pos += len+1; @@ -863,8 +863,8 @@ void set_label(int l,int pos, const char* script_pos_cur) /// Skips spaces and/or comments. const char* skip_space(const char* p) { - if( p == NULL ) - return NULL; + if( p == nullptr ) + return nullptr; for(;;) { while( ISSPACE(*p) ) @@ -958,7 +958,7 @@ static const char* parse_callfunc(const char* p, int require_paren, int is_custom) { const char* p2; - const char* arg=NULL; + const char* arg=nullptr; int func; func = add_word(p); @@ -985,7 +985,7 @@ const char* parse_callfunc(const char* p, int require_paren, int is_custom) ++arg; // count func as argument } else { const char* name = get_str(func); - if( !is_custom && strdb_get(userfunc_db, name) == NULL ) { + if( !is_custom && strdb_get(userfunc_db, name) == nullptr ) { disp_error_message("parse_line: expect command, missing function name or calling undeclared function",p); } else {; add_scriptl(buildin_callfunc_ref); @@ -1078,7 +1078,7 @@ static void parse_nextline(bool first, const char* p) void parse_variable_sub_push(int word, const char *p2) { if( p2 ) { // Process the variable index - const char *p3 = NULL; + const char *p3 = nullptr; // Push the getelementofarray method into the stack add_scriptl(buildin_getelementofarray_ref); @@ -1101,11 +1101,11 @@ void parse_variable_sub_push(int word, const char *p2) /// Parse a variable assignment using the direct equals operator /// @param p script position where the function should run from -/// @return NULL if not a variable assignment, the new position otherwise +/// @return nullptr if not a variable assignment, the new position otherwise const char* parse_variable(const char* p) { int word; c_op type = C_NOP; - const char *p2 = NULL; + const char *p2 = nullptr; const char *var = p; if( p[0] == '+' && p[1] == '+' ){ @@ -1122,8 +1122,8 @@ const char* parse_variable(const char* p) { p = skip_word(p); p = skip_space(p); - if( p == NULL ) {// end of the line or invalid buffer - return NULL; + if( p == nullptr ) {// end of the line or invalid buffer + return nullptr; } if( *p == '[' ) {// array variable so process the array as appropriate @@ -1195,8 +1195,8 @@ const char* parse_variable(const char* p) { } } - if( p == NULL ) {// end of line or invalid buffer - return NULL; + if( p == nullptr ) {// end of line or invalid buffer + return nullptr; } // push the set function onto the stack @@ -1369,7 +1369,7 @@ const char* parse_simpleexpr(const char *p) return parse_callfunc(p,1,0); else { const char* name = get_str(l); - if( strdb_get(userfunc_db,name) != NULL ) { + if( strdb_get(userfunc_db,name) != nullptr ) { return parse_callfunc(p,1,1); } } @@ -1516,13 +1516,13 @@ const char* parse_line(const char* p) // Syntax-related processing p2 = parse_syntax(p); - if(p2 != NULL) + if(p2 != nullptr) return p2; // attempt to process a variable assignment p2 = parse_variable(p); - if( p2 != NULL ) + if( p2 != nullptr ) {// variable assignment processed so leave the method return parse_syntax_close(p2 + 1); } @@ -1711,7 +1711,7 @@ const char* parse_syntax(const char* p) set_label(l,script_pos,p); } // check duplication of case label [Rayce] - if(linkdb_search(&syntax.curly[pos].case_label, (void*)__64BPRTSIZE(v)) != NULL) + if(linkdb_search(&syntax.curly[pos].case_label, (void*)__64BPRTSIZE(v)) != nullptr) disp_error_message("parse_syntax: dup 'case'",p); linkdb_insert(&syntax.curly[pos].case_label, (void*)__64BPRTSIZE(v), (void*)1); @@ -2031,7 +2031,7 @@ const char* parse_syntax(const char* p) } break; } - return NULL; + return nullptr; } const char* parse_syntax_close(const char *p) { @@ -2252,7 +2252,7 @@ static void add_buildin_func(void) str_data[n].type = C_FUNC; str_data[n].val = i; str_data[n].func = buildin_func[i].func; - str_data[n].deprecated = (buildin_func[i].deprecated != NULL); + str_data[n].deprecated = (buildin_func[i].deprecated != nullptr); if (!strcmp(buildin_func[i].name, "setr")) buildin_set_ref = n; else if (!strcmp(buildin_func[i].name, "callsub")) buildin_callsub_ref = n; @@ -2266,7 +2266,7 @@ static void add_buildin_func(void) * String comparison with a char array to a script constant * @param prefix: Char array to compare * @param value: Script constant - * @return Constant name as char array or NULL otherwise + * @return Constant name as char array or nullptr otherwise */ const char* script_get_constant_str( const char* prefix, int64 value ){ const char* name; @@ -2292,7 +2292,7 @@ const char* script_get_constant_str( const char* prefix, int64 value ){ } } - return NULL; + return nullptr; } /// Retrieves the value of a constant parameter. @@ -2401,7 +2401,7 @@ void script_hardcoded_constants(void) { static const char* script_print_line(StringBuf* buf, const char* p, const char* mark, int line) { int i; - if( p == NULL || !p[0] ) return NULL; + if( p == nullptr || !p[0] ) return nullptr; if( line < 0 ) StringBuf_Printf(buf, "*% 5d : ", -line); else @@ -2421,11 +2421,11 @@ void script_errorwarning_sub(StringBuf *buf, const char* src, const char* file, int j; int line = start_line; const char *p; - const char *linestart[5] = { NULL, NULL, NULL, NULL, NULL }; + const char *linestart[5] = { nullptr, nullptr, nullptr, nullptr, nullptr }; for(p=src;p && *p;line++){ const char *lineend=strchr(p,'\n'); - if(lineend==NULL || error_pos_curscript_buf = script_buf; code->script_size = script_size; - code->local.vars = NULL; - code->local.arrays = NULL; + code->local.vars = nullptr; + code->local.arrays = nullptr; return code; } @@ -2680,7 +2680,7 @@ static bool script_rid2sd_( struct script_state *st, map_session_data** sd, cons * Dereferences a variable/constant, replacing it with a copy of the value. * @param st Script state * @param data Variable/constant - * @param sd If NULL, will try to use sd from st->rid (for player's variables) + * @param sd If nullptr, will try to use sd from st->rid (for player's variables) */ struct script_data *get_val_(struct script_state* st, struct script_data* data, map_session_data *sd) { @@ -2697,7 +2697,7 @@ struct script_data *get_val_(struct script_state* st, struct script_data* data, //##TODO use reference_tovariable(data) when it's confirmed that it works [FlavioJS] if( !reference_toconstant(data) && not_server_variable(prefix) ) { - if( sd == NULL && !script_rid2sd(sd) ) {// needs player attached + if( sd == nullptr && !script_rid2sd(sd) ) {// needs player attached if( postfix == '$' ) {// string variable ShowWarning("script:get_val: cannot access player variable '%s', defaulting to \"\"\n", name); data->type = C_CONSTSTR; @@ -2735,7 +2735,7 @@ struct script_data *get_val_(struct script_state* st, struct script_data* data, if( n ) data->u.str = (char*)i64db_get(n,reference_getuid(data)); else - data->u.str = NULL; + data->u.str = nullptr; } break; case '\'': @@ -2753,7 +2753,7 @@ struct script_data *get_val_(struct script_state* st, struct script_data* data, data->u.str = (char*)i64db_get(n,reference_getuid(data)); else { ShowWarning("script:get_val: cannot access instance variable '%s', defaulting to \"\"\n", name); - data->u.str = NULL; + data->u.str = nullptr; } break; } @@ -2762,7 +2762,7 @@ struct script_data *get_val_(struct script_state* st, struct script_data* data, break; } - if( data->u.str == NULL || data->u.str[0] == '\0' ) {// empty string + if( data->u.str == nullptr || data->u.str[0] == '\0' ) {// empty string data->type = C_CONSTSTR; data->u.str = const_cast(""); } else {// duplicate string @@ -2829,14 +2829,14 @@ struct script_data *get_val_(struct script_state* st, struct script_data* data, } } - data->ref = NULL; + data->ref = nullptr; return data; } struct script_data *get_val(struct script_state* st, struct script_data* data) { - return get_val_(st,data,NULL); + return get_val_(st,data,nullptr); } struct script_data* push_val2(struct script_stack* stack, enum c_op type, int64 val, struct reg_db* ref); @@ -2890,7 +2890,7 @@ void script_array_ensure_zero(struct script_state *st, map_session_data *sd, int { const char *name = get_str(script_getvarid(uid)); // is here st can be null pointer and st->rid is wrong? - struct reg_db *src = script_array_src(st, sd ? sd : st->rid ? map_id2sd(st->rid) : NULL, name, ref); + struct reg_db *src = script_array_src(st, sd ? sd : st->rid ? map_id2sd(st->rid) : nullptr, name, ref); bool insert = false; if (sd && !st) { @@ -2934,7 +2934,7 @@ void script_array_ensure_zero(struct script_state *st, map_session_data *sd, int **/ unsigned int script_array_size(struct script_state *st, map_session_data *sd, const char *name, struct reg_db *ref) { - struct script_array *sa = NULL; + struct script_array *sa = nullptr; struct reg_db *src = script_array_src(st, sd, name, ref); if (src && src->arrays) @@ -2948,7 +2948,7 @@ unsigned int script_array_size(struct script_state *st, map_session_data *sd, co **/ unsigned int script_array_highest_key(struct script_state *st, map_session_data *sd, const char *name, struct reg_db *ref) { - struct script_array *sa = NULL; + struct script_array *sa = nullptr; struct reg_db *src = script_array_src(st, sd, name, ref); if (src && src->arrays) { @@ -3035,7 +3035,7 @@ void script_array_add_member(struct script_array *sa, unsigned int idx) **/ struct reg_db *script_array_src(struct script_state *st, map_session_data *sd, const char *name, struct reg_db *ref) { - struct reg_db *src = NULL; + struct reg_db *src = nullptr; switch( name[0] ) { // from player @@ -3073,7 +3073,7 @@ struct reg_db *script_array_src(struct script_state *st, map_session_data *sd, c return src; } - return NULL; + return nullptr; } /** @@ -3085,7 +3085,7 @@ struct reg_db *script_array_src(struct script_state *st, map_session_data *sd, c **/ void script_array_update(struct reg_db *src, int64 num, bool empty) { - struct script_array *sa = NULL; + struct script_array *sa = nullptr; int id = script_getvarid(num); unsigned int index = script_getvaridx(num); @@ -3117,7 +3117,7 @@ void script_array_update(struct reg_db *src, int64 num, bool empty) } else if ( !empty ) { // we only move to create if not empty sa = ers_alloc(array_ers, struct script_array); sa->id = id; - sa->members = NULL; + sa->members = nullptr; sa->size = 0; script_array_add_member(sa,index); idb_put(src->arrays, id, sa); @@ -3233,7 +3233,7 @@ bool set_reg_num( struct script_state* st, map_session_data* sd, int64 num, cons if( str_data[script_getvarid(num)].type == C_PARAM ){ if( pc_setparam( sd, str_data[script_getvarid(num)].val, value ) == 0 ){ - if( st != NULL ) { + if( st != nullptr ) { ShowError( "script_set_reg: failed to set param '%s' to %" PRId64 ".\n", name, value ); script_reportsrc( st ); st->state = END; @@ -3312,7 +3312,7 @@ bool set_reg_num( struct script_state* st, map_session_data* sd, int64 num, cons } bool set_var_str( map_session_data* sd, const char* name, const char* val ){ - return set_reg_str( NULL, sd, reference_uid( add_str( name ), 0 ), name, val, NULL ); + return set_reg_str( nullptr, sd, reference_uid( add_str( name ), 0 ), name, val, nullptr ); } bool clear_reg( struct script_state* st, map_session_data* sd, int64 num, const char* name, struct reg_db *ref ){ @@ -3372,7 +3372,7 @@ const char* conv_str_(struct script_state* st, struct script_data* data, map_ses const char* conv_str(struct script_state* st, struct script_data* data) { - return conv_str_(st, data, NULL); + return conv_str_(st, data, nullptr); } /** @@ -3396,7 +3396,7 @@ int64 conv_num_(struct script_state* st, struct script_data* data, map_session_d bool error; errno = 0; - num = strtoll(data->u.str, NULL, 10);// change radix to 0 to support octal numbers "o377" and hex numbers "0xFF" + num = strtoll(data->u.str, nullptr, 10);// change radix to 0 to support octal numbers "o377" and hex numbers "0xFF" error = (errno == ERANGE); if( num < SCRIPT_INT_MIN || ( error && num == INT64_MIN ) ){ @@ -3433,12 +3433,12 @@ int64 conv_num_(struct script_state* st, struct script_data* data, map_session_d int64 conv_num64(struct script_state* st, struct script_data* data) { - return conv_num_(st, data, NULL); + return conv_num_(st, data, nullptr); } int conv_num(struct script_state* st, struct script_data* data) { - return static_cast(conv_num_(st, data, NULL)); + return static_cast(conv_num_(st, data, nullptr)); } // @@ -3456,7 +3456,7 @@ void stack_expand(struct script_stack* stack) } /// Pushes a value into the stack -#define push_val(stack,type,val) push_val2(stack, type, val, NULL) +#define push_val(stack,type,val) push_val2(stack, type, val, nullptr) /// Pushes a value into the stack (with reference) struct script_data* push_val2(struct script_stack* stack, enum c_op type, int64 val, struct reg_db *ref) @@ -3477,7 +3477,7 @@ struct script_data* push_str(struct script_stack* stack, enum c_op type, char* s stack_expand(stack); stack->stack_data[stack->sp].type = type; stack->stack_data[stack->sp].u.str = str; - stack->stack_data[stack->sp].ref = NULL; + stack->stack_data[stack->sp].ref = nullptr; stack->sp++; return &stack->stack_data[stack->sp-1]; } @@ -3544,11 +3544,11 @@ void pop_stack(struct script_state* st, int start, int end) if (ri->scope.vars) { script_free_vars(ri->scope.vars); - ri->scope.vars = NULL; + ri->scope.vars = nullptr; } if (ri->scope.arrays) { ri->scope.arrays->destroy(ri->scope.arrays, script_free_array_db); - ri->scope.arrays = NULL; + ri->scope.arrays = nullptr; } if( data->ref ) aFree(data->ref); @@ -3633,7 +3633,7 @@ struct script_state* script_alloc_state(struct script_code* rootscript, int pos, CREATE(st->stack->stack_data, struct script_data, st->stack->sp_max); st->stack->defsp = st->stack->sp; st->stack->scope.vars = i64db_alloc(DB_OPT_RELEASE_DATA); - st->stack->scope.arrays = NULL; + st->stack->scope.arrays = nullptr; st->state = RUN; st->script = rootscript; st->pos = pos; @@ -3667,7 +3667,7 @@ struct script_state* script_alloc_state(struct script_code* rootscript, int pos, void script_free_state(struct script_state* st) { if (idb_exists(st_db, st->id)) { - map_session_data *sd = st->rid ? map_id2sd(st->rid) : NULL; + map_session_data *sd = st->rid ? map_id2sd(st->rid) : nullptr; if (st->bk_st) // backup was not restored ShowDebug("script_free_state: Previous script state lost (rid=%d, oid=%d, state=%d, bk_npcid=%d).\n", st->bk_st->rid, st->bk_st->oid, st->bk_st->state, st->bk_npcid); @@ -3677,7 +3677,7 @@ void script_free_state(struct script_state* st) clif_clearunit_single(sd->npc_id, CLR_OUTSIGHT, sd->fd); sd->state.using_fake_npc = 0; } - sd->st = NULL; + sd->st = nullptr; sd->npc_id = 0; } @@ -3690,16 +3690,16 @@ void script_free_state(struct script_state* st) pop_stack(st, 0, st->stack->sp); aFree(st->stack->stack_data); ers_free(stack_ers, st->stack); - st->stack = NULL; + st->stack = nullptr; } if (st->script && st->script->instances != USHRT_MAX && --st->script->instances == 0) { if (st->script->local.vars && !db_size(st->script->local.vars)) { script_free_vars(st->script->local.vars); - st->script->local.vars = NULL; + st->script->local.vars = nullptr; } if (st->script->local.arrays && !db_size(st->script->local.arrays)) { st->script->local.arrays->destroy(st->script->local.arrays, script_free_array_db); - st->script->local.arrays = NULL; + st->script->local.arrays = nullptr; } } st->pos = -1; @@ -4024,7 +4024,7 @@ static void script_check_buildin_argtype(struct script_state* st, int func) } else { - const char* name = NULL; + const char* name = nullptr; if( data_isreference(data) ) {// get name for variables to determine the type they refer to @@ -4187,7 +4187,7 @@ void run_script(struct script_code *rootscript, int pos, int rid, int oid) { struct script_state *st; - if( rootscript == NULL || pos < 0 ) + if( rootscript == nullptr || pos < 0 ) return; // TODO In jAthena, this function can take over the pending script in the player. [FlavioJS] @@ -4280,7 +4280,7 @@ struct linkdb_node *script_erase_sleepdb(struct linkdb_node *n) { struct linkdb_node *retnode; if (!n) - return NULL; + return nullptr; if (!n->prev) sleep_db = n->next; @@ -4304,7 +4304,7 @@ static void script_detach_state(struct script_state* st, bool dequeue_event) { map_session_data* sd; - if(st->rid && (sd = map_id2sd(st->rid))!=NULL) { + if(st->rid && (sd = map_id2sd(st->rid))!=nullptr) { if( sd->state.using_fake_npc ){ clif_clearunit_single( sd->npc_id, CLR_OUTSIGHT, sd->fd ); sd->state.using_fake_npc = 0; @@ -4315,7 +4315,7 @@ static void script_detach_state(struct script_state* st, bool dequeue_event) sd->state.disable_atcommand_on_npc = 0; if(st->bk_st) { //Remove tag for removal. - st->bk_st = NULL; + st->bk_st = nullptr; st->bk_npcid = 0; } else if(dequeue_event) { @@ -4337,7 +4337,7 @@ static void script_detach_state(struct script_state* st, bool dequeue_event) script_reportsrc(st->bk_st); script_free_state(st->bk_st); - st->bk_st = NULL; + st->bk_st = nullptr; } } @@ -4347,7 +4347,7 @@ static void script_detach_state(struct script_state* st, bool dequeue_event) void script_attach_state(struct script_state* st){ map_session_data* sd; - if(st->rid && (sd = map_id2sd(st->rid))!=NULL) + if(st->rid && (sd = map_id2sd(st->rid))!=nullptr) { if(st!=sd->st) { @@ -4495,7 +4495,7 @@ void run_script_main(struct script_state *st) script_reportsrc(st); script_free_state(st->bk_st); - st->bk_st = NULL; + st->bk_st = nullptr; } } else { if (st->stack && st->stack->defsp >= 1 && st->stack->stack_data[st->stack->defsp - 1].type == C_RETINFO) { @@ -4508,7 +4508,7 @@ void run_script_main(struct script_state *st) } //Dispose of script. - if ((sd = map_id2sd(st->rid))!=NULL) + if ((sd = map_id2sd(st->rid))!=nullptr) { //Restore previous stack and save char. if(sd->state.using_fake_npc){ clif_clearunit_single(sd->npc_id, CLR_OUTSIGHT, sd->fd); @@ -4531,7 +4531,7 @@ int script_config_read(const char *cfgName) fp=fopen(cfgName,"r"); - if(fp==NULL){ + if(fp==nullptr){ ShowError("File not found: %s\n", cfgName); return 1; } @@ -4607,7 +4607,7 @@ void script_run_autobonus(const char *autobonus, map_session_data *sd, unsigned void script_add_autobonus(const char *autobonus) { - if( strdb_get(autobonus_db, autobonus) == NULL ) + if( strdb_get(autobonus_db, autobonus) == nullptr ) { struct script_code *script = parse_script(autobonus, "autobonus", 0, 0); @@ -4640,14 +4640,14 @@ void script_add_petautobonus(const std::string &autobonus) { /// resets a temporary character array variable to given value void script_cleararray_pc( map_session_data* sd, const char* varname ){ - struct script_array *sa = NULL; - struct reg_db *src = NULL; - unsigned int i, *list = NULL, size = 0; + struct script_array *sa = nullptr; + struct reg_db *src = nullptr; + unsigned int i, *list = nullptr, size = 0; int key; key = add_str(varname); - if( !(src = script_array_src(NULL,sd,varname,NULL) ) ) + if( !(src = script_array_src(nullptr,sd,varname,nullptr) ) ) return; if( !(sa = static_cast(idb_get(src->arrays, key))) ) /* non-existent array, nothing to empty */ @@ -4657,13 +4657,13 @@ void script_cleararray_pc( map_session_data* sd, const char* varname ){ list = script_array_cpy_list(sa); for( i = 0; i < size; i++ ){ - clear_reg( NULL, sd, reference_uid( key, list[i] ), varname, NULL ); + clear_reg( nullptr, sd, reference_uid( key, list[i] ), varname, nullptr ); } } /// sets a temporary character array variable element idx to given value -/// @param refcache Pointer to an int variable, which keeps a copy of the reference to varname and must be initialized to 0. Can be NULL if only one element is set. +/// @param refcache Pointer to an int variable, which keeps a copy of the reference to varname and must be initialized to 0. Can be nullptr if only one element is set. void script_setarray_pc(map_session_data* sd, const char* varname, uint32 idx, int64 value, int* refcache) { int key; @@ -4675,7 +4675,7 @@ void script_setarray_pc(map_session_data* sd, const char* varname, uint32 idx, i key = ( refcache && refcache[0] ) ? refcache[0] : add_str(varname); - set_reg_num( NULL, sd, reference_uid( key, idx ), varname, value, NULL ); + set_reg_num( nullptr, sd, reference_uid( key, idx ), varname, value, nullptr ); if( refcache ) { // save to avoid repeated script->add_str calls @@ -4895,8 +4895,8 @@ void script_reload(void) { // buildin functions // -#define BUILDIN_DEF(x,args) { buildin_ ## x , #x , args, NULL } -#define BUILDIN_DEF2(x,x2,args) { buildin_ ## x , x2 , args, NULL } +#define BUILDIN_DEF(x,args) { buildin_ ## x , #x , args, nullptr } +#define BUILDIN_DEF2(x,x2,args) { buildin_ ## x , x2 , args, nullptr } #define BUILDIN_DEF_DEPRECATED(x,args,deprecationdate) { buildin_ ## x , #x , args, deprecationdate } #define BUILDIN_DEF2_DEPRECATED(x,x2,args,deprecationdate) { buildin_ ## x , x2 , args, deprecationdate } #define BUILDIN_FUNC(x) int buildin_ ## x (struct script_state* st) @@ -5034,13 +5034,13 @@ BUILDIN_FUNC(close2) /// Counts the number of valid and total number of options in 'str' /// If max_count > 0 the counting stops when that valid option is reached -/// total is incremented for each option (NULL is supported) +/// total is incremented for each option (nullptr is supported) static int menu_countoptions(const char* str, int max_count, int* total) { int count = 0; int bogus_total; - if( total == NULL ) + if( total == nullptr ) total = &bogus_total; ++(*total); @@ -5134,7 +5134,7 @@ BUILDIN_FUNC(menu) if( sd->npc_menu > 0 ) StringBuf_AppendStr(&buf, ":"); StringBuf_AppendStr(&buf, text); - sd->npc_menu += menu_countoptions(text, 0, NULL); + sd->npc_menu += menu_countoptions(text, 0, nullptr); } st->state = RERUNLINE; sd->state.menu_or_input = 1; @@ -5237,7 +5237,7 @@ BUILDIN_FUNC(select) StringBuf_AppendStr(&buf, ":"); StringBuf_AppendStr(&buf, text); - sd->npc_menu += menu_countoptions(text, 0, NULL); + sd->npc_menu += menu_countoptions(text, 0, nullptr); } st->state = RERUNLINE; @@ -5315,7 +5315,7 @@ BUILDIN_FUNC(prompt) if( sd->npc_menu > 0 ) StringBuf_AppendStr(&buf, ":"); StringBuf_AppendStr(&buf, text); - sd->npc_menu += menu_countoptions(text, 0, NULL); + sd->npc_menu += menu_countoptions(text, 0, nullptr); } st->state = RERUNLINE; @@ -5399,7 +5399,7 @@ BUILDIN_FUNC(callfunc) struct script_retinfo* ri; struct script_code* scr; const char* str = script_getstr(st,2); - struct reg_db *ref = NULL; + struct reg_db *ref = nullptr; scr = (struct script_code*)strdb_get(userfunc_db, str); if(!scr) { @@ -5459,7 +5459,7 @@ BUILDIN_FUNC(callsub) int i,j; struct script_retinfo* ri; int pos = script_getnum(st,2); - struct reg_db *ref = NULL; + struct reg_db *ref = nullptr; if( !data_islabel(script_getdata(st,2)) && !data_isfunclabel(script_getdata(st,2)) ) { ShowError("buildin_callsub: Argument is not a label\n"); @@ -5553,7 +5553,7 @@ BUILDIN_FUNC(return) if( !data->ref || data->ref->vars == st->stack->scope.vars ) get_val(st, data); // current scope, convert to value if( data->ref && data->ref->vars == st->stack->stack_data[st->stack->defsp-1].u.ri->scope.vars ) - data->ref = NULL; // Reference to the parent scope, remove reference pointer + data->ref = nullptr; // Reference to the parent scope, remove reference pointer } } } @@ -5773,7 +5773,7 @@ enum e_warpparty_target{ *------------------------------------------*/ BUILDIN_FUNC(warpparty) { - TBL_PC *sd = NULL; + TBL_PC *sd = nullptr; TBL_PC *pl_sd; struct party_data* p; int mapindex = 0, m = -1, i, rx = 0, ry = 0; @@ -5782,7 +5782,7 @@ BUILDIN_FUNC(warpparty) int x = script_getnum(st,3); int y = script_getnum(st,4); int p_id = script_getnum(st,5); - const char* str2 = NULL; + const char* str2 = nullptr; if ( script_hasdata(st,6) ) str2 = script_getstr(st,6); if (script_hasdata(st, 7)) @@ -5931,7 +5931,7 @@ BUILDIN_FUNC(warpparty) *------------------------------------------*/ BUILDIN_FUNC(warpguild) { - TBL_PC *sd = NULL; + TBL_PC *sd = nullptr; TBL_PC *pl_sd; struct s_mapiterator* iter; int type, mapindex = 0, m = -1; @@ -5942,7 +5942,7 @@ BUILDIN_FUNC(warpguild) int gid = script_getnum(st,5); auto g = guild_search(gid); - if( g == NULL ) + if( g == nullptr ) return SCRIPT_CMD_SUCCESS; type = ( strcmp(str,"Random")==0 ) ? 0 @@ -6194,7 +6194,7 @@ BUILDIN_FUNC(copyarray); /// set(,{,}) BUILDIN_FUNC(setr) { - TBL_PC* sd = NULL; + TBL_PC* sd = nullptr; struct script_data* data; //struct script_data* datavalue; int64 num; @@ -6231,7 +6231,7 @@ BUILDIN_FUNC(setr) if( !not_array_variable(*namevalue) ) {// array variable being copied into another array variable - if( sd == NULL && not_server_variable(*namevalue) && !(sd = script_rid2sd(st)) ) + if( sd == nullptr && not_server_variable(*namevalue) && !(sd = script_rid2sd(st)) ) {// player must be attached in order to copy a player variable ShowError("script:set: no player attached for player variable '%s'\n", namevalue); return SCRIPT_CMD_SUCCESS; @@ -6284,7 +6284,7 @@ BUILDIN_FUNC(setarray) uint32 end; int32 id; int32 i; - TBL_PC* sd = NULL; + TBL_PC* sd = nullptr; data = script_getdata(st, 2); if( !data_isreference(data) ) @@ -6333,7 +6333,7 @@ BUILDIN_FUNC(cleararray) uint32 start; uint32 end; int32 id; - TBL_PC* sd = NULL; + TBL_PC* sd = nullptr; data = script_getdata(st, 2); if( !data_isreference(data) ) @@ -6391,7 +6391,7 @@ BUILDIN_FUNC(copyarray) int32 id2; int32 i; uint32 count; - TBL_PC* sd = NULL; + TBL_PC* sd = nullptr; data1 = script_getdata(st, 2); data2 = script_getdata(st, 3); @@ -6477,7 +6477,7 @@ BUILDIN_FUNC(getarraysize) { struct script_data* data; const char* name; - map_session_data* sd = NULL; + map_session_data* sd = nullptr; data = script_getdata(st, 2); if( !data_isreference(data) ) @@ -6515,9 +6515,9 @@ BUILDIN_FUNC(deletearray) const char* name; unsigned int start, end, i; int id; - TBL_PC *sd = NULL; - struct script_array *sa = NULL; - struct reg_db *src = NULL; + TBL_PC *sd = nullptr; + struct script_array *sa = nullptr; + struct reg_db *src = nullptr; data = script_getdata(st, 2); if( !data_isreference(data) ) { @@ -6543,7 +6543,7 @@ BUILDIN_FUNC(deletearray) return SCRIPT_CMD_FAILURE;// not a variable } - script_array_ensure_zero(st, NULL, data->u.num, reference_getref(data)); + script_array_ensure_zero(st, nullptr, data->u.num, reference_getref(data)); if ( !(sa = static_cast(idb_get(src->arrays, id))) ) { // non-existent array, nothing to empty return SCRIPT_CMD_SUCCESS;// not a variable @@ -6583,7 +6583,7 @@ BUILDIN_FUNC(deletearray) } } else { // using sa to speed up - unsigned int *list = NULL, size = 0; + unsigned int *list = nullptr, size = 0; list = script_array_cpy_list(sa); size = sa->size; qsort(list, size, sizeof(unsigned int), script_array_index_cmp); @@ -6612,7 +6612,7 @@ BUILDIN_FUNC(deletearray) } } } else { - unsigned int *list = NULL, size = 0; + unsigned int *list = nullptr, size = 0; list = script_array_cpy_list(sa); size = sa->size; @@ -6669,8 +6669,8 @@ BUILDIN_FUNC(inarray) struct script_data *data; const char* name; int id; - map_session_data* sd = NULL; - struct reg_db *ref = NULL; + map_session_data* sd = nullptr; + struct reg_db *ref = nullptr; data = script_getdata(st, 2); if (!data_isreference(data)) @@ -6748,8 +6748,8 @@ BUILDIN_FUNC(countinarray) const char* name1; const char* name2; int id1, id2, case_count = 0; - map_session_data* sd = NULL; - struct reg_db *ref1 = NULL, *ref2 = NULL; + map_session_data* sd = nullptr; + struct reg_db *ref1 = nullptr, *ref2 = nullptr; data1 = script_getdata(st, 2); data2 = script_getdata(st, 3); @@ -6982,7 +6982,7 @@ static bool script_getitem_randomoption(struct script_state *st, map_session_dat int32 opt_id_id, opt_id_idx; int32 opt_val_id, opt_val_idx; int32 opt_param_id, opt_param_idx; - struct reg_db *opt_id_ref = NULL, *opt_val_ref = NULL, *opt_param_ref = NULL; + struct reg_db *opt_id_ref = nullptr, *opt_val_ref = nullptr, *opt_param_ref = nullptr; // Check if the variable requires a player if( not_server_variable(opt_id_var[0]) && sd == nullptr ){ @@ -7661,7 +7661,7 @@ BUILDIN_FUNC(getitem) script_mapid2sd(4,sd); } - if( sd == NULL ) // no target + if( sd == nullptr ) // no target return SCRIPT_CMD_SUCCESS; //Check if it's stackable. @@ -7894,7 +7894,7 @@ BUILDIN_FUNC(rentitem) { it.nameid = nameid; it.identify = 1; - it.expire_time = (unsigned int)(time(NULL) + seconds); + it.expire_time = (unsigned int)(time(nullptr) + seconds); it.bound = BOUND_NONE; if( (flag = pc_additem(sd, &it, 1, LOG_TYPE_SCRIPT)) ) @@ -7986,7 +7986,7 @@ BUILDIN_FUNC(rentitem2) { it.card[1] = c2; it.card[2] = c3; it.card[3] = c4; - it.expire_time = (unsigned int)(time(NULL) + seconds); + it.expire_time = (unsigned int)(time(nullptr) + seconds); it.bound = BOUND_NONE; if (funcname[strlen(funcname)-1] == '3') { @@ -8059,7 +8059,7 @@ BUILDIN_FUNC(getnameditem) else //Char Id was given tsd = map_charid2sd(script_getnum(st, 3)); - if( tsd == NULL ) + if( tsd == nullptr ) { //Failed script_pushint(st,0); return SCRIPT_CMD_SUCCESS; @@ -8290,8 +8290,8 @@ BUILDIN_FUNC(makeitem2) { static void buildin_delitem_delete(map_session_data* sd, int idx, int* amount, uint8 loc, bool delete_items) { int delamount; - struct item *itm = NULL; - struct s_storage *gstor = NULL; + struct item *itm = nullptr; + struct s_storage *gstor = nullptr; switch(loc) { case TABLE_CART: @@ -8402,7 +8402,7 @@ static bool buildin_delitem_search(map_session_data* sd, struct item* it, uint8 // 1st pass -- less important items / exact match for( i = 0; amount && i < size; i++ ) { - struct item *itm = NULL; + struct item *itm = nullptr; if( !&items[i] || !(itm = &items[i])->nameid || itm->nameid != it->nameid ) {// wrong/invalid item @@ -8458,7 +8458,7 @@ static bool buildin_delitem_search(map_session_data* sd, struct item* it, uint8 } else for( i = 0; amount && i < size; i++ ) { - struct item *itm = NULL; + struct item *itm = nullptr; if( !&items[i] || !(itm = &items[i])->nameid || itm->nameid != it->nameid ) {// wrong/invalid item @@ -8546,7 +8546,7 @@ BUILDIN_FUNC(delitem) if (loc == TABLE_GUILD_STORAGE) { struct s_storage *gstor = guild2storage2(sd->status.guild_id); - if (gstor == NULL || sd->state.storage_flag) { + if (gstor == nullptr || sd->state.storage_flag) { script_pushint(st, -1); return SCRIPT_CMD_FAILURE; } @@ -8639,7 +8639,7 @@ BUILDIN_FUNC(delitem2) if (loc == TABLE_GUILD_STORAGE) { struct s_storage *gstor = guild2storage2(sd->status.guild_id); - if (gstor == NULL || sd->state.storage_flag) { + if (gstor == nullptr || sd->state.storage_flag) { script_pushint(st, -1); return SCRIPT_CMD_FAILURE; } @@ -8782,7 +8782,7 @@ BUILDIN_FUNC(readparam) { int value; struct script_data *data = script_getdata(st, 2); - TBL_PC *sd = NULL; + TBL_PC *sd = nullptr; if( script_hasdata(st, 3) ){ if (script_isint(st, 3)) @@ -8854,11 +8854,11 @@ BUILDIN_FUNC(getcharid) BUILDIN_FUNC(getnpcid) { int num = script_getnum(st,2); - struct npc_data* nd = NULL; + struct npc_data* nd = nullptr; if( script_hasdata(st,3) ) {// unique npc name - if( ( nd = npc_name2id(script_getstr(st,3)) ) == NULL ) + if( ( nd = npc_name2id(script_getstr(st,3)) ) == nullptr ) { //Npc not found. script_pushint(st,0); @@ -8889,7 +8889,7 @@ BUILDIN_FUNC(getpartyname) party_id = script_getnum(st,2); - if( ( p = party_search(party_id) ) != NULL ) + if( ( p = party_search(party_id) ) != nullptr ) { script_pushstrcopy(st,p->party.name); } @@ -8915,10 +8915,10 @@ BUILDIN_FUNC(getpartymember) p = party_search(script_getnum(st,2)); - if (p != NULL) { + if (p != nullptr) { uint8 i, type = 0; - struct script_data *data = NULL; - char *varname = NULL; + struct script_data *data = nullptr; + char *varname = nullptr; if (script_hasdata(st,3)) type = script_getnum(st,3); @@ -8949,19 +8949,19 @@ BUILDIN_FUNC(getpartymember) switch (type) { case 2: if (data) - setd_sub_num( st, NULL, varname, j, p->party.member[i].account_id, data->ref ); + setd_sub_num( st, nullptr, varname, j, p->party.member[i].account_id, data->ref ); else mapreg_setreg(reference_uid(add_str("$@partymemberaid"), j),p->party.member[i].account_id); break; case 1: if (data) - setd_sub_num( st, NULL, varname, j, p->party.member[i].char_id, data->ref ); + setd_sub_num( st, nullptr, varname, j, p->party.member[i].char_id, data->ref ); else mapreg_setreg(reference_uid(add_str("$@partymembercid"), j),p->party.member[i].char_id); break; default: if (data) - setd_sub_str( st, NULL, varname, j, p->party.member[i].name, data->ref ); + setd_sub_str( st, nullptr, varname, j, p->party.member[i].name, data->ref ); else mapreg_setregstr(reference_uid(add_str("$@partymembername$"), j),p->party.member[i].name); break; @@ -9088,7 +9088,7 @@ BUILDIN_FUNC(strcharinfo) script_pushstrcopy(st,sd->status.name); break; case 1: - if( ( p = party_search(sd->status.party_id) ) != NULL ) { + if( ( p = party_search(sd->status.party_id) ) != nullptr ) { script_pushstrcopy(st,p->party.name); } else { script_pushconststr(st,""); @@ -9126,7 +9126,7 @@ BUILDIN_FUNC(strnpcinfo) { TBL_NPC* nd; int num; - char *buf,*name=NULL; + char *buf,*name=nullptr; nd = map_id2nd(st->oid); if (!nd) { @@ -9140,7 +9140,7 @@ BUILDIN_FUNC(strnpcinfo) name = aStrdup(nd->name); break; case 1: // visible part of display name - if((buf = strchr(nd->name,'#')) != NULL) + if((buf = strchr(nd->name,'#')) != nullptr) { name = aStrdup(nd->name); name[buf - nd->name] = 0; @@ -9148,7 +9148,7 @@ BUILDIN_FUNC(strnpcinfo) name = aStrdup(nd->name); break; case 2: // # fragment - if((buf = strchr(nd->name,'#')) != NULL) + if((buf = strchr(nd->name,'#')) != nullptr) name = aStrdup(buf+1); break; case 3: // unique name @@ -10002,7 +10002,7 @@ BUILDIN_FUNC(autobonus) short rate; uint16 atk_type = 0; TBL_PC* sd; - const char *bonus_script, *other_script = NULL; + const char *bonus_script, *other_script = nullptr; if( !script_rid2sd(sd) ) return SCRIPT_CMD_SUCCESS; // no player attached @@ -10039,7 +10039,7 @@ BUILDIN_FUNC(autobonus2) short rate; uint16 atk_type = 0; TBL_PC* sd; - const char *bonus_script, *other_script = NULL; + const char *bonus_script, *other_script = nullptr; if( !script_rid2sd(sd) ) return SCRIPT_CMD_SUCCESS; // no player attached @@ -10076,7 +10076,7 @@ BUILDIN_FUNC(autobonus3) short rate; uint16 skill_id = 0; TBL_PC* sd; - const char *bonus_script, *other_script = NULL; + const char *bonus_script, *other_script = nullptr; if( !script_rid2sd(sd) ) return SCRIPT_CMD_SUCCESS; // no player attached @@ -10741,7 +10741,7 @@ BUILDIN_FUNC(gettimetick) /* Asgard Version */ case 2: //type 2:(Get the number of seconds elapsed since 00:00 hours, Jan 1, 1970 UTC // from the system clock.) - script_pushint(st,(int)time(NULL)); + script_pushint(st,(int)time(nullptr)); break; case 1: //type 1:(Second Ticks: 0-86399, 00:00:00-23:59:59) @@ -10813,7 +10813,7 @@ BUILDIN_FUNC(gettimestr) } else now = (time_t)script_getnum(st, 4); } else - now = time(NULL); + now = time(nullptr); tmpstr = (char *)aMalloc((maxlen+1)*sizeof(char)); strftime(tmpstr,maxlen,fmtstr,localtime(&now)); @@ -11045,7 +11045,7 @@ BUILDIN_FUNC(getexp){ if (job) job = (int64) cap_value(job * bonus, 0, MAX_EXP); - pc_gainexp(sd, NULL, base, job, 1); + pc_gainexp(sd, nullptr, base, job, 1); #ifdef RENEWAL if (base && sd->hd) hom_gainexp(sd->hd, base * battle_config.homunculus_exp_gain / 100); // Homunculus only receive 10% of EXP @@ -11419,7 +11419,7 @@ BUILDIN_FUNC(killmonsterall) *------------------------------------------*/ BUILDIN_FUNC(clone) { - TBL_PC *sd, *msd=NULL; + TBL_PC *sd, *msd=nullptr; uint32 char_id, master_id = 0, x, y, flag = 0; int16 m; enum e_mode mode = MD_NONE; @@ -11820,7 +11820,7 @@ BUILDIN_FUNC(detachnpctimer) *------------------------------------------*/ BUILDIN_FUNC(playerattached) { - if(st->rid == 0 || map_id2sd(st->rid) == NULL) + if(st->rid == 0 || map_id2sd(st->rid) == nullptr) script_pushint(st,0); else script_pushint(st,st->rid); @@ -11833,7 +11833,7 @@ BUILDIN_FUNC(announce) { const char *mes = script_getstr(st,2); int flag = script_getnum(st,3); - const char *fontColor = script_hasdata(st,4) ? script_getstr(st,4) : NULL; + const char *fontColor = script_hasdata(st,4) ? script_getstr(st,4) : nullptr; int fontType = script_hasdata(st,5) ? script_getnum(st,5) : FW_NORMAL; // default fontType int fontSize = script_hasdata(st,6) ? script_getnum(st,6) : 12; // default fontSize int fontAlign = script_hasdata(st,7) ? script_getnum(st,7) : 0; // default fontAlign @@ -11853,10 +11853,10 @@ BUILDIN_FUNC(announce) if(script_charid2sd(9, sd)) bl = &sd->bl; else - bl = NULL; + bl = nullptr; } - if (bl == NULL) + if (bl == nullptr) return SCRIPT_CMD_SUCCESS; switch (flag&BC_TARGET_MASK) { @@ -11867,14 +11867,14 @@ BUILDIN_FUNC(announce) } if (fontColor) - clif_broadcast2(bl, mes, (int)strlen(mes)+1, strtol(fontColor, (char **)NULL, 0), fontType, fontSize, fontAlign, fontY, target); + clif_broadcast2(bl, mes, (int)strlen(mes)+1, strtol(fontColor, (char **)nullptr, 0), fontType, fontSize, fontAlign, fontY, target); else clif_broadcast(bl, mes, (int)strlen(mes)+1, flag&BC_COLOR_MASK, target); } else { if (fontColor) - intif_broadcast2(mes, (int)strlen(mes)+1, strtol(fontColor, (char **)NULL, 0), fontType, fontSize, fontAlign, fontY); + intif_broadcast2(mes, (int)strlen(mes)+1, strtol(fontColor, (char **)nullptr, 0), fontType, fontSize, fontAlign, fontY); else intif_broadcast(mes, (int)strlen(mes)+1, flag&BC_COLOR_MASK); } @@ -11894,7 +11894,7 @@ static int buildin_announce_sub(struct block_list *bl, va_list ap) short fontAlign = (short)va_arg(ap, int); short fontY = (short)va_arg(ap, int); if (fontColor) - clif_broadcast2(bl, mes, len, strtol(fontColor, (char **)NULL, 0), fontType, fontSize, fontAlign, fontY, SELF); + clif_broadcast2(bl, mes, len, strtol(fontColor, (char **)nullptr, 0), fontType, fontSize, fontAlign, fontY, SELF); else clif_broadcast(bl, mes, len, type, SELF); return SCRIPT_CMD_SUCCESS; @@ -11905,7 +11905,7 @@ BUILDIN_FUNC(mapannounce) const char *mapname = script_getstr(st,2); const char *mes = script_getstr(st,3); int flag = script_getnum(st,4); - const char *fontColor = script_hasdata(st,5) ? script_getstr(st,5) : NULL; + const char *fontColor = script_hasdata(st,5) ? script_getstr(st,5) : nullptr; int fontType = script_hasdata(st,6) ? script_getnum(st,6) : FW_NORMAL; // default fontType int fontSize = script_hasdata(st,7) ? script_getnum(st,7) : 12; // default fontSize int fontAlign = script_hasdata(st,8) ? script_getnum(st,8) : 0; // default fontAlign @@ -11931,7 +11931,7 @@ BUILDIN_FUNC(areaannounce) int y1 = script_getnum(st,6); const char *mes = script_getstr(st,7); int flag = script_getnum(st,8); - const char *fontColor = script_hasdata(st,9) ? script_getstr(st,9) : NULL; + const char *fontColor = script_hasdata(st,9) ? script_getstr(st,9) : nullptr; int fontType = script_hasdata(st,10) ? script_getnum(st,10) : FW_NORMAL; // default fontType int fontSize = script_hasdata(st,11) ? script_getnum(st,11) : 12; // default fontSize int fontAlign = script_hasdata(st,12) ? script_getnum(st,12) : 0; // default fontAlign @@ -11952,7 +11952,7 @@ BUILDIN_FUNC(getusers) { int flag, val = 0; map_session_data* sd; - struct block_list* bl = NULL; + struct block_list* bl = nullptr; flag = script_getnum(st,2); @@ -12066,9 +12066,9 @@ BUILDIN_FUNC(getareausers) *------------------------------------------*/ BUILDIN_FUNC(getunits) { - struct block_list *bl = NULL; - map_session_data *sd = NULL; - struct script_data *data = NULL; + struct block_list *bl = nullptr; + map_session_data *sd = nullptr; + struct script_data *data = nullptr; char *command = (char *)script_getfuncname(st); const char *str; const char *name; @@ -12437,7 +12437,7 @@ BUILDIN_FUNC(getscrate) bl = map_id2bl(st->rid); if (bl) - rate = status_get_sc_def(NULL,bl, (sc_type)type, 10000, 10000, SCSTART_NONE); + rate = status_get_sc_def(nullptr,bl, (sc_type)type, 10000, 10000, SCSTART_NONE); script_pushint(st,rate); return SCRIPT_CMD_SUCCESS; @@ -12556,7 +12556,7 @@ BUILDIN_FUNC(homunculus_mutate) uint16 homun_id; TBL_PC *sd; - if( !script_rid2sd(sd) || sd->hd == NULL ) + if( !script_rid2sd(sd) || sd->hd == nullptr ) return SCRIPT_CMD_SUCCESS; if(script_hasdata(st,2)) @@ -12595,7 +12595,7 @@ BUILDIN_FUNC(morphembryo) struct item item_tmp; TBL_PC *sd; - if( !script_rid2sd(sd) || sd->hd == NULL ) + if( !script_rid2sd(sd) || sd->hd == nullptr ) return SCRIPT_CMD_SUCCESS; if( hom_is_active(sd->hd) ) { @@ -12810,7 +12810,7 @@ BUILDIN_FUNC(skillpointcount) *------------------------------------------*/ BUILDIN_FUNC(changebase) { - TBL_PC *sd=NULL; + TBL_PC *sd=nullptr; int vclass; if( !script_mapid2sd(3,sd) ) @@ -12846,7 +12846,7 @@ BUILDIN_FUNC(changebase) BUILDIN_FUNC(changesex) { int i; - TBL_PC *sd = NULL; + TBL_PC *sd = nullptr; if (!script_charid2sd(2,sd)) return SCRIPT_CMD_FAILURE; @@ -12870,7 +12870,7 @@ BUILDIN_FUNC(changecharsex) { #if PACKETVER >= 20141016 int i; - TBL_PC *sd = NULL; + TBL_PC *sd = nullptr; if (!script_charid2sd(2,sd)) return SCRIPT_CMD_FAILURE; @@ -12896,10 +12896,10 @@ BUILDIN_FUNC(globalmes) { struct block_list *bl = map_id2bl(st->oid); struct npc_data *nd = (struct npc_data *)bl; - const char *name=NULL,*mes; + const char *name=nullptr,*mes; mes=script_getstr(st,2); - if(mes==NULL) + if(mes==nullptr) return SCRIPT_CMD_SUCCESS; if(script_hasdata(st,3)){ // npc name to display @@ -12931,7 +12931,7 @@ BUILDIN_FUNC(waitingroom) int maxLvl = script_hasdata(st,8) ? script_getnum(st,8) : MAX_LEVEL; nd = (struct npc_data *)map_id2bl(st->oid); - if( nd != NULL ) + if( nd != nullptr ) chat_createnpcchat(nd, title, limit, 1, trigger, ev, zeny, minLvl, maxLvl); return SCRIPT_CMD_SUCCESS; @@ -12948,7 +12948,7 @@ BUILDIN_FUNC(delwaitingroom) nd = npc_name2id(script_getstr(st, 2)); else nd = (struct npc_data *)map_id2bl(st->oid); - if( nd != NULL ) + if( nd != nullptr ) chat_deletenpcchat(nd); return SCRIPT_CMD_SUCCESS; } @@ -12965,7 +12965,7 @@ BUILDIN_FUNC(waitingroomkick) nd = npc_name2id(script_getstr(st,2)); kickusername = script_getstr(st,3); - if( nd != NULL && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != NULL ) + if( nd != nullptr && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != nullptr ) chat_npckickchat(cd, kickusername); return SCRIPT_CMD_SUCCESS; } @@ -12986,12 +12986,12 @@ BUILDIN_FUNC(getwaitingroomusers) else nd = (struct npc_data *)map_id2bl(st->oid); - if( nd != NULL && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != NULL ) { + if( nd != nullptr && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != nullptr ) { for(i = 0; i < cd->users; ++i) { - setd_sub_num( st, NULL, ".@waitingroom_users", j, cd->usersd[i]->status.account_id, NULL ); + setd_sub_num( st, nullptr, ".@waitingroom_users", j, cd->usersd[i]->status.account_id, nullptr ); j++; } - setd_sub_num( st, NULL, ".@waitingroom_usercount", 0, j, NULL ); + setd_sub_num( st, nullptr, ".@waitingroom_usercount", 0, j, nullptr ); } return SCRIPT_CMD_SUCCESS; } @@ -13010,7 +13010,7 @@ BUILDIN_FUNC(waitingroomkickall) else nd = (struct npc_data *)map_id2bl(st->oid); - if( nd != NULL && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != NULL ) + if( nd != nullptr && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != nullptr ) chat_npckickall(cd); return SCRIPT_CMD_SUCCESS; } @@ -13029,7 +13029,7 @@ BUILDIN_FUNC(enablewaitingroomevent) else nd = (struct npc_data *)map_id2bl(st->oid); - if( nd != NULL && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != NULL ) + if( nd != nullptr && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != nullptr ) chat_enableevent(cd); return SCRIPT_CMD_SUCCESS; } @@ -13048,7 +13048,7 @@ BUILDIN_FUNC(disablewaitingroomevent) else nd = (struct npc_data *)map_id2bl(st->oid); - if( nd != NULL && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != NULL ) + if( nd != nullptr && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != nullptr ) chat_disableevent(cd); return SCRIPT_CMD_SUCCESS; } @@ -13079,7 +13079,7 @@ BUILDIN_FUNC(getwaitingroomstate) else nd = (struct npc_data *)map_id2bl(st->oid); - if( nd == NULL || (cd=(struct chat_data *)map_id2bl(nd->chat_id)) == NULL ) + if( nd == nullptr || (cd=(struct chat_data *)map_id2bl(nd->chat_id)) == nullptr ) { script_pushint(st, -1); return SCRIPT_CMD_SUCCESS; @@ -13124,7 +13124,7 @@ BUILDIN_FUNC(warpwaitingpc) struct chat_data* cd; nd = (struct npc_data *)map_id2bl(st->oid); - if( nd == NULL || (cd=(struct chat_data *)map_id2bl(nd->chat_id)) == NULL ) + if( nd == nullptr || (cd=(struct chat_data *)map_id2bl(nd->chat_id)) == nullptr ) return SCRIPT_CMD_SUCCESS; map_name = script_getstr(st,2); @@ -13281,7 +13281,7 @@ BUILDIN_FUNC(addrid) st,forceflag);//4-x0 , 5-y0 , 6-x1, 7-y1 break; case 5: - if (script_getstr(st, 4) == NULL) { + if (script_getstr(st, 4) == nullptr) { script_pushint(st, 0); mapit_free(iter); return SCRIPT_CMD_FAILURE; @@ -13319,7 +13319,7 @@ BUILDIN_FUNC(addrid) break; default: mapit_free(iter); - if((map_id2sd(type)) == NULL) { // Player not found. + if((map_id2sd(type)) == nullptr) { // Player not found. script_pushint(st,0); return SCRIPT_CMD_SUCCESS; } @@ -13350,7 +13350,7 @@ BUILDIN_FUNC(attachrid) map_session_data* sd = map_id2sd(rid); - if( sd != NULL && ( !sd->npc_id || force ) ){ + if( sd != nullptr && ( !sd->npc_id || force ) ){ script_detach_rid(st); st->rid = rid; @@ -13378,8 +13378,8 @@ BUILDIN_FUNC(isloggedin) TBL_PC* sd = map_id2sd(script_getnum(st,2)); if (script_hasdata(st,3) && sd && sd->status.char_id != script_getnum(st,3)) - sd = NULL; - push_val(st->stack,C_INT,sd!=NULL); + sd = nullptr; + push_val(st->stack,C_INT,sd!=nullptr); return SCRIPT_CMD_SUCCESS; } @@ -13650,7 +13650,7 @@ BUILDIN_FUNC(gvgoff3) */ BUILDIN_FUNC(emotion) { - struct block_list *bl = NULL; + struct block_list *bl = nullptr; int type = script_getnum(st,2); if (type < ET_SURPRISE || type >= ET_MAX) { @@ -13833,7 +13833,7 @@ BUILDIN_FUNC(flagemblem) return SCRIPT_CMD_SUCCESS; nd = (TBL_NPC*)map_id2nd(st->oid); - if( nd == NULL ) { + if( nd == nullptr ) { ShowError("script:flagemblem: npc %d not found\n", st->oid); } else if( nd->subtype != NPCTYPE_SCRIPT ) { ShowError("script:flagemblem: unexpected subtype %d for npc %d '%s'\n", nd->subtype, st->oid, nd->exname); @@ -13852,7 +13852,7 @@ BUILDIN_FUNC(flagemblem) BUILDIN_FUNC(getcastlename) { - const char* mapname = mapindex_getmapname(script_getstr(st,2),NULL); + const char* mapname = mapindex_getmapname(script_getstr(st,2),nullptr); std::shared_ptr gc = castle_db.mapname2gc(mapname); const char* name = (gc) ? gc->castle_name : ""; script_pushstrcopy(st,name); @@ -13861,11 +13861,11 @@ BUILDIN_FUNC(getcastlename) BUILDIN_FUNC(getcastledata) { - const char *mapname = mapindex_getmapname(script_getstr(st,2),NULL); + const char *mapname = mapindex_getmapname(script_getstr(st,2),nullptr); int index = script_getnum(st,3); std::shared_ptr gc = castle_db.mapname2gc(mapname); - if (gc == NULL) { + if (gc == nullptr) { script_pushint(st,0); ShowWarning("buildin_getcastledata: guild castle for map '%s' not found\n", mapname); return SCRIPT_CMD_FAILURE; @@ -13904,12 +13904,12 @@ BUILDIN_FUNC(getcastledata) BUILDIN_FUNC(setcastledata) { - const char *mapname = mapindex_getmapname(script_getstr(st,2),NULL); + const char *mapname = mapindex_getmapname(script_getstr(st,2),nullptr); int index = script_getnum(st,3); int value = script_getnum(st,4); std::shared_ptr gc = castle_db.mapname2gc(mapname); - if (gc == NULL) { + if (gc == nullptr) { ShowWarning("buildin_setcastledata: guild castle for map '%s' not found\n", mapname); return SCRIPT_CMD_FAILURE; } @@ -13928,7 +13928,7 @@ BUILDIN_FUNC(setcastledata) BUILDIN_FUNC(requestguildinfo) { int guild_id=script_getnum(st,2); - const char *event=NULL; + const char *event=nullptr; if( script_hasdata(st,3) ){ event=script_getstr(st,3); @@ -14144,7 +14144,7 @@ BUILDIN_FUNC(mapwarp) // Added by RoVeRT { int x,y,m,check_val=0,check_ID=0,i=0; std::shared_ptr g; - struct party_data *p = NULL; + struct party_data *p = nullptr; const char *str; const char *mapname; unsigned int index; @@ -14209,7 +14209,7 @@ BUILDIN_FUNC(mobcount) // Added by RoVeRT event=script_getstr(st,3); if( strcmp(event, "all") == 0 ) - event = NULL; + event = nullptr; else check_event(st, event); @@ -14280,7 +14280,7 @@ BUILDIN_FUNC(ispartneron) TBL_PC *sd; if (!script_charid2sd(2,sd) || !pc_ismarried(sd) || - map_charid2sd(sd->status.partner_id) == NULL) + map_charid2sd(sd->status.partner_id) == nullptr) { script_pushint(st,0); return SCRIPT_CMD_FAILURE; @@ -14363,7 +14363,7 @@ BUILDIN_FUNC(warppartner) TBL_PC *p_sd; if(!script_rid2sd(sd) || !pc_ismarried(sd) || - (p_sd=map_charid2sd(sd->status.partner_id)) == NULL) { + (p_sd=map_charid2sd(sd->status.partner_id)) == nullptr) { script_pushint(st,0); return SCRIPT_CMD_SUCCESS; } @@ -14506,14 +14506,14 @@ BUILDIN_FUNC(checkwall) /// BUILDIN_FUNC(guardianinfo) { - const char* mapname = mapindex_getmapname(script_getstr(st,2),NULL); + const char* mapname = mapindex_getmapname(script_getstr(st,2),nullptr); int id = script_getnum(st,3); int type = script_getnum(st,4); std::shared_ptr gc = castle_db.mapname2gc(mapname); struct mob_data* gd; - if( gc == NULL || id < 0 || id >= MAX_GUARDIANS ) + if( gc == nullptr || id < 0 || id >= MAX_GUARDIANS ) { script_pushint(st,-1); return SCRIPT_CMD_SUCCESS; @@ -14525,7 +14525,7 @@ BUILDIN_FUNC(guardianinfo) if( !gc->guardian[id].visible ) script_pushint(st,-1); else - if( (gd = map_id2md(gc->guardian[id].id)) == NULL ) + if( (gd = map_id2md(gc->guardian[id].id)) == nullptr ) script_pushint(st,-1); else { @@ -14783,7 +14783,7 @@ BUILDIN_FUNC(petskillbonus) struct pet_data *pd; TBL_PC *sd; - if(!script_rid2sd(sd) || sd->pd == NULL) + if(!script_rid2sd(sd) || sd->pd == nullptr) return SCRIPT_CMD_FAILURE; pd = sd->pd; @@ -14819,7 +14819,7 @@ BUILDIN_FUNC(petloot) struct pet_data *pd; TBL_PC *sd; - if(!script_rid2sd(sd) || sd->pd==NULL) + if(!script_rid2sd(sd) || sd->pd==nullptr) return SCRIPT_CMD_SUCCESS; max=script_getnum(st,2); @@ -14830,7 +14830,7 @@ BUILDIN_FUNC(petloot) max = MAX_PETLOOT_SIZE; pd = sd->pd; - if (pd->loot != NULL) + if (pd->loot != nullptr) { //Release whatever was there already and reallocate memory pet_lootitem_drop(pd, pd->master); aFree(pd->loot->item); @@ -14989,7 +14989,7 @@ BUILDIN_FUNC(undisguise) BUILDIN_FUNC(classchange) { int _class, type = 1; - struct npc_data* nd = NULL; + struct npc_data* nd = nullptr; TBL_PC *sd = map_id2sd(st->rid); send_target target = AREA; @@ -15000,7 +15000,7 @@ BUILDIN_FUNC(classchange) else nd = (struct npc_data *)map_id2bl(st->oid); - if (nd == NULL) + if (nd == nullptr) return SCRIPT_CMD_FAILURE; if (script_hasdata(st, 4)) { @@ -15012,7 +15012,7 @@ BUILDIN_FUNC(classchange) } if (target != SELF) clif_class_change(&nd->bl,_class,type); - else if (sd == NULL) + else if (sd == nullptr) return SCRIPT_CMD_FAILURE; else clif_class_change_target(&nd->bl,_class,type,target,sd); @@ -15186,7 +15186,7 @@ BUILDIN_FUNC(petrecovery) TBL_PC *sd; int sc; - if(!script_rid2sd(sd) || sd->pd == NULL) + if(!script_rid2sd(sd) || sd->pd == nullptr) return SCRIPT_CMD_FAILURE; sc = script_getnum(st,2); @@ -15221,7 +15221,7 @@ BUILDIN_FUNC(petskillattack) TBL_PC *sd; int id = 0; - if(!script_rid2sd(sd) || sd->pd == NULL) + if(!script_rid2sd(sd) || sd->pd == nullptr) return SCRIPT_CMD_FAILURE; id = (script_isstring(st, 2) ? skill_name2id(script_getstr(st,2)) : skill_get_index(script_getnum(st,2))); @@ -15231,7 +15231,7 @@ BUILDIN_FUNC(petskillattack) } pd = sd->pd; - if (pd->a_skill == NULL) + if (pd->a_skill == nullptr) pd->a_skill = (struct pet_skill_attack *)aMalloc(sizeof(struct pet_skill_attack)); pd->a_skill->id = id; @@ -15254,7 +15254,7 @@ BUILDIN_FUNC(petskillattack2) TBL_PC *sd; int id = 0; - if(!script_rid2sd(sd) || sd->pd == NULL) + if(!script_rid2sd(sd) || sd->pd == nullptr) return SCRIPT_CMD_FAILURE; id = (script_isstring(st, 2) ? skill_name2id(script_getstr(st,2)) : skill_get_index(script_getnum(st,2))); @@ -15264,7 +15264,7 @@ BUILDIN_FUNC(petskillattack2) } pd = sd->pd; - if (pd->a_skill == NULL) + if (pd->a_skill == nullptr) pd->a_skill = (struct pet_skill_attack *)aMalloc(sizeof(struct pet_skill_attack)); pd->a_skill->id = id; @@ -15287,7 +15287,7 @@ BUILDIN_FUNC(petskillsupport) TBL_PC *sd; int id = 0; - if(!script_rid2sd(sd) || sd->pd == NULL) + if(!script_rid2sd(sd) || sd->pd == nullptr) return SCRIPT_CMD_FAILURE; id = (script_isstring(st, 2) ? skill_name2id(script_getstr(st,2)) : skill_get_index(script_getnum(st,2))); @@ -15413,7 +15413,7 @@ BUILDIN_FUNC(specialeffect) int type = script_getnum(st,2); enum send_target target = script_hasdata(st,3) ? (send_target)script_getnum(st,3) : AREA; - if(bl==NULL) + if(bl==nullptr) return SCRIPT_CMD_SUCCESS; if( type <= EF_NONE || type >= EF_MAX ){ @@ -15685,7 +15685,7 @@ BUILDIN_FUNC(recovery) else if(script_rid2sd(sd)) p_id = sd->status.party_id; p = party_search(p_id); - if(p == NULL) + if(p == nullptr) return SCRIPT_CMD_SUCCESS; for (i = 0; i < MAX_PARTY; i++) { map_session_data* pl_sd; @@ -15712,7 +15712,7 @@ BUILDIN_FUNC(recovery) else if(script_rid2sd(sd)) g_id = sd->status.guild_id; auto g = guild_search(g_id); - if(g == NULL) + if(g == nullptr) return SCRIPT_CMD_SUCCESS; for (i = 0; i < MAX_GUILD; i++) { map_session_data* pl_sd; @@ -15866,7 +15866,7 @@ BUILDIN_FUNC(getmercinfo) type = script_getnum(st,2); md = sd->md; - if( md == NULL ){ + if( md == nullptr ){ if( type == 2 ) script_pushconststr(st,""); else @@ -15947,7 +15947,7 @@ BUILDIN_FUNC(jump_zero) *------------------------------------------*/ BUILDIN_FUNC(movenpc) { - TBL_NPC *nd = NULL; + TBL_NPC *nd = nullptr; const char *npc; int x,y; @@ -15955,7 +15955,7 @@ BUILDIN_FUNC(movenpc) x = script_getnum(st,3); y = script_getnum(st,4); - if ((nd = npc_name2id(npc)) == NULL){ + if ((nd = npc_name2id(npc)) == nullptr){ ShowError("script: movenpc: NPC with ID '%s' was not found!\n", npc ); return -1; } @@ -15972,12 +15972,12 @@ BUILDIN_FUNC(movenpc) BUILDIN_FUNC(message) { const char *msg,*player; - TBL_PC *pl_sd = NULL; + TBL_PC *pl_sd = nullptr; player = script_getstr(st,2); msg = script_getstr(st,3); - if((pl_sd=map_nick2sd((char *) player,false)) == NULL) + if((pl_sd=map_nick2sd((char *) player,false)) == nullptr) return SCRIPT_CMD_SUCCESS; clif_displaymessage(pl_sd->fd, msg); @@ -15994,7 +15994,7 @@ BUILDIN_FUNC(message) */ BUILDIN_FUNC(npctalk) { - struct npc_data* nd = NULL; + struct npc_data* nd = nullptr; const char* str = script_getstr(st,2); int color = 0xFFFFFF; @@ -16006,7 +16006,7 @@ BUILDIN_FUNC(npctalk) if (script_hasdata(st, 5)) color = script_getnum(st, 5); - if (nd != NULL) { + if (nd != nullptr) { send_target target = AREA; char message[CHAT_SIZE_MAX]; @@ -16024,7 +16024,7 @@ BUILDIN_FUNC(npctalk) clif_messagecolor(&nd->bl, color, message, true, target); else { TBL_PC *sd = map_id2sd(st->rid); - if (sd == NULL) + if (sd == nullptr) return SCRIPT_CMD_FAILURE; clif_messagecolor_target(&nd->bl, color, message, true, target, sd); } @@ -16039,7 +16039,7 @@ BUILDIN_FUNC(npctalk) */ BUILDIN_FUNC(chatmes) { - struct npc_data* nd = NULL; + struct npc_data* nd = nullptr; const char* str = script_getstr(st,2); if (script_hasdata(st, 3)) @@ -16047,7 +16047,7 @@ BUILDIN_FUNC(chatmes) else nd = (struct npc_data *)map_id2bl(st->oid); - if (nd != NULL && nd->chat_id) { + if (nd != nullptr && nd->chat_id) { char message[256]; safesnprintf(message, sizeof(message), "%s", str); clif_GlobalMessage(map_id2bl(nd->chat_id), message, CHAT_WOS); @@ -16181,8 +16181,8 @@ BUILDIN_FUNC(getsavepoint) */ BUILDIN_FUNC(getmapxy) { - struct block_list *bl = NULL; - TBL_PC *sd=NULL; + struct block_list *bl = nullptr; + TBL_PC *sd=nullptr; int64 num; const char *name; @@ -16291,7 +16291,7 @@ BUILDIN_FUNC(getmapxy) return SCRIPT_CMD_FAILURE; } }else - sd=NULL; + sd=nullptr; set_reg_str( st, sd, num, name, mapname, script_getref( st, 2 ) ); //Set MapX @@ -16305,7 +16305,7 @@ BUILDIN_FUNC(getmapxy) return SCRIPT_CMD_FAILURE; } }else - sd=NULL; + sd=nullptr; set_reg_num( st, sd, num, name, x, script_getref( st, 3 ) ); //Set MapY @@ -16319,7 +16319,7 @@ BUILDIN_FUNC(getmapxy) return SCRIPT_CMD_FAILURE; } }else - sd=NULL; + sd=nullptr; set_reg_num( st, sd, num, name, y, script_getref( st, 4 ) ); //Return Success value @@ -16400,7 +16400,7 @@ BUILDIN_FUNC(summon) md->deletetimer = add_timer(tick+(timeout>0?timeout:60000),mob_timer_delete,md->bl.id,0); mob_spawn (md); //Now it is ready for spawning. clif_specialeffect(&md->bl,EF_ENTRY2,AREA); - sc_start4(NULL,&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000); + sc_start4(nullptr,&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000); } script_pushint(st, md->bl.id); @@ -16982,7 +16982,7 @@ BUILDIN_FUNC(explode) int start; char *temp; const char* name; - TBL_PC* sd = NULL; + TBL_PC* sd = nullptr; temp = (char*)aMalloc(len + 1); @@ -17125,8 +17125,8 @@ BUILDIN_FUNC(sprintf) const char* format; char* p; char* q; - char* buf = NULL; - char* buf2 = NULL; + char* buf = nullptr; + char* buf2 = nullptr; struct script_data* data; StringBuf final_buf; @@ -17157,7 +17157,7 @@ BUILDIN_FUNC(sprintf) // Issue sprintf for each parameter StringBuf_Init(&final_buf); q = buf; - while((p = strchr(q, '%')) != NULL) { + while((p = strchr(q, '%')) != nullptr) { if(p != q) { len = p - q + 1; @@ -17195,7 +17195,7 @@ BUILDIN_FUNC(sprintf) return SCRIPT_CMD_FAILURE; } - if((p = strchr(q+1, '%')) == NULL) + if((p = strchr(q+1, '%')) == nullptr) p = strchr(q, 0); // EOS len = p - q + 1; @@ -17264,14 +17264,14 @@ BUILDIN_FUNC(sprintf) BUILDIN_FUNC(sscanf){ unsigned int argc, arg = 0, len; struct script_data* data; - map_session_data* sd = NULL; + map_session_data* sd = nullptr; const char* str; const char* format; const char* p; const char* q; - char* buf = NULL; + char* buf = nullptr; char* buf_p; - char* ref_str = NULL; + char* ref_str = nullptr; int ref_int; // Get data @@ -17313,7 +17313,7 @@ BUILDIN_FUNC(sscanf){ if(ref_str) aFree(ref_str); return SCRIPT_CMD_FAILURE; } - if((p = strchr(q+1, '%'))==NULL){ + if((p = strchr(q+1, '%'))==nullptr){ p = strchr(q, 0); // EOS } len = p-q; @@ -17339,7 +17339,7 @@ BUILDIN_FUNC(sscanf){ // Save value if any if(buf_p[strlen(buf_p)-1]=='$'){ // String - if(ref_str==NULL){ + if(ref_str==nullptr){ CREATE(ref_str, char, strlen(str)+1); } if(sscanf(str, buf, ref_str)==0){ @@ -17563,7 +17563,7 @@ BUILDIN_FUNC(countstr) BUILDIN_FUNC(setnpcdisplay) { const char* name; - const char* newname = NULL; + const char* newname = nullptr; int class_ = JT_FAKENPC, size = -1; struct npc_data* nd; @@ -17580,7 +17580,7 @@ BUILDIN_FUNC(setnpcdisplay) class_ = script_getnum(st, 3); nd = npc_name2id(name); - if( nd == NULL ) + if( nd == nullptr ) {// not found script_pushint(st,1); return SCRIPT_CMD_SUCCESS; @@ -17615,7 +17615,7 @@ BUILDIN_FUNC(atoi) BUILDIN_FUNC(axtoi) { const char *hex = script_getstr(st,2); - long value = strtol(hex, NULL, 16); + long value = strtol(hex, nullptr, 16); #if LONG_MAX > INT_MAX || LONG_MIN < INT_MIN value = cap_value(value, INT_MIN, INT_MAX); #endif @@ -17627,7 +17627,7 @@ BUILDIN_FUNC(strtol) { const char *string = script_getstr(st, 2); int base = script_getnum(st, 3); - long value = strtol(string, NULL, base); + long value = strtol(string, nullptr, base); #if LONG_MAX > INT_MAX || LONG_MIN < INT_MIN value = cap_value(value, INT_MIN, INT_MAX); #endif @@ -17642,7 +17642,7 @@ BUILDIN_FUNC(compare) const char *cmpstring; message = script_getstr(st,2); cmpstring = script_getstr(st,3); - script_pushint(st,(stristr(message,cmpstring) != NULL)); + script_pushint(st,(stristr(message,cmpstring) != nullptr)); return SCRIPT_CMD_SUCCESS; } @@ -17709,7 +17709,7 @@ BUILDIN_FUNC(md5) **/ BUILDIN_FUNC(setd) { - TBL_PC *sd = NULL; + TBL_PC *sd = nullptr; char varname[100]; const char *buffer; int elem; @@ -17724,9 +17724,9 @@ BUILDIN_FUNC(setd) } if( is_string_variable(varname) ) { - setd_sub_str( st, sd, varname, elem, script_getstr( st, 3 ), NULL ); + setd_sub_str( st, sd, varname, elem, script_getstr( st, 3 ), nullptr ); } else { - setd_sub_num( st, sd, varname, elem, script_getnum64( st, 3 ), NULL ); + setd_sub_num( st, sd, varname, elem, script_getnum64( st, 3 ), nullptr ); } return SCRIPT_CMD_SUCCESS; @@ -17735,7 +17735,7 @@ BUILDIN_FUNC(setd) int buildin_query_sql_sub(struct script_state* st, Sql* handle) { int i, j; - TBL_PC* sd = NULL; + TBL_PC* sd = nullptr; const char* query; struct script_data* data; const char* name; @@ -17748,7 +17748,7 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle) data = script_getdata(st, i); if( data_isreference(data) ) { // it's a variable name = reference_getname(data); - if( not_server_variable(*name) && sd == NULL ) { // requires a player + if( not_server_variable(*name) && sd == nullptr ) { // requires a player if( !script_rid2sd(sd) ) { // no player attached script_reportdata(data); st->state = END; @@ -17792,10 +17792,10 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle) // Store data for( i = 0; i < max_rows && SQL_SUCCESS == Sql_NextRow(handle); ++i ) { for( j = 0; j < num_vars; ++j ) { - char* str = NULL; + char* str = nullptr; if( j < num_cols ) - Sql_GetData(handle, j, &str, NULL); + Sql_GetData(handle, j, &str, nullptr); data = script_getdata(st, j+3); name = reference_getname(data); @@ -17822,7 +17822,7 @@ BUILDIN_FUNC(query_sql) { } BUILDIN_FUNC(query_logsql) { - if( !log_config.sql_logs ) {// logmysql_handle == NULL + if( !log_config.sql_logs ) {// logmysql_handle == nullptr ShowWarning("buildin_query_logsql: SQL logs are disabled, query '%s' will not be executed.\n", script_getstr(st,2)); script_pushint(st,-1); return SCRIPT_CMD_FAILURE; @@ -17865,7 +17865,7 @@ BUILDIN_FUNC(getd) BUILDIN_FUNC(callshop) { - TBL_PC *sd = NULL; + TBL_PC *sd = nullptr; struct npc_data *nd; const char *shopname; int flag = 0; @@ -18142,7 +18142,7 @@ BUILDIN_FUNC(npcshopattach) if (flag) nd->master_nd = ((struct npc_data *)map_id2bl(st->oid)); else - nd->master_nd = NULL; + nd->master_nd = nullptr; script_pushint(st,1); return SCRIPT_CMD_SUCCESS; @@ -18170,7 +18170,7 @@ BUILDIN_FUNC(setitemscript) std::shared_ptr i_data = item_db.find(item_id); - if (!i_data || script==NULL || ( script[0] && script[0]!='{' )) { + if (!i_data || script==nullptr || ( script[0] && script[0]!='{' )) { script_pushint(st,0); return SCRIPT_CMD_SUCCESS; } @@ -18188,7 +18188,7 @@ BUILDIN_FUNC(setitemscript) if(*dstscript) script_free_code(*dstscript); - *dstscript = script[0] ? parse_script(script, "script_setitemscript", 0, 0) : NULL; + *dstscript = script[0] ? parse_script(script, "script_setitemscript", 0, 0) : nullptr; script_pushint(st,1); return SCRIPT_CMD_SUCCESS; } @@ -18448,7 +18448,7 @@ BUILDIN_FUNC(getmonsterinfo) * @author [Nab4] */ BUILDIN_FUNC(checkvending) { - TBL_PC *sd = NULL; + TBL_PC *sd = nullptr; if (!script_nick2sd(2,sd) ) { script_pushint(st,0); @@ -18471,7 +18471,7 @@ BUILDIN_FUNC(checkvending) { BUILDIN_FUNC(checkchatting) // check chatting [Marka] { - TBL_PC *sd = NULL; + TBL_PC *sd = nullptr; if( script_nick2sd(2,sd) ) script_pushint(st,(sd->chatID != 0)); @@ -18482,7 +18482,7 @@ BUILDIN_FUNC(checkchatting) // check chatting [Marka] BUILDIN_FUNC(checkidle) { - TBL_PC *sd = NULL; + TBL_PC *sd = nullptr; if( script_nick2sd(2,sd) ) script_pushint(st, DIFF_TICK(last_tick, sd->idletime)); @@ -18493,7 +18493,7 @@ BUILDIN_FUNC(checkidle) BUILDIN_FUNC(checkidlehom) { - TBL_PC *sd = NULL; + TBL_PC *sd = nullptr; if( script_nick2sd(2,sd) ) script_pushint(st, DIFF_TICK(last_tick, sd->idletime_hom)); @@ -18563,7 +18563,7 @@ BUILDIN_FUNC(searchitem) // [zBuffer] List of player cont commands ---> BUILDIN_FUNC(rid2name) { - struct block_list *bl = NULL; + struct block_list *bl = nullptr; int rid = script_getnum(st,2); if((bl = map_id2bl(rid))) { @@ -18592,7 +18592,7 @@ BUILDIN_FUNC(rid2name) */ BUILDIN_FUNC(pcblockmove) { - struct block_list *bl = NULL; + struct block_list *bl = nullptr; if (script_getnum(st, 2)) bl = map_id2bl(script_getnum(st,2)); @@ -18615,7 +18615,7 @@ BUILDIN_FUNC(pcblockmove) */ BUILDIN_FUNC(pcblockskill) { - struct block_list *bl = NULL; + struct block_list *bl = nullptr; if (script_getnum(st, 2)) bl = map_id2bl(script_getnum(st,2)); @@ -18735,14 +18735,14 @@ BUILDIN_FUNC(getunittype) /// getunitdata ,; BUILDIN_FUNC(getunitdata) { - TBL_PC *sd = st->rid ? map_id2sd(st->rid) : NULL; + TBL_PC *sd = st->rid ? map_id2sd(st->rid) : nullptr; struct block_list* bl; - TBL_MOB* md = NULL; - TBL_HOM* hd = NULL; - TBL_MER* mc = NULL; - TBL_PET* pd = NULL; - TBL_ELEM* ed = NULL; - TBL_NPC* nd = NULL; + TBL_MOB* md = nullptr; + TBL_HOM* hd = nullptr; + TBL_MER* mc = nullptr; + TBL_PET* pd = nullptr; + TBL_ELEM* ed = nullptr; + TBL_NPC* nd = nullptr; char* name; struct script_data *data = script_getdata(st, 3); @@ -19130,7 +19130,7 @@ BUILDIN_FUNC(setunitdata) } int type = script_getnum(st, 3), value = 0; - const char *mapname = NULL; + const char *mapname = nullptr; bool calc_status = false; if ((type == UMOB_MAPID || type == UHOM_MAPID || type == UPET_MAPID || type == UMER_MAPID || type == UELE_MAPID || type == UNPC_MAPID) && script_isstring(st, 4)) @@ -19200,7 +19200,7 @@ BUILDIN_FUNC(setunitdata) case UMOB_LUK: md->base_status->luk = (unsigned short)value; status_calc_misc(bl, &md->status, md->level); calc_status = true; break; case UMOB_SLAVECPYMSTRMD: if (value > 0) { - TBL_MOB *md2 = NULL; + TBL_MOB *md2 = nullptr; if (!md->master_id || !(md2 = map_id2md(md->master_id))) { ShowWarning("buildin_setunitdata: Trying to set UMOB_SLAVECPYMSTRMD on mob without master!\n"); break; @@ -19594,7 +19594,7 @@ BUILDIN_FUNC(setunitdata) /// getunitname ; BUILDIN_FUNC(getunitname) { - struct block_list* bl = NULL; + struct block_list* bl = nullptr; if(!script_rid2bl(2,bl)){ script_pushconststr(st, "Unknown"); @@ -19613,10 +19613,10 @@ BUILDIN_FUNC(getunitname) /// setunitname ,; BUILDIN_FUNC(setunitname) { - struct block_list* bl = NULL; - TBL_MOB* md = NULL; - TBL_HOM* hd = NULL; - TBL_PET* pd = NULL; + struct block_list* bl = nullptr; + TBL_MOB* md = nullptr; + TBL_HOM* hd = nullptr; + TBL_PET* pd = nullptr; if(!script_rid2bl(2,bl)) { @@ -19723,7 +19723,7 @@ BUILDIN_FUNC(getunittitle) BUILDIN_FUNC(unitwalk) { struct block_list* bl; - struct unit_data *ud = NULL; + struct unit_data *ud = nullptr; const char *cmd = script_getfuncname(st), *done_label = ""; uint8 off = 5; @@ -19765,7 +19765,7 @@ BUILDIN_FUNC(unitwalk) ShowError("buildin_unitwalk: Bad target destination.\n"); script_pushint(st, 0); return SCRIPT_CMD_FAILURE; - } else if (script_pushint(st, unit_can_reach_bl(bl, tbl, distance_bl(bl, tbl)+1, 0, NULL, NULL))) { + } else if (script_pushint(st, unit_can_reach_bl(bl, tbl, distance_bl(bl, tbl)+1, 0, nullptr, nullptr))) { if (ud != nullptr) ud->state.force_walk = true; add_timer(gettick()+50, unit_delay_walktobl_timer, bl->id, tbl->id); // Need timer to avoid mismatches @@ -19822,7 +19822,7 @@ BUILDIN_FUNC(unitwarp) else map_idx = map_mapname2mapid(mapname); - if (map_idx >= 0 && bl != NULL) + if (map_idx >= 0 && bl != nullptr) script_pushint(st, unit_warp(bl,map_idx,x,y,CLR_OUTSIGHT)); else script_pushint(st, 0); @@ -19840,7 +19840,7 @@ BUILDIN_FUNC(unitwarp) BUILDIN_FUNC(unitattack) { struct block_list* unit_bl; - struct block_list* target_bl = NULL; + struct block_list* target_bl = nullptr; int actiontype = 0; if (!script_rid2bl(2,unit_bl)) { @@ -19850,7 +19850,7 @@ BUILDIN_FUNC(unitattack) if (script_isstring(st, 3)) { TBL_PC* sd = map_nick2sd(script_getstr(st, 3),false); - if( sd != NULL ) + if( sd != nullptr ) target_bl = &sd->bl; } else target_bl = map_id2bl(script_getnum(st, 3)); @@ -19954,7 +19954,7 @@ BUILDIN_FUNC(unittalk) if (script_hasdata(st, 4)) { if (script_getnum(st, 4) == BC_SELF) { - if (map_id2sd(bl->id) == NULL) { + if (map_id2sd(bl->id) == nullptr) { ShowWarning("script: unittalk: bc_self can't be used for non-players objects.\n"); return SCRIPT_CMD_FAILURE; } @@ -20132,7 +20132,7 @@ BUILDIN_FUNC(sleep2) return SCRIPT_CMD_FAILURE; } - if (map_id2bl(st->rid) == NULL) { + if (map_id2bl(st->rid) == nullptr) { ShowError( "buildin_sleep2: no unit is attached\n" ); return SCRIPT_CMD_FAILURE; } @@ -20144,7 +20144,7 @@ BUILDIN_FUNC(sleep2) } else { // Check if the unit is still attached // NOTE: This should never happen, since run_script_timer already checks this - if (map_id2bl(st->rid) == NULL) { + if (map_id2bl(st->rid) == nullptr) { // The unit is not attached anymore - terminate the script st->rid = 0; st->state = END; @@ -20167,7 +20167,7 @@ BUILDIN_FUNC(awake) struct script_state *tst; struct npc_data* nd; - if ((nd = npc_name2id(script_getstr(st, 2))) == NULL) { + if ((nd = npc_name2id(script_getstr(st, 2))) == nullptr) { ShowError("buildin_awake: NPC \"%s\" not found\n", script_getstr(st, 2)); return SCRIPT_CMD_FAILURE; } @@ -20235,7 +20235,7 @@ BUILDIN_FUNC(getvariableofnpc) } nd = npc_name2id(script_getstr(st,3)); - if( nd == NULL || nd->subtype != NPCTYPE_SCRIPT || nd->u.scr.script == NULL ) + if( nd == nullptr || nd->subtype != NPCTYPE_SCRIPT || nd->u.scr.script == nullptr ) {// NPC not found or has no script ShowError("buildin_getvariableofnpc: can't find npc %s\n", script_getstr(st,3)); script_pushnil(st); @@ -20267,7 +20267,7 @@ BUILDIN_FUNC(warpportal) struct block_list* bl; bl = map_id2bl(st->oid); - if( bl == NULL ) { + if( bl == nullptr ) { ShowError("buildin_warpportal: NPC is needed\n"); return SCRIPT_CMD_FAILURE; } @@ -20284,7 +20284,7 @@ BUILDIN_FUNC(warpportal) } group = skill_unitsetting(bl, AL_WARP, 4, spx, spy, 0); - if( group == NULL ) + if( group == nullptr ) return SCRIPT_CMD_FAILURE;// failed group->val1 = (group->val1<<16)|(short)0; group->val2 = (tpx<<16) | tpy; @@ -20504,7 +20504,7 @@ BUILDIN_FUNC(mercenary_heal) map_session_data *sd; int hp, sp; - if( !script_rid2sd(sd) || sd->md == NULL ) + if( !script_rid2sd(sd) || sd->md == nullptr ) return SCRIPT_CMD_SUCCESS; hp = script_getnum(st,2); sp = script_getnum(st,3); @@ -20519,14 +20519,14 @@ BUILDIN_FUNC(mercenary_sc_start) enum sc_type type; int tick, val1; - if( !script_rid2sd(sd) || sd->md == NULL ) + if( !script_rid2sd(sd) || sd->md == nullptr ) return SCRIPT_CMD_SUCCESS; type = (sc_type)script_getnum(st,2); tick = script_getnum(st,3); val1 = script_getnum(st,4); - status_change_start(NULL, &sd->md->bl, type, 10000, val1, 0, 0, 0, tick, SCSTART_NOTICKDEF); + status_change_start(nullptr, &sd->md->bl, type, 10000, val1, 0, 0, 0, tick, SCSTART_NOTICKDEF); return SCRIPT_CMD_SUCCESS; } @@ -20950,7 +20950,7 @@ BUILDIN_FUNC(waitingroom2bg) else nd = (struct npc_data *)map_id2bl(st->oid); - if( nd == NULL || (cd = (struct chat_data *)map_id2bl(nd->chat_id)) == NULL ) + if( nd == nullptr || (cd = (struct chat_data *)map_id2bl(nd->chat_id)) == nullptr ) { script_pushint(st,0); return SCRIPT_CMD_SUCCESS; @@ -20984,7 +20984,7 @@ BUILDIN_FUNC(waitingroom2bg) for (i = 0; i < cd->users; i++) { // Only add those who are in the chat room map_session_data *sd; - if( (sd = cd->usersd[i]) != NULL && bg_team_join(bg_id, sd, false) ){ + if( (sd = cd->usersd[i]) != nullptr && bg_team_join(bg_id, sd, false) ){ mapreg_setreg(reference_uid(add_str("$@arenamembers"), c), sd->bl.id); ++c; } @@ -21030,10 +21030,10 @@ BUILDIN_FUNC(waitingroom2bg_single) nd = npc_name2id(script_getstr(st,6)); - if( nd == NULL || (cd = (struct chat_data *)map_id2bl(nd->chat_id)) == NULL || cd->users <= 0 ) + if( nd == nullptr || (cd = (struct chat_data *)map_id2bl(nd->chat_id)) == nullptr || cd->users <= 0 ) return SCRIPT_CMD_SUCCESS; - if( (sd = cd->usersd[0]) == NULL ) + if( (sd = cd->usersd[0]) == nullptr ) return SCRIPT_CMD_SUCCESS; if( bg_team_join(bg_id, sd, false) && pc_setpos(sd, mapindex, x, y, CLR_TELEPORT) == SETPOS_OK) @@ -21180,7 +21180,7 @@ BUILDIN_FUNC(bg_monster_set_team) int id = script_getnum(st,2), bg_id = script_getnum(st,3); - if( id == 0 || (mbl = map_id2bl(id)) == NULL || mbl->type != BL_MOB ) + if( id == 0 || (mbl = map_id2bl(id)) == nullptr || mbl->type != BL_MOB ) return SCRIPT_CMD_SUCCESS; md = (TBL_MOB *)mbl; md->bg_id = bg_id; @@ -21195,7 +21195,7 @@ BUILDIN_FUNC(bg_monster_set_team) BUILDIN_FUNC(bg_leave) { - map_session_data *sd = NULL; + map_session_data *sd = nullptr; bool deserter = false; if( !script_charid2sd(2,sd) || !sd->bg_id ) @@ -21441,8 +21441,8 @@ BUILDIN_FUNC(instance_create) if (script_hasdata(st, 4)) owner_id = script_getnum(st, 4); else { - // If sd is NULL, instance_create will return -2. - map_session_data *sd = NULL; + // If sd is nullptr, instance_create will return -2. + map_session_data *sd = nullptr; switch(mode) { case IM_NONE: @@ -21508,7 +21508,7 @@ BUILDIN_FUNC(instance_destroy) *------------------------------------------*/ BUILDIN_FUNC(instance_enter) { - map_session_data *sd = NULL; + map_session_data *sd = nullptr; int x = script_hasdata(st,3) ? script_getnum(st, 3) : -1; int y = script_hasdata(st,4) ? script_getnum(st, 4) : -1; int instance_id; @@ -21544,7 +21544,7 @@ BUILDIN_FUNC(instance_npcname) else instance_id = script_instancegetid(st); - if( instance_id > 0 && (nd = npc_name2id(str)) != NULL ) { + if( instance_id > 0 && (nd = npc_name2id(str)) != nullptr ) { static char npcname[NAME_LENGTH]; snprintf(npcname, sizeof(npcname), "dup_%d_%d", instance_id, nd->bl.id); script_pushconststr(st,npcname); @@ -21709,7 +21709,7 @@ BUILDIN_FUNC(instance_announce) { int instance_id = script_getnum(st,2); const char *mes = script_getstr(st,3); int flag = script_getnum(st,4); - const char *fontColor = script_hasdata(st,5) ? script_getstr(st,5) : NULL; + const char *fontColor = script_hasdata(st,5) ? script_getstr(st,5) : nullptr; int fontType = script_hasdata(st,6) ? script_getnum(st,6) : FW_NORMAL; // default fontType int fontSize = script_hasdata(st,7) ? script_getnum(st,7) : 12; // default fontSize int fontAlign = script_hasdata(st,8) ? script_getnum(st,8) : 0; // default fontAlign @@ -21865,7 +21865,7 @@ BUILDIN_FUNC(instance_check_guild) BUILDIN_FUNC(instance_check_clan) { int amount, min, max, i, clan_id = 0, c = 0; - struct clan *cd = NULL; + struct clan *cd = nullptr; amount = script_hasdata(st,3) ? script_getnum(st,3) : 1; // Amount of needed Clan members for the Instance. min = script_hasdata(st,4) ? script_getnum(st,4) : 1; // Minimum Level needed to join the Instance. @@ -22234,7 +22234,7 @@ BUILDIN_FUNC(progressbar) sd->progressbar.timeout = gettick() + second*1000; sd->state.workinprogress = WIP_DISABLE_ALL; - clif_progressbar(sd, strtol(color, (char **)NULL, 0), second); + clif_progressbar(sd, strtol(color, (char **)nullptr, 0), second); return SCRIPT_CMD_SUCCESS; } @@ -22244,7 +22244,7 @@ BUILDIN_FUNC(progressbar) */ BUILDIN_FUNC(progressbar_npc){ map_session_data *sd = map_id2sd(st->rid); - struct npc_data* nd = NULL; + struct npc_data* nd = nullptr; if( script_hasdata(st, 4) ){ const char* name = script_getstr(st, 4); @@ -22281,7 +22281,7 @@ BUILDIN_FUNC(progressbar_npc){ st->state = RERUNLINE; st->sleep.tick = second * 1000; nd->progressbar.timeout = gettick() + second * 1000; - nd->progressbar.color = strtol(color, (char **)NULL, 0); + nd->progressbar.color = strtol(color, (char **)nullptr, 0); clif_progressbar_npc_area(nd); // Second call(by timer after sleeping time is over) @@ -22541,7 +22541,7 @@ BUILDIN_FUNC(setmounting) { if( sd->sc.getSCE(SC_ALL_RIDING) ) status_change_end(&sd->bl, SC_ALL_RIDING); //release mount else - sc_start(NULL, &sd->bl, SC_ALL_RIDING, 10000, 1, INFINITE_TICK); //mount + sc_start(nullptr, &sd->bl, SC_ALL_RIDING, 10000, 1, INFINITE_TICK); //mount script_pushint(st,1);//in both cases, return 1. } return SCRIPT_CMD_SUCCESS; @@ -22568,7 +22568,7 @@ BUILDIN_FUNC(getargcount) { **/ BUILDIN_FUNC(getcharip) { - map_session_data* sd = NULL; + map_session_data* sd = nullptr; /* check if a character name is specified */ if( script_hasdata(st, 2) ) @@ -22596,12 +22596,12 @@ BUILDIN_FUNC(getcharip) if (sd && sd->fd && session[sd->fd]) { /* initiliaze */ - const char *ip_addr = NULL; + const char *ip_addr = nullptr; uint32 ip; /* set ip, ip_addr and convert to ip and push str */ ip = session[sd->fd]->client_addr; - ip_addr = ip2str(ip, NULL); + ip_addr = ip2str(ip, nullptr); script_pushstrcopy(st, ip_addr); } return SCRIPT_CMD_SUCCESS; @@ -22724,10 +22724,10 @@ BUILDIN_FUNC(unbindatcmd) { if( i < atcmd_binding_count ) { int cursor = 0; aFree(atcmd_binding[i]); - atcmd_binding[i] = NULL; + atcmd_binding[i] = nullptr; /* compact the list now that we freed a slot somewhere */ for( i = 0, cursor = 0; i < atcmd_binding_count; i++ ) { - if( atcmd_binding[i] == NULL ) + if( atcmd_binding[i] == nullptr ) continue; if( cursor != i ) { @@ -22962,7 +22962,7 @@ BUILDIN_FUNC(npcskill) ShowError("npcskill: level exceeded maximum of %d.\n", MAX_LEVEL); return SCRIPT_CMD_FAILURE; } - if (nd == NULL) { //ain't possible, but I don't trust people. + if (nd == nullptr) { //ain't possible, but I don't trust people. return SCRIPT_CMD_FAILURE; } @@ -23105,7 +23105,7 @@ BUILDIN_FUNC(party_create) { char party_name[NAME_LENGTH]; int item1 = 0, item2 = 0; - TBL_PC *sd = NULL; + TBL_PC *sd = nullptr; if (!script_charid2sd(3, sd)) { script_pushint(st,-1); @@ -23198,7 +23198,7 @@ BUILDIN_FUNC(party_addmember) */ BUILDIN_FUNC(party_delmember) { - TBL_PC *sd = NULL; + TBL_PC *sd = nullptr; if( !script_hasdata(st,2) && !script_hasdata(st,3) && !script_rid2sd(sd) ) { script_pushint(st,-1); @@ -23207,7 +23207,7 @@ BUILDIN_FUNC(party_delmember) if( sd || script_charid2sd(2,sd) ) script_pushint(st,party_removemember2(sd,0,0)); else - script_pushint(st,party_removemember2(NULL,script_getnum(st,2),script_getnum(st,3))); + script_pushint(st,party_removemember2(nullptr,script_getnum(st,2),script_getnum(st,3))); return SCRIPT_CMD_SUCCESS; } @@ -23225,9 +23225,9 @@ BUILDIN_FUNC(party_delmember) BUILDIN_FUNC(party_changeleader) { int i, party_id = script_getnum(st,2); - TBL_PC *sd = NULL; - TBL_PC *tsd = NULL; - struct party_data *party = NULL; + TBL_PC *sd = nullptr; + TBL_PC *tsd = nullptr; + struct party_data *party = nullptr; if( !(party = party_search(party_id)) ) { script_pushint(st,-1); @@ -23335,7 +23335,7 @@ BUILDIN_FUNC(vip_status) { break; case VIP_STATUS_REMAINING: // Get remaining time. if (pc_isvip(sd)) { - script_pushint(st, sd->vip.time - time(NULL)); + script_pushint(st, sd->vip.time - time(nullptr)); } else script_pushint(st, 0); break; @@ -23446,13 +23446,13 @@ BUILDIN_FUNC(montransform) { if (!strcmp(script_getfuncname(st), "active_transform")) { status_change_end(&sd->bl, SC_ACTIVE_MONSTER_TRANSFORM); // Clear previous - sc_start2(NULL, &sd->bl, SC_ACTIVE_MONSTER_TRANSFORM, 100, mob_id, type, tick); + sc_start2(nullptr, &sd->bl, SC_ACTIVE_MONSTER_TRANSFORM, 100, mob_id, type, tick); } else { status_change_end(&sd->bl, SC_MONSTER_TRANSFORM); // Clear previous - sc_start2(NULL, &sd->bl, SC_MONSTER_TRANSFORM, 100, mob_id, type, tick); + sc_start2(nullptr, &sd->bl, SC_MONSTER_TRANSFORM, 100, mob_id, type, tick); } if (type != SC_NONE) - sc_start4(NULL, &sd->bl, type, 100, val1, val2, val3, val4, tick); + sc_start4(nullptr, &sd->bl, type, 100, val1, val2, val3, val4, tick); } return SCRIPT_CMD_SUCCESS; @@ -23474,8 +23474,8 @@ BUILDIN_FUNC(bonus_script) { uint32 dur; uint8 type = 0; TBL_PC* sd; - const char *script_str = NULL; - struct s_bonus_script_entry *entry = NULL; + const char *script_str = nullptr; + struct s_bonus_script_entry *entry = nullptr; if ( !script_charid2sd(7,sd) ) return SCRIPT_CMD_FAILURE; @@ -23567,8 +23567,8 @@ BUILDIN_FUNC(getguildmember) if (g) { uint8 i, type = 0; - struct script_data *data = NULL; - char *varname = NULL; + struct script_data *data = nullptr; + char *varname = nullptr; if (script_hasdata(st,3)) type = script_getnum(st,3); @@ -23599,19 +23599,19 @@ BUILDIN_FUNC(getguildmember) switch (type) { case 2: if (data) - setd_sub_num( st, NULL, varname, j, g->guild.member[i].account_id, data->ref ); + setd_sub_num( st, nullptr, varname, j, g->guild.member[i].account_id, data->ref ); else mapreg_setreg(reference_uid(add_str("$@guildmemberaid"), j),g->guild.member[i].account_id); break; case 1: if (data) - setd_sub_num( st, NULL, varname, j, g->guild.member[i].char_id, data->ref ); + setd_sub_num( st, nullptr, varname, j, g->guild.member[i].char_id, data->ref ); else mapreg_setreg(reference_uid(add_str("$@guildmembercid"), j), g->guild.member[i].char_id); break; default: if (data) - setd_sub_str( st, NULL, varname, j, g->guild.member[i].name, data->ref ); + setd_sub_str( st, nullptr, varname, j, g->guild.member[i].name, data->ref ); else mapreg_setregstr(reference_uid(add_str("$@guildmembername$"), j), g->guild.member[i].name); break; @@ -23635,7 +23635,7 @@ BUILDIN_FUNC(getguildmember) BUILDIN_FUNC(addspiritball) { uint8 i, count; uint16 duration; - map_session_data *sd = NULL; + map_session_data *sd = nullptr; if (script_hasdata(st,4)) { if (!script_isstring(st,4)) @@ -23668,7 +23668,7 @@ BUILDIN_FUNC(addspiritball) { */ BUILDIN_FUNC(delspiritball) { uint8 count; - map_session_data *sd = NULL; + map_session_data *sd = nullptr; if (script_hasdata(st,3)) { if (!script_isstring(st,3)) @@ -23735,7 +23735,7 @@ BUILDIN_FUNC(mergeitem) { */ BUILDIN_FUNC(mergeitem2) { map_session_data *sd; - struct item *items = NULL; + struct item *items = nullptr; uint16 i, count = 0; t_itemid nameid = 0; @@ -23924,8 +23924,8 @@ BUILDIN_FUNC(getattachedrid) { BUILDIN_FUNC(getvar) { int char_id = script_getnum(st, 3); map_session_data *sd = map_charid2sd(char_id); - struct script_data *data = NULL; - const char *name = NULL; + struct script_data *data = nullptr; + const char *name = nullptr; if (!sd) { ShowError("buildin_getvar: No player found with char id '%d'.\n", char_id); @@ -23976,7 +23976,7 @@ BUILDIN_FUNC(getvar) { * SELF - Message is sent only to player attached. **/ BUILDIN_FUNC(showscript) { - struct block_list *bl = NULL; + struct block_list *bl = nullptr; const char *msg = script_getstr(st,2); int id = 0; send_target target = AREA; @@ -23997,7 +23997,7 @@ BUILDIN_FUNC(showscript) { if (script_hasdata(st, 4)) { target = static_cast(script_getnum(st, 4)); - if (target == SELF && map_id2sd(bl->id) == NULL) { + if (target == SELF && map_id2sd(bl->id) == nullptr) { ShowWarning("script: showscript: self can't be used for non-players objects.\n"); return SCRIPT_CMD_FAILURE; } @@ -24016,7 +24016,7 @@ BUILDIN_FUNC(showscript) { BUILDIN_FUNC(ignoretimeout) { #ifdef SECURE_NPCTIMEOUT - map_session_data *sd = NULL; + map_session_data *sd = nullptr; if (script_hasdata(st,3)) { if (!script_isstring(st,3)) @@ -24145,7 +24145,7 @@ BUILDIN_FUNC(adopt) const char *name = script_getstr(st, 2); sd = map_nick2sd(name,false); - if (sd == NULL) { + if (sd == nullptr) { ShowError("buildin_adopt: Non-existant parent character %s requested.\n", name); return SCRIPT_CMD_FAILURE; } @@ -24153,7 +24153,7 @@ BUILDIN_FUNC(adopt) uint32 char_id = script_getnum(st, 2); sd = map_charid2sd(char_id); - if (sd == NULL) { + if (sd == nullptr) { ShowError("buildin_adopt: Non-existant parent character %d requested.\n", char_id); return SCRIPT_CMD_FAILURE; } @@ -24163,7 +24163,7 @@ BUILDIN_FUNC(adopt) const char *name = script_getstr(st, 3); b_sd = map_nick2sd(name,false); - if (b_sd == NULL) { + if (b_sd == nullptr) { ShowError("buildin_adopt: Non-existant baby character %s requested.\n", name); return SCRIPT_CMD_FAILURE; } @@ -24171,7 +24171,7 @@ BUILDIN_FUNC(adopt) uint32 char_id = script_getnum(st, 3); b_sd = map_charid2sd(char_id); - if (b_sd == NULL) { + if (b_sd == nullptr) { ShowError("buildin_adopt: Non-existant baby character %d requested.\n", char_id); return SCRIPT_CMD_FAILURE; } @@ -24259,7 +24259,7 @@ BUILDIN_FUNC(minmax){ } // Get the session data, if a player is attached - sd = st->rid ? map_id2sd(st->rid) : NULL; + sd = st->rid ? map_id2sd(st->rid) : nullptr; if (not_server_variable(*name) && !script_rid2sd(sd)) { ShowError("buildin_%s: Cannot use a player variable '%s' if no player is attached.\n", functionname, name); @@ -24322,7 +24322,7 @@ BUILDIN_FUNC(cap_value) * @author [Cydh] **/ BUILDIN_FUNC(getexp2) { - TBL_PC *sd = NULL; + TBL_PC *sd = nullptr; int64 base_exp = script_getnum64(st, 2); int64 job_exp = script_getnum64(st, 3); @@ -24335,12 +24335,12 @@ BUILDIN_FUNC(getexp2) { } if (base_exp > 0) - pc_gainexp(sd, NULL, base_exp, 0, 2); + pc_gainexp(sd, nullptr, base_exp, 0, 2); else if (base_exp < 0) pc_lostexp(sd, base_exp * -1, 0); if (job_exp > 0) - pc_gainexp(sd, NULL, 0, job_exp, 2); + pc_gainexp(sd, nullptr, 0, job_exp, 2); else if (job_exp < 0) pc_lostexp(sd, 0, job_exp * -1); return SCRIPT_CMD_SUCCESS; @@ -24583,7 +24583,7 @@ BUILDIN_FUNC(jobcanentermap) { const char *mapname = script_getstr(st, 2); int mapidx = mapindex_name2id(mapname), m = -1; int jobid = 0; - TBL_PC *sd = NULL; + TBL_PC *sd = nullptr; if (!mapidx) {// Invalid map script_pushint(st, false); @@ -24640,12 +24640,12 @@ BUILDIN_FUNC(getguildalliance) auto guild_data1 = guild_search(guild_id1); auto guild_data2 = guild_search(guild_id2); - if (guild_data1 == NULL) { + if (guild_data1 == nullptr) { ShowWarning("buildin_getguildalliance: Requesting non-existent GuildID1 '%d'.\n", guild_id1); script_pushint(st, -2); return SCRIPT_CMD_FAILURE; } - if (guild_data2 == NULL) { + if (guild_data2 == nullptr) { ShowWarning("buildin_getguildalliance: Requesting non-existent GuildID2 '%d'.\n", guild_id2); script_pushint(st, -1); return SCRIPT_CMD_FAILURE; @@ -24670,7 +24670,7 @@ BUILDIN_FUNC(getguildalliance) **/ BUILDIN_FUNC(openstorage2) { int stor_id = script_getnum(st, 2); - TBL_PC *sd = NULL; + TBL_PC *sd = nullptr; if (!script_accid2sd(4, sd)) { script_pushint(st, 0); @@ -24692,10 +24692,10 @@ BUILDIN_FUNC(openstorage2) { * @author [Cydh] **/ BUILDIN_FUNC(channel_create) { - struct Channel tmp_chan, *ch = NULL; - const char *chname = script_getstr(st,2), *pass = NULL; - int i = channel_chk((char*)chname, NULL, 3); - TBL_PC *sd = NULL; + struct Channel tmp_chan, *ch = nullptr; + const char *chname = script_getstr(st,2), *pass = nullptr; + int i = channel_chk((char*)chname, nullptr, 3); + TBL_PC *sd = nullptr; if (i != 0) { ShowError("buildin_channel_create: Channel name '%s' is invalid. Errno %d\n", chname, i); @@ -24785,11 +24785,11 @@ BUILDIN_FUNC(channel_join) { * @author [Cydh] **/ BUILDIN_FUNC(channel_setopt) { - struct Channel *ch = NULL; + struct Channel *ch = nullptr; const char *chname = script_getstr(st,2); int opt = script_getnum(st,3), value = script_getnum(st,4); - if (!(ch = channel_name2channel((char *)chname, NULL, 0))) { + if (!(ch = channel_name2channel((char *)chname, nullptr, 0))) { ShowError("buildin_channel_setopt: Channel name '%s' is invalid.\n", chname); script_pushint(st,0); return SCRIPT_CMD_FAILURE; @@ -24829,7 +24829,7 @@ BUILDIN_FUNC(channel_getopt) { Channel *ch; const char *chname = script_getstr(st, 2); - if (!(ch = channel_name2channel((char *)chname, NULL, 0))) { + if (!(ch = channel_name2channel((char *)chname, nullptr, 0))) { ShowError("buildin_channel_getopt: Channel name '%s' is invalid.\n", chname); script_pushint(st, false); return SCRIPT_CMD_FAILURE; @@ -24865,11 +24865,11 @@ BUILDIN_FUNC(channel_getopt) { * @author [Cydh] **/ BUILDIN_FUNC(channel_setcolor) { - struct Channel *ch = NULL; + struct Channel *ch = nullptr; const char *chname = script_getstr(st,2); int color = script_getnum(st,3); - if (!(ch = channel_name2channel((char *)chname, NULL, 0))) { + if (!(ch = channel_name2channel((char *)chname, nullptr, 0))) { ShowError("buildin_channel_setcolor: Channel name '%s' is invalid.\n", chname); script_pushint(st,0); return SCRIPT_CMD_FAILURE; @@ -24887,10 +24887,10 @@ BUILDIN_FUNC(channel_setcolor) { * @author [Cydh] **/ BUILDIN_FUNC(channel_setpass) { - struct Channel *ch = NULL; + struct Channel *ch = nullptr; const char *chname = script_getstr(st,2), *passwd = script_getstr(st,3); - if (!(ch = channel_name2channel((char *)chname, NULL, 0))) { + if (!(ch = channel_name2channel((char *)chname, nullptr, 0))) { ShowError("buildin_channel_setpass: Channel name '%s' is invalid.\n", chname); script_pushint(st,0); return SCRIPT_CMD_FAILURE; @@ -24910,11 +24910,11 @@ BUILDIN_FUNC(channel_setpass) { * @author [Cydh] **/ BUILDIN_FUNC(channel_setgroup) { - struct Channel *ch = NULL; + struct Channel *ch = nullptr; const char *funcname = script_getfuncname(st), *chname = script_getstr(st,2); int i, n = 0, group = 0; - if (!(ch = channel_name2channel((char *)chname, NULL, 0))) { + if (!(ch = channel_name2channel((char *)chname, nullptr, 0))) { ShowError("buildin_channel_setgroup: Channel name '%s' is invalid.\n", chname); script_pushint(st,0); return SCRIPT_CMD_FAILURE; @@ -24940,7 +24940,7 @@ BUILDIN_FUNC(channel_setgroup) { } } - n = script_array_highest_key(st, NULL, reference_getname(data), reference_getref(data)); + n = script_array_highest_key(st, nullptr, reference_getname(data), reference_getref(data)); if (n < 1) { ShowError("buildin_channel_setgroup: No group id listed.\n"); script_pushint(st,0); @@ -24949,7 +24949,7 @@ BUILDIN_FUNC(channel_setgroup) { if (ch->groups) aFree(ch->groups); - ch->groups = NULL; + ch->groups = nullptr; ch->group_count = 0; id = reference_getid(data); @@ -24977,7 +24977,7 @@ BUILDIN_FUNC(channel_setgroup) { if (ch->groups) aFree(ch->groups); - ch->groups = NULL; + ch->groups = nullptr; ch->group_count = 0; if (group == 0) { // Removed group list @@ -25001,7 +25001,7 @@ BUILDIN_FUNC(channel_setgroup) { * @author [Cydh] **/ BUILDIN_FUNC(channel_chat) { - struct Channel *ch = NULL; + struct Channel *ch = nullptr; const char *chname = script_getstr(st,2), *msg = script_getstr(st,3); char output[CHAT_SIZE_MAX+1]; unsigned long color = 0; @@ -25033,7 +25033,7 @@ BUILDIN_FUNC(channel_chat) { return SCRIPT_CMD_SUCCESS; } } - else if (!(ch = channel_name2channel((char *)chname, NULL, 0))) { + else if (!(ch = channel_name2channel((char *)chname, nullptr, 0))) { ShowError("buildin_channel_chat: Channel name '%s' is invalid.\n", chname); script_pushint(st,0); return SCRIPT_CMD_FAILURE; @@ -25059,12 +25059,12 @@ BUILDIN_FUNC(channel_chat) { * @author [Cydh] **/ BUILDIN_FUNC(channel_ban) { - struct Channel *ch = NULL; + struct Channel *ch = nullptr; const char *chname = script_getstr(st,2); unsigned int char_id = script_getnum(st,3); TBL_PC *tsd; - if (!(ch = channel_name2channel((char *)chname, NULL, 0))) { + if (!(ch = channel_name2channel((char *)chname, nullptr, 0))) { ShowError("buildin_channel_ban: Channel name '%s' is invalid.\n", chname); script_pushint(st,0); return SCRIPT_CMD_FAILURE; @@ -25108,11 +25108,11 @@ BUILDIN_FUNC(channel_ban) { * @author [Cydh] **/ BUILDIN_FUNC(channel_unban) { - struct Channel *ch = NULL; + struct Channel *ch = nullptr; const char *chname = script_getstr(st,2); unsigned int char_id = script_getnum(st,3); - if (!(ch = channel_name2channel((char *)chname, NULL, 0))) { + if (!(ch = channel_name2channel((char *)chname, nullptr, 0))) { ShowError("buildin_channel_unban: Channel name '%s' is invalid.\n", chname); script_pushint(st,0); return SCRIPT_CMD_FAILURE; @@ -25145,9 +25145,9 @@ BUILDIN_FUNC(channel_unban) { * @author [Cydh] **/ BUILDIN_FUNC(channel_kick) { - struct Channel *ch = NULL; + struct Channel *ch = nullptr; const char *chname = script_getstr(st,2); - TBL_PC *tsd = NULL; + TBL_PC *tsd = nullptr; int res = 1; if (script_isstring(st, 3)) { @@ -25201,10 +25201,10 @@ BUILDIN_FUNC(channel_kick) { * @author [Cydh] **/ BUILDIN_FUNC(channel_delete) { - struct Channel *ch = NULL; + struct Channel *ch = nullptr; const char *chname = script_getstr(st,2); - if (!(ch = channel_name2channel((char *)chname, NULL, 0))) { + if (!(ch = channel_name2channel((char *)chname, nullptr, 0))) { ShowError("channel_delete: Channel name '%s' is invalid.\n", chname); script_pushint(st,-1); return SCRIPT_CMD_FAILURE; @@ -25221,7 +25221,7 @@ BUILDIN_FUNC(unloadnpc) { name = script_getstr(st, 2); nd = npc_name2id(name); - if( nd == NULL ){ + if( nd == nullptr ){ ShowError( "buildin_unloadnpc: npc '%s' was not found.\n", name ); return SCRIPT_CMD_FAILURE; } else if ( nd->bl.id == st->oid ) { @@ -25724,7 +25724,7 @@ static inline bool mail_sub( struct script_state *st, struct script_data *data, } // Check if the variable requires a player - if( not_server_variable(*name) && sd == NULL ){ + if( not_server_variable(*name) && sd == nullptr ){ // If no player is attached if( !script_rid2sd(sd) ){ ShowError( "buildin_mail: variable \"%s\" was not a server variable, but no player was attached.\n", name ); @@ -25756,7 +25756,7 @@ BUILDIN_FUNC(mail){ const char *sender, *title, *body, *name; struct mail_message msg; struct script_data *data; - map_session_data *sd = NULL; + map_session_data *sd = nullptr; unsigned int i, j, k, num_items, start, end; int32 id; @@ -25999,7 +25999,7 @@ BUILDIN_FUNC(mail){ msg.status = MAIL_NEW; msg.type = MAIL_INBOX_NORMAL; - msg.timestamp = time(NULL); + msg.timestamp = time(nullptr); intif_Mail_send(0, &msg); @@ -26046,7 +26046,7 @@ BUILDIN_FUNC(identifyall) { else sd = map_id2sd( script_getnum(st, 3) ); - if (sd == NULL) { + if (sd == nullptr) { script_pushint(st, -1); return SCRIPT_CMD_SUCCESS; } @@ -26380,7 +26380,7 @@ BUILDIN_FUNC(naviregisterwarp) { #ifdef MAP_GENERATOR TBL_NPC* nd; int x, y, m; - const char *warpname, *mapname=NULL; + const char *warpname, *mapname=nullptr; struct navi_link link; @@ -27257,13 +27257,13 @@ BUILDIN_FUNC(preg_match) { if (script_hasdata(st,4)) offset = script_getnum(st,4); - re = pcre_compile(pattern, 0, &error, &erroffset, NULL); + re = pcre_compile(pattern, 0, &error, &erroffset, nullptr); pcreExtra = pcre_study(re, 0, &error); r = pcre_exec(re, pcreExtra, subject, (int)strlen(subject), offset, 0, subStrVec, 30); pcre_free(re); - if (pcreExtra != NULL) + if (pcreExtra != nullptr) pcre_free(pcreExtra); if (r < 0) @@ -27998,5 +27998,5 @@ struct script_function buildin_func[] = { #include - {NULL,NULL,NULL}, + {nullptr,nullptr,nullptr}, }; diff --git a/src/map/script.hpp b/src/map/script.hpp index b7beb8483d..81fd2919fe 100644 --- a/src/map/script.hpp +++ b/src/map/script.hpp @@ -103,7 +103,7 @@ #define reference_getindex(data) ( (uint32)(int64)((reference_getuid(data) >> 32) & 0xffffffff) ) /// Returns the name of the reference #define reference_getname(data) ( str_buf + str_data[reference_getid(data)].str ) -/// Returns the linked list of uid-value pairs of the reference (can be NULL) +/// Returns the linked list of uid-value pairs of the reference (can be nullptr) #define reference_getref(data) ( (data)->ref ) /// Returns the value of the constant #define reference_getconstant(data) ( str_data[reference_getid(data)].val ) @@ -116,8 +116,8 @@ /// Checks whether two references point to the same variable (or array) #define is_same_reference(data1, data2) \ ( reference_getid(data1) == reference_getid(data2) \ - && ( (data1->ref == data2->ref && data1->ref == NULL) \ - || (data1->ref != NULL && data2->ref != NULL && data1->ref->vars == data2->ref->vars \ + && ( (data1->ref == data2->ref && data1->ref == nullptr) \ + || (data1->ref != nullptr && data2->ref != nullptr && data1->ref->vars == data2->ref->vars \ ) ) ) #define script_getvarid(var) ( (int32)(int64)(var & 0xFFFFFFFF) ) @@ -353,7 +353,7 @@ struct script_array { enum script_parse_options { SCRIPT_USE_LABEL_DB = 0x1,// records labels in scriptlabel_db SCRIPT_IGNORE_EXTERNAL_BRACKETS = 0x2,// ignores the check for {} brackets around the script - SCRIPT_RETURN_EMPTY_SCRIPT = 0x4// returns the script object instead of NULL for empty scripts + SCRIPT_RETURN_EMPTY_SCRIPT = 0x4// returns the script object instead of nullptr for empty scripts }; enum monsterinfo_types { @@ -2252,7 +2252,7 @@ const char* script_get_constant_str(const char* prefix, int64 value); bool script_get_parameter(const char* name, int64* value); bool script_get_constant(const char* name, int64* value); void script_set_constant_(const char* name, int64 value, const char* constant_name, bool isparameter, bool deprecated); -#define script_set_constant(name, value, isparameter, deprecated) script_set_constant_(name, value, NULL, isparameter, deprecated) +#define script_set_constant(name, value, isparameter, deprecated) script_set_constant_(name, value, nullptr, isparameter, deprecated) void script_hardcoded_constants(void); void script_cleararray_pc(map_session_data* sd, const char* varname); diff --git a/src/map/searchstore.cpp b/src/map/searchstore.cpp index ef81bc6e79..61f3c61581 100644 --- a/src/map/searchstore.cpp +++ b/src/map/searchstore.cpp @@ -53,7 +53,7 @@ static searchstore_search_t searchstore_getsearchfunc(unsigned char type) case SEARCHTYPE_BUYING_STORE: return &buyingstore_search; } - return NULL; + return nullptr; } /** @@ -68,7 +68,7 @@ static searchstore_searchall_t searchstore_getsearchallfunc(unsigned char type) case SEARCHTYPE_BUYING_STORE: return &buyingstore_searchall; } - return NULL; + return nullptr; } /** @@ -153,7 +153,7 @@ void searchstore_query(map_session_data* sd, unsigned char type, unsigned int mi if( !sd->searchstore.open ) return; - if( ( store_searchall = searchstore_getsearchallfunc(type) ) == NULL ) { + if( ( store_searchall = searchstore_getsearchallfunc(type) ) == nullptr ) { ShowError("searchstore_query: Unknown search type %u (account_id=%d).\n", (unsigned int)type, sd->bl.id); return; } @@ -316,7 +316,7 @@ void searchstore_click(map_session_data* sd, uint32 account_id, int store_id, t_ return; } - if( ( pl_sd = map_id2sd(account_id) ) == NULL ) { // no longer online + if( ( pl_sd = map_id2sd(account_id) ) == nullptr ) { // no longer online clif_search_store_info_failed(sd, SSI_FAILED_SSILIST_CLICK_TO_OPEN_STORE); return; } diff --git a/src/map/skill.cpp b/src/map/skill.cpp index e6b237a06f..e050be434d 100755 --- a/src/map/skill.cpp +++ b/src/map/skill.cpp @@ -51,15 +51,15 @@ using namespace rathena; #define SKILLUNITTIMER_INTERVAL 100 #define TIMERSKILL_INTERVAL 150 -static struct eri *skill_timer_ers = NULL; //For handling skill_timerskills [Skotlex] -static DBMap* bowling_db = NULL; // int mob_id -> struct mob_data* +static struct eri *skill_timer_ers = nullptr; //For handling skill_timerskills [Skotlex] +static DBMap* bowling_db = nullptr; // int mob_id -> struct mob_data* -DBMap* skillunit_db = NULL; // int id -> struct skill_unit* +DBMap* skillunit_db = nullptr; // int id -> struct skill_unit* /** * Skill Unit Persistency during endack routes (mostly for songs see bugreport:4574) */ -DBMap* skillusave_db = NULL; // char_id -> struct skill_usave +DBMap* skillusave_db = nullptr; // char_id -> struct skill_usave struct skill_usave { uint16 skill_id, skill_lv; }; @@ -1169,7 +1169,7 @@ struct s_skill_unit_layout *skill_get_unit_layout(uint16 skill_id, uint16 skill_ pos = cap_value(pos, 0, MAX_SQUARE_LAYOUT); // cap to nearest square layout } - nullpo_retr(NULL, src); + nullpo_retr(nullptr, src); //Monsters sometimes deploy more units on level 10 if (src->type == BL_MOB && skill_lv >= 10) { @@ -2538,8 +2538,8 @@ int skill_onskillusage(map_session_data *sd, struct block_list *bl, uint16 skill int skill_counter_additional_effect (struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, t_tick tick) { int rate; - map_session_data *sd=NULL; - map_session_data *dstsd=NULL; + map_session_data *sd=nullptr; + map_session_data *dstsd=nullptr; nullpo_ret(src); nullpo_ret(bl); @@ -2653,7 +2653,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * sp += sd->bonus.magic_sp_gain_value; hp += sd->bonus.magic_hp_gain_value; if( skill_id == WZ_WATERBALL ) {//(bugreport:5303) - status_change *sc = NULL; + status_change *sc = nullptr; if( ( sc = status_get_sc(src) ) ) { if(sc->getSCE(SC_SPIRIT) && sc->getSCE(SC_SPIRIT)->val2 == SL_WIZARD && @@ -2805,7 +2805,7 @@ int skill_break_equip(struct block_list *src, struct block_list *bl, unsigned sh TBL_PC *sd; sd = BL_CAST(BL_PC, bl); if (sc && !sc->count) - sc = NULL; + sc = nullptr; if (sd) { if (sd->bonus.unbreakable_equip) @@ -3246,10 +3246,10 @@ void skill_combo(struct block_list* src,struct block_list *dsrc, struct block_li TBL_HOM *hd = BL_CAST(BL_HOM,src); status_change *sc = status_get_sc(src); - if(sc == NULL) return; + if(sc == nullptr) return; //End previous combo state after skill is invoked - if ((sce = sc->getSCE(SC_COMBO)) != NULL) { + if ((sce = sc->getSCE(SC_COMBO)) != nullptr) { switch (skill_id) { case TK_TURNKICK: case TK_STORMKICK: @@ -3546,7 +3546,7 @@ int64 skill_attack (int attack_type, struct block_list* src, struct block_list * if (src != dsrc) { //When caster is not the src of attack, this is a ground skill, and as such, do the relevant target checking. [Skotlex] - if (!status_check_skilluse(battle_config.skill_caster_check?src:NULL, bl, skill_id, 2)) + if (!status_check_skilluse(battle_config.skill_caster_check?src:nullptr, bl, skill_id, 2)) return 0; } else if ((flag&SD_ANIMATION) && skill_get_nk(skill_id, NK_SPLASH)) { //Note that splash attacks often only check versus the targetted mob, those around the splash area normally don't get checked for being hidden/cloaked/etc. [Skotlex] @@ -3562,7 +3562,7 @@ int64 skill_attack (int attack_type, struct block_list* src, struct block_list * sc= status_get_sc(src); tsc= status_get_sc(bl); if (tsc && !tsc->count) - tsc = NULL; //Don't need it. + tsc = nullptr; //Don't need it. //Trick Dead protects you from damage, but not from buffs and the like, hence it's placed here. if (tsc && tsc->getSCE(SC_TRICKDEAD)) @@ -3615,7 +3615,7 @@ int64 skill_attack (int attack_type, struct block_list* src, struct block_list * tsd = BL_CAST(BL_PC, bl); tsc = status_get_sc(bl); if (tsc && !tsc->count) - tsc = NULL; //Don't need it. + tsc = nullptr; //Don't need it. /* bugreport:2564 flag&2 disables double casting trigger */ flag |= 2; //Reflected magic damage will not cause the caster to be knocked back [Playtester] @@ -4189,7 +4189,7 @@ static int skill_check_unit_range_sub(struct block_list *bl, va_list ap) unit = (struct skill_unit *)bl; - if(bl->prev == NULL || bl->type != BL_SKILL) + if(bl->prev == nullptr || bl->type != BL_SKILL) return 0; if(!unit->alive) @@ -4272,7 +4272,7 @@ static int skill_check_unit_range2_sub (struct block_list *bl, va_list ap) { uint16 skill_id; - if(bl->prev == NULL) + if(bl->prev == nullptr) return 0; skill_id = va_arg(ap,int); @@ -4385,7 +4385,7 @@ void skill_consume_hpspap(block_list* bl, uint16 skill_id, int hp, int sp, int a static int skill_check_condition_mercenary(struct block_list *bl, uint16 skill_id, uint16 skill_lv, int type) { struct status_data *status; - map_session_data *sd = NULL; + map_session_data *sd = nullptr; int i, hp, sp, hp_rate, sp_rate, state, mhp; t_itemid itemid[MAX_SKILL_ITEM_REQUIRE]; int amount[ARRAYLENGTH(itemid)], index[ARRAYLENGTH(itemid)]; @@ -4513,21 +4513,21 @@ static TIMER_FUNC(skill_timerskill){ struct block_list *src = map_id2bl(id),*target; struct unit_data *ud = unit_bl2ud(src); struct skill_timerskill *skl; - struct skill_unit *unit = NULL; + struct skill_unit *unit = nullptr; int range; nullpo_ret(src); nullpo_ret(ud); skl = ud->skilltimerskill[data]; nullpo_ret(skl); - ud->skilltimerskill[data] = NULL; + ud->skilltimerskill[data] = nullptr; do { - if(src->prev == NULL) + if(src->prev == nullptr) break; // Source not on Map if(skl->target_id) { target = map_id2bl(skl->target_id); - if( ( skl->skill_id == RG_INTIMIDATE || skl->skill_id == NPC_FATALMENACE ) && (!target || target->prev == NULL || !check_distance_bl(src,target,AREA_SIZE)) ) + if( ( skl->skill_id == RG_INTIMIDATE || skl->skill_id == NPC_FATALMENACE ) && (!target || target->prev == nullptr || !check_distance_bl(src,target,AREA_SIZE)) ) target = src; //Required since it has to warp. if (skl->skill_id == SR_SKYNETBLOW) { @@ -4538,9 +4538,9 @@ static TIMER_FUNC(skill_timerskill){ break; } - if(target == NULL) + if(target == nullptr) break; // Target offline? - if(target->prev == NULL) + if(target->prev == nullptr) break; // Target not on Map if(src->m != target->m) break; // Different Maps @@ -4611,7 +4611,7 @@ static TIMER_FUNC(skill_timerskill){ for (i = skl->type; i >= 0 && i < layout->count; i++) { int ux = skl->x + layout->dx[i]; int uy = skl->y + layout->dy[i]; - unit = map_find_skill_unit_oncell(src, ux, uy, WZ_WATERBALL, NULL, 0); + unit = map_find_skill_unit_oncell(src, ux, uy, WZ_WATERBALL, nullptr, 0); if (unit) break; } @@ -4619,7 +4619,7 @@ static TIMER_FUNC(skill_timerskill){ [[fallthrough]]; case WZ_JUPITEL: // Official behaviour is to hit as long as there is a line of sight, regardless of distance - if (skl->type > 0 && !status_isdead(target) && path_search_long(NULL,src->m,src->x,src->y,target->x,target->y,CELL_CHKWALL)) { + if (skl->type > 0 && !status_isdead(target) && path_search_long(nullptr,src->m,src->x,src->y,target->x,target->y,CELL_CHKWALL)) { // Apply canact delay here to prevent hacks (unlimited casting) ud->canact_tick = i64max(tick + status_get_amotion(src), ud->canact_tick); skill_attack(BF_MAGIC, src, src, target, skl->skill_id, skl->skill_lv, tick, skl->flag); @@ -4642,7 +4642,7 @@ static TIMER_FUNC(skill_timerskill){ case NPC_DANCINGBLADE_ATK: skill_attack(BF_WEAPON,src,src,target,skl->skill_id,skl->skill_lv,tick,skl->flag); if (skl->type < 4) { - struct block_list *nbl = NULL; + struct block_list *nbl = nullptr; nbl = battle_getenemyarea(src, target->x, target->y, 5, splash_target(src), src->id); skill_addtimerskill(src, tick + 650, (nbl?nbl:target)->id, skl->x, 0, NPC_DANCINGBLADE_ATK, skl->skill_lv, skl->type + 1, 0); @@ -4655,10 +4655,10 @@ static TIMER_FUNC(skill_timerskill){ skill_attack(BF_MAGIC,src,src,target,skl->skill_id,skl->skill_lv,tick,9 - skl->type); // Hit a Lightning on the current Target if( skl->type < (4 + skl->skill_lv - 1) && skl->x < 3 ) { // Remaining Chains Hit - struct block_list *nbl = NULL; // Next Target of Chain + struct block_list *nbl = nullptr; // Next Target of Chain nbl = battle_getenemyarea(src, target->x, target->y, (skl->type>2)?2:3, // After 2 bounces, it will bounce to other targets in 7x7 range. splash_target(src), target->id); // Search for a new Target around current one... - if( nbl == NULL ) + if( nbl == nullptr ) skl->x++; else skl->x = 0; @@ -4699,7 +4699,7 @@ static TIMER_FUNC(skill_timerskill){ break; case SR_WINDMILL: if( target->type == BL_PC ) { - map_session_data *tsd = NULL; + map_session_data *tsd = nullptr; if( (tsd = ((TBL_PC*)target)) && !pc_issit(tsd) ) { pc_setsit(tsd); skill_sit(tsd, true); @@ -4836,7 +4836,7 @@ int skill_addtimerskill (struct block_list *src, t_tick tick, int target, int x, int i; struct unit_data *ud; nullpo_retr(1, src); - if (src->prev == NULL) + if (src->prev == nullptr) return 0; ud = unit_bl2ud(src); nullpo_retr(1, ud); @@ -4886,7 +4886,7 @@ int skill_cleartimerskill (struct block_list *src) } delete_timer(ud->skilltimerskill[i]->timer, skill_timerskill); ers_free(skill_timer_ers, ud->skilltimerskill[i]); - ud->skilltimerskill[i]=NULL; + ud->skilltimerskill[i]=nullptr; } } return 1; @@ -5092,7 +5092,7 @@ static int skill_tarotcard(struct block_list* src, struct block_list *target, ui *------------------------------------------*/ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, t_tick tick, int flag) { - map_session_data *sd = NULL; + map_session_data *sd = nullptr; struct status_data *tstatus; status_change *sc, *tsc; @@ -5104,7 +5104,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint if (src->m != bl->m) return 1; - if (bl->prev == NULL) + if (bl->prev == nullptr) return 1; sd = BL_CAST(BL_PC, src); @@ -5124,9 +5124,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint sc = status_get_sc(src); tsc = status_get_sc(bl); if (sc && !sc->count) - sc = NULL; //Unneeded + sc = nullptr; //Unneeded if (tsc && !tsc->count) - tsc = NULL; + tsc = nullptr; tstatus = status_get_status_data(bl); @@ -5360,7 +5360,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint case KN_CHARGEATK: { - bool path = path_search_long(NULL, src->m, src->x, src->y, bl->x, bl->y,CELL_CHKWALL); + bool path = path_search_long(nullptr, src->m, src->x, src->y, bl->x, bl->y,CELL_CHKWALL); #ifdef RENEWAL int dist = skill_get_blewcount(skill_id, skill_lv); #else @@ -5757,7 +5757,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint switch (skill_id) { case NPC_VAMPIRE_GIFT: if (heal > 0) { - clif_skill_nodamage(NULL, src, AL_HEAL, heal, 1); + clif_skill_nodamage(nullptr, src, AL_HEAL, heal, 1); status_heal(src, heal, 0, 0); } break; @@ -6337,7 +6337,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint int heal = (int)skill_attack( (skill_id == NPC_BLOODDRAIN) ? BF_WEAPON : BF_MAGIC, src, src, bl, skill_id, skill_lv, tick, flag); if (heal > 0){ - clif_skill_nodamage(NULL, src, AL_HEAL, heal, 1); + clif_skill_nodamage(nullptr, src, AL_HEAL, heal, 1); status_heal(src, heal, 0, 0); } } @@ -6455,7 +6455,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint if( heal && rnd()%100 < rate ) { status_heal(src, heal, 0, 0); - clif_skill_nodamage(NULL, src, AL_HEAL, heal, 1); + clif_skill_nodamage(nullptr, src, AL_HEAL, heal, 1); } } break; @@ -6609,7 +6609,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint sc_start(src, bl, SC_FREEZING, 25 + 5 * skill_lv, skill_lv, skill_get_time(skill_id, skill_lv)); sc_start(src, bl, SC_MISTY_FROST, 100, skill_lv, skill_get_time2(skill_id, skill_lv)); // Doesn't deal damage through non-shootable walls. - if( !battle_config.skill_wall_check || (battle_config.skill_wall_check && path_search(NULL,src->m,src->x,src->y,bl->x,bl->y,1,CELL_CHKWALL)) ) + if( !battle_config.skill_wall_check || (battle_config.skill_wall_check && path_search(nullptr,src->m,src->x,src->y,bl->x,bl->y,1,CELL_CHKWALL)) ) skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag|SD_ANIMATION); break; case WL_HELLINFERNO: @@ -6635,7 +6635,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint } [[fallthrough]]; case RA_WUGBITE: - if( path_search(NULL,src->m,src->x,src->y,bl->x,bl->y,1,CELL_CHKNOREACH) ) { + if( path_search(nullptr,src->m,src->x,src->y,bl->x,bl->y,1,CELL_CHKNOREACH) ) { skill_attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); }else if( sd && skill_id == RA_WUGBITE ) // Only RA_WUGBITE has the skill fail message. clif_skill_fail( *sd, skill_id ); @@ -7288,7 +7288,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui dstsd = BL_CAST(BL_PC, bl); dstmd = BL_CAST(BL_MOB, bl); - if(bl->prev == NULL) + if(bl->prev == nullptr) return 1; if(status_isdead(src)) return 1; @@ -7354,12 +7354,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui type = skill_get_sc(skill_id); tsc = status_get_sc(bl); status_change* sc = status_get_sc(src); - tsce = (tsc && type != SC_NONE)?tsc->getSCE(type):NULL; + tsce = (tsc && type != SC_NONE)?tsc->getSCE(type):nullptr; if (src!=bl && type > SC_NONE && CHK_ELEMENT((i = skill_get_ele(skill_id, skill_lv))) && i > ELE_NEUTRAL && skill_get_inf(skill_id) != INF_SUPPORT_SKILL && - battle_attr_fix(NULL, NULL, 100, i, tstatus->def_ele, tstatus->ele_lv) <= 0) + battle_attr_fix(nullptr, nullptr, 100, i, tstatus->def_ele, tstatus->ele_lv) <= 0) return 1; //Skills that cause an status should be blocked if the target element blocks its element. map_freeblock_lock(); @@ -7614,7 +7614,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if( status_isimmune(bl) ) break; heal = status_percent_heal(bl, 100, 0); - clif_skill_nodamage(NULL, bl, AL_HEAL, heal, 1); + clif_skill_nodamage(nullptr, bl, AL_HEAL, heal, 1); if( dstmd ) { // Reset Damage Logs memset(dstmd->dmglog, 0, sizeof(dstmd->dmglog)); @@ -7630,7 +7630,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case SA_LEVELUP: clif_skill_nodamage(src,bl,skill_id,skill_lv,1); if (sd && pc_nextbaseexp(sd)) - pc_gainexp(sd, NULL, pc_nextbaseexp(sd) * 10 / 100, 0, 0); + pc_gainexp(sd, nullptr, pc_nextbaseexp(sd) * 10 / 100, 0, 0); break; case SA_INSTANTDEATH: clif_skill_nodamage(src,bl,skill_id,skill_lv,1); @@ -8319,7 +8319,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui sc_start(src,bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); skill_reveal_trap_inarea(src, splash, src->x, src->y); map_foreachinallrange( status_change_timer_sub, src, - splash, BL_CHAR, src, NULL, type, tick); + splash, BL_CHAR, src, nullptr, type, tick); } break; @@ -8399,7 +8399,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif_skill_nodamage(src, bl, skill_id, skill_lv, sc_start4(src, bl, type, 10000, src->id, i, skill_get_range2(src, skill_id, skill_lv, true), 0, skill_get_time2(skill_id, skill_lv))); - clif_devotion(src, NULL); + clif_devotion(src, nullptr); } break; @@ -8844,7 +8844,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui #endif case PR_MAGNIFICAT: case PR_GLORIA: - if (sd == NULL || sd->status.party_id == 0 || (flag & 1)) { + if (sd == nullptr || sd->status.party_id == 0 || (flag & 1)) { // Animations don't play when outside visible range if (check_distance_bl(src, bl, AREA_SIZE)) @@ -8866,7 +8866,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case NV_HELPANGEL: case IG_GUARDIAN_SHIELD: case IG_ULTIMATE_SACRIFICE:// Is the animation on this skill correct? Check if its on caster only or all affected. [Rytech] - if( sd == NULL || sd->status.party_id == 0 || (flag & 1) ) + if( sd == nullptr || sd->status.party_id == 0 || (flag & 1) ) clif_skill_nodamage(bl, bl, skill_id, skill_lv, sc_start(src,bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); else if (sd) { @@ -8877,7 +8877,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case MER_MAGNIFICAT: - if( mer != NULL ) + if( mer != nullptr ) { clif_skill_nodamage(bl, bl, skill_id, skill_lv, sc_start(src,bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); if( mer->master && mer->master->status.party_id != 0 && !(flag&1) ) @@ -8891,7 +8891,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case BS_ADRENALINE2: case BS_WEAPONPERFECT: case BS_OVERTHRUST: - if (sd == NULL || sd->status.party_id == 0 || (flag & 1)) { + if (sd == nullptr || sd->status.party_id == 0 || (flag & 1)) { int weapontype = skill_get_weapontype(skill_id); if (!weapontype || !dstsd || pc_check_weapontype(dstsd, weapontype)) { clif_skill_nodamage(bl, bl, skill_id, skill_lv, @@ -9248,7 +9248,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui sd = mer->master; [[fallthrough]]; case WZ_ESTIMATION: - if( sd == NULL ) + if( sd == nullptr ) break; if( dstsd ) { // Fail on Players @@ -9259,7 +9259,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); clif_skill_estimation(sd, bl); if( skill_id == MER_ESTIMATION ) - sd = NULL; + sd = nullptr; break; case BS_REPAIRWEAPON: @@ -9357,7 +9357,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if(sd) { if (skill_produce_mix(sd, skill_id, ITEMID_HOLY_WATER, 0, 0, 0, 1, -1)) { struct skill_unit* su; - if ((su = map_find_skill_unit_oncell(bl, bl->x, bl->y, NJ_SUITON, NULL, 0)) != NULL) + if ((su = map_find_skill_unit_oncell(bl, bl->x, bl->y, NJ_SUITON, nullptr, 0)) != nullptr) skill_delunit(su); clif_skill_nodamage(src, bl, skill_id, skill_lv, 1); } @@ -9441,7 +9441,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui map_freeblock_unlock(); return 1; } - if (sd->inventory_data[j] == NULL || sd->inventory.u.items_inventory[j].amount < require.amount[x]) { + if (sd->inventory_data[j] == nullptr || sd->inventory.u.items_inventory[j].amount < require.amount[x]) { clif_skill_fail( *sd, skill_id ); map_freeblock_unlock(); return 1; @@ -9544,9 +9544,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui clif_skill_nodamage(src,bl,skill_id,skill_lv,1); if( hp > 0 || (skill_id == AM_POTIONPITCHER && sp <= 0) ) - clif_skill_nodamage(NULL,bl,AL_HEAL,hp,1); + clif_skill_nodamage(nullptr,bl,AL_HEAL,hp,1); if( sp > 0 ) - clif_skill_nodamage(NULL,bl,MG_SRECOVERY,sp,1); + clif_skill_nodamage(nullptr,bl,MG_SRECOVERY,sp,1); if (tsc) { #ifdef RENEWAL if (tsc->getSCE(SC_EXTREMITYFIST2)) @@ -9919,8 +9919,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui // not really needed... but adding here anyway ^^ if (md && md->master_id > 0) { struct block_list *mbl, *tbl; - if ((mbl = map_id2bl(md->master_id)) == NULL || - (tbl = battle_gettargeted(mbl)) == NULL) + if ((mbl = map_id2bl(md->master_id)) == nullptr || + (tbl = battle_gettargeted(mbl)) == nullptr) break; md->state.provoke_flag = tbl->id; mob_target(md, tbl, sstatus->rhw.range); @@ -10190,7 +10190,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case HT_SPRINGTRAP: clif_skill_nodamage(src,bl,skill_id,skill_lv,1); { - struct skill_unit *su=NULL; + struct skill_unit *su=nullptr; if((bl->type==BL_SKILL) && (su=(struct skill_unit *)bl) && (su->group) ){ switch(su->group->unit_id){ case UNT_ANKLESNARE: // ankle snare @@ -10337,9 +10337,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } } if(hp > 0) - clif_skill_nodamage(NULL,bl,AL_HEAL,hp,1); + clif_skill_nodamage(nullptr,bl,AL_HEAL,hp,1); if(sp > 0) - clif_skill_nodamage(NULL,bl,MG_SRECOVERY,sp,1); + clif_skill_nodamage(nullptr,bl,MG_SRECOVERY,sp,1); status_heal(bl,hp,sp,0); } break; @@ -10537,7 +10537,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui for (i = 0; i < g->guild.max_member && (!calls || (calls && called < calls)); i++, j++) { if (j > 8) j = 0; - if ((dstsd = g->guild.member[i].sd) != NULL && sd != dstsd && !dstsd->state.autotrade && !pc_isdead(dstsd)) { + if ((dstsd = g->guild.member[i].sd) != nullptr && sd != dstsd && !dstsd->state.autotrade && !pc_isdead(dstsd)) { if (map_getmapflag(dstsd->bl.m, MF_NOWARP) && !map_flag_gvg2(dstsd->bl.m)) continue; if (!pc_job_can_entermap((enum e_job)dstsd->status.class_, src->m, pc_get_group_level(dstsd))) @@ -10988,7 +10988,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui { int bless_lv = ((sd) ? pc_checkskill(sd,AL_BLESSING) : skill_get_max(AL_BLESSING)) + (((sd) ? sd->status.job_level : 50) / 10); int agi_lv = ((sd) ? pc_checkskill(sd,AL_INCAGI) : skill_get_max(AL_INCAGI)) + (((sd) ? sd->status.job_level : 50) / 10); - if( sd == NULL || sd->status.party_id == 0 || flag&1 ) + if( sd == nullptr || sd->status.party_id == 0 || flag&1 ) clif_skill_nodamage(bl, bl, skill_id, skill_lv, sc_start(src,bl,type,100, (skill_id == AB_CLEMENTIA)? bless_lv : (skill_id == AB_CANTO)? agi_lv : skill_lv, skill_get_time(skill_id,skill_lv))); else if( sd ) @@ -12369,7 +12369,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case MH_STYLE_CHANGE: if(hd){ struct status_change_entry *sce; - if((sce=hd->sc.getSCE(SC_STYLE_CHANGE))!=NULL){ //in preparation for other bl usage + if((sce=hd->sc.getSCE(SC_STYLE_CHANGE))!=nullptr){ //in preparation for other bl usage if(sce->val1 == MH_MD_FIGHTING) sce->val1 = MH_MD_GRAPPLING; else sce->val1 = MH_MD_FIGHTING; //if(hd->master && hd->sc.getSCE(SC_STYLE_CHANGE)) { // Aegis does not show any message when switching fighting style @@ -12570,7 +12570,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case SU_HISS: case SU_PURRING: case SU_MEOWMEOW: - if (sd == NULL || sd->status.party_id == 0 || flag&1) { + if (sd == nullptr || sd->status.party_id == 0 || flag&1) { int duration = skill_get_time(skill_id, skill_lv); if (skill_id == SU_BUNCHOFSHRIMP && pc_checkskill(sd, SU_SPIRITOFSEA)) @@ -12582,7 +12582,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case SU_SHRIMPARTY: - if (sd == NULL || sd->status.party_id == 0 || flag&1) { + if (sd == nullptr || sd->status.party_id == 0 || flag&1) { sc_start(src, bl, type, 100, skill_lv, skill_get_time(skill_id, skill_lv)); if (sd && (i = pc_checkskill(sd, SU_FRESHSHRIMP)) > 0) { clif_skill_nodamage(bl, bl, SU_FRESHSHRIMP, i, 1); @@ -13064,7 +13064,7 @@ static int8 skill_castend_id_check(struct block_list *src, struct block_list *ta break; case RA_WUGSTRIKE: // Check if path can be reached - if (!path_search(NULL,src->m,src->x,src->y,target->x,target->y,1,CELL_CHKNOREACH)) + if (!path_search(nullptr,src->m,src->x,src->y,target->x,target->y,1,CELL_CHKNOREACH)) return USESKILL_FAIL_MAX; break; case MG_NAPALMBEAT: @@ -13170,16 +13170,16 @@ TIMER_FUNC(skill_castend_id){ int flag = 0; src = map_id2bl(id); - if( src == NULL ) + if( src == nullptr ) { - ShowDebug("skill_castend_id: src == NULL (tid=%d, id=%d)\n", tid, id); + ShowDebug("skill_castend_id: src == nullptr (tid=%d, id=%d)\n", tid, id); return 0;// not found } ud = unit_bl2ud(src); - if( ud == NULL ) + if( ud == nullptr ) { - ShowDebug("skill_castend_id: ud == NULL (tid=%d, id=%d)\n", tid, id); + ShowDebug("skill_castend_id: ud == nullptr (tid=%d, id=%d)\n", tid, id); return 0;// ??? } @@ -13187,7 +13187,7 @@ TIMER_FUNC(skill_castend_id){ md = BL_CAST(BL_MOB, src); status_change *sc = status_get_sc(src); - if( src->prev == NULL ) { + if( src->prev == nullptr ) { ud->skilltimer = INVALID_TIMER; return 0; } @@ -13217,7 +13217,7 @@ TIMER_FUNC(skill_castend_id){ bool fail = false; int8 res = USESKILL_FAIL_LEVEL; - if (!target || target->prev == NULL) + if (!target || target->prev == nullptr) break; if (src->m != target->m || status_isdead(src)) @@ -13310,7 +13310,7 @@ TIMER_FUNC(skill_castend_id){ break; } #ifdef OFFICIAL_WALKPATH - if(skill_get_casttype(ud->skill_id) != CAST_NODAMAGE && !path_search_long(NULL, src->m, src->x, src->y, target->x, target->y, CELL_CHKWALL)) + if(skill_get_casttype(ud->skill_id) != CAST_NODAMAGE && !path_search_long(nullptr, src->m, src->x, src->y, target->x, target->y, CELL_CHKWALL)) { if (sd) { clif_skill_fail( *sd, ud->skill_id ); @@ -13536,7 +13536,7 @@ TIMER_FUNC(skill_castend_pos){ sd = BL_CAST(BL_PC , src); md = BL_CAST(BL_MOB, src); - if( src->prev == NULL ) { + if( src->prev == nullptr ) { ud->skilltimer = INVALID_TIMER; return 0; } @@ -13564,7 +13564,7 @@ TIMER_FUNC(skill_castend_pos){ if(tid != INVALID_TIMER) { //Avoid double checks on instant cast skills. [Skotlex] - if (!status_check_skilluse(src, NULL, ud->skill_id, 1)) + if (!status_check_skilluse(src, nullptr, ud->skill_id, 1)) break; if (battle_config.skill_add_range && !check_distance_blxy(src, ud->skillx, ud->skilly, skill_get_range2(src, ud->skill_id, ud->skill_lv, true) + battle_config.skill_add_range)) { @@ -13696,7 +13696,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui sc = status_get_sc(src); type = skill_get_sc(skill_id); - sce = (sc && type != SC_NONE)?sc->getSCE(type):NULL; + sce = (sc && type != SC_NONE)?sc->getSCE(type):nullptr; switch (skill_id) { //Skill effect. case WZ_METEOR: @@ -13745,7 +13745,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui i = skill_get_splash(skill_id, skill_lv); map_foreachinallarea( status_change_timer_sub, src->m, x-i, y-i, x+i,y+i,BL_CHAR, - src,NULL,SC_SIGHT,tick); + src,nullptr,SC_SIGHT,tick); skill_reveal_trap_inarea(src, i, x, y); break; @@ -13767,7 +13767,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case SA_VIOLENTGALE: { //Does not consumes if the skill is already active. [Skotlex] std::shared_ptr sg2; - if ((sg2= skill_locate_element_field(src)) != NULL && ( sg2->skill_id == SA_VOLCANO || sg2->skill_id == SA_DELUGE || sg2->skill_id == SA_VIOLENTGALE )) + if ((sg2= skill_locate_element_field(src)) != nullptr && ( sg2->skill_id == SA_VOLCANO || sg2->skill_id == SA_DELUGE || sg2->skill_id == SA_VIOLENTGALE )) { if (sg2->limit - DIFF_TICK(gettick(), sg2->tick) > 0) { @@ -14074,7 +14074,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui struct s_skill_condition require = skill_get_requirement(sd, skill_id, skill_lv); i_lv = skill_lv%11 - 1; j = pc_search_inventory(sd, require.itemid[i_lv]); - if (j < 0 || require.itemid[i_lv] <= 0 || sd->inventory_data[j] == NULL || sd->inventory.u.items_inventory[j].amount < require.amount[i_lv]) + if (j < 0 || require.itemid[i_lv] <= 0 || sd->inventory_data[j] == nullptr || sd->inventory.u.items_inventory[j].amount < require.amount[i_lv]) { clif_skill_fail( *sd, skill_id ); return 1; @@ -14164,7 +14164,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui if (rnd()%100 < 50) { clif_skill_fail( *sd, skill_id ); } else { - TBL_MOB* md = NULL; + TBL_MOB* md = nullptr; int t, mob_id; if (skill_lv == 1) @@ -14312,7 +14312,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui return 0; } skill_clear_unitgroup(src); // To remove previous skills - cannot used combined - if( (sg = skill_unitsetting(src,skill_id,skill_lv,src->x,src->y,0)) != NULL ) { + if( (sg = skill_unitsetting(src,skill_id,skill_lv,src->x,src->y,0)) != nullptr ) { sc_start2(src,src,skill_id == NC_NEUTRALBARRIER ? SC_NEUTRALBARRIER_MASTER : SC_STEALTHFIELD_MASTER,100,skill_lv,sg->group_id,skill_get_time(skill_id,skill_lv)); } break; @@ -14362,7 +14362,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case LG_BANDING: if( sc && sc->getSCE(SC_BANDING) ) status_change_end(src,SC_BANDING); - else if( (sg = skill_unitsetting(src,skill_id,skill_lv,src->x,src->y,0)) != NULL ) + else if( (sg = skill_unitsetting(src,skill_id,skill_lv,src->x,src->y,0)) != nullptr ) sc_start4(src,src,SC_BANDING,100,skill_lv,0,0,sg->group_id,skill_get_time(skill_id,skill_lv)); clif_skill_nodamage(src,src,skill_id,skill_lv,1); break; @@ -14416,7 +14416,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui break; case 2: map_foreachinallarea(skill_area_sub, src->m, su->bl.x - 2, su->bl.y - 2, su->bl.x + 2, su->bl.y + 2, BL_CHAR, src, GN_DEMONIC_FIRE, skill_lv + 20, tick, flag | BCT_ENEMY | SD_LEVEL | 1, skill_castend_damage_id); - if (su != NULL) + if (su != nullptr) skill_delunit(su); break; case 3: @@ -14435,7 +14435,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui if (sd && pc_checkskill(sd, CR_ACIDDEMONSTRATION) > 5) acid_lv = pc_checkskill(sd, CR_ACIDDEMONSTRATION); map_foreachinallarea(skill_area_sub, src->m, su->bl.x - 2, su->bl.y - 2, su->bl.x + 2, su->bl.y + 2, BL_CHAR, src, GN_FIRE_EXPANSION_ACID, acid_lv, tick, flag | BCT_ENEMY | SD_LEVEL | 1, skill_castend_damage_id); - if (su != NULL) + if (su != nullptr) skill_delunit(su); } break; @@ -14725,7 +14725,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui {// consume arrow if this is a ground skill battle_consume_ammo(sd, skill_id, skill_lv); } - skill_onskillusage(sd, NULL, skill_id, tick); + skill_onskillusage(sd, nullptr, skill_id, tick); // perform skill requirement consumption if (!(flag&SKILL_NOCONSUME_REQ)) skill_consume_requirement(sd,skill_id,skill_lv,2); @@ -14746,7 +14746,7 @@ int skill_castend_map (map_session_data *sd, uint16 skill_id, const char *mapnam if(skill_id != sd->menuskill_id) return 0; - if( sd->bl.prev == NULL || pc_isdead(sd) ) { + if( sd->bl.prev == nullptr || pc_isdead(sd) ) { skill_failed(sd); return 0; } @@ -15442,7 +15442,7 @@ std::shared_ptr skill_unitsetting(struct block_list *src, ui if( !group->state.song_dance && !map_getcell(src->m,ux,uy,CELL_CHKREACH) ) continue; // don't place skill units on walls (except for songs/dances/encores) - if( battle_config.skill_wall_check && skill->unit_flag[UF_PATHCHECK] && !path_search_long(NULL,src->m,ux,uy,src->x,src->y,CELL_CHKWALL) ) + if( battle_config.skill_wall_check && skill->unit_flag[UF_PATHCHECK] && !path_search_long(nullptr,src->m,ux,uy,src->x,src->y,CELL_CHKWALL) ) continue; // no path between cell and caster switch( skill_id ) { @@ -15479,7 +15479,7 @@ std::shared_ptr skill_unitsetting(struct block_list *src, ui case WZ_WATERBALL: //Check if there are cells that can be turned into waterball units if (!sd || map_getcell(src->m, ux, uy, CELL_CHKWATER) - || (map_find_skill_unit_oncell(src, ux, uy, SA_DELUGE, NULL, 1)) != NULL || (map_find_skill_unit_oncell(src, ux, uy, NJ_SUITON, NULL, 1)) != NULL) + || (map_find_skill_unit_oncell(src, ux, uy, SA_DELUGE, nullptr, 1)) != nullptr || (map_find_skill_unit_oncell(src, ux, uy, NJ_SUITON, nullptr, 1)) != nullptr) break; //Turn water, deluge or suiton into waterball cell continue; case GS_DESPERADO: @@ -15587,7 +15587,7 @@ static int skill_unit_onplace(struct skill_unit *unit, struct block_list *bl, t_ nullpo_ret(unit); nullpo_ret(bl); - if(bl->prev == NULL || !unit->alive || status_isdead(bl)) + if(bl->prev == nullptr || !unit->alive || status_isdead(bl)) return 0; std::shared_ptr sg = unit->group; @@ -15620,7 +15620,7 @@ static int skill_unit_onplace(struct skill_unit *unit, struct block_list *bl, t_ return 0; // Under Hovering characters are immune to select trap and ground target skills. type = skill_get_sc(sg->skill_id); - sce = (sc && type != SC_NONE) ? sc->getSCE(type) : NULL; + sce = (sc && type != SC_NONE) ? sc->getSCE(type) : nullptr; skill_id = sg->skill_id; //In case the group is deleted, we need to return the correct skill id, still. switch (sg->unit_id) { case UNT_SPIDERWEB: @@ -15652,13 +15652,13 @@ static int skill_unit_onplace(struct skill_unit *unit, struct block_list *bl, t_ else if (sc->getSCE(type)->val4 == 0) sc->getSCE(type)->val4 = sg->group_id; //Overwrite status change with new duration - if ((td = get_timer(sc->getSCE(type)->timer))!=NULL) + if ((td = get_timer(sc->getSCE(type)->timer))!=nullptr) status_change_start(ss, bl, type, 10000, sc->getSCE(type)->val1 + 1, sc->getSCE(type)->val2, sc->getSCE(type)->val3, sc->getSCE(type)->val4, i64max(DIFF_TICK(td->tick, tick), sec), SCSTART_NORATEDEF); } else { if (status_change_start(ss, bl, type, 10000, 1, sg->group_id, 0, 0, sec, SCSTART_NORATEDEF)) { - td = sc->getSCE(type) ? get_timer(sc->getSCE(type)->timer) : NULL; + td = sc->getSCE(type) ? get_timer(sc->getSCE(type)->timer) : nullptr; if (td) sec = DIFF_TICK(td->tick, tick); map_moveblock(bl, unit->bl.x, unit->bl.y, tick); @@ -15935,7 +15935,7 @@ int skill_unit_onplace_timer(struct skill_unit *unit, struct block_list *bl, t_t nullpo_ret(unit); nullpo_ret(bl); - if (bl->prev == NULL || !unit->alive || status_isdead(bl)) + if (bl->prev == nullptr || !unit->alive || status_isdead(bl)) return 0; std::shared_ptr sg = unit->group; @@ -16195,7 +16195,7 @@ int skill_unit_onplace_timer(struct skill_unit *unit, struct block_list *bl, t_t } if( status_change_start(ss, bl,type,10000,sg->skill_lv,sg->group_id,0,0,sec, SCSTART_NORATEDEF) ) { - const struct TimerData* td = tsc->getSCE(type)?get_timer(tsc->getSCE(type)->timer):NULL; + const struct TimerData* td = tsc->getSCE(type)?get_timer(tsc->getSCE(type)->timer):nullptr; if( td ) sec = DIFF_TICK(td->tick, tick); @@ -16419,7 +16419,7 @@ int skill_unit_onplace_timer(struct skill_unit *unit, struct block_list *bl, t_t sc_start2(ss, bl, SC_POISON, 100, 1, ss->id, 1800000); //30 minutes break; case 5: // Level 10 Provoke - clif_skill_nodamage(NULL, bl, SM_PROVOKE, 10, sc_start(ss, bl, SC_PROVOKE, 100, 10, INFINITE_TICK)); //Infinite + clif_skill_nodamage(nullptr, bl, SM_PROVOKE, 10, sc_start(ss, bl, SC_PROVOKE, 100, 10, INFINITE_TICK)); //Infinite break; case 6: // DEF -100% sc_start(ss, bl, SC_INCDEFRATE, 100, -100, 20000); //20 seconds @@ -16540,7 +16540,7 @@ int skill_unit_onplace_timer(struct skill_unit *unit, struct block_list *bl, t_t if( !sg->val2 ) { t_tick sec = skill_get_time2(sg->skill_id, sg->skill_lv); if( sc_start(ss, bl, type, 100, sg->skill_lv, sec) ) { - const struct TimerData* td = tsc->getSCE(type)?get_timer(tsc->getSCE(type)->timer):NULL; + const struct TimerData* td = tsc->getSCE(type)?get_timer(tsc->getSCE(type)->timer):nullptr; if( td ) sec = DIFF_TICK(td->tick, tick); ///map_moveblock(bl, src->bl.x, src->bl.y, tick); // in official server it doesn't behave like this. [malufett] @@ -16743,9 +16743,9 @@ int skill_unit_onout(struct skill_unit *src, struct block_list *bl, t_tick tick) sc = status_get_sc(bl); type = skill_get_sc(sg->skill_id); - sce = (sc && type != SC_NONE)?sc->getSCE(type):NULL; + sce = (sc && type != SC_NONE)?sc->getSCE(type):nullptr; - if (bl->prev == NULL || (status_isdead(bl) && sg->unit_id != UNT_ANKLESNARE)) //Need to delete the trap if the source died. + if (bl->prev == nullptr || (status_isdead(bl) && sg->unit_id != UNT_ANKLESNARE)) //Need to delete the trap if the source died. return 0; switch(sg->unit_id){ @@ -16774,7 +16774,7 @@ int skill_unit_onout(struct skill_unit *src, struct block_list *bl, t_tick tick) for(uint16 i = BA_WHISTLE; i <= DC_SERVICEFORYOU; i++) { if(skill_get_inf2(i, INF2_ISSONG)) { type = skill_get_sc(i); - sce = (sc && type != SC_NONE)?sc->getSCE(type):NULL; + sce = (sc && type != SC_NONE)?sc->getSCE(type):nullptr; if(sce) return i; } @@ -16809,10 +16809,10 @@ int skill_unit_onleft(uint16 skill_id, struct block_list *bl, t_tick tick) sc = status_get_sc(bl); if (sc && !sc->count) - sc = NULL; + sc = nullptr; type = skill_get_sc(skill_id); - sce = (sc && type != SC_NONE)?sc->getSCE(type):NULL; + sce = (sc && type != SC_NONE)?sc->getSCE(type):nullptr; switch (skill_id) { @@ -16879,7 +16879,7 @@ int skill_unit_onleft(uint16 skill_id, struct block_list *bl, t_tick tick) for(uint16 i = BA_WHISTLE; i <= DC_SERVICEFORYOU; i++){ if(skill_get_inf2(i, INF2_ISSONG)){ type = skill_get_sc(i); - sce = (sc && type != SC_NONE)?sc->getSCE(type):NULL; + sce = (sc && type != SC_NONE)?sc->getSCE(type):nullptr; if(sce && !sce->val4){ //We don't want dissonance updating this anymore delete_timer(sce->timer, status_change_timer); sce->val4 = 1; //Store the fact that this is a "reduced" duration effect. @@ -16949,7 +16949,7 @@ static int skill_unit_effect(struct block_list* bl, va_list ap) bool dissonance = false; bool isTarget = false; - if( (!unit->alive && !(flag&4)) || bl->prev == NULL ) + if( (!unit->alive && !(flag&4)) || bl->prev == nullptr ) return 0; std::shared_ptr group = unit->group; @@ -17158,12 +17158,12 @@ int skill_check_pc_partner(map_session_data *sd, uint16 skill_id, uint16 *skill_ case PR_BENEDICTIO: case WM_GREAT_ECHO: for (i = 0; i < c; i++) { - if ((tsd = map_id2sd(p_sd[i])) != NULL) + if ((tsd = map_id2sd(p_sd[i])) != nullptr) status_charge(&tsd->bl, 0, (skill_id == PR_BENEDICTIO) ? 10 : skill_get_sp(skill_id, *skill_lv) / 2); } return c; case AB_ADORAMUS: - if( c > 0 && (tsd = map_id2sd(p_sd[0])) != NULL ) { + if( c > 0 && (tsd = map_id2sd(p_sd[0])) != nullptr ) { i = 2 * (*skill_lv); status_charge(&tsd->bl, 0, i); } @@ -17172,7 +17172,7 @@ int skill_check_pc_partner(map_session_data *sd, uint16 skill_id, uint16 *skill_ if( is_chorus ) break;//Chorus skills are not to be parsed as ensembles if (skill_get_inf2(skill_id, INF2_ISENSEMBLE)) { - if (c > 0 && sd->sc.getSCE(SC_DANCING) && (tsd = map_id2sd(p_sd[0])) != NULL) { + if (c > 0 && sd->sc.getSCE(SC_DANCING) && (tsd = map_id2sd(p_sd[0])) != nullptr) { sd->sc.getSCE(SC_DANCING)->val4 = tsd->bl.id; sc_start4(&sd->bl,&tsd->bl,SC_DANCING,100,skill_id,sd->sc.getSCE(SC_DANCING)->val2,*skill_lv,sd->bl.id,skill_get_time(skill_id,*skill_lv)+1000); clif_skill_nodamage(&tsd->bl, &sd->bl, skill_id, *skill_lv, 1); @@ -17417,7 +17417,7 @@ bool skill_check_condition_castbegin( map_session_data& sd, uint16 skill_id, uin { // When a target was selected, consume items that were skipped in pc_use_item [Skotlex] if( (i = sd.itemindex) == -1 || sd.inventory.u.items_inventory[i].nameid != sd.itemid || - sd.inventory_data[i] == NULL || + sd.inventory_data[i] == nullptr || sd.inventory_data[i]->flag.delay_consume == DELAYCONSUME_NONE || sd.inventory.u.items_inventory[i].amount < 1 ) @@ -18727,7 +18727,7 @@ void skill_consume_requirement(map_session_data *sd, uint16 skill_id, uint16 ski int n,i; if( !sc->count ) - sc = NULL; + sc = nullptr; for( i = 0; i < MAX_SKILL_ITEM_REQUIRE; ++i ) { @@ -18789,7 +18789,7 @@ struct s_skill_condition skill_get_requirement(map_session_data* sd, uint16 skil sc = &sd->sc; if( !sc->count ) - sc = NULL; + sc = nullptr; //Checks if disabling skill - in which case no SP requirements are necessary if( sc && skill_disable_check(*sc,skill_id) ) @@ -19986,7 +19986,7 @@ int skill_attack_area(struct block_list *bl, va_list ap) } if(battle_check_target(dsrc,bl,type) <= 0 || - !status_check_skilluse(NULL, bl, skill_id, 2)) + !status_check_skilluse(nullptr, bl, skill_id, 2)) return 0; switch (skill_id) { @@ -20108,12 +20108,12 @@ std::shared_ptr skill_locate_element_field(struct block_list /// Graffiti cleaner [Valaris] int skill_graffitiremover(struct block_list *bl, va_list ap) { - struct skill_unit *unit = NULL; + struct skill_unit *unit = nullptr; int remove = va_arg(ap, int); nullpo_retr(0, bl); - if (bl->type != BL_SKILL || (unit = (struct skill_unit *)bl) == NULL) + if (bl->type != BL_SKILL || (unit = (struct skill_unit *)bl) == nullptr) return 0; if ((unit->group) && (unit->group->unit_id == UNT_GRAFFITI)) { @@ -20129,8 +20129,8 @@ int skill_graffitiremover(struct block_list *bl, va_list ap) int skill_greed(struct block_list *bl, va_list ap) { struct block_list *src; - map_session_data *sd = NULL; - struct flooritem_data *fitem = NULL; + map_session_data *sd = nullptr; + struct flooritem_data *fitem = nullptr; nullpo_ret(bl); nullpo_ret(src = va_arg(ap, struct block_list *)); @@ -20213,8 +20213,8 @@ int skill_banding_count(map_session_data *sd) * @author [Cydh] */ static int skill_bind_trap(struct block_list *bl, va_list ap) { - struct skill_unit *su = NULL; - struct block_list *src = NULL; + struct skill_unit *su = nullptr; + struct block_list *src = nullptr; nullpo_ret(bl); @@ -20247,7 +20247,7 @@ static int skill_cell_overlap(struct block_list *bl, va_list ap) alive = va_arg(ap,int *); unit = (struct skill_unit *)bl; - if (unit == NULL || unit->group == NULL || (*alive) == 0) + if (unit == nullptr || unit->group == nullptr || (*alive) == 0) return 0; if (unit->group->state.guildaura) /* guild auras are not cancelled! */ @@ -20375,7 +20375,7 @@ static int skill_cell_overlap(struct block_list *bl, va_list ap) static int skill_trap_splash(struct block_list *bl, va_list ap) { struct block_list *src = va_arg(ap,struct block_list *); - struct skill_unit *unit = NULL; + struct skill_unit *unit = nullptr; t_tick tick = va_arg(ap,t_tick); struct block_list *ss; //Skill src bl @@ -20383,7 +20383,7 @@ static int skill_trap_splash(struct block_list *bl, va_list ap) unit = (struct skill_unit *)src; - if (!unit || !unit->alive || bl->prev == NULL) + if (!unit || !unit->alive || bl->prev == nullptr) return 0; std::shared_ptr sg = unit->group; @@ -20513,7 +20513,7 @@ int skill_maelstrom_suction(struct block_list *bl, va_list ap) skill_lv = va_arg(ap,int); unit = (struct skill_unit *)bl; - if( unit == NULL || unit->group == NULL ) + if( unit == nullptr || unit->group == nullptr ) return 0; if( skill_get_inf2(skill_id, INF2_ISTRAP) ) @@ -20653,8 +20653,8 @@ bool skill_check_camouflage(struct block_list *bl, struct status_change_entry *s * @author [Cydh] **/ int skill_getareachar_skillunit_visibilty_sub(struct block_list *bl, va_list ap) { - struct skill_unit *su = NULL; - struct block_list *src = NULL; + struct skill_unit *su = nullptr; + struct block_list *src = nullptr; unsigned int party1 = 0; bool visible = true; @@ -20701,7 +20701,7 @@ void skill_getareachar_skillunit_visibilty(struct skill_unit *su, enum send_targ **/ void skill_getareachar_skillunit_visibilty_single(struct skill_unit *su, struct block_list *bl) { bool visible = true; - struct block_list *src = NULL; + struct block_list *src = nullptr; nullpo_retv(bl); nullpo_retv(su); @@ -20758,7 +20758,7 @@ struct skill_unit *skill_initunit(std::shared_ptr group, int idb_put(skillunit_db, unit->bl.id, unit); map_addiddb(&unit->bl); if(map_addblock(&unit->bl)) - return NULL; + return nullptr; // Perform oninit actions switch (group->skill_id) { @@ -20858,7 +20858,7 @@ int skill_delunit(struct skill_unit* unit) clif_skill_delunit(unit); - unit->group=NULL; + unit->group=nullptr; map_delblock(&unit->bl); // don't free yet map_deliddb(&unit->bl); idb_remove(skillunit_db, unit->bl.id); @@ -20884,7 +20884,7 @@ static int skill_unit_group_newid = MAX_SKILL; /// Skill Unit Group ID */ static int skill_get_new_group_id(void) { - if( skill_unit_group_newid >= MAX_SKILL && skill_id2group(skill_unit_group_newid) == NULL ) + if( skill_unit_group_newid >= MAX_SKILL && skill_id2group(skill_unit_group_newid) == nullptr ) return skill_unit_group_newid++;// available {// find next id int base_id = skill_unit_group_newid; @@ -20892,7 +20892,7 @@ static int skill_get_new_group_id(void) { if( skill_unit_group_newid < MAX_SKILL ) skill_unit_group_newid = MAX_SKILL; - if( skill_id2group(skill_unit_group_newid) == NULL ) + if( skill_id2group(skill_unit_group_newid) == nullptr ) return skill_unit_group_newid++;// available } // full loop, nothing available @@ -20969,7 +20969,7 @@ int skill_delunitgroup_(std::shared_ptr group, const char* f int link_group_id; if( group == nullptr ) { - ShowDebug("skill_delunitgroup: group is NULL (source=%s:%d, %s)! Please report this! (#3504)\n", file, line, func); + ShowDebug("skill_delunitgroup: group is nullptr (source=%s:%d, %s)! Please report this! (#3504)\n", file, line, func); return 0; } @@ -21030,7 +21030,7 @@ int skill_delunitgroup_(std::shared_ptr group, const char* f status_change *sc; bool removed = true; //Clear group id from status change - if (target && (sc = status_get_sc(target)) != NULL && sc->getSCE(SC_SPIDERWEB)) { + if (target && (sc = status_get_sc(target)) != nullptr && sc->getSCE(SC_SPIDERWEB)) { if (sc->getSCE(SC_SPIDERWEB)->val2 == group->group_id) sc->getSCE(SC_SPIDERWEB)->val2 = 0; else if (sc->getSCE(SC_SPIDERWEB)->val3 == group->group_id) @@ -21068,8 +21068,8 @@ int skill_delunitgroup_(std::shared_ptr group, const char* f break; case NC_NEUTRALBARRIER: { - status_change *sc = NULL; - if( (sc = status_get_sc(src)) != NULL ) { + status_change *sc = nullptr; + if( (sc = status_get_sc(src)) != nullptr ) { if ( sc->getSCE(SC_NEUTRALBARRIER_MASTER) ) { sc->getSCE(SC_NEUTRALBARRIER_MASTER)->val2 = 0; @@ -21081,8 +21081,8 @@ int skill_delunitgroup_(std::shared_ptr group, const char* f break; case NC_STEALTHFIELD: { - status_change *sc = NULL; - if( (sc = status_get_sc(src)) != NULL && sc->getSCE(SC_STEALTHFIELD_MASTER) ) { + status_change *sc = nullptr; + if( (sc = status_get_sc(src)) != nullptr && sc->getSCE(SC_STEALTHFIELD_MASTER) ) { sc->getSCE(SC_STEALTHFIELD_MASTER)->val2 = 0; status_change_end(src,SC_STEALTHFIELD_MASTER); } @@ -21096,14 +21096,14 @@ int skill_delunitgroup_(std::shared_ptr group, const char* f group->alive_count=0; // remove all unit cells - if(group->unit != NULL) + if(group->unit != nullptr) for( int j = 0; j < group->unit_count; j++ ) skill_delunit(&group->unit[j]); // clear Talkie-box string - if( group->valstr != NULL ) { + if( group->valstr != nullptr ) { aFree(group->valstr); - group->valstr = NULL; + group->valstr = nullptr; } link_group_id = group->link_group_id; @@ -21156,11 +21156,11 @@ struct skill_unit_group_tickset *skill_unitgrouptickset_search(struct block_list nullpo_ret(bl); if (group->interval == -1) - return NULL; + return nullptr; ud = unit_bl2ud(bl); if (!ud) - return NULL; + return nullptr; set = ud->skillunittick; @@ -21198,7 +21198,7 @@ int skill_unit_timer_sub_onplace(struct block_list* bl, va_list ap) nullpo_ret(unit); - if( !unit->alive || bl->prev == NULL ) + if( !unit->alive || bl->prev == nullptr ) return 0; std::shared_ptr group = unit->group; @@ -21297,7 +21297,7 @@ static int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) case UNT_ICEBOUNDTRAP: { struct block_list* src; - if( unit->val1 > 0 && (src = map_id2bl(group->src_id)) != NULL && src->type == BL_PC ) + if( unit->val1 > 0 && (src = map_id2bl(group->src_id)) != nullptr && src->type == BL_PC ) { // revert unit back into a trap struct item item_tmp; memset(&item_tmp,0,sizeof(item_tmp)); @@ -21322,7 +21322,7 @@ static int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) case UNT_CALLFAMILY: { - map_session_data *sd = NULL; + map_session_data *sd = nullptr; if(group->val1) { sd = map_charid2sd(group->val1); group->val1 = 0; @@ -21366,7 +21366,7 @@ static int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) { struct block_list *src = map_id2bl(group->src_id); status_change *sc; - if( !src || (sc = status_get_sc(src)) == NULL || !sc->getSCE(SC_BANDING) ) { + if( !src || (sc = status_get_sc(src)) == nullptr || !sc->getSCE(SC_BANDING) ) { skill_delunit(unit); break; } @@ -21537,7 +21537,7 @@ int skill_unit_move_sub(struct block_list* bl, va_list ap) nullpo_ret(unit); nullpo_ret(target); - if( !unit->alive || target->prev == NULL ) + if( !unit->alive || target->prev == nullptr ) return 0; std::shared_ptr group = unit->group; @@ -21623,7 +21623,7 @@ int skill_unit_move(struct block_list *bl, t_tick tick, int flag) { nullpo_ret(bl); - if( bl->prev == NULL ) + if( bl->prev == nullptr ) return 0; if( flag&2 && !(flag&1) ) //Onout, clear data @@ -21688,13 +21688,13 @@ void skill_unit_move_unit_group(std::shared_ptr group, int16 struct skill_unit *unit1; struct skill_unit *unit2; - if (group == NULL) + if (group == nullptr) return; if (group->unit_count <= 0) return; - if (group->unit == NULL) + if (group->unit == nullptr) return; if (skill_get_unit_flag(group->skill_id, UF_ENSEMBLE)) @@ -22439,7 +22439,7 @@ bool skill_produce_mix(map_session_data *sd, uint16 skill_id, t_itemid nameid, i } else { switch (skill_id) { case ASC_CDP: //25% Damage yourself, and display same effect as failed potion. - status_percent_damage(NULL, &sd->bl, -25, 0, true); + status_percent_damage(nullptr, &sd->bl, -25, 0, true); [[fallthrough]]; case AM_PHARMACY: case AM_TWILIGHT1: @@ -22961,7 +22961,7 @@ TIMER_FUNC(skill_blockpc_end){ } aFree(sd->scd[i]); - sd->scd[i] = NULL; + sd->scd[i] = nullptr; return 1; } @@ -22985,7 +22985,7 @@ int skill_blockpc_start(map_session_data *sd, int skill_id, t_tick tick) { if (i < MAX_SKILLCOOLDOWN) { // Skill already with cooldown delete_timer(sd->scd[i]->timer, skill_blockpc_end); aFree(sd->scd[i]); - sd->scd[i] = NULL; + sd->scd[i] = nullptr; } ARR_FIND(0, MAX_SKILLCOOLDOWN, i, !sd->scd[i]); @@ -23014,7 +23014,7 @@ int skill_blockpc_clear(map_session_data *sd) { continue; delete_timer(sd->scd[i]->timer, skill_blockpc_end); aFree(sd->scd[i]); - sd->scd[i] = NULL; + sd->scd[i] = nullptr; } return 1; } @@ -23090,7 +23090,7 @@ int skill_blockmerc_start(s_mercenary_data *md, uint16 skill_id, int tick) */ void skill_usave_add(map_session_data *sd, uint16 skill_id, uint16 skill_lv) { - struct skill_usave *sus = NULL; + struct skill_usave *sus = nullptr; if (idb_exists(skillusave_db,sd->status.char_id)) idb_remove(skillusave_db,sd->status.char_id); diff --git a/src/map/status.cpp b/src/map/status.cpp index 2baf9715fe..3b7359bea3 100644 --- a/src/map/status.cpp +++ b/src/map/status.cpp @@ -1392,7 +1392,7 @@ int64 status_charge(struct block_list* bl, int64 hp, int64 sp) { if(!(bl->type&BL_CONSUME)) return (int)hp+sp; // Assume all was charged so there are no 'not enough' fails. - return status_damage(NULL, bl, hp, sp, 0, 3, 0); + return status_damage(nullptr, bl, hp, sp, 0, 3, 0); } /** @@ -1714,12 +1714,12 @@ int status_heal(struct block_list *bl,int64 hhp,int64 hsp, int64 hap, int flag) sc = status_get_sc(bl); if (sc && !sc->count) - sc = NULL; + sc = nullptr; if (hp < 0) { if (hp == INT_MIN) // -INT_MIN == INT_MIN in some architectures! hp++; - status_damage(NULL, bl, -hp, 0, 0, 1, 0); + status_damage(nullptr, bl, -hp, 0, 0, 1, 0); hp = 0; } @@ -1738,7 +1738,7 @@ int status_heal(struct block_list *bl,int64 hhp,int64 hsp, int64 hap, int flag) if(sp < 0) { if (sp == INT_MIN) sp++; - status_damage(NULL, bl, 0, -sp, 0, 1, 0); + status_damage(nullptr, bl, 0, -sp, 0, 1, 0); sp = 0; } @@ -1928,9 +1928,9 @@ int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per * Checks whether the src can use the skill on the target, * taking into account status/option of both source/target * @param src: Object using skill on target [PC|MOB|PET|HOM|MER|ELEM] - src MAY be NULL to indicate we shouldn't check it, this is a ground-based skill attack + src MAY be nullptr to indicate we shouldn't check it, this is a ground-based skill attack * @param target: Object being targeted by src [PC|MOB|HOM|MER|ELEM] - target MAY be NULL, which checks if src can cast skill_id on the ground + target MAY be nullptr, which checks if src can cast skill_id on the ground * @param skill_id: Skill ID being used on target * @param flag: 0 - Trying to use skill on target * 1 - Cast bar is done @@ -2684,7 +2684,7 @@ void status_calc_misc(struct block_list *bl, struct status_data *status, int lev int status_calc_mob_(struct mob_data* md, uint8 opt) { struct status_data *status; - struct block_list *mbl = NULL; + struct block_list *mbl = nullptr; int flag=0; if (opt&SCO_FIRST) { // Set basic level on respawn. @@ -2719,7 +2719,7 @@ int status_calc_mob_(struct mob_data* md, uint8 opt) if (!flag) { // No special status required. if (md->base_status) { aFree(md->base_status); - md->base_status = NULL; + md->base_status = nullptr; } if (opt&SCO_FIRST) memcpy(&md->status, &md->db->status, sizeof(struct status_data)); @@ -3535,7 +3535,7 @@ bool status_calc_weight(map_session_data *sd, enum e_status_calc_weight_opt flag sd->weight = 0; // Reset current weight for(i = 0; i < MAX_INVENTORY; i++) { - if (!sd->inventory.u.items_inventory[i].nameid || sd->inventory_data[i] == NULL) + if (!sd->inventory.u.items_inventory[i].nameid || sd->inventory_data[i] == nullptr) continue; sd->weight += sd->inventory_data[i]->weight * sd->inventory.u.items_inventory[i].amount; } @@ -7902,7 +7902,7 @@ static unsigned short status_calc_speed(struct block_list *bl, status_change *sc TBL_PC* sd = BL_CAST(BL_PC, bl); int speed_rate = 100; - if (sc == NULL || (sd && sd->state.permanent_speed)) + if (sc == nullptr || (sd && sd->state.permanent_speed)) return (unsigned short)cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED); if (sd && pc_ismadogear(sd)) { // Mado speed is not affected by other statuses @@ -8833,20 +8833,20 @@ void status_calc_slave_mode(struct mob_data *md, struct mob_data *mmd) switch (battle_config.slaves_inherit_mode) { case 1: //Always aggressive if (!status_has_mode(&md->status,MD_AGGRESSIVE)) - sc_start4(NULL, &md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 0); + sc_start4(nullptr, &md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 0); break; case 2: //Always passive if (status_has_mode(&md->status,MD_AGGRESSIVE)) - sc_start4(NULL, &md->bl, SC_MODECHANGE, 100, 1, 0, 0, MD_AGGRESSIVE, 0); + sc_start4(nullptr, &md->bl, SC_MODECHANGE, 100, 1, 0, 0, MD_AGGRESSIVE, 0); break; case 4: // Overwrite with slave mode - sc_start4(NULL, &md->bl, SC_MODECHANGE, 100, 1, MD_CANMOVE|MD_NORANDOMWALK|MD_CANATTACK, 0, 0, 0); + sc_start4(nullptr, &md->bl, SC_MODECHANGE, 100, 1, MD_CANMOVE|MD_NORANDOMWALK|MD_CANATTACK, 0, 0, 0); break; default: //Copy master if (status_has_mode(&mmd->status,MD_AGGRESSIVE)) - sc_start4(NULL, &md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 0); + sc_start4(nullptr, &md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 0); else - sc_start4(NULL, &md->bl, SC_MODECHANGE, 100, 1, 0, 0, MD_AGGRESSIVE, 0); + sc_start4(nullptr, &md->bl, SC_MODECHANGE, 100, 1, 0, 0, MD_AGGRESSIVE, 0); break; } } @@ -8914,18 +8914,18 @@ int status_get_lv(struct block_list *bl) /** * Gets the regeneration info of the given bl * @param bl: Object whose regen info to get [PC|HOM|MER|ELEM] - * @return regen data or NULL if any other bl->type than noted above + * @return regen data or nullptr if any other bl->type than noted above */ struct regen_data *status_get_regen_data(struct block_list *bl) { - nullpo_retr(NULL, bl); + nullpo_retr(nullptr, bl); switch (bl->type) { case BL_PC: return &((TBL_PC*)bl)->regen; case BL_HOM: return &((TBL_HOM*)bl)->regen; case BL_MER: return &((TBL_MER*)bl)->regen; case BL_ELEM: return &((TBL_ELEM*)bl)->regen; default: - return NULL; + return nullptr; } } @@ -8954,11 +8954,11 @@ struct status_data *status_get_status_data(struct block_list *bl) /** * Gets the base status data of the given bl * @param bl: Object whose status to get [PC|MOB|PET|HOM|MER|ELEM|NPC] - * @return base_status or NULL if any other bl->type than noted above + * @return base_status or nullptr if any other bl->type than noted above */ struct status_data *status_get_base_status(struct block_list *bl) { - nullpo_retr(NULL, bl); + nullpo_retr(nullptr, bl); switch (bl->type) { case BL_PC: return &((TBL_PC*)bl)->base_status; case BL_MOB: return ((TBL_MOB*)bl)->base_status ? ((TBL_MOB*)bl)->base_status : &((TBL_MOB*)bl)->db->status; @@ -8966,9 +8966,9 @@ struct status_data *status_get_base_status(struct block_list *bl) case BL_HOM: return &((TBL_HOM*)bl)->base_status; case BL_MER: return &((TBL_MER*)bl)->base_status; case BL_ELEM: return &((TBL_ELEM*)bl)->base_status; - case BL_NPC: return ((mobdb_checkid(((TBL_NPC*)bl)->class_) == 0) ? &((TBL_NPC*)bl)->status : NULL); + case BL_NPC: return ((mobdb_checkid(((TBL_NPC*)bl)->class_) == 0) ? &((TBL_NPC*)bl)->status : nullptr); default: - return NULL; + return nullptr; } } @@ -9020,7 +9020,7 @@ int status_get_party_id(struct block_list *bl) struct mob_data *md=(TBL_MOB*)bl; if( md->master_id > 0 ) { map_session_data *msd; - if (md->special_state.ai && (msd = map_id2sd(md->master_id)) != NULL) + if (md->special_state.ai && (msd = map_id2sd(md->master_id)) != nullptr) return msd->status.party_id; return -md->master_id; } @@ -9067,7 +9067,7 @@ int status_get_guild_id(struct block_list *bl) struct mob_data *md = (struct mob_data *)bl; if (md->guardian_data) // Guardian's guild [Skotlex] return md->guardian_data->guild_id; - if (md->special_state.ai && (msd = map_id2sd(md->master_id)) != NULL) + if (md->special_state.ai && (msd = map_id2sd(md->master_id)) != nullptr) return msd->status.guild_id; // Alchemist's mobs [Skotlex] } break; @@ -9116,7 +9116,7 @@ int status_get_emblem_id(struct block_list *bl) struct mob_data *md = (struct mob_data *)bl; if (md->guardian_data) // Guardian's guild [Skotlex] return md->guardian_data->emblem_id; - if (md->special_state.ai && (msd = map_id2sd(md->master_id)) != NULL) + if (md->special_state.ai && (msd = map_id2sd(md->master_id)) != nullptr) return msd->guild_emblem_id; // Alchemist's mobs [Skotlex] } break; @@ -9200,7 +9200,7 @@ int status_isimmune(struct block_list *bl) */ struct view_data* status_get_viewdata(struct block_list *bl) { - nullpo_retr(NULL, bl); + nullpo_retr(nullptr, bl); switch (bl->type) { case BL_PC: return &((TBL_PC*)bl)->vd; case BL_MOB: return ((TBL_MOB*)bl)->vd; @@ -9210,7 +9210,7 @@ struct view_data* status_get_viewdata(struct block_list *bl) case BL_MER: return ((TBL_MER*)bl)->vd; case BL_ELEM: return ((TBL_ELEM*)bl)->vd; } - return NULL; + return nullptr; } /** @@ -9235,7 +9235,7 @@ void status_set_viewdata(struct block_list *bl, int class_) else if (elemental_db.exists(class_)) vd = elemental_get_viewdata(class_); else - vd = NULL; + vd = nullptr; switch (bl->type) { case BL_PC: @@ -9395,7 +9395,7 @@ status_change *status_get_sc(struct block_list *bl) case BL_MER: return &((TBL_MER*)bl)->sc; case BL_ELEM: return &((TBL_ELEM*)bl)->sc; } - return NULL; + return nullptr; } /** @@ -9476,7 +9476,7 @@ t_tick status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_ map_session_data *sd; nullpo_ret(bl); - if (src == NULL) + if (src == nullptr) return tick?tick:1; // This should not happen in current implementation, but leave it anyway // Skills (magic type) that are blocked by Golden Thief Bug card or Wand of Hermod @@ -9498,7 +9498,7 @@ t_tick status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_ status_src = status_get_status_data(src); sc = status_get_sc(bl); if( sc && !sc->count ) - sc = NULL; + sc = nullptr; #ifdef RENEWAL uint16 levelAdv = (static_cast(pow(max(0, status_get_lv(src) - status_get_lv(bl)), 2)) / 5) * 100; @@ -9931,11 +9931,11 @@ void status_display_remove(struct block_list *bl, enum sc_type type) { int cursor; ers_free(eri, sc_display[i]); - sc_display[i] = NULL; + sc_display[i] = nullptr; /* The all-mighty compact-o-matic */ for( i = 0, cursor = 0; i < sc_display_count; i++ ) { - if( sc_display[i] == NULL ) + if( sc_display[i] == nullptr ) continue; if( i != cursor ) @@ -9946,7 +9946,7 @@ void status_display_remove(struct block_list *bl, enum sc_type type) { if( !(sc_display_count = cursor) ) { aFree(sc_display); - sc_display = NULL; + sc_display = nullptr; } *sc_display_ptr = sc_display; @@ -9968,7 +9968,7 @@ void status_display_remove(struct block_list *bl, enum sc_type type) { * @return adjusted duration based on flag values */ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_type type,int rate,int val1,int val2,int val3,int val4,t_tick duration,unsigned char flag, int32 delay) { - map_session_data *sd = NULL; + map_session_data *sd = nullptr; status_change* sc; struct status_change_entry* sce; struct status_data *status; @@ -10098,8 +10098,8 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty // Avoid cloaking with no wall and low skill level. [Skotlex] // Due to the cloaking card, we have to check the wall versus to known // skill level rather than the used one. [Skotlex] - // if (sd && val1 < 3 && skill_check_cloaking(bl,NULL)) - if( sd && pc_checkskill(sd, AS_CLOAKING) < 3 && !skill_check_cloaking(bl,NULL) ) + // if (sd && val1 < 3 && skill_check_cloaking(bl,nullptr)) + if( sd && pc_checkskill(sd, AS_CLOAKING) < 3 && !skill_check_cloaking(bl,nullptr) ) return 0; break; case SC_MODECHANGE: { @@ -10262,7 +10262,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty return 0; break; case SC_CAMOUFLAGE: - if( sd && pc_checkskill(sd, RA_CAMOUFLAGE) < 3 && !skill_check_camouflage(bl,NULL) ) + if( sd && pc_checkskill(sd, RA_CAMOUFLAGE) < 3 && !skill_check_camouflage(bl,nullptr) ) return 0; break; case SC__STRIPACCESSORY: @@ -11162,8 +11162,8 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty int stat,max_stat; // Fetch caster information struct block_list *pbl = map_id2bl(val1); - status_change *psc = pbl?status_get_sc(pbl):NULL; - struct status_change_entry *psce = psc?psc->getSCE(SC_MARIONETTE):NULL; + status_change *psc = pbl?status_get_sc(pbl):nullptr; + struct status_change_entry *psce = psc?psc->getSCE(SC_MARIONETTE):nullptr; // Fetch target's stats struct status_data* status2 = status_get_status_data(bl); // Battle status @@ -11249,9 +11249,9 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty break; case SC_CLOSECONFINE2: { - struct block_list *src2 = val2?map_id2bl(val2):NULL; - status_change *sc2 = src2?status_get_sc(src2):NULL; - struct status_change_entry *sce2 = sc2?sc2->getSCE(SC_CLOSECONFINE):NULL; + struct block_list *src2 = val2?map_id2bl(val2):nullptr; + status_change *sc2 = src2?status_get_sc(src2):nullptr; + struct status_change_entry *sce2 = sc2?sc2->getSCE(SC_CLOSECONFINE):nullptr; if (src2 && sc2) { if (!sce2) { // Start lock on caster. @@ -13007,7 +13007,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty struct unit_data *ud = unit_bl2ud(bl); if( ud ) - ud->state.running = unit_run(bl, NULL, SC_RUN); + ud->state.running = unit_run(bl, nullptr, SC_RUN); } break; case SC_BOSSMAPINFO: @@ -13272,7 +13272,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid) int damage = status->max_hp*sce->val3/100; if(status->hp < damage) // to not kill him damage = status->hp-1; - status_damage(NULL,bl,damage,0,0,1,0); + status_damage(nullptr,bl,damage,0,0,1,0); } break; case SC_RUN: @@ -13330,7 +13330,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid) ((TBL_PC*)d_bl)->devotion[sce->val2] = 0; else if( d_bl->type == BL_MER ) ((TBL_MER*)d_bl)->devotion_flag = 0; - clif_devotion(d_bl, NULL); + clif_devotion(d_bl, nullptr); } } break; @@ -13442,7 +13442,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid) if (sce->val1) { // Check for partner and end their marionette status as well enum sc_type type2 = (type == SC_MARIONETTE) ? SC_MARIONETTE2 : SC_MARIONETTE; struct block_list *pbl = map_id2bl(sce->val1); - status_change* sc2 = pbl?status_get_sc(pbl):NULL; + status_change* sc2 = pbl?status_get_sc(pbl):nullptr; if (sc2 && sc2->getSCE(type2)) { sc2->getSCE(type2)->val1 = 0; @@ -13685,7 +13685,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid) { // Drop the material from target if expired struct item it; - map_session_data *caster = NULL; + map_session_data *caster = nullptr; if (sce->val3 || status_isdead(bl) || !(caster = map_id2sd(sce->val2))) break; @@ -14981,7 +14981,7 @@ int status_change_timer_sub(struct block_list* bl, va_list ap) status_check_skilluse(src, bl, WZ_SIGHTBLASTER, 2)) { if (sce) { - struct skill_unit *su = NULL; + struct skill_unit *su = nullptr; if(bl->type == BL_SKILL) su = (struct skill_unit *)bl; if (skill_attack(BF_MAGIC,src,src,bl,WZ_SIGHTBLASTER,sce->val1,tick,0x1000000) @@ -15148,7 +15148,7 @@ static int status_natural_heal(struct block_list* bl, va_list args) struct status_data *status; status_change *sc; struct unit_data *ud; - struct view_data *vd = NULL; + struct view_data *vd = nullptr; struct regen_data_sub *sregen; map_session_data *sd; int rate, multi = 1, flag; @@ -15159,7 +15159,7 @@ static int status_natural_heal(struct block_list* bl, va_list args) status = status_get_status_data(bl); sc = status_get_sc(bl); if (sc && !sc->count) - sc = NULL; + sc = nullptr; sd = BL_CAST(BL_PC,bl); flag = regen->flag; diff --git a/src/map/storage.cpp b/src/map/storage.cpp index b7ecd2d643..edc6a642ea 100644 --- a/src/map/storage.cpp +++ b/src/map/storage.cpp @@ -667,26 +667,26 @@ enum e_guild_storage_log storage_guild_log_read_sub( map_session_data* sd, std:: struct guild_log_entry entry; // General data - SqlStmt_BindColumn(stmt, 0, SQLDT_UINT, &entry.id, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 1, SQLDT_STRING, &entry.time, sizeof(entry.time), NULL, NULL); - SqlStmt_BindColumn(stmt, 2, SQLDT_STRING, &entry.name, sizeof(entry.name), NULL, NULL); - SqlStmt_BindColumn(stmt, 3, SQLDT_SHORT, &entry.amount, 0, NULL, NULL); + SqlStmt_BindColumn(stmt, 0, SQLDT_UINT, &entry.id, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 1, SQLDT_STRING, &entry.time, sizeof(entry.time), nullptr, nullptr); + SqlStmt_BindColumn(stmt, 2, SQLDT_STRING, &entry.name, sizeof(entry.name), nullptr, nullptr); + SqlStmt_BindColumn(stmt, 3, SQLDT_SHORT, &entry.amount, 0, nullptr, nullptr); // Item data - SqlStmt_BindColumn(stmt, 4, SQLDT_UINT, &entry.item.nameid, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 5, SQLDT_CHAR, &entry.item.identify, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 6, SQLDT_CHAR, &entry.item.refine, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 7, SQLDT_CHAR, &entry.item.attribute, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 8, SQLDT_UINT, &entry.item.expire_time, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 9, SQLDT_UINT, &entry.item.bound, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 10, SQLDT_UINT64, &entry.item.unique_id, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 11, SQLDT_INT8, &entry.item.enchantgrade,0, NULL, NULL); + SqlStmt_BindColumn(stmt, 4, SQLDT_UINT, &entry.item.nameid, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 5, SQLDT_CHAR, &entry.item.identify, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 6, SQLDT_CHAR, &entry.item.refine, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 7, SQLDT_CHAR, &entry.item.attribute, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 8, SQLDT_UINT, &entry.item.expire_time, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 9, SQLDT_UINT, &entry.item.bound, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 10, SQLDT_UINT64, &entry.item.unique_id, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 11, SQLDT_INT8, &entry.item.enchantgrade,0, nullptr, nullptr); for( j = 0; j < MAX_SLOTS; ++j ) - SqlStmt_BindColumn(stmt, 12+j, SQLDT_UINT, &entry.item.card[j], 0, NULL, NULL); + SqlStmt_BindColumn(stmt, 12+j, SQLDT_UINT, &entry.item.card[j], 0, nullptr, nullptr); for( j = 0; j < MAX_ITEM_RDM_OPT; ++j ) { - SqlStmt_BindColumn(stmt, 12+MAX_SLOTS+j*3, SQLDT_SHORT, &entry.item.option[j].id, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 12+MAX_SLOTS+j*3+1, SQLDT_SHORT, &entry.item.option[j].value, 0, NULL, NULL); - SqlStmt_BindColumn(stmt, 12+MAX_SLOTS+j*3+2, SQLDT_CHAR, &entry.item.option[j].param, 0, NULL, NULL); + SqlStmt_BindColumn(stmt, 12+MAX_SLOTS+j*3, SQLDT_SHORT, &entry.item.option[j].id, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 12+MAX_SLOTS+j*3+1, SQLDT_SHORT, &entry.item.option[j].value, 0, nullptr, nullptr); + SqlStmt_BindColumn(stmt, 12+MAX_SLOTS+j*3+2, SQLDT_CHAR, &entry.item.option[j].param, 0, nullptr, nullptr); } log.reserve(max); @@ -1044,7 +1044,7 @@ void storage_guild_storagesaved(int guild_id) { struct s_storage *stor; - if ((stor = guild2storage2(guild_id)) != NULL) { + if ((stor = guild2storage2(guild_id)) != nullptr) { if (stor->dirty && !stor->status) // Storage has been correctly saved. stor->dirty = false; } diff --git a/src/map/trade.cpp b/src/map/trade.cpp index 1ad2e3a57c..0131d4ac7b 100644 --- a/src/map/trade.cpp +++ b/src/map/trade.cpp @@ -37,7 +37,7 @@ void trade_traderequest(map_session_data *sd, map_session_data *target_sd) return; //Can't trade in notrade mapflag maps. } - if (target_sd == NULL || sd == target_sd) { + if (target_sd == nullptr || sd == target_sd) { clif_tradestart(sd, 1); // character does not exist return; } @@ -110,7 +110,7 @@ void trade_tradeack(map_session_data *sd, int type) if (sd->state.trading || !sd->trade_partner) return; // Already trading or no partner set. - if ((tsd = map_id2sd(sd->trade_partner)) == NULL) { + if ((tsd = map_id2sd(sd->trade_partner)) == nullptr) { clif_tradestart(sd, 1); // Character does not exist sd->trade_partner=0; return; @@ -356,7 +356,7 @@ void trade_tradeadditem(map_session_data *sd, short index, short amount) if( !sd->state.trading || sd->state.deal_locked > 0 ) return; // Can't add stuff. - if( (target_sd = map_id2sd(sd->trade_partner)) == NULL ) { + if( (target_sd = map_id2sd(sd->trade_partner)) == nullptr ) { trade_tradecancel(sd); return; } @@ -453,7 +453,7 @@ void trade_tradeaddzeny(map_session_data* sd, int amount) if( !sd->state.trading || sd->state.deal_locked > 0 ) return; //Can't add stuff. - if( (target_sd = map_id2sd(sd->trade_partner)) == NULL ) { + if( (target_sd = map_id2sd(sd->trade_partner)) == nullptr ) { trade_tradecancel(sd); return; } @@ -478,7 +478,7 @@ void trade_tradeok(map_session_data *sd) if(sd->state.deal_locked || !sd->state.trading) return; - if ((target_sd = map_id2sd(sd->trade_partner)) == NULL) { + if ((target_sd = map_id2sd(sd->trade_partner)) == nullptr) { trade_tradecancel(sd); return; } @@ -569,7 +569,7 @@ void trade_tradecommit(map_session_data *sd) if (!sd->state.trading || !sd->state.deal_locked) //Locked should be 1 (pressed ok) before you can press trade. return; - if ((tsd = map_id2sd(sd->trade_partner)) == NULL) { + if ((tsd = map_id2sd(sd->trade_partner)) == nullptr) { trade_tradecancel(sd); return; } diff --git a/src/map/unit.cpp b/src/map/unit.cpp index dff15ac64f..16d202c2ab 100644 --- a/src/map/unit.cpp +++ b/src/map/unit.cpp @@ -61,11 +61,11 @@ int unit_unattackable(struct block_list *bl); * Get the unit_data related to the bl * @param bl : Object to get the unit_data from * valid type are : BL_PC|BL_MOB|BL_PET|BL_NPC|BL_HOM|BL_MER|BL_ELEM - * @return unit_data of bl or NULL + * @return unit_data of bl or nullptr */ struct unit_data* unit_bl2ud(struct block_list *bl) { - if( bl == NULL) return NULL; + if( bl == nullptr) return nullptr; switch(bl->type){ case BL_PC: return &((map_session_data*)bl)->ud; case BL_MOB: return &((struct mob_data*)bl)->ud; @@ -74,7 +74,7 @@ struct unit_data* unit_bl2ud(struct block_list *bl) case BL_HOM: return &((struct homun_data*)bl)->ud; case BL_MER: return &((s_mercenary_data*)bl)->ud; case BL_ELEM: return &((s_elemental_data*)bl)->ud; - default : return NULL; + default : return nullptr; } } @@ -162,7 +162,7 @@ int unit_walktoxy_sub(struct block_list *bl) /** * Retrieve the direct master of a bl if one exists. * @param bl: char to get his master [HOM|ELEM|PET|MER] - * @return map_session_data of master or NULL + * @return map_session_data of master or nullptr */ TBL_PC* unit_get_master(struct block_list *bl) { @@ -173,13 +173,13 @@ TBL_PC* unit_get_master(struct block_list *bl) case BL_PET: return (((TBL_PET *)bl)->master); case BL_MER: return (((TBL_MER *)bl)->master); } - return NULL; + return nullptr; } /** * Retrieve a unit's master's teleport timer * @param bl: char to get his master's teleport timer [HOM|ELEM|PET|MER] - * @return timer or NULL + * @return timer or nullptr */ int* unit_get_masterteleport_timer(struct block_list *bl) { @@ -190,7 +190,7 @@ int* unit_get_masterteleport_timer(struct block_list *bl) case BL_PET: return &(((TBL_PET *)bl)->masterteleport_timer); case BL_MER: return &(((TBL_MER *)bl)->masterteleport_timer); } - return NULL; + return nullptr; } /** @@ -206,9 +206,9 @@ TIMER_FUNC(unit_teleport_timer){ struct block_list *bl = map_id2bl(id); int *mast_tid = unit_get_masterteleport_timer(bl); - if(tid == INVALID_TIMER || mast_tid == NULL) + if(tid == INVALID_TIMER || mast_tid == nullptr) return 0; - else if(*mast_tid != tid || bl == NULL) + else if(*mast_tid != tid || bl == nullptr) return 0; else { TBL_PC *msd = unit_get_master(bl); @@ -229,7 +229,7 @@ TIMER_FUNC(unit_teleport_timer){ */ int unit_check_start_teleport_timer(struct block_list *sbl) { - TBL_PC *msd = NULL; + TBL_PC *msd = nullptr; int max_dist = 0; switch(sbl->type) { @@ -253,7 +253,7 @@ int unit_check_start_teleport_timer(struct block_list *sbl) if(msd && max_dist) { int *msd_tid = unit_get_masterteleport_timer(sbl); - if(msd_tid == NULL) + if(msd_tid == nullptr) return 0; if (!check_distance_bl(&msd->bl, sbl, max_dist)) { if(*msd_tid == INVALID_TIMER || *msd_tid == 0) @@ -282,7 +282,7 @@ TIMER_FUNC(unit_step_timer){ bl = map_id2bl(id); - if (!bl || bl->prev == NULL) + if (!bl || bl->prev == nullptr) return 0; ud = unit_bl2ud(bl); @@ -524,7 +524,7 @@ static TIMER_FUNC(unit_walktoxy_timer) npc_touchnext_areanpc(sd,false); if(map_getcell(bl->m,x,y,CELL_CHKNPC)) { npc_touch_area_allnpc(sd,bl->m,x,y); - if (bl->prev == NULL) // Script could have warped char, abort remaining of the function. + if (bl->prev == nullptr) // Script could have warped char, abort remaining of the function. return 0; } else sd->areanpc.clear(); @@ -620,7 +620,7 @@ static TIMER_FUNC(unit_walktoxy_timer) if( md && DIFF_TICK(tick,md->dmgtick) < 3000 ) // Not required not damaged recently clif_move(ud); } else if(ud->state.running) { // Keep trying to run. - if (!(unit_run(bl, NULL, SC_RUN) || unit_run(bl, sd, SC_WUGDASH)) ) + if (!(unit_run(bl, nullptr, SC_RUN) || unit_run(bl, sd, SC_WUGDASH)) ) ud->state.running = 0; } else if (!ud->stepaction && ud->target_to) { // Update target trajectory. @@ -681,7 +681,7 @@ static TIMER_FUNC(unit_walktoxy_timer) TIMER_FUNC(unit_delay_walktoxy_timer){ struct block_list *bl = map_id2bl(id); - if (!bl || bl->prev == NULL) + if (!bl || bl->prev == nullptr) return 0; unit_walktoxy(bl, (short)((data>>16)&0xffff), (short)(data&0xffff), 0); @@ -700,7 +700,7 @@ TIMER_FUNC(unit_delay_walktoxy_timer){ TIMER_FUNC(unit_delay_walktobl_timer){ struct block_list *bl = map_id2bl(id), *tbl = map_id2bl(data); - if(!bl || bl->prev == NULL || tbl == NULL) + if(!bl || bl->prev == nullptr || tbl == nullptr) return 0; else { struct unit_data* ud = unit_bl2ud(bl); @@ -825,7 +825,7 @@ static inline void set_mobstate(struct block_list* bl, int flag) */ static TIMER_FUNC(unit_walktobl_sub){ struct block_list *bl = map_id2bl(id); - struct unit_data *ud = bl?unit_bl2ud(bl):NULL; + struct unit_data *ud = bl?unit_bl2ud(bl):nullptr; if (ud && ud->walktimer == INVALID_TIMER && ud->target && ud->target == data) { if (DIFF_TICK(ud->canmove_tick, tick) > 0) // Keep waiting? @@ -1037,21 +1037,21 @@ int unit_escape(struct block_list *bl, struct block_list *target, short dist, ui bool unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool checkpath) { short dx,dy; - struct unit_data *ud = NULL; - map_session_data *sd = NULL; + struct unit_data *ud = nullptr; + map_session_data *sd = nullptr; nullpo_retr(false,bl); sd = BL_CAST(BL_PC, bl); ud = unit_bl2ud(bl); - if(ud == NULL) + if(ud == nullptr) return false; unit_stop_walking(bl, 1); unit_stop_attack(bl); - if( checkpath && (map_getcell(bl->m,dst_x,dst_y,CELL_CHKNOPASS) || !path_search(NULL,bl->m,bl->x,bl->y,dst_x,dst_y,easy,CELL_CHKNOREACH)) ) + if( checkpath && (map_getcell(bl->m,dst_x,dst_y,CELL_CHKNOPASS) || !path_search(nullptr,bl->m,bl->x,bl->y,dst_x,dst_y,easy,CELL_CHKNOREACH)) ) return false; // Unreachable ud->to_x = dst_x; @@ -1077,7 +1077,7 @@ bool unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, boo if(map_getcell(bl->m,bl->x,bl->y,CELL_CHKNPC)) { npc_touch_area_allnpc(sd, bl->m, bl->x, bl->y); - if (bl->prev == NULL) // Script could have warped char, abort remaining of the function. + if (bl->prev == nullptr) // Script could have warped char, abort remaining of the function. return false; } else sd->areanpc.clear(); @@ -1087,7 +1087,7 @@ bool unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, boo int flag = 0; struct block_list* pbl = &sd->pd->bl; - if( !checkpath && !path_search(NULL,pbl->m,pbl->x,pbl->y,dst_x,dst_y,0,CELL_CHKNOPASS) ) + if( !checkpath && !path_search(nullptr,pbl->m,pbl->x,pbl->y,dst_x,dst_y,0,CELL_CHKNOPASS) ) flag = 1; else if (!check_distance_bl(&sd->bl, pbl, AREA_SIZE)) // Too far, teleport. flag = 2; @@ -1166,7 +1166,7 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, enum e_skill_bl { if(count) { map_session_data* sd; - struct skill_unit* su = NULL; + struct skill_unit* su = nullptr; int nx, ny, result; sd = BL_CAST(BL_PC, bl); @@ -1297,7 +1297,7 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type) ud = unit_bl2ud(bl); - if(bl->prev==NULL || !ud) + if(bl->prev==nullptr || !ud) return 1; if (type == CLR_DEAD) @@ -1323,7 +1323,7 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type) } if (x < 0 || y < 0) { // Random map position. - if (!map_search_freecell(NULL, m, &x, &y, -1, -1, 1)) { + if (!map_search_freecell(nullptr, m, &x, &y, -1, -1, 1)) { ShowWarning("unit_warp failed. Unit Id:%d/Type:%d, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, map[m].name, x, y); return 2; @@ -1331,7 +1331,7 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type) } else if ( bl->type != BL_NPC && map_getcell(m,x,y,CELL_CHKNOREACH)) { // Invalid target cell ShowWarning("unit_warp: Specified non-walkable target cell: %d (%s) at [%d,%d]\n", m, map[m].name, x,y); - if (!map_search_freecell(NULL, m, &x, &y, 4, 4, 1)) { // Can't find a nearby cell + if (!map_search_freecell(nullptr, m, &x, &y, 4, 4, 1)) { // Can't find a nearby cell ShowWarning("unit_warp failed. Unit Id:%d/Type:%d, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, map[m].name, x, y); return 2; } @@ -1383,7 +1383,7 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type) int unit_stop_walking(struct block_list *bl,int type) { struct unit_data *ud; - const struct TimerData* td = NULL; + const struct TimerData* td = nullptr; t_tick tick; nullpo_ret(bl); @@ -1612,8 +1612,8 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui struct unit_data *ud; struct status_data *tstatus; status_change *sc; - map_session_data *sd = NULL; - struct block_list * target = NULL; + map_session_data *sd = nullptr; + struct block_list * target = nullptr; t_tick tick = gettick(); int combo = 0, range; @@ -1625,7 +1625,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui sd = BL_CAST(BL_PC, src); ud = unit_bl2ud(src); - if(ud == NULL) + if(ud == nullptr) return 0; if (ud && ud->state.blockedskill) @@ -1634,7 +1634,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui sc = status_get_sc(src); if (sc && !sc->count) - sc = NULL; // Unneeded + sc = nullptr; // Unneeded int inf = skill_get_inf(skill_id); std::shared_ptr skill = skill_db.find(skill_id); @@ -1671,7 +1671,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui switch(skill_id) { // Check for skills that auto-select target case MO_CHAINCOMBO: if (sc && sc->getSCE(SC_BLADESTOP)) { - if ((target=map_id2bl(sc->getSCE(SC_BLADESTOP)->val4)) == NULL) + if ((target=map_id2bl(sc->getSCE(SC_BLADESTOP)->val4)) == nullptr) return 0; } break; @@ -1881,7 +1881,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui // (these are supposed to always have the same range as your attack) if( src->type != BL_NPC && !ignore_range && src->id != target_id && (!combo || ud->attacktimer == INVALID_TIMER) ) { if( skill_get_state(ud->skill_id) == ST_MOVE_ENABLE ) { - if( !unit_can_reach_bl(src, target, range + 1, 1, NULL, NULL) ) + if( !unit_can_reach_bl(src, target, range + 1, 1, nullptr, nullptr) ) return 0; // Walk-path check failed. } else if( src->type == BL_MER && skill_id == MA_REMOVETRAP ) { if( !battle_check_range(battle_get_master(src), target, range + 1) ) @@ -2125,8 +2125,8 @@ int unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, uint */ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel, bool ignore_range) { - map_session_data *sd = NULL; - struct unit_data *ud = NULL; + map_session_data *sd = nullptr; + struct unit_data *ud = nullptr; status_change *sc; struct block_list bl; t_tick tick = gettick(); @@ -2143,7 +2143,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui sd = BL_CAST(BL_PC, src); ud = unit_bl2ud(src); - if(ud == NULL) + if(ud == nullptr) return 0; if (ud && ud->state.blockedskill) @@ -2155,7 +2155,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui sc = status_get_sc(src); if (sc && !sc->count) - sc = NULL; + sc = nullptr; if (!skill_db.find(skill_id)) return 0; @@ -2173,7 +2173,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui return 0; } - if (!status_check_skilluse(src, NULL, skill_id, 0)) + if (!status_check_skilluse(src, nullptr, skill_id, 0)) return 0; // Fail if the targetted skill is near NPC [Cydh] @@ -2211,7 +2211,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui if (!ignore_range) { if( skill_get_state(ud->skill_id) == ST_MOVE_ENABLE ) { - if( !unit_can_reach_bl(src, &bl, range + 1, 1, NULL, NULL) ) + if( !unit_can_reach_bl(src, &bl, range + 1, 1, nullptr, nullptr) ) return 0; // Walk-path check failed. }else if( !battle_check_range(src, &bl, range) ) return 0; // Arrow-path check failed. @@ -2425,7 +2425,7 @@ int unit_attack(struct block_list *src,int target_id,int continuous) nullpo_ret(ud = unit_bl2ud(src)); target = map_id2bl(target_id); - if( target == NULL || status_isdead(target) ) { + if( target == nullptr || status_isdead(target) ) { unit_unattackable(src); return 1; } @@ -2523,7 +2523,7 @@ bool unit_can_reach_pos(struct block_list *bl,int x,int y, int easy) if (bl->x == x && bl->y == y) // Same place return true; - return path_search(NULL,bl->m,bl->x,bl->y,x,y,easy,CELL_CHKNOREACH); + return path_search(nullptr,bl->m,bl->x,bl->y,x,y,easy,CELL_CHKNOREACH); } /** @@ -2684,11 +2684,11 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, t_tick tick) struct block_list *target; struct unit_data *ud; struct status_data *sstatus; - map_session_data *sd = NULL; - struct mob_data *md = NULL; + map_session_data *sd = nullptr; + struct mob_data *md = nullptr; int range; - if( (ud = unit_bl2ud(src)) == NULL ) + if( (ud = unit_bl2ud(src)) == nullptr ) return 0; if( ud->attacktimer != tid ) { @@ -2701,13 +2701,13 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, t_tick tick) ud->attacktimer = INVALID_TIMER; target = map_id2bl(ud->target); - if( src == NULL || src->prev == NULL || target==NULL || target->prev == NULL ) + if( src == nullptr || src->prev == nullptr || target==nullptr || target->prev == nullptr ) return 0; if( status_isdead(src) || status_isdead(target) || battle_check_target(src,target,BCT_ENEMY) <= 0 || !status_check_skilluse(src, target, 0, 0) #ifdef OFFICIAL_WALKPATH - || !path_search_long(NULL, src->m, src->x, src->y, target->x, target->y, CELL_CHKWALL) + || !path_search_long(nullptr, src->m, src->x, src->y, target->x, target->y, CELL_CHKWALL) #endif || !unit_can_attack(src, target->id) ) return 0; // Can't attack under these conditions @@ -2895,7 +2895,7 @@ bool unit_can_attack(struct block_list *bl, int target_id) { */ int unit_skillcastcancel(struct block_list *bl, char type) { - map_session_data *sd = NULL; + map_session_data *sd = nullptr; struct unit_data *ud = unit_bl2ud( bl); t_tick tick = gettick(); int ret = 0, skill_id; @@ -3051,7 +3051,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file, nullpo_ret(ud); - if(bl->prev == NULL) + if(bl->prev == nullptr) return 0; // Already removed? map_freeblock_lock(); @@ -3164,7 +3164,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file, if( map[bl->m].users <= 0 || sd->state.debug_remove_map ) { // This is only place where map users is decreased, if the mobs were removed // too soon then this function was executed too many times [FlavioJS] - if( sd->debug_file == NULL || !(sd->state.debug_remove_map) ) { + if( sd->debug_file == nullptr || !(sd->state.debug_remove_map) ) { sd->debug_file = ""; sd->debug_line = 0; sd->debug_func = ""; @@ -3427,7 +3427,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) if( sd->st && sd->st->state != RUN ) {// free attached scripts that are waiting script_free_state(sd->st); - sd->st = NULL; + sd->st = nullptr; sd->npc_id = 0; } @@ -3457,12 +3457,12 @@ int unit_free(struct block_list *bl, clr_type clrtype) sd->sc_display_count = 0; aFree(sd->sc_display); - sd->sc_display = NULL; + sd->sc_display = nullptr; } - if( sd->quest_log != NULL ) { + if( sd->quest_log != nullptr ) { aFree(sd->quest_log); - sd->quest_log = NULL; + sd->quest_log = nullptr; sd->num_quests = sd->avail_quests = 0; } @@ -3504,8 +3504,8 @@ int unit_free(struct block_list *bl, clr_type clrtype) } if( sd ) - sd->pd = NULL; - pd->master = NULL; + sd->pd = nullptr; + pd->master = nullptr; skill_clear_unitgroup(bl); status_change_clear(bl,1); @@ -3529,7 +3529,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) if (md->lootitems) { aFree(md->lootitems); - md->lootitems = NULL; + md->lootitems = nullptr; } if( md->guardian_data ) { @@ -3547,7 +3547,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) md->guardian_data->~guardian_data(); aFree(md->guardian_data); - md->guardian_data = NULL; + md->guardian_data = nullptr; } if( md->spawn ) { @@ -3556,14 +3556,14 @@ int unit_free(struct block_list *bl, clr_type clrtype) if( !md->spawn->state.dynamic ) { // Permanently remove the mob if( --md->spawn->num == 0 ) { // Last freed mob is responsible for deallocating the group's spawn data. aFree(md->spawn); - md->spawn = NULL; + md->spawn = nullptr; } } } if( md->base_status) { aFree(md->base_status); - md->base_status = NULL; + md->base_status = nullptr; } skill_clear_unitgroup(bl); @@ -3598,8 +3598,8 @@ int unit_free(struct block_list *bl, clr_type clrtype) } if( sd ) - sd->hd = NULL; - hd->master = NULL; + sd->hd = nullptr; + hd->master = nullptr; skill_clear_unitgroup(bl); status_change_clear(bl,1); @@ -3619,10 +3619,10 @@ int unit_free(struct block_list *bl, clr_type clrtype) } if( sd ) - sd->md = NULL; + sd->md = nullptr; mercenary_contract_stop(md); - md->master = NULL; + md->master = nullptr; skill_clear_unitgroup(bl); status_change_clear(bl,1); @@ -3642,10 +3642,10 @@ int unit_free(struct block_list *bl, clr_type clrtype) } if( sd ) - sd->ed = NULL; + sd->ed = nullptr; elemental_summon_stop(ed); - ed->master = NULL; + ed->master = nullptr; skill_clear_unitgroup(bl); status_change_clear(bl,1); diff --git a/src/map/vending.cpp b/src/map/vending.cpp index abfdbf27d1..d8ac6cd0d1 100755 --- a/src/map/vending.cpp +++ b/src/map/vending.cpp @@ -82,7 +82,7 @@ void vending_vendinglistreq(map_session_data* sd, int id) map_session_data* vsd; nullpo_retv(sd); - if( (vsd = map_id2sd(id)) == NULL ) + if( (vsd = map_id2sd(id)) == nullptr ) return; if( !vsd->state.vending ) return; // not vending @@ -128,7 +128,7 @@ void vending_purchasereq(map_session_data* sd, int aid, int uid, const uint8* da map_session_data* vsd = map_id2sd(aid); nullpo_retv(sd); - if( vsd == NULL || !vsd->state.vending || vsd->bl.id == sd->bl.id ) + if( vsd == nullptr || !vsd->state.vending || vsd->bl.id == sd->bl.id ) return; // invalid shop if( vsd->vender_id != uid ) { // shop has changed @@ -292,7 +292,7 @@ void vending_purchasereq(map_session_data* sd, int aid, int uid, const uint8* da * @param data : itemlist data * data := {.w .w .l}[count] * @param count : number of different items - * @param at Autotrader info, or NULL if requetsed not from autotrade persistance + * @param at Autotrader info, or nullptr if requetsed not from autotrade persistance * @return 0 If success, 1 - Cannot open (die, not state.prevend, trading), 2 - No cart, 3 - Count issue, 4 - Cart data isn't saved yet, 5 - No valid item found */ int8 vending_openvending( map_session_data& sd, const char* message, const uint8* data, int count, struct s_autotrader *at ){ @@ -493,7 +493,7 @@ bool vending_searchall(map_session_data* sd, const struct s_search_store_search* */ void vending_reopen( map_session_data& sd ) { - struct s_autotrader *at = NULL; + struct s_autotrader *at = nullptr; int8 fail = -1; // Open vending for this autotrader @@ -583,24 +583,24 @@ void do_init_vending_autotrade(void) if( Sql_NumRows(mmysql_handle) > 0 ) { uint16 items = 0; - DBIterator *iter = NULL; - struct s_autotrader *at = NULL; + DBIterator *iter = nullptr; + struct s_autotrader *at = nullptr; // Init each autotrader data while (SQL_SUCCESS == Sql_NextRow(mmysql_handle)) { size_t len; char* data; - at = NULL; + at = nullptr; CREATE(at, struct s_autotrader, 1); - Sql_GetData(mmysql_handle, 0, &data, NULL); at->id = atoi(data); - Sql_GetData(mmysql_handle, 1, &data, NULL); at->account_id = atoi(data); - Sql_GetData(mmysql_handle, 2, &data, NULL); at->char_id = atoi(data); - Sql_GetData(mmysql_handle, 3, &data, NULL); at->sex = (data[0] == 'F') ? SEX_FEMALE : SEX_MALE; + Sql_GetData(mmysql_handle, 0, &data, nullptr); at->id = atoi(data); + Sql_GetData(mmysql_handle, 1, &data, nullptr); at->account_id = atoi(data); + Sql_GetData(mmysql_handle, 2, &data, nullptr); at->char_id = atoi(data); + Sql_GetData(mmysql_handle, 3, &data, nullptr); at->sex = (data[0] == 'F') ? SEX_FEMALE : SEX_MALE; Sql_GetData(mmysql_handle, 4, &data, &len); safestrncpy(at->title, data, zmin(len + 1, MESSAGE_SIZE)); - Sql_GetData(mmysql_handle, 5, &data, NULL); at->dir = atoi(data); - Sql_GetData(mmysql_handle, 6, &data, NULL); at->head_dir = atoi(data); - Sql_GetData(mmysql_handle, 7, &data, NULL); at->sit = atoi(data); + Sql_GetData(mmysql_handle, 5, &data, nullptr); at->dir = atoi(data); + Sql_GetData(mmysql_handle, 6, &data, nullptr); at->head_dir = atoi(data); + Sql_GetData(mmysql_handle, 7, &data, nullptr); at->sit = atoi(data); at->count = 0; if (battle_config.feature_autotrade_direction >= 0) @@ -653,9 +653,9 @@ void do_init_vending_autotrade(void) while (SQL_SUCCESS == Sql_NextRow(mmysql_handle) && j < at->count) { char *data; CREATE(at->entries[j], struct s_autotrade_entry, 1); - Sql_GetData(mmysql_handle, 0, &data, NULL); at->entries[j]->cartinventory_id = atoi(data); - Sql_GetData(mmysql_handle, 1, &data, NULL); at->entries[j]->amount = atoi(data); - Sql_GetData(mmysql_handle, 2, &data, NULL); at->entries[j]->price = atoi(data); + Sql_GetData(mmysql_handle, 0, &data, nullptr); at->entries[j]->cartinventory_id = atoi(data); + Sql_GetData(mmysql_handle, 1, &data, nullptr); at->entries[j]->amount = atoi(data); + Sql_GetData(mmysql_handle, 2, &data, nullptr); at->entries[j]->price = atoi(data); j++; } items += j; diff --git a/src/tool/csv2yaml.cpp b/src/tool/csv2yaml.cpp index 67c4962820..26f83a8892 100644 --- a/src/tool/csv2yaml.cpp +++ b/src/tool/csv2yaml.cpp @@ -660,14 +660,14 @@ static bool pet_read_db( const char* file ){ str[k] = p; p = strchr(p,','); - if( p == NULL ) + if( p == nullptr ) break; // comma not found *p = '\0'; ++p; } - if( p == NULL ) { + if( p == nullptr ) { ShowError("read_petdb: Insufficient columns in line %d, skipping.\n", lines); continue; } @@ -681,7 +681,7 @@ static bool pet_read_db( const char* file ){ str[20] = p; p = strstr(p+1,"},"); - if( p == NULL ) { + if( p == nullptr ) { ShowError("read_petdb: Invalid format (Pet Script column) in line %d, skipping.\n", lines); continue; } @@ -1272,13 +1272,13 @@ static bool skill_parse_row_castnodexdb( char* split[], size_t columns, size_t c static bool skill_parse_row_unitdb( char* split[], size_t columns, size_t current ){ s_skill_unit_csv entry = {}; - entry.unit_id = (uint16)strtol(split[1], NULL, 16); - entry.unit_id2 = (uint16)strtol(split[2], NULL, 16); + entry.unit_id = (uint16)strtol(split[1], nullptr, 16); + entry.unit_id2 = (uint16)strtol(split[2], nullptr, 16); skill_split_atoi(split[3], entry.unit_layout_type); skill_split_atoi(split[4], entry.unit_range); entry.unit_interval = atoi(split[5]); entry.target_str = trim(split[6]); - entry.unit_flag_csv = strtol(split[7], NULL, 16); + entry.unit_flag_csv = strtol(split[7], nullptr, 16); skill_unit.insert({ atoi(split[0]), entry }); @@ -1369,7 +1369,7 @@ static bool skill_parse_row_skilldb( char* split[], size_t columns, size_t curre body << YAML::Key << "TargetType" << YAML::Value << name2Upper(constant); } - uint64 nk_val = strtol(split[5], NULL, 0); + uint64 nk_val = strtol(split[5], nullptr, 0); if (nk_val) { body << YAML::Key << "DamageFlags"; @@ -2342,7 +2342,7 @@ static bool quest_read_db( char *split[], size_t columns, size_t current ){ title.erase(std::remove(title.begin(), title.end(), '"'), title.end()); // Strip double quotes out body << YAML::Key << "Title" << YAML::Value << title; - if (strchr(split[1], ':') == NULL) { + if (strchr(split[1], ':') == nullptr) { uint32 time = atoi(split[1]); if (time > 0) { @@ -2560,7 +2560,7 @@ static bool itemdb_read_stack( char* fields[], size_t columns, size_t current ){ item.amount = atoi(fields[1]); - int type = strtoul(fields[2], NULL, 10); + int type = strtoul(fields[2], nullptr, 10); if (type & 1) item.inventory = true; @@ -2656,13 +2656,13 @@ static bool itemdb_read_db(const char* file) { for (i = 0; i < 19; ++i) { str[i] = p; p = strchr(p, ','); - if (p == NULL) + if (p == nullptr) break;// comma not found *p = '\0'; ++p; } - if (p == NULL) { + if (p == nullptr) { ShowError("itemdb_read_db: Insufficient columns in line %d (item with id %lu), skipping.\n", lines, strtoul(str[0], nullptr, 10)); continue; } @@ -2674,7 +2674,7 @@ static bool itemdb_read_db(const char* file) { } str[19] = p + 1; p = strstr(p + 1, "},"); - if (p == NULL) { + if (p == nullptr) { ShowError("itemdb_read_db: Invalid format (Script column) in line %d (item with id %lu), skipping.\n", lines, strtoul(str[0], nullptr, 10)); continue; } @@ -2688,7 +2688,7 @@ static bool itemdb_read_db(const char* file) { } str[20] = p + 1; p = strstr(p + 1, "},"); - if (p == NULL) { + if (p == nullptr) { ShowError("itemdb_read_db: Invalid format (OnEquip_Script column) in line %d (item with id %lu), skipping.\n", lines, strtoul(str[0], nullptr, 10)); continue; } @@ -2792,7 +2792,7 @@ static bool itemdb_read_db(const char* file) { bool equippable = type == IT_UNKNOWN ? false : type == IT_ETC ? false : type == IT_CARD ? false : type == IT_PETEGG ? false : type == IT_PETARMOR ? false : type == IT_UNKNOWN2 ? false : true; if (equippable) { - uint64 temp_mask = strtoull(str[11], NULL, 0); + uint64 temp_mask = strtoull(str[11], nullptr, 0); if (temp_mask == 0) { //body << YAML::Key << "Jobs"; diff --git a/src/tool/mapcache.cpp b/src/tool/mapcache.cpp index 4c78d3ba22..5da35b4b28 100644 --- a/src/tool/mapcache.cpp +++ b/src/tool/mapcache.cpp @@ -77,7 +77,7 @@ int read_map(char *name, struct map_data *m) // Open map GAT sprintf(filename,"data\\%s.gat", name); gat = (unsigned char *)grfio_read(filename); - if (gat == NULL) + if (gat == nullptr) return 0; // Open map RSW @@ -217,7 +217,7 @@ bool MapcacheTool::initialize( int argc, char* argv[] ){ ShowStatus("Opening map cache: %s\n", map_cache_file.c_str()); if(!rebuild) { map_cache_fp = fopen(map_cache_file.c_str(), "rb"); - if(map_cache_fp == NULL) { + if(map_cache_fp == nullptr) { ShowNotice("Existing map cache not found, forcing rebuild mode\n"); rebuild = 1; } else @@ -227,7 +227,7 @@ bool MapcacheTool::initialize( int argc, char* argv[] ){ map_cache_fp = fopen(map_cache_file.c_str(), "w+b"); else map_cache_fp = fopen(map_cache_file.c_str(), "r+b"); - if(map_cache_fp == NULL) { + if(map_cache_fp == nullptr) { ShowError("Failure when opening map cache file %s\n", map_cache_file.c_str()); return false; } @@ -241,7 +241,7 @@ bool MapcacheTool::initialize( int argc, char* argv[] ){ ShowStatus("Opening map list: %s\n", filename.c_str()); list = fopen(filename.c_str(), "r"); - if (list == NULL) { + if (list == nullptr) { ShowError("Failure when opening maps list file %s\n", filename.c_str()); return false; } diff --git a/src/tool/yaml.hpp b/src/tool/yaml.hpp index 54217a6abe..89bd5208f6 100644 --- a/src/tool/yaml.hpp +++ b/src/tool/yaml.hpp @@ -311,7 +311,7 @@ uint8 skill_split_atoi2(char *str, int64 *val, const char *delim, int min_value, uint8 i = 0; char *p = strtok(str, delim); - while (p != NULL) { + while (p != nullptr) { int64 n = min_value; trim(p); @@ -320,7 +320,7 @@ uint8 skill_split_atoi2(char *str, int64 *val, const char *delim, int min_value, n = atoi(p); else { n = constant_lookup_int(p); - p = strtok(NULL, delim); + p = strtok(nullptr, delim); } if (n > min_value) { @@ -329,7 +329,7 @@ uint8 skill_split_atoi2(char *str, int64 *val, const char *delim, int min_value, if (i >= max) break; } - p = strtok(NULL, delim); + p = strtok(nullptr, delim); } return i; } @@ -408,7 +408,7 @@ static bool parse_item_constants_txt(const char *path) { FILE *fp; fp = fopen(path, "r"); - if (fp == NULL) { + if (fp == nullptr) { ShowWarning("itemdb_readdb: File not found \"%s\", skipping.\n", path); return false; } @@ -438,7 +438,7 @@ static bool parse_item_constants_txt(const char *path) { { str[i] = p; p = strchr(p, ','); - if (p == NULL) + if (p == nullptr) break;// comma not found *p = '\0'; ++p; @@ -446,7 +446,7 @@ static bool parse_item_constants_txt(const char *path) { t_itemid item_id = strtoul(str[0], nullptr, 10); - if (p == NULL) + if (p == nullptr) { ShowError("itemdb_readdb: Insufficient columns in line %d of \"%s\" (item with id %u), skipping.\n", lines, path, item_id); continue; @@ -460,7 +460,7 @@ static bool parse_item_constants_txt(const char *path) { } str[19] = p + 1; p = strstr(p + 1, "},"); - if (p == NULL) + if (p == nullptr) { ShowError("itemdb_readdb: Invalid format (Script column) in line %d of \"%s\" (item with id %u), skipping.\n", lines, path, item_id); continue; @@ -476,7 +476,7 @@ static bool parse_item_constants_txt(const char *path) { } str[20] = p + 1; p = strstr(p + 1, "},"); - if (p == NULL) + if (p == nullptr) { ShowError("itemdb_readdb: Invalid format (OnEquip_Script column) in line %d of \"%s\" (item with id %u), skipping.\n", lines, path, item_id); continue; diff --git a/src/web/charconfig_controller.cpp b/src/web/charconfig_controller.cpp index 25a029b22f..5fe67b7022 100644 --- a/src/web/charconfig_controller.cpp +++ b/src/web/charconfig_controller.cpp @@ -53,7 +53,7 @@ HANDLER_FUNC(charconfig_save) { if (SqlStmt_NumRows(stmt) > 0) { char databuf[SQL_BUFFER_SIZE]; - if (SQL_SUCCESS != SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &databuf, sizeof(databuf), NULL, NULL) + if (SQL_SUCCESS != SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &databuf, sizeof(databuf), nullptr, nullptr) || SQL_SUCCESS != SqlStmt_NextRow(stmt) ) { SqlStmt_ShowDebug(stmt); @@ -157,7 +157,7 @@ HANDLER_FUNC(charconfig_load) { char databuf[SQL_BUFFER_SIZE]; - if (SQL_SUCCESS != SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &databuf, sizeof(databuf), NULL, NULL) + if (SQL_SUCCESS != SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &databuf, sizeof(databuf), nullptr, nullptr) || SQL_SUCCESS != SqlStmt_NextRow(stmt) ) { SqlStmt_ShowDebug(stmt); diff --git a/src/web/emblem_controller.cpp b/src/web/emblem_controller.cpp index fe38615365..ed1aa969a8 100644 --- a/src/web/emblem_controller.cpp +++ b/src/web/emblem_controller.cpp @@ -246,7 +246,7 @@ HANDLER_FUNC(emblem_upload) { uint32 version = START_VERSION; if (SqlStmt_NumRows(stmt) > 0) { - if (SQL_SUCCESS != SqlStmt_BindColumn(stmt, 0, SQLDT_UINT32, &version, sizeof(version), NULL, NULL) + if (SQL_SUCCESS != SqlStmt_BindColumn(stmt, 0, SQLDT_UINT32, &version, sizeof(version), nullptr, nullptr) || SQL_SUCCESS != SqlStmt_NextRow(stmt) ) { SqlStmt_ShowDebug(stmt); diff --git a/src/web/merchantstore_controller.cpp b/src/web/merchantstore_controller.cpp index d2ec49afcf..79d5564eef 100644 --- a/src/web/merchantstore_controller.cpp +++ b/src/web/merchantstore_controller.cpp @@ -149,7 +149,7 @@ HANDLER_FUNC(merchantstore_load) { char databuf[SQL_BUFFER_SIZE] = { 0 }; - if (SQL_SUCCESS != SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &databuf, sizeof(databuf), NULL, NULL) + if (SQL_SUCCESS != SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &databuf, sizeof(databuf), nullptr, nullptr) || SQL_SUCCESS != SqlStmt_NextRow(stmt) ) { SqlStmt_ShowDebug(stmt); diff --git a/src/web/partybooking_controller.cpp b/src/web/partybooking_controller.cpp index 6e3decb8fe..ce9cde58a6 100644 --- a/src/web/partybooking_controller.cpp +++ b/src/web/partybooking_controller.cpp @@ -79,17 +79,17 @@ bool party_booking_read( std::string& world_name, std::vector 0) { char databuf[SQL_BUFFER_SIZE]; - if (SQL_SUCCESS != SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &databuf, sizeof(databuf), NULL, NULL) + if (SQL_SUCCESS != SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &databuf, sizeof(databuf), nullptr, nullptr) || SQL_SUCCESS != SqlStmt_NextRow(stmt) ) { SqlStmt_ShowDebug(stmt); @@ -152,7 +152,7 @@ HANDLER_FUNC(userconfig_load) { char databuf[SQL_BUFFER_SIZE]; - if (SQL_SUCCESS != SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &databuf, sizeof(databuf), NULL, NULL) + if (SQL_SUCCESS != SqlStmt_BindColumn(stmt, 0, SQLDT_STRING, &databuf, sizeof(databuf), nullptr, nullptr) || SQL_SUCCESS != SqlStmt_NextRow(stmt) ) { SqlStmt_ShowDebug(stmt); diff --git a/src/web/web.cpp b/src/web/web.cpp index 008d8c3bbe..3b1e6acb06 100644 --- a/src/web/web.cpp +++ b/src/web/web.cpp @@ -70,10 +70,10 @@ std::string web_server_db = "ragnarok"; std::string default_codepage = ""; -Sql * login_handle = NULL; -Sql * char_handle = NULL; -Sql * map_handle = NULL; -Sql * web_handle = NULL; +Sql * login_handle = nullptr; +Sql * char_handle = nullptr; +Sql * map_handle = nullptr; +Sql * web_handle = nullptr; char login_table[32] = "login"; char guild_emblems_table[32] = "guild_emblems"; @@ -112,7 +112,7 @@ void web_do_final_msg(void){ bool web_config_read(const char* cfgName, bool normal) { char line[1024], w1[32], w2[1024]; FILE* fp = fopen(cfgName, "r"); - if (fp == NULL) { + if (fp == nullptr) { ShowError("Configuration file (%s) not found.\n", cfgName); return false; } @@ -167,7 +167,7 @@ int inter_config_read(const char* cfgName) FILE* fp; fp = fopen(cfgName, "r"); - if(fp == NULL) { + if(fp == nullptr) { ShowError("File not found: %s\n", cfgName); return 1; } @@ -348,16 +348,16 @@ int web_sql_close(void) { ShowStatus("Close Login DB Connection....\n"); Sql_Free(login_handle); - login_handle = NULL; + login_handle = nullptr; ShowStatus("Close Char DB Connection....\n"); Sql_Free(char_handle); - char_handle = NULL; + char_handle = nullptr; ShowStatus("Close Map DB Connection....\n"); Sql_Free(map_handle); - map_handle = NULL; + map_handle = nullptr; ShowStatus("Close Web DB Connection....\n"); Sql_Free(web_handle); - web_handle = NULL; + web_handle = nullptr; return 0; }