[Wesnoth-commits] r10082 - /trunk/src/marked-up_text.cpp (February 13, 2006 - 01:49)

Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Headers

 

Author: darthfool
Date: Mon Feb 13 01:48:47 2006
New Revision: 10082

URL: http://svn.gna.org/viewcvs/wesnoth?rev=10082&view=rev
Log:
fixed bug with < named units crashing game.  Should also fix 5105.

Modified:
    trunk/src/marked-up_text.cpp

Modified: trunk/src/marked-up_text.cpp
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/src/marked-up_text.cpp?rev=10082&r1=10081&r2=10082&view=diff
==============================================================================
--- trunk/src/marked-up_text.cpp (original)
+++ trunk/src/marked-up_text.cpp Mon Feb 13 01:48:47 2006
@@ -34,6 +34,7 @@
 		return i1;
 	}
 
+	std::string::const_iterator i_start=i1;
 	while(i1 != i2) {
 		switch(*i1) {
 		case '\\':
@@ -96,7 +97,7 @@
 		    }
 		    red=temp;
 		    temp=0;
-		    if(i1 != i2){
+		    if(i1 != i2 && '>' != (*i1)){
 		      ++i1;
 		      while(i1 != i2 && *i1 >= '0' && *i1<='9'){
 			temp*=10;
@@ -106,7 +107,7 @@
 		      green=temp;
 		      temp=0;
 		    }
-		    if(i1 != i2){
+		    if(i1 != i2 && '>' != (*i1)){
 		      ++i1;
 		      while(i1 != i2 && *i1 >= '0' && *i1<='9'){
 			temp*=10;
@@ -115,17 +116,19 @@
 		      }
 		    }
 		    blue=temp;
-		    SDL_Color temp_color = {red,green,blue,0};
-			(*colour) = temp_color;
+		    if(i1 != i2 && i1+1 != i2 && '>'==(*i1)){
+		      SDL_Color temp_color = {red,green,blue,0};
+		      (*colour) = temp_color;
+		      return i1+1;
+		    }else
+		      return i_start;
 		    break;
 		  }
 		default:
 		  return i1;
 		}
-
 		++i1;
 	}
-
 	return i1;
 }
 



Related Mails




Powered by MHonArc, Updated Mon Feb 13 02:00:17 2006