// go in wait mode when back in water
if(dying == DYING_NOT
- && gettile(base.x, base.y+ base.height)->attributes & Tile::WATER
+ && gettile(base.x, base.y + base.height)
+ && gettile(base.x, base.y + base.height)->attributes & Tile::WATER
&& physic.get_velocity_y() <= 0 && mode == NORMAL)
{
mode = FISH_WAIT;
for(int x = starttilex; x*32 < max_x; ++x) {
for(int y = starttiley; y*32 < max_y; ++y) {
Tile* tile = tilemap.get_tile(x, y);
- if(tile->attributes & Tile::SOLID)
+ if(tile && tile->attributes & Tile::SOLID)
return true;
}
}
Sector::trybreakbrick(const Vector& pos, bool small)
{
Tile* tile = solids->get_tile_at(pos);
+ if (!tile)
+ {
+ char errmsg[64];
+ sprintf(errmsg, "Invalid tile at %i,%i", (int)((pos.x+1)/32*32), (int)((pos.y+1)/32*32));
+ throw SuperTuxException(errmsg, __FILE__, __LINE__);
+ }
+
if (tile->attributes & Tile::BRICK)
{
if (tile->data > 0)
Sector::tryemptybox(const Vector& pos, Direction col_side)
{
Tile* tile = solids->get_tile_at(pos);
+ if (!tile)
+ {
+ char errmsg[64];
+ sprintf(errmsg, "Invalid tile at %i,%i", (int)((pos.x+1)/32*32), (int)((pos.y+1)/32*32));
+ throw SuperTuxException(errmsg, __FILE__, __LINE__);
+ }
+
+
if (!(tile->attributes & Tile::FULLBOX))
return;
Sector::trygrabdistro(const Vector& pos, int bounciness)
{
Tile* tile = solids->get_tile_at(pos);
+ if (!tile)
+ {
+ char errmsg[64];
+ sprintf(errmsg, "Invalid tile at %i,%i", (int)((pos.x+1)/32*32), (int)((pos.y+1)/32*32));
+ throw SuperTuxException(errmsg, __FILE__, __LINE__);
+ }
+
+
if (!(tile->attributes & Tile::COIN))
return;