- Wrap FIND_PACKAGE(RTI) in IF(NOT TARGET RTI::nddsc) condition - Prevents placeholder targets from overwriting manually configured RTI:: targets - Manual configuration creates RTI:: targets when BUILD_RTI=ON and RTI found - FIND_PACKAGE only called as fallback when manual config doesn't create targets Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Entire-Checkpoint: 01M1CT3XSQXCX9RQR6WM9DG3GH
42 lines
1.8 KiB
Python
42 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""Fix public member access in training_area_telegrams.cpp"""
|
|
|
|
import re
|
|
|
|
file_path = 'qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Proxies/TrainingAreaBase/training_area_telegrams.cpp'
|
|
|
|
with open(file_path, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
# Public member structs and their members
|
|
public_member_structs = {
|
|
'OpsPosition': ['opsId', 'moutObjectId', 'moutRoomId'],
|
|
'GpsQuality': ['moreThan4SatellitesAvailable', 'dgpsModeAvailable', 'pdopValue'],
|
|
'Gear': ['gearTasCode', 'gearSerialNumber', 'chargeCounting'],
|
|
'GearCharge': ['gearTasCode', 'gearSerialNumber', 'chargeTypeId', 'remain', 'location'],
|
|
'WlsPosition': ['x', 'y', 'z', 'wlsAreaId', 'wlsZone', 'wlsBuildingId', 'wlsRoomNumber', 'playerOrientation', 'weaponOrientation'],
|
|
}
|
|
|
|
# Fix fromJson: ret.m_member = → ret.member =
|
|
for struct_name, members in public_member_structs.items():
|
|
for member in members:
|
|
# Fix fromJson assignments
|
|
pattern = rf'(ret\.m_{member}\s*=\s*[^;]+;)'
|
|
replacement = f'ret.{member} = \\1'.replace('m_', '', 1)
|
|
# More precise: replace ret.m_member with ret.member
|
|
content = re.sub(rf'ret\.m_{member}(?=\s*=)', f'ret.{member}', content)
|
|
|
|
# Fix toJson method calls member() → member
|
|
content = re.sub(rf'\b{member}\(\)(?=\s*[,}}])', member, content)
|
|
|
|
# Fix QJsonObject initializer syntax - remove outer braces
|
|
# Pattern: return {QJsonObject{{ -> return QJsonObject{{
|
|
content = re.sub(r'return\s*\{\s*QJsonObject\s*\{', r'return QJsonObject{', content)
|
|
|
|
# Also fix cases where it's: return {QJsonObject{ -> return QJsonObject{
|
|
content = re.sub(r'return\s*\{\s*QJsonObject\{', r'return QJsonObject{', content)
|
|
|
|
with open(file_path, 'w', encoding='utf-8') as f:
|
|
f.write(content)
|
|
|
|
print("Fixed public member access in training_area_telegrams.cpp") |