From 83bbf93278328b5530ce7f0d6d5a5160148e3e1e Mon Sep 17 00:00:00 2001 From: ultramage Date: Tue, 19 Aug 2008 16:00:30 +0000 Subject: * 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 --- src/txt-converter/char-converter.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/txt-converter') 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); -- cgit v1.2.3-70-g09d2