Fixed some areas where the non-pretty name for a unit was displayed.

This commit is contained in:
Simon Clark 2021-02-07 11:15:25 +00:00
parent 6573157112
commit 3fab1d92b7
5 changed files with 17 additions and 5 deletions

View File

@ -5,6 +5,7 @@
* **[Units]** Fixed syntax error with the SH-60B payload file.
* **[Culling]** Missile sites generate reasonably sized non-cull zones rather than 100km ones.
* **[UI]** Budget display is also now rounded to 2 decimal places.
* **[UI]** Fixed some areas where the old, non-pretty name was displayed to users.
# 2.4.0

View File

@ -11,6 +11,8 @@ from game.theater import ControlPoint, TheaterGroundObject
from qt_ui.dialogs import Dialog
from qt_ui.uiconstants import VEHICLES_ICONS
from qt_ui.windows.groundobject.QGroundObjectMenu import QGroundObjectMenu
from game import db
from dcs import vehicles
class QBaseDefenseGroupInfo(QGroupBox):
@ -71,7 +73,11 @@ class QBaseDefenseGroupInfo(QGroupBox):
icon.setText("<b>" + k[:8] + "</b>")
icon.setProperty("style", "icon-armor")
self.unit_layout.addWidget(icon, i, 0)
self.unit_layout.addWidget(QLabel(str(v) + " x " + "<strong>" + k + "</strong>"), i, 1)
unit_display_name = k
unit_type = vehicles.vehicle_map.get(k)
if unit_type is not None:
unit_display_name = db.unit_get_expanded_info(self.game.enemy_country, unit_type, 'name')
self.unit_layout.addWidget(QLabel(str(v) + " x " + "<strong>" + unit_display_name + "</strong>"), i, 1)
i = i + 1
if len(unit_dict.items()) == 0:

View File

@ -29,6 +29,7 @@ from qt_ui.uiconstants import EVENT_ICONS
from qt_ui.widgets.QBudgetBox import QBudgetBox
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
from qt_ui.windows.groundobject.QBuildingInfo import QBuildingInfo
from dcs import vehicles
class QGroundObjectMenu(QDialog):
@ -101,7 +102,11 @@ class QGroundObjectMenu(QDialog):
if not hasattr(g, "units_losts"):
g.units_losts = []
for u in g.units:
self.intelLayout.addWidget(QLabel("<b>Unit #" + str(u.id) + " - " + str(u.type) + "</b>"), i, 0)
unit_display_name = u.type
unit_type = vehicles.vehicle_map.get(u.type)
if unit_type is not None:
unit_display_name = db.unit_get_expanded_info(self.game.enemy_country, unit_type, 'name')
self.intelLayout.addWidget(QLabel("<b>Unit #" + str(u.id) + " - " + str(unit_display_name) + "</b>"), i, 0)
i = i + 1
for u in g.units_losts:

View File

@ -3,7 +3,7 @@
dofile('Scripts/ScriptingSystem.lua')
--Sanitize Mission Scripting environment
--This makes unavailable some unsecure functions.
--This makes unavailable some unsecure functions.
--Mission downloaded from server to client may contain potentialy harmful lua code that may use these functions.
--You can remove the code below and make availble these functions at your own risk.

View File

@ -962,7 +962,7 @@
}],
"AAA Bofors 40mm": [{
"default": {
"name": "Bofors 40 mm gun",
"name": "Bofors 40 mm Gun",
"country-of-origin": "Sweden",
"manufacturer": "Bofors",
"role": "Anti-Aircraft Gun",
@ -1101,7 +1101,7 @@
}],
"APC M2A1": [{
"default": {
"name": "M2A1 Half-track",
"name": "M2A1 Half-Track",
"country-of-origin": "USA",
"manufacturer": "White Motor Company",
"role": "Armoured Personnel Carrier",