Extrait méthode Actor.getDemiReve

This commit is contained in:
Vincent Vandemeulebrouck 2021-02-28 01:50:46 +01:00
parent 3f4d52487d
commit bbd38bd618

View File

@ -311,6 +311,9 @@ export class RdDActor extends Actor {
} }
return duplicate(list[0]); return duplicate(list[0]);
} }
getDemiReve() {
return this.data.data.reve.tmrpos.coord;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async deleteSortReserve(sortReserve) { async deleteSortReserve(sortReserve) {
let reserve = duplicate(this.data.data.reve.reserve); let reserve = duplicate(this.data.data.reve.reserve);
@ -1193,7 +1196,7 @@ export class RdDActor extends Actor {
//console.log("List", rencontres, len); //console.log("List", rencontres, len);
let newTable = []; let newTable = [];
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
if (rencontres.list[i].coord != this.data.data.reve.tmrpos.coord) if (rencontres.list[i].coord != this.getDemiReve())
newTable.push(rencontres.list[i]); newTable.push(rencontres.list[i]);
} }
if (newTable.length != len) { if (newTable.length != len) {
@ -1210,7 +1213,7 @@ export class RdDActor extends Actor {
let i = 0; let i = 0;
let already = false; let already = false;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
if (rencontres.list[i].coord == this.data.data.reve.tmrpos.coord) if (rencontres.list[i].coord == this.getDemiReve())
already = true; already = true;
} }
if (!already) { if (!already) {
@ -1232,9 +1235,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async updateCoordTMR(coord) { async updateCoordTMR(coord) {
let tmrPos = duplicate(this.data.data.reve.tmrpos); await this.update({ "data.reve.tmrpos.coord": coord });
tmrPos.coord = coord;
await this.update({ "data.reve.tmrpos": tmrPos });
} }
/* -------------------------------------------- */ /* -------------------------------------------- */