From d6c052038fc28db92668821cad5a94683d13d526 Mon Sep 17 00:00:00 2001
From: sapier <Sapier at GMX dot net>
Date: Mon, 15 Jul 2013 23:28:55 +0200
Subject: [PATCH] Add playernumber to favorites list

---
 builtin/mainmenu.lua | 15 +++++++++++++--
 src/guiLuaApi.cpp    |  2 +-
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/builtin/mainmenu.lua b/builtin/mainmenu.lua
index be0654584..90e10abca 100644
--- a/builtin/mainmenu.lua
+++ b/builtin/mainmenu.lua
@@ -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
 
 --------------------------------------------------------------------------------
diff --git a/src/guiLuaApi.cpp b/src/guiLuaApi.cpp
index 6bf8df607..211a6e1aa 100644
--- a/src/guiLuaApi.cpp
+++ b/src/guiLuaApi.cpp
@@ -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);
 
-- 
GitLab