hopefully a fix for the majority of the windows 7 problems - thanks to zerochen
authorPerttu Ahola <celeron55@gmail.com>
Sat, 12 Feb 2011 18:15:57 +0000 (20:15 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Sat, 12 Feb 2011 18:15:57 +0000 (20:15 +0200)
src/guiPauseMenu.cpp
src/main.cpp
src/utility.h

index 5e2cd8c8e2b2bcb340fc37f56eaa9bfe16bb6fed..99347b052197c8282460f3875b0556ba0bf5657e 100644 (file)
@@ -132,7 +132,7 @@ void GUIPauseMenu::regenerateGui(v2u32 screensize)
                        max_texture_size = driver->getMaxTextureSize();\r
                }\r
 \r
-               wchar_t text[200];\r
+               /*wchar_t text[200];\r
                swprintf(text, 200,\r
                                L"Minetest-c55\n"\r
                                L"by Perttu Ahola\n"\r
@@ -143,9 +143,16 @@ void GUIPauseMenu::regenerateGui(v2u32 screensize)
                                ,\r
                                BUILD_INFO,\r
                                porting::path_userdata.c_str()\r
-               );\r
+               );*/\r
+\r
+               std::ostringstream os;\r
+               os<<"Minetest-c55\n";\r
+               os<<"by Perttu Ahola\n";\r
+               os<<"celeron55@gmail.com\n";\r
+               os<<BUILD_INFO<<"\n";\r
+               os<<"ud_path = "<<wrap_rows(porting::path_userdata, 20)<<"\n";\r
        \r
-               Environment->addStaticText(text, rect, false, true, this, 259);\r
+               Environment->addStaticText(narrow_to_wide(os.str()).c_str(), rect, false, true, this, 259);\r
        }\r
 }\r
 \r
index 24310b53eb8fd3cca7a543b8468ca358f2364738..31a39ecd76a0151bb6a21b6d28b2ff829d90e105 100644 (file)
@@ -81,7 +81,8 @@ SUGG: MovingObject::move and Player::move are basically the same.
 \r
 SUGG: Precalculate lighting translation table at runtime (at startup)\r
       - This is not doable because it is currently hand-made and not\r
-           based on some mathematical function. Now it is not.\r
+           based on some mathematical function.\r
+               - Note: This has been changing lately\r
 \r
 SUGG: A version number to blocks, which increments when the block is\r
       modified (node add/remove, water update, lighting update)\r
@@ -95,7 +96,6 @@ SUGG: Make the amount of blocks sending to client and the total
 \r
 SUGG: Meshes of blocks could be split into 6 meshes facing into\r
       different directions and then only those drawn that need to be\r
-         - Also an 1-dimensional tile map would be nice probably\r
 \r
 SUGG: Calculate lighting per vertex to get a lighting effect like in\r
       bartwe's game\r
@@ -268,11 +268,6 @@ Doing now (most important at the top):
 * not done\r
 \r
 === Stuff to do before release\r
-* Save the new mapgen stuff\r
-  - map/meta.txt, which should contain only plain text, something like this:\r
-      seed = 7ff1bafcd7118800\r
-      chunksize = 8\r
-  - map/chunks.dat: chunk positions and flags in binary format\r
 * Make server find the spawning place from the real map data, not from\r
   the heightmap\r
   - But the changing borders of chunk have to be avoided, because\r
@@ -283,10 +278,10 @@ Doing now (most important at the top):
 * Check the fixmes in the list above\r
 \r
 === Making it more portable\r
-* MinGW: Switch away from swprintf; mingw has a bad version of it.\r
-  Use snprintf + narrow_to_wide or (w)ostringstream\r
 * Some MSVC: std::sto* are defined without a namespace and collide\r
   with the ones in utility.h\r
+* On Kray's machine, the new find_library(XXF86VM_LIBRARY, Xxf86vm)\r
+  line doesn't find the library.\r
 \r
 === Stuff to do after release\r
 * Make an "environment metafile" to store at least time of day\r
@@ -1255,12 +1250,10 @@ public:
                        {\r
                                m_images[i]->setImage(NULL);\r
 \r
-                               wchar_t t[10];\r
                                if(m_selection == j)\r
-                                       swprintf(t, 10, L"<-");\r
+                                       m_texts[i]->setText(L"<-");\r
                                else\r
-                                       swprintf(t, 10, L"");\r
-                               m_texts[i]->setText(t);\r
+                                       m_texts[i]->setText(L"");\r
 \r
                                // The next ifs will segfault with a NULL pointer\r
                                continue;\r
@@ -1269,12 +1262,18 @@ public:
                        \r
                        m_images[i]->setImage(item->getImage());\r
                        \r
-                       wchar_t t[10];\r
+                       std::ostringstream os;\r
+                       os<<item->getText();\r
+                       if(m_selection == j)\r
+                               os<<" <-";\r
+                       m_texts[i]->setText(narrow_to_wide(os.str()).c_str());\r
+\r
+                       /*wchar_t t[10];\r
                        if(m_selection == j)\r
                                swprintf(t, 10, SWPRINTF_CHARSTRING L" <-", item->getText().c_str());\r
                        else\r
                                swprintf(t, 10, SWPRINTF_CHARSTRING, item->getText().c_str());\r
-                       m_texts[i]->setText(t);\r
+                       m_texts[i]->setText(t);*/\r
                }\r
        }\r
 \r
@@ -2806,8 +2805,6 @@ int main(int argc, char *argv[])
                //TimeTaker guiupdatetimer("Gui updating");\r
                \r
                {\r
-                       wchar_t temptext[150];\r
-\r
                        static float drawtime_avg = 0;\r
                        drawtime_avg = drawtime_avg * 0.95 + (float)drawtime*0.05;\r
                        static float beginscenetime_avg = 0;\r
@@ -2817,11 +2814,13 @@ int main(int argc, char *argv[])
                        static float endscenetime_avg = 0;\r
                        endscenetime_avg = endscenetime_avg * 0.95 + (float)endscenetime*0.05;\r
                        \r
-                       swprintf(temptext, 150, L"Minetest-c55 ("\r
-                                       L"F: item=%i"\r
-                                       L", R: range_all=%i"\r
-                                       L")"\r
-                                       L" drawtime=%.0f, beginscenetime=%.0f, scenetime=%.0f, endscenetime=%.0f",\r
+                       char temptext[300];\r
+                       snprintf(temptext, 300, "Minetest-c55 ("\r
+                                       "F: item=%i"\r
+                                       ", R: range_all=%i"\r
+                                       ")"\r
+                                       " drawtime=%.0f, beginscenetime=%.0f"\r
+                                       ", scenetime=%.0f, endscenetime=%.0f",\r
                                        g_selected_item,\r
                                        draw_control.range_all,\r
                                        drawtime_avg,\r
@@ -2830,16 +2829,16 @@ int main(int argc, char *argv[])
                                        endscenetime_avg\r
                                        );\r
                        \r
-                       guitext->setText(temptext);\r
+                       guitext->setText(narrow_to_wide(temptext).c_str());\r
                }\r
                \r
                {\r
-                       wchar_t temptext[150];\r
-                       swprintf(temptext, 150,\r
-                                       L"(% .1f, % .1f, % .1f)"\r
-                                       L" (% .3f < btime_jitter < % .3f"\r
-                                       L", dtime_jitter = % .1f %%"\r
-                                       L", v_range = %.1f)",\r
+                       char temptext[300];\r
+                       snprintf(temptext, 300,\r
+                                       "(% .1f, % .1f, % .1f)"\r
+                                       " (% .3f < btime_jitter < % .3f"\r
+                                       ", dtime_jitter = % .1f %%"\r
+                                       ", v_range = %.1f)",\r
                                        player_position.X/BS,\r
                                        player_position.Y/BS,\r
                                        player_position.Z/BS,\r
@@ -2849,7 +2848,7 @@ int main(int argc, char *argv[])
                                        draw_control.wanted_range\r
                                        );\r
 \r
-                       guitext2->setText(temptext);\r
+                       guitext2->setText(narrow_to_wide(temptext).c_str());\r
                }\r
                \r
                {\r
index b3816c8a7bd1495dd153018b5a1d8be91fb9eadb..46277cd4240ec2ffcb33c28de40ecd3828cbe69d 100644 (file)
@@ -1686,6 +1686,22 @@ inline bool string_allowed(const std::string &s, const std::string &allowed_char
        return true;
 }
 
+/*
+       Forcefully wraps string into rows using \n
+       (no word wrap, used for showing paths in gui)
+*/
+inline std::string wrap_rows(const std::string &from, u32 rowlen)
+{
+       std::string to;
+       for(u32 i=0; i<from.size(); i++)
+       {
+               if(i != 0 && i%rowlen == 0)
+                       to += '\n';
+               to += from[i];
+       }
+       return to;
+}
+
 /*
        Some helper stuff
 */