Use template strings over array joins for map names
This commit is contained in:
parent
e2a89c28d0
commit
f7b774321b
@ -169,7 +169,7 @@ export const mutations: MutationTree<State> & Mutations = {
|
|||||||
|
|
||||||
worlds.forEach(world => {
|
worlds.forEach(world => {
|
||||||
state.worlds.set(world.name, world);
|
state.worlds.set(world.name, world);
|
||||||
world.maps.forEach(map => state.maps.set([world.name, map.name].join('_'), map));
|
world.maps.forEach(map => state.maps.set(`${world.name}_${map.name}`, map));
|
||||||
});
|
});
|
||||||
|
|
||||||
//Update current world if a world with the same name still exists, otherwise clear
|
//Update current world if a world with the same name still exists, otherwise clear
|
||||||
@ -180,8 +180,8 @@ export const mutations: MutationTree<State> & Mutations = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Update current map if a map with the same name still exists, otherwise clear
|
//Update current map if a map with the same name still exists, otherwise clear
|
||||||
if(state.currentWorld && state.currentMap && state.maps.has([state.currentWorld.name, state.currentMap.name].join('_'))) {
|
if(state.currentWorld && state.currentMap && state.maps.has(`${state.currentWorld.name}_${state.currentMap.name}`)) {
|
||||||
state.currentMap = state.maps.get([state.currentWorld.name, state.currentMap.name].join('_'));
|
state.currentMap = state.maps.get(`${state.currentWorld.name}_${state.currentMap.name}`);
|
||||||
} else {
|
} else {
|
||||||
state.currentMap = undefined;
|
state.currentMap = undefined;
|
||||||
}
|
}
|
||||||
@ -388,7 +388,7 @@ export const mutations: MutationTree<State> & Mutations = {
|
|||||||
|
|
||||||
//Sets the currently active map/world
|
//Sets the currently active map/world
|
||||||
[MutationTypes.SET_CURRENT_MAP](state: State, {worldName, mapName}) {
|
[MutationTypes.SET_CURRENT_MAP](state: State, {worldName, mapName}) {
|
||||||
mapName = [worldName, mapName].join('_');
|
mapName = `${worldName}_${mapName}`;
|
||||||
|
|
||||||
if(!state.worlds.has(worldName)) {
|
if(!state.worlds.has(worldName)) {
|
||||||
throw new RangeError(`Unknown world ${worldName}`);
|
throw new RangeError(`Unknown world ${worldName}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user