Package: epiphany / 0.7.0+0-3

unravel-sprintf.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Subject: Unravel level path construction which seems to
 be optimized out by current C++ compiler
From: Ricardo Mones <mones@debian.org>
Forwarded: no
Last-Update: 2014-11-04
Bug-Debian: https://bugs.debian.org/767904

diff --git a/src/game.cpp b/src/game.cpp
index e3c8bc7..2a8a70a 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -413,14 +413,10 @@ void Game::go()
 			m_level=new Level();
   		
 			char current_level_path[255];
-  		
-			sprintf(current_level_path, "%s", (Resource_Factory::instance()->get_resource_path().c_str()));
-  		
-			sprintf(current_level_path, "%s%s", current_level_path, "/maps/level");
-  	
-			sprintf(current_level_path, "%s%d", current_level_path, (menu.get_current_level()));
-  		
-			sprintf(current_level_path, "%s%s", current_level_path, ".map");
+
+			sprintf(current_level_path, "%s/maps/level%d.map",
+				Resource_Factory::instance()->get_resource_path().c_str(),
+				menu.get_current_level());
   	
 			DEBOUT("Loading map: "<<current_level_path<<"\n");