Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 4x 4x 4x 4x 4x 4x 4x 9x 1x 1x 8x | /**
* @module Engine.Maps
* Maps reducers
*/
import * as Tasks from '@engine/Commands/tasks';
import { Coord } from '@models';
import { List, Map } from 'immutable';
import { AnyAction } from 'redux';
import { MapsActions } from './actions';
import { CoordsTools } from './CoordsTools';
// tslint:disable-next-line: no-unnecessary-type-annotation
const INITIAL_STATE: IMapsState = Map();
const DATABASE = 'maps';
export type IMapsState = Map<string, List<Coord>>;
export const mapsReducer = (state: IMapsState = INITIAL_STATE, action: AnyAction) => {
switch (action.type) {
case MapsActions.LOAD_DATABASE:
return Tasks.loadDatabaseMap(DATABASE, CoordsTools.hydrater, action.characters);
case MapsActions.SAVE_DATABASE:
Tasks.saveDatabaseMap(DATABASE, state, CoordsTools.serializer);
default:
return state;
}
};
|