1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2025-02-02 14:46:28 -05:00

d2ds1: getMaxGroupLen is public

This commit is contained in:
gucio321 2021-04-07 10:55:15 +02:00
parent 53de5c17ad
commit 54645b138f
2 changed files with 6 additions and 5 deletions

View File

@ -132,7 +132,7 @@ func (l *ds1Layers) push(t LayerGroupType, layer *Layer) {
group := l.getLayersGroup(t)
max := getMaxGroupLen(t)
max := GetMaxGroupLen(t)
if len(*group) < max {
*group = append(*group, layer)
@ -194,7 +194,7 @@ func (l *ds1Layers) insert(t LayerGroupType, idx int, newLayer *Layer) {
return
}
if len(*group)+1 > getMaxGroupLen(t) {
if len(*group)+1 > GetMaxGroupLen(t) {
return
}
@ -335,7 +335,8 @@ func (l *ds1Layers) getLayersGroup(t LayerGroupType) (group *layerGroup) {
return group
}
func getMaxGroupLen(t LayerGroupType) (max int) {
// GetMaxGroupLen returns maximum length of layer group of type given
func GetMaxGroupLen(t LayerGroupType) (max int) {
switch t {
case FloorLayerGroup:
max = maxFloorLayers

View File

@ -116,7 +116,7 @@ func Test_ds1Layers_Insert(t *testing.T) {
func ds1LayersInsert(t *testing.T, lt LayerGroupType) {
ds1 := DS1{}
layers := make([]*Layer, getMaxGroupLen(lt)+1)
layers := make([]*Layer, GetMaxGroupLen(lt)+1)
for i := range layers {
i := i
@ -150,7 +150,7 @@ func ds1LayersInsert(t *testing.T, lt LayerGroupType) {
insert(i)
}
if len(*group) != getMaxGroupLen(lt) {
if len(*group) != GetMaxGroupLen(lt) {
t.Fatal("unexpected floor len after setting")
}