main_timer.stop_print_and_clear() turn_timer.stop_print_and_clear() turn_timer.start("Server_Processing") try: fo.doneTurn() except Exception as e: print_error(e) # TODO move it to cycle above if using_statprof: try: statprof.stop() statprof.display() statprof.start() except: pass # The following methods should probably be moved to the AIstate module, to keep this module more focused on implementing required interface def declare_war_on_all(): # pylint: disable=invalid-name """Used to declare war on all other empires (at start of game)""" my_emp_id = fo.empireID() for emp_id in fo.allEmpireIDs(): if emp_id != my_emp_id: msg = fo.diplomaticMessage(my_emp_id, emp_id, fo.diplomaticMessageType.warDeclaration) fo.sendDiplomaticMessage(msg) init_handlers(fo.getOptionsDBOptionStr("ai-config"), fo.getAIDir())
print_error(e, location=action.__name__) main_timer.stop_print_and_clear() turn_timer.stop_print_and_clear() turn_timer.start("Server_Processing") try: fo.doneTurn() except Exception as e: print_error(e) # TODO move it to cycle above if using_statprof: try: statprof.stop() statprof.display() statprof.start() except: pass # The following methods should probably be moved to the AIstate module, to keep this module more focused on implementing required interface def declare_war_on_all(): # pylint: disable=invalid-name """Used to declare war on all other empires (at start of game)""" my_emp_id = fo.empireID() for emp_id in fo.allEmpireIDs(): if emp_id != my_emp_id: msg = fo.diplomaticMessage(my_emp_id, emp_id, fo.diplomaticMessageType.warDeclaration) fo.sendDiplomaticMessage(msg) init_handlers(fo.getOptionsDBOptionStr("ai-config"), fo.getAIDir())
print_error(e, location=action.__name__) main_timer.end() turn_timer.end() turn_timer.start("Server_Processing") try: fo.doneTurn() except Exception as e: print_error(e) # TODO move it to cycle above if using_statprof: try: statprof.stop() statprof.display() statprof.start() except: pass # The following methods should probably be moved to the AIstate module, to keep this module more focused on implementing required interface def declare_war_on_all(): # pylint: disable=invalid-name """Used to declare war on all other empires (at start of game)""" my_emp_id = fo.empireID() for emp_id in fo.allEmpireIDs(): if emp_id != my_emp_id: msg = fo.diplomaticMessage(my_emp_id, emp_id, fo.diplomaticMessageType.warDeclaration) fo.sendDiplomaticMessage(msg) init_handlers(fo.getAIConfigStr(), fo.getAIDir())