Browse Source

Optimization, code comments

Vova Tkach 5 years ago
parent
commit
18d0440f1f
2 changed files with 12 additions and 4 deletions
  1. 4 4
      engine/fetdata/shop.go
  2. 8 0
      engine/fetdata/shop_category.go

+ 4 - 4
engine/fetdata/shop.go

@@ -635,10 +635,10 @@ func (this *Shop) Categories(parent, depth int) []*ShopCategory {
 	for _, cat := range this.bufferCats {
 		if parent <= 1 {
 			if depth <= 0 {
-				result = append(result, &ShopCategory{wrap: this.wrap, object: cat})
+				result = append(result, (&ShopCategory{wrap: this.wrap, object: cat}).load(&this.bufferCats))
 			} else {
 				if cat.A_depth <= depth {
-					result = append(result, &ShopCategory{wrap: this.wrap, object: cat})
+					result = append(result, (&ShopCategory{wrap: this.wrap, object: cat}).load(&this.bufferCats))
 				}
 			}
 		} else {
@@ -647,10 +647,10 @@ func (this *Shop) Categories(parent, depth int) []*ShopCategory {
 					depth_tmp = cat.A_depth
 				}
 				if depth <= 0 {
-					result = append(result, &ShopCategory{wrap: this.wrap, object: cat})
+					result = append(result, (&ShopCategory{wrap: this.wrap, object: cat}).load(&this.bufferCats))
 				} else {
 					if (cat.A_depth - depth_tmp + 1) <= depth {
-						result = append(result, &ShopCategory{wrap: this.wrap, object: cat})
+						result = append(result, (&ShopCategory{wrap: this.wrap, object: cat}).load(&this.bufferCats))
 					}
 				}
 			}

+ 8 - 0
engine/fetdata/shop_category.go

@@ -244,3 +244,11 @@ func (this *ShopCategory) Parent() *ShopCategory {
 	cat := &ShopCategory{wrap: this.wrap, object: this.bufferCats[this.object.A_parent]}
 	return cat.load(&this.bufferCats)
 }
+
+func (this *ShopCategory) HaveChilds() bool {
+	// TODO: Add ability
+	if this == nil {
+		return false
+	}
+	return false
+}