Skip to content

Commit 1e85b4c

Browse files
committed
Allow connections for water tiles
1 parent fd4d1a9 commit 1e85b4c

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/sdltiles.cpp

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -683,22 +683,33 @@ std::pair<std::string, bool> cata_tiles::get_omt_id_rotation_and_subtile(
683683
oter_type_id ot_type_id = ot.get_type_id();
684684
const oter_type_t &ot_type = *ot_type_id;
685685

686+
// get terrain neighborhood
687+
const std::array<oter_type_id, 4> neighborhood = {
688+
oter_at( omp + point_south )->get_type_id(),
689+
oter_at( omp + point_east )->get_type_id(),
690+
oter_at( omp + point_west )->get_type_id(),
691+
oter_at( omp + point_north )->get_type_id()
692+
};
693+
686694
if( ot_type.has_connections() ) {
687695
// This would be for connected terrain
696+
char val = 0;
688697

689-
// get terrain neighborhood
690-
const std::array<oter_type_id, 4> neighborhood = {
691-
oter_at( omp + point_south )->get_type_id(),
692-
oter_at( omp + point_east )->get_type_id(),
693-
oter_at( omp + point_west )->get_type_id(),
694-
oter_at( omp + point_north )->get_type_id()
695-
};
698+
// populate connection information
699+
for( int i = 0; i < 4; ++i ) {
700+
if( ot_type.connects_to( neighborhood[i] ) ) {
701+
val += 1 << i;
702+
}
703+
}
696704

705+
get_rotation_and_subtile( val, -1, rota, subtile );
706+
} else if( ot_type.has_flag( oter_flags::water ) ) {
707+
// water looks nicer if it connects together
697708
char val = 0;
698709

699710
// populate connection information
700711
for( int i = 0; i < 4; ++i ) {
701-
if( ot_type.connects_to( neighborhood[i] ) ) {
712+
if( neighborhood[i]->has_flag( oter_flags::water ) ) {
702713
val += 1 << i;
703714
}
704715
}

0 commit comments

Comments
 (0)