本文整理汇总了Golang中github.com/zond/godip/common.Province.Split方法的典型用法代码示例。如果您正苦于以下问题:Golang Province.Split方法的具体用法?Golang Province.Split怎么用?Golang Province.Split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/zond/godip/common.Province
的用法示例。
在下文中一共展示了Province.Split方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: edges
func (self *Graph) edges(n common.Province) (result map[common.Province]*edge) {
p, c := n.Split()
if node, ok := self.nodes[p]; ok {
if sub, ok := node.subs[c]; ok {
result = sub.edges
}
}
return
}
示例2: Has
func (self *Graph) Has(n common.Province) (result bool) {
p, c := n.Split()
if node, ok := self.nodes[p]; ok {
if _, ok := node.subs[c]; ok {
result = true
}
}
return
}
示例3: Flags
func (self *Graph) Flags(n common.Province) (result map[common.Flag]bool) {
p, c := n.Split()
if node, ok := self.nodes[p]; ok {
if sub, ok := node.subs[c]; ok {
result = sub.flags
}
}
return
}
示例4: Prov
func (self *Graph) Prov(n common.Province) *subNode {
p, c := n.Split()
if self.nodes[p] == nil {
self.nodes[p] = &node{
name: p,
subs: make(map[common.Province]*subNode),
graph: self,
}
}
return self.nodes[p].sub(c)
}
示例5: AllFlags
func (self *Graph) AllFlags(n common.Province) (result map[common.Flag]bool) {
result = map[common.Flag]bool{}
p, _ := n.Split()
if node, ok := self.nodes[p]; ok {
for _, sub := range node.subs {
for flag, _ := range sub.flags {
result[flag] = true
}
}
}
return
}
示例6: Order
func (self *State) Order(prov common.Province) (o common.Order, p common.Province, ok bool) {
if o, ok = self.orders[prov]; ok {
p = prov
return
}
sup, _ := prov.Split()
if o, ok = self.orders[sup]; ok {
p = sup
return
}
for _, name := range self.graph.Coasts(prov) {
if o, ok = self.orders[name]; ok {
p = name
return
}
}
return
}
示例7: SupplyCenter
func (self *State) SupplyCenter(prov common.Province) (n common.Nation, p common.Province, ok bool) {
if n, ok = self.supplyCenters[prov]; ok {
p = prov
return
}
sup, _ := prov.Split()
if n, ok = self.supplyCenters[sup]; ok {
p = sup
return
}
for _, name := range self.graph.Coasts(prov) {
if n, ok = self.supplyCenters[name]; ok {
p = name
return
}
}
return
}
示例8: Unit
func (self *State) Unit(prov common.Province) (u common.Unit, p common.Province, ok bool) {
if u, ok = self.units[prov]; ok {
p = prov
return
}
sup, _ := prov.Split()
if u, ok = self.units[sup]; ok {
p = sup
return
}
for _, name := range self.graph.Coasts(prov) {
if u, ok = self.units[name]; ok {
p = name
return
}
}
return
}