@@ -3,21 +3,19 @@ use crate::client::{Features, GameSyncRequest};
3
3
use crate :: collect_ui:: CollectResources ;
4
4
use crate :: combat_ui:: RemoveCasualtiesSelection ;
5
5
use crate :: construct_ui:: ConstructionPayment ;
6
+ use crate :: event_ui:: { custom_phase_event_origin, event_help, pay_help} ;
6
7
use crate :: happiness_ui:: IncreaseHappinessConfig ;
7
8
use crate :: layout_ui:: FONT_SIZE ;
8
- use crate :: log_ui:: { add_advance_help, advance_help} ;
9
9
use crate :: map_ui:: ExploreResolutionConfig ;
10
10
use crate :: move_ui:: { MoveDestination , MoveIntent , MovePayment , MoveSelection } ;
11
11
use crate :: payment_ui:: Payment ;
12
12
use crate :: recruit_unit_ui:: { RecruitAmount , RecruitSelection } ;
13
13
use crate :: render_context:: RenderContext ;
14
14
use crate :: status_phase_ui:: ChooseAdditionalAdvances ;
15
15
use macroquad:: prelude:: * ;
16
- use server:: ability_initializer:: EventOrigin ;
17
16
use server:: action:: Action ;
18
17
use server:: city:: { City , MoodState } ;
19
18
use server:: combat:: { active_attackers, active_defenders, CombatPhase } ;
20
- use server:: content:: advances:: { NAVIGATION , ROADS } ;
21
19
use server:: content:: custom_phase_actions:: { CustomPhaseAdvanceRewardRequest , CustomPhaseRequest } ;
22
20
use server:: game:: { CulturalInfluenceResolution , CurrentMove , Game , GameState } ;
23
21
use server:: position:: Position ;
@@ -113,34 +111,34 @@ impl ActiveDialog {
113
111
"Click on a city to increase happiness" . to_string( ) ,
114
112
]
115
113
}
116
- ActiveDialog :: AdvancePayment ( _)
117
- | ActiveDialog :: ConstructionPayment ( _)
118
- | ActiveDialog :: MovePayment ( _) => {
119
- vec ! [ "Pay resources" . to_string( ) ]
120
- }
121
- ActiveDialog :: CollectResources ( collect) => collect. help_text ( rc. game ) ,
114
+ ActiveDialog :: AdvancePayment ( p) => pay_help ( rc, p) ,
115
+ ActiveDialog :: ConstructionPayment ( p) => pay_help ( rc, & p. payment ) ,
116
+ ActiveDialog :: MovePayment ( p) => pay_help ( rc, & p. payment ) ,
117
+ ActiveDialog :: CollectResources ( collect) => collect. help_text ( rc) ,
122
118
ActiveDialog :: RecruitUnitSelection ( _) => vec ! [ "Click on a unit to recruit" . to_string( ) ] ,
123
119
ActiveDialog :: ReplaceUnits ( _) => vec ! [ "Click on a unit to replace" . to_string( ) ] ,
124
120
ActiveDialog :: MoveUnits ( m) => {
125
121
if m. start . is_some ( ) {
126
122
let mut result = vec ! [ ] ;
127
- if m. destinations . is_empty ( ) {
123
+ let destinations = & m. destinations . list ;
124
+ if destinations. is_empty ( ) {
128
125
result. push ( "No unit on this tile can move" . to_string ( ) ) ;
129
126
}
130
- if m . destinations
127
+ if destinations
131
128
. iter ( )
132
129
. any ( |d| matches ! ( d, MoveDestination :: Tile ( _) ) )
133
130
{
134
131
result. push ( "Click on a highlighted tile to move units" . to_string ( ) ) ;
135
132
} ;
136
- if m . destinations
133
+ if destinations
137
134
. iter ( )
138
135
. any ( |d| matches ! ( d, MoveDestination :: Carrier ( _) ) )
139
136
{
140
137
result. push ( "Click on a carrier to embark units" . to_string ( ) ) ;
141
138
} ;
142
- add_advance_help ( rc, & mut result, NAVIGATION ) ;
143
- add_advance_help ( rc, & mut result, ROADS ) ;
139
+ m. destinations . modifiers . iter ( ) . for_each ( |m| {
140
+ result. extend ( event_help ( rc, m, true ) ) ;
141
+ } ) ;
144
142
result
145
143
} else {
146
144
vec ! [ "Click on a unit to move" . to_string( ) ]
@@ -189,29 +187,12 @@ impl ActiveDialog {
189
187
ActiveDialog :: WaitingForUpdate => vec ! [ "Waiting for server update" . to_string( ) ] ,
190
188
ActiveDialog :: CustomPhaseResourceRewardRequest ( _)
191
189
| ActiveDialog :: CustomPhaseAdvanceRewardRequest ( _)
192
- | ActiveDialog :: CustomPhasePaymentRequest ( _) => Self :: event_help ( rc) ,
193
- }
194
- }
195
-
196
- #[ must_use]
197
- pub fn event_help ( rc : & RenderContext ) -> Vec < String > {
198
- match & Self :: event_origin ( rc) {
199
- EventOrigin :: Advance ( a) => advance_help ( rc, a) ,
200
- _ => vec ! [ ] , // TODO
190
+ | ActiveDialog :: CustomPhasePaymentRequest ( _) => {
191
+ event_help ( rc, & custom_phase_event_origin ( rc) , true )
192
+ }
201
193
}
202
194
}
203
195
204
- #[ must_use]
205
- pub fn event_origin ( rc : & RenderContext ) -> EventOrigin {
206
- rc. game
207
- . custom_phase_state
208
- . current
209
- . as_ref ( )
210
- . unwrap ( )
211
- . origin
212
- . clone ( )
213
- }
214
-
215
196
#[ must_use]
216
197
pub fn show_for_other_player ( & self ) -> bool {
217
198
matches ! ( self , ActiveDialog :: Log | ActiveDialog :: DetermineFirstPlayer ) || self . is_advance ( )
@@ -222,11 +203,6 @@ impl ActiveDialog {
222
203
matches ! ( self , ActiveDialog :: Log ) || self . is_advance ( )
223
204
}
224
205
225
- #[ must_use]
226
- pub fn is_full_modal ( & self ) -> bool {
227
- self . is_modal ( )
228
- }
229
-
230
206
#[ must_use]
231
207
pub fn is_advance ( & self ) -> bool {
232
208
matches ! (
0 commit comments