Package: xmoto / 0.5.11+dfsg-8

svn3421.patch 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
Description: Fix several warnings

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+X-Moto 0.5.12 201
+--------------------------------
+ * remove several warnings (including replacing hash_map by unordered_map)
+
 X-Moto 0.5.11 2014-03-29
 --------------------------------
  * handles lua 5.2 library loading changes
--- a/src/states/StateOptions.cpp
+++ b/src/states/StateOptions.cpp
@@ -728,7 +728,7 @@
 		      i_screen->getDispWidth(),
 		      i_screen->getDispHeight());
 
-  UIWindow *v_window, *v_frame;
+  UIWindow *v_window;
   UIStatic*  v_someText;
   UITabView* v_tabview;
   UIButton*  v_button;
@@ -750,11 +750,11 @@
   v_tabview->setTabContextHelp(3, CONTEXTHELP_DB_OPTIONS);
   v_tabview->setTabContextHelp(4, CONTEXTHELP_LANGUAGE_OPTIONS);
 
-  v_frame = makeWindowOptions_general(v_tabview);
-  v_frame = makeWindowOptions_rooms(v_tabview);
-  v_frame = makeWindowOptions_ghosts(v_tabview);
-  v_frame = makeWindowOptions_db(v_tabview);
-  v_frame = makeWindowOptions_language(v_tabview);
+  makeWindowOptions_general(v_tabview);
+  makeWindowOptions_rooms(v_tabview);
+  makeWindowOptions_ghosts(v_tabview);
+  makeWindowOptions_db(v_tabview);
+  makeWindowOptions_language(v_tabview);
 
   v_button = new UIButton(v_window, 20, v_window->getPosition().nHeight-68, GAMETEXT_DEFAULTS, 115, 57);
   v_button->setID("DEFAULTS_BUTTON");
@@ -2134,7 +2134,6 @@
 }
 
 void StateOptions::createRoomsList(UIList *pList) {
-  UIListEntry *pEntry;
   std::string v_selected_roomName = "";
   char **v_result;
   unsigned int nrow;
@@ -2157,7 +2156,7 @@
   for(unsigned int i=0; i<nrow; i++) {
     v_roomId   = xmDatabase::instance("main")->getResult(v_result, 2, i, 0);
     v_roomName = xmDatabase::instance("main")->getResult(v_result, 2, i, 1);
-    pEntry = pList->addEntry(v_roomName, reinterpret_cast<void *>(new std::string(v_roomId)));    
+    pList->addEntry(v_roomName, reinterpret_cast<void *>(new std::string(v_roomId)));    
   }
   xmDatabase::instance("main")->read_DB_free(v_result);
 
@@ -2165,7 +2164,7 @@
   for(unsigned int i=0; i<nrow; i++) {
     v_roomId   = xmDatabase::instance("main")->getResult(v_result, 2, i, 0);
     v_roomName = xmDatabase::instance("main")->getResult(v_result, 2, i, 1);
-    pEntry = pList->addEntry(v_roomName, reinterpret_cast<void *>(new std::string(v_roomId)));    
+    pList->addEntry(v_roomName, reinterpret_cast<void *>(new std::string(v_roomId)));    
   }
   xmDatabase::instance("main")->read_DB_free(v_result);
 
--- a/src/drawlib/DrawLibOpenGL.cpp
+++ b/src/drawlib/DrawLibOpenGL.cpp
@@ -80,7 +80,7 @@
   /* a glyph from other glyphs */
   /*kejo:why not just grrr create a copy contructor*/
   GLFontGlyph(const std::string& i_value,
-	      HashNamespace::hash_map<const char*, GLFontGlyphLetter*, HashNamespace::hash<const char*>, hashcmp_str>& i_glyphsLetters);
+	      HashNamespace::unordered_map<std::string, GLFontGlyphLetter*>& i_glyphsLetters);
   virtual ~GLFontGlyph();
 
   std::string Value() const;
@@ -132,11 +132,11 @@
 private:
   std::vector<std::string> m_glyphsKeys;
   std::vector<GLFontGlyph*> m_glyphsValues;
-  HashNamespace::hash_map<const char*, GLFontGlyph*, HashNamespace::hash<const char*>, hashcmp_str> m_glyphs;
+  HashNamespace::unordered_map<std::string, GLFontGlyph*> m_glyphs;
 
   std::vector<std::string> m_glyphsLettersKeys;
   std::vector<GLFontGlyphLetter*> m_glyphsLettersValues;
-  HashNamespace::hash_map<const char*, GLFontGlyphLetter*, HashNamespace::hash<const char*>, hashcmp_str> m_glyphsLetters;
+  HashNamespace::unordered_map<std::string, GLFontGlyphLetter*> m_glyphsLetters;
 
   unsigned int getLonguestLineSize(const std::string& i_value, unsigned int i_start = 0, unsigned int i_nbLinesToRead = -1);
 };
@@ -825,7 +825,7 @@
 }
 
 GLFontGlyph::GLFontGlyph(const std::string& i_value,
-			 HashNamespace::hash_map<const char*, GLFontGlyphLetter*, HashNamespace::hash<const char*>, hashcmp_str>& i_glyphsLetters) {
+			 HashNamespace::unordered_map<std::string, GLFontGlyphLetter*>& i_glyphsLetters) {
   GLFontGlyph* v_glyph;
   std::string  v_char;
 
@@ -850,7 +850,7 @@
       v_maxHeight = 0;
       v_curWidth  = 0;
     } else {
-      v_glyph = i_glyphsLetters[v_char.c_str()];
+      v_glyph = i_glyphsLetters[v_char];
       if(v_glyph != NULL) {
 	if(v_glyph->realHeight() > v_maxHeight)
 	  v_maxHeight = v_glyph->realHeight();
@@ -927,7 +927,7 @@
   /* i added the m_glyphsList because the iterator on the hashmap
      often produces segfault on delete it->second */
   //printf("BEGIN ~GLFontManager()\n");
-  //HashNamespace::hash_map<const char*, GLFontGlyph*, HashNamespace::hash<const char*>, hashcmp_str, std::allocator<GLFontGlyph*> >::iterator it;
+  //HashNamespace::unordered_map<std::string, GLFontGlyph*>::iterator it;
   //for (it = m_glyphs.begin(); it != m_glyphs.end(); it++) {
   //  delete it->second;
   //}
@@ -967,7 +967,7 @@
   GLFontGlyph *v_glyph;
   GLFontGlyphLetter *v_glyphLetter;
 
-  v_glyph = m_glyphs[i_string.c_str()];
+  v_glyph = m_glyphs[i_string];
   if(v_glyph != NULL) return v_glyph;
 
   /* make sure that chars exists into the hashmap before continuing */
@@ -976,11 +976,11 @@
   while(n < i_string.size()) {
     v_char = utf8::getNextChar(i_string, n);
     if(v_char != "\n") {
-      if(m_glyphsLetters[v_char.c_str()] == NULL) {
+      if(m_glyphsLetters[v_char] == NULL) {
 	v_glyphLetter = new GLFontGlyphLetter(v_char, m_ttf, m_fixedFontSize);
 	m_glyphsLettersKeys.push_back(v_char);
 	m_glyphsLettersValues.push_back(v_glyphLetter);
-	m_glyphsLetters[m_glyphsLettersKeys[m_glyphsLettersKeys.size()-1].c_str()] = v_glyphLetter;
+	m_glyphsLetters[m_glyphsLettersKeys[m_glyphsLettersKeys.size()-1]] = v_glyphLetter;
       }
     }
   }
@@ -989,7 +989,7 @@
   v_glyph = new GLFontGlyph(i_string, m_glyphsLetters);
   m_glyphsKeys.push_back(i_string);
   m_glyphsValues.push_back(v_glyph);  
-  m_glyphs[m_glyphsKeys[m_glyphsKeys.size()-1].c_str()] = v_glyph;
+  m_glyphs[m_glyphsKeys[m_glyphsKeys.size()-1]] = v_glyph;
 
   return v_glyph;
 }
@@ -1078,7 +1078,7 @@
 	v_y -= v_lineHeight + UTF8_INTERLINE_SPACE;
 	v_lineHeight = 0;
       } else {
-	v_glyphLetter = m_glyphsLetters[v_char.c_str()];
+	v_glyphLetter = m_glyphsLetters[v_char];
 	if(v_glyphLetter != NULL) {
 	  if(v_glyphLetter->realHeight() > v_lineHeight)
 	    v_lineHeight = v_glyphLetter->realHeight();
@@ -1145,7 +1145,7 @@
 	return v_longuest_linesize;
       }
     } else {
-      v_glyphLetter = m_glyphsLetters[v_char.c_str()];
+      v_glyphLetter = m_glyphsLetters[v_char];
       if(v_glyphLetter != NULL) {
 	v_current_linesize += v_glyphLetter->realWidth() + UTF8_INTERCHAR_SPACE;
       }
--- a/src/VXml.cpp
+++ b/src/VXml.cpp
@@ -39,7 +39,6 @@
 }
 
 void XMLDocument::XMLDocumentErrorFunc(void* ctx, const char* msg, ...) {
-  XMLDocument* v_xml = (XMLDocument*) ctx;
   va_list List;
   char cBuf[2048];
 
--- a/src/WWW.h
+++ b/src/WWW.h
@@ -30,10 +30,6 @@
 #include <stdio.h>
 #include <curl/curl.h>
 
-#if !defined(WIN32) && !defined(__APPLE__) && !defined(__MACH__)
-  //#define USE_HASH_MAP // removed because it seems to segfault i don't know why when i refresh levels using F5 and quit
-#endif
-
 #include "WWWAppInterface.h"
 #include "Theme.h"
 #include "XMSession.h"
@@ -62,27 +58,6 @@
 
 #define WWW_AGENT ("xmoto-" + XMBuild::getVersionString(true))
 
-#if defined(USE_HASH_MAP)
-  #ifdef __GNUC__
-  #if (__GNUC__ >= 3)
-  #include <ext/hash_map>
-  namespace HashNamespace=__gnu_cxx;
-  #else
-  #include <hash_map>
-  #define HashNamespace std
-  #endif
-  #else // #ifdef __GNUC__
-  #include <hash_map>
-  namespace HashNamespace=std;
-  #endif
-
-  struct highscore_str {
-    bool operator()(const char* s1, const char* s2) {
-      return strcmp(s1, s2) == 0;
-    }
-  };
-#endif
-
 struct f_curl_download_data {
   WWWAppInterface *v_WebApp;
   int v_nb_files_to_download;
--- a/src/VBezier.cpp
+++ b/src/VBezier.cpp
@@ -97,14 +97,7 @@
   ===========================================================================*/  
   void BezierShape::finishCreation() {
     /* Okay, create shape curves */
-    for(unsigned int i=0;i<m_nNumPoints;i++) {
-      /* Next point? */
-      int j;
-      if(i+1 == m_nNumPoints)
-	j=0;
-      else
-	j=i+1;
-    
+    for(unsigned int i=0;i<m_nNumPoints;i++) {    
       /* Do this curve */
       m_pCurves[i].setP(0,m_pPoints[i].Pos);
       m_pCurves[i].setP(1,m_pPoints[i].c2);
--- a/src/Renderer.cpp
+++ b/src/Renderer.cpp
@@ -1365,7 +1365,6 @@
 
     int nStrawberriesLeft = i_scene->getLevelSrc()->countToTakeEntities();
     int nQuantity = 0;
-    Vector2i bottomLeft = i_scene->getCamera()->getDispBottomLeft();
     int height = i_scene->getCamera()->getDispHeight();
 
     if(XMSession::instance()->ugly() == false) {
@@ -2768,7 +2767,6 @@
   DrawLib* pDrawlib = GameApp::instance()->getDrawLib();
 
   Biker* pBiker = i_scene->getCamera()->getPlayerToFollow();
-  Vector2i bottomLeft = i_scene->getCamera()->getDispBottomLeft();
 
   /* render game time */
   FontManager* v_fm = pDrawlib->getFontMedium();
--- a/src/Packager.cpp
+++ b/src/Packager.cpp
@@ -193,7 +193,7 @@
     fclose(fp);
     
     /* Info */
-    printf("%d files scheduled for packaging!\n",FileList.size());
+    printf("%lu files scheduled for packaging!\n",FileList.size());
     printf("Creating package '%s'...\n", BinFile.c_str());
     
     /* Do it */
--- a/src/helpers/Color.h
+++ b/src/helpers/Color.h
@@ -24,7 +24,7 @@
 typedef unsigned int Color;
 
 #define MAKE_COLOR(red, green, blue, alpha) \
-	((Color)(alpha|(((Color)blue)<<8)|(((Color)green)<<16)|(((Color)red)<<24)))
+  ((Color)((alpha)|(((Color)blue)<<8)|(((Color)green)<<16)|(((Color)red)<<24)))
 
 #define GET_ALPHA(color) \
 	((Color)((color)&0xff))
--- a/src/Locales.cpp
+++ b/src/Locales.cpp
@@ -88,6 +88,11 @@
 
   cs = bind_textdomain_codeset(PACKAGE_LANG, "UTF-8");
 
+  if(cs == NULL) {
+    /* outch not enough memory, no real thing to do */
+    return locale;
+  }
+
   return locale;
 
 #endif
--- a/src/LevelsManager.cpp
+++ b/src/LevelsManager.cpp
@@ -659,15 +659,13 @@
 
   i_db->levels_add_begin(true);
   for(unsigned int i=0; i<LvlFiles.size(); i++) {
-    bool bCached = false;
-
     /* add the level from the unloaded levels if possible to make it faster */
     if(i_db->levels_add_fast(LvlFiles[i], v_levelName, true) == false) {
       Level *v_level = new Level();
 
       try {
 	v_level->setFileName(LvlFiles[i]);
-	bCached = v_level->loadReducedFromFile(i_loadMainLayerOnly);
+        v_level->loadReducedFromFile(i_loadMainLayerOnly);
 	
 	v_levelName = v_level->Name();
 
@@ -702,10 +700,8 @@
 void LevelsManager::addExternalLevel(std::string i_levelFile, xmDatabase *i_db, bool i_loadMainLayerOnly) {
   Level *v_level = new Level();
   try {
-    bool bCached = false;
-
     v_level->setFileName(i_levelFile);
-    bCached = v_level->loadReducedFromFile(i_loadMainLayerOnly);
+    v_level->loadReducedFromFile(i_loadMainLayerOnly);
       
     // Check for ID conflict
     if(doesLevelExist(v_level->Id(), i_db)) {
@@ -741,7 +737,6 @@
   i_db->levels_add_begin(false);
 
   for(unsigned int i=0; i<LvlFiles.size(); i++) {
-    bool bCached = false;
     int v_isExternal;
 
     v_isExternal = LvlFiles[i].find("Levels/MyLevels/") != std::string::npos;
@@ -755,7 +750,7 @@
 
       try {
 	v_level->setFileName(LvlFiles[i]);
-	bCached = v_level->loadReducedFromFile(i_loadMainLayerOnly);
+	v_level->loadReducedFromFile(i_loadMainLayerOnly);
 	
 	// Check for ID conflict
 	if(doesLevelExist(v_level->Id(), i_db)) {
@@ -873,7 +868,6 @@
 
     /* new */
     for(unsigned int i=0; i<NewLvl.size(); i++) {
-      bool bCached = false;
       v_level = new Level();
       
       try {
@@ -881,7 +875,7 @@
 	current++;
 	
 	v_level->setFileName(NewLvl[i]);
-	bCached = v_level->loadReducedFromFile(i_loadMainLayerOnly);
+	v_level->loadReducedFromFile(i_loadMainLayerOnly);
 	
 	// Check for ID conflict
 	if(doesLevelExist(v_level->Id(), i_db)) {
@@ -907,12 +901,11 @@
     
     /* updated */
     for(unsigned int i=0; i<UpdatedLvl.size(); i++) {
-      bool bCached = false;
       v_level = new Level();
       
       try {
 	v_level->setFileName(UpdatedLvl[i]);
-	bCached = v_level->loadReducedFromFile(i_loadMainLayerOnly);
+	v_level->loadReducedFromFile(i_loadMainLayerOnly);
 	
 	pCaller->setTaskProgress(current * total);
 	pCaller->setBeingDownloadedInformation(v_level->Name());
--- a/src/VTexture.h
+++ b/src/VTexture.h
@@ -135,7 +135,7 @@
 
   void cleanUnregistredTextures();
 
-  HashNamespace::hash_map<const char*, int*, HashNamespace::hash<const char*>, hashcmp_str> m_textureSizeCache;
+  HashNamespace::unordered_map<std::string, int*> m_textureSizeCache;
   std::vector<std::string> m_textureSizeCacheKeys;
   std::vector<int*> m_textureSizeCacheValues;
 
--- a/src/include/xm_hashmap.h
+++ b/src/include/xm_hashmap.h
@@ -1,25 +1,6 @@
 #ifndef __XMHASHMAP_H__
 #define __XMHASHMAP_H__
 
-#ifdef __GNUC__
-#if (__GNUC__ >= 3)
-#include <ext/hash_map>
-  namespace HashNamespace=__gnu_cxx;
-#else
-#include <hash_map>
-#define HashNamespace std
-#endif
-#else // #ifdef __GNUC__
-#include <hash_map>
-namespace HashNamespace=std;
-#endif
-struct hashcmp_str {
-  bool operator()(const char* s1, const char* s2) {
-    if(s1 == NULL || s2 == NULL) {
-      return false;
-    }
-    return strcmp(s1, s2) == 0;
-  }
-};
-
+#include <tr1/unordered_map>
+namespace HashNamespace=std::tr1;
 #endif
--- a/src/gui/basic/GUIButton.cpp
+++ b/src/gui/basic/GUIButton.cpp
@@ -29,8 +29,6 @@
   Painting
   ===========================================================================*/
   void UIButton::paint(void) {
-    int xm=0,ym=0;
-        
     bool bDisabled = isDisabled();
     bool bActive = isActive();
     
@@ -68,7 +66,6 @@
               }
               break;
 	    }
-	    xm=2; ym=2;
 	  } else {
 	    switch(m_Type) {
 	    case UI_BUTTON_TYPE_LARGE:
--- a/src/xmscene/Level.cpp
+++ b/src/xmscene/Level.cpp
@@ -1221,8 +1221,6 @@
   /* Spawn initial entities */
   for(unsigned int i=0; i<m_entities.size(); i++) {
     m_entities[i]->loadToPlay(m_scriptSource);
-    Vector2f v = m_entities[i]->DynamicPosition();
-
     m_pCollisionSystem->addEntity(m_entities[i]);
 
     if(m_entities[i]->IsToTake()){
--- a/src/xmscene/GhostTrail.cpp
+++ b/src/xmscene/GhostTrail.cpp
@@ -65,7 +65,6 @@
     // now lets try real linear interpolation   
     Vector2f v_P_old = m_trailData[0], 
       v_P_new, 
-      v_vecCum = Vector2f(0,0),
       v_vecTmp;
     float v_time = TRAIL_INTERPOLATION_STEP;
     
--- a/src/xmscene/BikePlayer.cpp
+++ b/src/xmscene/BikePlayer.cpp
@@ -120,11 +120,8 @@
   }
 
   /* controler */
-  bool bChangeDir = false;
   if(m_BikeC->ChangeDir()) {
     m_BikeC->setChangeDir(false);
-    bChangeDir = true;
-
     m_bikeState->Dir = m_bikeState->Dir==DD_LEFT?DD_RIGHT:DD_LEFT; /* switch */
     m_changeDirPer = 0.0;
   }
--- a/src/VTexture.cpp
+++ b/src/VTexture.cpp
@@ -307,7 +307,7 @@
     int* v_val;
 
     // cache
-    v_val = m_textureSizeCache[p_fileName.c_str()];
+    v_val = m_textureSizeCache[p_fileName];
     if(v_val != NULL) {
       return *v_val;
     }
@@ -331,7 +331,7 @@
 #endif
 	m_textureSizeCacheKeys.push_back(p_fileName);
 	m_textureSizeCacheValues.push_back(v_val);
-	m_textureSizeCache[m_textureSizeCacheKeys[m_textureSizeCacheKeys.size()-1].c_str()] = v_val;
+	m_textureSizeCache[m_textureSizeCacheKeys[m_textureSizeCacheKeys.size()-1]] = v_val;
 
       }