Changeset 425:1a85044f81a8


Ignore:
Timestamp:
09/07/13 11:34:01 (8 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
Children:
426:275e0b4bd571, 428:6bbb0ac87acc
Phase:
public
Message:

Safer color access

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • nagslang/level.py

    r408 r425  
    1919    5: pygame.color.THECOLORS['lightblue'],
    2020    6: pygame.color.THECOLORS['magenta'],
     21    7: pygame.color.THECOLORS['lightgreen'],
     22    8: pygame.color.THECOLORS['grey'],
    2123}
    2224
     
    186188    def _draw_walls(self):
    187189        for index, polygon in self.polygons.items():
    188             color = POLY_COLORS[index]
     190            color = POLY_COLORS.get(index, pygame.color.THECOLORS['black'])
    189191            if len(polygon) > 1:
    190192                pointlist = [self.point_to_pygame(p) for p in polygon]
  • tools/area_editor.py

    r424 r425  
    122122            self._draw_exterior(True)
    123123        for index, polygon in self.polygons.items():
    124             color = POLY_COLORS[index]
     124            color = POLY_COLORS.get(index, pygame.color.THECOLORS['black'])
    125125            if move_point_mode and index == self._move_poly:
    126126                pointlist = [p for p in polygon]
Note: See TracChangeset for help on using the changeset viewer.