forked from mirrors/0ad
Return CTerrain and CUnitManager references from CWorld instead of pointers
Accepted By: @vladislavbelov Comments By: @Stan Differential Revision: https://code.wildfiregames.com/D4739 This was SVN commit r27861.
This commit is contained in:
@@ -118,15 +118,15 @@ JS::Value GetCameraPosition(const ScriptRequest& rq)
|
||||
*/
|
||||
void CameraMoveTo(entity_pos_t x, entity_pos_t z)
|
||||
{
|
||||
if (!g_Game || !g_Game->GetWorld() || !g_Game->GetView() || !g_Game->GetWorld()->GetTerrain())
|
||||
if (!g_Game || !g_Game->GetWorld() || !g_Game->GetView())
|
||||
return;
|
||||
|
||||
CTerrain* terrain = g_Game->GetWorld()->GetTerrain();
|
||||
const CTerrain& terrain = g_Game->GetWorld()->GetTerrain();
|
||||
|
||||
CVector3D target;
|
||||
target.X = x.ToFloat();
|
||||
target.Z = z.ToFloat();
|
||||
target.Y = terrain->GetExactGroundLevel(target.X, target.Z);
|
||||
target.Y = terrain.GetExactGroundLevel(target.X, target.Z);
|
||||
|
||||
g_Game->GetView()->MoveCameraTarget(target);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user