summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-06 15:35:31 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-06 15:35:31 +0000
commitf3ac07ef1c9f6224f985d5bff2f405f6bc9bf226 (patch)
tree0bfc02f8ef4c4a924296958465ae1ec480aa7c17 /src/map/map.c
parent688dc3e7034d4cdbb9a6f62879a2dcdc84ec8180 (diff)
downloadhercules-f3ac07ef1c9f6224f985d5bff2f405f6bc9bf226.tar.gz
hercules-f3ac07ef1c9f6224f985d5bff2f405f6bc9bf226.tar.bz2
hercules-f3ac07ef1c9f6224f985d5bff2f405f6bc9bf226.tar.xz
hercules-f3ac07ef1c9f6224f985d5bff2f405f6bc9bf226.zip
* the mapserver won't exit when no mapcache is found, with use_grf: yes
* Fixed some \r uses, now looks better; /thx to Ai4rei (topic:165952) * Removed that ridiculous spinner that displays during map/npc loading, and added a more informative progress indicator (idea from jA/eapp) * Checked/fixed/removed some old script and npc commands * cmdothernpc - a specialized 'donpcevent' with the event specified as two arguments * enablearena/disablearena - completely equivalent to enablewaitingroomevent & co. * inittimer/stoptimer - removed since its logic was incompatible with the code it depended on * Removed loads of code that supported these functions. Result: -100b per npc => -1,5MB of wasted memory * Fixed related npcs that erroneously used 'stoptimer' git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11374 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c51
1 files changed, 17 insertions, 34 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 967edbab9..b18b93753 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2607,48 +2607,29 @@ int map_readgat (struct map_data* m)
int map_readallmaps (void)
{
int i;
+ FILE* fp;
int maps_removed = 0;
- FILE *fp;
- if(!(fp = fopen(map_cache_file, "rb")))
+ if( enable_grf )
+ ShowStatus("Loading maps (using GRF files)...\n");
+ else
{
- ShowFatalError("Unable to open map cache file "CL_WHITE"%s"CL_RESET"\n", map_cache_file);
- exit(1); //No use launching server if maps can't be read.
+ ShowStatus("Loading maps (using %s as map cache)...\n", map_cache_file);
+ if( (fp = fopen(map_cache_file, "rb")) == NULL )
+ {
+ ShowFatalError("Unable to open map cache file "CL_WHITE"%s"CL_RESET"\n", map_cache_file);
+ exit(1); //No use launching server if maps can't be read.
+ }
}
- if(enable_grf) ShowStatus("Loading maps (using GRF files)...\n");
- else ShowStatus("Loading maps (using %s as map cache)...\n", map_cache_file);
-
for(i = 0; i < map_num; i++)
{
- static int lasti = -1;
- static int last_time = -1;
- int j = i*20/map_num;
size_t size;
// show progress
- if (j != lasti || last_time != time(0))
- {
- char progress[21] = " ";
- char c = '-';
- int k;
-
- lasti = j;
- printf("\r");
- ShowStatus("Progress: [");
- for (k=0; k < j; k++) progress[k] = '#';
- printf(progress);
- last_time = (int)time(0);
- switch(last_time % 4) {
- case 0: c='\\'; break;
- case 1: c='|'; break;
- case 2: c='/'; break;
- case 3: c='-'; break;
- }
- printf("] Working: [%c]",c);
- fflush(stdout);
- }
+ ShowStatus("Loading maps [%i/%i]: %s"CL_CLL"\r", i, map_num, map[i].name);
+ // try to load the map
if( !
(enable_grf?
map_readgat(&map[i])
@@ -2662,7 +2643,8 @@ int map_readallmaps (void)
map[i].index = mapindex_name2id(map[i].name);
- if (uidb_get(map_db,(unsigned int)map[i].index) != NULL) {
+ if (uidb_get(map_db,(unsigned int)map[i].index) != NULL)
+ {
ShowWarning("Map %s already loaded!\n", map[i].name);
if (map[i].gat) {
aFree(map[i].gat);
@@ -2703,11 +2685,12 @@ int map_readallmaps (void)
map[i].block_mob_count = (int*)aCallocA(size, 1);
}
- fclose(fp);
+ if( !enable_grf )
+ fclose(fp);
// finished map loading
printf("\r");
- ShowInfo("Successfully loaded '"CL_WHITE"%d"CL_RESET"' maps.%30s\n",map_num,"");
+ ShowInfo("Successfully loaded '"CL_WHITE"%d"CL_RESET"' maps."CL_CLL"\n",map_num);
if (maps_removed)
ShowNotice("Maps removed: '"CL_WHITE"%d"CL_RESET"'\n",maps_removed);