mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Push full control point information in the event stream.
https://github.com/dcs-liberation/dcs_liberation/issues/2263
This commit is contained in:
@@ -15,9 +15,10 @@ export const controlPointsSlice = createSlice({
|
||||
name: "controlPoints",
|
||||
initialState,
|
||||
reducers: {
|
||||
updateControlPoint: (state, action: PayloadAction<ControlPoint>) => {
|
||||
const cp = action.payload;
|
||||
state.controlPoints[cp.id] = cp;
|
||||
updateControlPoint: (state, action: PayloadAction<ControlPoint[]>) => {
|
||||
for (const cp of action.payload) {
|
||||
state.controlPoints[cp.id] = cp;
|
||||
}
|
||||
},
|
||||
},
|
||||
extraReducers: (builder) => {
|
||||
|
||||
@@ -49,7 +49,7 @@ interface GameUpdateEvents {
|
||||
updated_front_lines: FrontLine[];
|
||||
deleted_front_lines: string[];
|
||||
updated_tgos: string[];
|
||||
updated_control_points: number[];
|
||||
updated_control_points: ControlPoint[];
|
||||
reset_on_map_center: LatLng | null;
|
||||
game_unloaded: boolean;
|
||||
new_turn: boolean;
|
||||
@@ -141,11 +141,8 @@ export const handleStreamedEvents = (
|
||||
});
|
||||
}
|
||||
|
||||
for (const id of events.updated_control_points) {
|
||||
backend.get(`/control-points/${id}`).then((response) => {
|
||||
const cp = response.data as ControlPoint;
|
||||
dispatch(updateControlPoint(cp));
|
||||
});
|
||||
if (events.updated_control_points.length > 0) {
|
||||
dispatch(updateControlPoint(events.updated_control_points));
|
||||
}
|
||||
|
||||
if (events.reset_on_map_center != null) {
|
||||
|
||||
Reference in New Issue
Block a user