refactor war participant ID + fix campaign participant
This commit is contained in:
parent
ac01568c2f
commit
49bf6d7ea8
4 changed files with 55 additions and 26 deletions
|
|
@ -152,9 +152,16 @@ class Controller:
|
|||
self.view.show_war_details(name=war.name, year=war.year)
|
||||
objectives = war.get_all_objectives()
|
||||
self.view.display_war_objectives(objectives)
|
||||
participants = war.get_all_war_participants()
|
||||
war_parts = war.get_all_war_participants()
|
||||
participants_for_display = [
|
||||
(self.model.get_player_name(p.id), p.faction, p.id) for p in participants
|
||||
(
|
||||
self.model.get_player_name(
|
||||
p.player_id,
|
||||
),
|
||||
p.faction,
|
||||
p.id,
|
||||
)
|
||||
for p in war_parts
|
||||
]
|
||||
self.view.display_war_participants(participants_for_display)
|
||||
|
||||
|
|
@ -180,10 +187,15 @@ class Controller:
|
|||
)
|
||||
)
|
||||
self.view.display_campaign_sectors(sectors_for_display)
|
||||
participants = camp.get_all_campaign_participants()
|
||||
camp_parts = camp.get_all_campaign_participants()
|
||||
participants_for_display = [
|
||||
(self.model.get_player_name(p.war_participant_id), p.leader, p.theme, p.id)
|
||||
for p in participants
|
||||
(
|
||||
self.model.get_participant_name(p.war_participant_id),
|
||||
p.leader,
|
||||
p.theme,
|
||||
p.id,
|
||||
)
|
||||
for p in camp_parts
|
||||
]
|
||||
self.view.display_campaign_participants(participants_for_display)
|
||||
|
||||
|
|
@ -346,13 +358,13 @@ class Controller:
|
|||
self.model.update_objective(item_id, name=name, description=description)
|
||||
self.refresh(RefreshScope.WAR_DETAILS)
|
||||
elif item_type == ItemType.WAR_PARTICIPANT:
|
||||
part = self.model.get_war_participant(item_id)
|
||||
player = self.model.get_player(part.id)
|
||||
camp_part = self.model.get_war_participant(item_id)
|
||||
player = self.model.get_player(camp_part.player_id)
|
||||
dialog = WarParticipantDialog(
|
||||
self.view,
|
||||
players=[player],
|
||||
default_player_id=part.id,
|
||||
default_faction=part.faction,
|
||||
default_player_id=camp_part.id,
|
||||
default_faction=camp_part.faction,
|
||||
editable_player=False,
|
||||
)
|
||||
if dialog.exec() == QDialog.DialogCode.Accepted:
|
||||
|
|
@ -391,15 +403,16 @@ class Controller:
|
|||
)
|
||||
self.refresh(RefreshScope.CAMPAIGN_DETAILS)
|
||||
elif item_type == ItemType.CAMPAIGN_PARTICIPANT:
|
||||
part = self.model.get_campaign_participant(item_id)
|
||||
player = self.model.get_player(part.war_participant_id)
|
||||
camp_part = self.model.get_campaign_participant(item_id)
|
||||
war_part = self.model.get_war_participant(camp_part.war_participant_id)
|
||||
player = self.model.get_player(war_part.player_id)
|
||||
part_opt = [ParticipantOption(id=player.id, name=player.name)]
|
||||
dialog = CampaignParticipantDialog(
|
||||
self.view,
|
||||
participants=part_opt,
|
||||
default_participant_id=part.id,
|
||||
default_leader=part.leader,
|
||||
default_theme=part.theme,
|
||||
default_participant_id=camp_part.id,
|
||||
default_leader=camp_part.leader,
|
||||
default_theme=camp_part.theme,
|
||||
editable_player=False,
|
||||
)
|
||||
if dialog.exec() == QDialog.DialogCode.Accepted:
|
||||
|
|
@ -595,7 +608,7 @@ class Controller:
|
|||
self.selected_campaign_id
|
||||
)
|
||||
part_opts = [
|
||||
ParticipantOption(id=p.id, name=self.model.get_player_name(p.id))
|
||||
ParticipantOption(id=p.id, name=self.model.get_player_name(p.player_id))
|
||||
for p in participants
|
||||
]
|
||||
dialog = CampaignParticipantDialog(self.view, participants=part_opts)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue