mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Remove unnecessary check for entities close to map border
When handling door and laser entities, all 8 adjacent tiles are checked for laser modifier tiles. When handling laser entities, the 8 tiles one further out are also checked for laser modifier tiles. If either of those 16 tiles is outside the map bounds, an error message was printed and the tiles are ignored. The error message is removed because it's unnecessary and misleading. Placing entities near or on the map border is not known to cause any issues. Closes #7759.
This commit is contained in:
parent
0bce368c77
commit
6e4afd7c63
|
@ -1032,51 +1032,26 @@ int CCollision::GetFTile(int x, int y) const
|
||||||
int CCollision::Entity(int x, int y, int Layer) const
|
int CCollision::Entity(int x, int y, int Layer) const
|
||||||
{
|
{
|
||||||
if(x < 0 || x >= m_Width || y < 0 || y >= m_Height)
|
if(x < 0 || x >= m_Width || y < 0 || y >= m_Height)
|
||||||
{
|
|
||||||
const char *pName;
|
|
||||||
switch(Layer)
|
|
||||||
{
|
|
||||||
case LAYER_GAME:
|
|
||||||
pName = "Game";
|
|
||||||
break;
|
|
||||||
case LAYER_FRONT:
|
|
||||||
pName = "Front";
|
|
||||||
break;
|
|
||||||
case LAYER_SWITCH:
|
|
||||||
pName = "Switch";
|
|
||||||
break;
|
|
||||||
case LAYER_TELE:
|
|
||||||
pName = "Tele";
|
|
||||||
break;
|
|
||||||
case LAYER_SPEEDUP:
|
|
||||||
pName = "Speedup";
|
|
||||||
break;
|
|
||||||
case LAYER_TUNE:
|
|
||||||
pName = "Tune";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
pName = "Unknown";
|
|
||||||
}
|
|
||||||
dbg_msg("collision", "Something is VERY wrong with the %s layer near (%d, %d). Please report this at https://github.com/ddnet/ddnet/issues, you will need to post the map as well and any steps that you think may have led to this.", pName, x, y);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
const int Index = y * m_Width + x;
|
||||||
switch(Layer)
|
switch(Layer)
|
||||||
{
|
{
|
||||||
case LAYER_GAME:
|
case LAYER_GAME:
|
||||||
return m_pTiles[y * m_Width + x].m_Index - ENTITY_OFFSET;
|
return m_pTiles[Index].m_Index - ENTITY_OFFSET;
|
||||||
case LAYER_FRONT:
|
case LAYER_FRONT:
|
||||||
return m_pFront[y * m_Width + x].m_Index - ENTITY_OFFSET;
|
return m_pFront[Index].m_Index - ENTITY_OFFSET;
|
||||||
case LAYER_SWITCH:
|
case LAYER_SWITCH:
|
||||||
return m_pSwitch[y * m_Width + x].m_Type - ENTITY_OFFSET;
|
return m_pSwitch[Index].m_Type - ENTITY_OFFSET;
|
||||||
case LAYER_TELE:
|
case LAYER_TELE:
|
||||||
return m_pTele[y * m_Width + x].m_Type - ENTITY_OFFSET;
|
return m_pTele[Index].m_Type - ENTITY_OFFSET;
|
||||||
case LAYER_SPEEDUP:
|
case LAYER_SPEEDUP:
|
||||||
return m_pSpeedup[y * m_Width + x].m_Type - ENTITY_OFFSET;
|
return m_pSpeedup[Index].m_Type - ENTITY_OFFSET;
|
||||||
case LAYER_TUNE:
|
case LAYER_TUNE:
|
||||||
return m_pTune[y * m_Width + x].m_Type - ENTITY_OFFSET;
|
return m_pTune[Index].m_Type - ENTITY_OFFSET;
|
||||||
default:
|
default:
|
||||||
return 0;
|
dbg_assert(false, "Layer invalid");
|
||||||
break;
|
dbg_break();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue