mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-02-08 17:10:04 +01:00
Fix regression in LayeredTileMaps.
This commit is contained in:
parent
936c2e07bc
commit
3b25f0c0d5
@ -2370,7 +2370,7 @@ void LayeredTileMapLayer::fix_invalid_tiles() {
|
|||||||
ERR_FAIL_COND_MSG(tile_set.is_null(), "Cannot call fix_invalid_tiles() on a LayeredTileMap without a valid LayeredTileSet.");
|
ERR_FAIL_COND_MSG(tile_set.is_null(), "Cannot call fix_invalid_tiles() on a LayeredTileMap without a valid LayeredTileSet.");
|
||||||
|
|
||||||
RBSet<Vector2i> coords;
|
RBSet<Vector2i> coords;
|
||||||
for (const HashMap<Vector2i, CellData>::Element *E = tile_map.front(); E; E = E->next) {
|
for (const HashMap<Vector2i, CellData>::Element *E = tile_map_layer_data.front(); E; E = E->next) {
|
||||||
LayeredTileSetSource *source = *tile_set->get_source(E->value().cell.source_id);
|
LayeredTileSetSource *source = *tile_set->get_source(E->value().cell.source_id);
|
||||||
if (!source || !source->has_tile(E->value().cell.get_atlas_coords()) || !source->has_alternative_tile(E->value().cell.get_atlas_coords(), E->value().cell.alternative_tile)) {
|
if (!source || !source->has_tile(E->value().cell.get_atlas_coords()) || !source->has_alternative_tile(E->value().cell.get_atlas_coords(), E->value().cell.alternative_tile)) {
|
||||||
coords.insert(E->key());
|
coords.insert(E->key());
|
||||||
@ -2384,7 +2384,7 @@ void LayeredTileMapLayer::fix_invalid_tiles() {
|
|||||||
|
|
||||||
void LayeredTileMapLayer::clear() {
|
void LayeredTileMapLayer::clear() {
|
||||||
// Remove all tiles.
|
// Remove all tiles.
|
||||||
for (HashMap<Vector2i, CellData>::Element *kv = tile_map.front(); kv; kv = kv->next) {
|
for (HashMap<Vector2i, CellData>::Element *kv = tile_map_layer_data.front(); kv; kv = kv->next) {
|
||||||
erase_cell(kv->key());
|
erase_cell(kv->key());
|
||||||
}
|
}
|
||||||
used_rect_cache_dirty = true;
|
used_rect_cache_dirty = true;
|
||||||
@ -2414,7 +2414,7 @@ Vector2i LayeredTileMapLayer::get_cell_atlas_coords(const Vector2i &p_coords) co
|
|||||||
|
|
||||||
int LayeredTileMapLayer::get_cell_alternative_tile(const Vector2i &p_coords) const {
|
int LayeredTileMapLayer::get_cell_alternative_tile(const Vector2i &p_coords) const {
|
||||||
// Get a cell source id from position.
|
// Get a cell source id from position.
|
||||||
const HashMap<Vector2i, CellData>::Element *E = tile_map.find(p_coords);
|
const HashMap<Vector2i, CellData>::Element *E = tile_map_layer_data.find(p_coords);
|
||||||
|
|
||||||
if (!E) {
|
if (!E) {
|
||||||
return LayeredTileSetSource::INVALID_TILE_ALTERNATIVE;
|
return LayeredTileSetSource::INVALID_TILE_ALTERNATIVE;
|
||||||
@ -2440,7 +2440,7 @@ LayeredTileData *LayeredTileMapLayer::get_cell_tile_data(const Vector2i &p_coord
|
|||||||
PoolVector2iArray LayeredTileMapLayer::get_used_cells() const {
|
PoolVector2iArray LayeredTileMapLayer::get_used_cells() const {
|
||||||
// Returns the cells used in the tilemap.
|
// Returns the cells used in the tilemap.
|
||||||
PoolVector2iArray a;
|
PoolVector2iArray a;
|
||||||
for (const HashMap<Vector2i, CellData>::Element *E = tile_map.front(); E; E = E->next) {
|
for (const HashMap<Vector2i, CellData>::Element *E = tile_map_layer_data.front(); E; E = E->next) {
|
||||||
const LayeredTileMapCell &c = E->value().cell;
|
const LayeredTileMapCell &c = E->value().cell;
|
||||||
if (c.source_id == LayeredTileSet::INVALID_SOURCE) {
|
if (c.source_id == LayeredTileSet::INVALID_SOURCE) {
|
||||||
continue;
|
continue;
|
||||||
@ -2454,7 +2454,7 @@ PoolVector2iArray LayeredTileMapLayer::get_used_cells() const {
|
|||||||
PoolVector2iArray LayeredTileMapLayer::get_used_cells_by_id(int p_source_id, const Vector2i &p_atlas_coords, int p_alternative_tile) const {
|
PoolVector2iArray LayeredTileMapLayer::get_used_cells_by_id(int p_source_id, const Vector2i &p_atlas_coords, int p_alternative_tile) const {
|
||||||
// Returns the cells used in the tilemap.
|
// Returns the cells used in the tilemap.
|
||||||
PoolVector2iArray a;
|
PoolVector2iArray a;
|
||||||
for (const HashMap<Vector2i, CellData>::Element *E = tile_map.front(); E; E = E->next) {
|
for (const HashMap<Vector2i, CellData>::Element *E = tile_map_layer_data.front(); E; E = E->next) {
|
||||||
const LayeredTileMapCell &c = E->value().cell;
|
const LayeredTileMapCell &c = E->value().cell;
|
||||||
if (c.source_id == LayeredTileSet::INVALID_SOURCE) {
|
if (c.source_id == LayeredTileSet::INVALID_SOURCE) {
|
||||||
continue;
|
continue;
|
||||||
@ -2475,7 +2475,7 @@ Rect2i LayeredTileMapLayer::get_used_rect() const {
|
|||||||
used_rect_cache = Rect2i();
|
used_rect_cache = Rect2i();
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (const HashMap<Vector2i, CellData>::Element *E = tile_map.front(); E; E = E->next) {
|
for (const HashMap<Vector2i, CellData>::Element *E = tile_map_layer_data.front(); E; E = E->next) {
|
||||||
const LayeredTileMapCell &c = E->value().cell;
|
const LayeredTileMapCell &c = E->value().cell;
|
||||||
if (c.source_id == LayeredTileSet::INVALID_SOURCE) {
|
if (c.source_id == LayeredTileSet::INVALID_SOURCE) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -317,7 +317,6 @@ private:
|
|||||||
DebugVisibilityMode navigation_visibility_mode = DEBUG_VISIBILITY_MODE_DEFAULT;
|
DebugVisibilityMode navigation_visibility_mode = DEBUG_VISIBILITY_MODE_DEFAULT;
|
||||||
|
|
||||||
// Internal.
|
// Internal.
|
||||||
HashMap<Vector2i, CellData> tile_map;
|
|
||||||
bool pending_update = false;
|
bool pending_update = false;
|
||||||
|
|
||||||
// For keeping compatibility with LayeredTileMap.
|
// For keeping compatibility with LayeredTileMap.
|
||||||
|
Loading…
Reference in New Issue
Block a user