android/GlueIOIOPort: fix spurious errors after IOIO baud rate change
[xcsoar.git] / src / Terrain / RasterTerrain.cpp
blob468e27936a0035d9855b5973d2e68f95cd9558e3
1 /*
2 Copyright_License {
4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "Terrain/RasterTerrain.hpp"
25 #include "Profile/Profile.hpp"
26 #include "OS/PathName.hpp"
27 #include "Compatibility/path.h"
29 #include <windef.h> /* for MAX_PATH */
31 // General, open/close
33 RasterTerrain *
34 RasterTerrain::OpenTerrain(FileCache *cache, OperationEnvironment &operation)
36 TCHAR szFile[MAX_PATH], world_file_buffer[MAX_PATH];
37 const TCHAR *world_file;
39 if (Profile::GetPath(ProfileKeys::MapFile, szFile)) {
40 _tcscpy(world_file_buffer, szFile);
41 _tcscat(world_file_buffer, _T(DIR_SEPARATOR_S "terrain.j2w"));
42 world_file = world_file_buffer;
44 _tcscat(szFile, _T("/terrain.jp2"));
45 } else
46 return NULL;
48 RasterTerrain *rt = new RasterTerrain(szFile, world_file, cache, operation);
49 if (!rt->map.IsDefined()) {
50 delete rt;
51 return NULL;
54 return rt;