Stops unit following when other object selected. Fixes #775
This was SVN commit r9764.
This commit is contained in:
parent
d2d631d2ed
commit
1bc2db56ea
@ -740,6 +740,12 @@ function handleInputAfterGui(ev)
|
||||
var selectedEntity = ents[0];
|
||||
var now = new Date();
|
||||
|
||||
// If camera following and we select different unit, stop
|
||||
if (Engine.GetFollowedEntity() != selectedEntity)
|
||||
{
|
||||
Engine.CameraFollow(0);
|
||||
}
|
||||
|
||||
if ((now.getTime() - doubleClickTimer < doubleClickTime) && (selectedEntity == prevClickedEntity))
|
||||
{
|
||||
// Double click or triple click has occurred
|
||||
|
@ -958,6 +958,11 @@ void CGameView::CameraFollow(entity_id_t entity, bool firstPerson)
|
||||
m->FollowFirstPerson = firstPerson;
|
||||
}
|
||||
|
||||
entity_id_t CGameView::GetFollowedEntity()
|
||||
{
|
||||
return m->FollowEntity;
|
||||
}
|
||||
|
||||
InReaction game_view_handler(const SDL_Event_* ev)
|
||||
{
|
||||
// put any events that must be processed even if inactive here
|
||||
|
@ -86,6 +86,7 @@ public:
|
||||
void ResetCameraTarget(const CVector3D& target);
|
||||
void ResetCameraAngleZoom();
|
||||
void CameraFollow(entity_id_t entity, bool firstPerson);
|
||||
entity_id_t GetFollowedEntity();
|
||||
|
||||
CCamera *GetCamera();
|
||||
CCinemaManager* GetCinema();
|
||||
|
@ -346,6 +346,14 @@ void CameraFollowFPS(void* UNUSED(cbdata), entity_id_t entityid)
|
||||
g_Game->GetView()->CameraFollow(entityid, true);
|
||||
}
|
||||
|
||||
entity_id_t GetFollowedEntity(void* UNUSED(cbdata))
|
||||
{
|
||||
if (g_Game && g_Game->GetView())
|
||||
return g_Game->GetView()->GetFollowedEntity();
|
||||
|
||||
return INVALID_ENTITY;
|
||||
}
|
||||
|
||||
bool HotkeyIsPressed_(void* UNUSED(cbdata), std::string hotkeyName)
|
||||
{
|
||||
return HotkeyIsPressed(hotkeyName);
|
||||
@ -491,6 +499,7 @@ void GuiScriptingInit(ScriptInterface& scriptInterface)
|
||||
scriptInterface.RegisterFunction<CScriptVal, &GetMapSettings>("GetMapSettings");
|
||||
scriptInterface.RegisterFunction<void, entity_id_t, &CameraFollow>("CameraFollow");
|
||||
scriptInterface.RegisterFunction<void, entity_id_t, &CameraFollowFPS>("CameraFollowFPS");
|
||||
scriptInterface.RegisterFunction<entity_id_t, &GetFollowedEntity>("GetFollowedEntity");
|
||||
scriptInterface.RegisterFunction<bool, std::string, &HotkeyIsPressed_>("HotkeyIsPressed");
|
||||
scriptInterface.RegisterFunction<void, std::wstring, &DisplayErrorDialog>("DisplayErrorDialog");
|
||||
scriptInterface.RegisterFunction<CScriptVal, &GetProfilerState>("GetProfilerState");
|
||||
|
Loading…
Reference in New Issue
Block a user