Add playernumber to favorites list
authorsapier <Sapier at GMX dot net>
Mon, 15 Jul 2013 21:28:55 +0000 (23:28 +0200)
committerPilzAdam <pilzadam@minetest.net>
Mon, 22 Jul 2013 16:09:59 +0000 (18:09 +0200)
builtin/mainmenu.lua
src/guiLuaApi.cpp

index be065458494b3f49d456ffaabfd6bd824a5bb666..90e10abca94a026c0324636bbd1194c955ad278b 100644 (file)
@@ -44,6 +44,9 @@ function render_favourite(spec,render_details)
                return text
        end
        
+
+
+       
        local details = ""
        if spec.password == true then
                details = details .. "*"
@@ -68,9 +71,17 @@ function render_favourite(spec,render_details)
        else
                details = details .. "_"
        end
-       details = details .. "  "
+       details = details .. " "
+       
+       local playercount = ""
+       
+       if spec.clients ~= nil and
+               spec.clients_max ~= nil then
+               playercount = string.format("%03d",spec.clients) .. "/" ..
+                                               string.format("%03d",spec.clients_max) .. " "
+       end
        
-       return fs_escape_string(details) .. text
+       return playercount .. fs_escape_string(details) ..  text
 end
 
 --------------------------------------------------------------------------------
index 6bf8df607672e230385dc1a54e764ba8cb209472..211a6e1aaf96da8bbd1969526a1a8b5c98d7c9c5 100644 (file)
@@ -556,7 +556,7 @@ int guiLuaApi::l_get_favorites(lua_State *L)
 
                if (servers[i]["clients_max"].asString().size()) {
 
-                       const char* clients_max_raw = servers[i]["clients"].asString().c_str();
+                       const char* clients_max_raw = servers[i]["clients_max"].asString().c_str();
                        char* endptr = 0;
                        int numbervalue = strtol(clients_max_raw,&endptr,10);