Pārlūkot izejas kodu

Updated to master
* Resolved various merge conflicts.
* Resolved various compile errors.

aleos89 9 gadi atpakaļ
vecāks
revīzija
57b0f83270

+ 4 - 0
conf/char_athena.conf

@@ -230,9 +230,13 @@ char_moves_unlimited: no
 //===================================
 // Char/Inter-server Tables
 //===================================
+acc_reg_num_table: acc_reg_num
+acc_reg_str_table: acc_reg_str
 auction_table: auction
 bonus_script_table: bonus_script
 cart_table: cart_inventory
+char_reg_num_table: char_reg_num
+char_reg_str_table: char_reg_str
 char_table: char
 charlog_table: charlog
 elemental_table: elemental

+ 3 - 2
conf/login_athena.conf

@@ -179,9 +179,10 @@ time_allowed: 10
 //===================================
 // Login-server Tables
 //===================================
-login_server_account_table: login
-login_server_accreg_table: global_reg_value
+global_acc_reg_num_table: global_acc_reg_num
+global_acc_reg_str_table: global_acc_reg_str
 ipban_list_table: ipbanlist
+login_server_account_table: login
 
 import: conf/inter_athena.conf
 import: conf/import/login_conf.txt

+ 1 - 0
conf/map_athena.conf

@@ -131,6 +131,7 @@ buyingstore_table: buyingstores
 buyingstore_items_table: buyingstore_items
 mapreg_table: mapreg
 market_table: market
+roulette_table: db_roulette
 vending_table: vendings
 vending_items_table: vending_items
 

+ 2 - 2
src/char/char.c

@@ -880,7 +880,7 @@ int char_mmo_gender(const struct char_session_data *sd, const struct mmo_charsta
 		} else {
 			ShowInfo("Resetting sex of character '%s' (CID: %d, AID: %d) to 'U' due to incompatible PACKETVER.\n", p->name, p->char_id, p->account_id);
 		}
-		if (SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `sex` = 'U' WHERE `char_id` = '%d'", schema_config.char_db, p->char_id)) {
+		if (SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `sex` = 'U' WHERE `char_id` = '%d'", charserv_table(char_table), p->char_id)) {
 			Sql_ShowDebug(sql_handle);
 		}
 	}
@@ -2438,7 +2438,7 @@ bool char_checkdb(void){
 	}
 	//checking ragsrvinfo_db
 	if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `index`,`name`,`exp`,`jexp`,`drop`"
-		" FROM `%s` LIMIT 1;", schema_config.ragsrvinfo_db) ) {
+		" FROM `%s` LIMIT 1;", charserv_table(ragsrvinfo_table)) ) {
 		Sql_ShowDebug(sql_handle);
 		return false;
 	}

+ 4 - 4
src/char/char_logif.c

@@ -414,10 +414,10 @@ void chlogif_parse_change_sex_sub(int sex, int acc, int char_id, int class_, int
 	else if (class_ == JOB_KAGEROU || class_ == JOB_OBORO)
 		class_ = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO);
 
-	if (SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `equip` = '0' WHERE `char_id` = '%d'", schema_config.inventory_db, char_id))
+	if (SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `equip` = '0' WHERE `char_id` = '%d'", charserv_table(inventory_table), char_id))
 		Sql_ShowDebug(sql_handle);
 
-	if (SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `class` = '%d', `weapon` = '0', `shield` = '0', `head_top` = '0', `head_mid` = '0', `head_bottom` = '0' WHERE `char_id` = '%d'", schema_config.char_db, class_, char_id))
+	if (SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `class` = '%d', `weapon` = '0', `shield` = '0', `head_top` = '0', `head_mid` = '0', `head_bottom` = '0' WHERE `char_id` = '%d'", charserv_table(char_table), class_, char_id))
 		Sql_ShowDebug(sql_handle);
 	if (guild_id) // If there is a guild, update the guild_member data [Skotlex]
 		inter_guild_sex_changed(guild_id, acc, char_id, sex);
@@ -486,7 +486,7 @@ int chlogif_parse_ackchangecharsex(int char_id, int sex)
 	char *data;
 
 	// get character data
-	if (SQL_ERROR == Sql_Query(sql_handle, "SELECT `account_id`,`class`,`guild_id` FROM `%s` WHERE `char_id` = '%d'", schema_config.char_db, char_id)) {
+	if (SQL_ERROR == Sql_Query(sql_handle, "SELECT `account_id`,`class`,`guild_id` FROM `%s` WHERE `char_id` = '%d'", charserv_table(char_table), char_id)) {
 		Sql_ShowDebug(sql_handle);
 		return 1;
 	}
@@ -500,7 +500,7 @@ int chlogif_parse_ackchangecharsex(int char_id, int sex)
 	Sql_GetData(sql_handle, 2, &data, NULL); guild_id = atoi(data);
 	Sql_FreeResult(sql_handle);
 
-	if (SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `sex` = '%c' WHERE `char_id` = '%d'", schema_config.char_db, sex == SEX_MALE ? 'M' : 'F', char_id)) {
+	if (SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `sex` = '%c' WHERE `char_id` = '%d'", charserv_table(char_table), sex == SEX_MALE ? 'M' : 'F', char_id)) {
 		Sql_ShowDebug(sql_handle);
 		return 1;
 	}

+ 1 - 1
src/login/account.c

@@ -398,7 +398,7 @@ static bool account_db_sql_remove(AccountDB* self, const uint32 account_id) {
 
 	if( SQL_SUCCESS != Sql_QueryStr(sql_handle, "START TRANSACTION")
 	||  SQL_SUCCESS != Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = %d", StringBuf_Value(db->account_table), account_id)
-	||  SQL_SUCCESS != Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = %d", StringBuf_Value(db->global_acc_reg_num_table), account_id) )
+	||  SQL_SUCCESS != Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = %d", StringBuf_Value(db->global_acc_reg_num_table), account_id)
 	||  SQL_SUCCESS != Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = %d", StringBuf_Value(db->global_acc_reg_str_table), account_id) )
 		Sql_ShowDebug(sql_handle);
 	else

+ 2 - 2
src/map/itemdb.c

@@ -1076,7 +1076,7 @@ bool itemdb_parse_roulette_db(void)
 	uint32 count = 0;
 
 	// retrieve all rows from the item database
-	if (SQL_ERROR == Sql_Query(mmysql_handle, "SELECT * FROM `%s`", roulette_table)) {
+	if (SQL_ERROR == Sql_Query(mmysql_handle, "SELECT * FROM `%s`", mapserv_table(roulette_table))) {
 		Sql_ShowDebug(mmysql_handle);
 		return false;
 	}
@@ -1156,7 +1156,7 @@ bool itemdb_parse_roulette_db(void)
 		}
 	}
 
-	ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, roulette_table);
+	ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, mapserv_table(roulette_table));
 
 	return true;
 }

+ 5 - 3
src/map/mapreg.c

@@ -323,9 +323,11 @@ void mapreg_final(void)
  */
 void mapreg_init(void)
 {
-	mapreg_db = idb_alloc(DB_OPT_BASE);
-	mapregstr_db = idb_alloc(DB_OPT_RELEASE_DATA);
-	safestrncpy(mapreg_table, StringBuf_Value(mapserv_schema_config.mapreg_table), sizeof(mapreg_table));
+	regs.vars = i64db_alloc(DB_OPT_BASE);
+	mapreg_ers = ers_new(sizeof(struct mapreg_save), "mapreg.c:mapreg_ers", ERS_OPT_CLEAN);
+
+	skip_insert = false;
+	regs.arrays = NULL;
 
 	script_load_mapreg();