Merge branch 'ryzomcore' into 'develop'

Merge Ryzomcore into Develop



See merge request !2
This commit is contained in:
Dremor 2016-05-02 08:01:47 +00:00
commit 159898b081
29 changed files with 404 additions and 310 deletions

View file

@ -328,6 +328,11 @@ IF(WITH_QT5)
ENDIF() ENDIF()
# freetype is needed since Qt 5.5 # freetype is needed since Qt 5.5
FIND_PACKAGE(FreeType)
IF(FREETYPE_FOUND)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIBRARIES})
ELSE()
IF(UNIX) IF(UNIX)
SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/libqtfreetype.a") SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/libqtfreetype.a")
ELSEIF(WIN32) ELSEIF(WIN32)
@ -336,6 +341,7 @@ IF(WITH_QT5)
IF(EXISTS ${FREETYPE_LIB}) IF(EXISTS ${FREETYPE_LIB})
SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIB}) SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIB})
ENDIF() ENDIF()
ENDIF()
ADD_QT_PLUGIN(accessible qtaccessiblewidgets) ADD_QT_PLUGIN(accessible qtaccessiblewidgets)
@ -348,7 +354,8 @@ IF(WITH_QT5)
IF(WIN32) IF(WIN32)
SET(QT_LIBRARIES ${QT_LIBRARIES} SET(QT_LIBRARIES ${QT_LIBRARIES}
${WINSDK_LIBRARY_DIR}/Crypt32.lib ${WINSDK_LIBRARY_DIR}/Crypt32.lib
${WINSDK_LIBRARY_DIR}/WS2_32.Lib) ${WINSDK_LIBRARY_DIR}/WS2_32.Lib
${WINSDK_LIBRARY_DIR}/IPHlpApi.Lib)
ENDIF() ENDIF()
# Core # Core

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

@ -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,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

@ -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

@ -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

@ -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 }
else if (c < 224 && i + 1 < f_size)
{
//possibly 2byte UTF8
c2 = (unsigned char)(str[i+1]); c2 = (unsigned char)(str[i+1]);
if(c2>127 && c2<192){//valid 2byte UTF8
if(c==194 && c2<160){//control char, skipping 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 }
else if (c < 240 && i + 2 < f_size)
{
// possibly 3byte UTF8
c2 = (unsigned char)(str[i+1]); c2 = (unsigned char)(str[i+1]);
c3 = (unsigned char)(str[i+2]); c3 = (unsigned char)(str[i+2]);
if(c2>127 && c2<192 && c3>127 && c3<192){//valid 3byte UTF8
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 }
else if (c < 245 && i + 3 < f_size)
{
//possibly 4byte UTF8
c2 = (unsigned char)(str[i+1]); c2 = (unsigned char)(str[i+1]);
c3 = (unsigned char)(str[i+2]); c3 = (unsigned char)(str[i+2]);
c4 = (unsigned char)(str[i+3]); c4 = (unsigned char)(str[i+3]);
if(c2>127 && c2<192 && c3>127 && c3<192 && c4>127 && c4<192){//valid 4byte UTF8 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

@ -1258,7 +1258,7 @@ namespace NLGUI
getWindowForActiveMasterGroup(newCtrl->getContextHelpWindowName()); getWindowForActiveMasterGroup(newCtrl->getContextHelpWindowName());
uint32 _ScreenH, _ScreenW; uint32 _ScreenH, _ScreenW;
CViewRenderer::getInstance()->getScreenSize( _ScreenH, _ScreenW ); CViewRenderer::getInstance()->getScreenSize( _ScreenW, _ScreenH );
if(ttPosRef==Hotspot_TTAuto || ttParentRef==Hotspot_TTAuto) if(ttPosRef==Hotspot_TTAuto || ttParentRef==Hotspot_TTAuto)
{ {

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

@ -220,6 +220,11 @@ bool CCmdArgs::parse(int argc, char **argv)
for(sint i = 0; i < argc; ++i) for(sint i = 0; i < argc; ++i)
{ {
#ifdef NL_OS_MAC
// get rid of -psn_* arguments under OS X
if (strncmp(argv[i], "-psn_", 5) == 0) continue;
#endif
args.push_back(argv[i]); args.push_back(argv[i]);
} }
@ -245,7 +250,7 @@ bool CCmdArgs::parse(const std::vector<std::string> &argv)
uint argc = argv.size(); uint argc = argv.size();
// process each argument // process each argument
for (sint i = 1; i < argc; i++) for (uint i = 1; i < argc; i++)
{ {
std::string name = argv[i]; std::string name = argv[i];

View file

@ -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

@ -830,15 +830,15 @@ void CUnifiedNetwork::addService(const string &name, const vector<CInetAddress>
// 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
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 ()); 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

@ -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

@ -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

@ -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,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

@ -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

@ -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

View file

@ -602,7 +602,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);
@ -1439,9 +1439,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

@ -20,6 +20,7 @@
#include <curl/curl.h> #include <curl/curl.h>
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <openssl/err.h>
using namespace NLMISC; using namespace NLMISC;
using namespace NLNET; using namespace NLNET;
@ -62,11 +63,11 @@ bool CCurlHttpClient::authenticate(const std::string &user, const std::string &p
const char *CAFilename = "ssl_ca_cert.pem"; // this is the certificate "Thawte Server CA" const char *CAFilename = "ssl_ca_cert.pem"; // this is the certificate "Thawte Server CA"
// *************************************************************************** // ***************************************************************************
static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm) static CURLcode sslctx_function(CURL * /* curl */, void *sslctx, void * /* parm */)
{ {
// look for certificate in search paths // look for certificate in search paths
string path = CPath::lookup(CAFilename); string path = CPath::lookup(CAFilename);
nldebug("Cert path '%s'", path.c_str()); nlinfo("Cert path '%s'", path.c_str());
if (path.empty()) if (path.empty())
{ {
@ -92,6 +93,8 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
// get a BIO // get a BIO
BIO *bio = BIO_new_mem_buf(&buffer[0], file.getFileSize()); BIO *bio = BIO_new_mem_buf(&buffer[0], file.getFileSize());
char errorBuffer[1024];
if (bio) if (bio)
{ {
// get a pointer to the X509 certificate store (which may be empty!) // get a pointer to the X509 certificate store (which may be empty!)
@ -113,10 +116,21 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
// add our certificate to this store // add our certificate to this store
if (X509_STORE_add_cert(store, itmp->x509) == 0) if (X509_STORE_add_cert(store, itmp->x509) == 0)
{ {
nlwarning("Error adding certificate"); uint errCode = ERR_get_error();
// ignore already in hash table errors
if (ERR_GET_LIB(errCode) != ERR_LIB_X509 || ERR_GET_REASON(errCode) != X509_R_CERT_ALREADY_IN_HASH_TABLE)
{
ERR_error_string_n(errCode, errorBuffer, 1024);
nlwarning("Error adding certificate %s: %s", itmp->x509->name, errorBuffer);
res = CURLE_SSL_CACERT; res = CURLE_SSL_CACERT;
} }
} }
else
{
nlinfo("Added certificate %s", itmp->x509->name);
}
}
} }
// cleanup // cleanup
@ -148,7 +162,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

@ -1833,7 +1833,8 @@ bool CInterfaceManager::saveConfig (const string &filename)
COFile f; COFile f;
if (!f.open(filename)) return false; // using temporary file, so no f.close() unless its a success
if (!f.open(filename, false, false, true)) return false;
CInterfaceConfig ic; CInterfaceConfig ic;
@ -1880,7 +1881,6 @@ bool CInterfaceManager::saveConfig (const string &filename)
{ {
nlwarning("Config saving failed"); nlwarning("Config saving failed");
// couldn't save result so do not continue // couldn't save result so do not continue
f.close();
return false; return false;
} }
@ -1936,14 +1936,14 @@ bool CInterfaceManager::saveConfig (const string &filename)
nlwarning("Bad user dyn chat saving"); nlwarning("Bad user dyn chat saving");
return false; return false;
} }
f.close();
} }
catch(const NLMISC::EStream &) catch(const NLMISC::EStream &)
{ {
f.close();
nlwarning("Config saving failed."); nlwarning("Config saving failed.");
return false; return false;
} }
f.close();
ContinentMngr.serialFOWMaps(); ContinentMngr.serialFOWMaps();
@ -2652,7 +2652,8 @@ bool CInterfaceManager::saveKeys(const std::string &filename)
try try
{ {
COFile file; COFile file;
if (file.open (filename)) // using temporary file, so no file.close() unless its a success
if (file.open (filename, false, false, true))
{ {
COXml xmlStream; COXml xmlStream;
xmlStream.init (&file); xmlStream.init (&file);
@ -2682,8 +2683,7 @@ bool CInterfaceManager::saveKeys(const std::string &filename)
} }
catch (const Exception &e) catch (const Exception &e)
{ {
nlwarning ("Error while writing the file %s : %s. Remove it.", filename.c_str(), e.what ()); nlwarning ("Error while writing the file %s : %s.", filename.c_str(), e.what ());
CFile::deleteFile(filename);
} }
return ret; return ret;
} }

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

@ -1040,6 +1040,13 @@ void CPatchManager::executeBatchFile()
arguments.push_back(startupPath); arguments.push_back(startupPath);
#endif #endif
// log parameters passed to Ryzom client
nlinfo("Restarting Ryzom...");
nlinfo("RyzomFilename = %s", RyzomFilename.c_str());
nlinfo("ClientPatchPath = %s", ClientPatchPath.c_str());
nlinfo("ClientRootPath = %s", ClientRootPath.c_str());
nlinfo("StartupPath = %s", startupPath.c_str());
batchFilename += UpdateBatchFilename; batchFilename += UpdateBatchFilename;
// make script executable // make script executable

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

@ -488,7 +488,7 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
{ {
// if( itCl->second->isMuted() ) // if( itCl->second->isMuted() )
CEntityId eid = TheDataset.getEntityId(sender); CEntityId eid = TheDataset.getEntityId(sender);
if(_MutedUniverseUsers.find( eid ) != _MutedUniverseUsers.end()) if(_MutedUsers.find( eid ) != _MutedUsers.end())
{ {
nldebug("IOSCM: chat The player %s:%x is universe muted", nldebug("IOSCM: chat The player %s:%x is universe muted",
TheDataset.getEntityId(sender).toString().c_str(), TheDataset.getEntityId(sender).toString().c_str(),
@ -650,7 +650,7 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
// If universal channel check if player muted // If universal channel check if player muted
if (session->getChan()->UniversalChannel) if (session->getChan()->UniversalChannel)
{ {
if(_MutedUsers.find( eid ) != _MutedUsers.end()) if(_MutedUniverseUsers.find( eid ) != _MutedUniverseUsers.end())
{ {
nldebug("IOSCM: chat The player %s:%x is muted", nldebug("IOSCM: chat The player %s:%x is muted",
TheDataset.getEntityId(sender).toString().c_str(), TheDataset.getEntityId(sender).toString().c_str(),

View file

@ -17,14 +17,6 @@
#ifndef STDPCH_H #ifndef STDPCH_H
#define STDPCH_H #define STDPCH_H
#include <qglobal.h>
#ifdef Q_COMPILER_RVALUE_REFS
#undef Q_COMPILER_RVALUE_REFS
#endif
#include <string>
#include <nel/misc/types_nl.h> #include <nel/misc/types_nl.h>
#include <nel/misc/config_file.h> #include <nel/misc/config_file.h>