protected override void get_items(List <SupplyItem> items) { if (Global.battalion.has_convoy) { for (int i = 0; i < Global.game_battalions.active_convoy_data.Count; i++) { if (is_item_add_valid( this.type, Global.game_battalions.active_convoy_data[i])) { items.Add(new SupplyItem(0, i)); } } } foreach (Game_Actor actor in Global.battalion.actors .Where(x => x != Actor_Id) .Select(x => Global.game_actors[x])) { for (int i = 0; i < actor.num_items; i++) { if (is_item_add_valid( this.type, actor.items[i])) { items.Add(new SupplyItem(actor.id, i)); } } } Game_Convoy.sort_supplies(items); }
public static Game_Convoy read(BinaryReader reader) { Game_Convoy result = new Game_Convoy(); result.Data.read(reader); bool shop_exists = reader.ReadBoolean(); if (shop_exists) { result.Shop = Shop_Data.read(reader); } result.Sold_Items.read(reader); return(result); }
public void read(BinaryReader reader) { Current_Battalion = reader.ReadInt32(); int count = reader.ReadInt32(); if (Global.LOADED_VERSION.older_than(0, 4, 4, 1)) { List <Battalion> data = new List <Battalion>(); for (int i = 0; i < count; i++) { data.Add(Battalion.read(reader)); } Data = Enumerable.Range(0, data.Count).Select(x => new KeyValuePair <int, Battalion>(x, data[x])) .ToDictionary(p => p.Key, p => p.Value); } else { Data.read(reader); } Individual_Animations.read(reader); if (Global.LOADED_VERSION.older_than(0, 4, 6, 0)) { Dictionary <int, List <Item_Data> > convoys = new Dictionary <int, List <Item_Data> >(); convoys.read(reader); Convoys = new Dictionary <int, Game_Convoy>(convoys.Select(p => { Game_Convoy convoy = new Game_Convoy(); convoy.Data = p.Value; return(new KeyValuePair <int, Game_Convoy>(p.Key, convoy)); }).ToDictionary(p => p.Key, p => p.Value)); } else { Convoys.read(reader); } }
public Game_Convoy(Game_Convoy convoy) { Data = new List <Item_Data>(convoy.Data.Select(x => new Item_Data(x))); }