prompt window with logs on raised exception; minor UI updates; minor fixes

This commit is contained in:
Vasyl Horbachenko
2018-07-29 04:16:39 +03:00
parent 73d4a2d414
commit 9dbc9a8a56
25 changed files with 146 additions and 57 deletions

View File

@@ -1,3 +1,5 @@
import logging
from game import db
from game.settings import Settings
from .conflictgen import *
@@ -14,7 +16,7 @@ SPREAD_DISTANCE_FACTOR = 1, 2
ESCORT_ENGAGEMENT_MAX_DIST = 100000
WORKAROUND_WAYP_DIST = 1000
WARM_START_HELI_AIRSPEED = 200
WARM_START_HELI_AIRSPEED = 120
WARM_START_HELI_ALT = 1000
WARM_START_ALTITUDE = 3000
@@ -106,7 +108,7 @@ class AircraftConflictGenerator:
assert count > 0
assert unit is not None
print("airgen: {} for {} at {}".format(unit_type, side.id, airport))
logging.info("airgen: {} for {} at {}".format(unit_type, side.id, airport))
return self.m.flight_group_from_airport(
country=side,
name=name,
@@ -121,7 +123,7 @@ class AircraftConflictGenerator:
assert count > 0
assert unit is not None
if unit_type in helicopters.helicopter_map:
if unit_type in helicopters.helicopter_map.values():
alt = WARM_START_HELI_ALT + random.randint(50, 200)
speed = WARM_START_HELI_AIRSPEED
else:
@@ -130,7 +132,7 @@ class AircraftConflictGenerator:
pos = Point(at.x + random.randint(100, 200), at.y + random.randint(100, 200))
print("airgen: {} for {} at {} at {}".format(unit_type, side.id, alt, speed))
logging.info("airgen: {} for {} at {} at {}".format(unit_type, side.id, alt, speed))
return self.m.flight_group(
country=side,
name=name,
@@ -147,7 +149,7 @@ class AircraftConflictGenerator:
assert count > 0
assert unit is not None
print("airgen: {} for {} at carrier {}".format(unit_type, side.id, at))
logging.info("airgen: {} for {} at carrier {}".format(unit_type, side.id, at))
return self.m.flight_group_from_unit(
country=side,
name=name,

View File

@@ -1,3 +1,5 @@
import logging
from random import randint
from itertools import zip_longest
@@ -34,7 +36,7 @@ class ArmorConflictGenerator:
def _generate_group(self, side: Country, unit: VehicleType, count: int, at: Point, to: Point = None):
for c in range(count):
print("armorgen: {} for {}".format(unit, side.id))
logging.info("armorgen: {} for {}".format(unit, side.id))
group = self.m.vehicle_group(
side,
namegen.next_unit_name(side, unit),

View File

@@ -1,3 +1,4 @@
import logging
import typing
import pdb
import dcs
@@ -182,7 +183,7 @@ class Conflict:
initial = initial.point_from_heading(heading, 800)
print("Didn't find ground position!")
logging.info("Didn't find ground position!")
return None
@classmethod

View File

@@ -1,3 +1,4 @@
import logging
import typing
import random
from datetime import datetime, timedelta, time
@@ -68,7 +69,7 @@ class EnviromentGenerator:
weather_type = k
break
print("generated weather {}".format(weather_type))
logging.info("generated weather {}".format(weather_type))
if weather_type == 1:
self.mission.weather.heavy_rain()
elif weather_type == 2:

View File

@@ -1,3 +1,5 @@
import logging
from game import db
from .conflictgen import *
from .naming import *
@@ -28,7 +30,7 @@ class ShipGenerator:
def generate_cargo(self, units: db.ShipDict) -> typing.Collection[ShipGroup]:
groups = []
for unit_type, unit_count in units.items():
print("shipgen: {} ({}) for {}".format(unit_type, unit_count, self.conflict.defenders_side))
logging.info("shipgen: {} ({}) for {}".format(unit_type, unit_count, self.conflict.defenders_side))
group = self.m.ship_group(
country=self.conflict.defenders_side,
name=namegen.next_unit_name(self.conflict.defenders_side, unit_type),