From d6a41e652fe8b8dfd270ee12f73dae59d48057e1 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Fri, 3 Jan 2014 18:03:11 +0200 Subject: [PATCH] Merge --- .hgignore | 1 + code/CMakeModules/nel.cmake | 7 +- code/README | 7 +- .../nel/3d/ps_attrib_maker_bin_op_inline.h | 4 +- code/nel/include/nel/misc/debug.h | 2 +- .../src/3d/driver/opengl/driver_opengl.cpp | 3 + code/nel/src/gui/ctrl_button.cpp | 9 +- code/nel/src/gui/interface_parser.cpp | 8 +- code/nel/src/gui/widget_manager.cpp | 2 +- .../gui_editor/widget_properties_parser.cpp | 2 +- .../plugins/landscape_editor/builder_zone.cpp | 14 +- .../landscape_editor/builder_zone_base.cpp | 6 +- .../landscape_editor_window.cpp | 2 +- .../landscape_editor/list_zones_model.cpp | 2 +- .../landscape_editor/list_zones_widget.cpp | 36 +- .../landscape_editor/pixmap_database.cpp | 4 +- .../plugins/world_editor/primitives_view.cpp | 4 +- .../world_editor/property_editor_widget.cpp | 852 +++++++++--------- .../world_editor/world_editor_actions.cpp | 10 +- .../world_editor/world_editor_plugin.cpp | 2 +- .../world_editor/world_editor_window.cpp | 2 +- code/nel/tools/build_gamedata/0_setup.py | 3 +- code/nel/tools/build_gamedata/all.bat | 17 + .../1_export_header.py | 2 +- .../1_export_header.py | 2 +- .../processes/_dummy/1_export.py | 2 +- .../build_gamedata/processes/anim/1_export.py | 2 +- .../processes/clodbank/1_export.py | 2 +- .../build_gamedata/processes/ig/1_export.py | 2 +- .../build_gamedata/processes/ligo/1_export.py | 2 +- .../processes/pacs_prim/1_export.py | 2 +- .../processes/rbank/1_export.py | 2 +- .../processes/shape/1_export.py | 2 +- .../build_gamedata/processes/skel/1_export.py | 2 +- .../build_gamedata/processes/swt/1_export.py | 2 +- .../processes/veget/1_export.py | 2 +- .../build_gamedata/processes/zone/1_export.py | 2 +- code/ryzom/client/client_default.cfg | 6 +- code/ryzom/client/src/client_cfg.cpp | 6 + code/ryzom/client/src/main_loop.cpp | 30 +- code/ryzom/common/src/game_share/pact.cpp | 1 + .../ryzom_ams/ams_lib/translations/en.ini | 2 +- .../server/ryzom_ams/www/config.default.php | 2 +- .../tools/server/ryzom_ams/www/html/index.php | 7 +- .../ryzom_ams/www/html/installer/libsetup.php | 340 ++++++- 45 files changed, 879 insertions(+), 542 deletions(-) create mode 100644 code/nel/tools/build_gamedata/all.bat diff --git a/.hgignore b/.hgignore index a029f4c6e..bd8899404 100644 --- a/.hgignore +++ b/.hgignore @@ -226,6 +226,7 @@ code\ryzom\tools\server\ryzom_ams\old # AMS ignore code/ryzom/tools/server/ryzom_ams/www/config.php +code/ryzom/tools/server/ryzom_ams/www/is_installed #tools and external dir's external diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index f239ec779..c75e2e580 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -595,7 +595,7 @@ MACRO(NL_SETUP_BUILD) SET(NL_DEBUG_CFLAGS "/Zi /MDd /RTC1 /D_DEBUG ${DEBUG_CFLAGS} ${NL_DEBUG_CFLAGS}") SET(NL_RELEASE_CFLAGS "/MD /DNDEBUG ${RELEASE_CFLAGS} ${NL_RELEASE_CFLAGS}") - SET(NL_DEBUG_LINKFLAGS "/DEBUG /OPT:NOREF /OPT:NOICF /NODEFAULTLIB:msvcrt /INCREMENTAL:YES ${NL_DEBUG_LINKFLAGS}") + SET(NL_DEBUG_LINKFLAGS "/DEBUG /OPT:NOREF /OPT:NOICF /NODEFAULTLIB:msvcrt ${MSVC_INCREMENTAL_YES_FLAG} ${NL_DEBUG_LINKFLAGS}") SET(NL_RELEASE_LINKFLAGS "/OPT:REF /OPT:ICF /INCREMENTAL:NO ${NL_RELEASE_LINKFLAGS}") IF(WITH_WARNINGS) @@ -789,12 +789,7 @@ MACRO(NL_SETUP_BUILD) SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}") ENDIF(CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86) ELSE(IOS) - IF(CMAKE_OSX_SYSROOT) - ADD_PLATFORM_FLAGS("-isysroot ${CMAKE_OSX_SYSROOT}") - ENDIF(CMAKE_OSX_SYSROOT) - # Always force -mmacosx-version-min to override environement variable - ADD_PLATFORM_FLAGS("-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}") ENDIF(IOS) diff --git a/code/README b/code/README index 6a5d7ffad..ceb03081e 100644 --- a/code/README +++ b/code/README @@ -12,7 +12,7 @@ each other so you can use only the parts you really need in your project. If you want know more about the library content and functionalities, you should take a look on the documents present in the doc directory. -Ryzom Core is currently developped and tested under GNU/Linux and Windows +Ryzom Core is currently developed and tested under GNU/Linux and Windows environments. @@ -29,4 +29,7 @@ file for for more details on license terms and other legal issues. Installation ------------ -Please visit http://dev.ryzom.com for more information. +Please visit https://ryzomcore.atlassian.net/wiki/display/RC/Ryzom+Core+Home for more information. +In particular the Getting Started section on the right side of the webpage includes build +instructions for Windows, Linux and Mac. + diff --git a/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h b/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h index 421e059cb..2a9cbff45 100644 --- a/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h +++ b/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h @@ -128,7 +128,7 @@ inline uint32 CPSAttribMakerBinOp::getMinValue(void) const { uint32 lhs = _Arg[0]->getMinValue(); uint32 rhs = _Arg[1]->getMaxValue(); - return lhs > rhs ? 0 : lhs - rhs; + return rhs > lhs ? 0 : lhs - rhs; } break; default: @@ -153,7 +153,7 @@ inline uint32 CPSAttribMakerBinOp::getMaxValue(void) const { uint32 lhs = _Arg[0]->getMaxValue(); uint32 rhs = _Arg[1]->getMinValue(); - return lhs > rhs ? 0 : lhs - rhs; + return rhs > lhs ? 0 : lhs - rhs; } break; default: diff --git a/code/nel/include/nel/misc/debug.h b/code/nel/include/nel/misc/debug.h index 8c2efc62e..690d340a3 100644 --- a/code/nel/include/nel/misc/debug.h +++ b/code/nel/include/nel/misc/debug.h @@ -586,7 +586,7 @@ template inline T type_cast(U o) #ifdef NL_ISO_CPP0X_AVAILABLE # define nlctassert(cond) static_assert(cond, "Compile time assert in "#cond) #else -# define nlctassert(cond) sizeof(uint[(cond) ? 1 : 0]) +# define nlctassert(cond) (void)sizeof(uint[(cond) ? 1 : 0]) #endif /** diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.cpp b/code/nel/src/3d/driver/opengl/driver_opengl.cpp index 02617990d..474750d2c 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl.cpp @@ -2191,6 +2191,7 @@ void CDriverGL::setSwapVBLInterval(uint interval) res = nwglSwapIntervalEXT(_Interval) == TRUE; } #elif defined(NL_OS_MAC) + [_ctx setValues:(GLint*)&interval forParameter:NSOpenGLCPSwapInterval]; #elif defined(NL_OS_UNIX) if (_win && _Extensions.GLXEXTSwapControl) { @@ -2251,6 +2252,8 @@ void CDriverGL::enablePolygonSmoothing(bool smooth) { H_AUTO_OGL(CDriverGL_enablePolygonSmoothing); + if (_PolygonSmooth == smooth) return; + #ifndef USE_OPENGLES if(smooth) glEnable(GL_POLYGON_SMOOTH); diff --git a/code/nel/src/gui/ctrl_button.cpp b/code/nel/src/gui/ctrl_button.cpp index 571781e11..3f30105cc 100644 --- a/code/nel/src/gui/ctrl_button.cpp +++ b/code/nel/src/gui/ctrl_button.cpp @@ -202,24 +202,21 @@ namespace NLGUI prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_normal" ); if (prop) { - string TxName = (const char *) prop; - TxName = strlwr(TxName); + string TxName = NLMISC::toLower((const char *) prop); _TextureIdNormal.setTexture(TxName.c_str()); } prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_pushed" ); if (prop) { - string TxName = (const char *) prop; - TxName = strlwr(TxName); + string TxName = NLMISC::toLower((const char *) prop); _TextureIdPushed.setTexture(TxName.c_str()); } prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_over" ); if (prop) { - string TxName = (const char *) prop; - TxName = strlwr(TxName); + string TxName = NLMISC::toLower((const char *) prop); _TextureIdOver.setTexture(TxName.c_str()); } diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp index 01e47bb80..2bc1a70dd 100644 --- a/code/nel/src/gui/interface_parser.cpp +++ b/code/nel/src/gui/interface_parser.cpp @@ -2051,10 +2051,10 @@ namespace NLGUI // Clear all structures used only for init - //NLMISC::contReset (_ParentPositionsMap); - //NLMISC::contReset (_ParentSizesMap); - //NLMISC::contReset (_ParentSizesMaxMap); - //NLMISC::contReset (_LuaClassAssociation); + NLMISC::contReset (_ParentPositionsMap); + NLMISC::contReset (_ParentSizesMap); + NLMISC::contReset (_ParentSizesMaxMap); + NLMISC::contReset (_LuaClassAssociation); return true; } diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index 4d7ada23d..3ec11f215 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -2880,7 +2880,7 @@ namespace NLGUI bool CWidgetManager::serializeTreeData( xmlNodePtr parentNode ) const { if( parentNode == NULL ) - return NULL; + return false; std::vector< SMasterGroup >::size_type i; for( i = 0; i < _MasterGroups.size(); i++ ) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_properties_parser.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_properties_parser.cpp index fe7ee6d54..b1e693751 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_properties_parser.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_properties_parser.cpp @@ -138,7 +138,7 @@ namespace GUIEditor info.description = value.toUtf8().constData(); else if( key == "icon" ) - info.icon == value.toUtf8().constData(); + info.icon = value.toUtf8().constData(); else if( key == "abstract" ) { diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.cpp index a4a42259c..d8e74e564 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.cpp @@ -85,7 +85,7 @@ void ZoneBuilder::actionLigoTile(const LigoData &data, const ZonePosition &zoneP return; checkBeginMacro(); - // nlinfo(QString("%1 %2 %3 (%4 %5)").arg(data.zoneName.c_str()).arg(zonePos.x).arg(zonePos.y).arg(data.posX).arg(data.posY).toStdString().c_str()); + // nlinfo(QString("%1 %2 %3 (%4 %5)").arg(data.zoneName.c_str()).arg(zonePos.x).arg(zonePos.y).arg(data.posX).arg(data.posY).toUtf8().constData()); m_zonePositionList.push_back(zonePos); m_undoStack->push(new LigoTileCommand(data, zonePos, this, m_landscapeScene)); } @@ -105,7 +105,7 @@ void ZoneBuilder::actionLigoResize(uint index, sint32 newMinX, sint32 newMaxX, s return; checkBeginMacro(); - // nlinfo(QString("minX=%1 maxX=%2 minY=%3 maxY=%4").arg(newMinX).arg(newMaxX).arg(newMinY).arg(newMaxY).toStdString().c_str()); + // nlinfo(QString("minX=%1 maxX=%2 minY=%3 maxY=%4").arg(newMinX).arg(newMaxX).arg(newMinY).arg(newMaxY).toUtf8().constData()); m_undoStack->push(new LigoResizeCommand(index, newMinX, newMaxX, newMinY, newMaxY, this)); } @@ -119,7 +119,7 @@ void ZoneBuilder::addZone(sint32 posX, sint32 posY) return; // Check zone name - std::string zoneName = m_listZonesWidget->currentZoneName().toStdString(); + std::string zoneName = m_listZonesWidget->currentZoneName().toUtf8().constData(); if (zoneName.empty()) return; @@ -161,7 +161,7 @@ void ZoneBuilder::addTransition(const sint32 posX, const sint32 posY) m_createdAction = false; m_zonePositionList.clear(); - nlinfo(QString("trans %1,%2").arg(posX).arg(posY).toStdString().c_str()); + nlinfo(QString("trans %1,%2").arg(posX).arg(posY).toUtf8().constData()); sint32 x = (sint32)floor(float(posX) / m_landscapeScene->cellSize()); sint32 y = (sint32)floor(float(posY) / m_landscapeScene->cellSize()); @@ -271,7 +271,7 @@ int ZoneBuilder::createZoneRegion(const QString &fileName) { LandscapeItem landItem; landItem.zoneRegionObject = new ZoneRegionObject(); - landItem.zoneRegionObject->load(fileName.toStdString()); + landItem.zoneRegionObject->load(fileName.toUtf8().constData()); if (checkOverlaps(landItem.zoneRegionObject->ligoZoneRegion())) { @@ -382,8 +382,8 @@ bool ZoneBuilder::initZoneBank (const QString &pathName) std::string error; Q_FOREACH(QString file, listFiles) { - //nlinfo(file.toStdString().c_str()); - if (!m_zoneBank.addElement((pathName + file).toStdString(), error)) + //nlinfo(file.toUtf8().constData()); + if (!m_zoneBank.addElement((pathName + file).toUtf8().constData(), error)) QMessageBox::critical(0, QObject::tr("Landscape editor"), QString(error.c_str()), QMessageBox::Ok); } delete dir; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone_base.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone_base.cpp index 63f246df3..580068a56 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone_base.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone_base.cpp @@ -81,7 +81,7 @@ int ZoneBuilderBase::loadZoneRegion(const QString &fileName, int defaultId) { LandscapeItem landItem; landItem.zoneRegionObject = new ZoneRegionObject(); - landItem.zoneRegionObject->load(fileName.toStdString()); + landItem.zoneRegionObject->load(fileName.toUtf8().constData()); if (!checkOverlaps(landItem.zoneRegionObject->ligoZoneRegion())) { @@ -138,8 +138,8 @@ bool ZoneBuilderBase::initZoneBank (const QString &pathName) std::string error; Q_FOREACH(QString file, listFiles) { - //nlinfo(file.toStdString().c_str()); - if (!m_zoneBank.addElement((pathName + file).toStdString(), error)) + //nlinfo(file.toUtf8().constData()); + if (!m_zoneBank.addElement((pathName + file).toUtf8().constData(), error)) QMessageBox::critical(0, QObject::tr("Landscape editor"), QString(error.c_str()), QMessageBox::Ok); } delete dir; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp index 3f0ae5874..bbc996b94 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp @@ -311,7 +311,7 @@ void LandscapeEditorWindow::saveLandscape(int row, bool force) tr("NeL Ligo land file (*.land)")); if (!fileName.isEmpty()) { - regionObject->setFileName(fileName.toStdString()); + regionObject->setFileName(fileName.toUtf8().constData()); regionObject->save(); regionObject->setModified(false); item->setText(fileName); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_model.cpp index d78c7c577..fabd56a40 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_model.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_model.cpp @@ -128,7 +128,7 @@ QPixmap *ListZonesModel::getPixmap(const QString &zoneName) const { QPixmap *result = 0; if (!m_pixmapMap.contains(zoneName)) - nlwarning("QPixmap %s not found", zoneName.toStdString().c_str()); + nlwarning("QPixmap %s not found", zoneName.toUtf8().constData()); else result = m_pixmapMap.value(zoneName); return result; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.cpp index 9d6ff8eb4..42f472a81 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.cpp @@ -191,7 +191,7 @@ void ListZonesWidget::updateFilters_1(const QString &value) { disableSignals(true); std::vector allCategoryValues; - m_zoneBuilder->getZoneBank().getCategoryValues(value.toStdString(), allCategoryValues); + m_zoneBuilder->getZoneBank().getCategoryValues(value.toUtf8().constData(), allCategoryValues); m_ui.categoryValueComboBox_1->clear(); for(size_t i = 0; i < allCategoryValues.size(); ++i) m_ui.categoryValueComboBox_1->addItem(QString(allCategoryValues[i].c_str())); @@ -204,7 +204,7 @@ void ListZonesWidget::updateFilters_2(const QString &value) { disableSignals(true); std::vector allCategoryValues; - m_zoneBuilder->getZoneBank().getCategoryValues(value.toStdString(), allCategoryValues); + m_zoneBuilder->getZoneBank().getCategoryValues(value.toUtf8().constData(), allCategoryValues); m_ui.categoryValueComboBox_2->clear(); for(size_t i = 0; i < allCategoryValues.size(); ++i) @@ -218,7 +218,7 @@ void ListZonesWidget::updateFilters_3(const QString &value) { disableSignals(true); std::vector allCategoryValues; - m_zoneBuilder->getZoneBank().getCategoryValues(value.toStdString(), allCategoryValues); + m_zoneBuilder->getZoneBank().getCategoryValues(value.toUtf8().constData(), allCategoryValues); m_ui.categoryValueComboBox_3->clear(); for(size_t i = 0; i < allCategoryValues.size(); ++i) @@ -232,7 +232,7 @@ void ListZonesWidget::updateFilters_4(const QString &value) { disableSignals(true); std::vector allCategoryValues; - m_zoneBuilder->getZoneBank().getCategoryValues(value.toStdString(), allCategoryValues); + m_zoneBuilder->getZoneBank().getCategoryValues(value.toUtf8().constData(), allCategoryValues); m_ui.categoryValueComboBox_4->clear(); for(size_t i = 0; i < allCategoryValues.size(); ++i) @@ -249,37 +249,37 @@ void ListZonesWidget::updateListZones() zoneBank.resetSelection (); if(m_ui.categoryTypeComboBox_1->currentIndex() > 0 ) - zoneBank.addOrSwitch (m_ui.categoryTypeComboBox_1->currentText().toStdString() - , m_ui.categoryValueComboBox_1->currentText().toStdString()); + zoneBank.addOrSwitch (m_ui.categoryTypeComboBox_1->currentText().toUtf8().constData() + , m_ui.categoryValueComboBox_1->currentText().toUtf8().constData()); if(m_ui.categoryTypeComboBox_2->currentIndex() > 0 ) { if (m_ui.logicComboBox_2->currentIndex() == 0) // AND switch wanted - zoneBank.addAndSwitch(m_ui.categoryTypeComboBox_2->currentText().toStdString() - ,m_ui.categoryValueComboBox_2->currentText().toStdString()); + zoneBank.addAndSwitch(m_ui.categoryTypeComboBox_2->currentText().toUtf8().constData() + ,m_ui.categoryValueComboBox_2->currentText().toUtf8().constData()); else // OR switch wanted - zoneBank.addOrSwitch(m_ui.categoryTypeComboBox_2->currentText().toStdString() - ,m_ui.categoryValueComboBox_2->currentText().toStdString()); + zoneBank.addOrSwitch(m_ui.categoryTypeComboBox_2->currentText().toUtf8().constData() + ,m_ui.categoryValueComboBox_2->currentText().toUtf8().constData()); } if(m_ui.categoryTypeComboBox_3->currentIndex() > 0 ) { if (m_ui.logicComboBox_3->currentIndex() == 0) // AND switch wanted - zoneBank.addAndSwitch(m_ui.categoryTypeComboBox_3->currentText().toStdString() - ,m_ui.categoryValueComboBox_3->currentText().toStdString()); + zoneBank.addAndSwitch(m_ui.categoryTypeComboBox_3->currentText().toUtf8().constData() + ,m_ui.categoryValueComboBox_3->currentText().toUtf8().constData()); else // OR switch wanted - zoneBank.addOrSwitch(m_ui.categoryTypeComboBox_3->currentText().toStdString() - ,m_ui.categoryValueComboBox_3->currentText().toStdString()); + zoneBank.addOrSwitch(m_ui.categoryTypeComboBox_3->currentText().toUtf8().constData() + ,m_ui.categoryValueComboBox_3->currentText().toUtf8().constData()); } if(m_ui.categoryTypeComboBox_4->currentIndex() > 0 ) { if (m_ui.logicComboBox_4->currentIndex() == 0) // AND switch wanted - zoneBank.addAndSwitch(m_ui.categoryTypeComboBox_4->currentText().toStdString() - ,m_ui.categoryValueComboBox_4->currentText().toStdString()); + zoneBank.addAndSwitch(m_ui.categoryTypeComboBox_4->currentText().toUtf8().constData() + ,m_ui.categoryValueComboBox_4->currentText().toUtf8().constData()); else // OR switch wanted - zoneBank.addOrSwitch(m_ui.categoryTypeComboBox_4->currentText().toStdString() - ,m_ui.categoryValueComboBox_4->currentText().toStdString()); + zoneBank.addOrSwitch(m_ui.categoryTypeComboBox_4->currentText().toUtf8().constData() + ,m_ui.categoryValueComboBox_4->currentText().toUtf8().constData()); } std::vector currentSelection; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/pixmap_database.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/pixmap_database.cpp index 91de95cce..075624333 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/pixmap_database.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/pixmap_database.cpp @@ -96,7 +96,7 @@ bool PixmapDatabase::loadPixmaps(const QString &zonePath, NLLIGO::CZoneBank &zon painter.end(); delete pixmap; m_pixmapMap.insert(zonePixmapName, emptyPixmap); - nlwarning(QString("not found " + zonePath + zonePixmapName + ".png").toStdString().c_str()); + nlwarning(QString("not found " + zonePath + zonePixmapName + ".png").toUtf8().constData()); } // All pixmaps must be have same size else if (pixmap->width() != sizeX * m_textureSize) @@ -140,7 +140,7 @@ QPixmap *PixmapDatabase::pixmap(const QString &zoneName) const { QPixmap *result = m_errorPixmap; if (!m_pixmapMap.contains(zoneName)) - nlwarning("QPixmap %s not found", zoneName.toStdString().c_str()); + nlwarning("QPixmap %s not found", zoneName.toUtf8().constData()); else result = m_pixmapMap.value(zoneName); return result; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitives_view.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitives_view.cpp index 33b98eed6..ffa4ae955 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitives_view.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitives_view.cpp @@ -205,7 +205,7 @@ void PrimitivesView::save() if (node->data(Constants::PRIMITIVE_FILE_IS_CREATED).toBool()) { - if (!NLLIGO::saveXmlPrimitiveFile(*node->primitives(), node->fileName().toStdString())) + if (!NLLIGO::saveXmlPrimitiveFile(*node->primitives(), node->fileName().toUtf8().constData())) QMessageBox::warning(this, "World Editor Qt", tr("Error writing output file: %1").arg(node->fileName())); else node->setData(Constants::PRIMITIVE_IS_MODIFIED, false); @@ -230,7 +230,7 @@ void PrimitivesView::saveAs() RootPrimitiveNode *node = static_cast(index.internalPointer()); - if (!NLLIGO::saveXmlPrimitiveFile(*node->primitives(), fileName.toStdString())) + if (!NLLIGO::saveXmlPrimitiveFile(*node->primitives(), fileName.toUtf8().constData())) QMessageBox::warning(this, "World Editor Qt", tr("Error writing output file: %1").arg(fileName)); else { diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/property_editor_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/property_editor_widget.cpp index d015adaf1..6d3fdaec1 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/property_editor_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/property_editor_widget.cpp @@ -1,434 +1,434 @@ -// Object Viewer Qt - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// Copyright (C) 2011 Dzmitry Kamiahin -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Project includes -#include "property_editor_widget.h" -#include "world_editor_misc.h" - -// NeL includes -#include - -// STL includes -#include -#include - -// Qt includes -#include - -namespace WorldEditor -{ - -PropertyEditorWidget::PropertyEditorWidget(QWidget *parent) - : QWidget(parent) -{ - m_ui.setupUi(this); - - m_stringManager = new QtStringPropertyManager(this); - m_boolManager = new QtBoolPropertyManager(this); - m_enumManager = new QtEnumPropertyManager(this); - m_stringArrayManager = new QtTextPropertyManager(this); - - QtLineEditFactory *lineEditFactory = new QtLineEditFactory(this); - QtCheckBoxFactory *boolFactory = new QtCheckBoxFactory(this); - QtEnumEditorFactory *enumFactory = new QtEnumEditorFactory(this); - QtTextEditorFactory *textFactory = new QtTextEditorFactory(this); - - m_ui.treePropertyBrowser->setFactoryForManager(m_stringManager, lineEditFactory); - m_ui.treePropertyBrowser->setFactoryForManager(m_boolManager, boolFactory); - m_ui.treePropertyBrowser->setFactoryForManager(m_enumManager, enumFactory); - m_ui.treePropertyBrowser->setFactoryForManager(m_stringArrayManager, textFactory); - - m_groupManager = new QtGroupPropertyManager(this); - - connect(m_stringManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); - connect(m_boolManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); - connect(m_enumManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); - connect(m_stringArrayManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); - - connect(m_boolManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *))); - connect(m_stringManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *))); - connect(m_enumManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *))); - connect(m_stringArrayManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *))); -} - -PropertyEditorWidget::~PropertyEditorWidget() -{ -} - -void PropertyEditorWidget::clearProperties() -{ - m_ui.treePropertyBrowser->clear(); -} - -void PropertyEditorWidget::updateSelection(Node *node) -{ - clearProperties(); - - if ((node == 0) || (node->type() != Node::PrimitiveNodeType)) - return; - - blockSignalsOfProperties(true); - - // The parameter list - std::list parameterList; - - PrimitiveNode *primNode = static_cast(node); - const NLLIGO::IPrimitive *primitive = primNode->primitive(); - const NLLIGO::CPrimitiveClass *primClass = primNode->primitiveClass(); - - // Use the class or not ? - if (primClass) - { - // For each properties of the class - for (uint p = 0; p < primClass->Parameters.size(); p++) - { - // Is the parameter visible ? - if (primClass->Parameters[p].Visible) - { - if (primClass->Parameters[p].Name == "name") - parameterList.push_front(primClass->Parameters[p]); - else - parameterList.push_back(primClass->Parameters[p]); - } - } - } - else - { - // For each primitive property - uint numProp = primitive->getNumProperty(); - for (uint p = 0; p < numProp; p++) - { - // Get the property - std::string propertyName; - const NLLIGO::IProperty *prop; - nlverify(primitive->getProperty(p, propertyName, prop)); - - // Add a default property - NLLIGO::CPrimitiveClass::CParameter defProp(*prop, propertyName.c_str()); - - if (defProp.Name == "name") - parameterList.push_front(defProp); - else - parameterList.push_back(defProp); - } - } - - // Remove property class - std::list::iterator ite = parameterList.begin (); - while (ite != parameterList.end ()) - { - std::list::iterator next = ite; - next++; - if (ite->Name == "class") - { - parameterList.erase(ite); - } - ite = next; - } - - QtProperty *groupNode; - groupNode = m_groupManager->addProperty(QString("%1(%2)").arg(node->data(Qt::DisplayRole).toString()).arg(primClass->Name.c_str())); - m_ui.treePropertyBrowser->addProperty(groupNode); - - ite = parameterList.begin(); - while (ite != parameterList.end()) - { - NLLIGO::CPrimitiveClass::CParameter ¶meter = (*ite); - QtProperty *prop; - NLLIGO::IProperty *ligoProperty = 0; - primitive->getPropertyByName(parameter.Name.c_str(), ligoProperty); - - if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::ConstString) - prop = addConstStringProperty(ligoProperty, parameter, primitive); - else if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::String) - prop = addStringProperty(ligoProperty, parameter, primitive); - else if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::StringArray) - prop = addStringArrayProperty(ligoProperty, parameter, primitive); - else if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::ConstStringArray) - prop = addConstStringArrayProperty(ligoProperty, parameter, primitive); - else - prop = addBoolProperty(ligoProperty, parameter, primitive); - - // Default value ? - if ((ligoProperty == NULL) || (ligoProperty->Default)) - prop->setModified(false); - else - prop->setModified(true); - - bool staticChildSelected = Utils::ligoConfig()->isStaticChild(*primitive); - if (parameter.ReadOnly || (staticChildSelected && (parameter.Name == "name"))) - prop->setEnabled(false); - - // File ? - if (parameter.Filename && (parameter.FileExtension.empty() || parameter.Type != NLLIGO::CPrimitiveClass::CParameter::StringArray)) - { - // TODO: Create an edit box - // CHECK: only for ConstString - } - - groupNode->addSubProperty(prop); - - ite++; - } - - blockSignalsOfProperties(false); -} - +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// Copyright (C) 2011 Dzmitry Kamiahin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +// Project includes +#include "property_editor_widget.h" +#include "world_editor_misc.h" + +// NeL includes +#include + +// STL includes +#include +#include + +// Qt includes +#include + +namespace WorldEditor +{ + +PropertyEditorWidget::PropertyEditorWidget(QWidget *parent) + : QWidget(parent) +{ + m_ui.setupUi(this); + + m_stringManager = new QtStringPropertyManager(this); + m_boolManager = new QtBoolPropertyManager(this); + m_enumManager = new QtEnumPropertyManager(this); + m_stringArrayManager = new QtTextPropertyManager(this); + + QtLineEditFactory *lineEditFactory = new QtLineEditFactory(this); + QtCheckBoxFactory *boolFactory = new QtCheckBoxFactory(this); + QtEnumEditorFactory *enumFactory = new QtEnumEditorFactory(this); + QtTextEditorFactory *textFactory = new QtTextEditorFactory(this); + + m_ui.treePropertyBrowser->setFactoryForManager(m_stringManager, lineEditFactory); + m_ui.treePropertyBrowser->setFactoryForManager(m_boolManager, boolFactory); + m_ui.treePropertyBrowser->setFactoryForManager(m_enumManager, enumFactory); + m_ui.treePropertyBrowser->setFactoryForManager(m_stringArrayManager, textFactory); + + m_groupManager = new QtGroupPropertyManager(this); + + connect(m_stringManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); + connect(m_boolManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); + connect(m_enumManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); + connect(m_stringArrayManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); + + connect(m_boolManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *))); + connect(m_stringManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *))); + connect(m_enumManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *))); + connect(m_stringArrayManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *))); +} + +PropertyEditorWidget::~PropertyEditorWidget() +{ +} + +void PropertyEditorWidget::clearProperties() +{ + m_ui.treePropertyBrowser->clear(); +} + +void PropertyEditorWidget::updateSelection(Node *node) +{ + clearProperties(); + + if ((node == 0) || (node->type() != Node::PrimitiveNodeType)) + return; + + blockSignalsOfProperties(true); + + // The parameter list + std::list parameterList; + + PrimitiveNode *primNode = static_cast(node); + const NLLIGO::IPrimitive *primitive = primNode->primitive(); + const NLLIGO::CPrimitiveClass *primClass = primNode->primitiveClass(); + + // Use the class or not ? + if (primClass) + { + // For each properties of the class + for (uint p = 0; p < primClass->Parameters.size(); p++) + { + // Is the parameter visible ? + if (primClass->Parameters[p].Visible) + { + if (primClass->Parameters[p].Name == "name") + parameterList.push_front(primClass->Parameters[p]); + else + parameterList.push_back(primClass->Parameters[p]); + } + } + } + else + { + // For each primitive property + uint numProp = primitive->getNumProperty(); + for (uint p = 0; p < numProp; p++) + { + // Get the property + std::string propertyName; + const NLLIGO::IProperty *prop; + nlverify(primitive->getProperty(p, propertyName, prop)); + + // Add a default property + NLLIGO::CPrimitiveClass::CParameter defProp(*prop, propertyName.c_str()); + + if (defProp.Name == "name") + parameterList.push_front(defProp); + else + parameterList.push_back(defProp); + } + } + + // Remove property class + std::list::iterator ite = parameterList.begin (); + while (ite != parameterList.end ()) + { + std::list::iterator next = ite; + next++; + if (ite->Name == "class") + { + parameterList.erase(ite); + } + ite = next; + } + + QtProperty *groupNode; + groupNode = m_groupManager->addProperty(QString("%1(%2)").arg(node->data(Qt::DisplayRole).toString()).arg(primClass->Name.c_str())); + m_ui.treePropertyBrowser->addProperty(groupNode); + + ite = parameterList.begin(); + while (ite != parameterList.end()) + { + NLLIGO::CPrimitiveClass::CParameter ¶meter = (*ite); + QtProperty *prop; + NLLIGO::IProperty *ligoProperty = 0; + primitive->getPropertyByName(parameter.Name.c_str(), ligoProperty); + + if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::ConstString) + prop = addConstStringProperty(ligoProperty, parameter, primitive); + else if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::String) + prop = addStringProperty(ligoProperty, parameter, primitive); + else if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::StringArray) + prop = addStringArrayProperty(ligoProperty, parameter, primitive); + else if (parameter.Type == NLLIGO::CPrimitiveClass::CParameter::ConstStringArray) + prop = addConstStringArrayProperty(ligoProperty, parameter, primitive); + else + prop = addBoolProperty(ligoProperty, parameter, primitive); + + // Default value ? + if ((ligoProperty == NULL) || (ligoProperty->Default)) + prop->setModified(false); + else + prop->setModified(true); + + bool staticChildSelected = Utils::ligoConfig()->isStaticChild(*primitive); + if (parameter.ReadOnly || (staticChildSelected && (parameter.Name == "name"))) + prop->setEnabled(false); + + // File ? + if (parameter.Filename && (parameter.FileExtension.empty() || parameter.Type != NLLIGO::CPrimitiveClass::CParameter::StringArray)) + { + // TODO: Create an edit box + // CHECK: only for ConstString + } + + groupNode->addSubProperty(prop); + + ite++; + } + + blockSignalsOfProperties(false); +} + void PropertyEditorWidget::propertyChanged(QtProperty *property) { - nlinfo(QString("property %1 changed").arg(property->propertyName()).toStdString().c_str()); + nlinfo(QString("property %1 changed").arg(property->propertyName()).toUtf8().constData()); } void PropertyEditorWidget::resetProperty(QtProperty *property) -{ - nlinfo(QString("property %1 reset").arg(property->propertyName()).toStdString().c_str()); -} - -QtProperty *PropertyEditorWidget::addBoolProperty(const NLLIGO::IProperty *property, - const NLLIGO::CPrimitiveClass::CParameter ¶meter, - const NLLIGO::IPrimitive *primitive) -{ - std::string value; - std::string name = parameter.Name.c_str(); - primitive->getPropertyByName(name.c_str(), value); - QtProperty *prop = m_boolManager->addProperty(name.c_str()); - // if (Default) - { - //DialogProperties->setDefaultValue (this, value); - m_boolManager->setValue(prop, bool((value=="true")?1:0)); - } - return prop; -} - -QtProperty *PropertyEditorWidget::addConstStringProperty(const NLLIGO::IProperty *property, - const NLLIGO::CPrimitiveClass::CParameter ¶meter, - const NLLIGO::IPrimitive *primitive) -{ - std::string value; - std::string name = parameter.Name.c_str(); - - // Get current value - primitive->getPropertyByName(name.c_str(), value); - - // Create qt property - QtProperty *prop = m_enumManager->addProperty(parameter.Name.c_str()); - - QStringList listEnums = getComboValues(parameter); - - if (listEnums.isEmpty()) - { - listEnums << QString(value.c_str()) + tr(" (WRN: Check leveldesign!)"); - m_enumManager->setEnumNames(prop, listEnums); - m_enumManager->setValue(prop, 0); - prop->setEnabled(false); - } - else - { - // TODO: check this logic - if (parameter.DefaultValue.empty() || (parameter.DefaultValue[0].Name.empty())) - listEnums.prepend(""); - - // Fill qt property - m_enumManager->setEnumNames(prop, listEnums); - - // Find index of current value - for (int i = 0; i < listEnums.size(); i++) - { - if (value == listEnums[i].toStdString()) - { - m_enumManager->setValue(prop, i); - break; - } - } - } - - return prop; -} - -QtProperty *PropertyEditorWidget::addStringProperty(const NLLIGO::IProperty *property, - const NLLIGO::CPrimitiveClass::CParameter ¶meter, - const NLLIGO::IPrimitive *primitive) -{ - std::string value; - std::string name = parameter.Name.c_str(); - primitive->getPropertyByName(name.c_str(), value); - QtProperty *prop = m_stringManager->addProperty(parameter.Name.c_str()); - m_stringManager->setValue(prop, QString(value.c_str())); - return prop; -} - -QtProperty *PropertyEditorWidget::addStringArrayProperty(const NLLIGO::IProperty *property, - const NLLIGO::CPrimitiveClass::CParameter ¶meter, - const NLLIGO::IPrimitive *primitive) -{ - std::string name = parameter.Name.c_str(); - QtProperty *prop = m_stringArrayManager->addProperty(parameter.Name.c_str()); - - const NLLIGO::IProperty *ligoProperty; - std::vector vectString; - - if (primitive->getPropertyByName(parameter.Name.c_str (), ligoProperty)) - { - const NLLIGO::CPropertyStringArray *const propStringArray = dynamic_cast (ligoProperty); - if (propStringArray) - { - const std::vector &vectString = propStringArray->StringArray; - if (!vectString.empty()) - { - std::string temp; - for (size_t i = 0; i < vectString.size(); i++) - { - temp += vectString[i]; - if (i != (vectString.size() - 1)) - temp += '\n'; - } - m_stringArrayManager->setValue(prop, temp.c_str()); - prop->setToolTip(temp.c_str()); - } - } - else - { - m_stringArrayManager->setValue(prop, "StringArray :("); - } - } - - // Create an "EDIT" button if the text is editable (FileExtension != "") - if (parameter.FileExtension != "") - { - // Create an edit box - // TODO: - } - return prop; -} - -QtProperty *PropertyEditorWidget::addConstStringArrayProperty(const NLLIGO::IProperty *property, - const NLLIGO::CPrimitiveClass::CParameter ¶meter, - const NLLIGO::IPrimitive *primitive) -{ - std::string value; - std::string name = parameter.Name.c_str(); - - // Get current value - primitive->getPropertyByName(name.c_str(), value); - - // Create qt property -// QtProperty *prop = m_enumManager->addProperty(parameter.Name.c_str()); - QtProperty *prop = m_stringArrayManager->addProperty(parameter.Name.c_str()); - - QStringList listEnums = getComboValues(parameter); - - if (listEnums.isEmpty()) - { -// listEnums << QString(value.c_str()) + tr(" (WRN: Check leveldesign!)"); -// m_enumManager->setEnumNames(prop, listEnums); -// m_enumManager->setValue(prop, 0); - prop->setEnabled(false); - } - else - { - // Fill qt property - m_enumManager->setEnumNames(prop, listEnums); - - // Find index of current value - //for (int i = 0; i < listEnums.size(); i++) - //{ - // if (value == listEnums[i].toStdString()) - // { - // m_enumManager->setValue(prop, i); - // break; - // } - //} - - const NLLIGO::IProperty *ligoProperty; - std::vector vectString; - - if (primitive->getPropertyByName (parameter.Name.c_str(), ligoProperty)) - { - const NLLIGO::CPropertyStringArray *const propStringArray = dynamic_cast (ligoProperty); - if (propStringArray) - { - const std::vector &vectString = propStringArray->StringArray; - if (!vectString.empty()) - { - std::string temp; - for (size_t i = 0; i < vectString.size(); i++) - { - temp += vectString[i]; - if (i != (vectString.size() - 1)) - temp += '\n'; - } - m_stringArrayManager->setValue(prop, temp.c_str()); - prop->setToolTip(temp.c_str()); - } - } - else - { - m_stringArrayManager->setValue(prop, "StringArray :("); - } - } - - m_enumManager->setValue(prop, 0); - } - - return prop; -} - -QStringList PropertyEditorWidget::getComboValues(const NLLIGO::CPrimitiveClass::CParameter ¶meter) -{ - // TODO: get context value from dialog - std::string context("jungle"); - std::string defaultContext("default"); - - std::vector listContext; - - if (context != defaultContext) - listContext.push_back(context); - listContext.push_back(defaultContext); - - QStringList listEnums; - - // Correct fill properties with *both* contexts if the current context is not default and is valid. - for (size_t j = 0; j < listContext.size(); j++) - { - std::map::const_iterator ite = parameter.ComboValues.find(listContext[j].c_str()); - - if (ite != parameter.ComboValues.end()) - { - std::vector pathList; - - // Fill pathList - ite->second.appendFilePath(pathList); - - if (parameter.SortEntries) - std::sort(pathList.begin(), pathList.end()); - - for (size_t i = 0; i < pathList.size(); ++i) - listEnums.append(pathList[i].c_str()); - } - } - - return listEnums; -} - +{ + nlinfo(QString("property %1 reset").arg(property->propertyName()).toUtf8().constData()); +} + +QtProperty *PropertyEditorWidget::addBoolProperty(const NLLIGO::IProperty *property, + const NLLIGO::CPrimitiveClass::CParameter ¶meter, + const NLLIGO::IPrimitive *primitive) +{ + std::string value; + std::string name = parameter.Name.c_str(); + primitive->getPropertyByName(name.c_str(), value); + QtProperty *prop = m_boolManager->addProperty(name.c_str()); + // if (Default) + { + //DialogProperties->setDefaultValue (this, value); + m_boolManager->setValue(prop, bool((value=="true")?1:0)); + } + return prop; +} + +QtProperty *PropertyEditorWidget::addConstStringProperty(const NLLIGO::IProperty *property, + const NLLIGO::CPrimitiveClass::CParameter ¶meter, + const NLLIGO::IPrimitive *primitive) +{ + std::string value; + std::string name = parameter.Name.c_str(); + + // Get current value + primitive->getPropertyByName(name.c_str(), value); + + // Create qt property + QtProperty *prop = m_enumManager->addProperty(parameter.Name.c_str()); + + QStringList listEnums = getComboValues(parameter); + + if (listEnums.isEmpty()) + { + listEnums << QString(value.c_str()) + tr(" (WRN: Check leveldesign!)"); + m_enumManager->setEnumNames(prop, listEnums); + m_enumManager->setValue(prop, 0); + prop->setEnabled(false); + } + else + { + // TODO: check this logic + if (parameter.DefaultValue.empty() || (parameter.DefaultValue[0].Name.empty())) + listEnums.prepend(""); + + // Fill qt property + m_enumManager->setEnumNames(prop, listEnums); + + // Find index of current value + for (int i = 0; i < listEnums.size(); i++) + { + if (value == std::string(listEnums[i].toUtf8().constData())) + { + m_enumManager->setValue(prop, i); + break; + } + } + } + + return prop; +} + +QtProperty *PropertyEditorWidget::addStringProperty(const NLLIGO::IProperty *property, + const NLLIGO::CPrimitiveClass::CParameter ¶meter, + const NLLIGO::IPrimitive *primitive) +{ + std::string value; + std::string name = parameter.Name.c_str(); + primitive->getPropertyByName(name.c_str(), value); + QtProperty *prop = m_stringManager->addProperty(parameter.Name.c_str()); + m_stringManager->setValue(prop, QString(value.c_str())); + return prop; +} + +QtProperty *PropertyEditorWidget::addStringArrayProperty(const NLLIGO::IProperty *property, + const NLLIGO::CPrimitiveClass::CParameter ¶meter, + const NLLIGO::IPrimitive *primitive) +{ + std::string name = parameter.Name.c_str(); + QtProperty *prop = m_stringArrayManager->addProperty(parameter.Name.c_str()); + + const NLLIGO::IProperty *ligoProperty; + std::vector vectString; + + if (primitive->getPropertyByName(parameter.Name.c_str (), ligoProperty)) + { + const NLLIGO::CPropertyStringArray *const propStringArray = dynamic_cast (ligoProperty); + if (propStringArray) + { + const std::vector &vectString = propStringArray->StringArray; + if (!vectString.empty()) + { + std::string temp; + for (size_t i = 0; i < vectString.size(); i++) + { + temp += vectString[i]; + if (i != (vectString.size() - 1)) + temp += '\n'; + } + m_stringArrayManager->setValue(prop, temp.c_str()); + prop->setToolTip(temp.c_str()); + } + } + else + { + m_stringArrayManager->setValue(prop, "StringArray :("); + } + } + + // Create an "EDIT" button if the text is editable (FileExtension != "") + if (parameter.FileExtension != "") + { + // Create an edit box + // TODO: + } + return prop; +} + +QtProperty *PropertyEditorWidget::addConstStringArrayProperty(const NLLIGO::IProperty *property, + const NLLIGO::CPrimitiveClass::CParameter ¶meter, + const NLLIGO::IPrimitive *primitive) +{ + std::string value; + std::string name = parameter.Name.c_str(); + + // Get current value + primitive->getPropertyByName(name.c_str(), value); + + // Create qt property +// QtProperty *prop = m_enumManager->addProperty(parameter.Name.c_str()); + QtProperty *prop = m_stringArrayManager->addProperty(parameter.Name.c_str()); + + QStringList listEnums = getComboValues(parameter); + + if (listEnums.isEmpty()) + { +// listEnums << QString(value.c_str()) + tr(" (WRN: Check leveldesign!)"); +// m_enumManager->setEnumNames(prop, listEnums); +// m_enumManager->setValue(prop, 0); + prop->setEnabled(false); + } + else + { + // Fill qt property + m_enumManager->setEnumNames(prop, listEnums); + + // Find index of current value + //for (int i = 0; i < listEnums.size(); i++) + //{ + // if (value == std::string(listEnums[i].toUtf8().constData())) + // { + // m_enumManager->setValue(prop, i); + // break; + // } + //} + + const NLLIGO::IProperty *ligoProperty; + std::vector vectString; + + if (primitive->getPropertyByName (parameter.Name.c_str(), ligoProperty)) + { + const NLLIGO::CPropertyStringArray *const propStringArray = dynamic_cast (ligoProperty); + if (propStringArray) + { + const std::vector &vectString = propStringArray->StringArray; + if (!vectString.empty()) + { + std::string temp; + for (size_t i = 0; i < vectString.size(); i++) + { + temp += vectString[i]; + if (i != (vectString.size() - 1)) + temp += '\n'; + } + m_stringArrayManager->setValue(prop, temp.c_str()); + prop->setToolTip(temp.c_str()); + } + } + else + { + m_stringArrayManager->setValue(prop, "StringArray :("); + } + } + + m_enumManager->setValue(prop, 0); + } + + return prop; +} + +QStringList PropertyEditorWidget::getComboValues(const NLLIGO::CPrimitiveClass::CParameter ¶meter) +{ + // TODO: get context value from dialog + std::string context("jungle"); + std::string defaultContext("default"); + + std::vector listContext; + + if (context != defaultContext) + listContext.push_back(context); + listContext.push_back(defaultContext); + + QStringList listEnums; + + // Correct fill properties with *both* contexts if the current context is not default and is valid. + for (size_t j = 0; j < listContext.size(); j++) + { + std::map::const_iterator ite = parameter.ComboValues.find(listContext[j].c_str()); + + if (ite != parameter.ComboValues.end()) + { + std::vector pathList; + + // Fill pathList + ite->second.appendFilePath(pathList); + + if (parameter.SortEntries) + std::sort(pathList.begin(), pathList.end()); + + for (size_t i = 0; i < pathList.size(); ++i) + listEnums.append(pathList[i].c_str()); + } + } + + return listEnums; +} + void PropertyEditorWidget::blockSignalsOfProperties(bool block) { - m_stringManager->blockSignals(block); - m_boolManager->blockSignals(block); - m_enumManager->blockSignals(block); + m_stringManager->blockSignals(block); + m_boolManager->blockSignals(block); + m_enumManager->blockSignals(block); m_stringArrayManager->blockSignals(block); -} -} /* namespace WorldEditor */ +} +} /* namespace WorldEditor */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp index b8ca7138d..e10e15745 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp @@ -346,7 +346,7 @@ void LoadRootPrimitiveCommand::redo() // set the primitive context NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = primitives; - NLLIGO::loadXmlPrimitiveFile(*primitives, m_fileName.toStdString(), *Utils::ligoConfig()); + NLLIGO::loadXmlPrimitiveFile(*primitives, m_fileName.toUtf8().constData(), *Utils::ligoConfig()); // unset the context NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = NULL; @@ -358,7 +358,7 @@ void LoadRootPrimitiveCommand::redo() // Check property types if (Utils::recursiveUpdateDefaultValues(primitives->RootNode)) { - nlwarning("In file (%s) : Some primitives have been modified to initialise their default values\nor to change their properties type.", m_fileName.toStdString().c_str()); + nlwarning("In file (%s) : Some primitives have been modified to initialise their default values\nor to change their properties type.", m_fileName.toUtf8().constData()); } m_rootPrimIndex = m_model->createRootPrimitiveNode(m_fileName, primitives); @@ -460,15 +460,17 @@ void AddPrimitiveByClassCommand::redo() PrimitiveNode *parentNode = static_cast(parentIndex.internalPointer()); const NLLIGO::CPrimitiveClass *primClass = parentNode->primitiveClass(); + std::string className = m_className.toUtf8().constData(); + int id = 0; - while (primClass->DynamicChildren[id].ClassName != m_className.toStdString()) + while (primClass->DynamicChildren[id].ClassName != className) ++id; // set the primitive context NLLIGO::CPrimitiveContext::instance().CurrentPrimitive = parentNode->rootPrimitiveNode()->primitives(); QString namePrimititve = QString("%1_%2").arg(m_className).arg(parentNode->childCount()); - NLLIGO::IPrimitive *newPrimitive = Utils::createPrimitive(m_className.toStdString().c_str(), namePrimititve.toStdString().c_str(), + NLLIGO::IPrimitive *newPrimitive = Utils::createPrimitive(m_className.toUtf8().constData(), namePrimititve.toUtf8().constData(), NLMISC::CVector(m_initPos.x(), -m_initPos.y(), 0.0), m_delta, primClass->DynamicChildren[id].Parameters, parentNode->primitive()); // unset the context diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_plugin.cpp index fe7dc45c1..301939cb6 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_plugin.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_plugin.cpp @@ -62,7 +62,7 @@ bool WorldEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManage try { // Search path of file world_editor_classes.xml - std::string ligoPath = NLMISC::CPath::lookup(fileName.toStdString()); + std::string ligoPath = NLMISC::CPath::lookup(fileName.toUtf8().constData()); // Init LIGO m_ligoConfig.readPrimitiveClass(ligoPath.c_str(), true); NLLIGO::Register(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.cpp index 7bdff078b..b23e62063 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.cpp @@ -168,7 +168,7 @@ void WorldEditorWindow::loadWorldEditFile(const QString &fileName) return; Utils::WorldEditList worldEditList; - if (!Utils::loadWorldEditFile(fileName.toStdString(), worldEditList)) + if (!Utils::loadWorldEditFile(fileName.toUtf8().constData(), worldEditList)) { // TODO: add the message box return; diff --git a/code/nel/tools/build_gamedata/0_setup.py b/code/nel/tools/build_gamedata/0_setup.py index 4c1289587..61ef06563 100644 --- a/code/nel/tools/build_gamedata/0_setup.py +++ b/code/nel/tools/build_gamedata/0_setup.py @@ -146,7 +146,8 @@ if not args.noconf: try: MaxUserDirectory except NameError: - MaxUserDirectory = "C:/Users/Kaetemi/AppData/Local/Autodesk/3dsMax/2010 - 32bit/enu" + import os + MaxUserDirectory = os.path.normpath(os.environ["LOCALAPPDATA"] + "/Autodesk/3dsMax/2010 - 32bit/enu") try: MaxExecutable except NameError: diff --git a/code/nel/tools/build_gamedata/all.bat b/code/nel/tools/build_gamedata/all.bat new file mode 100644 index 000000000..d41b60052 --- /dev/null +++ b/code/nel/tools/build_gamedata/all.bat @@ -0,0 +1,17 @@ +TITLE 1_export.py +1_export.py +TITLE 2_build.py +2_build.py +TITLE 3_install.py +3_install.py +TITLE 4_data_shard.py +4_data_shard.py +TITLE 5_client_dev.py +5_client_dev.py +TITLE 6_client_patch.py +6_client_patch.py -bo +TITLE 7_client_install.py +7_client_install.py +PAUSE + + diff --git a/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/1_export_header.py b/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/1_export_header.py index 39906238d..1844e0777 100644 --- a/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/1_export_header.py +++ b/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/1_export_header.py @@ -82,7 +82,7 @@ if MaxAvailable: sDst.close() while tagDiff > 0: printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "%PreGenFileExtension%_export.ms", "-q", "-mi", "-vn" ]) + subprocess.call([ Max, "-U", "MAXScript", "%PreGenFileExtension%_export.ms", "-q", "-mi", "-mip" ]) tagList = findFiles(log, outputDirectory, "", ".%PreGenFileExtension%") newTagLen = len(tagList) tagDiff = newTagLen - tagLen diff --git a/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/1_export_header.py b/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/1_export_header.py index a780feecd..d16797a40 100644 --- a/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/1_export_header.py +++ b/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/1_export_header.py @@ -93,7 +93,7 @@ if MaxAvailable: mrt.write("moe-moe-kyun") mrt.close() printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "%PreGenFileExtension%_export.ms", "-q", "-mi", "-vn" ]) + subprocess.call([ Max, "-U", "MAXScript", "%PreGenFileExtension%_export.ms", "-q", "-mi", "-mip" ]) if os.path.exists(outputLogfile): try: lSrc = open(outputLogfile, "r") diff --git a/code/nel/tools/build_gamedata/processes/_dummy/1_export.py b/code/nel/tools/build_gamedata/processes/_dummy/1_export.py index f49c8e687..851dd8077 100644 --- a/code/nel/tools/build_gamedata/processes/_dummy/1_export.py +++ b/code/nel/tools/build_gamedata/processes/_dummy/1_export.py @@ -99,7 +99,7 @@ if MaxAvailable: # sDst.close() # while tagDiff > 0: # printLog(log, "MAXSCRIPT " + scriptDst) - # subprocess.call([ Max, "-U", "MAXScript", "dummy_export.ms", "-q", "-mi", "-vn" ]) + # subprocess.call([ Max, "-U", "MAXScript", "dummy_export.ms", "-q", "-mi", "-mip" ]) # tagList = findFiles(log, outDirTag, "", ".tag") # newTagLen = len(tagList) # tagDiff = newTagLen - tagLen diff --git a/code/nel/tools/build_gamedata/processes/anim/1_export.py b/code/nel/tools/build_gamedata/processes/anim/1_export.py index 1ddd412fd..c59056266 100644 --- a/code/nel/tools/build_gamedata/processes/anim/1_export.py +++ b/code/nel/tools/build_gamedata/processes/anim/1_export.py @@ -93,7 +93,7 @@ if MaxAvailable: mrt.write("moe-moe-kyun") mrt.close() printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "anim_export.ms", "-q", "-mi", "-vn" ]) + subprocess.call([ Max, "-U", "MAXScript", "anim_export.ms", "-q", "-mi", "-mip" ]) if os.path.exists(outputLogfile): try: lSrc = open(outputLogfile, "r") diff --git a/code/nel/tools/build_gamedata/processes/clodbank/1_export.py b/code/nel/tools/build_gamedata/processes/clodbank/1_export.py index 5dfc467ad..0046c2a01 100644 --- a/code/nel/tools/build_gamedata/processes/clodbank/1_export.py +++ b/code/nel/tools/build_gamedata/processes/clodbank/1_export.py @@ -93,7 +93,7 @@ if MaxAvailable: mrt.write("moe-moe-kyun") mrt.close() printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "clod_export.ms", "-q", "-mi", "-vn" ]) + subprocess.call([ Max, "-U", "MAXScript", "clod_export.ms", "-q", "-mi", "-mip" ]) if os.path.exists(outputLogfile): try: lSrc = open(outputLogfile, "r") diff --git a/code/nel/tools/build_gamedata/processes/ig/1_export.py b/code/nel/tools/build_gamedata/processes/ig/1_export.py index 8ec800098..6a2958a12 100644 --- a/code/nel/tools/build_gamedata/processes/ig/1_export.py +++ b/code/nel/tools/build_gamedata/processes/ig/1_export.py @@ -78,7 +78,7 @@ def igExport(sourceDir, targetDir): mrt.write("moe-moe-kyun") mrt.close() printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "ig_export.ms", "-q", "-mi", "-vn" ]) + subprocess.call([ Max, "-U", "MAXScript", "ig_export.ms", "-q", "-mi", "-mip" ]) if os.path.exists(outputLogfile): try: lSrc = open(outputLogfile, "r") diff --git a/code/nel/tools/build_gamedata/processes/ligo/1_export.py b/code/nel/tools/build_gamedata/processes/ligo/1_export.py index c18eceee7..65df263a7 100644 --- a/code/nel/tools/build_gamedata/processes/ligo/1_export.py +++ b/code/nel/tools/build_gamedata/processes/ligo/1_export.py @@ -93,7 +93,7 @@ if LigoExportLand == "" or LigoExportOnePass == 1: sDst.close() printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "nel_ligo_export.ms", "-q", "-mi", "-vn" ]) + subprocess.call([ Max, "-U", "MAXScript", "nel_ligo_export.ms", "-q", "-mi", "-mip" ]) os.remove(scriptDst) printLog(log, "") diff --git a/code/nel/tools/build_gamedata/processes/pacs_prim/1_export.py b/code/nel/tools/build_gamedata/processes/pacs_prim/1_export.py index f551228c0..e88d99b65 100644 --- a/code/nel/tools/build_gamedata/processes/pacs_prim/1_export.py +++ b/code/nel/tools/build_gamedata/processes/pacs_prim/1_export.py @@ -93,7 +93,7 @@ if MaxAvailable: mrt.write("moe-moe-kyun") mrt.close() printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "pacs_prim_export.ms", "-q", "-mi", "-vn" ]) + subprocess.call([ Max, "-U", "MAXScript", "pacs_prim_export.ms", "-q", "-mi", "-mip" ]) if os.path.exists(outputLogfile): try: lSrc = open(outputLogfile, "r") diff --git a/code/nel/tools/build_gamedata/processes/rbank/1_export.py b/code/nel/tools/build_gamedata/processes/rbank/1_export.py index d6b67bb8d..ea078d41d 100644 --- a/code/nel/tools/build_gamedata/processes/rbank/1_export.py +++ b/code/nel/tools/build_gamedata/processes/rbank/1_export.py @@ -93,7 +93,7 @@ if MaxAvailable: mrt.write("moe-moe-kyun") mrt.close() printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "cmb_export.ms", "-q", "-mi", "-vn" ]) + subprocess.call([ Max, "-U", "MAXScript", "cmb_export.ms", "-q", "-mi", "-mip" ]) if os.path.exists(outputLogfile): try: lSrc = open(outputLogfile, "r") diff --git a/code/nel/tools/build_gamedata/processes/shape/1_export.py b/code/nel/tools/build_gamedata/processes/shape/1_export.py index 41fad76d9..92bb9c3e9 100644 --- a/code/nel/tools/build_gamedata/processes/shape/1_export.py +++ b/code/nel/tools/build_gamedata/processes/shape/1_export.py @@ -112,7 +112,7 @@ if MaxAvailable: mrt.write("moe-moe-kyun") mrt.close() printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "shape_export.ms", "-q", "-mi", "-vn" ]) + subprocess.call([ Max, "-U", "MAXScript", "shape_export.ms", "-q", "-mi", "-mip" ]) if os.path.exists(outputLogfile): try: lSrc = open(outputLogfile, "r") diff --git a/code/nel/tools/build_gamedata/processes/skel/1_export.py b/code/nel/tools/build_gamedata/processes/skel/1_export.py index 1beaf482e..b0c54cb23 100644 --- a/code/nel/tools/build_gamedata/processes/skel/1_export.py +++ b/code/nel/tools/build_gamedata/processes/skel/1_export.py @@ -82,7 +82,7 @@ if MaxAvailable: sDst.close() while tagDiff > 0: printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "skel_export.ms", "-q", "-mi", "-vn" ]) + subprocess.call([ Max, "-U", "MAXScript", "skel_export.ms", "-q", "-mi", "-mip" ]) tagList = findFiles(log, outputDirectory, "", ".skel") newTagLen = len(tagList) tagDiff = newTagLen - tagLen diff --git a/code/nel/tools/build_gamedata/processes/swt/1_export.py b/code/nel/tools/build_gamedata/processes/swt/1_export.py index 9cc244599..9b1913f36 100644 --- a/code/nel/tools/build_gamedata/processes/swt/1_export.py +++ b/code/nel/tools/build_gamedata/processes/swt/1_export.py @@ -82,7 +82,7 @@ if MaxAvailable: sDst.close() while tagDiff > 0: printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "swt_export.ms", "-q", "-mi", "-vn" ]) + subprocess.call([ Max, "-U", "MAXScript", "swt_export.ms", "-q", "-mi", "-mip" ]) tagList = findFiles(log, outputDirectory, "", ".swt") newTagLen = len(tagList) tagDiff = newTagLen - tagLen diff --git a/code/nel/tools/build_gamedata/processes/veget/1_export.py b/code/nel/tools/build_gamedata/processes/veget/1_export.py index 5ae02d245..04d3dc06b 100644 --- a/code/nel/tools/build_gamedata/processes/veget/1_export.py +++ b/code/nel/tools/build_gamedata/processes/veget/1_export.py @@ -93,7 +93,7 @@ if MaxAvailable: mrt.write("moe-moe-kyun") mrt.close() printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "veget_export.ms", "-q", "-mi", "-vn" ]) + subprocess.call([ Max, "-U", "MAXScript", "veget_export.ms", "-q", "-mi", "-mip" ]) if os.path.exists(outputLogfile): try: lSrc = open(outputLogfile, "r") diff --git a/code/nel/tools/build_gamedata/processes/zone/1_export.py b/code/nel/tools/build_gamedata/processes/zone/1_export.py index fef927231..2897ccc0e 100644 --- a/code/nel/tools/build_gamedata/processes/zone/1_export.py +++ b/code/nel/tools/build_gamedata/processes/zone/1_export.py @@ -82,7 +82,7 @@ if MaxAvailable: sDst.close() while tagDiff > 0: printLog(log, "MAXSCRIPT " + scriptDst) - subprocess.call([ Max, "-U", "MAXScript", "zone_export.ms", "-q", "-mi", "-vn" ]) + subprocess.call([ Max, "-U", "MAXScript", "zone_export.ms", "-q", "-mi", "-mip" ]) tagList = findFiles(log, outputDirectory, "", ".zone") newTagLen = len(tagList) tagDiff = newTagLen - tagLen diff --git a/code/ryzom/client/client_default.cfg b/code/ryzom/client/client_default.cfg index 1b45f294d..a27e69ee0 100644 --- a/code/ryzom/client/client_default.cfg +++ b/code/ryzom/client/client_default.cfg @@ -47,7 +47,11 @@ SignUpURL = ""; StartupHost = "shard.ryzomcore.org:40916"; StartupPage = "/login/r2_login.php"; InstallStatsUrl = "http://open.ryzom.com:50000/stats/stats.php"; -CreateAccountURL = ""; +CreateAccountURL = "http://shard.ryzomcore.org/ams/?page=register"; +EditAccountURL = "http://shard.ryzomcore.org/ams/?page=settings"; +ConditionsTermsURL = "http://www.gnu.org/licenses/agpl-3.0.html"; +ForgetPwdURL = "http://shard.ryzomcore.org/ams/?page=forgot_password"; +LoginSupportURL = "https://plus.google.com/u/0/communities/103798956862568269036"; InstallWebPage = ""; diff --git a/code/ryzom/client/src/client_cfg.cpp b/code/ryzom/client/src/client_cfg.cpp index 782c6cc0d..b922fedb9 100644 --- a/code/ryzom/client/src/client_cfg.cpp +++ b/code/ryzom/client/src/client_cfg.cpp @@ -888,6 +888,12 @@ void CClientConfig::setValues() READ_STRING_DEV(ForgetPwdURL) READ_STRING_DEV(FreeTrialURL) READ_STRING_DEV(LoginSupportURL) + + READ_STRING_FV(CreateAccountURL) + READ_STRING_FV(EditAccountURL) + READ_STRING_FV(ConditionsTermsURL) + READ_STRING_FV(ForgetPwdURL) + READ_STRING_FV(LoginSupportURL) #ifndef RZ_NO_CLIENT // if cookie is not empty, it means that the client was launch diff --git a/code/ryzom/client/src/main_loop.cpp b/code/ryzom/client/src/main_loop.cpp index 4547ea591..bd5112f99 100644 --- a/code/ryzom/client/src/main_loop.cpp +++ b/code/ryzom/client/src/main_loop.cpp @@ -688,26 +688,22 @@ void updateWeather() } #endif + // FIXME: temporary fix for teleportation crash // Update new sky - if (ContinentMngr.cur() && !ContinentMngr.cur()->Indoor) + if (ContinentMngr.cur() && Driver->getPolygonMode() == UDriver::Filled && Filter3D[FilterSky]) { - if(Driver->getPolygonMode() == UDriver::Filled) + CSky &sky = ContinentMngr.cur()->CurrentSky; + + if (!ContinentMngr.cur()->Indoor && sky.getScene()) { - if (Filter3D[FilterSky]) - { - CSky &sky = ContinentMngr.cur()->CurrentSky; - if (sky.getScene()) - { - s_SkyMode = NewSky; - sky.getScene()->animate(TimeInSec-FirstTimeInSec); - // Setup the sky camera - preRenderNewSky(); - } - else - { - s_SkyMode = OldSky; - } - } + s_SkyMode = NewSky; + sky.getScene()->animate(TimeInSec-FirstTimeInSec); + // Setup the sky camera + preRenderNewSky(); + } + else + { + s_SkyMode = OldSky; } } } diff --git a/code/ryzom/common/src/game_share/pact.cpp b/code/ryzom/common/src/game_share/pact.cpp index 860bbe115..d732c84e2 100644 --- a/code/ryzom/common/src/game_share/pact.cpp +++ b/code/ryzom/common/src/game_share/pact.cpp @@ -41,6 +41,7 @@ static std::string pactTypeStrings[]= "Type3", "Type4", "Type5", + "Type6", "unknown" }; diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini index b7c44044e..586d49241 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini @@ -2,7 +2,7 @@ ; Comments start with ';', as in php.ini [install] -login_info = "Please enter your MySQL Username and Password to install the database.
This is being loaded because config.php is missing.
This process will take about 30 seconds." +login_info = "Please enter your MySQL Username and Password to install the database.
This is being loaded because the is_installed file is missing.
This process will take about 30 seconds." login_here = "here" [dashboard] diff --git a/code/ryzom/tools/server/ryzom_ams/www/config.default.php b/code/ryzom/tools/server/ryzom_ams/www/config.default.php index c20ad4cdc..7ade3efb6 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/config.default.php +++ b/code/ryzom/tools/server/ryzom_ams/www/config.default.php @@ -25,7 +25,7 @@ $cfg['db']['shard']['name'] = 'nel'; $cfg['db']['shard']['user'] = 'shard'; $cfg['db']['shard']['pass'] = ''; -// Variables for database access to the open_ring database +// Variables for database access to the ring_open database $cfg['db']['ring']['host'] = 'localhost'; $cfg['db']['ring']['port'] = '3306'; $cfg['db']['ring']['name'] = 'ring_open'; diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/index.php b/code/ryzom/tools/server/ryzom_ams/www/html/index.php index 65faef428..faf3488c6 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/index.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/index.php @@ -14,9 +14,12 @@ error_reporting(E_ALL); ini_set('display_errors', 'on'); require_once( '../../ams_lib/libinclude.php' ); -if (!@include '../config.php') { - //if config doesnt exist run setup +if (!file_exists('../is_installed')) { + //if is_installed doesnt exist run setup require( 'installer/libsetup.php' ); +} elseif (isset($_POST["function"]) && $_POST["function"] == "do_install") { + echo "Can't run setup while file '../is_installed' exists, please remove that file if you wish to run the install"; + exit; } else { //if config exists then include it require( '../config.php' ); diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/installer/libsetup.php b/code/ryzom/tools/server/ryzom_ams/www/html/installer/libsetup.php index 90df91532..17288784a 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/installer/libsetup.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/installer/libsetup.php @@ -23,7 +23,7 @@ error_reporting( E_ALL ); if (file_exists('../config.php')) { - require( '../config.php' ); + require_once( '../config.php' ); } else { //copy config.default.php to config.php! if (!file_exists('../config.php')) { @@ -31,6 +31,8 @@ echo "failed to copy ../config.php ...\n"; echo '
Reload! '; exit; + } else { + require_once( '../config.php' ); } } } @@ -60,11 +62,8 @@ `ReceiveMail` int(1) NOT NULL DEFAULT 1, `Language` varchar(3) DEFAULT NULL, PRIMARY KEY (`UId`) - ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='contains all users information for ryzom_ams'; - - ); - - GRANT ALL ON `" . $cfg['db']['web']['name'] ."`.* TO `" . $cfg['db']['web']['user'] ."`@".$cfg['db']['web']['host']."; + ) ENGINE = InnoDB; + GRANT ALL ON `" . $cfg['db']['web']['name'] ."`.* TO `" . $cfg['db']['web']['user'] ."`@".$cfg['db']['web']['host']." identified by '".$cfg['db']['web']['pass']."'; "; $dbw->executeWithoutParams($sql); @@ -470,7 +469,7 @@ ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; - GRANT ALL ON `" . $cfg['db']['lib']['name'] ."`.* TO `" . $cfg['db']['lib']['user'] ."`@".$cfg['db']['lib']['host']."; + GRANT ALL ON `" . $cfg['db']['lib']['name'] ."`.* TO `" . $cfg['db']['lib']['user'] ."`@".$cfg['db']['lib']['host']." identified by '".$cfg['db']['lib']['pass']."'; "; $dbl->executeWithoutParams($sql); print "The Lib & Web database were correctly installed!
"; @@ -585,7 +584,7 @@ KEY `GMId` (`GMId`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='contains all users informations for login system' AUTO_INCREMENT=1 ; - GRANT ALL ON `" . $cfg['db']['shard']['name'] ."`.* TO `" . $cfg['db']['shard']['user'] ."`@".$cfg['db']['shard']['host']."; + GRANT ALL ON `" . $cfg['db']['shard']['name'] ."`.* TO `" . $cfg['db']['shard']['user'] ."`@".$cfg['db']['shard']['host']." identified by '".$cfg['db']['shard']['pass']."'; "; $dbs->executeWithoutParams($sql); print "The shard database was correctly installed!
"; @@ -596,8 +595,8 @@ CREATE DATABASE IF NOT EXISTS `" . $cfg['db']['tool']['name'] ."`; USE `". $cfg['db']['tool']['name'] . "`; - CREATE DATABASE IF NOT EXISTS `nel_tool` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; - USE `nel_tool`; + CREATE DATABASE IF NOT EXISTS `" . $cfg['db']['tool']['name'] ."` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; + USE `" . $cfg['db']['tool']['name'] ."`; CREATE TABLE IF NOT EXISTS `neltool_annotations` ( `annotation_id` int(11) NOT NULL AUTO_INCREMENT, @@ -1368,11 +1367,317 @@ (164, 31, 104, 9), (165, 31, 103, 9); - GRANT ALL ON `" . $cfg['db']['tool']['name'] ."`.* TO `" . $cfg['db']['tool']['user'] ."`@".$cfg['db']['tool']['host']."; + GRANT ALL ON `" . $cfg['db']['tool']['name'] ."`.* TO `" . $cfg['db']['tool']['user'] ."`@".$cfg['db']['tool']['host']." identified by '".$cfg['db']['tool']['pass']."'; "; $dbn->executeWithoutParams($sql); print "The nel_tool database was correctly installed!
"; + //SETUP THE OPEN_SHARD DB + $dbw = new DBLayer("install", "ring"); + $sql = " + CREATE DATABASE IF NOT EXISTS `" . $cfg['db']['ring']['name'] ."`; + USE `" . $cfg['db']['ring']['name'] ."`; + + CREATE TABLE IF NOT EXISTS `characters` ( + `char_id` int(10) unsigned NOT NULL DEFAULT '0', + `char_name` varchar(20) NOT NULL DEFAULT '', + `user_id` int(10) unsigned NOT NULL DEFAULT '0', + `guild_id` int(10) unsigned NOT NULL DEFAULT '0', + `best_combat_level` int(10) unsigned NOT NULL DEFAULT '0', + `home_mainland_session_id` int(10) unsigned NOT NULL DEFAULT '0', + `ring_access` varchar(63) NOT NULL DEFAULT '', + `race` enum('r_fyros','r_matis','r_tryker','r_zorai') NOT NULL DEFAULT 'r_fyros', + `civilisation` enum('c_neutral','c_fyros','c_fyros','c_matis','c_tryker','c_zorai') NOT NULL DEFAULT 'c_neutral', + `cult` enum('c_neutral','c_kami','c_karavan') NOT NULL DEFAULT 'c_neutral', + `current_session` int(11) unsigned NOT NULL DEFAULT '0', + `rrp_am` int(11) unsigned NOT NULL DEFAULT '0', + `rrp_masterless` int(11) unsigned NOT NULL DEFAULT '0', + `rrp_author` int(11) unsigned NOT NULL DEFAULT '0', + `newcomer` tinyint(1) NOT NULL DEFAULT '1', + `creation_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `last_played_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`char_id`), + UNIQUE KEY `char_name_idx` (`char_name`,`home_mainland_session_id`), + KEY `user_id_idx` (`user_id`), + KEY `guild_idx` (`guild_id`), + KEY `guild_id_idx` (`guild_id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + + CREATE TABLE IF NOT EXISTS `folder` ( + `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `owner` int(10) unsigned NOT NULL DEFAULT '0', + `title` varchar(40) NOT NULL DEFAULT '', + `comments` text NOT NULL, + PRIMARY KEY (`Id`), + KEY `owner_idx` (`owner`), + KEY `title_idx` (`title`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1 ; + + + CREATE TABLE IF NOT EXISTS `folder_access` ( + `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `folder_id` int(10) unsigned NOT NULL DEFAULT '0', + `user_id` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`Id`), + KEY `folder_id_idx` (`folder_id`), + KEY `user_idx` (`user_id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED AUTO_INCREMENT=1 ; + + + CREATE TABLE IF NOT EXISTS `guild_invites` ( + `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `session_id` int(10) unsigned NOT NULL DEFAULT '0', + `guild_id` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`Id`), + KEY `guild_id_idx` (`guild_id`), + KEY `session_id_idx` (`session_id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED AUTO_INCREMENT=1 ; + + + CREATE TABLE IF NOT EXISTS `guilds` ( + `guild_id` int(10) unsigned NOT NULL DEFAULT '0', + `guild_name` varchar(50) NOT NULL DEFAULT '', + `shard_id` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`guild_id`), + KEY `shard_id_idx` (`shard_id`), + KEY `guild_name_idx` (`guild_name`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; + + + CREATE TABLE IF NOT EXISTS `journal_entry` ( + `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `session_id` int(10) unsigned NOT NULL DEFAULT '0', + `author` int(10) unsigned NOT NULL DEFAULT '0', + `type` enum('jet_credits','jet_notes') NOT NULL DEFAULT 'jet_notes', + `text` text NOT NULL, + `time_stamp` datetime NOT NULL DEFAULT '2005-09-07 12:41:33', + PRIMARY KEY (`Id`), + KEY `session_id_idx` (`session_id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1 ; + + + CREATE TABLE IF NOT EXISTS `known_users` ( + `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `owner` int(10) unsigned NOT NULL DEFAULT '0', + `targer_user` int(10) unsigned NOT NULL DEFAULT '0', + `targer_character` int(10) unsigned NOT NULL DEFAULT '0', + `relation_type` enum('rt_friend','rt_banned','rt_friend_dm') NOT NULL DEFAULT 'rt_friend', + `comments` varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (`Id`), + KEY `user_index` (`owner`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1 ; + + + CREATE TABLE IF NOT EXISTS `mfs_erased_mail_series` ( + `erased_char_id` int(11) unsigned NOT NULL DEFAULT '0', + `erased_char_name` varchar(32) NOT NULL DEFAULT '', + `erased_series` int(11) unsigned NOT NULL AUTO_INCREMENT, + `erase_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`erased_series`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1 ; + + + CREATE TABLE IF NOT EXISTS `mfs_guild_thread` ( + `thread_id` int(11) NOT NULL AUTO_INCREMENT, + `guild_id` int(11) unsigned NOT NULL DEFAULT '0', + `topic` varchar(255) NOT NULL DEFAULT '', + `author_name` varchar(32) NOT NULL DEFAULT '', + `last_post_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `post_count` int(11) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`thread_id`), + KEY `guild_index` (`guild_id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1 ; + + + CREATE TABLE IF NOT EXISTS `mfs_guild_thread_message` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `thread_id` int(11) unsigned NOT NULL DEFAULT '0', + `author_name` varchar(32) NOT NULL DEFAULT '', + `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `content` text NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1 ; + + + CREATE TABLE IF NOT EXISTS `mfs_mail` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `sender_name` varchar(32) NOT NULL DEFAULT '', + `subject` varchar(250) NOT NULL DEFAULT '', + `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `status` enum('ms_new','ms_read','ms_erased') NOT NULL DEFAULT 'ms_new', + `dest_char_id` int(11) unsigned NOT NULL DEFAULT '0', + `erase_series` int(11) unsigned NOT NULL DEFAULT '0', + `content` text NOT NULL, + PRIMARY KEY (`id`), + KEY `dest_index` (`dest_char_id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1 ; + + + CREATE TABLE IF NOT EXISTS `outlands` ( + `session_id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `island_name` text NOT NULL, + `billing_instance_id` int(11) unsigned NOT NULL DEFAULT '0', + `anim_session_id` int(11) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`session_id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + + + CREATE TABLE IF NOT EXISTS `player_rating` ( + `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `scenario_id` int(10) unsigned NOT NULL DEFAULT '0', + `session_id` int(10) unsigned NOT NULL DEFAULT '0', + `rate_fun` tinyint(3) unsigned NOT NULL DEFAULT '0', + `rate_difficulty` tinyint(3) unsigned NOT NULL DEFAULT '0', + `rate_accessibility` tinyint(3) unsigned NOT NULL DEFAULT '0', + `rate_originality` tinyint(3) unsigned NOT NULL DEFAULT '0', + `rate_direction` tinyint(3) unsigned NOT NULL DEFAULT '0', + `author` int(10) unsigned NOT NULL DEFAULT '0', + `rating` int(10) NOT NULL DEFAULT '0', + `comments` text NOT NULL, + `time_stamp` datetime NOT NULL DEFAULT '2005-09-07 12:41:33', + PRIMARY KEY (`Id`), + KEY `session_id_idx` (`scenario_id`), + KEY `author_idx` (`author`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1 ; + + + CREATE TABLE IF NOT EXISTS `ring_users` ( + `user_id` int(10) unsigned NOT NULL DEFAULT '0', + `user_name` varchar(20) NOT NULL DEFAULT '', + `user_type` enum('ut_character','ut_pioneer') NOT NULL DEFAULT 'ut_character', + `current_session` int(10) unsigned NOT NULL DEFAULT '0', + `current_activity` enum('ca_none','ca_play','ca_edit','ca_anim') NOT NULL DEFAULT 'ca_none', + `current_status` enum('cs_offline','cs_logged','cs_online') NOT NULL DEFAULT 'cs_offline', + `public_level` enum('pl_none','pl_public') NOT NULL DEFAULT 'pl_none', + `account_type` enum('at_normal','at_gold') NOT NULL DEFAULT 'at_normal', + `content_access_level` varchar(20) NOT NULL DEFAULT '', + `description` text NOT NULL, + `lang` enum('lang_en','lang_fr','lang_de') NOT NULL DEFAULT 'lang_en', + `cookie` varchar(30) NOT NULL DEFAULT '', + `current_domain_id` int(10) NOT NULL DEFAULT '-1', + `pioneer_char_id` int(11) unsigned NOT NULL DEFAULT '0', + `current_char` int(11) NOT NULL DEFAULT '0', + `add_privileges` varchar(64) NOT NULL, + PRIMARY KEY (`user_id`), + UNIQUE KEY `user_name_idx` (`user_name`), + KEY `cookie_idx` (`cookie`), + KEY `current_session_idx` (`current_session`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; + + CREATE TABLE IF NOT EXISTS `scenario` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `md5` varchar(64) NOT NULL DEFAULT '', + `title` varchar(32) NOT NULL DEFAULT '', + `description` text NOT NULL, + `author` varchar(32) NOT NULL DEFAULT '', + `rrp_total` int(11) unsigned NOT NULL DEFAULT '0', + `anim_mode` enum('am_dm','am_autonomous') NOT NULL DEFAULT 'am_dm', + `language` varchar(11) NOT NULL DEFAULT '', + `orientation` enum('so_newbie_training','so_story_telling','so_mistery','so_hack_slash','so_guild_training','so_other') NOT NULL DEFAULT 'so_other', + `level` enum('sl_a','sl_b','sl_c','sl_d','sl_e','sl_f') NOT NULL DEFAULT 'sl_a', + `allow_free_trial` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1 ; + + + CREATE TABLE IF NOT EXISTS `scenario_desc` ( + `session_id` int(10) unsigned NOT NULL DEFAULT '0', + `parent_scenario` int(10) unsigned NOT NULL DEFAULT '0', + `description` text NOT NULL, + `relation_to_parent` enum('rtp_same','rtp_variant','rtp_different') NOT NULL DEFAULT 'rtp_same', + `title` varchar(40) NOT NULL DEFAULT '', + `num_player` int(10) unsigned NOT NULL DEFAULT '0', + `content_access_level` varchar(20) NOT NULL DEFAULT '', + PRIMARY KEY (`session_id`), + UNIQUE KEY `title_idx` (`title`), + KEY `parent_idx` (`parent_scenario`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; + + + CREATE TABLE IF NOT EXISTS `session_log` ( + `id` int(11) NOT NULL DEFAULT '0', + `scenario_id` int(11) unsigned NOT NULL DEFAULT '0', + `rrp_scored` int(11) unsigned NOT NULL DEFAULT '0', + `scenario_point_scored` int(11) unsigned NOT NULL DEFAULT '0', + `time_taken` int(11) unsigned NOT NULL DEFAULT '0', + `participants` text NOT NULL, + `launch_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `owner` varchar(32) NOT NULL DEFAULT '0', + `guild_name` varchar(50) DEFAULT NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; + + + CREATE TABLE IF NOT EXISTS `session_participant` ( + `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `session_id` int(10) unsigned NOT NULL DEFAULT '0', + `char_id` int(10) unsigned NOT NULL DEFAULT '0', + `status` enum('sps_play_subscribed','sps_play_invited','sps_edit_invited','sps_anim_invited','sps_playing','sps_editing','sps_animating') NOT NULL DEFAULT 'sps_play_subscribed', + `kicked` tinyint(1) unsigned NOT NULL DEFAULT '0', + `session_rated` tinyint(1) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`Id`), + KEY `session_idx` (`session_id`), + KEY `user_idx` (`char_id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED AUTO_INCREMENT=1 ; + + + CREATE TABLE IF NOT EXISTS `sessions` ( + `session_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `session_type` enum('st_edit','st_anim','st_outland','st_mainland') NOT NULL DEFAULT 'st_edit', + `title` varchar(40) NOT NULL DEFAULT '', + `owner` int(10) unsigned NOT NULL DEFAULT '0', + `plan_date` datetime NOT NULL DEFAULT '2005-09-21 12:41:33', + `start_date` datetime NOT NULL DEFAULT '2005-08-31 00:00:00', + `description` text NOT NULL, + `orientation` enum('so_newbie_training','so_story_telling','so_mistery','so_hack_slash','so_guild_training','so_other') NOT NULL DEFAULT 'so_other', + `level` enum('sl_a','sl_b','sl_c','sl_d','sl_e','sl_f') NOT NULL DEFAULT 'sl_a', + `rule_type` enum('rt_strict','rt_liberal') NOT NULL DEFAULT 'rt_strict', + `access_type` enum('at_public','at_private') NOT NULL DEFAULT 'at_private', + `state` enum('ss_planned','ss_open','ss_locked','ss_closed') NOT NULL DEFAULT 'ss_planned', + `host_shard_id` int(11) NOT NULL DEFAULT '0', + `subscription_slots` int(11) unsigned NOT NULL DEFAULT '0', + `reserved_slots` int(10) unsigned NOT NULL DEFAULT '0', + `free_slots` int(10) unsigned NOT NULL DEFAULT '0', + `estimated_duration` enum('et_short','et_medium','et_long') NOT NULL DEFAULT 'et_short', + `final_duration` int(10) unsigned NOT NULL DEFAULT '0', + `folder_id` int(10) unsigned NOT NULL DEFAULT '0', + `lang` varchar(20) NOT NULL DEFAULT '', + `icone` varchar(70) NOT NULL DEFAULT '', + `anim_mode` enum('am_dm','am_autonomous') NOT NULL DEFAULT 'am_dm', + `race_filter` set('rf_fyros','rf_matis','rf_tryker','rf_zorai') NOT NULL DEFAULT '', + `religion_filter` set('rf_kami','rf_karavan','rf_neutral') NOT NULL DEFAULT '', + `guild_filter` enum('gf_only_my_guild','gf_any_player') DEFAULT 'gf_only_my_guild', + `shard_filter` set('sf_shard00','sf_shard01','sf_shard02','sf_shard03','sf_shard04','sf_shard05','sf_shard06','sf_shard07','sf_shard08','sf_shard09','sf_shard10','sf_shard11','sf_shard12','sf_shard13','sf_shard14','sf_shard15','sf_shard16','sf_shard17','sf_shard18','sf_shard19','sf_shard20','sf_shard21','sf_shard22','sf_shard23','sf_shard24','sf_shard25','sf_shard26','sf_shard27','sf_shard28','sf_shard29','sf_shard30','sf_shard31') NOT NULL DEFAULT 'sf_shard00,sf_shard01,sf_shard02,sf_shard03,sf_shard04,sf_shard05,sf_shard06,sf_shard07,sf_shard08,sf_shard09,sf_shard10,sf_shard11,sf_shard12,sf_shard13,sf_shard14,sf_shard15,sf_shard16,sf_shard17,sf_shard18,sf_shard19,sf_shard20,sf_shard21,sf_shard22,sf_shard23,sf_shard24,sf_shard25,sf_shard26,sf_shard27,sf_shard28,sf_shard29,sf_shard30,sf_shard31', + `level_filter` set('lf_a','lf_b','lf_c','lf_d','lf_e','lf_f') NOT NULL DEFAULT 'lf_a,lf_b,lf_c,lf_d,lf_e,lf_f', + `subscription_closed` tinyint(1) NOT NULL DEFAULT '0', + `newcomer` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0', + PRIMARY KEY (`session_id`), + KEY `owner_idx` (`owner`), + KEY `folder_idx` (`folder_id`), + KEY `state_type_idx` (`state`,`session_type`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=303 ; + + INSERT INTO `sessions` (`session_id`, `session_type`, `title`, `owner`, `plan_date`, `start_date`, `description`, `orientation`, `level`, `rule_type`, `access_type`, `state`, `host_shard_id`, `subscription_slots`, `reserved_slots`, `free_slots`, `estimated_duration`, `final_duration`, `folder_id`, `lang`, `icone`, `anim_mode`, `race_filter`, `religion_filter`, `guild_filter`, `shard_filter`, `level_filter`, `subscription_closed`, `newcomer`) VALUES + (302, 'st_mainland', 'open shard mainland', 0, '2005-09-21 12:41:33', '2005-08-31 00:00:00', '', 'so_other', 'sl_a', 'rt_strict', 'at_public', 'ss_planned', 0, 0, 0, 0, 'et_short', 0, 0, 'lang_en', '', 'am_dm', 'rf_fyros,rf_matis,rf_tryker,rf_zorai', 'rf_kami,rf_karavan,rf_neutral', 'gf_any_player', '', 'lf_a,lf_b,lf_c,lf_d,lf_e,lf_f', 0, 0); + + CREATE TABLE IF NOT EXISTS `shard` ( + `shard_id` int(10) NOT NULL DEFAULT '0', + `WSOnline` tinyint(1) NOT NULL DEFAULT '0', + `MOTD` text NOT NULL, + `OldState` enum('ds_close','ds_dev','ds_restricted','ds_open') NOT NULL DEFAULT 'ds_restricted', + `RequiredState` enum('ds_close','ds_dev','ds_restricted','ds_open') NOT NULL DEFAULT 'ds_dev', + PRIMARY KEY (`shard_id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED; + + INSERT INTO `shard` (`shard_id`, `WSOnline`, `MOTD`, `OldState`, `RequiredState`) VALUES + (302, 1, 'Shard up', 'ds_restricted', 'ds_open'); + + GRANT ALL ON `" . $cfg['db']['ring']['name'] ."`.* TO `" . $cfg['db']['ring']['user'] ."`@".$cfg['db']['ring']['host']." identified by '".$cfg['db']['ring']['pass']."'; + "; + $dbw->executeWithoutParams($sql); + + print "The ring_open database was correctly installed!
"; + //Now create an admin account! $hashpass = crypt("admin", Users::generateSALT()); @@ -1380,21 +1685,24 @@ 'name' => "admin", 'pass' => $hashpass, 'mail' => "admin@admin.com", - 'permission' => 3, - 'lang' => "en" ); try{ - $dbw = new DBLayer("web"); - $user_id = $dbw->executeReturnId("INSERT INTO ams_user (Login, Password, Email, Permission, Language) VALUES (:name, :pass, :mail, :permission, :lang)",$params); - Users::createUser($params, $user_id); + $user_id = WebUsers::createWebuser($params['name'], $params['pass'],$params['mail']); + $result = Webusers::createUser($params, $user_id); + Users::createPermissions(array($params['name'])); $dbl = new DBLayer("lib"); $dbl->execute("UPDATE ticket_user SET Permission = 3 WHERE TUserId = :user_id",array('user_id' => $user_id)); print "The admin account is created, you can login with id: admin, pass: admin!"; }catch (PDOException $e){ print "There was an error while creating the admin account! "; + print_r($e); } + echo '
Reload! '; + + touch("../is_installed"); + exit;