1
0
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:
Matei 2006-12-20 05:41:54 +00:00
parent f6de818ea8
commit 603401dc09
6 changed files with 14 additions and 7 deletions

View File

@ -96,6 +96,10 @@ bool CTerrain::isOnMap(const CVector2D& v) const
bool CTerrain::isPassable(const CVector2D &loc/*tile space*/, HEntity entity) const
{
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);
CTerrainPropertiesPtr pProperties = pTexEntry->GetProperties();

View File

@ -78,7 +78,7 @@ void CUnitManager::DeleteAll()
///////////////////////////////////////////////////////////////////////////////
// PickUnit: iterate through units testing given ray against bounds of each
// 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();
@ -94,6 +94,8 @@ CUnit* CUnitManager::PickUnit(const CVector3D& origin, const CVector3D& dir) con
float tmin, tmax;
CEntity* ent = unit->GetEntity();
if( entitiesOnly && !ent )
continue;
if( ent && !ent->m_visible )
continue;

View File

@ -48,7 +48,7 @@ public:
// iterate through units testing given ray against bounds of each unit;
// 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;

View File

@ -71,9 +71,10 @@ void CMiniMap::HandleMessage(const SGUIMessage &Message)
}
case GUIM_MOUSE_RELEASE_LEFT:
{
SetCameraPos();
m_Clicking = false;
break;
if(m_Clicking)
SetCameraPos();
m_Clicking = false;
break;
}
case GUIM_MOUSE_ENTER:
{

View File

@ -644,7 +644,7 @@ void CMouseoverEntities::update( float timestep )
CVector3D 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);

View File

@ -487,7 +487,7 @@ QUERYHANDLER(PickObject)
CVector3D 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)
msg->id = target->GetID();