summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-18 22:43:41 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-18 22:43:41 +0000
commit6ce5dacb5b15f16ff4c672596c091a41a190d687 (patch)
treee2cf5b1ee2869933472b21a3b609ad813fb07652
parent504f2e94093f05ce66be9bf54a5fa64cf5a53d3d (diff)
downloadhercules-6ce5dacb5b15f16ff4c672596c091a41a190d687.tar.gz
hercules-6ce5dacb5b15f16ff4c672596c091a41a190d687.tar.bz2
hercules-6ce5dacb5b15f16ff4c672596c091a41a190d687.tar.xz
hercules-6ce5dacb5b15f16ff4c672596c091a41a190d687.zip
- Removed the old 'mapserver charsave' mechanism
- Fixed some wrong sql login logic - Fixed some compiler warnings, cleaned up mapserver sql-related vars git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10027 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt3
-rw-r--r--conf-tmpl/Changelog.txt2
-rw-r--r--conf-tmpl/inter_athena.conf7
-rw-r--r--src/char_sql/char.h1
-rw-r--r--src/login_sql/login.c30
-rw-r--r--src/map/Makefile4
-rw-r--r--src/map/atcommand.c2
-rw-r--r--src/map/charsave.c523
-rw-r--r--src/map/charsave.h21
-rw-r--r--src/map/chrif.c26
-rw-r--r--src/map/chrif.h2
-rw-r--r--src/map/map.c110
-rw-r--r--src/map/map.h9
-rw-r--r--src/map/mercenary.c1
-rw-r--r--src/map/npc.c5
-rw-r--r--src/map/npc_chat.c4
-rw-r--r--vcproj-6/map-server_sql.dsp8
-rw-r--r--vcproj-6/map-server_txt.dsp8
-rw-r--r--vcproj-7.1/map-server_sql.vcproj6
-rw-r--r--vcproj-7.1/map-server_txt.vcproj6
-rw-r--r--vcproj-8/login-server_sql.vcproj2
-rw-r--r--vcproj-8/map-server_sql.vcproj8
-rw-r--r--vcproj-8/map-server_txt.vcproj8
23 files changed, 48 insertions, 748 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 51cb8290f..4229e78a5 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/03/19
+ * Fixed some wrong sql login logic
+ * Fixed some compiler warnings, cleaned up mapserver sql-related vars
+ * Removed the old 'mapserver charsave' mechanism [ultramage]
* Globalised use of script_pushint and script_getdata in script.c
If someone need them, the regexp used was :
sed -i "s/& *(st->stack->stack_data\[st->start *+ *\([^]]*\)\])/script_getdata(st,\1)/g" script.c
diff --git a/conf-tmpl/Changelog.txt b/conf-tmpl/Changelog.txt
index 8583c9e46..8d3252dd9 100644
--- a/conf-tmpl/Changelog.txt
+++ b/conf-tmpl/Changelog.txt
@@ -1,5 +1,7 @@
Date Added
+2007/03/19
+ * Removed the 'charsave_method' setting from inter_athena.conf
2007/03/17
* Cleaned up the login & char config [ultramage]
- removed check_ip_flag
diff --git a/conf-tmpl/inter_athena.conf b/conf-tmpl/inter_athena.conf
index 1822ba74f..29a14461a 100644
--- a/conf-tmpl/inter_athena.conf
+++ b/conf-tmpl/inter_athena.conf
@@ -36,13 +36,6 @@ party_share_level: 10
// SQL version options only
-// Char-Save method
-// 0 = saves over the charserver [default]
-// 1 = map server saves character data (reduces strain on the charserver)
-// NOTE: Feature still somewhat experimental, needs more testing.
-// WARNING: Don't use it in multi char/map or customized table names config.
-charsave_method: 0
-
// GM Reading Method
// 1 to have Char read GMs, 0 to have Login-controlled GMs
gm_read_method: 0
diff --git a/src/char_sql/char.h b/src/char_sql/char.h
index 41ce45ea6..2f3db1216 100644
--- a/src/char_sql/char.h
+++ b/src/char_sql/char.h
@@ -67,7 +67,6 @@ extern char char_name_letters[];
extern bool char_gm_read;
extern int autosave_interval;
extern int save_log;
-extern int charsave_method;
extern char db_path[];
extern char char_db[256];
extern char scdata_db[256];
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index e2d63626e..3986279f5 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -46,7 +46,7 @@ struct Login_Config {
char date_format[32]; // date format used in messages
bool console; // console input system enabled?
unsigned int ip_sync_interval; // interval (in minutes) to execute a DNS/IP update (for dynamic IPs)
- unsigned short min_level_to_connect; // minimum level of player/GM (0: player, 1-99: gm) to connect
+ int min_level_to_connect; // minimum level of player/GM (0: player, 1-99: gm) to connect
bool new_account_flag; // autoregistration via _M/_F ?
bool case_sensitive; // are logins case sensitive ?
bool use_md5_passwds; // work with password hashes instead of plaintext passwords?
@@ -1450,7 +1450,6 @@ int parse_login(int fd)
#endif
result=mmo_auth(&account, fd);
-
jstrescapecpy(t_uid,account.userid);
if(result==-1){
if (login_config.min_level_to_connect > account.level) {
@@ -1515,11 +1514,11 @@ int parse_login(int fd)
}
}
} else {
- const char* error = "";
WFIFOHEAD(fd,23);
if (login_config.log_login)
{
- switch((result + 1)) {
+ const char* error;
+ switch ((result + 1)) {
case -2: error = "Account banned."; break; //-3 = Account Banned
case -1: error = "dynamic ban (ip and account)."; break; //-2 = Dynamic Ban
case 1: error = "Unregistered ID."; break; // 0 = Unregistered ID
@@ -1554,7 +1553,7 @@ int parse_login(int fd)
ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmpsql);
}
- } //End login log of error.
+ }
if ((result == 1) && login_config.dynamic_pass_failure_ban && login_config.log_login) { // failed password
sprintf(tmpsql,"SELECT count(*) FROM `%s` WHERE `ip` = '%u' AND `rcode` = '1' AND `time` > NOW() - INTERVAL %d MINUTE",
@@ -1599,16 +1598,11 @@ int parse_login(int fd)
WFIFOW(fd,0)=0x6a;
WFIFOB(fd,2)=result;
if (result == 6) { // 6 = Your are Prohibited to log in until %s
- if (sql_row && atol(sql_row[0]) != 0) { // if account is banned, we send ban timestamp
- char tmpstr[20];
- time_t ban_until_time;
- ban_until_time = atol(sql_row[0]);
- strftime(tmpstr, 20, login_config.date_format, localtime(&ban_until_time));
- tmpstr[19] = '\0';
- memcpy(WFIFOP(fd,3), tmpstr, 20);
- } else { // we send error message
- memcpy(WFIFOP(fd,3), error, 20);
- }
+ char tmpstr[20];
+ time_t ban_until_time = (sql_row) ? atol(sql_row[0]) : 0;
+ strftime(tmpstr, 20, login_config.date_format, localtime(&ban_until_time));
+ tmpstr[19] = '\0';
+ strncpy(WFIFOP(fd,3), tmpstr, 20); // ban timestamp goes here
}
WFIFOSET(fd,23);
}
@@ -1635,14 +1629,14 @@ int parse_login(int fd)
if(RFIFOREST(fd)<86)
return 0;
{
- unsigned char* server_name;
+ char* server_name;
WFIFOHEAD(fd, 3);
memcpy(account.userid,RFIFOP(fd, 2),NAME_LENGTH);
account.userid[23] = '\0';
memcpy(account.passwd,RFIFOP(fd, 26),NAME_LENGTH);
account.passwd[23] = '\0';
account.passwdenc = 0;
- server_name = RFIFOP(fd,60);
+ server_name = (char*)RFIFOP(fd,60);
server_name[20] = '\0';
ShowInfo("server connection request %s @ %d.%d.%d.%d:%d (%d.%d.%d.%d)\n",
server_name, RFIFOB(fd, 54), RFIFOB(fd, 55), RFIFOB(fd, 56), RFIFOB(fd, 57), RFIFOW(fd, 58),
@@ -1903,7 +1897,7 @@ int login_config_read(const char* cfgName)
if (login_config.login_ip)
ShowStatus("Login server binding IP address : %s -> %s\n", w2, login_ip_str);
} else if(!strcmpi(w1,"login_port")) {
- login_config.login_port = atoi(w2);
+ login_config.login_port = (unsigned short)atoi(w2);
ShowStatus("set login_port : %s\n",w2);
}
else if (!strcmpi(w1,"ipban"))
diff --git a/src/map/Makefile b/src/map/Makefile
index 5f9f122e8..10af86c8f 100644
--- a/src/map/Makefile
+++ b/src/map/Makefile
@@ -24,8 +24,7 @@ OBJECTS = obj/map.o obj/chrif.o obj/clif.o obj/pc.o obj/status.o obj/npc.o \
obj/npc_chat.o obj/chat.o obj/path.o obj/itemdb.o obj/mob.o obj/script.o \
obj/storage.o obj/skill.o obj/atcommand.o obj/charcommand.o obj/battle.o \
obj/intif.o obj/trade.o obj/party.o obj/vending.o obj/guild.o obj/pet.o \
- obj/log.o obj/mail.o obj/charsave.o obj/date.o obj/irc.o obj/unit.o \
- obj/mercenary.o \
+ obj/log.o obj/mail.o obj/date.o obj/irc.o obj/unit.o obj/mercenary.o \
$(COMMON_OBJ)
map-server: $(OBJECTS:obj/%=txtobj/%)
@@ -99,7 +98,6 @@ sqlobj/pet.o: pet.c pet.h map.h clif.h chrif.h intif.h pc.h itemdb.h battle.h mo
sqlobj/mail.o: mail.c mail.h $(COMMON_H)
sqlobj/log.o: log.c log.h map.h $(COMMON_H)
sqlobj/charcommand.o: charcommand.c charcommand.h itemdb.h pc.h map.h skill.h clif.h mob.h intif.h battle.h storage.h guild.h pet.h log.h $(COMMON_H)
-sqlobj/charsave.o: charsave.c charsave.h $(COMMON_H)
sqlobj/date.o: date.c date.h $(COMMON_H)
sqlobj/irc.o: irc.c irc.h map.h pc.h $(COMMON_H)
sqlobj/unit.o: unit.c unit.h $(COMMON_H)
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 72664aa1c..25a6b4e19 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -2913,6 +2913,8 @@ int atcommand_gm(const int fd, struct map_session_data* sd, const char* command,
return 0;
}
+// helper function, used in foreach calls to stop auto-attack timers
+// parameter: '0' - everyone, 'id' - only those attacking someone with that id
static int atcommand_stopattack(struct block_list *bl,va_list ap)
{
struct unit_data *ud = unit_bl2ud(bl);
diff --git a/src/map/charsave.c b/src/map/charsave.c
deleted file mode 100644
index 13724cffd..000000000
--- a/src/map/charsave.c
+++ /dev/null
@@ -1,523 +0,0 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "../common/cbasetypes.h"
-#include "../common/core.h"
-#include "../common/socket.h"
-#include "../common/timer.h"
-#include "../common/nullpo.h"
-#include "../common/mmo.h"
-#include "../common/strlib.h"
-#include "../common/showmsg.h"
-#include "../common/malloc.h"
-
-#include "charsave.h"
-#include "map.h"
-
-#ifndef TXT_ONLY
-
-struct mmo_charstatus *charsave_loadchar(int charid){
- int i,j, friends;
- struct mmo_charstatus *c;
- char *str_p;
- double exp;
- friends = 0;
-
- c = (struct mmo_charstatus *)aCalloc(1,sizeof(struct mmo_charstatus));
-
- if(charid <= 0){
- ShowError("charsave_loadchar() charid <= 0! (%d)", charid);
- aFree(c);
- return NULL;
- }
- // add homun_id [albator]
- //Tested, Mysql 4.1.9+ has no problems with the long query, the buf is 65k big and the sql server needs for it 0.00009 secs on an athlon xp 2400+ WinXP (1GB Mem) .. [Sirius]
- sprintf(tmp_sql, "SELECT `char_id`,`account_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`, `str`,`agi`,`vit`,`int`,`dex`,`luk`, `max_hp`,`hp`,`max_sp`,`sp`,`status_point`,`skill_point`, `option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`hair`,`hair_color`, `clothes_color`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`, `last_map`,`last_x`,`last_y`,`save_map`,`save_x`,`save_y`, `partner_id`, `father`, `mother`, `child`, `fame`, `homun_id` FROM `char` WHERE `char_id` = '%d'", charid);
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- aFree(c);
- return NULL;
- }
-
- charsql_res = mysql_store_result(&charsql_handle);
- if(mysql_num_rows(charsql_res) <= 0){
- ShowWarning("charsave_loadchar() -> CHARACTER NOT FOUND! (id: %d)\n", charid);
- mysql_free_result(charsql_res);
- aFree(c);
- return NULL;
- }
-
- //fetch data
- charsql_row = mysql_fetch_row(charsql_res);
-
- //fill with data
- c->char_id = charid;
- c->account_id = atoi(charsql_row[1]);
- c->char_num = atoi(charsql_row[2]);
- strcpy(c->name, charsql_row[3]);
- c->class_ = atoi(charsql_row[4]);
- c->base_level = atoi(charsql_row[5]);
- c->job_level = atoi(charsql_row[6]);
- exp = atof(charsql_row[7]);
- c->base_exp = (unsigned int)cap_value(exp,0,UINT_MAX);
- exp = atof(charsql_row[8]);
- c->job_exp = (unsigned int)cap_value(exp,0,UINT_MAX);
- c->zeny = atoi(charsql_row[9]);
- c->str = atoi(charsql_row[10]);
- c->agi = atoi(charsql_row[11]);
- c->vit = atoi(charsql_row[12]);
- c->int_ = atoi(charsql_row[13]);
- c->dex = atoi(charsql_row[14]);
- c->luk = atoi(charsql_row[15]);
- c->max_hp = atoi(charsql_row[16]);
- c->hp = atoi(charsql_row[17]);
- c->max_sp = atoi(charsql_row[18]);
- c->sp = atoi(charsql_row[19]);
- c->status_point = atoi(charsql_row[20]) > USHRT_MAX? USHRT_MAX : atoi(charsql_row[20]);
- c->skill_point = atoi(charsql_row[21]) > USHRT_MAX? USHRT_MAX : atoi(charsql_row[21]);
- c->option = atoi(charsql_row[22]);
- c->karma = atoi(charsql_row[23]);
- c->manner = atoi(charsql_row[24]);
- c->party_id = atoi(charsql_row[25]);
- c->guild_id = atoi(charsql_row[26]);
- c->pet_id = atoi(charsql_row[27]);
- c->hair = atoi(charsql_row[28]);
- c->hair_color = atoi(charsql_row[29]);
- c->clothes_color = atoi(charsql_row[30]);
- c->weapon = atoi(charsql_row[31]);
- c->shield = atoi(charsql_row[32]);
- c->head_top = atoi(charsql_row[33]);
- c->head_mid = atoi(charsql_row[34]);
- c->head_bottom = atoi(charsql_row[35]);
- c->last_point.map = mapindex_name2id(charsql_row[36]);
- c->last_point.x = atoi(charsql_row[37]);
- c->last_point.y = atoi(charsql_row[38]);
- c->save_point.map = mapindex_name2id(charsql_row[39]);
- c->save_point.x = atoi(charsql_row[40]);
- c->save_point.y = atoi(charsql_row[41]);
- c->partner_id = atoi(charsql_row[42]);
- c->father = atoi(charsql_row[43]);
- c->mother = atoi(charsql_row[44]);
- c->child = atoi(charsql_row[45]);
- c->fame = atoi(charsql_row[46]);
- c->hom_id = atoi(charsql_row[47]); // albator
-
- mysql_free_result(charsql_res);
-
- //Check for '0' Savepoint / LastPoint
- if (c->last_point.x == 0 || c->last_point.y == 0 || c->last_point.map == 0){
- c->last_point.map = mapindex_name2id(MAP_PRONTERA);
- c->last_point.x = 100;
- c->last_point.y = 100;
- }
-
- if (c->save_point.x == 0 || c->save_point.y == 0 || c->save_point.map == 0){
- c->save_point.map = mapindex_name2id(MAP_PRONTERA);
- c->save_point.x = 100;
- c->save_point.y = 100;
- }
-
-
- //read the memo points
- sprintf(tmp_sql, "SELECT `memo_id`, `char_id`, `map`, `x`, `y` FROM `memo` WHERE `char_id` = '%d' ORDER BY `memo_id`", charid);
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- aFree(c);
- return NULL;
- }
-
- charsql_res = mysql_store_result(&charsql_handle);
- if(charsql_res){
- for(i = 0; (charsql_row = mysql_fetch_row(charsql_res)); i++){
- c->memo_point[i].map = mapindex_name2id(charsql_row[2]);
- c->memo_point[i].x = atoi(charsql_row[3]);
- c->memo_point[i].y = atoi(charsql_row[4]);
- }
- mysql_free_result(charsql_res);
- }
-
- //read inventory...
- str_p = tmp_sql;
- str_p += sprintf(str_p, "SELECT `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`");
- for (i = 0; i < MAX_SLOTS; i++)
- str_p += sprintf(str_p, ", `card%d`", i);
- str_p += sprintf(str_p, " FROM `inventory` WHERE `char_id` = '%d'", charid);
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- aFree(c);
- return NULL;
- }
-
- charsql_res = mysql_store_result(&charsql_handle);
- if(charsql_res){
- for(i = 0; (charsql_row = mysql_fetch_row(charsql_res)); i++){
- //c->inventory[i].id = atoi(charsql_row[0]);
- c->inventory[i].nameid = atoi(charsql_row[0]);
- c->inventory[i].amount = atoi(charsql_row[1]);
- c->inventory[i].equip = atoi(charsql_row[2]);
- c->inventory[i].identify = atoi(charsql_row[3]);
- c->inventory[i].refine = atoi(charsql_row[4]);
- c->inventory[i].attribute = atoi(charsql_row[5]);
- for (j = 0; j < MAX_SLOTS; j++)
- c->inventory[i].card[j] = atoi(charsql_row[6+j]);
- }
- mysql_free_result(charsql_res);
- }
-
-
- //cart inventory ..
- str_p = tmp_sql;
- str_p += sprintf(str_p, "SELECT `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`");
- for (i = 0; i < MAX_SLOTS; i++)
- str_p += sprintf(str_p, ", `card%d`", i);
- str_p += sprintf(str_p, " FROM `cart_inventory` WHERE `char_id` = '%d'", charid);
-
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- aFree(c);
- return NULL;
- }
-
- charsql_res = mysql_store_result(&charsql_handle);
- if(charsql_res){
- for(i = 0; (charsql_row = mysql_fetch_row(charsql_res)); i++){
- //c->cart[i].id = atoi(charsql_row[0]);
- c->cart[i].nameid = atoi(charsql_row[0]);
- c->cart[i].amount = atoi(charsql_row[1]);
- c->cart[i].equip = atoi(charsql_row[2]);
- c->cart[i].identify = atoi(charsql_row[3]);
- c->cart[i].refine = atoi(charsql_row[4]);
- c->cart[i].attribute = atoi(charsql_row[5]);
- for (j = 0; j < MAX_SLOTS; j++)
- c->cart[i].card[j] = atoi(charsql_row[6+j]);
- }
- mysql_free_result(charsql_res);
- }
-
-
- //Skills...
- sprintf(tmp_sql, "SELECT `char_id`, `id`, `lv` FROM `skill` WHERE `char_id` = '%d'", charid);
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- aFree(c);
- return NULL;
- }
-
- charsql_res = mysql_store_result(&charsql_handle);
- if(charsql_res){
- while((charsql_row = mysql_fetch_row(charsql_res))){
- i = atoi(charsql_row[1]);
- c->skill[i].id = i;
- c->skill[i].lv = atoi(charsql_row[2]);
- }
- mysql_free_result(charsql_res);
- }
-/* Reg values are handled by the char server.
- //Global REG
- sprintf(tmp_sql, "SELECT `char_id`, `str`, `value` FROM `global_reg_value` WHERE `type` = '3' AND `char_id` = '%d'", charid);
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- aFree(c);
- return NULL;
- }
-
- charsql_res = mysql_store_result(&charsql_handle);
- if(charsql_res){
- for(i = 0; (charsql_row = mysql_fetch_row(charsql_res)); i++){
- strcpy(c->global_reg[i].str, charsql_row[1]);
- strcpy(c->global_reg[i].value, charsql_row[2]);
- }
- mysql_free_result(charsql_res);
- c->global_reg_num = i;
- }
-*/
-
- //Shamelessly stolen from its_sparky (ie: thanks) and then assimilated by [Skotlex]
- //Friend list
- sprintf(tmp_sql, "SELECT f.friend_account, f.friend_id, c.name FROM friends f LEFT JOIN `char` c ON f.friend_account=c.account_id AND f.friend_id=c.char_id WHERE f.char_id='%d'", charid);
-
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- sql_res = NULL; //To avoid trying to read data.
- }
- else
- sql_res = mysql_store_result(&charsql_handle);
-
- if(sql_res)
- {
- for(i = 0; (sql_row = mysql_fetch_row(sql_res)) && i<MAX_FRIENDS; i++)
- {
- if (sql_row[2] != NULL)
- {
- c->friends[i].account_id = atoi(sql_row[0]);
- c->friends[i].char_id = atoi(sql_row[1]);
- strncpy(c->friends[i].name, sql_row[2], NAME_LENGTH-1); //The -1 is to avoid losing the ending \0 [Skotlex]
- }
- }
- mysql_free_result(sql_res);
- }
-
- ShowInfo("charsql_loadchar(): loading of '%d' (%s) complete.\n", charid, c->name);
- return c;
-}
-
-int charsave_savechar(int charid, struct mmo_charstatus *c){
- int i,j;
- char *str_p;
-// char tmp_str[64];
-// char tmp_str2[512];
- //First save the 'char'
- sprintf(tmp_sql ,"UPDATE `char` SET `class`='%d', `base_level`='%d', `job_level`='%d',"
- "`base_exp`='%u', `job_exp`='%u', `zeny`='%d',"
- "`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%d',`skill_point`='%d',"
- "`str`='%d',`agi`='%d',`vit`='%d',`int`='%d',`dex`='%d',`luk`='%d',"
- "`option`='%d',`karma`='%d',`manner`='%d',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',"
- "`hair`='%d',`hair_color`='%d',`clothes_color`='%d',`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d',"
- "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d',"
- "`partner_id`='%d', `father`='%d', `mother`='%d', `child`='%d', `fame`='%d', `homun_id`='%d'"
- "WHERE `account_id`='%d' AND `char_id` = '%d'",
- c->class_, c->base_level, c->job_level,
- c->base_exp, c->job_exp, c->zeny,
- c->max_hp, c->hp, c->max_sp, c->sp, c->status_point, c->skill_point,
- c->str, c->agi, c->vit, c->int_, c->dex, c->luk,
- c->option, c->karma, c->manner, c->party_id, c->guild_id, c->pet_id,
- c->hair, c->hair_color, c->clothes_color,
- c->weapon, c->shield, c->head_top, c->head_mid, c->head_bottom,
- mapindex_id2name(c->last_point.map), c->last_point.x, c->last_point.y,
- mapindex_id2name(c->save_point.map), c->save_point.x, c->save_point.y, c->partner_id, c->father, c->mother,
- c->child, c->fame, c->hom_id, c->account_id, c->char_id
- );
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
-
-
- //Save the inventory
- sprintf(tmp_sql, "DELETE FROM `inventory` WHERE `char_id` = '%d'", charid);
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- for(i = 0; i < MAX_INVENTORY; i++){
- if(c->inventory[i].nameid > 0){
- str_p = tmp_sql;
- str_p += sprintf(str_p, "INSERT INTO `inventory` (`char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`");
- for (j = 0; j < MAX_SLOTS; j++)
- str_p += sprintf(str_p, ", `card%d`", j);
-
- str_p += sprintf(str_p, ") VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%d'",
- charid, c->inventory[i].nameid, c->inventory[i].amount, c->inventory[i].equip,
- c->inventory[i].identify, c->inventory[i].refine, c->inventory[i].attribute);
-
- for (j = 0; j < MAX_SLOTS; j++)
- str_p += sprintf(str_p, ", '%d'", c->inventory[i].card[j]);
-
- strcat(tmp_sql,")");
-
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- }
- }
-
- //Save the cart
- sprintf(tmp_sql, "DELETE FROM `cart_inventory` WHERE `char_id` = '%d'", charid);
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- for(i = 0; i < MAX_CART; i++){
- if(c->cart[i].nameid > 0){
- str_p = tmp_sql;
- str_p += sprintf(str_p, "INSERT INTO `cart_inventory` (`char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`");
- for (j = 0; j < MAX_SLOTS; j++)
- str_p += sprintf(str_p, ", `card%d`", j);
-
- str_p += sprintf(str_p, ") VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%d'",
- charid, c->cart[i].nameid, c->cart[i].amount, c->cart[i].equip,
- c->cart[i].identify, c->cart[i].refine, c->cart[i].attribute);
-
- for (j = 0; j < MAX_SLOTS; j++)
- str_p += sprintf(str_p, ", '%d'", c->cart[i].card[j]);
-
- strcat(tmp_sql,")");
-
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- }
- }
-
-
- //Save memo points
- sprintf(tmp_sql, "DELETE FROM `memo` WHERE `char_id` = '%d'", charid);
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- for(i = 0; i < MAX_MEMOPOINTS; i++){
- if(c->memo_point[i].map && c->memo_point[i].x > 0 && c->memo_point[i].y > 0){
- sprintf(tmp_sql, "INSERT INTO `memo` ( `char_id`, `map`, `x`, `y` ) VALUES ('%d', '%s', '%d', '%d')", charid, mapindex_id2name(c->memo_point[i].map), c->memo_point[i].x, c->memo_point[i].y);
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- }
- }
-
-
- //Save skills
- sprintf(tmp_sql, "DELETE FROM `skill` WHERE `char_id` = '%d'", charid);
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- for(i = 0; i < MAX_SKILL; i++){
- if(c->skill[i].id > 0){
- sprintf(tmp_sql, "INSERT INTO `skill` (`char_id`, `id`, `lv`) VALUES ('%d', '%d', '%d')", charid, c->skill[i].id, c->skill[i].lv);
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- }
- }
-
-
-/* Reg values are handled by the char server.
- //global_reg_value saving
- sprintf(tmp_sql, "DELETE FROM `global_reg_value` WHERE `type`=3 AND `char_id` = '%d'", charid);
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- for(i = 0; i < c->global_reg_num; i++){
- if(c->global_reg[i].str){
- if(c->global_reg[i].value){
- //jstrescapecpy(tmp_str, c->global_reg[i].str);
- sprintf(tmp_sql, "INSERT INTO `global_reg_value` (`char_id`, `str`, `value`) VALUES ('%d', '%s', '%s')", charid, jstrescapecpy(tmp_str,c->global_reg[i].str), jstrescapecpy(tmp_str2,c->global_reg[i].value));
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- }
- }
- }
-*/
-
- //friendlist saving
- sprintf(tmp_sql, "DELETE FROM `friends` WHERE `char_id` = '%d'", charid);
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- for(i = 0; i < MAX_FRIENDS; i++){
- if(c->friends[i].char_id > 0){
- sprintf(tmp_sql, "INSERT INTO `friends` (`char_id`, `friend_account`, `friend_id`) VALUES ('%d','%d','%d')", charid, c->friends[i].account_id, c->friends[i].char_id);
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- }
- }
-
- ShowInfo("charsql_savechar(): saving of '%d' (%s) complete.\n", charid, c->name);
- return 0;
-}
-
-int charsave_load_scdata(int account_id, int char_id)
-{ //Loads character's sc_data
- struct map_session_data *sd;
-
- sd = map_id2sd(account_id);
- if (!sd)
- {
- ShowError("charsave_load_scdata: Player of AID %d not found!\n", account_id);
- return -1;
- }
- if (sd->status.char_id != char_id)
- {
- ShowError("charsave_load_scdata: Receiving data for account %d, char id does not matches (%d != %d)!\n", account_id, sd->status.char_id, char_id);
- return -1;
- }
- sprintf(tmp_sql, "SELECT `type`, `tick`, `val1`, `val2`, `val3`, `val4` FROM `sc_data`"
- "WHERE `account_id`='%d' AND `char_id`='%d'", account_id, char_id);
-
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- return -1;
- }
-
- sql_res = mysql_store_result(&charsql_handle);
- if(sql_res)
- {
- while ((sql_row = mysql_fetch_row(sql_res)))
- {
- if (atoi(sql_row[1]) < 1)
- { //Protection against invalid tick values. [Skotlex]
- ShowWarning("charsave_load_scdata: Received invalid duration (%d ms) for status change %d (character %s)\n", atoi(sql_row[1]), sd->status.name);
- continue;
- }
-
- status_change_start(&sd->bl, atoi(sql_row[0]), 10000, atoi(sql_row[2]), atoi(sql_row[3]),
- atoi(sql_row[4]), atoi(sql_row[5]), atoi(sql_row[1]), 15);
- }
- }
-
- //Once loaded, sc_data must be disposed.
- sprintf(tmp_sql, "DELETE FROM `sc_data` WHERE `account_id`='%d' AND `char_id`='%d'", account_id, char_id);
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- return 0;
-}
-
-void charsave_save_scdata(int account_id, int char_id, struct status_change* sc_data, int max_sc)
-{ //Saves character's sc_data.
- int i,count =0;
- struct TimerData *timer;
- unsigned int tick = gettick();
- char *p = tmp_sql;
-
- p += sprintf(p, "INSERT INTO `sc_data` (`account_id`, `char_id`, `type`, `tick`, `val1`, `val2`, `val3`, `val4`) VALUES ");
-
- for(i = 0; i < max_sc; i++)
- {
- if (sc_data->data[i].timer == -1)
- continue;
- timer = get_timer(sc_data->data[i].timer);
- if (timer == NULL || timer->func != status_change_timer || DIFF_TICK(timer->tick,tick) < 0)
- continue;
-
- p += sprintf(p, " ('%d','%d','%hu','%d','%d','%d','%d','%d'),", account_id, char_id,
- i, DIFF_TICK(timer->tick,tick), sc_data->data[i].val1, sc_data->data[i].val2, sc_data->data[i].val3, sc_data->data[i].val4);
-
- count++;
- }
- if (count > 0)
- {
- *--p = '\0'; //Remove the trailing comma.
- if(mysql_query(&charsql_handle, tmp_sql)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- }
- ShowInfo("charsql_save_scdata(): saved %d status changes of '%d:%d'.\n", count, account_id, char_id);
- return;
-}
-#endif
diff --git a/src/map/charsave.h b/src/map/charsave.h
deleted file mode 100644
index 5734ebf58..000000000
--- a/src/map/charsave.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
-
-#ifndef _CHARSAVE_H_
-#define _CHARSAVE_H_
-
-#include "status.h"
-
-#ifndef TXT_ONLY
- int charsave_loadHomunculus(int hom_id, struct homun_data *p);
- int charsave_saveHomunculus(struct homun_data *hd);
- int charsave_saveHomunculusSkills(struct homun_data *hd);
- int charsave_deleteHomunculus(struct homun_data *hd);
-
- struct mmo_charstatus *charsave_loadchar(int charid);
- int charsave_savechar(int charid, struct mmo_charstatus *c);
- int charsave_load_scdata(int account_id, int char_id);
- void charsave_save_scdata(int account_id, int char_id, struct status_change* sc_data, int max_sc);
-#endif
-
-#endif /* _CHARSAVE_H_ */
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 87517f40c..09565b608 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -23,9 +23,7 @@
#include "pc.h"
#include "status.h"
#include "mercenary.h"
-#ifndef TXT_ONLY
-#include "charsave.h"
-#endif
+
//Updated table (only doc^^) [Sirius]
//Used Packets: U->2af8
//Free Packets: F->2af8
@@ -210,16 +208,7 @@ int chrif_save(struct map_session_data *sd, int flag)
intif_saveregistry(sd, 2); //Save account regs
if (sd->state.reg_dirty&1)
intif_saveregistry(sd, 1); //Save account2 regs
-#ifndef TXT_ONLY
- if(charsave_method){ //New 'Local' save
- charsave_savechar(sd->status.char_id, &sd->status);
- if (flag) //Character final saved.
- sd->state.finalsave = 1;
- if (flag == 1)
- chrif_char_offline(sd); //Tell char server that character went offline.
- return 0;
- }
-#endif
+
WFIFOHEAD(char_fd, sizeof(sd->status) + 13);
WFIFOW(char_fd,0) = 0x2b01;
WFIFOW(char_fd,2) = sizeof(sd->status) + 13;
@@ -458,10 +447,6 @@ int chrif_sendmapack(int fd)
int chrif_scdata_request(int account_id, int char_id)
{
#ifdef ENABLE_SC_SAVING
-#ifndef TXT_ONLY
- if (charsave_method)
- return charsave_load_scdata(account_id, char_id);
-#endif
chrif_check(-1);
WFIFOHEAD(char_fd, 10);
@@ -1231,13 +1216,6 @@ int chrif_save_scdata(struct map_session_data *sd)
if (sd->state.finalsave) //Character was already saved?
return -1;
-#ifndef TXT_ONLY
- if(charsave_method) //New 'Local' save
- {
- charsave_save_scdata(sd->status.account_id, sd->status.char_id, &sd->sc, MAX_STATUSCHANGE);
- return 0;
- }
-#endif
chrif_check(-1);
tick = gettick();
diff --git a/src/map/chrif.h b/src/map/chrif.h
index a94591cd4..a80543d1a 100644
--- a/src/map/chrif.h
+++ b/src/map/chrif.h
@@ -48,8 +48,6 @@ int chrif_changesex(int id, int sex);
int chrif_chardisconnect(struct map_session_data *sd);
int check_connect_char_server(int tid, unsigned int tick, int id, int data);
-int chrif_pcauthok(int fd);
-
int do_final_chrif(void);
int do_init_chrif(void);
diff --git a/src/map/map.c b/src/map/map.c
index dfdda95b7..a438731de 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -46,65 +46,53 @@
#include "log.h"
-#include "charsave.h"
-
#include "irc.h"
#ifndef TXT_ONLY
-#include "mail.h" // mail system [Valaris]
+#include "mail.h"
-MYSQL mmysql_handle;
-MYSQL_RES* sql_res ;
-MYSQL_ROW sql_row ;
char tmp_sql[65535]="";
-
-MYSQL logmysql_handle; //For the log database - fix by [Maeki]
-MYSQL_RES* logsql_res ;
-MYSQL_ROW logsql_row ;
-
-MYSQL mail_handle; // mail system [Valaris]
-MYSQL_RES* mail_res ;
-MYSQL_ROW mail_row ;
+char default_codepage[32] = "";
int map_server_port = 3306;
char map_server_ip[16] = "127.0.0.1";
char map_server_id[32] = "ragnarok";
char map_server_pw[32] = "ragnarok";
char map_server_db[32] = "ragnarok";
-char default_codepage[32] = ""; //Feature by irmin.
-int db_use_sqldbs = 0;
+MYSQL mmysql_handle;
+MYSQL_RES* sql_res;
+MYSQL_ROW sql_row;
+int db_use_sqldbs = 0;
char item_db_db[32] = "item_db";
char item_db2_db[32] = "item_db2";
char mob_db_db[32] = "mob_db";
char mob_db2_db[32] = "mob_db2";
-int log_db_port = 3306;
+char char_db[32] = "char";
+
+// log database
char log_db_ip[16] = "127.0.0.1";
+int log_db_port = 3306;
char log_db_id[32] = "ragnarok";
char log_db_pw[32] = "ragnarok";
char log_db[32] = "log";
+MYSQL logmysql_handle;
+MYSQL_RES* logsql_res;
+MYSQL_ROW logsql_row;
-int mail_server_port = 3306;
+// mail system
+int mail_server_enable = 0;
char mail_server_ip[16] = "127.0.0.1";
+int mail_server_port = 3306;
char mail_server_id[32] = "ragnarok";
char mail_server_pw[32] = "ragnarok";
char mail_server_db[32] = "ragnarok";
-int mail_server_enable = 0;
-
-char char_db[32] = "char";
-
char mail_db[32] = "mail";
-
-char charsql_host[40] = "localhost";
-int charsql_port = 3306;
-char charsql_user[32] = "ragnarok";
-char charsql_pass[32] = "eAthena";
-char charsql_db[40] = "ragnarok";
-MYSQL charsql_handle;
-MYSQL_RES* charsql_res;
-MYSQL_ROW charsql_row;
+MYSQL mail_handle;
+MYSQL_RES* mail_res;
+MYSQL_ROW mail_row;
#endif /* not TXT_ONLY */
@@ -150,7 +138,6 @@ int map_port=0;
int autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
int minsave_interval = 100;
int save_settings = 0xFFFF;
-int charsave_method = 0; //Default 'OLD' Save method (SQL ONLY!) [Sirius]
int agit_flag = 0;
int night_flag = 0; // 0=day, 1=night [Yor]
@@ -182,7 +169,7 @@ void map_setusers(int fd)
WFIFOHEAD(fd, 2);
map_users = RFIFOL(fd,2);
- // send some anser
+ // send some answer
WFIFOW(fd,0) = 0x2718;
WFIFOSET(fd,2);
}
@@ -1721,15 +1708,6 @@ int map_quit(struct map_session_data *sd) {
sd->st = NULL;
sd->npc_id = 0;
}
-#ifndef TXT_ONLY
- if(charsave_method)
- { //Let player be free'd on closing the connection.
- idb_remove(pc_db,sd->status.account_id);
- if (!(sd->fd && session[sd->fd]->session_data == sd))
- aFree(sd); //In case player was not attached to session.
- return 0;
- }
-#endif
if(sd->fd)
{ //Player will be free'd on save-ack. [Skotlex]
if (session[sd->fd])
@@ -2754,9 +2732,8 @@ int map_config_read(char *cfgName) {
} else if(strcmpi(w1,"stdout_with_ansisequence")==0){
stdout_with_ansisequence = config_switch(w2);
} else if(strcmpi(w1,"console_silent")==0){
- msg_silent = 0; //To always allow the next line to show up.
- ShowInfo("Console Silent Setting: %d\n", atoi(w2));
msg_silent = atoi(w2);
+ ShowInfo("Console Silent Setting: %d\n", msg_silent);
} else if (strcmpi(w1, "userid")==0){
chrif_setuserid(w2);
} else if (strcmpi(w1, "passwd") == 0) {
@@ -2854,8 +2831,6 @@ int inter_config_read(char *cfgName)
strcpy(main_chat_nick, w2);
#ifndef TXT_ONLY
- } else if(strcmpi(w1,"charsave_method")==0){
- charsave_method = atoi(w2); //New char saving method.
} else if(strcmpi(w1,"item_db_db")==0){
strcpy(item_db_db,w2);
} else if(strcmpi(w1,"mob_db_db")==0){
@@ -2882,16 +2857,6 @@ int inter_config_read(char *cfgName)
} else if(strcmpi(w1,"use_sql_db")==0){
db_use_sqldbs = battle_config_switch(w2);
ShowStatus ("Using SQL dbs: %s\n",w2);
- }else if(strcmpi(w1, "char_server_ip") == 0){
- strcpy(charsql_host, w2);
- }else if(strcmpi(w1, "char_server_port") == 0){
- charsql_port = atoi(w2);
- }else if(strcmpi(w1, "char_server_id") == 0){
- strcpy(charsql_user, w2);
- }else if(strcmpi(w1, "char_server_pw") == 0){
- strcpy(charsql_pass, w2);
- }else if(strcmpi(w1, "char_server_db") == 0){
- strcpy(charsql_db, w2);
} else if(strcmpi(w1,"log_db")==0) {
strcpy(log_db, w2);
} else if(strcmpi(w1,"log_db_ip")==0) {
@@ -3184,8 +3149,6 @@ void do_final(void) {
#ifndef TXT_ONLY
map_sql_close();
- if(charsave_method)
- charsql_db_init(0); //Connecting to chardb
#endif /* not TXT_ONLY */
ShowStatus("Successfully terminated.\n");
}
@@ -3331,8 +3294,6 @@ int do_init(int argc, char *argv[]) {
charid_db = db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_RELEASE_DATA,sizeof(int));
#ifndef TXT_ONLY
map_sql_init();
- if(charsave_method)
- charsql_db_init(1); //Connecting to chardb
#endif /* not TXT_ONLY */
map_readallmaps();
@@ -3399,32 +3360,3 @@ int compare_item(struct item *a, struct item *b) {
}
return 0;
}
-
-#ifndef TXT_ONLY
-int charsql_db_init(int method){
-
- if(method == 1){ //'INIT / START'
- ShowInfo("Connecting to 'character' Database... ");
- mysql_init(&charsql_handle);
-
- if(!mysql_real_connect(&charsql_handle, charsql_host, charsql_user, charsql_pass, charsql_db, charsql_port, (char *)NULL, 0)){
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- exit(1);
- }else{
- printf("success.\n");
- if( strlen(default_codepage) > 0 ) {
- sprintf( tmp_sql, "SET NAMES %s", default_codepage );
- if (mysql_query(&charsql_handle, tmp_sql)) {
- ShowSQL("DB error - %s\n",mysql_error(&charsql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
- }
- }
- }else if(method == 0){ //'FINAL' / Shutdown
- ShowInfo("Closing 'character' Database connection ... ");
- mysql_close(&charsql_handle);
- printf("done.\n");
- }
- return 0;
-}
-#endif
diff --git a/src/map/map.h b/src/map/map.h
index 4ce73972e..87ac38711 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1431,9 +1431,6 @@ void map_spawnmobs(int); // [Wizputer]
void map_removemobs(int); // [Wizputer]
void do_reconnect_map(void); //Invoked on map-char reconnection [Skotlex]
-//Added for own save method
-int charsql_db_init(int method);
-
extern char *INTER_CONF_NAME;
extern char *LOG_CONF_NAME;
extern char *MAP_CONF_NAME;
@@ -1444,8 +1441,6 @@ extern char *SCRIPT_CONF_NAME;
extern char *MSG_CONF_NAME;
extern char *GRF_PATH_FILENAME;
-
-extern int charsave_method; //needed ..
extern char *map_server_dns;
#ifndef TXT_ONLY
@@ -1464,10 +1459,6 @@ extern MYSQL mmysql_handle;
extern MYSQL_RES* sql_res ;
extern MYSQL_ROW sql_row ;
-extern MYSQL charsql_handle;
-extern MYSQL_RES* charsql_res;
-extern MYSQL_ROW charsql_row;
-
extern MYSQL logmysql_handle;
extern MYSQL_RES* logsql_res ;
extern MYSQL_ROW logsql_row ;
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index a11373032..80e471ddc 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -36,7 +36,6 @@
#include "unit.h"
#include "mercenary.h"
-#include "charsave.h"
//Better equiprobability than rand()% [orn]
#define rand(a, b) a+(int) ((float)(b-a+1)*rand()/(RAND_MAX+1.0))
diff --git a/src/map/npc.c b/src/map/npc.c
index cb104c11b..edeb6d8d4 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2345,9 +2345,8 @@ static int npc_parse_function (char *w1, char *w2, char *w3, char *w4, char *fir
script_free_vars( &oldscript->script_vars );
aFree( oldscript->script_buf );
user_db->remove(user_db,str2key(p));
- strdb_put(user_db, p, script);
- } else
- strdb_put(user_db, p, script);
+ }
+ strdb_put(user_db, p, script);
// もう使わないのでバッファ解放
aFree(srcbuf);
diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c
index e77c93020..9cee26f8e 100644
--- a/src/map/npc_chat.c
+++ b/src/map/npc_chat.c
@@ -369,7 +369,7 @@ int npc_chat_sub(struct block_list *bl, va_list ap)
{
struct npc_data *nd = (struct npc_data *)bl;
struct npc_parse *npcParse = (struct npc_parse *) nd->chatdb;
- unsigned char *msg;
+ char *msg;
int len, pos, i;
struct map_session_data *sd;
struct npc_label_list *lst;
@@ -379,7 +379,7 @@ int npc_chat_sub(struct block_list *bl, va_list ap)
if (npcParse == NULL || npcParse->active_ == NULL)
return 0;
- msg = va_arg(ap,unsigned char*);
+ msg = va_arg(ap,char*);
len = va_arg(ap,int);
sd = va_arg(ap,struct map_session_data *);
diff --git a/vcproj-6/map-server_sql.dsp b/vcproj-6/map-server_sql.dsp
index 5d375bd4f..bbe8539f6 100644
--- a/vcproj-6/map-server_sql.dsp
+++ b/vcproj-6/map-server_sql.dsp
@@ -215,14 +215,6 @@ SOURCE=..\src\map\charcommand.h
# End Source File
# Begin Source File
-SOURCE=..\src\map\charsave.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\map\charsave.h
-# End Source File
-# Begin Source File
-
SOURCE=..\src\map\chat.c
# End Source File
# Begin Source File
diff --git a/vcproj-6/map-server_txt.dsp b/vcproj-6/map-server_txt.dsp
index 4ca9ff78d..a46b752ca 100644
--- a/vcproj-6/map-server_txt.dsp
+++ b/vcproj-6/map-server_txt.dsp
@@ -206,10 +206,6 @@ SOURCE=..\src\map\charcommand.c
# End Source File
# Begin Source File
-SOURCE=..\src\map\charsave.c
-# End Source File
-# Begin Source File
-
SOURCE=..\src\map\chat.c
# End Source File
# Begin Source File
@@ -330,10 +326,6 @@ SOURCE=..\src\map\charcommand.h
# End Source File
# Begin Source File
-SOURCE=..\src\map\charsave.h
-# End Source File
-# Begin Source File
-
SOURCE=..\src\map\chat.h
# End Source File
# Begin Source File
diff --git a/vcproj-7.1/map-server_sql.vcproj b/vcproj-7.1/map-server_sql.vcproj
index 90d2ab5ca..2fe58bb80 100644
--- a/vcproj-7.1/map-server_sql.vcproj
+++ b/vcproj-7.1/map-server_sql.vcproj
@@ -150,9 +150,6 @@
RelativePath="..\src\map\charcommand.c">
</File>
<File
- RelativePath="..\src\map\charsave.c">
- </File>
- <File
RelativePath="..\src\map\chat.c">
</File>
<File
@@ -298,9 +295,6 @@
RelativePath="..\src\map\charcommand.h">
</File>
<File
- RelativePath="..\src\map\charsave.h">
- </File>
- <File
RelativePath="..\src\map\chat.h">
</File>
<File
diff --git a/vcproj-7.1/map-server_txt.vcproj b/vcproj-7.1/map-server_txt.vcproj
index 00368e9ab..d611fff3f 100644
--- a/vcproj-7.1/map-server_txt.vcproj
+++ b/vcproj-7.1/map-server_txt.vcproj
@@ -151,9 +151,6 @@
RelativePath="..\src\map\charcommand.c">
</File>
<File
- RelativePath="..\src\map\charsave.c">
- </File>
- <File
RelativePath="..\src\map\chat.c">
</File>
<File
@@ -299,9 +296,6 @@
RelativePath="..\src\map\charcommand.h">
</File>
<File
- RelativePath="..\src\map\charsave.h">
- </File>
- <File
RelativePath="..\src\map\chat.h">
</File>
<File
diff --git a/vcproj-8/login-server_sql.vcproj b/vcproj-8/login-server_sql.vcproj
index 1640c110a..00d6dd3f6 100644
--- a/vcproj-8/login-server_sql.vcproj
+++ b/vcproj-8/login-server_sql.vcproj
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="8.00"
+ Version="8,00"
Name="login-server_sql"
ProjectGUID="{D356871D-58E1-450B-967A-E5E9646175AF}"
RootNamespace="login-server_sql"
diff --git a/vcproj-8/map-server_sql.vcproj b/vcproj-8/map-server_sql.vcproj
index ecc8b652c..32f5bf519 100644
--- a/vcproj-8/map-server_sql.vcproj
+++ b/vcproj-8/map-server_sql.vcproj
@@ -399,14 +399,6 @@
>
</File>
<File
- RelativePath="..\src\map\charsave.c"
- >
- </File>
- <File
- RelativePath="..\src\map\charsave.h"
- >
- </File>
- <File
RelativePath="..\src\map\chat.c"
>
</File>
diff --git a/vcproj-8/map-server_txt.vcproj b/vcproj-8/map-server_txt.vcproj
index 872c64419..212a981e2 100644
--- a/vcproj-8/map-server_txt.vcproj
+++ b/vcproj-8/map-server_txt.vcproj
@@ -227,14 +227,6 @@
>
</File>
<File
- RelativePath="..\src\map\charsave.c"
- >
- </File>
- <File
- RelativePath="..\src\map\charsave.h"
- >
- </File>
- <File
RelativePath="..\src\map\chat.c"
>
</File>