diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-08-19 16:00:30 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-08-19 16:00:30 +0000 |
commit | 83bbf93278328b5530ce7f0d6d5a5160148e3e1e (patch) | |
tree | 3989709252e556de2fda83d617d56d589d8f13b1 /src/txt-converter | |
parent | 73c06082f78f6ba79e40bf66c531d5ff99082fee (diff) | |
download | hercules-83bbf93278328b5530ce7f0d6d5a5160148e3e1e.tar.gz hercules-83bbf93278328b5530ce7f0d6d5a5160148e3e1e.tar.bz2 hercules-83bbf93278328b5530ce7f0d6d5a5160148e3e1e.tar.xz hercules-83bbf93278328b5530ce7f0d6d5a5160148e3e1e.zip |
* Fixed a storage saving issue with txt charserver (bugreport:2084)
- caused by incorrect idb_ensure -> idb_get change (see r12950)
- removed redundant account_id variable from storage data
- cleaned up the very messy txt storage handling code
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13093 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/txt-converter')
-rw-r--r-- | src/txt-converter/char-converter.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/txt-converter/char-converter.c b/src/txt-converter/char-converter.c index 2997771fc..0d6ecea25 100644 --- a/src/txt-converter/char-converter.c +++ b/src/txt-converter/char-converter.c @@ -36,7 +36,7 @@ int convert_init(void) { char line[65536]; int ret; - int set,tmp_int[2], lineno, count; + int tmp_int[2], lineno, count; char input; FILE *fp; @@ -118,18 +118,19 @@ int convert_init(void) lineno = count = 0; while(fgets(line, sizeof(line), fp)) { + int account_id; + lineno++; - set=sscanf(line,"%d,%d",&tmp_int[0],&tmp_int[1]); - if(set==2) { - memset(&storage, 0, sizeof(struct storage_data)); - storage.account_id = tmp_int[0]; - if (storage_fromstr(line,&storage) == 0) { - count++; - storage_tosql(storage.account_id,&storage); //to sql. (dump) - } else { - ShowError("Error parsing storage line [%s] (at %s:%d)\n", line, storage_txt, lineno); - } - } + if( sscanf(line,"%d,%d",&tmp_int[0],&tmp_int[1]) != 2 ) + continue; + + memset(&storage, 0, sizeof(struct storage_data)); + if( storage_fromstr(line,&account_id,&storage) ) + { + count++; + storage_tosql(account_id,&storage); //to sql. (dump) + } else + ShowError("Error parsing storage line [%s] (at %s:%d)\n", line, storage_txt, lineno); } ShowStatus("Converted %d storages.\n", count); fclose(fp); |