// Code generated by the FlatBuffers compiler. DO NOT EDIT.

package battle

import (
	flatbuffers "github.com/google/flatbuffers/go"
)

type BattleReport struct {
	_tab flatbuffers.Table
}

func GetRootAsBattleReport(buf []byte, offset flatbuffers.UOffsetT) *BattleReport {
	n := flatbuffers.GetUOffsetT(buf[offset:])
	x := &BattleReport{}
	x.Init(buf, n+offset)
	return x
}

func FinishBattleReportBuffer(builder *flatbuffers.Builder, offset flatbuffers.UOffsetT) {
	builder.Finish(offset)
}

func GetSizePrefixedRootAsBattleReport(buf []byte, offset flatbuffers.UOffsetT) *BattleReport {
	n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
	x := &BattleReport{}
	x.Init(buf, n+offset+flatbuffers.SizeUint32)
	return x
}

func FinishSizePrefixedBattleReportBuffer(builder *flatbuffers.Builder, offset flatbuffers.UOffsetT) {
	builder.FinishSizePrefixed(offset)
}

func (rcv *BattleReport) Init(buf []byte, i flatbuffers.UOffsetT) {
	rcv._tab.Bytes = buf
	rcv._tab.Pos = i
}

func (rcv *BattleReport) Table() flatbuffers.Table {
	return rcv._tab
}

func (rcv *BattleReport) Id(obj *UUID) *UUID {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
	if o != 0 {
		x := o + rcv._tab.Pos
		if obj == nil {
			obj = new(UUID)
		}
		obj.Init(rcv._tab.Bytes, x)
		return obj
	}
	return nil
}

func (rcv *BattleReport) Planet() uint64 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
	if o != 0 {
		return rcv._tab.GetUint64(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *BattleReport) MutatePlanet(n uint64) bool {
	return rcv._tab.MutateUint64Slot(6, n)
}

func (rcv *BattleReport) PlanetName() []byte {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
	if o != 0 {
		return rcv._tab.ByteVector(o + rcv._tab.Pos)
	}
	return nil
}

func (rcv *BattleReport) Races(obj *RaceEntry, j int) bool {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
	if o != 0 {
		x := rcv._tab.Vector(o)
		x += flatbuffers.UOffsetT(j) * 4
		x = rcv._tab.Indirect(x)
		obj.Init(rcv._tab.Bytes, x)
		return true
	}
	return false
}

func (rcv *BattleReport) RacesLength() int {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
	if o != 0 {
		return rcv._tab.VectorLen(o)
	}
	return 0
}

func (rcv *BattleReport) Ships(obj *ShipEntry, j int) bool {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
	if o != 0 {
		x := rcv._tab.Vector(o)
		x += flatbuffers.UOffsetT(j) * 4
		x = rcv._tab.Indirect(x)
		obj.Init(rcv._tab.Bytes, x)
		return true
	}
	return false
}

func (rcv *BattleReport) ShipsLength() int {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
	if o != 0 {
		return rcv._tab.VectorLen(o)
	}
	return 0
}

func (rcv *BattleReport) Protocol(obj *BattleActionReport, j int) bool {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
	if o != 0 {
		x := rcv._tab.Vector(o)
		x += flatbuffers.UOffsetT(j) * 4
		x = rcv._tab.Indirect(x)
		obj.Init(rcv._tab.Bytes, x)
		return true
	}
	return false
}

func (rcv *BattleReport) ProtocolLength() int {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
	if o != 0 {
		return rcv._tab.VectorLen(o)
	}
	return 0
}

func BattleReportStart(builder *flatbuffers.Builder) {
	builder.StartObject(6)
}
func BattleReportAddId(builder *flatbuffers.Builder, id flatbuffers.UOffsetT) {
	builder.PrependStructSlot(0, flatbuffers.UOffsetT(id), 0)
}
func BattleReportAddPlanet(builder *flatbuffers.Builder, planet uint64) {
	builder.PrependUint64Slot(1, planet, 0)
}
func BattleReportAddPlanetName(builder *flatbuffers.Builder, planetName flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(2, flatbuffers.UOffsetT(planetName), 0)
}
func BattleReportAddRaces(builder *flatbuffers.Builder, races flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(3, flatbuffers.UOffsetT(races), 0)
}
func BattleReportStartRacesVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
	return builder.StartVector(4, numElems, 4)
}
func BattleReportAddShips(builder *flatbuffers.Builder, ships flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(4, flatbuffers.UOffsetT(ships), 0)
}
func BattleReportStartShipsVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
	return builder.StartVector(4, numElems, 4)
}
func BattleReportAddProtocol(builder *flatbuffers.Builder, protocol flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(5, flatbuffers.UOffsetT(protocol), 0)
}
func BattleReportStartProtocolVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
	return builder.StartVector(4, numElems, 4)
}
func BattleReportEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
	return builder.EndObject()
}
