Beispiel #1
0
    def recount(self, RULES, colony_leader, PLAYERS):
        """
        recounts colony values, should be called after any change
        """
        print "$$$ colony::recount() ... colony_id = %i" % self.i_id
        start_clock = time.clock()

        self.i_bc = 0

        if not self.exists():
            self.i_population      = 0
            self.v_max_populations = Game_Rules.get_empty_max_populations()
            return

        if self.is_outpost():
            self.recount_outpost()
            self.v_max_populations = Game_Rules.get_empty_max_populations()
            return

        self.d_prod_summary      = Game_Rules.compose_prod_summary(RULES, self, colony_leader, PLAYERS)
        self.i_morale            = self.d_prod_summary['morale_total']
        self.i_food              = self.d_prod_summary['food_total']
        self.i_industry          = self.d_prod_summary['industry_total']
        self.i_pollution         = self.d_prod_summary['industry_pollution']
        self.i_research          = self.d_prod_summary['research_total']
        #self.i_bc                = self.d_prod_summary['bc_total']
        self.v_max_populations   = Game_Rules.compose_max_populations(RULES, self, PLAYERS)
        self.v_pop_grow          = Game_Rules.compose_pop_growth(RULES, self, colony_leader, PLAYERS)
        self.i_max_population    = max(self.v_max_populations)

        self.init_available_production(RULES, PLAYERS)

        end_clock = time.clock()
        print "$$$ colony::recount() ... clock elapsed = %f" % (end_clock-start_clock)