Avoid duplicate groups id.

This commit is contained in:
Khopa 2020-08-04 01:08:27 +02:00
parent a76962e206
commit 9d4d3d0523
2 changed files with 8 additions and 6 deletions

View File

@ -77,7 +77,7 @@ def generate_groundobjects(theater: ConflictTheater, game):
if cp.cptype == ControlPointType.AIRCRAFT_CARRIER_GROUP:
# Create ground object group
group_id = group_id + 1
group_id = game.next_group_id()
g = TheaterGroundObject("CARRIER")
g.group_id = group_id
g.object_id = 0
@ -100,7 +100,7 @@ def generate_groundobjects(theater: ConflictTheater, game):
cp_to_remove.append(cp)
elif cp.cptype == ControlPointType.LHA_GROUP:
# Create ground object group
group_id = group_id + 1
group_id = game.next_group_id()
g = TheaterGroundObject("LHA")
g.group_id = group_id
g.object_id = 0
@ -133,7 +133,7 @@ def generate_groundobjects(theater: ConflictTheater, game):
logging.info("Couldn't find point for {} base defense".format(cp))
continue
group_id = group_id + 1
group_id = game.next_group_id()
g = TheaterGroundObject("aa")
g.group_id = group_id
@ -175,7 +175,7 @@ def generate_groundobjects(theater: ConflictTheater, game):
logging.info("Couldn't find point for {} ships".format(cp))
continue
group_id = group_id + 1
group_id = game.next_group_id()
g = TheaterGroundObject("aa")
g.group_id = group_id
@ -210,7 +210,7 @@ def generate_groundobjects(theater: ConflictTheater, game):
logging.info("Couldn't find point for {} missiles".format(cp))
continue
group_id = group_id + 1
group_id = game.next_group_id()
g = TheaterGroundObject("aa")
g.group_id = group_id
@ -359,7 +359,7 @@ def generate_cp_ground_points(cp: ControlPoint, theater, game, group_id, templat
continue
object_id = 0
group_id = group_id + 1
group_id = game.next_group_id()
logging.info("generated {} for {}".format(tpl_category, cp))

View File

@ -1,4 +1,5 @@
from dcs.mapping import Point
import uuid
NAME_BY_CATEGORY = {
"power": "Power plant",
@ -70,6 +71,7 @@ class TheaterGroundObject:
groups = []
obj_name = ""
sea_object = False
uuid = uuid.uuid1()
def __init__(self, category: str):
self.category = category