def from_file_units(f, me): """Load units and their logical content (names, properties, etc.)""" print("Loading units") n = pickle.load(f) #len(dynamic_objects) for i in range(n): coord = pickle.load(f) #coord a = {} for attr_name in MapObject.get_saved_attributes(): a[attr_name] = pickle.load(f) # print("*** Loading unit", a["name"]) print(a) obj = MapObject(me, fns=a["fns"], name=a["name"], factor=a["factor"], relpos=a["relpos"], build=a["build"], new_type=a["new_type"]) obj.set_frame_refresh_type(obj._refresh_frame_type) obj_added = me.add_unit(coord, obj, a["quantity"])
def get_saved_attributes(): return MapObject.get_saved_attributes() + ["team"]