@@ -139,16 +139,16 @@ TerrainFrameData parse_terrain_frame(const std::vector<std::string> &args) {
139139 return frame;
140140}
141141
142- TerrainInfo parse_terrain_file (const util::Path &file ,
142+ TerrainInfo parse_terrain_file (const util::Path &path ,
143143 const std::shared_ptr<AssetCache> &cache) {
144- if (not file .is_file ()) [[unlikely]] {
144+ if (not path .is_file ()) [[unlikely]] {
145145 throw Error (MSG (err) << " Reading .terrain file '"
146- << file .get_name ()
146+ << path .get_name ()
147147 << " ' failed. Reason: File not found" );
148148 }
149149
150- auto content = file .open ();
151- auto lines = content .get_lines ();
150+ auto file = path .open ();
151+ auto lines = file .get_lines ();
152152
153153 float scalefactor = 1.0 ;
154154 std::vector<TextureData> textures;
@@ -167,7 +167,7 @@ TerrainInfo parse_terrain_file(const util::Path &file,
167167
168168 if (version_no != 2 ) {
169169 throw Error (MSG (err) << " Reading .terrain file '"
170- << file .get_name ()
170+ << path .get_name ()
171171 << " ' failed. Reason: Version "
172172 << version_no << " not supported" );
173173 }
@@ -200,16 +200,16 @@ TerrainInfo parse_terrain_file(const util::Path &file,
200200 })};
201201
202202 for (auto line : lines) {
203- // Skip empty lines, lines with carriage returns, and comments
204- if (line.empty () || line.substr (0 , 1 ) == " #" || line[ 0 ] == ' \r ' ) {
203+ // Skip empty lines and comments
204+ if (line.empty () || line.substr (0 , 1 ) == " #" ) {
205205 continue ;
206206 }
207207 std::vector<std::string> args{util::split (line, ' ' )};
208208
209209 // TODO: Avoid double lookup with keywordfuncs.find(args[0])
210210 if (not keywordfuncs.contains (args[0 ])) [[unlikely]] {
211211 throw Error (MSG (err) << " Reading .terrain file '"
212- << file .get_name ()
212+ << path .get_name ()
213213 << " ' failed. Reason: Keyword "
214214 << args[0 ] << " is not defined" );
215215 }
@@ -269,7 +269,7 @@ TerrainInfo parse_terrain_file(const util::Path &file,
269269 // Parse textures
270270 std::vector<std::shared_ptr<Texture2dInfo>> texture_infos;
271271 for (auto texture : textures) {
272- util::Path texturepath = (file .get_parent () / texture.path );
272+ util::Path texturepath = (path .get_parent () / texture.path );
273273
274274 if (cache && cache->check_texture_cache (texturepath)) {
275275 // already loaded
@@ -287,7 +287,7 @@ TerrainInfo parse_terrain_file(const util::Path &file,
287287
288288 std::shared_ptr<BlendTableInfo> blendtable_info;
289289 if (blendtable) {
290- util::Path tablepath = (file .get_parent () / blendtable.value ().path );
290+ util::Path tablepath = (path .get_parent () / blendtable.value ().path );
291291
292292 if (cache && cache->check_bltable_cache (tablepath)) {
293293 // already loaded
0 commit comments