Example #1
0
def send_travel_view_household_info(_connection=None):
    msg = UI_pb2.TravelViewHouseholdsInfo()
    for household in tuple(services.household_manager().values()):
        with ProtocolBufferRollback(
                msg.household_locations) as household_location_data:
            household_location_data.household_id = household.id
            household_location_data.household_name = household.name
            household_location_data.home_zone_id = household.home_zone_id
            for sim_info in household:
                with ProtocolBufferRollback(
                        household_location_data.sim_info_status
                ) as sim_info_location_status:
                    sim_info_location_status.sim_id = sim_info.id
                    sim_info_location_status.age = sim_info.age
                    sim_info_location_status.is_at_home = sim_info.is_at_home
    distributor = Distributor.instance()
    distributor.add_op_with_no_owner(
        GenericProtocolBufferOp(Operation.TRAVEL_VIEW_HOUSEHOLDS_INFO, msg))
Example #2
0
def send_travel_view_household_info(_connection=None):
    msg = UI_pb2.TravelViewHouseholdsInfo()
    for household in tuple(services.household_manager().values()):
        with ProtocolBufferRollback(msg.household_locations) as household_location_data:
            household_location_data.household_id = household.id
            household_location_data.household_name = household.name
            household_location_data.home_zone_id = household.home_zone_id
            household_location_data.is_played = household.is_player_household
            for sim_info in household:
                with ProtocolBufferRollback(household_location_data.sim_info_status) as sim_info_location_status:
                    sim_info_location_status.sim_id = sim_info.id
                    sim_info_location_status.age = sim_info.age
                    sim_info_location_status.is_at_home = sim_info.is_at_home
                    sim_info_location_status.zone_id = sim_info.zone_id
    distributor = Distributor.instance()
    distributor.add_op_with_no_owner(GenericProtocolBufferOp(Operation.TRAVEL_VIEW_HOUSEHOLDS_INFO, msg))
    travel_group_list_msg = FileSerialization_pb2.TravelGroupList()
    for travel_group in tuple(services.travel_group_manager().values()):
        with ProtocolBufferRollback(travel_group_list_msg.travel_groups) as travel_group_data:
            travel_group.save_data(travel_group_data)
    distributor.add_op_with_no_owner(GenericProtocolBufferOp(Operation.TRAVEL_GROUP_LIST, travel_group_list_msg))