public void ReadDictionary(BinBuffer bb) { int modAmt = bb.ReadByte(); for (int i = 0; i < modAmt; i++) { Mods.Add(bb.ReadString(), bb.ReadByte()); } for (int i = 0; i < modAmt; i++) { ModID mid = bb.ReadByte(); var modObjs = new BiDictionary <ObjName, ObjID>(); short objAmt = bb.ReadInt16(); for (int j = 0; j < objAmt; j++) { modObjs.Add(bb.ReadString(), bb.ReadInt16()); } ModObjects.Add(mid, modObjs); } }
static void LoadBehaviours(BinBuffer bb, int v) { if (v != 3) // TileBehaviour data introduced in v3 { return; } while (bb.ReadBoolean()) { bb.ReadInt16(); bb.ReadInt16(); } }
static void LoadTileData(BinBuffer bb, int v) { if (v < 4) { return; } TileDataEntryFlags fl; while ((fl = (TileDataEntryFlags)bb.ReadByte()) != TileDataEntryFlags.Finished) { var x = bb.ReadInt16(); var y = bb.ReadInt16(); var p = new Point16(x, y); var t = Main.tile[x, y].type; var bs = TileHooks.CreateBHandler(p); if ((fl & TileDataEntryFlags.Tile) != 0) { var bh = bs.Item1; foreach (var b in bh.behaviours) { b.HasTile = true; b.Position = p; } bh.Load(bb); } if ((fl & TileDataEntryFlags.Type) != 0) { var bh = bs.Item2; foreach (var b in bh.behaviours) { b.HasTile = true; b.Position = p; } bh.Load(bb); } } }
static void LoadChestItems(BinBuffer bb, int v) { int chestAmt = bb.ReadInt16(); int items = bb.ReadByte(); for (int i = 0; i < chestAmt; i++) { LoadItemSlots(bb, Main.chest[i].item, items, true, false); } }