Loading

Paste #pnduplzx4

  1. class IndustryLocationChecks(object):
  2.     """class to hold location checks for an industry"""
  3.     def __init__(self, **kwargs):
  4.         self.incompatible = kwargs.get('incompatible', {})
  5.  
  6.     def get_render_tree(self, switch_prefix):
  7.         result = []
  8.         for industry_type, distance in self.incompatible.items():
  9.             result.append(LocationCheckIncompatible(industry_type, distance))
  10.         for index in range(0, len(result) - 1):
  11.             result[index].switch_result = switch_prefix + result[index + 1].industry_type
  12.         return result
  13.  
  14. class LocationCheckIncompatible(object):
  15.     def __init__(self, industry_type, distance):
  16.         self.industry_type = industry_type
  17.         self.distance = distance
  18.         self.switch_result = 'CB_RESULT_LOCATION_ALLOW' # default result, value may also be id for next switch

Comments