private void ReadFieldState(NetBuffer msg, Field field)
        {
            int bitsForPlayerIndex = NetUtility.BitsToHoldUInt((uint)(field.GetPlayers().GetCount() - 1));

            FieldCellSlot[] slots = field.GetCells().slots;
            for (int i = 0; i < slots.Length; ++i)
            {
                FieldCellSlot slot = slots[i];

                bool hasStaticCell = msg.ReadBoolean();
                if (hasStaticCell)
                {
                    byte type = msg.ReadByte(BITS_FOR_STATIC_CELL);
                    switch (type)
                    {
                    case CELL_BRICK:
                    {
                        Debug.Assert(slot.ContainsBrick());
                        break;
                    }

                    case CELL_POWERUP:
                    {
                        int powerup = msg.ReadInt32(BITS_FOR_POWERUP);
                        if (slot.staticCell == null)
                        {
                            field.AddCell(new PowerupCell(powerup, slot.cx, slot.cy));
                        }
                        else if (!slot.staticCell.IsPowerup())
                        {
                            field.RemoveCell(slot.staticCell);
                            field.AddCell(new PowerupCell(powerup, slot.cx, slot.cy));
                        }
                        break;
                    }

                    case CELL_FLAME:
                    {
                        int playerIndex = msg.ReadInt32(bitsForPlayerIndex);
                        if (slot.staticCell == null)
                        {
                            Player player = field.GetPlayers().Get(playerIndex);
                            field.AddCell(new FlameCell(player, slot.cx, slot.cy));
                        }
                        else if (!slot.staticCell.IsFlame())
                        {
                            Player player = field.GetPlayers().Get(playerIndex);
                            field.RemoveCell(slot.staticCell);
                            field.AddCell(new FlameCell(player, slot.cx, slot.cy));
                        }
                        break;
                    }
                    }
                }
                else if (slot.staticCell != null && !slot.staticCell.IsSolid())
                {
                    field.RemoveCell(slot.staticCell);
                }
            }
        }