Explorar o código

Speeded up jobchange command. Partially fixes bugreport:7453

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@17235 54d463be-8e91-2dee-dedb-b68131a5f0ec
lemongrass3110 %!s(int64=12) %!d(string=hai) anos
pai
achega
927b1fdb47
Modificáronse 1 ficheiros con 22 adicións e 11 borrados
  1. 22 11
      src/map/atcommand.c

+ 22 - 11
src/map/atcommand.c

@@ -927,14 +927,24 @@ ACMD_FUNC(jobchange)
 	nullpo_retr(-1, sd);
 
     if (!message || !*message || sscanf(message, "%d %d", &job, &upper) < 1) {
-		int i, found = 0;
-
-        for (i = JOB_NOVICE; i < JOB_MAX; ++i) {
-            if (strncmpi(message, job_name(i), 16) == 0) {
-                job = i;
-				upper = 0;
-				found = 1;
-				break;
+		int i;
+		bool found = false;
+
+		upper = 0;
+ 
+		// Normal Jobs
+		for( i = JOB_NOVICE; i < JOB_MAX_BASIC && !found; i++ ){
+			if (strncmpi(message, job_name(i), 16) == 0) {
+				job = i;
+				found = true;
+			}
+		}
+ 
+		// High Jobs, Babys and Third
+		for( i = JOB_NOVICE_HIGH; i < JOB_MAX && !found; i++ ){
+			if (strncmpi(message, job_name(i), 16) == 0) {
+				job = i;
+				found = true;
 			}
 		}
 
@@ -949,9 +959,10 @@ ACMD_FUNC(jobchange)
     if (job == JOB_KNIGHT2 || job == JOB_CRUSADER2 || job == JOB_WEDDING || job == JOB_XMAS || job == JOB_SUMMER || job == JOB_HANBOK
         || job == JOB_LORD_KNIGHT2 || job == JOB_PALADIN2 || job == JOB_BABY_KNIGHT2 || job == JOB_BABY_CRUSADER2 || job == JOB_STAR_GLADIATOR2
 		 || (job >= JOB_RUNE_KNIGHT2 && job <= JOB_MECHANIC_T2) || (job >= JOB_BABY_RUNE2 && job <= JOB_BABY_MECHANIC2)
-	) // Deny direct transformation into dummy jobs
-		{clif_displaymessage(fd, msg_txt(923)); //"You can not change to this job by command."
-		return 0;}
+	){ // Deny direct transformation into dummy jobs
+		clif_displaymessage(fd, msg_txt(923)); //"You can not change to this job by command."
+		return 0;
+	}
 
 	if (pcdb_checkid(job))
 	{