diff options
-rw-r--r-- | Changelog.txt | 1 | ||||
-rw-r--r-- | src/map/map.c | 51 |
2 files changed, 26 insertions, 26 deletions
diff --git a/Changelog.txt b/Changelog.txt index 713ff1501..91bcd25b8 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,6 @@ Date Added 12/27 + * Modified the map progress bar to reduce updates (SVN 829) [MouseJstr] * Updated map cache system from jA 1087 - change read_map_from_bitmap to 2 to enable zlib compression [celest] * don't delete alive_timers of -1 (SVN 823) [MouseJstr] diff --git a/src/map/map.c b/src/map/map.c index f36ef0ccf..fc2049724 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1882,7 +1882,7 @@ static int map_readafm(int m,char *fn) { /*========================================== * マップ1枚読み込み * ===================================================*/ -static int map_readmap(int m,char *fn, char *alias, int *map_cache) { +static int map_readmap(int m,char *fn, char *alias, int *map_cache, int maxmap) { unsigned char *gat=""; size_t size; @@ -1892,14 +1892,28 @@ static int map_readmap(int m,char *fn, char *alias, int *map_cache) { //printf("\rLoading Maps [%d/%d]: %-50s ",m,map_num,fn); if (map_num) { //avoid map-server crashing if there are 0 maps - printf("\r"); - ShowStatus("Progress: "); - i=m*20/420; - printf("["); - for (e=0;e<i;e++) progress[e] = '#'; - printf(progress); - printf("] Working: ["); - fflush(stdout); + char c; + static int lasti = -1; + static int last_time = -1; + i=m*20/maxmap; + if ((i != lasti) || (last_time != time(0))) { + lasti = i; + printf("\r"); + ShowStatus("Progress: "); + printf("["); + for (e=0;e<i;e++) progress[e] = '#'; + printf(progress); + printf("] Working: ["); + last_time = time(0); + switch(last_time % 4) { + case 0: c='\\'; break; + case 1: c='|'; break; + case 2: c='/'; break; + case 3: c='-'; break; + } + printf("%c]",c); + fflush(stdout); + } } if(map_cache_read(&map[m])) { @@ -1970,9 +1984,6 @@ static int map_readmap(int m,char *fn, char *alias, int *map_cache) { int map_readallmap(void) { int i,maps_removed=0; char fn[256]; - char c = '-'; - time_t last_time = time(0); - int busy = 0; #ifdef USE_AFM FILE *afm_file; #endif @@ -2024,23 +2035,11 @@ int map_readallmap(void) { map[i].alias = NULL; sprintf(fn,"data\\%s",map[i].name); - if(map_readmap(i,fn, p, &map_cache) == -1) { + if(map_readmap(i,fn, p, &map_cache, map_num) == -1) { map_delmap(map[i].name); maps_removed++; i--; - } else { - if (last_time != time(0)) { - last_time = time(0); - switch(busy) { - case 0: c='\\'; busy++; break; - case 1: c='|'; busy++; break; - case 2: c='/'; busy++; break; - case 3: c='-'; busy=0; - } - } - printf("%c]",c); - fflush(stdout); - } + } } } |