Browse Source

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@568 54d463be-8e91-2dee-dedb-b68131a5f0ec

mc_cameri 20 năm trước cách đây
mục cha
commit
d79477081d
2 tập tin đã thay đổi với 17 bổ sung1 xóa
  1. 1 0
      Changelog.txt
  2. 16 1
      src/map/npc.c

+ 1 - 0
Changelog.txt

@@ -1,5 +1,6 @@
 Date	Added
 12/14
+	* Added a busy animation for npc loading [MC Cameri]
 	* Replaced the way map loading was displayed into a progress-like way [MC Cameri]
 	* Fixed some typos in _ShowMessage() [MC Cameri]
 	* Replaced lots of more printf's in map-server with _ShowMessage() [MC Cameri]

+ 16 - 1
src/map/npc.c

@@ -2219,11 +2219,13 @@ void ev_release(struct dbn *db, int which)
  */
 int do_init_npc(void)
 {
-	ShowStatus("Loading NPCs...\n");
 	struct npc_src_list *nsl;
 	FILE *fp;
 	char line[1024];
 	int m,lines;
+	time_t last_time = time(0);
+	int busy = 0;
+	char c = '-';
 
 	ev_db=strdb_init(24);
 	npcname_db=strdb_init(24);
@@ -2295,6 +2297,19 @@ int do_init_npc(void)
 			}
 		}
 		fclose(fp);
+		printf("\r");
+		ShowStatus("Loading NPCs... Working: ");
+		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);
 //		printf("\rLoading NPCs [%d]: %-54s",npc_id-START_NPC_NUM,nsl->name);
 //		fflush(stdout);
 	}