From 8d6bc60f0be1f592020dbbaff11b63abadb9cced Mon Sep 17 00:00:00 2001
From: DarkGod <darkgod@net-core.org>
Date: Sun, 22 Dec 2013 21:28:37 +0100
Subject: [PATCH] New Game option will show the module list if there are
 incompatible modules found

---
 game/engines/default/modules/boot/dialogs/NewGame.lua | 10 +++++++---
 game/modules/example/init.lua                         |  4 ++--
 game/modules/example_realtime/init.lua                |  4 ++--
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/game/engines/default/modules/boot/dialogs/NewGame.lua b/game/engines/default/modules/boot/dialogs/NewGame.lua
index 0a039d9b54..4ca8d03707 100644
--- a/game/engines/default/modules/boot/dialogs/NewGame.lua
+++ b/game/engines/default/modules/boot/dialogs/NewGame.lua
@@ -62,7 +62,7 @@ function _M:init()
 end
 
 function _M:on_register()
-	if #self.list == 1 then
+	if #self.list == 1 and not self.has_incompatible then
 		game:unregisterDialog(self)
 		self.list[1]:fct()
 	end
@@ -75,8 +75,9 @@ function _M:select(item)
 end
 
 function _M:generateList()
-	local list = Module:listModules(self.c_compat.checked)
+	local list = Module:listModules(true)
 	self.list = {}
+	self.has_incompatible = false
 	for i = 1, #list do
 		for j, mod in ipairs(list[i].versions) do
 			if not self.c_switch.checked and j > 1 then break end
@@ -105,7 +106,10 @@ function _M:generateList()
 				tstr:merge(mod.description:toTString())
 				mod.zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=tstr}
 
-				table.insert(self.list, mod)
+				if self.c_compat.checked or not mod.incompatible then
+					table.insert(self.list, mod)
+				end
+				if mod.incompatible then self.has_incompatible = true end
 			end
 		end
 	end
diff --git a/game/modules/example/init.lua b/game/modules/example/init.lua
index efa3c5d262..428228cfd8 100644
--- a/game/modules/example/init.lua
+++ b/game/modules/example/init.lua
@@ -22,8 +22,8 @@ long_name = "Example Module for T-Engine4"
 short_name = "example"
 author = { "DarkGod", "darkgod@te4.org" }
 homepage = "http://te4.org/modules:example"
-version = {1,1,0}
-engine = {1,1,0,"te4"}
+version = {1,1,2}
+engine = {1,1,2,"te4"}
 description = [[
 This is *NOT* a game, just an example/template to make your own using the T-Engine4.
 ]]
diff --git a/game/modules/example_realtime/init.lua b/game/modules/example_realtime/init.lua
index d9b3ab04b7..7948105fdc 100644
--- a/game/modules/example_realtime/init.lua
+++ b/game/modules/example_realtime/init.lua
@@ -22,8 +22,8 @@ long_name = "Realtime Example Module for T-Engine4"
 short_name = "example_realtime"
 author = { "DarkGod", "darkgod@te4.org" }
 homepage = "http://te4.org/modules:example"
-version = {1,0,6}
-engine = {1,0,6,"te4"}
+version = {1,1,2}
+engine = {1,1,2,"te4"}
 description = [[
 This is *NOT* a game, just an example/template to make your own using the T-Engine4.
 ]]
-- 
GitLab