forked from 0ad/0ad
# Bug fixes.
- Fixed a crash that was happening in pathfinding on maps where some tiles had invalid texture names (from earlier versions of the game). - Releasing the mouse over the minimap while dragging a selection band will no longer cause the view to move there. Unfortunately, the bandbox still won't properly "release". The bandbox input routine should ideally be placed at a higher priority than the GUI, separate from the other Interact.cpp routines. This was SVN commit r4711.
This commit is contained in:
parent
f6de818ea8
commit
603401dc09
@ -96,6 +96,10 @@ bool CTerrain::isOnMap(const CVector2D& v) const
|
|||||||
bool CTerrain::isPassable(const CVector2D &loc/*tile space*/, HEntity entity) const
|
bool CTerrain::isPassable(const CVector2D &loc/*tile space*/, HEntity entity) const
|
||||||
{
|
{
|
||||||
CMiniPatch *pTile = GetTile(loc.x, loc.y);
|
CMiniPatch *pTile = GetTile(loc.x, loc.y);
|
||||||
|
if(!pTile->Tex1)
|
||||||
|
{
|
||||||
|
return false; // Invalid terrain type in the scenario file
|
||||||
|
}
|
||||||
CTextureEntry *pTexEntry = g_TexMan.FindTexture(pTile->Tex1);
|
CTextureEntry *pTexEntry = g_TexMan.FindTexture(pTile->Tex1);
|
||||||
CTerrainPropertiesPtr pProperties = pTexEntry->GetProperties();
|
CTerrainPropertiesPtr pProperties = pTexEntry->GetProperties();
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ void CUnitManager::DeleteAll()
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// PickUnit: iterate through units testing given ray against bounds of each
|
// PickUnit: iterate through units testing given ray against bounds of each
|
||||||
// unit; return the closest unit, or null if everything missed
|
// unit; return the closest unit, or null if everything missed
|
||||||
CUnit* CUnitManager::PickUnit(const CVector3D& origin, const CVector3D& dir) const
|
CUnit* CUnitManager::PickUnit(const CVector3D& origin, const CVector3D& dir, bool entitiesOnly) const
|
||||||
{
|
{
|
||||||
CLOSManager* losMgr = g_Game->GetWorld()->GetLOSManager();
|
CLOSManager* losMgr = g_Game->GetWorld()->GetLOSManager();
|
||||||
|
|
||||||
@ -94,6 +94,8 @@ CUnit* CUnitManager::PickUnit(const CVector3D& origin, const CVector3D& dir) con
|
|||||||
float tmin, tmax;
|
float tmin, tmax;
|
||||||
|
|
||||||
CEntity* ent = unit->GetEntity();
|
CEntity* ent = unit->GetEntity();
|
||||||
|
if( entitiesOnly && !ent )
|
||||||
|
continue;
|
||||||
if( ent && !ent->m_visible )
|
if( ent && !ent->m_visible )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public:
|
|||||||
|
|
||||||
// iterate through units testing given ray against bounds of each unit;
|
// iterate through units testing given ray against bounds of each unit;
|
||||||
// return the closest unit, or null if everything missed
|
// return the closest unit, or null if everything missed
|
||||||
CUnit* PickUnit(const CVector3D& origin, const CVector3D& dir) const;
|
CUnit* PickUnit(const CVector3D& origin, const CVector3D& dir, bool entitiesOnly) const;
|
||||||
|
|
||||||
CUnit* FindByID(int id) const;
|
CUnit* FindByID(int id) const;
|
||||||
|
|
||||||
|
@ -71,6 +71,7 @@ void CMiniMap::HandleMessage(const SGUIMessage &Message)
|
|||||||
}
|
}
|
||||||
case GUIM_MOUSE_RELEASE_LEFT:
|
case GUIM_MOUSE_RELEASE_LEFT:
|
||||||
{
|
{
|
||||||
|
if(m_Clicking)
|
||||||
SetCameraPos();
|
SetCameraPos();
|
||||||
m_Clicking = false;
|
m_Clicking = false;
|
||||||
break;
|
break;
|
||||||
|
@ -644,7 +644,7 @@ void CMouseoverEntities::update( float timestep )
|
|||||||
CVector3D origin, dir;
|
CVector3D origin, dir;
|
||||||
pCamera->BuildCameraRay( origin, dir );
|
pCamera->BuildCameraRay( origin, dir );
|
||||||
|
|
||||||
CUnit* hit = g_UnitMan.PickUnit( origin, dir );
|
CUnit* hit = g_UnitMan.PickUnit( origin, dir, true );
|
||||||
|
|
||||||
m_worldposition = pCamera->GetWorldCoordinates(true);
|
m_worldposition = pCamera->GetWorldCoordinates(true);
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ QUERYHANDLER(PickObject)
|
|||||||
CVector3D rayorigin, raydir;
|
CVector3D rayorigin, raydir;
|
||||||
g_Game->GetView()->GetCamera()->BuildCameraRay((int)x, (int)y, rayorigin, raydir);
|
g_Game->GetView()->GetCamera()->BuildCameraRay((int)x, (int)y, rayorigin, raydir);
|
||||||
|
|
||||||
CUnit* target = g_UnitMan.PickUnit(rayorigin, raydir);
|
CUnit* target = g_UnitMan.PickUnit(rayorigin, raydir, false);
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
msg->id = target->GetID();
|
msg->id = target->GetID();
|
||||||
|
Loading…
Reference in New Issue
Block a user