- small optimization for moving units when source and destintation position are the same
This commit is contained in:
parent
c781982e57
commit
c9ca56e91b
|
@ -533,8 +533,12 @@ void World::moveUnitCells(Unit *unit){
|
||||||
|
|
||||||
//newPos must be free or the same pos as current
|
//newPos must be free or the same pos as current
|
||||||
assert(map.getCell(unit->getPos())->getUnit(unit->getCurrField())==unit || map.isFreeCell(newPos, unit->getCurrField()));
|
assert(map.getCell(unit->getPos())->getUnit(unit->getCurrField())==unit || map.isFreeCell(newPos, unit->getCurrField()));
|
||||||
map.clearUnitCells(unit, unit->getPos());
|
// Only change cell plaement in map if the new position is different
|
||||||
map.putUnitCells(unit, newPos);
|
// from the old one
|
||||||
|
if(newPos != unit->getPos()) {
|
||||||
|
map.clearUnitCells(unit, unit->getPos());
|
||||||
|
map.putUnitCells(unit, newPos);
|
||||||
|
}
|
||||||
|
|
||||||
//water splash
|
//water splash
|
||||||
if(tileset.getWaterEffects() && unit->getCurrField()==fLand){
|
if(tileset.getWaterEffects() && unit->getCurrField()==fLand){
|
||||||
|
|
Loading…
Reference in New Issue
Block a user