summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2013-12-11 23:07:38 +0100
committersapier <Sapier at GMX dot net>2013-12-11 23:07:38 +0100
commit4ccaa6d0af852d0aada01f341a61290a3760cffa (patch)
tree2fe3ee091345d154eb173223fc332754734e7a0c /src
parentdfd1f87762ca17b4839f87ab62a53fa2f64cf2c8 (diff)
downloadminetest-4ccaa6d0af852d0aada01f341a61290a3760cffa.tar.gz
minetest-4ccaa6d0af852d0aada01f341a61290a3760cffa.tar.bz2
minetest-4ccaa6d0af852d0aada01f341a61290a3760cffa.zip
Implement search tab and version picker
Diffstat (limited to 'src')
-rw-r--r--src/convert_json.cpp2
-rw-r--r--src/guiEngine.cpp2
-rw-r--r--src/guiFormSpecMenu.cpp17
-rw-r--r--src/script/lua_api/l_mainmenu.cpp25
4 files changed, 36 insertions, 10 deletions
diff --git a/src/convert_json.cpp b/src/convert_json.cpp
index e8eede0b1..0b69f43a3 100644
--- a/src/convert_json.cpp
+++ b/src/convert_json.cpp
@@ -210,7 +210,7 @@ ModStoreModDetails readModStoreModDetails(Json::Value& details) {
}
if (retval.versions.size() < 1) {
- errorstream << "readModStoreModDetails: not a single version specified!" << std::endl;
+ infostream << "readModStoreModDetails: not a single version specified!" << std::endl;
retval.valid = false;
}
diff --git a/src/guiEngine.cpp b/src/guiEngine.cpp
index 7acc00ef1..d008b2568 100644
--- a/src/guiEngine.cpp
+++ b/src/guiEngine.cpp
@@ -156,7 +156,7 @@ GUIEngine::GUIEngine( irr::IrrlichtDevice* dev,
m_sound_manager = &dummySoundManager;
//create topleft header
- core::rect<s32> rect(0, 0, 500, 40);
+ core::rect<s32> rect(0, 0, 500, 20);
rect += v2s32(4, 0);
std::string t = std::string("Minetest ") + minetest_version_hash;
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp
index 82def7411..87a46d9c9 100644
--- a/src/guiFormSpecMenu.cpp
+++ b/src/guiFormSpecMenu.cpp
@@ -1856,7 +1856,7 @@ void GUIFormSpecMenu::drawMenu()
v2u32 screenSize = driver->getScreenSize();
core::rect<s32> allbg(0, 0, screenSize.X , screenSize.Y);
- if (m_bgfullscreen)
+ if (m_bgfullscreen)
driver->draw2DRectangle(m_bgcolor, allbg, &allbg);
else
driver->draw2DRectangle(m_bgcolor, AbsoluteRect, &AbsoluteClippingRect);
@@ -1959,7 +1959,7 @@ void GUIFormSpecMenu::drawMenu()
IItemDefManager *idef = m_gamedef->idef();
ItemStack item;
item.deSerialize(spec.name, idef);
- video::ITexture *texture = idef->getInventoryTexture(item.getDefinition(idef).name, m_gamedef);
+ video::ITexture *texture = idef->getInventoryTexture(item.getDefinition(idef).name, m_gamedef);
// Image size on screen
core::rect<s32> imgrect(0, 0, spec.geom.X, spec.geom.Y);
// Image rectangle on screen
@@ -1998,7 +1998,7 @@ void GUIFormSpecMenu::drawMenu()
if (spec.tooltip != "")
{
core::rect<s32> rect = spec.rect;
- if (rect.isPointInside(m_pointer))
+ if (rect.isPointInside(m_pointer))
{
m_tooltip_element->setVisible(true);
this->bringToFront(m_tooltip_element);
@@ -2168,7 +2168,7 @@ void GUIFormSpecMenu::acceptInput(bool quit=false)
for(u32 i=0; i<m_fields.size(); i++)
{
const FieldSpec &s = m_fields[i];
- if(s.send)
+ if(s.send)
{
if(s.ftype == f_Button)
{
@@ -2194,8 +2194,11 @@ void GUIFormSpecMenu::acceptInput(bool quit=false)
if ((element) && (element->getType() == gui::EGUIET_COMBO_BOX)) {
e = static_cast<gui::IGUIComboBox*>(element);
}
- fields[wide_to_narrow(s.fname.c_str())] =
- wide_to_narrow(e->getItem(e->getSelected()));
+ s32 selected = e->getSelected();
+ if (selected >= 0) {
+ fields[wide_to_narrow(s.fname.c_str())] =
+ wide_to_narrow(e->getItem(selected));
+ }
}
else if (s.ftype == f_TabHeader) {
// no dynamic cast possible due to some distributions shipped
@@ -2662,7 +2665,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
for(u32 i=0; i<m_fields.size(); i++)
{
FieldSpec &s = m_fields[i];
- // if its a button, set the send field so
+ // if its a button, set the send field so
// lua knows which button was pressed
if (((s.ftype == f_Button) || (s.ftype == f_CheckBox)) &&
(s.fid == event.GUIEvent.Caller->getID()))
diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp
index 42ddd0b14..ba8a09747 100644
--- a/src/script/lua_api/l_mainmenu.cpp
+++ b/src/script/lua_api/l_mainmenu.cpp
@@ -336,6 +336,26 @@ int ModApiMainMenu::l_get_modstore_details(lua_State *L)
lua_pushstring(L,current_mod.versions[0].file.c_str());
lua_settable(L, top);
+ lua_pushstring(L,"versions");
+ lua_newtable(L);
+ int versionstop = lua_gettop(L);
+ for (unsigned int i=0;i < current_mod.versions.size(); i++) {
+ lua_pushnumber(L,i+1);
+ lua_newtable(L);
+ int current_element = lua_gettop(L);
+
+ lua_pushstring(L,"date");
+ lua_pushstring(L,current_mod.versions[i].date.c_str());
+ lua_settable(L,current_element);
+
+ lua_pushstring(L,"download_url");
+ lua_pushstring(L,current_mod.versions[i].file.c_str());
+ lua_settable(L,current_element);
+
+ lua_settable(L,versionstop);
+ }
+ lua_settable(L, top);
+
lua_pushstring(L,"screenshot_url");
lua_pushstring(L,current_mod.titlepic.file.c_str());
lua_settable(L, top);
@@ -782,7 +802,10 @@ int ModApiMainMenu::l_extract_zip(lua_State *L)
io::IFileSystem* fs = engine->m_device->getFileSystem();
- fs->addFileArchive(zipfile,true,false,io::EFAT_ZIP);
+ if (!fs->addFileArchive(zipfile,true,false,io::EFAT_ZIP)) {
+ lua_pushboolean(L,false);
+ return 1;
+ }
assert(fs->getFileArchiveCount() > 0);