コード例 #1
0
ファイル: storagedb_sql.c プロジェクト: Lilystar/Auriga
/*==========================================
 * ギルド倉庫削除
 *------------------------------------------
 */
bool gstoragedb_sql_delete(int guild_id)
{
	const struct guild_storage *s = gstoragedb_sql_load(guild_id);
	bool result = false;

	if( sqldbs_transaction_start(&mysql_handle) == false )
		return result;

	// try
	do
	{
		if(s) {
			int i;
			for(i = 0; i < s->storage_amount; i++) {
				// ペット削除
				if( s->store_item[i].card[0] == (short)0xff00) {
					if( petdb_delete(*((int *)(&s->store_item[i].card[1]))) == false )
						break;
				}
			}
			if(i != s->storage_amount)
				break;
		}

		// delete
		if( sqldbs_query(&mysql_handle, "DELETE FROM `" GUILD_STORAGE_TABLE "` WHERE `guild_id`='%d'", guild_id) == false )
			break;

		// success
		result = true;

		{
			// cache delete
			struct guild_storage *s2 = (struct guild_storage *)numdb_erase(gstorage_db, guild_id);
			if(s2) {
				aFree(s2);
			}
		}
	} while(0);

	sqldbs_transaction_end(&mysql_handle, result);

	return result;
}
コード例 #2
0
ファイル: storagedb_txt.c プロジェクト: AurigaProject/root
/*==========================================
 * 倉庫データ削除
 *------------------------------------------
 */
bool storagedb_txt_delete(int account_id)
{
	struct storage *s = (struct storage *)numdb_search(storage_db, account_id);

	if(s) {
		int i;
		for(i = 0; i < s->storage_amount; i++) {
			// ペット削除
			if(s->store_item[i].card[0] == (short)0xff00)
				petdb_delete(*((int *)(&s->store_item[i].card[1])));
		}
		numdb_erase(storage_db, account_id);
		aFree(s);
#ifdef TXT_JOURNAL
		if( storage_journal_enable )
			journal_write( &storage_journal, account_id, NULL );
#endif
	}
	return true;
}