summaryrefslogtreecommitdiff
path: root/src/char/int_elemental.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-09-22 09:56:48 +0200
committerHaru <haru@dotalux.com>2013-09-22 09:56:48 +0200
commit469102135fd5429a4225afe378bed3e82dc81d31 (patch)
tree281e2f661c9affe3870669b4faceb173c96e674f /src/char/int_elemental.c
parentbeaf3a26a60d5b0429a577b7d58232957d4483e7 (diff)
downloadhercules-469102135fd5429a4225afe378bed3e82dc81d31.tar.gz
hercules-469102135fd5429a4225afe378bed3e82dc81d31.tar.bz2
hercules-469102135fd5429a4225afe378bed3e82dc81d31.tar.xz
hercules-469102135fd5429a4225afe378bed3e82dc81d31.zip
Corrected various hardcoded database table names
- Added an elemental_db setting to inter-server.conf (elemental table) - Switched an instance of hardcoded `ipbanlist` to use the ipban_table setting; thanks to Takkun, related to issue #135 - Switched two instances of hardcoded `char` to use the char_db setting - Added a TODO notice about the usage of the login table (on a side note, hardcoded) from the login server (related to issue #142) Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/char/int_elemental.c')
-rw-r--r--src/char/int_elemental.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/char/int_elemental.c b/src/char/int_elemental.c
index 53a63a212..ed0c2a9ed 100644
--- a/src/char/int_elemental.c
+++ b/src/char/int_elemental.c
@@ -21,9 +21,9 @@ bool mapif_elemental_save(struct s_elemental* ele) {
if( ele->elemental_id == 0 ) { // Create new DB entry
if( SQL_ERROR == SQL->Query(sql_handle,
- "INSERT INTO `elemental` (`char_id`,`class`,`mode`,`hp`,`sp`,`max_hp`,`max_sp`,`atk1`,`atk2`,`matk`,`aspd`,`def`,`mdef`,`flee`,`hit`,`life_time`)"
- "VALUES ('%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%u')",
- ele->char_id, ele->class_, ele->mode, ele->hp, ele->sp, ele->max_hp, ele->max_sp, ele->atk, ele->atk2, ele->matk, ele->amotion, ele->def, ele->mdef, ele->flee, ele->hit, ele->life_time) )
+ "INSERT INTO `%s` (`char_id`,`class`,`mode`,`hp`,`sp`,`max_hp`,`max_sp`,`atk1`,`atk2`,`matk`,`aspd`,`def`,`mdef`,`flee`,`hit`,`life_time`)"
+ "VALUES ('%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%u')",
+ elemental_db, ele->char_id, ele->class_, ele->mode, ele->hp, ele->sp, ele->max_hp, ele->max_sp, ele->atk, ele->atk2, ele->matk, ele->amotion, ele->def, ele->mdef, ele->flee, ele->hit, ele->life_time) )
{
Sql_ShowDebug(sql_handle);
flag = false;
@@ -31,11 +31,11 @@ bool mapif_elemental_save(struct s_elemental* ele) {
else
ele->elemental_id = (int)SQL->LastInsertId(sql_handle);
} else if( SQL_ERROR == SQL->Query(sql_handle,
- "UPDATE `elemental` SET `char_id` = '%d', `class` = '%d', `mode` = '%d', `hp` = '%d', `sp` = '%d',"
- "`max_hp` = '%d', `max_sp` = '%d', `atk1` = '%d', `atk2` = '%d', `matk` = '%d', `aspd` = '%d', `def` = '%d',"
- "`mdef` = '%d', `flee` = '%d', `hit` = '%d', `life_time` = '%u' WHERE `ele_id` = '%d'",
- ele->char_id, ele->class_, ele->mode, ele->hp, ele->sp, ele->max_hp, ele->max_sp, ele->atk, ele->atk2,
- ele->matk, ele->amotion, ele->def, ele->mdef, ele->flee, ele->hit, ele->life_time, ele->elemental_id) )
+ "UPDATE `%s` SET `char_id` = '%d', `class` = '%d', `mode` = '%d', `hp` = '%d', `sp` = '%d',"
+ "`max_hp` = '%d', `max_sp` = '%d', `atk1` = '%d', `atk2` = '%d', `matk` = '%d', `aspd` = '%d', `def` = '%d',"
+ "`mdef` = '%d', `flee` = '%d', `hit` = '%d', `life_time` = '%u' WHERE `ele_id` = '%d'",
+ elemental_db, ele->char_id, ele->class_, ele->mode, ele->hp, ele->sp, ele->max_hp, ele->max_sp, ele->atk, ele->atk2,
+ ele->matk, ele->amotion, ele->def, ele->mdef, ele->flee, ele->hit, ele->life_time, ele->elemental_id) )
{ // Update DB entry
Sql_ShowDebug(sql_handle);
flag = false;
@@ -50,9 +50,11 @@ bool mapif_elemental_load(int ele_id, int char_id, struct s_elemental *ele) {
ele->elemental_id = ele_id;
ele->char_id = char_id;
- if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `class`, `mode`, `hp`, `sp`, `max_hp`, `max_sp`, `atk1`, `atk2`, `matk`, `aspd`,"
- "`def`, `mdef`, `flee`, `hit`, `life_time` FROM `elemental` WHERE `ele_id` = '%d' AND `char_id` = '%d'",
- ele_id, char_id) ) {
+ if( SQL_ERROR == SQL->Query(sql_handle,
+ "SELECT `class`, `mode`, `hp`, `sp`, `max_hp`, `max_sp`, `atk1`, `atk2`, `matk`, `aspd`,"
+ "`def`, `mdef`, `flee`, `hit`, `life_time` FROM `%s` WHERE `ele_id` = '%d' AND `char_id` = '%d'",
+ elemental_db, ele_id, char_id) )
+ {
Sql_ShowDebug(sql_handle);
return false;
}
@@ -85,7 +87,7 @@ bool mapif_elemental_load(int ele_id, int char_id, struct s_elemental *ele) {
}
bool mapif_elemental_delete(int ele_id) {
- if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `elemental` WHERE `ele_id` = '%d'", ele_id) ) {
+ if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `ele_id` = '%d'", elemental_db, ele_id) ) {
Sql_ShowDebug(sql_handle);
return false;
}