#166 Supprimer seulement le sort déclenché
This commit is contained in:
parent
d85396db0f
commit
cfe99ec188
@ -313,15 +313,13 @@ export class RdDActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async deleteSortReserve(sortReserve) {
|
async deleteSortReserve(sortReserve) {
|
||||||
let reserve = duplicate(this.data.data.reve.reserve);
|
let reserve = duplicate(this.data.data.reve.reserve);
|
||||||
let len = reserve.list.length;
|
let tmr = TMRUtility.getTMR(sortReserve.coord);
|
||||||
let i = 0;
|
let index = reserve.list.findIndex(tmr.type == 'fleuve'
|
||||||
let newTable = [];
|
? sort => (TMRUtility.getTMR(sort.coord).type == 'fleuve' && sort.sort.name == sortReserve.sort.name)
|
||||||
for (i = 0; i < len; i++) {
|
: sort => (sort.coord == sortReserve.coord && sort.sort.name == sortReserve.sort.name)
|
||||||
if (reserve.list[i].coord != sortReserve.coord && reserve.list[i].sort.name != sortReserve.sort.name)
|
);
|
||||||
newTable.push(reserve.list[i]);
|
if (index >=0 ) {
|
||||||
}
|
reserve.list.splice(index,1);
|
||||||
if (newTable.length != len) {
|
|
||||||
reserve.list = newTable;
|
|
||||||
await this.update({ "data.reve.reserve": reserve });
|
await this.update({ "data.reve.reserve": reserve });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user