fix bug with rolling over output
authorhgn <hgodden00@gmail.com>
Mon, 27 Sep 2021 21:48:09 +0000 (22:48 +0100)
committerhgn <hgodden00@gmail.com>
Mon, 27 Sep 2021 21:48:09 +0000 (22:48 +0100)
fishladder.c

index 49aa43ad1fe0b727835fd54a503abb1cd4adf196..9c573084c3daa3fe9deeaf3d01dc0caece1f201f 100644 (file)
@@ -681,7 +681,7 @@ void vg_update(void)
                                        else
                                        {
                                                struct cell *cell_next = pcell( (v2i){ fish->pos[0]+fish->dir[0], fish->pos[1]+fish->dir[1] } );
-                                               if( !(cell_next->state & FLAG_CANAL) )
+                                               if( !(cell_next->state & (FLAG_CANAL|FLAG_OUTPUT)) )
                                                {
                                                        // Try other directions for valid, so down, left, right..
                                                        v2i dirs[] = {{1,0},{-1,0},{0,-1}};
@@ -692,7 +692,7 @@ void vg_update(void)
                                                                if( (dirs[j][0] == -fish->dir[0]) && (dirs[j][1] == -fish->dir[1]) )
                                                                        continue;
                                                        
-                                                               if( pcell( (v2i){ fish->pos[0]+dirs[j][0], fish->pos[1]+dirs[j][1] } )->state & FLAG_CANAL )
+                                                               if( pcell( (v2i){ fish->pos[0]+dirs[j][0], fish->pos[1]+dirs[j][1] } )->state & (FLAG_CANAL|FLAG_OUTPUT) )
                                                                {
                                                                        fish->dir[0] = dirs[j][0];
                                                                        fish->dir[1] = dirs[j][1];