Merge with develop

--HG--
branch : feature-ryzom-installer
This commit is contained in:
kervala 2016-04-12 16:53:28 +02:00
commit ba1486ea48
136 changed files with 1984 additions and 955 deletions

View file

@ -871,7 +871,7 @@ MACRO(NL_SETUP_BUILD)
ENDIF(ANDROID) ENDIF(ANDROID)
IF(APPLE) IF(APPLE)
ADD_PLATFORM_FLAGS("-gdwarf-2") ADD_PLATFORM_FLAGS("-gdwarf-2 -D_DARWIN_UNLIMITED_STREAMS")
ENDIF(APPLE) ENDIF(APPLE)
# Fix "relocation R_X86_64_32 against.." error on x64 platforms # Fix "relocation R_X86_64_32 against.." error on x64 platforms

View file

@ -51,7 +51,7 @@ namespace NLGUI
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const; xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
// Init part // Init part
virtual bool parse (xmlNodePtr cur,CInterfaceGroup * parentGroup); virtual bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup);
virtual void updateCoords(); virtual void updateCoords();

View file

@ -29,7 +29,7 @@ namespace NLGUI
DECLARE_UI_CLASS( CCtrlDraggable ) DECLARE_UI_CLASS( CCtrlDraggable )
CCtrlDraggable( const TCtorParam &param ); CCtrlDraggable( const TCtorParam &param );
virtual ~CCtrlDraggable(){}; virtual ~CCtrlDraggable(){}
static CCtrlDraggable *getDraggedSheet(){ return _LastDraggedSheet; } static CCtrlDraggable *getDraggedSheet(){ return _LastDraggedSheet; }
bool isDragged() const{ return dragged; } bool isDragged() const{ return dragged; }

View file

@ -49,7 +49,7 @@ namespace NLGUI
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const; xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
// Init part // Init part
virtual bool parse (xmlNodePtr cur,CInterfaceGroup * parentGroup); virtual bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup);
virtual void checkCoords(); virtual void checkCoords();
virtual void updateCoords(); virtual void updateCoords();

View file

@ -64,7 +64,7 @@ namespace NLGUI
uint getTextPos(uint nId) const; uint getTextPos(uint nId) const;
const ucstring &getTexture(uint i) const; const ucstring &getTexture(uint i) const;
void setGrayed(uint i, bool g); void setGrayed(uint i, bool g);
const bool getGrayed(uint i) const; bool getGrayed(uint i) const;
void removeText(uint nPos); void removeText(uint nPos);
uint getNumTexts() const {return (uint)_Texts.size();} uint getNumTexts() const {return (uint)_Texts.size();}
void sortText(); void sortText();

View file

@ -72,10 +72,12 @@ namespace NLGUI
GroupChildren = 4 /// module can parse when parsing the group children GroupChildren = 4 /// module can parse when parsing the group children
}; };
IParserModule(){ IParserModule()
{
parser = NULL; parser = NULL;
parsingStage = None; parsingStage = None;
} }
virtual ~IParserModule(){} virtual ~IParserModule(){}
bool canParseInStage( ParsingStage stage ) bool canParseInStage( ParsingStage stage )

View file

@ -71,13 +71,13 @@ namespace NLGUI
private: private:
/// Drawing helpers /// Drawing helpers
virtual bool drawResizer(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; } virtual bool drawResizer(CCtrlBase* /* pCB */, NLMISC::CRGBA /* col */) { return false; }
virtual bool drawRotate(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; } virtual bool drawRotate(CCtrlBase* /* pCB */, NLMISC::CRGBA /* col */) { return false; }
virtual bool drawScale(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; } virtual bool drawScale(CCtrlBase* /* pCB */, NLMISC::CRGBA /* col */) { return false; }
virtual bool drawColorPicker(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; } virtual bool drawColorPicker(CCtrlBase* /* pCB */, NLMISC::CRGBA /* col */) { return false; }
virtual bool drawLink(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; } virtual bool drawLink(CCtrlBase* /* pCB */, NLMISC::CRGBA /* col */) { return false; }
virtual bool drawBrowse(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; } virtual bool drawBrowse(CCtrlBase* /* pCB */, NLMISC::CRGBA /* col */) { return false; }
virtual bool drawPan(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; } virtual bool drawPan(CCtrlBase* /* pCB */, NLMISC::CRGBA /* col */) { return false; }
virtual bool drawCustom(CCtrlBase* pCB); virtual bool drawCustom(CCtrlBase* pCB);
protected: protected:

View file

@ -71,7 +71,7 @@ namespace NLGUI
class IOnWidgetsDrawnHandler class IOnWidgetsDrawnHandler
{ {
public: public:
virtual ~IOnWidgetsDrawnHandler(){}; virtual ~IOnWidgetsDrawnHandler(){}
virtual void process() = 0; virtual void process() = 0;
}; };

View file

@ -127,6 +127,9 @@ public:
/// Returns the code of the language ("fr", "en", ...) defined on system /// Returns the code of the language ("fr", "en", ...) defined on system
static std::string getSystemLanguageCode (); static std::string getSystemLanguageCode ();
/// Define the code of the language ("fr", "en", ...) defined on system
static bool setSystemLanguageCode (const std::string &languageCode);
/// Find a string in the selected language and return his association. /// Find a string in the selected language and return his association.
static const ucstring &get (const std::string &label); static const ucstring &get (const std::string &label);
@ -230,6 +233,7 @@ private:
static std::vector<std::string> _LanguageCodes; static std::vector<std::string> _LanguageCodes;
static std::vector<ucstring> _LanguageNames; static std::vector<ucstring> _LanguageNames;
static std::string _SystemLanguageCode;
static bool _LanguagesNamesLoaded; static bool _LanguagesNamesLoaded;

View file

@ -236,9 +236,6 @@ private:
// If not NULL, binary mode detected, use this stream in serials // If not NULL, binary mode detected, use this stream in serials
IStream *_BinaryStream; IStream *_BinaryStream;
// System dependant structure for locale
void* _Locale;
}; };

View file

@ -181,9 +181,6 @@ private:
// Error message // Error message
std::string _ErrorString; std::string _ErrorString;
// System dependant structure for locale
void* _Locale;
}; };

View file

@ -32,6 +32,12 @@ struct in6_addr;
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
// automatically add the win socket library if you use nel network part // automatically add the win socket library if you use nel network part
#pragma comment(lib, "ws2_32.lib") #pragma comment(lib, "ws2_32.lib")
// it seems that the default loop back address is not defined for ipv6
#ifndef IN6ADDR_LOOPBACK_INIT
#define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }
#endif
#endif #endif
namespace NLMISC namespace NLMISC
@ -137,6 +143,9 @@ public:
/// Returns true if this CInetAddress is 127.0.0.1 /// Returns true if this CInetAddress is 127.0.0.1
bool is127001 () const; bool is127001 () const;
/// Returns true if this CInetAddress is a loop back address
bool isLoopbackIPAddress () const;
/// Creates a CInetAddress object with local host address, port=0 /// Creates a CInetAddress object with local host address, port=0
static CInetAddress localHost(); static CInetAddress localHost();

View file

@ -39,6 +39,7 @@
// NeL includes // NeL includes
#include <nel/misc/time_nl.h> #include <nel/misc/time_nl.h>
#include <nel/misc/string_common.h> #include <nel/misc/string_common.h>
#include <nel/misc/common.h>
// Project includes // Project includes
@ -102,7 +103,7 @@ public:
{ {
releaseError(); releaseError();
m_ErrorLog = fopen(errorLog.c_str(), "wt"); m_ErrorLog = NLMISC::nlfopen(errorLog, "wt");
fwrite(s_ErrorHeader.c_str(), 1, s_ErrorHeader.length(), m_ErrorLog); fwrite(s_ErrorHeader.c_str(), 1, s_ErrorHeader.length(), m_ErrorLog);
fwrite("\n", 1, 1, m_ErrorLog); fwrite("\n", 1, 1, m_ErrorLog);
fflush(m_ErrorLog); fflush(m_ErrorLog);
@ -113,7 +114,7 @@ public:
{ {
releaseDepend(); releaseDepend();
m_DependLog = fopen(dependLog.c_str(), "wt"); m_DependLog = NLMISC::nlfopen(dependLog, "wt");
fwrite(s_DependHeader.c_str(), 1, s_DependHeader.length(), m_DependLog); fwrite(s_DependHeader.c_str(), 1, s_DependHeader.length(), m_DependLog);
fwrite("\n", 1, 1, m_DependLog); fwrite("\n", 1, 1, m_DependLog);
// fflush(m_DependLog); // fflush(m_DependLog);

View file

@ -23,6 +23,7 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/common.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/bitmap.h" #include "nel/misc/bitmap.h"
#include "nel/misc/events.h" #include "nel/misc/events.h"
@ -115,7 +116,7 @@ void LoadSceneScript (const char *ScriptName, CScene* pScene, vector<SDispCS> &D
float posx, posy, posz; float posx, posy, posz;
float roti, rotj, rotk; float roti, rotj, rotk;
FILE *f = fopen (CPath::lookup(ScriptName).c_str(),"rb"); FILE *f = nlfopen (CPath::lookup(ScriptName), "rb");
fseek (f, 0, SEEK_END); fseek (f, 0, SEEK_END);
uint file_size = ftell (f); uint file_size = ftell (f);
fseek (f, 0, SEEK_SET); fseek (f, 0, SEEK_SET);

View file

@ -60,7 +60,7 @@ public:
nlinfo ("init() was called"); nlinfo ("init() was called");
// fp = fopen (NLMISC::CFile::findNewFile("stat.csv").c_str(), "wt"); // fp = nlfopen (NLMISC::CFile::findNewFile("stat.csv"), "wt");
} }
bool update () bool update ()

View file

@ -33,6 +33,7 @@
#endif #endif
#include "nel/misc/common.h"
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
#include "nel/misc/mem_stream.h" #include "nel/misc/mem_stream.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
@ -276,11 +277,11 @@ void CClient::updatePong (sint64 pingTime, sint64 pongTime, uint32 pongNumber, u
} }
string fn = StatPathName + ConnectionName + "_" + ha + "_" + getDate() + ".pong"; string fn = StatPathName + ConnectionName + "_" + ha + "_" + getDate() + ".pong";
FILE *fp = fopen (fn.c_str(), "rt"); FILE *fp = nlfopen (fn, "rt");
if (fp == NULL) if (fp == NULL)
{ {
// new file, add the header // new file, add the header
FILE *fp = fopen (fn.c_str(), "wt"); FILE *fp = nlfopen (fn, "wt");
if (fp != NULL) if (fp != NULL)
{ {
fprintf (fp, "#%s\t%s\t%s\t%s\n", "PingTime", "PongTime", "Delta", "PingNumber"); fprintf (fp, "#%s\t%s\t%s\t%s\n", "PingTime", "PongTime", "Delta", "PingNumber");
@ -292,7 +293,7 @@ void CClient::updatePong (sint64 pingTime, sint64 pongTime, uint32 pongNumber, u
fclose (fp); fclose (fp);
} }
fp = fopen (fn.c_str(), "at"); fp = nlfopen (fn, "at");
if (fp == NULL) if (fp == NULL)
{ {
nlwarning ("Can't open pong file name '%s'", fn.c_str()); nlwarning ("Can't open pong file name '%s'", fn.c_str());

View file

@ -21,6 +21,7 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
#include "nel/misc/common.h"
#include "nel/misc/mem_stream.h" #include "nel/misc/mem_stream.h"
#include "nel/misc/time_nl.h" #include "nel/misc/time_nl.h"
#include "nel/misc/config_file.h" #include "nel/misc/config_file.h"
@ -112,7 +113,7 @@ void exit (const string &reason)
void createConfigFile() void createConfigFile()
{ {
FILE *fp = fopen ("client.cfg", "wt"); FILE *fp = nlfopen ("client.cfg", "wt");
if (fp == NULL) if (fp == NULL)
{ {
InfoLog->displayRawNL ("Can't create client.cfg"); InfoLog->displayRawNL ("Can't create client.cfg");
@ -159,7 +160,7 @@ void checkConnectionName ()
void loadConfigFile () void loadConfigFile ()
{ {
FILE *fp = fopen ("client.cfg", "rt"); FILE *fp = nlfopen ("client.cfg", "rt");
if (fp == NULL) if (fp == NULL)
{ {
createConfigFile(); createConfigFile();

View file

@ -40,8 +40,6 @@ NL_ADD_LIB_SUFFIX(${NLDRV_OGL_LIB})
NL_ADD_RUNTIME_FLAGS(${NLDRV_OGL_LIB}) NL_ADD_RUNTIME_FLAGS(${NLDRV_OGL_LIB})
IF(WIN32) IF(WIN32)
INCLUDE_DIRECTORIES(BEFORE ${DXSDK_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY})
ADD_DEFINITIONS(-DDRIVER_OPENGL_EXPORTS) ADD_DEFINITIONS(-DDRIVER_OPENGL_EXPORTS)
ENDIF() ENDIF()

View file

@ -38,8 +38,6 @@ NL_ADD_LIB_SUFFIX(${NLDRV_OGLES_LIB})
NL_ADD_RUNTIME_FLAGS(${NLDRV_OGLES_LIB}) NL_ADD_RUNTIME_FLAGS(${NLDRV_OGLES_LIB})
IF(WIN32) IF(WIN32)
INCLUDE_DIRECTORIES(BEFORE ${DXSDK_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY})
ADD_DEFINITIONS(/DDRIVER_OPENGLES_EXPORTS) ADD_DEFINITIONS(/DDRIVER_OPENGLES_EXPORTS)
ENDIF() ENDIF()

View file

@ -40,7 +40,8 @@ namespace NLGUI
{ {
char c = toLower( s[ i ] ); char c = toLower( s[ i ] );
switch( c ){ switch( c )
{
case 'l': case 'l':
_Align &= ~1; _Align &= ~1;
break; break;

View file

@ -321,7 +321,7 @@ namespace NLGUI
} }
// *************************************************************************** // ***************************************************************************
const bool CDBGroupComboBox::getGrayed(uint i) const bool CDBGroupComboBox::getGrayed(uint i) const
{ {
if(i<_Grayed.size()) if(i<_Grayed.size())
return _Grayed[i]; return _Grayed[i];

View file

@ -5882,9 +5882,11 @@ namespace NLGUI
{ {
const char* digits = (Type == "I" ? upper : lower); const char* digits = (Type == "I" ? upper : lower);
uint8 i, d=0; uint8 i, d=0;
do { do
{
uint32 num = number % 10; uint32 num = number % 10;
if (num % 5 < 4){ if (num % 5 < 4)
{
for (i = num % 5; i > 0; i--) for (i = num % 5; i > 0; i--)
{ {
ret.insert(ret.begin(), digits[d]); ret.insert(ret.begin(), digits[d]);
@ -5904,7 +5906,9 @@ namespace NLGUI
} }
number /= 10; number /= 10;
d += 2; d += 2;
} while (number > 0); }
while (number > 0);
if (Type == "I") if (Type == "I")
{ {
ret = toUpper(ret); ret = toUpper(ret);

View file

@ -121,69 +121,112 @@ namespace NLGUI
// *************************************************************************** // ***************************************************************************
// http://stackoverflow.com/a/18335183 // http://stackoverflow.com/a/18335183
static std::string correct_non_utf_8(const std::string &str) static std::string correctNonUtf8(const std::string &str)
{ {
int i,f_size=str.size(); int i, f_size=str.size();
unsigned char c,c2,c3,c4; unsigned char c,c2,c3,c4;
std::string to; std::string to;
to.reserve(f_size); to.reserve(f_size);
for(i=0 ; i<f_size ; i++){ for(i=0 ; i<f_size ; i++)
{
c=(unsigned char)(str[i]); c=(unsigned char)(str[i]);
if(c<32){//control char if (c<32)
if(c==9 || c==10 || c==13){//allow only \t \n \r {
//control char
if(c==9 || c==10 || c==13)
{
//allow only \t \n \r
to.append(1,c); to.append(1,c);
} }
continue; continue;
}else if(c<127){//normal ASCII }
else if (c<127)
{
//normal ASCII
to.append(1,c); to.append(1,c);
continue; continue;
}else if(c<160){//control char (nothing should be defined here either ASCI, ISO_8859-1 or UTF8, so skipping) }
if(c==128){//fix microsoft mess, add euro else if (c < 160)
{
//control char (nothing should be defined here either ASCI, ISO_8859-1 or UTF8, so skipping)
if (c == 128)
{
//fix microsoft mess, add euro
to.append(1,226); to.append(1,226);
to.append(1,130); to.append(1,130);
to.append(1,172); to.append(1,172);
} }
if(c==133){//fix IBM mess, add NEL = \n\r
if (c == 133)
{
//fix IBM mess, add NEL = \n\r
to.append(1,10); to.append(1,10);
to.append(1,13); to.append(1,13);
} }
continue; continue;
}else if(c<192){//invalid for UTF8, converting ASCII }
else if (c < 192)
{
//invalid for UTF8, converting ASCII
to.append(1,(unsigned char)194); to.append(1,(unsigned char)194);
to.append(1,c); to.append(1,c);
continue; continue;
}else if(c<194){//invalid for UTF8, converting ASCII }
else if (c < 194)
{
//invalid for UTF8, converting ASCII
to.append(1,(unsigned char)195); to.append(1,(unsigned char)195);
to.append(1,c-64); to.append(1,c-64);
continue; continue;
}else if(c<224 && i+1<f_size){//possibly 2byte UTF8 }
c2=(unsigned char)(str[i+1]); else if (c < 224 && i + 1 < f_size)
if(c2>127 && c2<192){//valid 2byte UTF8 {
if(c==194 && c2<160){//control char, skipping //possibly 2byte UTF8
c2 = (unsigned char)(str[i+1]);
if (c2 > 127 && c2 < 192)
{
//valid 2byte UTF8
if (c == 194 && c2 < 160)
{
//control char, skipping
; ;
}else{ }
else
{
to.append(1,c); to.append(1,c);
to.append(1,c2); to.append(1,c2);
} }
i++; i++;
continue; continue;
} }
}else if(c<240 && i+2<f_size){//possibly 3byte UTF8 }
c2=(unsigned char)(str[i+1]); else if (c < 240 && i + 2 < f_size)
c3=(unsigned char)(str[i+2]); {
if(c2>127 && c2<192 && c3>127 && c3<192){//valid 3byte UTF8 // possibly 3byte UTF8
c2 = (unsigned char)(str[i+1]);
c3 = (unsigned char)(str[i+2]);
if (c2 > 127 && c2 < 192 && c3 > 127 && c3 < 192)
{
// valid 3byte UTF8
to.append(1,c); to.append(1,c);
to.append(1,c2); to.append(1,c2);
to.append(1,c3); to.append(1,c3);
i+=2; i+=2;
continue; continue;
} }
}else if(c<245 && i+3<f_size){//possibly 4byte UTF8 }
c2=(unsigned char)(str[i+1]); else if (c < 245 && i + 3 < f_size)
c3=(unsigned char)(str[i+2]); {
c4=(unsigned char)(str[i+3]); //possibly 4byte UTF8
if(c2>127 && c2<192 && c3>127 && c3<192 && c4>127 && c4<192){//valid 4byte UTF8 c2 = (unsigned char)(str[i+1]);
c3 = (unsigned char)(str[i+2]);
c4 = (unsigned char)(str[i+3]);
if (c2 > 127 && c2 < 192 && c3 > 127 && c3 < 192 && c4 > 127 && c4 < 192)
{
//valid 4byte UTF8
to.append(1,c); to.append(1,c);
to.append(1,c2); to.append(1,c2);
to.append(1,c3); to.append(1,c3);
@ -192,6 +235,7 @@ namespace NLGUI
continue; continue;
} }
} }
//invalid UTF8, converting ASCII (c>245 || string too short for multi-byte)) //invalid UTF8, converting ASCII (c>245 || string too short for multi-byte))
to.append(1,(unsigned char)195); to.append(1,(unsigned char)195);
to.append(1,c-64); to.append(1,c-64);
@ -250,7 +294,7 @@ namespace NLGUI
} }
// if there is invalid utf-8 chars, then libxml will break everything after first it finds. // if there is invalid utf-8 chars, then libxml will break everything after first it finds.
htmlString = correct_non_utf_8(htmlString); htmlString = correctNonUtf8(htmlString);
} }
// *************************************************************************** // ***************************************************************************

View file

@ -201,12 +201,6 @@ ELSE(WITH_STATIC OR WIN32)
TARGET_LINK_LIBRARIES(nelmisc ${PNG_LIBRARY}) TARGET_LINK_LIBRARIES(nelmisc ${PNG_LIBRARY})
ENDIF(WITH_STATIC OR WIN32) ENDIF(WITH_STATIC OR WIN32)
# For DirectInput (di_event_emitter)
IF(WIN32)
INCLUDE_DIRECTORIES(BEFORE ${DXSDK_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(nelmisc ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY} winmm dbghelp)
ENDIF(WIN32)
IF(UNIX) IF(UNIX)
TARGET_LINK_LIBRARIES(nelmisc -lc -ldl) TARGET_LINK_LIBRARIES(nelmisc -lc -ldl)
IF(NOT APPLE) IF(NOT APPLE)

View file

@ -19,6 +19,8 @@
#include "nel/misc/dynloadlib.h" #include "nel/misc/dynloadlib.h"
#include "nel/misc/command.h" #include "nel/misc/command.h"
#include <locale.h>
#ifdef DEBUG_NEW #ifdef DEBUG_NEW
#define new DEBUG_NEW #define new DEBUG_NEW
#endif #endif
@ -85,6 +87,9 @@ void INelContext::contextReady()
_NelContext = this; _NelContext = this;
*(_getInstance()) = this; *(_getInstance()) = this;
// set numeric locale to C to avoid the use of decimal separators different of a dot
char *locale = setlocale(LC_NUMERIC, "C");
// register any pending thinks // register any pending thinks
// register local instance counter in the global instance counter manager // register local instance counter in the global instance counter manager

View file

@ -3106,11 +3106,17 @@ bool CBitmap::blit(const CBitmap *src, sint32 x, sint32 y)
// Private : // Private :
float CBitmap::getColorInterp (float x, float y, float colorInXY00, float colorInXY10, float colorInXY01, float colorInXY11) const float CBitmap::getColorInterp (float x, float y, float colorInXY00, float colorInXY10, float colorInXY01, float colorInXY11) const
{ {
if (colorInXY00 == colorInXY10
&& colorInXY00 == colorInXY01
&& colorInXY00 == colorInXY11)
return colorInXY00; // Fix rounding error for alpha 255...
float res = colorInXY00*(1.0f-x)*(1.0f-y) + float res = colorInXY00*(1.0f-x)*(1.0f-y) +
colorInXY10*( x)*(1.0f-y) + colorInXY10*( x)*(1.0f-y) +
colorInXY01*(1.0f-x)*( y) + colorInXY01*(1.0f-x)*( y) +
colorInXY11*( x)*( y); colorInXY11*( x)*( y);
clamp (res, 0.0f, 255.0f); clamp(res, 0.0f, 255.0f);
return res; return res;
} }

View file

@ -49,7 +49,8 @@ static uint8 INTERLACED_OFFSET[] = { 0, 4, 2, 1 };
static uint8 INTERLACED_JUMP[] = { 8, 8, 4, 2 }; static uint8 INTERLACED_JUMP[] = { 8, 8, 4, 2 };
#endif #endif
static int readGIFData(GifFileType *gif, GifByteType *data, int length){ static int readGIFData(GifFileType *gif, GifByteType *data, int length)
{
NLMISC::IStream *f = static_cast<NLMISC::IStream *>(gif->UserData); NLMISC::IStream *f = static_cast<NLMISC::IStream *>(gif->UserData);
if(!f->isReading()) return 0; if(!f->isReading()) return 0;

View file

@ -316,6 +316,13 @@ CConfigFile::~CConfigFile ()
void CConfigFile::load (const string &fileName, bool lookupPaths ) void CConfigFile::load (const string &fileName, bool lookupPaths )
{ {
char *locale = setlocale(LC_NUMERIC, NULL);
if (!locale || strcmp(locale, "C"))
{
nlerror("Numeric locale not defined to C, an external library possibly redefined it!");
}
if(fileName.empty()) if(fileName.empty())
{ {
nlwarning ("CF: Can't load a empty file name configfile"); nlwarning ("CF: Can't load a empty file name configfile");
@ -597,8 +604,12 @@ bool CConfigFile::exists (const std::string &varName)
void CConfigFile::save () const void CConfigFile::save () const
{ {
// Avoid any problem, Force Locale to default char *locale = setlocale(LC_NUMERIC, NULL);
setlocale(LC_ALL, "C");
if (!locale || strcmp(locale, "C"))
{
nlerror("Numeric locale not defined to C, an external library possibly redefined it!");
}
FILE *fp = nlfopen (getFilename(), "w"); FILE *fp = nlfopen (getFilename(), "w");
if (fp == NULL) if (fp == NULL)

View file

@ -43,6 +43,7 @@ string CI18N::_SelectedLanguageCode;
CI18N::ILoadProxy *CI18N::_LoadProxy = 0; CI18N::ILoadProxy *CI18N::_LoadProxy = 0;
vector<string> CI18N::_LanguageCodes; vector<string> CI18N::_LanguageCodes;
vector<ucstring> CI18N::_LanguageNames; vector<ucstring> CI18N::_LanguageNames;
std::string CI18N::_SystemLanguageCode;
bool CI18N::noResolution = false; bool CI18N::noResolution = false;
void CI18N::setLoadProxy(ILoadProxy *loadProxy) void CI18N::setLoadProxy(ILoadProxy *loadProxy)
@ -248,10 +249,8 @@ bool CI18N::isLanguageCodeSupported(const std::string &lang)
std::string CI18N::getSystemLanguageCode () std::string CI18N::getSystemLanguageCode ()
{ {
static std::string s_cachedSystemLanguage; if (!_SystemLanguageCode.empty())
return _SystemLanguageCode;
if (!s_cachedSystemLanguage.empty())
return s_cachedSystemLanguage;
#ifdef NL_OS_MAC #ifdef NL_OS_MAC
// under OS X, locale is only defined in console, not in UI // under OS X, locale is only defined in console, not in UI
@ -317,7 +316,7 @@ std::string CI18N::getSystemLanguageCode ()
// only keep language code if supported by NeL // only keep language code if supported by NeL
if (isLanguageCodeSupported(lang)) if (isLanguageCodeSupported(lang))
{ {
s_cachedSystemLanguage = lang; _SystemLanguageCode = lang;
break; break;
} }
} }
@ -328,21 +327,116 @@ std::string CI18N::getSystemLanguageCode ()
} }
#endif #endif
// use system locale (works under Linux and Windows) #ifdef NL_OS_WINDOWS
if (s_cachedSystemLanguage.empty()) // use user locale under Windows (since Vista)
if (_SystemLanguageCode.empty())
{ {
std::string lang = NLMISC::toLower(std::string(setlocale(LC_CTYPE, ""))); // GetUserDefaultLocaleName prototype
typedef int (WINAPI* GetUserDefaultLocaleNamePtr)(LPWSTR lpLocaleName, int cchLocaleName);
// only keep 2 first characters // get pointer on GetUserDefaultLocaleName, kernel32.dll is always in memory so no need to call LoadLibrary
if (lang.size() > 1) GetUserDefaultLocaleNamePtr nlGetUserDefaultLocaleName = (GetUserDefaultLocaleNamePtr)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetUserDefaultLocaleName");
s_cachedSystemLanguage = lang.substr(0, 2);
// only use it if found
if (nlGetUserDefaultLocaleName)
{
// get user locale
wchar_t buffer[LOCALE_NAME_MAX_LENGTH];
sint res = nlGetUserDefaultLocaleName(buffer, LOCALE_NAME_MAX_LENGTH);
// convert wide string to std::string
std::string lang = wideToUtf8(buffer);
// only keep 2 first characters
if (lang.size() > 1)
_SystemLanguageCode = lang.substr(0, 2);
}
}
#endif
// use system locale (works under OS X, Linux and Windows)
if (_SystemLanguageCode.empty())
{
// get default locale
char *locale = setlocale(LC_CTYPE, "");
if (locale)
{
std::string lang(locale);
#ifdef NL_OS_WINDOWS
// be sure supported languages are initialized
initLanguages();
// locales names are different under Windows, for example: French_France.1252
for(uint i = 0; i < _LanguageNames.size(); ++i)
{
std::string name = _LanguageNames[i].toUtf8();
// so we compare the language name with the supported ones
if (lang.compare(0, name.length(), name) == 0)
{
// found, so use its code
_SystemLanguageCode = _LanguageCodes[i];
break;
}
}
#else
// only keep 2 first characters
if (lang.size() > 1)
_SystemLanguageCode = NLMISC::toLower(lang).substr(0, 2);
#endif
}
} }
// english is default language // english is default language
if (s_cachedSystemLanguage.empty()) if (_SystemLanguageCode.empty())
s_cachedSystemLanguage = "en"; _SystemLanguageCode = "en";
return s_cachedSystemLanguage; return _SystemLanguageCode;
}
bool CI18N::setSystemLanguageCode (const std::string &languageCode)
{
// be sure supported languages are initialized
initLanguages();
std::string lang = NLMISC::toLower(languageCode);
// specified language is really a code (2 characters)
if (lang.length() == 2)
{
// check if language code is supported
for(uint i = 0; i < _LanguageCodes.size(); ++i)
{
std::string code = NLMISC::toLower(_LanguageCodes[i]);
if (lang == code)
{
// found, so use it
_SystemLanguageCode = lang;
return true;
}
}
}
// specified language is something else
else
{
// check if language name is supported
for(uint i = 0; i < _LanguageNames.size(); ++i)
{
std::string name = NLMISC::toLower(_LanguageNames[i].toUtf8());
if (name == lang)
{
// found, so use its code
_SystemLanguageCode = _LanguageCodes[i];
return true;
}
}
}
return false;
} }
void CI18N::removeCComment(ucstring &commentedString) void CI18N::removeCComment(ucstring &commentedString)

View file

@ -24,11 +24,6 @@
// Include from libxml2 // Include from libxml2
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#if defined(NL_OS_WINDOWS) && defined(NL_COMP_VC_VERSION) && NL_COMP_VC_VERSION >= 80
#define USE_LOCALE_ATOF
#include <locale.h>
#endif
using namespace std; using namespace std;
#define NLMISC_READ_BUFFER_SIZE 1024 #define NLMISC_READ_BUFFER_SIZE 1024
@ -46,26 +41,10 @@ const char SEPARATOR = ' ';
// *************************************************************************** // ***************************************************************************
#define readnumber(dest,thetype,digits,convfunc) \ #define readnumber(dest,digits) \
string number_as_string; \ string number_as_string; \
serialSeparatedBufferIn( number_as_string ); \ serialSeparatedBufferIn( number_as_string ); \
dest = (thetype)convfunc( number_as_string.c_str() ); NLMISC::fromString(number_as_string, dest);
#ifdef USE_LOCALE_ATOF
#define readnumberlocale(dest,thetype,digits,convfunc) \
string number_as_string; \
serialSeparatedBufferIn( number_as_string ); \
dest = (thetype)convfunc( number_as_string.c_str(), (_locale_t)_Locale );
#define nl_atof _atof_l
#else
#define readnumberlocale(dest,thetype,digits,convfunc) readnumber(dest,thetype,digits,convfunc)
#define nl_atof atof
#endif
// *************************************************************************** // ***************************************************************************
@ -91,13 +70,6 @@ CIXml::CIXml () : IStream (true /* Input mode */)
_ErrorString = ""; _ErrorString = "";
_TryBinaryMode = false; _TryBinaryMode = false;
_BinaryStream = NULL; _BinaryStream = NULL;
#ifdef USE_LOCALE_ATOF
// create C numeric locale
_Locale = _create_locale(LC_NUMERIC, "C");
#else
_Locale = NULL;
#endif
} }
// *************************************************************************** // ***************************************************************************
@ -113,13 +85,6 @@ CIXml::CIXml (bool tryBinaryMode) : IStream (true /* Input mode */)
_ErrorString = ""; _ErrorString = "";
_TryBinaryMode = tryBinaryMode; _TryBinaryMode = tryBinaryMode;
_BinaryStream = NULL; _BinaryStream = NULL;
#ifdef USE_LOCALE_ATOF
// create C numeric locale
_Locale = _create_locale(LC_NUMERIC, "C");
#else
_Locale = NULL;
#endif
} }
// *************************************************************************** // ***************************************************************************
@ -128,10 +93,6 @@ CIXml::~CIXml ()
{ {
// Release // Release
release (); release ();
#ifdef USE_LOCALE_ATOF
if (_Locale) _free_locale((_locale_t)_Locale);
#endif
} }
// *************************************************************************** // ***************************************************************************
@ -468,7 +429,7 @@ void CIXml::serial(uint8 &b)
else else
{ {
// Read the number // Read the number
readnumber( b, uint8, 3, atoi ); readnumber( b, 3 );
} }
} }
@ -482,7 +443,7 @@ void CIXml::serial(sint8 &b)
} }
else else
{ {
readnumber( b, sint8, 4, atoi ); readnumber( b, 4 );
} }
} }
@ -496,7 +457,7 @@ void CIXml::serial(uint16 &b)
} }
else else
{ {
readnumber( b, uint16, 5, atoi ); readnumber( b, 5 );
} }
} }
@ -510,7 +471,7 @@ void CIXml::serial(sint16 &b)
} }
else else
{ {
readnumber( b, sint16, 6, atoi ); readnumber( b, 6 );
} }
} }
@ -529,7 +490,7 @@ void CIXml::serial(uint32 &b)
} }
else else
{ {
readnumber( b, uint32, 10, atoui ); readnumber( b, 10 );
} }
} }
@ -543,7 +504,7 @@ void CIXml::serial(sint32 &b)
} }
else else
{ {
readnumber( b, sint32, 11, atoi ); readnumber( b, 11 );
} }
} }
@ -557,7 +518,7 @@ void CIXml::serial(uint64 &b)
} }
else else
{ {
readnumber( b, uint64, 20, atoiInt64 ); readnumber( b, 20 );
} }
} }
@ -571,7 +532,7 @@ void CIXml::serial(sint64 &b)
} }
else else
{ {
readnumber( b, sint64, 20, atoiInt64 ); readnumber( b, 20 );
} }
} }
@ -585,7 +546,7 @@ void CIXml::serial(float &b)
} }
else else
{ {
readnumberlocale( b, float, 128, nl_atof ); readnumber( b, 128 );
} }
} }
@ -599,7 +560,7 @@ void CIXml::serial(double &b)
} }
else else
{ {
readnumberlocale( b, double, 128, nl_atof ); readnumber( b, 128 );
} }
} }

View file

@ -43,22 +43,11 @@ const char SEPARATOR = ' ';
// *************************************************************************** // ***************************************************************************
#ifdef USE_LOCALE_SPRINTF
#define writenumber(src,format,digits) \
char number_as_cstring [digits+1]; \
_sprintf_l( number_as_cstring, format, (_locale_t)_Locale, src ); \
serialSeparatedBufferOut( number_as_cstring );
#else
#define writenumber(src,format,digits) \ #define writenumber(src,format,digits) \
char number_as_cstring [digits+1]; \ char number_as_cstring [digits+1]; \
sprintf( number_as_cstring, format, src ); \ sprintf( number_as_cstring, format, src ); \
serialSeparatedBufferOut( number_as_cstring ); serialSeparatedBufferOut( number_as_cstring );
#endif
// *************************************************************************** // ***************************************************************************
// XML callbacks // XML callbacks
// *************************************************************************** // ***************************************************************************
@ -149,13 +138,6 @@ COXml::COXml () : IStream (false /* Output mode */)
// Push begin // Push begin
_PushBegin = false; _PushBegin = false;
#ifdef USE_LOCALE_SPRINTF
// create C numeric locale
_Locale = _create_locale(LC_NUMERIC, "C");
#else
_Locale = NULL;
#endif
} }
// *************************************************************************** // ***************************************************************************
@ -215,10 +197,6 @@ COXml::~COXml ()
{ {
// Flush document to the internal stream // Flush document to the internal stream
flush (); flush ();
#ifdef USE_LOCALE_SPRINTF
if (_Locale) _free_locale((_locale_t)_Locale);
#endif
} }
// *************************************************************************** // ***************************************************************************

View file

@ -1963,14 +1963,15 @@ bool CFile::createEmptyFile (const std::string& filename)
bool CFile::fileExists (const string& filename) bool CFile::fileExists (const string& filename)
{ {
//H_AUTO(FileExists); //H_AUTO(FileExists);
#ifdef NL_OS_WINDOWS FILE *file = nlfopen(filename, "rb");
DWORD attr = GetFileAttributesW(utf8ToWide(filename));
// attributes are valid and file is not a directory if (file)
if (attr == INVALID_FILE_ATTRIBUTES || (attr & FILE_ATTRIBUTE_DIRECTORY)) return false; {
return true; fclose(file);
#else return true;
return access(filename.c_str(), R_OK) != -1; }
#endif
return false;
} }

View file

@ -92,18 +92,18 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t size)
BOOLEAN IN6_IS_ADDR_UNSPECIFIED(CONST IN6_ADDR *a) BOOLEAN IN6_IS_ADDR_UNSPECIFIED(CONST IN6_ADDR *a)
{ {
// //
// We can't use the in6addr_any variable, since that would // We can't use the in6addr_any variable, since that would
// require existing callers to link with a specific library. // require existing callers to link with a specific library.
// //
return (BOOLEAN)((a->s6_words[0] == 0) && return (BOOLEAN)((a->s6_words[0] == 0) &&
(a->s6_words[1] == 0) && (a->s6_words[1] == 0) &&
(a->s6_words[2] == 0) && (a->s6_words[2] == 0) &&
(a->s6_words[3] == 0) && (a->s6_words[3] == 0) &&
(a->s6_words[4] == 0) && (a->s6_words[4] == 0) &&
(a->s6_words[5] == 0) && (a->s6_words[5] == 0) &&
(a->s6_words[6] == 0) && (a->s6_words[6] == 0) &&
(a->s6_words[7] == 0)); (a->s6_words[7] == 0));
} }
#endif #endif
@ -714,25 +714,51 @@ std::vector<CInetAddress> CInetAddress::localAddresses()
if (status) if (status)
{ {
// will come here if the local hostname (/etc/hostname in Linux) is not the real name // will come here if the local hostname (/etc/hostname in Linux) is not the real name
throw ESocket( (string("Hostname resolution failed for ")+string(localhost)).c_str() ); throw ESocket( toString("Hostname resolution failed for %s", localhost).c_str() );
} }
struct addrinfo *p = res; struct addrinfo *p = res;
// for loopback ipv4
bool IPv4LoopbackAdded = false;
// for loopback ipv6
bool IPv6LoopbackAdded = false;
// process all addresses // process all addresses
while (p != NULL) while (p != NULL)
{ {
// check address family // check address family
if (p->ai_family == AF_INET) if (p->ai_family == AF_INET)
{ {
// ipv4 // loopback ipv4
if (!IPv4LoopbackAdded)
{
// add loopback address only once
struct in_addr psin_addrIPv4;
psin_addrIPv4.s_addr = htonl(INADDR_LOOPBACK);
vect.push_back(CInetAddress(&psin_addrIPv4, localhost));
IPv4LoopbackAdded = true;
}
struct sockaddr_in *ipv4 = (struct sockaddr_in *)p->ai_addr; struct sockaddr_in *ipv4 = (struct sockaddr_in *)p->ai_addr;
vect.push_back( CInetAddress( &ipv4->sin_addr, localhost ) ); vect.push_back( CInetAddress( &ipv4->sin_addr, localhost ) );
} }
else if (p->ai_family == AF_INET6) else if (p->ai_family == AF_INET6)
{ {
// ipv6 // loopback ipv6
if (!IPv6LoopbackAdded)
{
// add loopback address only once
struct in6_addr psin_addrIPv6 = IN6ADDR_LOOPBACK_INIT;
vect.push_back(CInetAddress(&psin_addrIPv6, localhost));
IPv6LoopbackAdded = true;
}
struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)p->ai_addr; struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)p->ai_addr;
vect.push_back( CInetAddress( &ipv6->sin6_addr, localhost ) ); vect.push_back( CInetAddress( &ipv6->sin6_addr, localhost ) );
@ -747,7 +773,7 @@ std::vector<CInetAddress> CInetAddress::localAddresses()
if(vect.empty()) if(vect.empty())
{ {
throw ESocket( (string("No network card detected for ")+string(localhost)).c_str() ); throw ESocket(toString("No network card detected for %s", localhost).c_str() );
} }
return vect; return vect;
@ -758,6 +784,16 @@ bool CInetAddress::is127001 () const
return (internalIPAddress () == htonl(0x7F000001)); return (internalIPAddress () == htonl(0x7F000001));
} }
bool CInetAddress::isLoopbackIPAddress () const
{
std::string sIPAddress = ipAddress();
return (sIPAddress.compare("::") == 0) ||
(sIPAddress.compare("::1") == 0) ||
(sIPAddress.compare("127.0.0.1") == 0) ||
(sIPAddress.compare("0:0:0:0:0:0:0:1") == 0);
}
std::string vectorCInetAddressToString(const std::vector<CInetAddress> &addrs) std::string vectorCInetAddressToString(const std::vector<CInetAddress> &addrs)
{ {

View file

@ -828,17 +828,17 @@ void CUnifiedNetwork::addService(const string &name, const vector<CInetAddress>
for (uint i = 0; i < addr.size(); i++) for (uint i = 0; i < addr.size(); i++)
{ {
// first we have to look if we have a network that can established the connection // first we have to look if we have a network that can established the connection
uint j = 0; uint j = 0;
// it s 127.0.0.1, it s ok
if (!addr[i].is127001 ()) if (!addr[i].isLoopbackIPAddress())
{ {
// it's loopback ip address, it's ok
for (j = 0; j < laddr.size (); j++) for (j = 0; j < laddr.size (); j++)
{ {
if (laddr[j].internalNetAddress () == addr[i].internalNetAddress ()) if (laddr[j].internalNetAddress () == addr[i].internalNetAddress ())
{ {
// it's ok, we can try break; // it's ok, we can try
break;
} }
} }
@ -1272,8 +1272,7 @@ uint8 CUnifiedNetwork::findConnectionId (TServiceId sid, uint8 nid)
uint8 connectionId = _IdCnx[sid.get()].DefaultNetwork; uint8 connectionId = _IdCnx[sid.get()].DefaultNetwork;
if (nid == 0xFF) if (nid == 0xFF)
{ { // default network
// it s often happen because they didn't set a good network configuration, so it s in debug to disable it easily
//nldebug ("HNETL5: nid %hu, will use the default connection %hu", (uint16)nid, (uint16)connectionId); //nldebug ("HNETL5: nid %hu, will use the default connection %hu", (uint16)nid, (uint16)connectionId);
} }
else if (nid >= _IdCnx[sid.get()].NetworkConnectionAssociations.size()) else if (nid >= _IdCnx[sid.get()].NetworkConnectionAssociations.size())
@ -1294,8 +1293,12 @@ uint8 CUnifiedNetwork::findConnectionId (TServiceId sid, uint8 nid)
if (connectionId >= _IdCnx[sid.get()].Connections.size() || !_IdCnx[sid.get()].Connections[connectionId].valid() || !_IdCnx[sid.get()].Connections[connectionId].CbNetBase->connected()) if (connectionId >= _IdCnx[sid.get()].Connections.size() || !_IdCnx[sid.get()].Connections[connectionId].valid() || !_IdCnx[sid.get()].Connections[connectionId].CbNetBase->connected())
{ {
// there's a problem with the selected connectionID, so try to find a valid one
nlwarning ("HNETL5: Can't find selected connection id %hu to send message to %s because connection is not valid or connected, find a valid connection id", (uint16)connectionId, _IdCnx[sid.get()].ServiceName.c_str ()); if (nid != 0xFF)
{
// not a default network. There's a problem with the selected connectionID, so try to find a valid one
nlwarning ("HNETL5: Can't find selected connection id %hu to send message to %s because connection is not valid or connected, find a valid connection id", (uint16)connectionId, _IdCnx[sid.get()].ServiceName.c_str ());
}
for (connectionId = 0; connectionId < _IdCnx[sid.get()].Connections.size(); connectionId++) for (connectionId = 0; connectionId < _IdCnx[sid.get()].Connections.size(); connectionId++)
{ {
@ -1303,6 +1306,19 @@ uint8 CUnifiedNetwork::findConnectionId (TServiceId sid, uint8 nid)
{ {
// we found one at last, use this one // we found one at last, use this one
//nldebug ("HNETL5: Ok, we found a valid connectionid, use %hu", (uint16)connectionId); //nldebug ("HNETL5: Ok, we found a valid connectionid, use %hu", (uint16)connectionId);
if (nid < _IdCnx[sid.get()].NetworkConnectionAssociations.size())
{
_IdCnx[sid.get()].NetworkConnectionAssociations[nid] = connectionId; // we set the preferred networkConnectionAssociation
}
else
{
if (nid == 0xFF)
{
_IdCnx[sid.get()].DefaultNetwork = connectionId;
}
}
nlwarning ("HNETL5: selected connection id %hu from network %hu to send message to %s", (uint16)connectionId, (uint16)nid, _IdCnx[sid.get()].ServiceName.c_str ());
break; break;
} }
} }
@ -1782,7 +1798,7 @@ bool CUnifiedNetwork::isServiceLocal (TServiceId sid)
{ {
for (uint j = 0; j < _IdCnx[sid.get()].ExtAddress.size(); j++) for (uint j = 0; j < _IdCnx[sid.get()].ExtAddress.size(); j++)
{ {
if (_IdCnx[sid.get()].ExtAddress[j].is127001 ()) if (_IdCnx[sid.get()].ExtAddress[j].isLoopbackIPAddress ())
return true; return true;
if (_IdCnx[sid.get()].ExtAddress[j].internalIPAddress () == laddr[i].internalIPAddress ()) if (_IdCnx[sid.get()].ExtAddress[j].internalIPAddress () == laddr[i].internalIPAddress ())

View file

@ -195,13 +195,17 @@ uint32 CAudioDecoderVorbis::getNextBytes(uint8 *buffer, uint32 minimum, uint32 m
uint8 CAudioDecoderVorbis::getChannels() uint8 CAudioDecoderVorbis::getChannels()
{ {
vorbis_info *vi = ov_info(&_OggVorbisFile, -1); vorbis_info *vi = ov_info(&_OggVorbisFile, -1);
return (uint8)vi->channels; if (vi) return (uint8)vi->channels;
nlwarning("ov_info returned NULL");
return 0;
} }
uint CAudioDecoderVorbis::getSamplesPerSec() uint CAudioDecoderVorbis::getSamplesPerSec()
{ {
vorbis_info *vi = ov_info(&_OggVorbisFile, -1); vorbis_info *vi = ov_info(&_OggVorbisFile, -1);
return (uint)vi->rate; if (vi) return (uint)vi->rate;
nlwarning("ov_info returned NULL");
return 0;
} }
uint8 CAudioDecoderVorbis::getBitsPerSample() uint8 CAudioDecoderVorbis::getBitsPerSample()

View file

@ -17,6 +17,7 @@
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/common.h"
#include "nel/3d/scene_group.h" #include "nel/3d/scene_group.h"
#include "nel/3d/zone.h" #include "nel/3d/zone.h"
#include "nel/3d/skeleton_shape.h" #include "nel/3d/skeleton_shape.h"
@ -660,9 +661,7 @@ int main(int argc, const char *argv[])
options.insert (argv[i]); options.insert (argv[i]);
// Open log // Open log
FILE *logStream; FILE *logStream = nlfopen(getLogDirectory() + "file_info.log", "wt");
logStream= fopen(std::string(getLogDirectory() + "file_info.log").c_str(), "wt");
// parse dir or file ?? // parse dir or file ??
const char *fileName= argv[1]; const char *fileName= argv[1];

View file

@ -998,7 +998,8 @@ int main(int nNbArg, char **ppArgs)
ChDir (sExeDir); ChDir (sExeDir);
// out a text file, with list of // out a text file, with list of
FILE *out= fopen(ppArgs[4], "wt"); FILE *out = NLMISC::nlfopen(ppArgs[4], "wt");
if(!out) if(!out)
{ {
outString(string("ERROR: cannot save ")+ppArgs[4]); outString(string("ERROR: cannot save ")+ppArgs[4]);

View file

@ -29,12 +29,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#undef free #undef free
#endif #endif
#include <qglobal.h>
#ifdef Q_COMPILER_RVALUE_REFS
#undef Q_COMPILER_RVALUE_REFS
#endif
#include <QtCore/QtCore> #include <QtCore/QtCore>
#include <QtGui/QtGui> #include <QtGui/QtGui>

View file

@ -21,12 +21,6 @@
// STL includes // STL includes
// Qt includes // Qt includes
#include <qglobal.h>
#ifdef Q_COMPILER_RVALUE_REFS
#undef Q_COMPILER_RVALUE_REFS
#endif
#include <QMainWindow> #include <QMainWindow>
// NeL includes // NeL includes

View file

@ -21,12 +21,6 @@
// STL includes // STL includes
// Qt includes // Qt includes
#include <qglobal.h>
#ifdef Q_COMPILER_RVALUE_REFS
#undef Q_COMPILER_RVALUE_REFS
#endif
#include <QWidget> #include <QWidget>
#include <QTextEdit> #include <QTextEdit>
#include <QLineEdit> #include <QLineEdit>

View file

@ -8,6 +8,7 @@
#include "nel/misc/time_nl.h" #include "nel/misc/time_nl.h"
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/common.h"
#include "nel/misc/triangle.h" #include "nel/misc/triangle.h"
#include "nel/misc/bsphere.h" #include "nel/misc/bsphere.h"
#include "3d/quad_tree.h" #include "3d/quad_tree.h"
@ -3121,8 +3122,8 @@ void CNelExport::deleteLM(INode& ZeNode)
sprintf( tmp, "%d", i ); sprintf( tmp, "%d", i );
sSaveName += tmp; sSaveName += tmp;
sSaveName += ".tga"; sSaveName += ".tga";
FILE *file; FILE *file = nlfopen(sSaveName, "rb")
if( file = fopen(sSaveName.c_str(),"rb") ) if (file)
{ {
fclose( file ); fclose( file );
DeleteFile( sSaveName.c_str() ); DeleteFile( sSaveName.c_str() );
@ -3521,8 +3522,8 @@ bool CNelExport::exportScene(std::vector<INode*>& vectNode)
sprintf( tmp, "%d", i ); sprintf( tmp, "%d", i );
sSaveName += tmp; sSaveName += tmp;
sSaveName += ".tga"; sSaveName += ".tga";
FILE *file; FILE *file = nlfopen(sSaveName, "rb");
if( file = fopen(sSaveName.c_str(),"rb") ) if (file)
{ {
fclose( file ); fclose( file );
DeleteFile( sSaveName.c_str() ); DeleteFile( sSaveName.c_str() );

View file

@ -15,6 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <nel/misc/path.h> #include <nel/misc/path.h>
#include <nel/misc/common.h>
#include <nel/misc/file.h> #include <nel/misc/file.h>
#include <nel/misc/config_file.h> #include <nel/misc/config_file.h>
#include <nel/3d/u_light.h> #include <nel/3d/u_light.h>
@ -851,7 +852,7 @@ bool ShapesExporter::renderPS(UInstance &entity, const string &output_path, doub
{ {
if(step > 0) if(step > 0)
{ {
FILE *fp = fopen(string(CPath::standardizePath(output_path)+"nb_steps.txt").c_str(), "w"); FILE *fp = nlfopen(CPath::standardizePath(output_path)+"nb_steps.txt", "w");
if(fp) { fprintf(fp, "%d", step); fclose(fp); } if(fp) { fprintf(fp, "%d", step); fclose(fp); }
} }
nlinfo("PS duration %f after %f with nothing with %d steps, dt %f", duration, startTime, step, deltaTime); nlinfo("PS duration %f after %f with nothing with %d steps, dt %f", duration, startTime, step, deltaTime);
@ -873,7 +874,7 @@ bool ShapesExporter::createThumbnail(const string &filename, const string &path)
uint selectedFrame = 0; uint selectedFrame = 0;
if(CFile::getExtension(filename) == "ps") if(CFile::getExtension(filename) == "ps")
{ {
FILE *fp = fopen(string(CPath::standardizePath(output_path)+"nb_steps.txt").c_str(), "r"); FILE *fp = nlfopen(CPath::standardizePath(output_path)+"nb_steps.txt", "r");
if(fp) if(fp)
{ {
char str[100]; char str[100];

View file

@ -34,12 +34,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// STL includes // STL includes
// Qt includes // Qt includes
#include <qglobal.h>
#ifdef Q_COMPILER_RVALUE_REFS
#undef Q_COMPILER_RVALUE_REFS
#endif
#include <QWidget> #include <QWidget>
#include <QTextEdit> #include <QTextEdit>
#include <QLineEdit> #include <QLineEdit>

View file

@ -18,6 +18,7 @@
#include <iostream> #include <iostream>
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/common.h"
#include "nel/misc/bitmap.h" #include "nel/misc/bitmap.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
@ -49,7 +50,7 @@ std::string getOutputFileName(const std::string &inputFileName);
uint8 getType(const std::string &sFileNameDest) uint8 getType(const std::string &sFileNameDest)
{ {
uint32 dds; uint32 dds;
FILE *f = fopen(sFileNameDest.c_str(),"rb"); FILE *f = nlfopen(sFileNameDest, "rb");
if(f==NULL) if(f==NULL)
{ {
return NOT_DEFINED; return NOT_DEFINED;
@ -105,7 +106,7 @@ uint8 getType(const std::string &sFileNameDest)
bool sameType(const std::string &sFileNameDest, uint8 &algo, bool wantMipMap) bool sameType(const std::string &sFileNameDest, uint8 &algo, bool wantMipMap)
{ {
uint32 dds; uint32 dds;
FILE *f = fopen(sFileNameDest.c_str(),"rb"); FILE *f = nlfopen(sFileNameDest, "rb");
if(f==NULL) if(f==NULL)
{ {
return false; return false;

View file

@ -26,12 +26,6 @@
#undef free #undef free
#endif #endif
#include <qglobal.h>
#ifdef Q_COMPILER_RVALUE_REFS
#undef Q_COMPILER_RVALUE_REFS
#endif
#include <QtCore/QtCore> #include <QtCore/QtCore>
#include <QtGui/QtGui> #include <QtGui/QtGui>

View file

@ -20,6 +20,7 @@
#include <iostream> #include <iostream>
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/common.h"
#include "nel/3d/quad_tree.h" #include "nel/3d/quad_tree.h"
#include "nel/3d/zone.h" #include "nel/3d/zone.h"
#include "nel/3d/landscape.h" #include "nel/3d/landscape.h"
@ -978,7 +979,7 @@ int main(sint argc, char **argv)
} }
#if WELD_LOG #if WELD_LOG
fdbg = fopen("log.txt","wt"); fdbg = nlfopen("log.txt","wt");
fprintf(fdbg,"Center zone : %s\n",argv[1]); fprintf(fdbg,"Center zone : %s\n",argv[1]);
#endif #endif

View file

@ -20,6 +20,7 @@
#include <nel/misc/types_nl.h> #include <nel/misc/types_nl.h>
#include <nel/misc/config_file.h> #include <nel/misc/config_file.h>
#include <nel/misc/debug.h> #include <nel/misc/debug.h>
#include <nel/misc/common.h>
#include <nel/misc/path.h> #include <nel/misc/path.h>
#include <nel/misc/i18n.h> #include <nel/misc/i18n.h>
@ -743,7 +744,7 @@ void displayZones()
\****************************************************************/ \****************************************************************/
void writeConfigFile(const char * configFileName) void writeConfigFile(const char * configFileName)
{ {
FILE * f = fopen(configFileName,"wt"); FILE * f = nlfopen(configFileName, "wt");
if(f==NULL) if(f==NULL)
{ {
@ -801,7 +802,7 @@ void writeConfigFile(const char * configFileName)
\****************************************************************/ \****************************************************************/
void initViewerConfig(const char * configFileName) void initViewerConfig(const char * configFileName)
{ {
FILE * f = fopen(configFileName,"rt"); FILE *f = nlfopen(configFileName, "rt");
if(f==NULL) if(f==NULL)
{ {
nlwarning("'%s' not found, default values used", configFileName); nlwarning("'%s' not found, default values used", configFileName);

View file

@ -32,6 +32,7 @@
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/smart_ptr.h" #include "nel/misc/smart_ptr.h"
#include "nel/misc/command.h" #include "nel/misc/command.h"
#include "nel/misc/common.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
//#include "nel/memory/memory_manager.h" //#include "nel/memory/memory_manager.h"
#include "nel/misc/i18n.h" #include "nel/misc/i18n.h"
@ -685,12 +686,13 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
{ {
const uint BUFFER_SIZE = 16*1024; const uint BUFFER_SIZE = 16*1024;
char lineBuffer[BUFFER_SIZE]; char lineBuffer[BUFFER_SIZE];
FILE *s;
vector<string> fields; vector<string> fields;
vector<string> args; vector<string> args;
if ((s = fopen(file.c_str(), "r")) == NULL) FILE *s = nlfopen(file, "r");
if (s == NULL)
{ {
fprintf(stderr, "Can't find file %s to convert\n", file.c_str()); fprintf(stderr, "Can't find file %s to convert\n", file.c_str());
return; return;

View file

@ -20,12 +20,6 @@
#ifndef RCERROR_DATA #ifndef RCERROR_DATA
#define RCERROR_DATA #define RCERROR_DATA
#include <qglobal.h>
#ifdef Q_COMPILER_RVALUE_REFS
#undef Q_COMPILER_RVALUE_REFS
#endif
#include <QString> #include <QString>
struct SCrashReportData struct SCrashReportData

View file

@ -20,6 +20,7 @@
#include "progress_dialog.h" #include "progress_dialog.h"
#include <sys/timeb.h> #include <sys/timeb.h>
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/common.h"
using namespace std; using namespace std;
using namespace NLMISC; using namespace NLMISC;
@ -468,9 +469,13 @@ void CData_mirrorDlg::OnOK()
if (!LogDirectory.empty()) if (!LogDirectory.empty())
{ {
string sTmp = LogDirectory + "data_mirror.txt"; string sTmp = LogDirectory + "data_mirror.txt";
FILE *f = fopen(sTmp.c_str(),"at"); FILE *f = nlfopen(sTmp ,"at");
fprintf(f,"Modified file : %s\n", dest.c_str());
fclose(f); if (f)
{
fprintf(f,"Modified file : %s\n", dest.c_str());
fclose(f);
}
} }
} }
@ -503,9 +508,12 @@ void CData_mirrorDlg::OnOK()
if (!LogDirectory.empty()) if (!LogDirectory.empty())
{ {
string sTmp = LogDirectory + "data_mirror.txt"; string sTmp = LogDirectory + "data_mirror.txt";
FILE *f = fopen(sTmp.c_str(),"at"); FILE *f = nlfopen(sTmp, "at");
fprintf(f,"Added file : %s\n", dest.c_str()); if (f)
fclose(f); {
fprintf(f,"Added file : %s\n", dest.c_str());
fclose(f);
}
} }
} }
@ -535,9 +543,13 @@ void CData_mirrorDlg::OnOK()
if (!LogDirectory.empty()) if (!LogDirectory.empty())
{ {
string sTmp = LogDirectory + "data_mirror.txt"; string sTmp = LogDirectory + "data_mirror.txt";
FILE *f = fopen(sTmp.c_str(),"at"); FILE *f = nlfopen(sTmp, "at");
fprintf(f,"Removed file : %s\n", dest.c_str());
fclose(f); if (f)
{
fprintf(f,"Removed file : %s\n", dest.c_str());
fclose(f);
}
} }
} }
} }

View file

@ -40,6 +40,7 @@ int _getch()
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/sheet_id.h" #include "nel/misc/sheet_id.h"
#include "nel/misc/common.h"
#include <vector> #include <vector>
@ -86,7 +87,7 @@ int main(int argc, const char *argv[])
sort(sheets.begin(), sheets.end(), Pred); sort(sheets.begin(), sheets.end(), Pred);
// display. // display.
FILE *out= fopen("sheetid.txt", "wb"); FILE *out= nlfopen("sheetid.txt", "wb");
if(out) if(out)
{ {
for(uint i=0;i<sheets.size();i++) for(uint i=0;i<sheets.size();i++)

View file

@ -18,6 +18,7 @@
// misc // misc
#include <nel/misc/types_nl.h> #include <nel/misc/types_nl.h>
#include <nel/misc/file.h> #include <nel/misc/file.h>
#include <nel/misc/common.h>
#include <nel/misc/path.h> #include <nel/misc/path.h>
#include <nel/misc/config_file.h> #include <nel/misc/config_file.h>
@ -567,9 +568,9 @@ int main( int argc, char ** argv )
// dump the list of extensions in a txt file // dump the list of extensions in a txt file
if( dumpExtensions ) if( dumpExtensions )
{ {
FILE * extListOutput;
string extListFileName = outputPath + "sheet_ext.txt"; string extListFileName = outputPath + "sheet_ext.txt";
if( !(extListOutput = fopen(extListFileName.c_str(),"w")) ) FILE *extListOutput = nlfopen(extListFileName, "w");
if (!extListOutput)
{ {
nlwarning("Can't open output file %s",extListFileName.c_str()); nlwarning("Can't open output file %s",extListFileName.c_str());
return 1; return 1;

View file

@ -1,12 +1,6 @@
#ifndef WORDS_DICDLG_H #ifndef WORDS_DICDLG_H
#define WORDS_DICDLG_H #define WORDS_DICDLG_H
#include <qglobal.h>
#ifdef Q_COMPILER_RVALUE_REFS
#undef Q_COMPILER_RVALUE_REFS
#endif
#include <QMainWindow> #include <QMainWindow>
#include "ui_words_dic_Qt.h" #include "ui_words_dic_Qt.h"

View file

@ -17,6 +17,7 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/misc/app_context.h" #include "nel/misc/app_context.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/common.h"
#include "nel/misc/sstring.h" #include "nel/misc/sstring.h"
#include "nel/misc/algo.h" #include "nel/misc/algo.h"
@ -228,7 +229,7 @@ int main(int argc, char *argv[])
// read the index file // read the index file
set<string> fileInIndex; set<string> fileInIndex;
char lineBuffer[1024]; char lineBuffer[1024];
FILE *fp = fopen(indexFileName.c_str(), "rt"); FILE *fp = nlfopen(indexFileName, "rt");
while (fgets(lineBuffer, 1024, fp)) while (fgets(lineBuffer, 1024, fp))
fileInIndex.insert(CSString(lineBuffer).strip()); fileInIndex.insert(CSString(lineBuffer).strip());
@ -263,8 +264,8 @@ int main(int argc, char *argv[])
if (!validFiles.empty() && needRepack) if (!validFiles.empty() && needRepack)
{ {
// open the pack file // open the pack file
// FILE *fp = fopen(filename.c_str(), "wt"); // FILE *fp = nlfopen(filename, "wt");
FILE *fp = fopen(packFileName.c_str(), "wt"); FILE *fp = nlfopen(packFileName, "wt");
fprintf(fp, "<nel:packed_xml>\n"); fprintf(fp, "<nel:packed_xml>\n");
@ -275,7 +276,7 @@ int main(int argc, char *argv[])
printf("Adding file '%s'...\n", CFile::getFilename(subFileName).c_str()); printf("Adding file '%s'...\n", CFile::getFilename(subFileName).c_str());
fprintf(fp, " <nel:xml_file name=\"%s\">\n", CFile::getFilename(subFileName).c_str()); fprintf(fp, " <nel:xml_file name=\"%s\">\n", CFile::getFilename(subFileName).c_str());
FILE *subFp = fopen(subFileName.c_str(), "rt"); FILE *subFp = nlfopen(subFileName, "rt");
nlassert(subFp != NULL); nlassert(subFp != NULL);
char buffer[MaxLineSize]; char buffer[MaxLineSize];
char *result; char *result;
@ -304,7 +305,7 @@ int main(int argc, char *argv[])
fclose(fp); fclose(fp);
// write the disposable index file used by pack to check for erased file // write the disposable index file used by pack to check for erased file
fp = fopen(indexFileName.c_str(), "wt"); fp = nlfopen(indexFileName, "wt");
for (uint i=0; i<validFiles.size(); ++i) for (uint i=0; i<validFiles.size(); ++i)
{ {
fprintf(fp, "%s\n", CFile::getFilename(validFiles[i]).c_str()); fprintf(fp, "%s\n", CFile::getFilename(validFiles[i]).c_str());
@ -327,8 +328,8 @@ int main(int argc, char *argv[])
{ {
printf("Unpacking directory '%s'...\n", dirName.c_str()); printf("Unpacking directory '%s'...\n", dirName.c_str());
// open the pack file // open the pack file
// FILE *fp = fopen((dirName+"/tmp."+DefaultExt).c_str(), "rt"); // FILE *fp = nlfopen(dirName+"/tmp."+DefaultExt, "rt");
FILE *fp = fopen(filename.c_str(), "rt"); FILE *fp = nlfopen(filename, "rt");
if (!recursive) if (!recursive)
{ {
// if we are not recursive, we MUST have a file here // if we are not recursive, we MUST have a file here

View file

@ -333,7 +333,7 @@ std::string getServiceStateFileName(const std::string& serviceAlias,const std::s
std::string getOfflineServiceState(const std::string& serviceAlias,const std::string& serviceExecutionPath) std::string getOfflineServiceState(const std::string& serviceAlias,const std::string& serviceExecutionPath)
{ {
// open the file for reading // open the file for reading
FILE* f= fopen(getServiceStateFileName(serviceAlias,serviceExecutionPath).c_str(),"rt"); FILE* f = nlfopen(getServiceStateFileName(serviceAlias,serviceExecutionPath), "rt");
if (f==NULL) return "Offline"; if (f==NULL) return "Offline";
// setup a buffer to hold the text read from the file // setup a buffer to hold the text read from the file
@ -366,7 +366,7 @@ bool writeServiceLaunchCtrl(const std::string& serviceAlias,const std::string& s
NLMISC::CFile::createDirectoryTree(serviceExecutionPath); NLMISC::CFile::createDirectoryTree(serviceExecutionPath);
// open the file for writing // open the file for writing
FILE* f= fopen(getServiceLaunchCtrlFileName(serviceAlias,serviceExecutionPath,delay).c_str(),"wt"); FILE* f= nlfopen(getServiceLaunchCtrlFileName(serviceAlias,serviceExecutionPath,delay), "wt");
if (f==NULL) return false; if (f==NULL) return false;
// write the text to the file // write the text to the file
@ -1636,7 +1636,7 @@ NLMISC_COMMAND(aesSystem, "Execute a system() call", "<command>")
char str[1024]; char str[1024];
FILE *fp = fopen(fn.c_str(), "rt"); FILE *fp = nlfopen(fn, "rt");
if (fp != NULL) if (fp != NULL)
{ {
while (true) while (true)
@ -1654,7 +1654,7 @@ NLMISC_COMMAND(aesSystem, "Execute a system() call", "<command>")
log.displayNL("No stdout"); log.displayNL("No stdout");
} }
fp = fopen(fne.c_str(), "rt"); fp = nlfopen(fne, "rt");
if (fp != NULL) if (fp != NULL)
{ {
while (true) while (true)

View file

@ -27,6 +27,7 @@
#endif #endif
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
#include "nel/misc/common.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/thread.h" #include "nel/misc/thread.h"
@ -586,7 +587,7 @@ private:
string dest = filename.substr(0, filename.size ()-4); string dest = filename.substr(0, filename.size ()-4);
setRWAccess(dest); setRWAccess(dest);
if(VerboseLog) nlinfo("Calling fopen('%s','wb')", dest.c_str()); if(VerboseLog) nlinfo("Calling fopen('%s','wb')", dest.c_str());
FILE *fp = fopen (dest.c_str(), "wb"); FILE *fp = nlfopen (dest, "wb");
if (fp == NULL) if (fp == NULL)
{ {
string err = toString("Can't open file '%s' : code=%d %s, (error code 32)", dest.c_str(), errno, strerror(errno)); string err = toString("Can't open file '%s' : code=%d %s, (error code 32)", dest.c_str(), errno, strerror(errno));

View file

@ -454,6 +454,7 @@ XMLInterfaceFiles = {
"config.xml", "config.xml",
"widgets.xml", "widgets.xml",
"webig_widgets.xml", "webig_widgets.xml",
"appzone.xml",
"player.xml", "player.xml",
"inventory.xml", "inventory.xml",
"interaction.xml", "interaction.xml",

View file

@ -0,0 +1,192 @@
-- global
AppZone = {
id = "ui:interface:appzone",
homeuri = "?action=appzone_toolbar",
launchuri = "?action=launch_app",
addappuri = "?action=list_user_apps",
mode = "h_bar",
imagesize = 26
}
-- use client.cfg value when available
local uri getClientCfg("AppZoneUrl")
if uri == nil or uri == '' then
uri = 'http://app.ryzom.com/'
end
AppZone.homeuri = uri .. AppZone.homeuri
AppZone.launchuri = uri .. AppZone.launchuri
AppZone.addappuri = uri .. AppZone.addappuri
function AppZone:getRoot()
return getUI(self.id)
end
function AppZone:onButtonHome()
local webig = getUI("ui:interface:webig")
webig:find("html").url = self.addappuri
webig.active = true
end
function AppZone:calculateSize(count, spacer, mode)
local w, h
if mode == "h_bar" then
-- icon=32, space=2+2
w = count * self.imagesize + spacer * 15
w = w + 55 + 10 + 20
h = self.imagesize + 2
elseif mode == "h_box" then
w = count * self.imagesize
w = w + 20
h = self.imagesize + 2
h = h * spacer
h = h + 15
elseif mode == "v_bar" then
-- icon=32, space=2+2
h = count * self.imagesize + spacer * 15
h = h + 20 + 20 + 12
w = self.imagesize + 2 + 18
else
h = count * self.imagesize
h = h + 20 + 25
w = self.imagesize + 2
w = w * spacer
w = w + 16
end
local ui = getUI("ui:interface")
if w > ui.w then
w = ui.w
end
if h > ui.h then
h = ui.h
end
return w, h
end
function AppZone:setElementCount(count,spacer,m)
self.mode = m
local root = self:getRoot()
local content = root:find("content")
local html = root:find("html")
local button_toggle = root:find("toggle_mode")
local button_reload = root:find("browse_reload")
local button_home = root:find("browse_home")
local w, h = self:calculateSize(count, spacer, self.mode)
root.h = h
root.w = w
content.w = w
content.h = h
-- set position of buttons
if self.mode == "h_bar" then
-- button_toggle.posref = "BL BL"
button_toggle.x = 2
button_toggle.y = 0
-- button_reload.posref = "TL BL"
html.x = 15
html.y = 0
button_reload.x = -25
button_reload.y = -25
-- button_home.posref = "BR BR"
button_home.x = 0
button_home.y = -3 + 5
elseif self.mode == "h_box" then
-- button_toggle.posref = "TL TL"
button_toggle.x = 2
button_toggle.y = h - 15
-- button_reload.posref = "TL BL"
html.x = 0
html.y = -20
button_reload.x = -25
button_reload.y = -4 - 20
-- button_home.posref = "BR BR"
button_home.x = 0
button_home.y = -3 + h - 18
elseif self.mode == "v_bar" then
-- button_toggle.posref = "TL TL"
button_toggle.x = 2
button_toggle.y = h - 15
-- button_reload.posref = "TL BL"
html.x = 0
html.y = -20
button_reload.x = 0
button_reload.y = -4
-- button_home.posref = "BR BR"
button_home.x = 4 - 7
button_home.y = -3
else
-- button_toggle.posref = "TL TL"
button_toggle.x = 2
button_toggle.y = h - 15
-- button_reload.posref = "TL BL"
html.x = 0
html.y = -20
button_reload.x = -25
button_reload.y = -4 - 20
-- button_home.posref = "BR BR"
button_home.x = 0 - w + 54 + 12
button_home.y = -3
end
end
function AppZone:setMode(m)
self.mode = m
self:reload()
end
function AppZone:setActive(s)
self:getRoot().active = s
end
function AppZone:launchApp(appid, appwin, appurl)
if not appwin then
if string.match(appid, "^[0-9]+$") then
appwin = "app" .. tostring(appid)
else
appwin = "webig"
end
end
if not appurl then
appurl = self.launchuri .. "&appid=" .. tostring(appid)
end
if WebBrowser then
WebBrowser:openWindow(appwin, appurl)
else
-- fallback if WebBrowser not present
local webig = getUI("ui:interface:webig")
webig:find("html").url = appurl;
webig.active = true
end
end
function AppZone:reload()
local url = self.homeuri
url = url .. "&mode=" .. tostring(self.mode)
local html = self:getRoot():find("html")
html.url = url
end
-- slash command: /appzone <cmd>
function AppZone:handle(cmd)
if cmd == 'show' then
self:setActive(true)
elseif cmd == 'hide' then
self:setActive(false)
elseif cmd == 'reload' then
self:reload()
elseif cmd == 'list' then
self:onButtonHome()
else
self:launchApp(cmd)
end
end

View file

@ -0,0 +1,258 @@
<?xml version="1.0"?>
<interface_config>
<root id="interface"
x="0"
y="0"
w="800"
h="600"
active="true" />
<!-- default: active, h_bar -->
<variable entry="UI:VARIABLES:ISACTIVE:APPZONE"
type="sint32"
value="1" />
<variable entry="UI:SAVE:APPZONE:MODE"
type="sint32"
value="1" />
<!-- load lua after variable are setup -->
<lua file="appzone.lua" />
<lua file="webbrowser.lua" />
<proc id="appzone_proc_active">
<action handler="set"
params="dblink=UI:VARIABLES:ISACTIVE:APPZONE|value=1" />
<action handler="proc"
params="appzone_proc_mode" />
</proc>
<proc id="appzone_proc_deactive">
<action handler="set"
params="dblink=UI:VARIABLES:ISACTIVE:APPZONE|value=0" />
</proc>
<proc id="appzone_proc_mode_set">
<action handler="set"
params="dblink=UI:SAVE:APPZONE:MODE|value=@0" />
<action handler="proc"
params="appzone_proc_mode" />
</proc>
<proc id="appzone_proc_mode_inc">
<action handler="set"
params="dblink=UI:SAVE:APPZONE:MODE|value=add(@UI:SAVE:APPZONE:MODE,1)" />
<action handler="proc"
params="appzone_proc_mode" />
</proc>
<proc id="appzone_proc_mode">
<action handler="set"
cond="le(@UI:SAVE:APPZONE:MODE,0)"
params="dblink=UI:SAVE:APPZONE:MODE|value=1" />
<action handler="set"
cond="ge(@UI:SAVE:APPZONE:MODE,5)"
params="dblink=UI:SAVE:APPZONE:MODE|value=1" />
<action handler="lua"
cond="eq(@UI:SAVE:APPZONE:MODE,1)"
params="AppZone:setMode('h_bar')" />
<action handler="lua"
cond="eq(@UI:SAVE:APPZONE:MODE,2)"
params="AppZone:setMode('h_box')" />
<action handler="lua"
cond="eq(@UI:SAVE:APPZONE:MODE,3)"
params="AppZone:setMode('v_bar')" />
<action handler="lua"
cond="eq(@UI:SAVE:APPZONE:MODE,4)"
params="AppZone:setMode('v_box')" />
</proc>
<group type="menu"
id="appzone_menu"
extends="base_menu_with_color">
<action id="settings"
name="uiBrowseHome"
handler="lua"
params="AppZone:onButtonHome()" />
<action id="reload"
name="uiBrowseRefresh"
handler="lua"
params="AppZone:reload()" />
<action id="hide"
name="uiHide"
handler="lua"
params="AppZone:setActive(false)" />
<separator />
</group>
<group id="appzone"
type="container"
x="0"
y="0"
w="200"
h="26"
posref="MM MM"
min_w="26"
min_h="26"
max_w="1600"
max_h="1600"
pop_max_w="1600"
pop_max_h="1600"
title=""
global_color="true"
global_color_over="true"
header_active="false"
right_button="false"
options="layer0_pad"
movable="true"
active="true"
opened="true"
openable="false"
resizer="false"
on_active="proc"
on_active_params="appzone_proc_active"
on_deactive="proc"
on_deactive_params="appzone_proc_deactive"
group_onclick_r="active_menu"
group_params_r="menu=ui:interface:appzone_menu">
<group id="header_closed"
x="0"
y="0"
w="0"
h="0"
posref="TL TL" />
<group id="header_opened"
x="0"
y="0"
w="0"
h="0"
wmin="5"
sizeref="w"
posref="TL TL" />
<group id="content"
x="0"
y="0"
w="0"
h="26"
posref="TL TL">
<ctrl type="button"
style="text_button_header"
button_type="toggle_button"
id="toggle_mode"
posref="BL BL"
x="2"
y="0"
tx_normal="tb_mode.tga"
tx_pushed="tb_mode.tga"
tooltip="uiMk_mode"
onclick_l="proc"
params_l="appzone_proc_mode_inc" />
<ctrl type="button"
style="text_button_header"
button_type="toggle_button"
id="browse_home"
posref="BR BR"
x="0"
y="-3"
tx_normal="r2_palette_components.tga"
tx_pushed="r2_palette_components.tga"
tooltip="uittBrowseHome"
onclick_l="lua"
params_l="AppZone:onButtonHome()" />
<ctrl type="button"
style="text_button_header"
button_type="toggle_button"
id="browse_reload"
posref="TL BL"
posparent="browse_home"
x="0"
y="-4"
tx_normal="r2ed_icon_rotate.tga"
tx_pushed="r2ed_icon_rotate.tga"
tooltip="uiBrowseRefresh"
onclick_l="lua"
params_l="AppZone:reload()" />
<group id="html"
type="webig_html"
posref="TL TL"
url=""
title_prefix=""
sizeref="wh"
x="15"
y="0"
w="0"
h="0"
background_color="0 0 0 0"
error_color="255 240 48 255"
link_color="240 155 100 255"
text_color="210 210 210 255"
h1_color="255 255 255 255"
h2_color="255 255 255 255"
h3_color="255 255 255 255"
h4_color="255 255 255 255"
h5_color="255 255 255 255"
h6_color="255 255 255 255"
text_font_size="10"
h1_font_size="16"
h2_font_size="14"
h3_font_size="13"
h4_font_size="12"
h5_font_size="11"
h6_font_size="11"
paragraph_begin_space="12"
multi_line_space_factor="0.25"
td_begin_space="0"
li_begin_space="4"
ul_begin_space="12"
li_indent="-10"
ul_indent="30"
checkbox_bitmap_normal="patch_off.tga"
checkbox_bitmap_pushed="patch_on.tga"
checkbox_bitmap_over=""
background_bitmap_view=""
home=""
browse_next_time="false"
timeout="5"
form_text_area_group="edit_box_widget_multiline">
<group id="black"
posref="BR BR"
sizeref="hw"
w="0"
h="0"
inherit_gc_alpha="true" />
<view type="bitmap"
id="black2"
posparent="black"
posref="MM MM"
sizeref="wh"
w="0"
h="0"
inherit_gc_alpha="true"
scale="true"
texture="blank.tga"
global_color="false" />
<group type="list"
id="text_list"
fontsize="9"
posref="TL TL"
posparent="black"
x="0"
y="0"
space="0"
sizeref="hw"
w="-4"
h="0"
maxelements="2000" />
<ctrl style="skin_scroll"
id="scroll_bar" />
</group>
</group>
</group>
<tree node="appzone" />
<command name="appzone"
action="lua"
params="AppZone:handle('$')" />
</interface_config>

View file

@ -32,7 +32,7 @@ end
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
function bgdownloader:setIcon(icon) function bgdownloader:setIcon(icon)
local bm = self:getProgressGroup():find("bm"); local bm = self:getProgressGroup():find("bm")
if icon == "" then if icon == "" then
bm.active = false bm.active = false
else else

View file

@ -4,7 +4,7 @@
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- create the game namespace without reseting if already created in an other file. -- create the game namespace without reseting if already created in an other file.
if (game==nil) then if (game==nil) then
game= {}; game = {}
end end
@ -12,14 +12,14 @@ end
-- called to construct guild flags background in the modal window -- called to construct guild flags background in the modal window
function game:bcCreateGuildInitFlags() function game:bcCreateGuildInitFlags()
local ui = getUICaller(); local ui = getUICaller()
for i = 0,14 do for i = 0,14 do
local uiBack = getUI(getUIId(ui) .. ':back' .. i); local uiBack = getUI(getUIId(ui) .. ':back' .. i)
uiBack.image1.back = i+1; uiBack.image1.back = i+1
uiBack.image1.symbol = 0; uiBack.image1.symbol = 0
uiBack.image1.color1 = runExpr('makeRGB(255,255,255)'); uiBack.image1.color1 = runExpr('makeRGB(255,255,255)')
uiBack.image1.color2 = runExpr('makeRGB(0,0,0)'); uiBack.image1.color2 = runExpr('makeRGB(0,0,0)')
end end
end end
@ -28,37 +28,37 @@ end
-- trap some parts should be deprecated ... try to clean it up -- trap some parts should be deprecated ... try to clean it up
function game:bcMissionsUpdate() function game:bcMissionsUpdate()
local mt = getDbProp('UI:TEMP:MISSION:MISSION_TYPE'); local mt = getDbProp('UI:TEMP:MISSION:MISSION_TYPE')
-- init bot_chat_missions title -- init bot_chat_missions title
local title = 'uiBotChatMissions'; local title = 'uiBotChatMissions'
if (mt == 3) then title = 'uiBotChatZCCharges'; if (mt == 3) then title = 'uiBotChatZCCharges'
elseif (mt == 4) then title = 'uiBotChatBuilding'; elseif (mt == 4) then title = 'uiBotChatBuilding'
elseif (mt == 5) then title = 'uiBotChatRMBuy'; elseif (mt == 5) then title = 'uiBotChatRMBuy'
elseif (mt == 6) then title = 'uiBotChatRMUpgrade'; elseif (mt == 6) then title = 'uiBotChatRMUpgrade'
end end
local ui = getUI('ui:interface:bot_chat_missions'); local ui = getUI('ui:interface:bot_chat_missions')
ui.title = title; ui.title = title
-- init desc -- init desc
title = 'uiSelectMission'; title = 'uiSelectMission'
if (mt == 3) then title = 'uiSelectZCCharge'; if (mt == 3) then title = 'uiSelectZCCharge'
elseif (mt == 4) then title = 'uiSelectBuilding'; elseif (mt == 4) then title = 'uiSelectBuilding'
elseif (mt == 5) then title = 'uiSelectRMBuy'; elseif (mt == 5) then title = 'uiSelectRMBuy'
elseif (mt == 6) then title = 'uiSelectRMUpgrade'; elseif (mt == 6) then title = 'uiSelectRMUpgrade'
end end
ui.header_opened.mission_title.hardtext = title; ui.header_opened.mission_title.hardtext = title
ui.header_opened.zc_duty.active = (mt == 3); ui.header_opened.zc_duty.active = (mt == 3)
ui.header_opened.xp_guild.active = ((mt == 5) or (mt == 6)); ui.header_opened.xp_guild.active = ((mt == 5) or (mt == 6))
-- init bot_chat_accept_mission title -- init bot_chat_accept_mission title
title = 'uiAcceptMission'; title = 'uiAcceptMission'
if (mt == 3) then title = 'uiAcceptZCCharge'; if (mt == 3) then title = 'uiAcceptZCCharge'
elseif (mt == 4) then title = 'uiAcceptBuilding'; elseif (mt == 4) then title = 'uiAcceptBuilding'
elseif (mt == 5) then title = 'uiAcceptRMBuy'; elseif (mt == 5) then title = 'uiAcceptRMBuy'
elseif (mt == 6) then title = 'uiAcceptRMUpgrade'; elseif (mt == 6) then title = 'uiAcceptRMUpgrade'
end end
ui = getUI('ui:interface:bot_chat_accept_mission'); ui = getUI('ui:interface:bot_chat_accept_mission')
ui.title = title; ui.title = title;
end end

View file

@ -3,36 +3,36 @@
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- create the game namespace without reseting if already created in an other file. -- create the game namespace without reseting if already created in an other file.
if (help==nil) then if (help==nil) then
help= {}; help = {}
end end
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- --
function help:closeCSBrowserHeader() function help:closeCSBrowserHeader()
local ui = getUI('ui:interface:cs_browser'); local ui = getUI('ui:interface:cs_browser')
-- save size -- save size
ui_cs_browser_h = ui.h; ui_cs_browser_h = ui.h
ui_cs_browser_w = ui.w; ui_cs_browser_w = ui.w
-- reduce window size -- reduce window size
ui.pop_min_h = 32; ui.pop_min_h = 32
ui.h = 0; ui.h = 0
ui.w = 216; ui.w = 216
end end
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- --
function help:openCSBrowserHeader() function help:openCSBrowserHeader()
local ui = getUI('ui:interface:cs_browser'); local ui = getUI('ui:interface:cs_browser')
ui.pop_min_h = 96; ui.pop_min_h = 96
-- set size from saved values -- set size from saved values
if (ui_cs_browser_h ~= nil) then if (ui_cs_browser_h ~= nil) then
ui.h = ui_cs_browser_h; ui.h = ui_cs_browser_h
end end
if (ui_cs_browser_w ~= nil) then if (ui_cs_browser_w ~= nil) then
ui.w = ui_cs_browser_w; ui.w = ui_cs_browser_w
end end
end end

View file

@ -161,7 +161,7 @@ end
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- Compute the current Max Resist -- Compute the current Max Resist
function game:getMagicResistMaxLevel() function game:getMagicResistMaxLevel()
local mlvl= self:getMagicResistBaseLevel() + getDbProp(formatUI('%player_resist_maxratio')); local mlvl= 25 + self:getMagicResistBaseLevel() + getDbProp(formatUI('%player_resist_maxratio'));
return math.max(0,mlvl); return math.max(0,mlvl);
end end
@ -267,27 +267,27 @@ function game:onDrawNpcWebPage()
local available local available
if config.Local == 1 then if config.Local == 1 then
available = (NicoMagicURL ~= "") available = (NicoMagicURL ~= "")
else else
available = isDynStringAvailable(self.NpcWebPage.UrlTextId) available = isDynStringAvailable(self.NpcWebPage.UrlTextId)
end end
if(available) then if(available) then
local ucUrl local ucUrl
if config.Local == 1 then if config.Local == 1 then
ucUrl = ucstring(NicoMagicURL) -- for test in local mode ucUrl = ucstring(NicoMagicURL) -- for test in local mode
else else
ucUrl = getDynString(self.NpcWebPage.UrlTextId); ucUrl = getDynString(self.NpcWebPage.UrlTextId);
end end
-- browse -- browse
local uiStr= getUIId(getUICaller()); local uiStr= getUIId(getUICaller());
-- if the url -- if the url
local utf8Url = ucUrl:toUtf8() local utf8Url = ucUrl:toUtf8()
local isRing = string.find(utf8Url, "ring_access_point=1") ~= nil local isRing = string.find(utf8Url, "ring_access_point=1") ~= nil
if isRing then if isRing then
getUI("ui:interface:npc_web_browser").active = false getUI("ui:interface:npc_web_browser").active = false
runAH(nil, "context_ring_sessions", "") runAH(nil, "context_ring_sessions", "")
return return
else else
local hideWindow = string.find(utf8Url, "_hideWindow=1") ~= nil local hideWindow = string.find(utf8Url, "_hideWindow=1") ~= nil
if hideWindow then if hideWindow then
getUI("ui:interface:npc_web_browser").active = false getUI("ui:interface:npc_web_browser").active = false
end end
@ -336,14 +336,14 @@ function game:startNpcWebPage()
end end
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- --
function game:closeNpcWebBrowserHeader() function game:closeNpcWebBrowserHeader()
local ui = getUI('ui:interface:npc_web_browser'); local ui = getUI('ui:interface:npc_web_browser');
-- save size -- save size
ui_npc_web_browser_h = ui.h; ui_npc_web_browser_h = ui.h;
ui_npc_web_browser_w = ui.w; ui_npc_web_browser_w = ui.w;
-- reduce window size -- reduce window size
ui.pop_min_h = 32; ui.pop_min_h = 32;
ui.h = 0; ui.h = 0;
@ -351,7 +351,7 @@ function game:closeNpcWebBrowserHeader()
end end
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- --
function game:openNpcWebBrowserHeader() function game:openNpcWebBrowserHeader()
local ui = getUI('ui:interface:npc_web_browser'); local ui = getUI('ui:interface:npc_web_browser');
ui.pop_min_h = 96; ui.pop_min_h = 96;
@ -360,7 +360,7 @@ function game:openNpcWebBrowserHeader()
if (ui_npc_web_browser_h ~= nil) then if (ui_npc_web_browser_h ~= nil) then
ui.h = ui_npc_web_browser_h; ui.h = ui_npc_web_browser_h;
end end
if (ui_npc_web_browser_w ~= nil) then if (ui_npc_web_browser_w ~= nil) then
ui.w = ui_npc_web_browser_w; ui.w = ui_npc_web_browser_w;
end end
@ -538,7 +538,7 @@ function game:updateFameBar(path)
uiMaxLimit.x = barX + barW * (fameMax + 100) / 200; uiMaxLimit.x = barX + barW * (fameMax + 100) / 200;
-- init bar3d -- init bar3d
if (bar3dStart < bar3dLimit) then if (bar3dStart < bar3dLimit) then
uiBar3d.x= bar3dStart; uiBar3d.x= bar3dStart;
uiBar3d.w= bar3dLimit-bar3dStart; uiBar3d.w= bar3dLimit-bar3dStart;
else else
@ -553,7 +553,7 @@ function game:updateFameBarTT(path)
local fameMax = getDbProp(path .. ':THRESHOLD'); local fameMax = getDbProp(path .. ':THRESHOLD');
local text = i18n.get('uittFameMaxPossible'); local text = i18n.get('uittFameMaxPossible');
text = findReplaceAll(text, '%famemax', tostring(fameMax)); text = findReplaceAll(text, '%famemax', tostring(fameMax));
setContextHelpText(text); setContextHelpText(text);
end end
@ -564,12 +564,12 @@ function game:getPvpEffects()
local i; local i;
local hasBonus = false; local hasBonus = false;
local hasMalus = false; local hasMalus = false;
local text = '' local text = ''
local textBonus = ''; local textBonus = '';
local textMalus = ''; local textMalus = '';
local fmt; local fmt;
-- check every malus and bonus -- check every malus and bonus
for i=0, n do for i=0, n do
local path = formatUI('SERVER:PVP_EFFECTS:#1', i); local path = formatUI('SERVER:PVP_EFFECTS:#1', i);
@ -611,7 +611,7 @@ function game:getPvpEffects()
end end
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
function game:getFactionName(id) function game:getFactionName(id)
if (id == self.TPVPClan.Kami) then if (id == self.TPVPClan.Kami) then
return i18n.get('uiFameKami'); return i18n.get('uiFameKami');
elseif (id == self.TPVPClan.Karavan) then elseif (id == self.TPVPClan.Karavan) then
@ -636,10 +636,10 @@ function game:getAllegiancePoints()
local civPoints = getDbProp(path .. ':CIV_POINTS'); local civPoints = getDbProp(path .. ':CIV_POINTS');
local cult = getDbProp(path .. ':CULT'); local cult = getDbProp(path .. ':CULT');
local cultPoints = getDbProp(path .. ':CULT_POINTS'); local cultPoints = getDbProp(path .. ':CULT_POINTS');
local text; local text;
local uiGroup= getUICaller(); local uiGroup= getUICaller();
-- civ allegiance -- civ allegiance
if (civ == self.TPVPClan.None or civ == self.TPVPClan.Neutral) then if (civ == self.TPVPClan.None or civ == self.TPVPClan.Neutral) then
text = i18n.get('uiPvpFameNoCivAllegiance'); text = i18n.get('uiPvpFameNoCivAllegiance');
@ -647,9 +647,9 @@ function game:getAllegiancePoints()
text = i18n.get('uiPvpFameAllegiancePoints'); text = i18n.get('uiPvpFameAllegiancePoints');
text = findReplaceAll(text, '%faction', self:getFactionName(civ)); text = findReplaceAll(text, '%faction', self:getFactionName(civ));
text = findReplaceAll(text, '%points', tostring(civPoints)); text = findReplaceAll(text, '%points', tostring(civPoints));
end end
uiGroup.civ_allegiance_pts.uc_hardtext_format = text; uiGroup.civ_allegiance_pts.uc_hardtext_format = text;
-- cult allegiance -- cult allegiance
if (cult == self.TPVPClan.None or cult == self.TPVPClan.Neutral) then if (cult == self.TPVPClan.None or cult == self.TPVPClan.Neutral) then
text = i18n.get('uiPvpFameNoCultAllegiance'); text = i18n.get('uiPvpFameNoCultAllegiance');
@ -698,11 +698,11 @@ function game:fameAllegianceTooltipCultGuild()
end end
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- --
function game:tooltipDeltaValue(base, max) function game:tooltipDeltaValue(base, max)
-- Calculate delta -- Calculate delta
local val = max - base; local val = max - base;
local text; local text;
if (val == 0) then if (val == 0) then
text = concatUCString('@{FFFF}', tostring(max)); text = concatUCString('@{FFFF}', tostring(max));
@ -729,37 +729,37 @@ function game:tooltipDeltaValue(base, max)
text = concatUCString(text, ')'); text = concatUCString(text, ')');
end end
end end
return text; return text;
end end
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- --
function game:tooltipScore(dbBase, dbMax, ttFormat) function game:tooltipScore(dbBase, dbMax, ttFormat)
-- Get DB values -- Get DB values
local base = getDbProp(dbBase); local base = getDbProp(dbBase);
local max = getDbProp(dbMax); local max = getDbProp(dbMax);
-- Tooltip text -- Tooltip text
local fmt = i18n.get(ttFormat); local fmt = i18n.get(ttFormat);
local text = self:tooltipDeltaValue(base, max); local text = self:tooltipDeltaValue(base, max);
fmt = findReplaceAll(fmt, "%n", text ); fmt = findReplaceAll(fmt, "%n", text );
-- Set tooltip -- Set tooltip
setContextHelpText(fmt); setContextHelpText(fmt);
end end
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- --
function game:tooltipScoreEP(dbBase, dbMax, ttFormat, dbLvl, dbMod) function game:tooltipScoreEP(dbBase, dbMax, ttFormat, dbLvl, dbMod)
-- Defender level -- Defender level
local defLvl= getDbProp(formatUI(dbLvl)); local defLvl= getDbProp(formatUI(dbLvl));
defLvl = math.max(0, defLvl); defLvl = math.max(0, defLvl);
-- Attacker level -- Attacker level
local attLvl = getBaseSkillValueMaxChildren(getSkillIdFromName('SF')); local attLvl = getBaseSkillValueMaxChildren(getSkillIdFromName('SF'));
-- Get DB values -- Get DB values
local base = getDbProp(dbBase); local base = getDbProp(dbBase);
local max = getDbProp(dbMax); local max = getDbProp(dbMax);
@ -774,7 +774,7 @@ function game:tooltipScoreEP(dbBase, dbMax, ttFormat, dbLvl, dbMod)
fmt = findReplaceAll(fmt, "%n", text ); fmt = findReplaceAll(fmt, "%n", text );
fmt = findReplaceAll(fmt, "%l", tostring(attLvl)); fmt = findReplaceAll(fmt, "%l", tostring(attLvl));
fmt = findReplaceAll(fmt, "%p", textChance); fmt = findReplaceAll(fmt, "%p", textChance);
-- Set tooltip -- Set tooltip
setContextHelpText(fmt); setContextHelpText(fmt);
end end
@ -786,7 +786,7 @@ end
---------------------------------- RING STATS --------------------------------------------------- ---------------------------------- RING STATS ---------------------------------------------------
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
RingPlayerInfo = RingPlayerInfo =
{ {
WaitingInfo = false, WaitingInfo = false,
LastRefreshTime = 0, LastRefreshTime = 0,
@ -810,7 +810,7 @@ end
-- --
function RingPlayerInfo:initRingStatPlayer() function RingPlayerInfo:initRingStatPlayer()
setOnDraw(self:getWindow(), "RingPlayerInfo:onRingRatingPlayerDraw()") setOnDraw(self:getWindow(), "RingPlayerInfo:onRingRatingPlayerDraw()")
end end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
@ -819,16 +819,16 @@ function RingPlayerInfo:onRingRatingPlayerDraw()
local timeInSec = nltime.getLocalTime() / 1000 local timeInSec = nltime.getLocalTime() / 1000
if self.WaitingInfo then if self.WaitingInfo then
if timeInSec - self.LastRefreshTime > self.WaitingPeriod then if timeInSec - self.LastRefreshTime > self.WaitingPeriod then
self.WaitingInfo = false self.WaitingInfo = false
self.LastRefreshTime = nltime.getLocalTime() / 1000 self.LastRefreshTime = nltime.getLocalTime() / 1000
else else
if not self.InfoReceived then if not self.InfoReceived then
--debugInfo("No received info") --debugInfo("No received info")
end end
end end
else else
if timeInSec - self.LastRefreshTime > self.RefreshPeriod then if timeInSec - self.LastRefreshTime > self.RefreshPeriod then
self:refresh() self:refresh()
else else
--debugInfo("pas de refresh") --debugInfo("pas de refresh")
@ -844,7 +844,7 @@ function RingPlayerInfo:updatePendingRefresh()
if self.PendingRefresh then if self.PendingRefresh then
local currTime = nltime.getLocalTime() / 1000 local currTime = nltime.getLocalTime() / 1000
if currTime - self.LastRefreshQuerryTime > self.MinRefreshPeriod and game.getRingStats then if currTime - self.LastRefreshQuerryTime > self.MinRefreshPeriod and game.getRingStats then
self.LastRefreshQuerryTime = currTime self.LastRefreshQuerryTime = currTime
self.PendingRefresh = false self.PendingRefresh = false
game.getRingStats() game.getRingStats()
@ -924,10 +924,10 @@ end
-- --
function RingPlayerInfo:refresh() function RingPlayerInfo:refresh()
self.PendingRefresh = true self.PendingRefresh = true
self.LastRefreshTime = nltime.getLocalTime() / 1000 self.LastRefreshTime = nltime.getLocalTime() / 1000
self.WaitingInfo = true self.WaitingInfo = true
end end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
-- --
@ -937,7 +937,7 @@ function RingPlayerInfo:tooltipEcosystemPoints(rp, maxRp, ttFormat)
local fmt = i18n.get(ttFormat); local fmt = i18n.get(ttFormat);
fmt = findReplaceAll(fmt, "%n", rp ); fmt = findReplaceAll(fmt, "%n", rp );
fmt = findReplaceAll(fmt, "%p", maxRp ); fmt = findReplaceAll(fmt, "%p", maxRp );
-- Set tooltip -- Set tooltip
return fmt; return fmt;
end end
@ -954,8 +954,8 @@ function RingPlayerInfo:updateRRPSLevel(dbVal, tooltip)
local ui= getUICaller(); local ui= getUICaller();
local uiText= ui.val; local uiText= ui.val;
-- set the text -- set the text
uiText.uc_hardtext= tostring(val) uiText.uc_hardtext= tostring(val)
self:tooltipRRPs(dbVal, tooltip) self:tooltipRRPs(dbVal, tooltip)
end end
@ -970,7 +970,7 @@ function RingPlayerInfo:tooltipRRPs(dbBase, ttFormat)
local fmt = i18n.get(ttFormat); local fmt = i18n.get(ttFormat);
local text = tostring(val) local text = tostring(val)
fmt = findReplaceAll(fmt, "%n", text ); fmt = findReplaceAll(fmt, "%n", text );
-- Set tooltip -- Set tooltip
setContextHelpText(fmt); setContextHelpText(fmt);
end end
@ -1013,7 +1013,7 @@ end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
-- --
function game:updateOrganization(path, uiOrgText, uiStatusText, uiPointsText) function game:updateOrganization(path, uiOrgText, uiStatusText, uiPointsText)
local org = getDbProp(path.."1:VALUE") local org = getDbProp(path.."1:VALUE")
getUICaller()[uiOrgText].uc_hardtext = i18n.get('uiOrganization_' .. org) getUICaller()[uiOrgText].uc_hardtext = i18n.get('uiOrganization_' .. org)
@ -1022,7 +1022,7 @@ function game:updateOrganization(path, uiOrgText, uiStatusText, uiPointsText)
local points = getDbProp(path.."3:VALUE") local points = getDbProp(path.."3:VALUE")
getUICaller()[uiPointsText].uc_hardtext= points getUICaller()[uiPointsText].uc_hardtext= points
end end
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
@ -1033,10 +1033,10 @@ end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
function game:popMissionList() function game:popMissionList()
local menu = getUI("ui:interface:mission_cb_menu") local menu = getUI("ui:interface:mission_cb_menu")
enableModalWindow(getUICaller(), "ui:interface:mission_cb_menu") enableModalWindow(getUICaller(), "ui:interface:mission_cb_menu")
self:updateMissionMenuSize() self:updateMissionMenuSize()
end end
@ -1053,12 +1053,12 @@ function game:getMissionDbPath(missionIndex)
return "SERVER:GROUP:MISSIONS:" .. tostring(missionIndex - numMissions) return "SERVER:GROUP:MISSIONS:" .. tostring(missionIndex - numMissions)
else else
return "SERVER:MISSIONS:" .. tostring(missionIndex) return "SERVER:MISSIONS:" .. tostring(missionIndex)
end end
end end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
function game:getCurrMissionIndex() function game:getCurrMissionIndex()
local result = getDbProp("UI:SAVE:MISSION_SELECTED") local result = getDbProp("UI:SAVE:MISSION_SELECTED")
return result return result
end end
@ -1071,10 +1071,10 @@ end
function game:updateCurrMissionComboBox() function game:updateCurrMissionComboBox()
local numMissions = tonumber(getDefine("ipj_nb_mission")) local numMissions = tonumber(getDefine("ipj_nb_mission"))
local missionFound = false local missionFound = false
local cb = getUI("ui:interface:info_player_journal:content:mission_combo") local cb = getUI("ui:interface:info_player_journal:content:mission_combo")
local missionList = getUI("ui:interface:info_player_journal:content:mission_list") local missionList = getUI("ui:interface:info_player_journal:content:mission_list")
for i = 0, numMissions - 1 do for i = 0, numMissions - 1 do
if getDbProp("SERVER:MISSIONS:" .. i .. ":TITLE") ~= 0 if getDbProp("SERVER:MISSIONS:" .. i .. ":TITLE") ~= 0
or getDbProp("SERVER:GROUP:MISSIONS:" .. i .. ":TITLE") ~= 0 then or getDbProp("SERVER:GROUP:MISSIONS:" .. i .. ":TITLE") ~= 0 then
missionFound = true missionFound = true
break break
@ -1095,20 +1095,20 @@ function game:updateCurrMissionComboBox()
missionList.no_available_mission.active = false missionList.no_available_mission.active = false
cb.arrow.active = true cb.arrow.active = true
cb.select.active = true cb.select.active = true
local currMission = self:getCurrMissionIndex() local currMission = self:getCurrMissionIndex()
local dbPath = self:getMissionDbPath(currMission) local dbPath = self:getMissionDbPath(currMission)
-- --
local selected = (currMission ~= -1) local selected = (currMission ~= -1)
if selected then if selected then
cb.mission_title.textid_dblink = dbPath .. ":TITLE" cb.mission_title.textid_dblink = dbPath .. ":TITLE"
selected = (tile ~= 0) selected = (tile ~= 0)
end end
cb.mission_ico.active = selected cb.mission_ico.active = selected
cb.mission_title.active = selected cb.mission_title.active = selected
cb.no_selected_mission.active = not selected cb.no_selected_mission.active = not selected
missionList.no_selected_mission.active = not selected missionList.no_selected_mission.active = not selected
if selected then if selected then
if getDbProp(dbPath .. ":FINISHED") == 0 then if getDbProp(dbPath .. ":FINISHED") == 0 then
cb.mission_ico.texture = runExpr("getMissionSmallIcon(" .. tostring(getDbProp(dbPath .. ":ICON") .. ")")) cb.mission_ico.texture = runExpr("getMissionSmallIcon(" .. tostring(getDbProp(dbPath .. ":ICON") .. ")"))
elseif getDbProp(dbPath .. ":FINISHED") == 1 then elseif getDbProp(dbPath .. ":FINISHED") == 1 then
@ -1116,17 +1116,17 @@ function game:updateCurrMissionComboBox()
else else
cb.mission_ico.texture = "Small_Task_Failed.tga" cb.mission_ico.texture = "Small_Task_Failed.tga"
end end
end end
end end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
function game:onMissionSelected(index) function game:onMissionSelected(index)
disableModalWindow() disableModalWindow()
self:updateCurrMissionComboBox() self:updateCurrMissionComboBox()
end end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
function game:onGroupMissionSelected(index) function game:onGroupMissionSelected(index)
disableModalWindow() disableModalWindow()
self:updateCurrMissionComboBox() self:updateCurrMissionComboBox()
end end
@ -1138,33 +1138,33 @@ function game:onMissionDBIndexChanged()
-- if selection was made from the list, update the other list -- if selection was made from the list, update the other list
if missionIndex >= self:getGroupMissionFirstIndex() then if missionIndex >= self:getGroupMissionFirstIndex() then
local groupMissionIndex = missionIndex - self:getGroupMissionFirstIndex() local groupMissionIndex = missionIndex - self:getGroupMissionFirstIndex()
getUI("ui:interface:info_player_journal:content:mission_list:b_group_title" .. tostring(groupMissionIndex)).pushed = true getUI("ui:interface:info_player_journal:content:mission_list:b_group_title" .. tostring(groupMissionIndex)).pushed = true
getUI("ui:interface:mission_cb_menu:mission_list:b_group_title" .. tostring(groupMissionIndex)).pushed = true getUI("ui:interface:mission_cb_menu:mission_list:b_group_title" .. tostring(groupMissionIndex)).pushed = true
else else
getUI("ui:interface:info_player_journal:content:mission_list:b_title" .. tostring(missionIndex)).pushed = true getUI("ui:interface:info_player_journal:content:mission_list:b_title" .. tostring(missionIndex)).pushed = true
getUI("ui:interface:mission_cb_menu:mission_list:b_title" .. tostring(missionIndex)).pushed = true getUI("ui:interface:mission_cb_menu:mission_list:b_title" .. tostring(missionIndex)).pushed = true
end end
end end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
function game:onMissionTitleChanged(index) function game:onMissionTitleChanged(index)
-- if title is not nil then a new mission has been added -> if db initilization is over, then selected this new mission -- if title is not nil then a new mission has been added -> if db initilization is over, then selected this new mission
if getDbProp(self:getMissionDbPath(index) .. ":TITLE") ~= 0 then if getDbProp(self:getMissionDbPath(index) .. ":TITLE") ~= 0 then
if game.InGameDbInitialized or config.Local then if game.InGameDbInitialized or config.Local then
self:setCurrentMission(index) self:setCurrentMission(index)
end end
else else
self:updateCurrMissionComboBox() self:updateCurrMissionComboBox()
self:updateMissionMenuSize() self:updateMissionMenuSize()
end end
end end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
function game:onGroupMissionTitleChanged(index) function game:onGroupMissionTitleChanged(index)
if getDbProp(self:getMissionDbPath(index + 15) .. ":TITLE") ~= 0 then if getDbProp(self:getMissionDbPath(index + 15) .. ":TITLE") ~= 0 then
if game.InGameDbInitialized or config.Local then if game.InGameDbInitialized or config.Local then
self:setCurrentMission(index + 15) self:setCurrentMission(index + 15)
end end
else else
self:updateCurrMissionComboBox() self:updateCurrMissionComboBox()
self:updateMissionMenuSize() self:updateMissionMenuSize()
end end
@ -1174,21 +1174,21 @@ end
function game:updateMissionMenuSize() function game:updateMissionMenuSize()
local parentCB = getUI("ui:interface:info_player_journal:content:mission_combo") local parentCB = getUI("ui:interface:info_player_journal:content:mission_combo")
local menu = getUI("ui:interface:mission_cb_menu") local menu = getUI("ui:interface:mission_cb_menu")
if not menu.active then return end if not menu.active then return end
local maxNumMissions = 2 * self:getGroupMissionFirstIndex() local maxNumMissions = 2 * self:getGroupMissionFirstIndex()
local missionCount = 0 local missionCount = 0
for k = 0, maxNumMissions - 1 do for k = 0, maxNumMissions - 1 do
if getDbProp(self:getMissionDbPath(k) .. ":TITLE") ~= 0 then if getDbProp(self:getMissionDbPath(k) .. ":TITLE") ~= 0 then
missionCount = missionCount + 1 missionCount = missionCount + 1
end end
end end
menu.h = 8 + missionCount * 18 menu.h = 8 + missionCount * 18
menu.y = 0 menu.y = 0
menu:updateCoords() menu:updateCoords()
local y = parentCB.y_real - menu.h_real - 1 local y = parentCB.y_real - menu.h_real - 1
if y < 0 then if y < 0 then
y = parentCB.y_real + parentCB.h_real + 1 y = parentCB.y_real + parentCB.h_real + 1
end end
local scrW local scrW
local scrH local scrH
scrW, scrH = getWindowSize() scrW, scrH = getWindowSize()
@ -1197,7 +1197,7 @@ function game:updateMissionMenuSize()
end end
menu.w = parentCB.w_real menu.w = parentCB.w_real
menu.y = y menu.y = y
menu.x = parentCB.x_real menu.x = parentCB.x_real
menu.h = 8 + missionCount * 18 menu.h = 8 + missionCount * 18
menu:invalidateCoords() menu:invalidateCoords()
end end
@ -1205,7 +1205,7 @@ end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
--function game:updateMissionDescCloseButton(index) --function game:updateMissionDescCloseButton(index)
-- local dbPath = self:getMissionDbPath(index) -- local dbPath = self:getMissionDbPath(index)
-- if index == self:getCurrMissionIndex() then -- if index == self:getCurrMissionIndex() then
-- local closeText = getUI("ui:interface:info_player_journal:content:desc:close") -- local closeText = getUI("ui:interface:info_player_journal:content:desc:close")
-- local button = getUI("ui:interface:info_player_journal:content:desc:uppart:over_icon") -- local button = getUI("ui:interface:info_player_journal:content:desc:uppart:over_icon")
-- local finished = getDbProp(dbPath .. ":FINISHED") -- local finished = getDbProp(dbPath .. ":FINISHED")
@ -1224,29 +1224,29 @@ end
--end --end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
function game:onMissionFinished(index) function game:onMissionFinished(index)
self:updateCurrMissionComboBox() self:updateCurrMissionComboBox()
--self:updateMissionDescCloseButton(index) --self:updateMissionDescCloseButton(index)
end end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
function game:onGroupMissionFinished(index) function game:onGroupMissionFinished(index)
self:updateCurrMissionComboBox() self:updateCurrMissionComboBox()
--self:updateMissionDescCloseButton(index + game:getGroupMissionFirstIndex()) --self:updateMissionDescCloseButton(index + game:getGroupMissionFirstIndex())
end end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
function game:expandMissionList() function game:expandMissionList()
local missionCB = getUI("ui:interface:info_player_journal:content:mission_combo") local missionCB = getUI("ui:interface:info_player_journal:content:mission_combo")
missionCB.active = not missionCB.active missionCB.active = not missionCB.active
self:updateMissionWindowLayout() self:updateMissionWindowLayout()
end end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
function game:updateMissionWindowLayout() function game:updateMissionWindowLayout()
if not isInRingMode() then if not isInRingMode() then
local missionCB = getUI("ui:interface:info_player_journal:content:mission_combo") local missionCB = getUI("ui:interface:info_player_journal:content:mission_combo")
local missionList = getUI("ui:interface:info_player_journal:content:mission_list") local missionList = getUI("ui:interface:info_player_journal:content:mission_list")
local fake = getUI("ui:interface:info_player_journal:content:fake") local fake = getUI("ui:interface:info_player_journal:content:fake")
local sepBis = getUI("ui:interface:info_player_journal:content:separator_bis") local sepBis = getUI("ui:interface:info_player_journal:content:separator_bis")
local desc = getUI("ui:interface:info_player_journal:content:desc") local desc = getUI("ui:interface:info_player_journal:content:desc")
@ -1254,18 +1254,18 @@ function game:updateMissionWindowLayout()
local popMinH local popMinH
local win = getUI("ui:interface:info_player_journal") local win = getUI("ui:interface:info_player_journal")
if missionCB.active then if missionCB.active then
sepBis.active = false sepBis.active = false
missionList.active = false missionList.active = false
fake.sizeref="" fake.sizeref=""
fake.y = -32 fake.y = -32
fake.h = 0 fake.h = 0
expanded = 0 expanded = 0
desc.max_sizeref ="wh" desc.max_sizeref ="wh"
desc.max_h= -42 desc.max_h= -42
win.pop_min_h = 152 - win.content_y_offset win.pop_min_h = 152 - win.content_y_offset
else else
sepBis.active = true sepBis.active = true
missionList.active = true missionList.active = true
fake.sizeref="wh5" fake.sizeref="wh5"
fake.y = -8 fake.y = -8
@ -1274,23 +1274,23 @@ function game:updateMissionWindowLayout()
desc.max_sizeref ="wh5" desc.max_sizeref ="wh5"
desc.max_h=16 desc.max_h=16
win.pop_min_h = 152 - win.content_y_offset win.pop_min_h = 152 - win.content_y_offset
end end
local fixedEntry = getUI("ui:interface:info_player_journal:content:mission_fixed_entry") local fixedEntry = getUI("ui:interface:info_player_journal:content:mission_fixed_entry")
fixedEntry:updateCoords() fixedEntry:updateCoords()
desc.max_h = desc.max_h - fixedEntry.h desc.max_h = desc.max_h - fixedEntry.h
setDbProp("UI:SAVE:EXPAND_MISSION_LIST", expanded) setDbProp("UI:SAVE:EXPAND_MISSION_LIST", expanded)
getUI("ui:interface:info_player_journal"):invalidateCoords() getUI("ui:interface:info_player_journal"):invalidateCoords()
end end
end end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
function game:onMissionJournalOpened() function game:onMissionJournalOpened()
local missionDesc = getUI("ui:interface:info_player_journal:content:desc") local missionDesc = getUI("ui:interface:info_player_journal:content:desc")
missionDesc.active = getDbProp("UI:SAVE:MISSION_SELECTED") ~= -1 missionDesc.active = getDbProp("UI:SAVE:MISSION_SELECTED") ~= -1
local expandList = getDbProp("UI:SAVE:EXPAND_MISSION_LIST") local expandList = getDbProp("UI:SAVE:EXPAND_MISSION_LIST")
self:updateMissionJournalMode() self:updateMissionJournalMode()
if not isInRingMode() then if not isInRingMode() then
@ -1304,9 +1304,9 @@ function game:onMissionJournalOpened()
self:updateMissionJournalHeader() self:updateMissionJournalHeader()
self:updateMissionWindowLayout() self:updateMissionWindowLayout()
self:updateMissionJournalFixedEntry() self:updateMissionJournalFixedEntry()
end end
@ -1315,12 +1315,12 @@ function game:updateMissionJournalHeader()
local win = getUI("ui:interface:info_player_journal") local win = getUI("ui:interface:info_player_journal")
local headerActive = getDbProp("UI:SAVE:MISSION_JOURNAL_HEADER_ACTIVE") ~= 0 local headerActive = getDbProp("UI:SAVE:MISSION_JOURNAL_HEADER_ACTIVE") ~= 0
win.header_active = headerActive win.header_active = headerActive
win.right_button_enabled = headerActive win.right_button_enabled = headerActive
if headerActive then if headerActive then
win.uc_title_opened = i18n.get("uiJournalTitle") win.uc_title_opened = i18n.get("uiJournalTitle")
win.content_y_offset = 0 win.content_y_offset = 0
else else
win.uc_title_opened = ucstring("") win.uc_title_opened = ucstring("")
win.content_y_offset = win.header_opened.h_real + 3 win.content_y_offset = win.header_opened.h_real + 3
end end
end end
@ -1329,13 +1329,13 @@ end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
function game:updateMissionJournalFixedEntry() function game:updateMissionJournalFixedEntry()
-- update fixed entry text -- update fixed entry text
local fixedEntryRing = getUI("ui:interface:info_player_journal:no_available_missions:main:mission_fixed_entry") local fixedEntryRing = getUI("ui:interface:info_player_journal:no_available_missions:main:mission_fixed_entry")
local fixedEntryMain = getUI("ui:interface:info_player_journal:content:mission_fixed_entry") local fixedEntryMain = getUI("ui:interface:info_player_journal:content:mission_fixed_entry")
fixedEntryRing.active = game.InGameDbInitialized and isInRingMode() fixedEntryRing.active = game.InGameDbInitialized and isInRingMode()
fixedEntryMain.active = game.InGameDbInitialized and not isInRingMode() fixedEntryMain.active = game.InGameDbInitialized and not isInRingMode()
local id = "uiFixedMissionEntry" local id = "uiFixedMissionEntry"
@ -1346,22 +1346,22 @@ function game:updateMissionJournalFixedEntry()
end end
if isPlayerFreeTrial() then if isPlayerFreeTrial() then
id = id .. "_Trial" id = id .. "_Trial"
end end
else else
if isInRingMode() then if isInRingMode() then
id = id .. "_R2" id = id .. "_R2"
else else
id = id .. "_Mainland_" .. getUserRace() id = id .. "_Mainland_" .. getUserRace()
end end
end end
fixedEntryMain.uc_hardtext = i18n.get(id) fixedEntryMain.uc_hardtext = i18n.get(id)
fixedEntryRing.uc_hardtext = i18n.get(id) fixedEntryRing.uc_hardtext = i18n.get(id)
self:updateMissionWindowLayout() self:updateMissionWindowLayout()
end end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
function game:setCurrentMission(index) function game:setCurrentMission(index)
mw = getMissionWindow() mw = getMissionWindow()
mw.active = game.InGameDbInitialized mw.active = game.InGameDbInitialized
if index < self:getGroupMissionFirstIndex() then if index < self:getGroupMissionFirstIndex() then
@ -1372,7 +1372,7 @@ function game:setCurrentMission(index)
end end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
function game:onMissionComboWheelUp() function game:onMissionComboWheelUp()
local currMissionIndex = self:getCurrMissionIndex() local currMissionIndex = self:getCurrMissionIndex()
while currMissionIndex > 0 do while currMissionIndex > 0 do
currMissionIndex = currMissionIndex - 1 currMissionIndex = currMissionIndex - 1
@ -1384,7 +1384,7 @@ function game:onMissionComboWheelUp()
end end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
function game:onMissionComboWheelDown() function game:onMissionComboWheelDown()
local currMissionIndex = self:getCurrMissionIndex() local currMissionIndex = self:getCurrMissionIndex()
local maxNumMission = 2 * self:getGroupMissionFirstIndex() local maxNumMission = 2 * self:getGroupMissionFirstIndex()
while currMissionIndex < (maxNumMission - 1) do while currMissionIndex < (maxNumMission - 1) do
@ -1399,37 +1399,37 @@ end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
function game:toggleMissionJournalCaption() function game:toggleMissionJournalCaption()
local dbPath = "UI:SAVE:MISSION_JOURNAL_HEADER_ACTIVE" local dbPath = "UI:SAVE:MISSION_JOURNAL_HEADER_ACTIVE"
setDbProp(dbPath, 1 - getDbProp(dbPath)) setDbProp(dbPath, 1 - getDbProp(dbPath))
local win = getUI("ui:interface:info_player_journal") local win = getUI("ui:interface:info_player_journal")
self:updateMissionJournalHeader() self:updateMissionJournalHeader()
self:updateMissionWindowLayout() self:updateMissionWindowLayout()
end end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
-- handler called by C++ to tell that the main loop is about to begin -- handler called by C++ to tell that the main loop is about to begin
function game:onMainLoopBegin() function game:onMainLoopBegin()
game.InGameDbInitialized = false game.InGameDbInitialized = false
game.PrevSessionMission = getDbProp("UI:VARIABLES:MISSION_SELECTED_PREV_SESSION") game.PrevSessionMission = getDbProp("UI:VARIABLES:MISSION_SELECTED_PREV_SESSION")
debugInfo("onMainLoopBegin()") debugInfo("onMainLoopBegin()")
end end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
-- handler called by C++ to tell that all initial value have been set in the db -- handler called by C++ to tell that all initial value have been set in the db
function game:onInGameDbInitialized() function game:onInGameDbInitialized()
game.InGameDbInitialized = true game.InGameDbInitialized = true
-- if the journal is opened, force an update for the fixed entry text -- if the journal is opened, force an update for the fixed entry text
-- (says if we're in start island, paying account ...) need DB flags like -- (says if we're in start island, paying account ...) need DB flags like
-- IS_NEWBIE & IS_TRIAL to be received -- IS_NEWBIE & IS_TRIAL to be received
game:updateMissionJournalFixedEntry() game:updateMissionJournalFixedEntry()
-- If a mission was previously selected, restore it -- If a mission was previously selected, restore it
if game.PrevSessionMission ~= -1 then if game.PrevSessionMission ~= -1 then
self:setCurrentMission(game.PrevSessionMission) self:setCurrentMission(game.PrevSessionMission)
end end
game:setInfoPlayerCharacterRace() game:setInfoPlayerCharacterRace()
end end
@ -1437,7 +1437,7 @@ function game:onWebIgReady()
-- Call init webig -- Call init webig
getUI("ui:interface:web_transactions:content:html"):browse("home") getUI("ui:interface:web_transactions:content:html"):browse("home")
getUI("ui:interface:webig:content:html"):browse("home") getUI("ui:interface:webig:content:html"):browse("home")
end end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
@ -1464,7 +1464,7 @@ end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
-- ring journal on / off -- ring journal on / off
function game:setMissionJournalRingMode(isRing) function game:setMissionJournalRingMode(isRing)
local journal = getUI("ui:interface:info_player_journal") local journal = getUI("ui:interface:info_player_journal")
if isRing then if isRing then
journal.content.expand_mission_list.active = false journal.content.expand_mission_list.active = false
@ -1480,7 +1480,7 @@ function game:setMissionJournalRingMode(isRing)
journal.no_available_missions.active = true journal.no_available_missions.active = true
else else
journal.content.expand_mission_list.active = true journal.content.expand_mission_list.active = true
journal.no_available_missions.active = false; journal.no_available_missions.active = false;
journal.content.active = true; journal.content.active = true;
--journal.content.mission_list.active = true; --journal.content.mission_list.active = true;
journal.content.sv.active = true; journal.content.sv.active = true;
@ -1494,8 +1494,8 @@ end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
-- update mission journal depending on wether we're in the ring or not -- update mission journal depending on wether we're in the ring or not
function game:updateMissionJournalMode() function game:updateMissionJournalMode()
--local isRing = r2~=nil and r2.Mode~=nil and r2.Mode=='r2ed_anim_test' --local isRing = r2~=nil and r2.Mode~=nil and r2.Mode=='r2ed_anim_test'
game:setMissionJournalRingMode(isInRingMode()) game:setMissionJournalRingMode(isInRingMode())
end end
@ -1521,22 +1521,22 @@ function game:onNewMissionStepAdded(stepIndex)
end end
-- debugInfo("New Step") -- debugInfo("New Step")
if missionIndex < 15 then if missionIndex < 15 then
dbPath = "SERVER:MISSIONS:" .. tostring(missionIndex) .. ":GOALS:" .. tostring(stepIndex) .. ":TEXT" dbPath = "SERVER:MISSIONS:" .. tostring(missionIndex) .. ":GOALS:" .. tostring(stepIndex) .. ":TEXT"
else else
dbPath = "SERVER:GROUP:MISSIONS:" .. tostring(missionIndex - 15) .. ":GOALS:" .. tostring(stepIndex) .. ":TEXT" dbPath = "SERVER:GROUP:MISSIONS:" .. tostring(missionIndex - 15) .. ":GOALS:" .. tostring(stepIndex) .. ":TEXT"
end end
local stringID = getDbProp(dbPath) local stringID = getDbProp(dbPath)
if stringID ~= 0 then if stringID ~= 0 then
-- debugInfo(tostring(stringID)) -- debugInfo(tostring(stringID))
table.insert(remainingMissionTextIDs, stringID) table.insert(remainingMissionTextIDs, stringID)
setOnDraw(missionWnd, "game:ensureLastMissionStepVisibility0()") setOnDraw(missionWnd, "game:ensureLastMissionStepVisibility0()")
else else
end end
end end
function game:ensureLastMissionStepVisibility0() function game:ensureLastMissionStepVisibility0()
local missing = false local missing = false
for k, v in pairs(remainingMissionTextIDs) do for k, v in pairs(remainingMissionTextIDs) do
if not isDynStringAvailable(v) then if not isDynStringAvailable(v) then
@ -1545,54 +1545,54 @@ function game:ensureLastMissionStepVisibility0()
end end
end end
local missionWnd = getMissionWindow() local missionWnd = getMissionWindow()
if not missing then if not missing then
remainingMissionTextIDs = {} remainingMissionTextIDs = {}
-- delay real update to newt frame -- delay real update to newt frame
setOnDraw(missionWnd, "game:ensureLastMissionStepVisibility1()") setOnDraw(missionWnd, "game:ensureLastMissionStepVisibility1()")
else else
-- for debug : dump the list of remaining "dyn string" -- for debug : dump the list of remaining "dyn string"
--local stringList = "{" --local stringList = "{"
--for k, v in remainingMissionTextIDs do --for k, v in remainingMissionTextIDs do
-- if not isDynStringAvailable(v) then -- if not isDynStringAvailable(v) then
-- stringList = stringList .. " " .. tostring(v) -- stringList = stringList .. " " .. tostring(v)
-- end -- end
--end --end
--stringList = stringList .. "}" --stringList = stringList .. "}"
end end
end end
function game:ensureLastMissionStepVisibility1() function game:ensureLastMissionStepVisibility1()
local missionWnd = getMissionWindow() local missionWnd = getMissionWindow()
local scrollBar = missionWnd:find("sv_desc") local scrollBar = missionWnd:find("sv_desc")
--scrollBar.trackPos = 20000 -- move upward --scrollBar.trackPos = 20000 -- move upward
--scrollBar:updateCoords() --scrollBar:updateCoords()
--setOnDraw(missionWnd, "") --setOnDraw(missionWnd, "")
local descWnd = missionWnd:find("desc") local descWnd = missionWnd:find("desc")
local maxNumSteps = getDefine("ipj_nb_goal") local maxNumSteps = getDefine("ipj_nb_goal")
local topStep local topStep
for stepIndex = 0, maxNumSteps -1 do for stepIndex = 0, maxNumSteps -1 do
local currStep = descWnd["step" .. tostring(stepIndex)] local currStep = descWnd["step" .. tostring(stepIndex)]
if currStep.active then if currStep.active then
topStep = currStep topStep = currStep
end end
end end
-- debugInfo("Found step : " .. topStep.hardtext) -- debugInfo("Found step : " .. topStep.hardtext)
if topStep == nil then if topStep == nil then
return return
end end
scrollBar:ensureVisible(topStep, "M", "M") scrollBar:ensureVisible(topStep, "M", "M")
--local wantedY = topStep.h_real / 2 - (descWnd.y_real - topStep.y_real) --local wantedY = topStep.h_real / 2 - (descWnd.y_real - topStep.y_real)
--local wantedY = descWnd.y_real + descWnd.h_real - topStep.y_real --local wantedY = descWnd.y_real + descWnd.h_real - topStep.y_real
--local offsetY = wantedY - descWnd.max_h_real / 2 --local offsetY = wantedY - descWnd.max_h_real / 2
--if offsetY < 0 then offsetY = 0 end --if offsetY < 0 then offsetY = 0 end
--descWnd.ofsy = offsetY --descWnd.ofsy = offsetY
--descWnd:invalidateCoords() --descWnd:invalidateCoords()
--descWnd:updateCoords() --descWnd:updateCoords()
setOnDraw(missionWnd, "") setOnDraw(missionWnd, "")
end end
-------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------
@ -1606,9 +1606,9 @@ end
function game:addRpJob(jobtype, id, value, rpjobs) function game:addRpJob(jobtype, id, value, rpjobs)
local base_path = "ui:interface:info_player_skills:content:rpjobs:rpjob_"..jobtype.."_"..id..":rpjob_"..jobtype.."_infos_"..id local base_path = "ui:interface:info_player_skills:content:rpjobs:rpjob_"..jobtype.."_"..id..":rpjob_"..jobtype.."_infos_"..id
local group = getUI("ui:interface:info_player_skills:content:rpjobs:rpjob_"..jobtype.."_"..id) local group = getUI("ui:interface:info_player_skills:content:rpjobs:rpjob_"..jobtype.."_"..id)
if (value == nil) then if (value == nil) then
group.active = false group.active = false
else else
@ -1618,16 +1618,16 @@ function game:addRpJob(jobtype, id, value, rpjobs)
group.active = false group.active = false
else else
group.active = true group.active = true
local echelon_value = rpjobs[sitem][1] local echelon_value = rpjobs[sitem][1]
local quantity = rpjobs[sitem][2] local quantity = rpjobs[sitem][2]
local maxlevel = (echelon_value*6)-30 local maxlevel = (echelon_value*6)-30
if (quantity > maxlevel) then if (quantity > maxlevel) then
quantity = maxlevel quantity = maxlevel
end end
local base = getUI(base_path..":t") local base = getUI(base_path..":t")
base.hardtext = i18n.get(name):toUtf8() base.hardtext = i18n.get(name):toUtf8()
local ui = getUI(base_path..":icon") local ui = getUI(base_path..":icon")
@ -1657,7 +1657,7 @@ function game:getRPJobs()
rpjobs_elementary = {} rpjobs_elementary = {}
rpjobs_roleplay = {} rpjobs_roleplay = {}
rpjobs = {} rpjobs = {}
for i = 0, 499, 1 do for i = 0, 499, 1 do
local sheet = getDbProp("SERVER:INVENTORY:BAG:"..tostring(i)..":SHEET") local sheet = getDbProp("SERVER:INVENTORY:BAG:"..tostring(i)..":SHEET")
if (sheet ~= 0) then if (sheet ~= 0) then
@ -1665,7 +1665,7 @@ function game:getRPJobs()
if (string.sub(name, 0, 6) == "rpjob_") then if (string.sub(name, 0, 6) == "rpjob_") then
local quality = getDbProp("SERVER:INVENTORY:BAG:"..tostring(i)..":QUALITY") local quality = getDbProp("SERVER:INVENTORY:BAG:"..tostring(i)..":QUALITY")
local quantity = getDbProp("SERVER:INVENTORY:BAG:"..tostring(i)..":QUANTITY") local quantity = getDbProp("SERVER:INVENTORY:BAG:"..tostring(i)..":QUANTITY")
if (name == "rpjob_advanced.sitem") then if (name == "rpjob_advanced.sitem") then
table.insert(rpjobs_advanced, quality) table.insert(rpjobs_advanced, quality)
else else
@ -1688,7 +1688,7 @@ function game:getRPJobs()
end end
end end
end end
for id=1,2,1 do for id=1,2,1 do
game:addRpJob("advanced", id, rpjobs_advanced[id], rpjobs) game:addRpJob("advanced", id, rpjobs_advanced[id], rpjobs)
end end

View file

@ -3,8 +3,8 @@
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- create the game namespace without reseting if already created in an other file. -- create the game namespace without reseting if already created in an other file.
if (outgame==nil) then if (outgame == nil) then
outgame= {}; outgame = {}
end end
@ -20,15 +20,13 @@ end
-- Fyros -- Fyros
function outgame:getFyrosFirstName() function outgame:getFyrosFirstName()
local nbFyrosFirstNames = 0; local nbFyrosFirstNames = #fyrosFirstNames
for _ in pairs(fyrosFirstNames) do nbFyrosFirstNames = nbFyrosFirstNames + 1 end
return fyrosFirstNames[math.random(nbFyrosFirstNames)] return fyrosFirstNames[math.random(nbFyrosFirstNames)]
end end
function outgame:getFyrosLastName() function outgame:getFyrosLastName()
local nbFyrosLastNames = 0; local nbFyrosLastNames = #fyrosLastNames
for _ in pairs(fyrosLastNames) do nbFyrosLastNames = nbFyrosLastNames + 1 end
return fyrosLastNames[math.random(nbFyrosLastNames)] return fyrosLastNames[math.random(nbFyrosLastNames)]
end end
@ -36,98 +34,97 @@ end
-- Matis -- Matis
function outgame:getMatisFirstName(sex) function outgame:getMatisFirstName(sex)
-- 1 = male, 2 = female -- 1 = male, 2 = female
local dbNameSex = getDbProp("UI:TEMP:NAME_SEX"); local dbNameSex = getDbProp("UI:TEMP:NAME_SEX")
if sex ~= nil then if sex ~= nil then
dbNameSex = sex; dbNameSex = sex
end end
local FirstName = "" local FirstName = ""
if tonumber(dbNameSex) == 1 then if tonumber(dbNameSex) == 1 then
local nbMatisMaleFirstNames = 0; local nbMatisMaleFirstNames = #matisMaleFirstNames
for _ in pairs(matisMaleFirstNames) do nbMatisMaleFirstNames = nbMatisMaleFirstNames + 1 end FirstName = matisMaleFirstNames[math.random(nbMatisMaleFirstNames)]
FirstName = matisMaleFirstNames[math.random(nbMatisMaleFirstNames)];
else else
local nbMatisFemaleFirstNames = 0; local nbMatisFemaleFirstNames = #matisFemaleFirstNames
for _ in pairs(matisFemaleFirstNames) do nbMatisFemaleFirstNames = nbMatisFemaleFirstNames + 1 end FirstName = matisFemaleFirstNames[math.random(nbMatisFemaleFirstNames)]
FirstName = matisFemaleFirstNames[math.random(nbMatisFemaleFirstNames)];
end end
return FirstName; return FirstName
end end
function outgame:getMatisLastName() function outgame:getMatisLastName()
local nbMatisLastNames = #matisLastNames
local nbMatisLastNames = 0;
for _ in pairs(matisLastNames) do nbMatisLastNames = nbMatisLastNames + 1 end
return matisLastNames[math.random(nbMatisLastNames)] return matisLastNames[math.random(nbMatisLastNames)]
end end
-- Tryker -- Tryker
function outgame:getTrykerFirstName() function outgame:getTrykerFirstName()
local nbTrykerFirstNames = 0; local nbTrykerFirstNames = #trykerFirstNames
for _ in pairs(trykerFirstNames) do nbTrykerFirstNames = nbTrykerFirstNames + 1 end
return trykerFirstNames[math.random(nbTrykerFirstNames)] return trykerFirstNames[math.random(nbTrykerFirstNames)]
end end
function outgame:getTrykerLastName() function outgame:getTrykerLastName()
local nbTrykerLastNames = 0; local nbTrykerLastNames = #trykerLastNames
for _ in pairs(trykerLastNames) do nbTrykerLastNames = nbTrykerLastNames + 1 end
return trykerLastNames[math.random(nbTrykerLastNames)] return trykerLastNames[math.random(nbTrykerLastNames)]
end end
-- Zoraï -- Zoraï
function outgame:getZoraiFirstName() function outgame:getZoraiFirstName()
local nbFirstNamesOne = 0; local nbFirstNamesOne = #zoraiFirstNamesOne
for _ in pairs(zoraiFirstNamesOne) do nbFirstNamesOne = nbFirstNamesOne + 1 end local FirstNameOne = zoraiFirstNamesOne[math.random(nbFirstNamesOne)]
local FirstNameOne = zoraiFirstNamesOne[math.random(nbFirstNamesOne)];
local nbFirstNamesTwo = 0; local nbFirstNamesTwo = #zoraiFirstNamesTwo
for _ in pairs(zoraiFirstNamesTwo) do nbFirstNamesTwo = nbFirstNamesTwo + 1 end local FirstNameTwo = zoraiFirstNamesTwo[math.random(nbFirstNamesTwo)]
local FirstNameTwo = zoraiFirstNamesTwo[math.random(nbFirstNamesTwo)];
return FirstNameOne .. "-" .. FirstNameTwo return FirstNameOne .. "-" .. FirstNameTwo
end end
function outgame:getZoraiLastName() function outgame:getZoraiLastName()
local nbLastNames = 0; local nbLastNames = #zoraiLastNames
for _ in pairs(zoraiLastNames) do nbLastNames = nbLastNames + 1 end
return zoraiLastNames[math.random(nbLastNames)] return zoraiLastNames[math.random(nbLastNames)]
end end
function outgame:procGenerateName() function outgame:procGenerateName()
local uiNameFull = getUI("ui:outgame:appear_name:name_full"); local uiNameFull = getUI("ui:outgame:appear_name:name_full")
local uiGenText = getUI("ui:outgame:appear_name:eb"); local uiGenText = getUI("ui:outgame:appear_name:eb")
local dbNameRace = getDbProp("UI:TEMP:NAME_RACE"); local dbNameRace = getDbProp("UI:TEMP:NAME_RACE")
local dbNameSubRaceFirstName = getDbProp("UI:TEMP:NAME_SUB_RACE_FIRST_NAME"); local dbNameSubRaceFirstName = getDbProp("UI:TEMP:NAME_SUB_RACE_FIRST_NAME")
local dbNameSubRaceLastName = getDbProp("UI:TEMP:NAME_SUB_RACE_LAST_NAME"); local dbNameSubRaceLastName = getDbProp("UI:TEMP:NAME_SUB_RACE_LAST_NAME")
local nameResult = ""; local nameResult = ""
local fullnameResult = ""; local fullnameResult = ""
-- Look at outgame:procUpdateNameRaceLabel() for the "race" list. -- Look at outgame:procUpdateNameRaceLabel() for the "race" list.
-- fy ma try zo --> -- fy ma try zo -->
local firstName = "test2" local firstName = "test2"
local lastName = "test" local lastName = "test"
-- Fyros and Matis are using "first name, last name" order
-- Trykers and Zoraïs are using "last name, first name" order
if tonumber(dbNameRace) == 1 then if tonumber(dbNameRace) == 1 then
-- Fyros -- Fyros
firstName = self:getFyrosFirstName() firstName = self:getFyrosFirstName()
lastName = self:getFyrosLastName() lastName = self:getFyrosLastName()
fullnameResult = firstName .. " " .. lastName
elseif tonumber(dbNameRace) == 2 then elseif tonumber(dbNameRace) == 2 then
-- Matis -- Matis
firstName = self:getMatisFirstName() firstName = self:getMatisFirstName()
lastName = self:getMatisLastName() lastName = self:getMatisLastName()
fullnameResult = firstName .. " " .. lastName
elseif tonumber(dbNameRace) == 3 then elseif tonumber(dbNameRace) == 3 then
-- Tryker -- Tryker
firstName = self:getTrykerFirstName() firstName = self:getTrykerFirstName()
lastName = self:getTrykerLastName() lastName = self:getTrykerLastName()
fullnameResult = lastName .. " " .. firstName
elseif tonumber(dbNameRace) == 4 then elseif tonumber(dbNameRace) == 4 then
-- Zorai -- Zorai
firstName = self:getZoraiFirstName() firstName = self:getZoraiFirstName()
lastName = self:getZoraiLastName() lastName = self:getZoraiLastName()
fullnameResult = lastName .. " " .. firstName
elseif tonumber(dbNameRace) == 5 then elseif tonumber(dbNameRace) == 5 then
-- Maraudeurs -- Maraudeurs
@ -163,97 +160,99 @@ function outgame:procGenerateName()
-- Zorai -- Zorai
lastName = self:getZoraiLastName() lastName = self:getZoraiLastName()
end end
fullnameResult = firstName .. " " .. lastName
end end
fullnameResult = firstName .. " " .. lastName -- always use first name for character name
nameResult = firstName nameResult = firstName
uiNameFull.hardtext = fullnameResult; uiNameFull.hardtext = fullnameResult
nameResult = string.gsub(nameResult, "'", ""); nameResult = string.gsub(nameResult, "'", "")
nameResult = string.gsub(nameResult, " ", ""); nameResult = string.gsub(nameResult, " ", "")
nameResult = string.gsub(nameResult, "-", ""); nameResult = string.gsub(nameResult, "-", "")
nameResult = string.lower( nameResult ); nameResult = string.lower(nameResult)
nameResult = nameResult:gsub("^%l", string.upper); nameResult = nameResult:gsub("^%l", string.upper)
uiGenText.input_string = nameResult; uiGenText.input_string = nameResult
end end
-- Name sex slider update. -- Name sex slider update.
function outgame:procUpdateNameSexLabel() function outgame:procUpdateNameSexLabel()
local nameSexType = { "uiCP_Sex_Male", "uiCP_Sex_Female" } local nameSexType = { "uiCP_Sex_Male", "uiCP_Sex_Female" }
local uiNameSexText = getUI("ui:outgame:appear_name:name_sex_slider:name_sex"); local uiNameSexText = getUI("ui:outgame:appear_name:name_sex_slider:name_sex")
local uiNameSex = getDbProp("UI:TEMP:NAME_SEX"); local uiNameSex = getDbProp("UI:TEMP:NAME_SEX")
tempstr = tostring(i18n.get(nameSexType[tonumber(uiNameSex)])); tempstr = tostring(i18n.get(nameSexType[tonumber(uiNameSex)]))
tempstr = string.lower(tempstr); tempstr = string.lower(tempstr)
tempstr = (tempstr:gsub("^%l", string.upper)); tempstr = (tempstr:gsub("^%l", string.upper))
uiNameSexText.hardtext = tempstr; uiNameSexText.hardtext = tempstr
end end
-- Name race slider update. -- Name race slider update.
function outgame:procUpdateNameRaceLabel() function outgame:procUpdateNameRaceLabel()
local nameRaceType = { "Fyros", "Matis", "Tryker", "Zoraï", "uiCP_Maraudeur" } local nameRaceType = { "Fyros", "Matis", "Tryker", "Zoraï", "uiCP_Maraudeur" }
local uiNameRaceText = getUI("ui:outgame:appear_name:name_race_slider:name_race"); local uiNameRaceText = getUI("ui:outgame:appear_name:name_race_slider:name_race")
local dbNameRace = getDbProp("UI:TEMP:NAME_RACE"); local dbNameRace = getDbProp("UI:TEMP:NAME_RACE")
local uiNameSexSlider = getUI("ui:outgame:appear_name:name_sex_slider"); local uiNameSexSlider = getUI("ui:outgame:appear_name:name_sex_slider")
local uiNameSubRaceFirstNameSlider = getUI("ui:outgame:appear_name:name_sub_race_first_name_slider"); local uiNameSubRaceFirstNameSlider = getUI("ui:outgame:appear_name:name_sub_race_first_name_slider")
local uiNameSubRaceLastNameSlider = getUI("ui:outgame:appear_name:name_sub_race_last_name_slider"); local uiNameSubRaceLastNameSlider = getUI("ui:outgame:appear_name:name_sub_race_last_name_slider")
local uiNameGenerate = getUI("ui:outgame:appear_name:generate"); local uiNameGenerate = getUI("ui:outgame:appear_name:generate")
-- Show/Hide sex slider -- Show/Hide sex slider
uiNameGenerate.y = "-50" uiNameGenerate.y = "-50"
if tonumber(dbNameRace) == 2 then if tonumber(dbNameRace) == 2 then
uiNameSexSlider.active = true; uiNameSexSlider.active = true
uiNameGenerate.y = "-65" uiNameGenerate.y = "-65"
else else
uiNameSexSlider.active = false; uiNameSexSlider.active = false
end end
-- Show/Hide sub race slider -- Show/Hide sub race slider
if tonumber(dbNameRace) == 5 then if tonumber(dbNameRace) == 5 then
uiNameSubRaceFirstNameSlider.active = true; uiNameSubRaceFirstNameSlider.active = true
uiNameSubRaceLastNameSlider.active = true; uiNameSubRaceLastNameSlider.active = true
uiNameGenerate.y = "-105" uiNameGenerate.y = "-105"
else else
uiNameSubRaceFirstNameSlider.active = false; uiNameSubRaceFirstNameSlider.active = false
uiNameSubRaceLastNameSlider.active = false; uiNameSubRaceLastNameSlider.active = false
end end
uiNameRaceText.hardtext = tostring(nameRaceType[tonumber(dbNameRace)]); uiNameRaceText.hardtext = tostring(nameRaceType[tonumber(dbNameRace)])
end end
local matisF = "Matis " .. (string.lower(tostring(i18n.get("uiCP_Sex_Female")) )):gsub("^%l", string.upper); local matisF = "Matis " .. (string.lower(tostring(i18n.get("uiCP_Sex_Female")) )):gsub("^%l", string.upper)
local matisM = "Matis " .. (string.lower(tostring(i18n.get("uiCP_Sex_Male")) )):gsub("^%l", string.upper); local matisM = "Matis " .. (string.lower(tostring(i18n.get("uiCP_Sex_Male")) )):gsub("^%l", string.upper)
function outgame:procUpdateNameSubRaceFirstNameLabel() function outgame:procUpdateNameSubRaceFirstNameLabel()
local nameSubRaceFirstNameType = { "Fyros", matisM, matisF, "Tryker", "Zoraï" } local nameSubRaceFirstNameType = { "Fyros", matisM, matisF, "Tryker", "Zoraï" }
local uiNameSubRaceFirstNameText = getUI("ui:outgame:appear_name:name_sub_race_first_name_slider:name_race"); local uiNameSubRaceFirstNameText = getUI("ui:outgame:appear_name:name_sub_race_first_name_slider:name_race")
local dbNameSubRaceFirstName = getDbProp("UI:TEMP:NAME_SUB_RACE_FIRST_NAME"); local dbNameSubRaceFirstName = getDbProp("UI:TEMP:NAME_SUB_RACE_FIRST_NAME")
uiNameSubRaceFirstNameText.hardtext= tostring(nameSubRaceFirstNameType[tonumber(dbNameSubRaceFirstName)]); uiNameSubRaceFirstNameText.hardtext= tostring(nameSubRaceFirstNameType[tonumber(dbNameSubRaceFirstName)])
end end
function outgame:procUpdateNameSubRaceLastNameLabel() function outgame:procUpdateNameSubRaceLastNameLabel()
local nameSubRaceLastNameType = { "Fyros", "Matis", "Tryker", "Zoraï" } local nameSubRaceLastNameType = { "Fyros", "Matis", "Tryker", "Zoraï" }
local uiNameSubRaceLastNameText = getUI("ui:outgame:appear_name:name_sub_race_last_name_slider:name_race"); local uiNameSubRaceLastNameText = getUI("ui:outgame:appear_name:name_sub_race_last_name_slider:name_race")
local dbNameSubRaceLastName = getDbProp("UI:TEMP:NAME_SUB_RACE_LAST_NAME"); local dbNameSubRaceLastName = getDbProp("UI:TEMP:NAME_SUB_RACE_LAST_NAME")
uiNameSubRaceLastNameText.hardtext= tostring(nameSubRaceLastNameType[tonumber(dbNameSubRaceLastName)]); uiNameSubRaceLastNameText.hardtext= tostring(nameSubRaceLastNameType[tonumber(dbNameSubRaceLastName)])
end end
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- called to construct icons -- called to construct icons
function outgame:activePackElement(id, icon) function outgame:activePackElement(id, icon)
local uiDesc = getUI("ui:outgame:appear:job_options:options:desc"); local uiDesc = getUI("ui:outgame:appear:job_options:options:desc")
uiDesc['ico' .. tostring(id)].active= true; uiDesc['ico' .. tostring(id)].active = true
uiDesc['ico' .. tostring(id)].texture= icon; uiDesc['ico' .. tostring(id)].texture = icon
uiDesc['ico' .. tostring(id) .. 'txt'].active= true; uiDesc['ico' .. tostring(id) .. 'txt'].active = true
end end
@ -261,13 +260,13 @@ end
-- called to construct pack text -- called to construct pack text
function outgame:setPackJobText(id, spec) function outgame:setPackJobText(id, spec)
-- Set Pack content -- Set Pack content
local uiPackText = getUI("ui:outgame:appear:job_options:options:desc:pack_" .. id); local uiPackText = getUI("ui:outgame:appear:job_options:options:desc:pack_" .. id)
uiPackText.hardtext= "uiCP_Job_" .. id .. tostring(spec); uiPackText.hardtext= "uiCP_Job_" .. id .. tostring(spec)
-- Set specialization text -- Set specialization text
local uiResText = getUI("ui:outgame:appear:job_options:options:result:res"); local uiResText = getUI("ui:outgame:appear:job_options:options:result:res")
if(spec==2) then if(spec==2) then
uiResText.hardtext= "uiCP_Res_" .. id; uiResText.hardtext= "uiCP_Res_" .. id
end end
end end
@ -275,63 +274,63 @@ end
-- called to construct pack -- called to construct pack
function outgame:buildActionPack() function outgame:buildActionPack()
local uiDesc = getUI("ui:outgame:appear:job_options:options:desc"); local uiDesc = getUI("ui:outgame:appear:job_options:options:desc")
if (uiDesc==nil) then if (uiDesc==nil) then
return; return
end end
-- Reset All -- Reset All
for i = 1,20 do for i = 1,20 do
uiDesc['ico' .. tostring(i)].active= false; uiDesc['ico' .. tostring(i)].active = false
uiDesc['ico' .. tostring(i) .. 'txt'].active= false; uiDesc['ico' .. tostring(i) .. 'txt'].active = false
end end
-- Build Default Combat -- Build Default Combat
self:activePackElement(1, 'f1.tga'); -- Dagger self:activePackElement(1, 'f1.tga') -- Dagger
self:activePackElement(2, 'f2.tga'); -- Accurate Attack self:activePackElement(2, 'f2.tga') -- Accurate Attack
-- Build Default Magic -- Build Default Magic
self:activePackElement(6, 'm2.tga'); -- Gloves self:activePackElement(6, 'm2.tga') -- Gloves
self:activePackElement(7, 'm1.tga'); -- Acid self:activePackElement(7, 'm1.tga') -- Acid
-- Build Default Forage -- Build Default Forage
self:activePackElement(11, 'g1.tga'); -- Forage Tool self:activePackElement(11, 'g1.tga') -- Forage Tool
self:activePackElement(12, 'g2.tga'); -- Basic Extract self:activePackElement(12, 'g2.tga') -- Basic Extract
-- Build Default Craft -- Build Default Craft
self:activePackElement(16, 'c2.tga'); -- Craft Tool self:activePackElement(16, 'c2.tga') -- Craft Tool
self:activePackElement(17, 'c1.tga'); -- 50 raw mat self:activePackElement(17, 'c1.tga') -- 50 raw mat
self:activePackElement(18, 'c3.tga'); -- Craft Root self:activePackElement(18, 'c3.tga') -- Craft Root
self:activePackElement(19, 'c4.tga'); -- Boots Plan self:activePackElement(19, 'c4.tga') -- Boots Plan
-- Build Option -- Build Option
if (getDbProp('UI:TEMP:JOB_FIGHT') == 2) then if (getDbProp('UI:TEMP:JOB_FIGHT') == 2) then
self:activePackElement(3, 'f3.tga'); -- Increase damage self:activePackElement(3, 'f3.tga') -- Increase damage
elseif (getDbProp('UI:TEMP:JOB_MAGIC') == 2) then elseif (getDbProp('UI:TEMP:JOB_MAGIC') == 2) then
self:activePackElement(8, 'm5.tga'); -- Fear self:activePackElement(8, 'm5.tga') -- Fear
elseif (getDbProp('UI:TEMP:JOB_FORAGE') == 2) then elseif (getDbProp('UI:TEMP:JOB_FORAGE') == 2) then
self:activePackElement(13, 'g3.tga'); -- Basic Prospection self:activePackElement(13, 'g3.tga') -- Basic Prospection
elseif (getDbProp('UI:TEMP:JOB_CRAFT') == 2) then elseif (getDbProp('UI:TEMP:JOB_CRAFT') == 2) then
self:activePackElement(20, 'c6.tga'); -- Gloves Plan self:activePackElement(20, 'c6.tga') -- Gloves Plan
self:activePackElement(17, 'c5.tga'); -- Replace 17, with 100x RawMat self:activePackElement(17, 'c5.tga') -- Replace 17, with 100x RawMat
end end
-- Reset Text -- Reset Text
self:setPackJobText('F', 1); self:setPackJobText('F', 1)
self:setPackJobText('M', 1); self:setPackJobText('M', 1)
self:setPackJobText('G', 1); self:setPackJobText('G', 1)
self:setPackJobText('C', 1); self:setPackJobText('C', 1)
-- Set correct text for specalized version -- Set correct text for specalized version
if (getDbProp('UI:TEMP:JOB_FIGHT') == 2) then if (getDbProp('UI:TEMP:JOB_FIGHT') == 2) then
self:setPackJobText('F', 2); self:setPackJobText('F', 2)
elseif (getDbProp('UI:TEMP:JOB_MAGIC') == 2) then elseif (getDbProp('UI:TEMP:JOB_MAGIC') == 2) then
self:setPackJobText('M', 2); self:setPackJobText('M', 2)
elseif (getDbProp('UI:TEMP:JOB_FORAGE') == 2) then elseif (getDbProp('UI:TEMP:JOB_FORAGE') == 2) then
self:setPackJobText('G', 2); self:setPackJobText('G', 2)
elseif (getDbProp('UI:TEMP:JOB_CRAFT') == 2) then elseif (getDbProp('UI:TEMP:JOB_CRAFT') == 2) then
self:setPackJobText('C', 2); self:setPackJobText('C', 2)
end end
end end

View file

@ -91,7 +91,11 @@
<action handler="set" params="target='ui:interface:gestion_windows:x'|value=div(sub(getprop('ui:interface:w'),getprop('ui:interface:gestion_windows:w')),2)" /> <action handler="set" params="target='ui:interface:gestion_windows:x'|value=div(sub(getprop('ui:interface:w'),getprop('ui:interface:gestion_windows:w')),2)" />
<action handler="set" params="target='ui:interface:gestion_windows:y'|value=add(getprop('ui:interface:gestion_windows:h'),div(sub(getprop('ui:interface:h'),getprop('ui:interface:gestion_windows:h')),2))" /> <action handler="set" params="target='ui:interface:gestion_windows:y'|value=add(getprop('ui:interface:gestion_windows:h'),div(sub(getprop('ui:interface:h'),getprop('ui:interface:gestion_windows:h')),2))" />
<action handler="set" params="target='ui:interface:gestion_windows:active'|value=@UI:TEMP:ACTIVE" /> <action handler="set" params="target='ui:interface:gestion_windows:active'|value=@UI:TEMP:ACTIVE" />
<!-- AppZone -->
<action handler="set" params="target='ui:interface:appzone:active'|value=1" />
<action handler="set" params="target='ui:interface:appzone:x'|value=div(sub(getprop('ui:interface:w'),getprop('ui:interface:appzone:w')),2)" />
<action handler="set" params="target='ui:interface:appzone:y'|value=add(getprop('ui:interface:appzone:h'),2)" />
</proc> </proc>
<proc id="proc_reset_interface"> <proc id="proc_reset_interface">
@ -470,4 +474,4 @@
</proc> </proc>
</interface_config> </interface_config>

View file

@ -109,7 +109,7 @@ function game.RingAccessPointFilter:validate()
if config.Local == 1 then if config.Local == 1 then
ucUrl = ucstring(NicoMagicURL) -- for test in local mode ucUrl = ucstring(NicoMagicURL) -- for test in local mode
else else
ucUrl = getDynString(game.NpcWebPage.UrlTextId); ucUrl = getDynString(game.NpcWebPage.UrlTextId)
end end
debugInfo(tostring(ucUrl)) debugInfo(tostring(ucUrl))
local utf8Url = ucUrl:toUtf8() local utf8Url = ucUrl:toUtf8()

View file

@ -2,39 +2,39 @@
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- create the game namespace without reseting if already created in an other file. -- create the game namespace without reseting if already created in an other file.
if (game==nil) then if (game==nil) then
game= {}; game = {}
end end
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- --
function game:getMilkoTooltipWithKey(prop, tooltip, tooltip_pushed, name, param) function game:getMilkoTooltipWithKey(prop, tooltip, tooltip_pushed, name, param)
local tt; local tt
-- Check if button is toggled and choose the good tooltip -- Check if button is toggled and choose the good tooltip
if (prop ~= '' and tooltip_pushed ~= '') then if (prop ~= '' and tooltip_pushed ~= '') then
local db = getDbProp(prop); local db = getDbProp(prop)
if (db == 1) then if (db == 1) then
tt = tooltip_pushed; tt = tooltip_pushed
else else
tt = tooltip; tt = tooltip
end end
else else
tt = tooltip; tt = tooltip;
end end
-- Get key shortcut -- Get key shortcut
local text = i18n.get(tt); local text = i18n.get(tt)
local key = runExpr('getKey(\'' .. name .. '\',\'' .. param .. '\',1)'); local key = runExpr('getKey(\'' .. name .. '\',\'' .. param .. '\',1)')
if (key ~= nil and key ~= '') then if (key ~= nil and key ~= '') then
key = ' @{2F2F}(' .. key .. ')'; key = ' @{2F2F}(' .. key .. ')'
text = concatUCString(text, key); text = concatUCString(text, key)
end end
setContextHelpText(text); setContextHelpText(text)
end end
function game:taskbarDisableTooltip(ui) function game:taskbarDisableTooltip(ui)
local uiGroup = getUI(ui); local uiGroup = getUI(ui)
disableContextHelpForControl(uiGroup); disableContextHelpForControl(uiGroup)
end end

View file

@ -1091,7 +1091,10 @@
<instance template="win_button" id="webig" color="UI:SAVE:WIN:COLORS:COM" text="uimwWebIG" posparent="fame" posref="BL TL" x="0" y="-4" <instance template="win_button" id="webig" color="UI:SAVE:WIN:COLORS:COM" text="uimwWebIG" posparent="fame" posref="BL TL" x="0" y="-4"
pushflag="UI:VARIABLES:ISACTIVE:WEBIG" win_name="webig" /> pushflag="UI:VARIABLES:ISACTIVE:WEBIG" win_name="webig" />
<instance template="win_button" id="appzone" color="UI:SAVE:WIN:COLORS:COM" text="uimwAppZone" posparent="webig" posref="BL TL" x="0" y="-4"
pushflag="UI:VARIABLES:ISACTIVE:APPZONE" win_name="appzone" />
</group> </group>
<view type="bitmap" id="com_ico_back" posparent="communication" posref="TL TL" x="-22" y="22" texture="W_slot_categorie.tga" global_color="false" /> <view type="bitmap" id="com_ico_back" posparent="communication" posref="TL TL" x="-22" y="22" texture="W_slot_categorie.tga" global_color="false" />
<view type="bitmap" id="com_ico" posparent="com_ico_back" posref="MM MM" x="2" y="-2" texture="spe_com.tga" global_color="false" /> <view type="bitmap" id="com_ico" posparent="com_ico_back" posref="MM MM" x="2" y="-2" texture="spe_com.tga" global_color="false" />

View file

@ -0,0 +1,161 @@
-- global
WebBrowser = {
template = "webig_browser",
apps = {}
}
function WebBrowser:openWindow(id, url)
-- default value if url is not set
url = url or "http://app.ryzom.com/"
local newWindow = false
local app = self:findAppById(id)
if not app then
app = {}
app.id = id
app.title = ""
app.url = url
-- getUI() object
app.uiWindow = nil
app.winid = "ui:interface:" .. id
app.winw = 780
app.winh = 500
app.minimized = true
app.activeUrl = ""
table.insert(self.apps, app)
end
if not app.uiWindow then
-- if there is window present (eg, 'webig'), then reuse it
app.uiWindow = getUI(app.winid, false)
if not app.uiWindow then
app.uiWindow = createRootGroupInstance(self.template, app.id, {
x = 0, y = 0, w = app.winw, h = app.winh, home = app.url,
browse_redo = "ui:interface:" .. app.id .. ":browser:header_opened:browse_redo",
browse_undo = "ui:interface:" .. app.id .. ":browser:header_opened:browse_undo",
browse_refresh = "ui:interface:" .. app.id .. ":browser:header_opened:browse_refresh"
})
if not app.uiWindow then
return
end
app.uiWindow:center()
end
newWindow = true
end
app.activeUrl = url
-- trigger on_open event
if not app.uiWindow.opened then
app.uiWindow.opened = true
end
-- trigger on_active event
if not app.uiWindow.active then
app.uiWindow.active = true
end
local html = app.uiWindow:find("html")
html:browse(url)
setTopWindow(app.uiWindow)
end
function WebBrowser:findAppById(id)
for k,app in pairs(self.apps) do
if app.id == id then
return app
end
end
return nil
end
function WebBrowser:findAppFromUiCaller()
-- id = app123
local id = getUICaller().id:match("ui:interface:([^:]*):?")
local app = self:findAppById(id)
if app then
return app
end
end
function WebBrowser:onActive()
if app then
self:restoreWindow(app)
end
end
function WebBrowser:onClickHeaderClose()
local app = self:findAppFromUiCaller()
if app then
self:saveWindow(app)
end
end
function WebBrowser:onClickHeaderOpen()
local app = self:findAppFromUiCaller()
if app then
self:restoreWindow(app)
end
end
-- save current window dimension and minimize window
function WebBrowser:saveWindow(app)
app.minimized = true
app.winw = app.uiWindow.w
app.winh = app.uiWindow.h
-- minimize
app.uiWindow.w = 150
app.uiWindow.h = 0
end
function WebBrowser:restoreWindow(app)
if app.minimized then
app.uiWindow.w = app.winw
app.uiWindow.h = app.winh
app.minimized = false
end
end
function WebBrowser:onClickRedo()
-- caller is :header_opened:browse_redo
local uiWindow = getUICaller().parent.parent
local html = uiWindow:find("html")
if html ~= nil then
runAH(nil, "browse_redo", "name=" .. html.id)
end
end
function WebBrowser:onClickUndo()
-- caller is :header_opened:browse_undo
local uiWindow = getUICaller().parent.parent
local html = uiWindow:find("html")
if html ~= nil then
runAH(nil, "browse_undo", "name=" .. html.id)
end
end
function WebBrowser:onClickRefresh()
-- caller is :header_opened:browse_refresh
local uiWindow = getUICaller().parent.parent
local html = uiWindow:find("html")
if html ~= nil then
html:refresh()
end
end
function WebBrowser:onClickHome()
-- caller is :header_opened:browse_home
local uiWindow = getUICaller().parent.parent
local html = uiWindow:find("html")
if html ~= nil then
html:browse("home")
end
end

View file

@ -180,7 +180,7 @@ function webig:doRemoveDbSheetQuantity(sheet_list, ctrl)
end end
end end
--assert(nil, "RELOADABLE SCRIPT"); --assert(nil, "RELOADABLE SCRIPT")

View file

@ -6927,7 +6927,203 @@
</group> </group>
</group> </group>
</template> </template>
<!-- html <hr> element -->
<!-- html browsing context -->
<template name="webig_html"
keep="true"
home=""
browse_redo=""
browse_undo=""
browse_refresh="">
<group id="html"
type="webig_html"
posref="TL TL"
home="#home"
title_prefix=""
sizeref="wh"
x="0"
y="0"
w="0"
h="0"
background_color="0 0 0 255"
error_color="255 240 48 255"
link_color="240 155 100 255"
text_color="210 210 210 255"
h1_color="255 255 255 255"
h2_color="255 255 255 255"
h3_color="255 255 255 255"
h4_color="255 255 255 255"
h5_color="255 255 255 255"
h6_color="255 255 255 255"
text_font_size="10"
h1_font_size="20"
h2_font_size="18"
h3_font_size="16"
h4_font_size="14"
h5_font_size="12"
h6_font_size="12"
paragraph_begin_space="12"
multi_line_space_factor="0.25"
td_begin_space="0"
li_begin_space="4"
ul_begin_space="12"
li_indent="-10"
ul_indent="30"
checkbox_bitmap_normal="w_slot_on.tga"
checkbox_bitmap_pushed="w_opacity_on.tga"
checkbox_bitmap_over=""
background_bitmap_view="background_bitmap"
browse_next_time="false"
form_text_area_group="edit_box_widget_multiline"
browse_refresh="#browse_refresh"
browse_undo="#browse_undo"
browse_redo="#browse_redo"
timeout="10">
<group id="black"
posref="BR BR"
sizeref="hw"
w="-10"
h="-12"
inherit_gc_alpha="true" />
<instance template="inner_thin_border"
posparent="black"
inherit_gc_alpha="true " />
<view id="background_bitmap"
type="bitmap"
posparent="black"
posref="MM MM"
sizeref="wh"
w="-2"
h="-2"
inherit_gc_alpha="true"
scale="true"
texture="blank.tga"
global_color="false" />
<group id="text_list"
type="list"
fontsize="9"
posref="TL TL"
posparent="black"
x="2"
y="-2"
space="0"
sizeref="hw"
w="-4"
h="-4"
maxelements="2000" />
<ctrl id="scroll_bar"
style="skin_scroll" />
</group>
</template>
<!-- html browser window -->
<template name="webig_browser"
keep="true"
home=""
w="480"
h="400"
browse_redo=""
browse_undo=""
browse_refresh="">
<group id="browser"
type="container"
w="#w"
h="#h"
x="0"
y="0"
pop_max_w="2000"
pop_max_h="2000"
pop_min_w="64"
pop_min_h="32"
header_color="UI:SAVE:WIN:COLORS:COM"
posref="TL TL"
title=""
global_color="true"
global_color_over="true"
right_button="true"
movable="true"
lockable="true"
active="true"
openable="true"
opened="true"
resizer="true"
on_active="lua"
on_active_params="WebBrowser:onActive()">
<group id="header_closed"
w="64"
h="16"
posref="TL TL"
on_active="lua"
on_active_params="WebBrowser:onClickHeaderClose()" />
<group id="header_opened"
h="16"
w="480"
posref="TL TL"
on_active="lua"
on_active_params="WebBrowser:onClickHeaderOpen()">
<ctrl style="text_button_header"
id="browse_redo"
button_type="push_button"
posref="MR MR"
x="-16"
y="0"
hardtext="uiBrowseRedoButton"
tooltip="uittBrowseRedo"
onclick_l="lua"
params_l="WebBrowser:onClickRedo()"
frozen="true" />
<ctrl style="text_button_header"
id="browse_undo"
button_type="push_button"
posparent="browse_redo"
posref="ML MR"
x="-4"
y="0"
hardtext="uiBrowseUndoButton"
tooltip="uittBrowseUndo"
onclick_l="lua"
params_l="WebBrowser:onClickUndo()"
frozen="true" />
<ctrl style="text_button_header"
id="browse_refresh"
button_type="push_button"
posparent="browse_undo"
posref="ML MR"
x="-4"
y="0"
hardtext="uiBrowseRefresh"
tooltip="uittBrowseRefresh"
onclick_l="lua"
params_l="WebBrowser:onClickRefresh()"
frozen="true" />
<ctrl style="text_button_header"
id="browse_home"
button_type="push_button"
posparent="browse_refresh"
posref="ML MR"
x="-4"
y="0"
hardtext="uiBrowseHome"
tooltip="uittBrowseHome"
onclick_l="lua"
params_l="WebBrowser:onClickHome()" />
</group>
<group id="content"
x="0"
y="0"
w="0"
h="0"
posref="TL TL">
<instance template="webig_html"
home="#home"
browse_redo="#browse_redo"
browse_undo="#browse_undo"
browse_refresh="#browse_refresh" />
</group>
</group>
</template>
<!-- html <hr> element --> <!-- html <hr> element -->
<template name="html_hr" <template name="html_hr"
keep="true"> keep="true">

View file

@ -30,13 +30,6 @@
#include <csignal> #include <csignal>
#endif #endif
#ifdef NL_OS_MAC
#include <stdio.h>
#include <sys/resource.h>
#include "nel/misc/dynloadlib.h"
#include "app_bundle_utils.h"
#endif
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
#include "nel/misc/command.h" #include "nel/misc/command.h"
#include "nel/net/tcp_sock.h" #include "nel/net/tcp_sock.h"
@ -226,23 +219,6 @@ int main(int argc, char **argv)
} }
#endif // TEST_CRASH_COUNTER #endif // TEST_CRASH_COUNTER
#ifdef NL_OS_MAC
struct rlimit rlp, rlp2, rlp3;
getrlimit(RLIMIT_NOFILE, &rlp);
rlp2.rlim_cur = 1024;
rlp2.rlim_max = rlp.rlim_max;
setrlimit(RLIMIT_NOFILE, &rlp2);
getrlimit(RLIMIT_NOFILE, &rlp3);
nlinfo("rlimit before %d %d\n", rlp.rlim_cur, rlp.rlim_max);
nlinfo("rlimit after %d %d\n", rlp3.rlim_cur, rlp3.rlim_max);
// add the bundle's plugins path as library search path (for nel drivers)
CLibrary::addLibPath(getAppBundlePath() + "/Contents/PlugIns/nel/");
#endif
#if defined(NL_OS_WINDOWS) #if defined(NL_OS_WINDOWS)
#ifdef TEST_CRASH_COUNTER #ifdef TEST_CRASH_COUNTER
@ -291,6 +267,10 @@ int main(int argc, char **argv)
// TODO for Linux : splashscreen // TODO for Linux : splashscreen
#endif #endif
// initialize log
initLog();
// initialize patch manager and set the ryzom full path, before it's used // initialize patch manager and set the ryzom full path, before it's used
CPatchManager *pPM = CPatchManager::getInstance(); CPatchManager *pPM = CPatchManager::getInstance();
pPM->setRyzomFilename(Args.getProgramPath() + Args.getProgramName()); pPM->setRyzomFilename(Args.getProgramPath() + Args.getProgramName());

View file

@ -2223,6 +2223,7 @@ bool CClientConfig::getDefaultConfigLocation(std::string& p_name) const
#endif #endif
std::string currentPath = CPath::standardizePath(CPath::getCurrentPath()); std::string currentPath = CPath::standardizePath(CPath::getCurrentPath());
std::string etcPath = CPath::standardizePath(getRyzomEtcPrefix());
// look in the current working directory first // look in the current working directory first
if (CFile::isExists(currentPath + defaultConfigFileName)) if (CFile::isExists(currentPath + defaultConfigFileName))
@ -2232,13 +2233,14 @@ bool CClientConfig::getDefaultConfigLocation(std::string& p_name) const
else if (CFile::isExists(Args.getStartupPath() + defaultConfigFileName)) else if (CFile::isExists(Args.getStartupPath() + defaultConfigFileName))
p_name = Args.getStartupPath() + defaultConfigFileName; p_name = Args.getStartupPath() + defaultConfigFileName;
// look in prefix path // look in application directory
else if (CFile::isExists(defaultConfigPath + defaultConfigFileName)) else if (CFile::isExists(defaultConfigPath + defaultConfigFileName))
p_name = defaultConfigPath + defaultConfigFileName; p_name = defaultConfigPath + defaultConfigFileName;
// if some client_default.cfg was found return true // look in etc prefix path
if (p_name.size()) else if (!etcPath.empty() && CFile::isExists(etcPath + defaultConfigFileName))
return true; p_name = etcPath + defaultConfigFileName;
return false; // if some client_default.cfg was found return true
return !p_name.empty();
} }

View file

@ -86,7 +86,7 @@ namespace NL3D
class CEntitySheet; class CEntitySheet;
class CEntityCL; class CEntityCL;
class CAttackInfo; struct CAttackInfo;
class CItemSheet; class CItemSheet;

View file

@ -569,7 +569,7 @@ void CLoginStateMachine::run()
break; break;
case st_disconnect: case st_disconnect:
// Far TP part 2: disconnect from the FS and unload shard-specific data (called from farTPmainLoop()) // Far TP part 2: disconnect from the FS and unload shard-specific data (called from farTPmainLoop())
// FarTP.disconnectFromPreviousShard(); FarTP.disconnectFromPreviousShard();
SM_BEGIN_EVENT_TABLE SM_BEGIN_EVENT_TABLE
SM_EVENT(ev_connect, st_reconnect_fs); SM_EVENT(ev_connect, st_reconnect_fs);
@ -1406,9 +1406,6 @@ void CFarTP::farTPmainLoop()
{ {
ConnectionReadySent = false; ConnectionReadySent = false;
LoginSM.pushEvent(CLoginStateMachine::ev_far_tp_main_loop_entered); LoginSM.pushEvent(CLoginStateMachine::ev_far_tp_main_loop_entered);
disconnectFromPreviousShard();
uint nbRecoSelectCharReceived = 0; uint nbRecoSelectCharReceived = 0;
bool welcomeWindow = true; bool welcomeWindow = true;

View file

@ -148,7 +148,7 @@ bool CCurlHttpClient::verifyServer(bool verify)
curl_easy_setopt(_Curl, CURLOPT_SSL_VERIFYPEER, verify ? 1 : 0); curl_easy_setopt(_Curl, CURLOPT_SSL_VERIFYPEER, verify ? 1 : 0);
curl_easy_setopt(_Curl, CURLOPT_SSLCERTTYPE, "PEM"); curl_easy_setopt(_Curl, CURLOPT_SSLCERTTYPE, "PEM");
// would allow to provide the CA in memory instead of using CURLOPT_CAINFO, but needs to include and link OpenSSL // would allow to provide the CA in memory instead of using CURLOPT_CAINFO, but needs to include and link OpenSSL
if (curl_easy_setopt(_Curl, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function) == CURLE_NOT_BUILT_IN) if (curl_easy_setopt(_Curl, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function) != CURLE_OK)
{ {
nlwarning("Unable to support CURLOPT_SSL_CTX_FUNCTION, curl not compiled with OpenSSL ?"); nlwarning("Unable to support CURLOPT_SSL_CTX_FUNCTION, curl not compiled with OpenSSL ?");
} }

View file

@ -105,6 +105,12 @@ extern HINSTANCE HInstance;
extern HWND SlashScreen; extern HWND SlashScreen;
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
#ifdef NL_OS_MAC
#include <stdio.h>
#include <sys/resource.h>
#include "nel/misc/dynloadlib.h"
#endif
#include "app_bundle_utils.h" #include "app_bundle_utils.h"
#include <new> #include <new>
@ -796,6 +802,65 @@ static bool addRyzomIconBitmap(const std::string &directory, vector<CBitmap> &bi
} }
#endif #endif
//---------------------------------------------------
// initLog :
// Initialize the client.log file
//---------------------------------------------------
void initLog()
{
// Add a displayer for Debug Infos.
createDebug();
// Client.Log displayer
nlassert( !ErrorLog->getDisplayer("CLIENT.LOG") );
CFileDisplayer *ClientLogDisplayer = new CFileDisplayer(getLogDirectory() + "client.log", true, "CLIENT.LOG");
DebugLog->addDisplayer (ClientLogDisplayer);
InfoLog->addDisplayer (ClientLogDisplayer);
WarningLog->addDisplayer (ClientLogDisplayer);
ErrorLog->addDisplayer (ClientLogDisplayer);
AssertLog->addDisplayer (ClientLogDisplayer);
// Display the client version.
nlinfo("RYZOM VERSION : %s", getDebugVersion().c_str());
#ifdef NL_OS_MAC
struct rlimit rlp, rlp2, rlp3;
getrlimit(RLIMIT_NOFILE, &rlp);
rlim_t value = 1024;
rlp2.rlim_cur = std::min(value, rlp.rlim_max);
rlp2.rlim_max = rlp.rlim_max;
if (setrlimit(RLIMIT_NOFILE, &rlp2))
{
if (errno == EINVAL)
{
nlwarning("Unable to set rlimit with error: the specified limit is invalid");
}
else if (errno == EPERM)
{
nlwarning("Unable to set rlimit with error: the limit specified would have raised the maximum limit value and the caller is not the super-user");
}
else
{
nlwarning("Unable to set rlimit with error: unknown error");
}
}
getrlimit(RLIMIT_NOFILE, &rlp3);
nlinfo("rlimit before %llu %llu", (uint64)rlp.rlim_cur, (uint64)rlp.rlim_max);
nlinfo("rlimit after %llu %llu", (uint64)rlp3.rlim_cur, (uint64)rlp3.rlim_max);
// add the bundle's plugins path as library search path (for nel drivers)
if (CFile::isExists(getAppBundlePath() + "/Contents/PlugIns/nel"))
{
CLibrary::addLibPath(getAppBundlePath() + "/Contents/PlugIns/nel/");
}
#endif
}
//--------------------------------------------------- //---------------------------------------------------
// prelogInit : // prelogInit :
// Initialize the application before login // Initialize the application before login
@ -848,21 +913,6 @@ void prelogInit()
// Due to Bug #906, we disable the stl xml allocation // Due to Bug #906, we disable the stl xml allocation
// nlverify (xmlMemSetup (XmlFree4NeL, XmlMalloc4NeL, XmlRealloc4NeL, XmlStrdup4NeL) == 0); // nlverify (xmlMemSetup (XmlFree4NeL, XmlMalloc4NeL, XmlRealloc4NeL, XmlStrdup4NeL) == 0);
// Add a displayer for Debug Infos.
createDebug();
// Client.Log displayer
nlassert( !ErrorLog->getDisplayer("CLIENT.LOG") );
CFileDisplayer *ClientLogDisplayer = new CFileDisplayer(getLogDirectory() + "client.log", true, "CLIENT.LOG");
DebugLog->addDisplayer (ClientLogDisplayer);
InfoLog->addDisplayer (ClientLogDisplayer);
WarningLog->addDisplayer (ClientLogDisplayer);
ErrorLog->addDisplayer (ClientLogDisplayer);
AssertLog->addDisplayer (ClientLogDisplayer);
// Display the client version.
nlinfo("RYZOM VERSION : %s", getDebugVersion().c_str());
// Init the debug memory // Init the debug memory
initDebugMemory(); initDebugMemory();

View file

@ -27,6 +27,9 @@ namespace NLMISC
class IProgressCallback; class IProgressCallback;
} }
// Initialize the log
void initLog();
// Initialize the application before login step // Initialize the application before login step
void prelogInit(); void prelogInit();

View file

@ -786,7 +786,7 @@ CInterface3DCharacter::~CInterface3DCharacter()
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool CInterface3DCharacter::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) bool CInterface3DCharacter::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
{ {
if (!CInterfaceElement::parse(cur, parentGroup)) if (!CInterfaceElement::parse(cur, parentGroup))
return false; return false;
@ -808,7 +808,7 @@ bool CInterface3DCharacter::parse (xmlNodePtr cur, CInterface3DScene *parentGrou
_Char3D = new CCharacter3D; _Char3D = new CCharacter3D;
_Char3D->copyAnimation(copyAnim); _Char3D->copyAnimation(copyAnim);
_Char3D->init (parentGroup->getScene()); _Char3D->init (dynamic_cast<CInterface3DScene*>(parentGroup)->getScene());
_Char3D->setPos (pos.x, pos.y, pos.z); _Char3D->setPos (pos.x, pos.y, pos.z);
_Char3D->setRotEuler ( rot.x * ((float)(NLMISC::Pi / 180)), _Char3D->setRotEuler ( rot.x * ((float)(NLMISC::Pi / 180)),
rot.y * ((float)(NLMISC::Pi / 180)), rot.y * ((float)(NLMISC::Pi / 180)),
@ -1073,7 +1073,7 @@ CInterface3DIG::~CInterface3DIG()
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool CInterface3DIG::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) bool CInterface3DIG::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
{ {
if (!CInterfaceElement::parse(cur, parentGroup)) if (!CInterfaceElement::parse(cur, parentGroup))
return false; return false;
@ -1095,8 +1095,8 @@ bool CInterface3DIG::parse (xmlNodePtr cur, CInterface3DScene *parentGroup)
setRotX (_Rot.x); setRotX (_Rot.x);
setRotY (_Rot.y); setRotY (_Rot.y);
setRotZ (_Rot.z); setRotZ (_Rot.z);
_IG->addToScene (*parentGroup->getScene(), CViewRenderer::getInstance()->getDriver() ); _IG->addToScene (*dynamic_cast<CInterface3DScene*>(parentGroup)->getScene(), CViewRenderer::getInstance()->getDriver() );
parentGroup->getScene()->setToGlobalInstanceGroup (_IG); dynamic_cast<CInterface3DScene*>(parentGroup)->getScene()->setToGlobalInstanceGroup (_IG);
return true; return true;
} }
@ -1235,7 +1235,7 @@ CInterface3DShape::~CInterface3DShape()
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool CInterface3DShape::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) bool CInterface3DShape::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
{ {
if (!CInterfaceElement::parse(cur, parentGroup)) if (!CInterfaceElement::parse(cur, parentGroup))
return false; return false;
@ -1249,7 +1249,7 @@ bool CInterface3DShape::parse (xmlNodePtr cur, CInterface3DScene *parentGroup)
ptr = xmlGetProp (cur, (xmlChar*)"name"); ptr = xmlGetProp (cur, (xmlChar*)"name");
if (ptr) _Name = toLower((const char*)ptr); if (ptr) _Name = toLower((const char*)ptr);
_Instance = parentGroup->getScene()->createInstance(_Name); _Instance = dynamic_cast<CInterface3DScene*>(parentGroup)->getScene()->createInstance(_Name);
if (_Instance.empty()) if (_Instance.empty())
return false; return false;
@ -1385,7 +1385,7 @@ void CInterface3DShape::setName (const std::string &ht)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool CInterface3DCamera::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) bool CInterface3DCamera::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
{ {
if (!CInterfaceElement::parse(cur, parentGroup)) if (!CInterfaceElement::parse(cur, parentGroup))
return false; return false;
@ -1422,12 +1422,12 @@ CInterface3DLight::~CInterface3DLight()
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool CInterface3DLight::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) bool CInterface3DLight::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
{ {
if (!CInterfaceElement::parse(cur, parentGroup)) if (!CInterfaceElement::parse(cur, parentGroup))
return false; return false;
_Light = parentGroup->getScene()->createPointLight(); _Light = dynamic_cast<CInterface3DScene*>(parentGroup)->getScene()->createPointLight();
CXMLAutoPtr ptr((const char*)xmlGetProp (cur, (xmlChar*)"pos")); CXMLAutoPtr ptr((const char*)xmlGetProp (cur, (xmlChar*)"pos"));
if (ptr) _Pos = convertVector(ptr); if (ptr) _Pos = convertVector(ptr);
@ -1514,7 +1514,7 @@ CInterface3DFX::~CInterface3DFX()
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool CInterface3DFX::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) bool CInterface3DFX::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
{ {
if (!CInterfaceElement::parse(cur, parentGroup)) if (!CInterfaceElement::parse(cur, parentGroup))
return false; return false;

View file

@ -148,7 +148,7 @@ public:
CInterface3DCharacter(); CInterface3DCharacter();
virtual ~CInterface3DCharacter(); virtual ~CInterface3DCharacter();
virtual bool parse (xmlNodePtr cur, CInterface3DScene *parentGroup); virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
virtual void checkCoords(); virtual void checkCoords();
@ -236,7 +236,7 @@ public:
virtual ~CInterface3DShape(); virtual ~CInterface3DShape();
virtual bool parse (xmlNodePtr cur, CInterface3DScene *parentGroup); virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
NL3D::UInstance getShape() { return _Instance; } NL3D::UInstance getShape() { return _Instance; }
@ -295,7 +295,7 @@ public:
virtual ~CInterface3DIG(); virtual ~CInterface3DIG();
virtual bool parse (xmlNodePtr cur, CInterface3DScene *parentGroup); virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
NL3D::UInstanceGroup *getIG() { return _IG; } NL3D::UInstanceGroup *getIG() { return _IG; }
@ -357,7 +357,7 @@ public:
_Dist = 0; _Dist = 0;
} }
virtual bool parse (xmlNodePtr cur, CInterface3DScene *parentGroup); virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
float getFOV() { return _FOV; } float getFOV() { return _FOV; }
NLMISC::CVector getPos() { return _Pos; } NLMISC::CVector getPos() { return _Pos; }
NLMISC::CVector getTarget() { return _Target; } NLMISC::CVector getTarget() { return _Target; }
@ -436,7 +436,7 @@ public:
virtual ~CInterface3DLight(); virtual ~CInterface3DLight();
virtual bool parse (xmlNodePtr cur, CInterface3DScene *parentGroup); virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
float getPosX() const { return _Pos.x; } float getPosX() const { return _Pos.x; }
float getPosY() const { return _Pos.y; } float getPosY() const { return _Pos.y; }
@ -498,7 +498,7 @@ public:
virtual ~CInterface3DFX(); virtual ~CInterface3DFX();
virtual bool parse (xmlNodePtr cur, CInterface3DScene *parentGroup); virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
virtual void checkCoords(); virtual void checkCoords();

View file

@ -2635,7 +2635,13 @@ public:
{ {
ucstring title; ucstring title;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
pMenu->addLineAtIndex(5 + insertion_index, title+" @{T8}/"+s, "chat_target_selected", "dyn"+s, "dyn"+s);
// replace dynamic channel name and shortcut
ucstring res = CI18N::get("uiFilterMenuDynamic");
strFindReplace(res, "%channel", title);
strFindReplace(res, "%shortcut", s);
pMenu->addLineAtIndex(5 + insertion_index, res, "chat_target_selected", "dyn"+s, "dyn"+s);
insertion_index++; insertion_index++;
} }
} }

View file

@ -779,7 +779,8 @@ void initLoginScreen()
ClientApp = ClientCfg.ConfigFile.getVar("Application").asString(0); ClientApp = ClientCfg.ConfigFile.getVar("Application").asString(0);
string l = ClientCfg.LastLogin; // give priority to login specified as argument
string l = !LoginLogin.empty() ? LoginLogin:ClientCfg.LastLogin;
if(!l.empty()) if(!l.empty())
{ {

View file

@ -922,21 +922,23 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
contentPrefix += "set RYZOM_CLIENT=\"%1\"\n"; contentPrefix += "set RYZOM_CLIENT=\"%1\"\n";
contentPrefix += "set UNPACKPATH=\"%2\"\n"; contentPrefix += "set UNPACKPATH=\"%2\"\n";
contentPrefix += "set ROOTPATH=\"%3\"\n"; contentPrefix += "set ROOTPATH=\"%3\"\n";
contentPrefix += "set STARTUPPATH=\"%4\"\n";
contentPrefix += toString("set UPGRADE_FILE=\"%%ROOTPATH%%\\%s\"\n", UpgradeBatchFilename.c_str()); contentPrefix += toString("set UPGRADE_FILE=\"%%ROOTPATH%%\\%s\"\n", UpgradeBatchFilename.c_str());
contentPrefix += "\n"; contentPrefix += "\n";
contentPrefix += "set LOGIN=%4\n"; contentPrefix += "set LOGIN=%5\n";
contentPrefix += "set PASSWORD=%5\n"; contentPrefix += "set PASSWORD=%6\n";
contentPrefix += "set SHARDID=%6\n"; contentPrefix += "set SHARDID=%7\n";
#else #else
contentPrefix += "#!/bin/sh\n"; contentPrefix += "#!/bin/sh\n";
contentPrefix += "export RYZOM_CLIENT=$1\n"; contentPrefix += "export RYZOM_CLIENT=$1\n";
contentPrefix += "export UNPACKPATH=$2\n"; contentPrefix += "export UNPACKPATH=$2\n";
contentPrefix += "export ROOTPATH=$3\n"; contentPrefix += "export ROOTPATH=$3\n";
contentPrefix += "export STARTUPPATH=$4\n";
contentPrefix += toString("export UPGRADE_FILE=$ROOTPATH/%s\n", UpgradeBatchFilename.c_str()); contentPrefix += toString("export UPGRADE_FILE=$ROOTPATH/%s\n", UpgradeBatchFilename.c_str());
contentPrefix += "\n"; contentPrefix += "\n";
contentPrefix += "LOGIN=$4\n"; contentPrefix += "LOGIN=$5\n";
contentPrefix += "PASSWORD=$5\n"; contentPrefix += "PASSWORD=$6\n";
contentPrefix += "SHARDID=$6\n"; contentPrefix += "SHARDID=$7\n";
#endif #endif
contentPrefix += "\n"; contentPrefix += "\n";
@ -958,7 +960,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
if (wantRyzomRestart) if (wantRyzomRestart)
{ {
// client shouldn't be in memory anymore else it couldn't be overwritten // client shouldn't be in memory anymore else it couldn't be overwritten
contentSuffix += toString("start \"\" /D \"%%ROOTPATH%%\" \"%%RYZOM_CLIENT%%\" %s %%LOGIN%% %%PASSWORD%% %%SHARDID%%\n", additionalParams.c_str()); contentSuffix += toString("start \"\" /D \"%%STARTUPPATH%%\" \"%%RYZOM_CLIENT%%\" %s %%LOGIN%% %%PASSWORD%% %%SHARDID%%\n", additionalParams.c_str());
} }
#else #else
if (wantRyzomRestart) if (wantRyzomRestart)
@ -976,7 +978,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
if (wantRyzomRestart) if (wantRyzomRestart)
{ {
// change to previous client directory // change to previous client directory
contentSuffix += "cd \"$ROOTPATH\"\n\n"; contentSuffix += "cd \"$STARTUPPATH\"\n\n";
// launch new client // launch new client
contentSuffix += toString("\"$RYZOM_CLIENT\" %s $LOGIN $PASSWORD $SHARDID\n", additionalParams.c_str()); contentSuffix += toString("\"$RYZOM_CLIENT\" %s $LOGIN $PASSWORD $SHARDID\n", additionalParams.c_str());
@ -1017,10 +1019,25 @@ void CPatchManager::executeBatchFile()
std::string batchFilename; std::string batchFilename;
std::vector<std::string> arguments;
std::string startupPath = Args.getStartupPath();
// 3 first parameters are Ryzom client full path, patch directory full path and client root directory full path
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
batchFilename = CPath::standardizeDosPath(ClientRootPath); batchFilename = CPath::standardizeDosPath(ClientRootPath);
arguments.push_back(CPath::standardizeDosPath(RyzomFilename));
arguments.push_back(CPath::standardizeDosPath(ClientPatchPath));
arguments.push_back(CPath::standardizeDosPath(ClientRootPath));
arguments.push_back(CPath::standardizeDosPath(startupPath));
#else #else
batchFilename = ClientRootPath; batchFilename = ClientRootPath;
arguments.push_back(RyzomFilename);
arguments.push_back(ClientPatchPath);
arguments.push_back(ClientRootPath);
arguments.push_back(startupPath);
#endif #endif
batchFilename += UpdateBatchFilename; batchFilename += UpdateBatchFilename;
@ -1028,19 +1045,6 @@ void CPatchManager::executeBatchFile()
// make script executable // make script executable
CFile::setRWAccess(batchFilename); CFile::setRWAccess(batchFilename);
std::vector<std::string> arguments;
// 3 first parameters are Ryzom client full path, patch directory full path and client root directory full path
#ifdef NL_OS_WINDOWS
arguments.push_back(CPath::standardizeDosPath(RyzomFilename));
arguments.push_back(CPath::standardizeDosPath(ClientPatchPath));
arguments.push_back(CPath::standardizeDosPath(ClientRootPath));
#else
arguments.push_back(RyzomFilename);
arguments.push_back(ClientPatchPath);
arguments.push_back(ClientRootPath);
#endif
// append login, password and shard // append login, password and shard
if (!LoginLogin.empty()) if (!LoginLogin.empty())
{ {

View file

@ -10,6 +10,6 @@ fi
chmod +x "$ROOTPATH/ryzom_client" chmod +x "$ROOTPATH/ryzom_client"
chmod +x "$ROOTPATH/crash_report" chmod +x "$ROOTPATH/crash_report"
chmod +x "$ROOTPATH/ryzom_client_patcher" chmod +x "$ROOTPATH/ryzom_client_patcher"
chmod +x "$ROOTPATH/ryzom_configuration" chmod +x "$ROOTPATH/ryzom_configuration_qt"
exit 0 exit 0

View file

@ -405,8 +405,8 @@ IBackupServiceInterfaceImplementation::~IBackupServiceInterfaceImplementation()
// backupInterfaceSingletonInstantiator // backupInterfaceSingletonInstantiator
// //
// This object provokes instantiation of our singleton at service startup // This object provokes instantiation of our singleton at service startup
// The instantiation of the signleton provokes registration in the singleton registry // The instantiation of the singleton provokes registration in the singleton registry
// menaing that the init() routine gets called properly in service init, etc. // meaning that the init() routine gets called properly in service init, etc.
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------
class CBackupInterfaceSingletonInstantiator class CBackupInterfaceSingletonInstantiator

View file

@ -65,7 +65,7 @@ public:
/*bool write(char *filename) /*bool write(char *filename)
{ {
FILE *outf=nlfopen(filename, "wb"); FILE *outf=NLMISC::nlfopen(filename, "wb");
if (outf==NULL) if (outf==NULL)
return false; return false;

View file

@ -205,7 +205,7 @@ inline bool CMirroredDataSet::propIsList( TPropertyIndex propIndex ) const
* Display the values of one property for all entities * Display the values of one property for all entities
*/ */
template <class T, class CPropLocationClass> template <class T, class CPropLocationClass>
inline void CMirroredDataSet::displayPropValues( TPropertyIndex propIndex, T* pt, NLMISC::CLog& log ) const inline void CMirroredDataSet::displayPropValues( TPropertyIndex propIndex, T* /* pt */, NLMISC::CLog& log ) const
{ {
// std::stringstream ss; // std::stringstream ss;
// ss << "Mirror property " << propIndex << ":" << endl; // ss << "Mirror property " << propIndex << ":" << endl;

View file

@ -99,7 +99,7 @@ public:
void addTaskAt(T t, CTask<T>* task) { task->setTime(t); _Tasks.push_back(task);_Clean = false; } void addTaskAt(T t, CTask<T>* task) { task->setTime(t); _Tasks.push_back(task);_Clean = false; }
uint32 getSize() const { return (uint32)_Tasks.size(); } uint32 getSize() const { return (uint32)_Tasks.size(); }
CTask<T>* getTaskAt(uint32 index) const { nlassert( index < _Tasks.size()); return _Tasks[index].getTask();} CTask<T>* getTaskAt(uint32 index) const { nlassert( index < _Tasks.size()); return _Tasks[index].getTask();}
void removeTaskAt(uint32 index){ nlassert( index < _Tasks.size()); _Tasks.erase(_Tasks.begin() + index); }; void removeTaskAt(uint32 index){ nlassert( index < _Tasks.size()); _Tasks.erase(_Tasks.begin() + index); }
// Waiting task are discared // Waiting task are discared

View file

@ -19,6 +19,7 @@
#include "nel/misc/singleton.h" #include "nel/misc/singleton.h"
#include <time.h> #include <time.h>
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/common.h"
#include "nel/net/module.h" #include "nel/net/module.h"
#include "nel/net/module_builder_parts.h" #include "nel/net/module_builder_parts.h"
#include "nel/net/unified_network.h" #include "nel/net/unified_network.h"
@ -297,7 +298,7 @@ namespace ADMIN
// read the persistent state file if any // read the persistent state file if any
string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+AESPersistentStateFilename; string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+AESPersistentStateFilename;
FILE *fp = fopen(filename.c_str(), "rt"); FILE *fp = nlfopen(filename, "rt");
if (fp != NULL) if (fp != NULL)
{ {
char buffer[1024]; char buffer[1024];
@ -567,7 +568,7 @@ namespace ADMIN
if (now > _LastNagiosReport+_NagiosReportDelay) if (now > _LastNagiosReport+_NagiosReportDelay)
{ {
// write the nagios report // write the nagios report
FILE *fp = fopen("aes_nagios_report.txt", "wt"); FILE *fp = nlfopen("aes_nagios_report.txt", "wt");
if (fp != NULL) if (fp != NULL)
{ {
// output the current date // output the current date
@ -632,7 +633,7 @@ namespace ADMIN
{ {
/// The persistent service orders need to be saved /// The persistent service orders need to be saved
string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+AESPersistentStateFilename; string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+AESPersistentStateFilename;
FILE *fp = fopen(filename.c_str(), "wt"); FILE *fp = nlfopen(filename, "wt");
if (fp != NULL) if (fp != NULL)
{ {
{ {
@ -801,7 +802,7 @@ namespace ADMIN
std::string getOfflineServiceState(const std::string& serviceAlias) std::string getOfflineServiceState(const std::string& serviceAlias)
{ {
// open the file for reading // open the file for reading
FILE* f= fopen(getServiceStateFileName(serviceAlias).c_str(),"rt"); FILE* f= nlfopen(getServiceStateFileName(serviceAlias), "rt");
if (f==NULL) return "STOPPED"; if (f==NULL) return "STOPPED";
// setup a buffer to hold the text read from the file // setup a buffer to hold the text read from the file
@ -825,7 +826,7 @@ namespace ADMIN
uint32 getOfflineServicePID(const std::string& serviceAlias) uint32 getOfflineServicePID(const std::string& serviceAlias)
{ {
// open the file for reading // open the file for reading
FILE* f= fopen(getServicePIDFileName(serviceAlias).c_str(),"rt"); FILE* f = nlfopen(getServicePIDFileName(serviceAlias), "rt");
if (f==NULL) return 0; if (f==NULL) return 0;
// setup a buffer to hold the text read from the file // setup a buffer to hold the text read from the file
@ -853,7 +854,7 @@ namespace ADMIN
uint32 getServiceStartLoopCounter(const std::string& serviceAlias) uint32 getServiceStartLoopCounter(const std::string& serviceAlias)
{ {
// open the file for reading // open the file for reading
FILE* f= fopen(getServiceLoopCounterFileName(serviceAlias).c_str(),"rt"); FILE* f= nlfopen(getServiceLoopCounterFileName(serviceAlias), "rt");
if (f==NULL) if (f==NULL)
return 0; return 0;
@ -936,7 +937,7 @@ namespace ADMIN
NLMISC::CFile::createDirectoryTree(path); NLMISC::CFile::createDirectoryTree(path);
// open the file for writing // open the file for writing
FILE* f= fopen(getServiceLaunchCtrlFileName(serviceAlias, path, deferred).c_str(),"wt"); FILE* f = nlfopen(getServiceLaunchCtrlFileName(serviceAlias, path, deferred).c_str(),"wt");
if (f==NULL) return false; if (f==NULL) return false;
// write the text to the file // write the text to the file

View file

@ -18,6 +18,7 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include <time.h> #include <time.h>
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/common.h"
#include "nel/misc/sstring.h" #include "nel/misc/sstring.h"
#include "nel/misc/mutable_container.h" #include "nel/misc/mutable_container.h"
#include "nel/net/service.h" #include "nel/net/service.h"
@ -195,7 +196,7 @@ namespace ADMIN
// read the persistent state file if any // read the persistent state file if any
string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+ASPersistentStateFilename; string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+ASPersistentStateFilename;
FILE *fp = fopen(filename.c_str(), "rt"); FILE *fp = nlfopen(filename, "rt");
if (fp != NULL) if (fp != NULL)
{ {
char buffer[1024]; char buffer[1024];
@ -232,7 +233,7 @@ namespace ADMIN
if (_NeedToWriteStateFile) if (_NeedToWriteStateFile)
{ {
string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+ASPersistentStateFilename; string filename = CPath::standardizePath(IService::getInstance()->SaveFilesDirectory.toString(), true)+ASPersistentStateFilename;
FILE *fp = fopen(filename.c_str(), "wt"); FILE *fp = nlfopen(filename, "wt");
if (fp != NULL) if (fp != NULL)
{ {
CSString line; CSString line;

View file

@ -18,6 +18,7 @@
#include "nel/misc/command.h" #include "nel/misc/command.h"
#include "nel/misc/variable.h" #include "nel/misc/variable.h"
#include "nel/misc/common.h"
#include "nel/misc/aabbox.h" #include "nel/misc/aabbox.h"
#include "nel/misc/vector.h" #include "nel/misc/vector.h"
#include "nel/misc/vectord.h" #include "nel/misc/vectord.h"
@ -1979,7 +1980,7 @@ public:
CBMP4Image<2,2>::SHdr imageHdr(imageWidth, imageHeight); CBMP4Image<2,2>::SHdr imageHdr(imageWidth, imageHeight);
CBMP4Image<2,2>::SPalette imagePalette; CBMP4Image<2,2>::SPalette imagePalette;
FILE *outf = fopen((OutputPath+name+".bmp").c_str(),"wb"); FILE *outf = nlfopen(OutputPath+name+".bmp", "wb");
if (outf == NULL) if (outf == NULL)
return; return;
@ -2095,8 +2096,8 @@ public:
CBMP4Image<2,2>::SHdr imageHdr(imageWidth, imageHeight); CBMP4Image<2,2>::SHdr imageHdr(imageWidth, imageHeight);
CBMP4Image<2,2>::SPalette imagePalette; CBMP4Image<2,2>::SPalette imagePalette;
FILE *outf = fopen((OutputPath+name+".bmp").c_str(),"wb"); FILE *outf = nlfopen(OutputPath+name+".bmp", "wb");
FILE *outfh = fopen((OutputPath+name+"_hm.bmp").c_str(),"wb"); FILE *outfh = nlfopen(OutputPath+name+"_hm.bmp", "wb");
if (outf == NULL) if (outf == NULL)
return; return;

View file

@ -183,7 +183,7 @@ std::string CAIScriptDataManager::dirname()
// string fullfilename = dirname() + "/" + name + ".ai_script_data"; // string fullfilename = dirname() + "/" + name + ".ai_script_data";
// if (!CFile::fileExists(fullfilename) || CFile::getFileSize(fullfilename)==0) // if (!CFile::fileExists(fullfilename) || CFile::getFileSize(fullfilename)==0)
// { // {
// FILE* fp = fopen(fullfilename.c_str(), "w"); // FILE* fp = nlfopen(fullfilename, "w");
// if (fp) // if (fp)
// { // {
// fprintf(fp, "// This file contains data for the AI script\n"); // fprintf(fp, "// This file contains data for the AI script\n");

View file

@ -25,6 +25,7 @@
#include "entities_game_service.h" #include "entities_game_service.h"
#include "egs_globals.h" #include "egs_globals.h"
#include "nel/misc/noise_value.h" #include "nel/misc/noise_value.h"
#include "nel/misc/common.h"
#include "nel/misc/variable.h" #include "nel/misc/variable.h"
#include "nel/misc/words_dictionary.h" #include "nel/misc/words_dictionary.h"
#include "game_share/time_weather_season/time_date_season_manager.h" #include "game_share/time_weather_season/time_date_season_manager.h"
@ -587,7 +588,7 @@ void CDeposit::selectRMsByFilters( std::vector<std::string>& exactRMCodesS, cons
if ( ! depositReportCreated ) if ( ! depositReportCreated )
{ {
depositReportCreated = true; depositReportCreated = true;
depositReportFile = fopen( "deposit_contents.csv", "wt" ); // fclose() auto? depositReportFile = nlfopen( "deposit_contents.csv", "wt" ); // fclose() auto?
if ( depositReportFile ) if ( depositReportFile )
{ {
fprintf( depositReportFile, "Deposit;RM;When in year;When in day;Weather;\n" ); fprintf( depositReportFile, "Deposit;RM;When in year;When in day;Weather;\n" );

View file

@ -2564,8 +2564,7 @@ void CGameItem::dumpGameItemStats( const string& fileName )
{ {
if( !fileName.empty() ) if( !fileName.empty() )
{ {
FILE * f; FILE *f = nlfopen(fileName, "w");
f = fopen(fileName.c_str(),"w");
if(f) if(f)
{ {

View file

@ -791,7 +791,7 @@ void CGameItemManager::destroyItem( CGameItemPtr &ptr )
//void CGameItemManager::dumpGameItemList( const string& fileName ) //void CGameItemManager::dumpGameItemList( const string& fileName )
//{ //{
// FILE * f; // FILE * f;
// f = fopen(fileName.c_str(),"w"); // f = nlfopen(fileName, "w");
// //
// if(f) // if(f)
// { // {

View file

@ -1240,8 +1240,8 @@ bool forageTestDoExtract(
} }
// Request and output results // Request and output results
FILE *f = fopen( std::string(getLogDirectory() + "forage_test.csv").c_str(), "at" ); FILE *f = nlfopen(getLogDirectory() + "forage_test.csv", "at" );
FILE *f2 = fopen( std::string(getLogDirectory() + "forage_test.log").c_str(), "at" ); FILE *f2 = nlfopen(getLogDirectory() + "forage_test.log", "at" );
float reqS = 1.0f / (reqPeriod * 10.0f); float reqS = 1.0f / (reqPeriod * 10.0f);
float req [CHarvestSource::NbPosRTProps]; float req [CHarvestSource::NbPosRTProps];
float abs [CHarvestSource::NbPosRTProps]; float abs [CHarvestSource::NbPosRTProps];

View file

@ -1884,13 +1884,13 @@ void CDepositMapsBatchTask::run()
if ( ! CFile::isExists( pathName ) ) if ( ! CFile::isExists( pathName ) )
CFile::createDirectory( pathName ); CFile::createDirectory( pathName );
pathName += "/"; pathName += "/";
FILE *outputF = fopen( (pathName + "deposit_maps.html").c_str(), "w" ); FILE *outputF = nlfopen(pathName + "deposit_maps.html", "w");
if ( ! outputF ) if ( ! outputF )
{ {
nlwarning( "Can't create file %sdeposit_maps.html", pathName.c_str() ); nlwarning( "Can't create file %sdeposit_maps.html", pathName.c_str() );
return; return;
} }
FILE *inputF = fopen( _InputFilename.c_str(), "r" ); FILE *inputF = nlfopen(_InputFilename, "r");
if ( ! inputF ) if ( ! inputF )
{ {
fprintf( outputF, "File %s not found", _InputFilename.c_str() ); fprintf( outputF, "File %s not found", _InputFilename.c_str() );

View file

@ -192,7 +192,7 @@ void CCDBSynchronised::write( const string& fileName )
if ( _DataStructRoot ) if ( _DataStructRoot )
{ {
TWriteCallbackArg wca; TWriteCallbackArg wca;
wca.F = fopen( fileName.c_str(),"w" ); wca.F = nlfopen(fileName, "w");
wca.Container = &_DataContainer; wca.Container = &_DataContainer;
ICDBStructNode::CTextId id; ICDBStructNode::CTextId id;
_DataStructRoot->foreachLeafCall( cbWrite, id, &wca ); _DataStructRoot->foreachLeafCall( cbWrite, id, &wca );

View file

@ -102,11 +102,11 @@ void CPlayer::checkCrashMarker()
if (!CFile::isExists(LastLoadFileName)) if (!CFile::isExists(LastLoadFileName))
{ {
// create the file if needed // create the file if needed
nlverify(LastLoad = fopen(LastLoadFileName, "wb")); nlverify(LastLoad = nlfopen(LastLoadFileName, "wb"));
fclose(LastLoad); fclose(LastLoad);
} }
nlverify(LastLoad = fopen(LastLoadFileName, "r+b")); nlverify(LastLoad = nlfopen(LastLoadFileName, "r+b"));
// check // check
uint32 lastBad[2]; uint32 lastBad[2];

View file

@ -118,7 +118,7 @@ void CSession::log(const NLMISC::CSString& lang,const NLMISC::CSString& txt)
nlassert(!fileName.empty()); nlassert(!fileName.empty());
nlinfo("Opening new log file: %s",fileName.c_str()); nlinfo("Opening new log file: %s",fileName.c_str());
_Files[lang]= fopen(fileName.c_str(),"wb"); _Files[lang]= nlfopen(fileName, "wb");
DROP_IF(_Files[lang]==NULL,"Failed to open log file for writing: "+fileName,return); DROP_IF(_Files[lang]==NULL,"Failed to open log file for writing: "+fileName,return);
} }
fprintf(_Files[lang],"%s\n",txt.c_str()); fprintf(_Files[lang],"%s\n",txt.c_str());

Some files were not shown because too many files have changed in this diff Show more