Mercurial > traipse_dev
diff orpg/mapper/fog_msg.py @ 20:072ffc1d466f traipse_dev
2nd attempt. Still untested.
author | sirebral |
---|---|
date | Sat, 25 Jul 2009 19:23:25 -0500 |
parents | 4385a7d0efd1 |
children | 449a8900f9ac |
line wrap: on
line diff
--- a/orpg/mapper/fog_msg.py Sat Jul 25 17:24:40 2009 -0500 +++ b/orpg/mapper/fog_msg.py Sat Jul 25 19:23:25 2009 -0500 @@ -41,10 +41,8 @@ def get_line(self,outline,action,output_act): elem = Element( "poly" ) - if ( output_act ): - elem.setAttribute( "action", action ) - if ( outline == 'all' ) or ( outline == 'none' ): - elem.setAttribute( "outline", outline ) + if ( output_act ): elem.setAttribute( "action", action ) + if ( outline == 'all' ) or ( outline == 'none' ): elem.setAttribute( "outline", outline ) else: elem.setAttribute( "outline", "points" ) for pair in string.split( outline, ";" ): @@ -77,11 +75,9 @@ #print "use_fog :",self.use_fog #print "output_action :",output_action #print "action :",action - if not (self.use_fog): - return "" + if not (self.use_fog): return "" fog_string = "" - if self.fogregion.isEmpty(): - fog_string=self.get_line("all","del",output_action) + if self.fogregion.isEmpty(): fog_string=self.get_line("all","del",output_action) for ri in self.fogregion.GetRectList(): x1=ri.GetX() x2=x1+ri.GetW()-1 @@ -96,8 +92,7 @@ s += ">" s += fog_string s += "</fog>" - else: - s+="/>" + else: s+="/>" return s def interpret_dom(self,xml_dom): @@ -127,10 +122,8 @@ # polyline.append(IPoint().make(int(pt[0]),int(pt[1]))) #print "length of polyline", len(polyline) if (len(polyline)>2): - if action=="del": - self.fogregion.FromPolygon(polyline,0) - else: - self.fogregion.FromPolygon(polyline,1) + if action=="del": self.fogregion.FromPolygon(polyline,0) + else: self.fogregion.FromPolygon(polyline,1) def init_from_dom(self,xml_dom): self.interpret_dom(xml_dom)