Merge with develop

--HG--
branch : compatibility-develop
This commit is contained in:
kervala 2016-12-18 20:44:33 +01:00
commit c8bc57d0a4
17 changed files with 291 additions and 240 deletions

View file

@ -1,5 +1,3 @@
PROJECT(NeL CXX C)
IF(WITH_STATIC_DRIVERS) IF(WITH_STATIC_DRIVERS)
ADD_DEFINITIONS(-DNL_STATIC) ADD_DEFINITIONS(-DNL_STATIC)
ENDIF() ENDIF()
@ -17,7 +15,6 @@ IF(WITH_3D)
IF(WITH_NEL_CEGUI) IF(WITH_NEL_CEGUI)
FIND_PACKAGE(CEGUI) FIND_PACKAGE(CEGUI)
ENDIF() ENDIF()
ENDIF() ENDIF()
IF(WITH_SOUND) IF(WITH_SOUND)

View file

@ -289,7 +289,7 @@ bool CForm::insertParent (uint before, const std::string &filename, CForm *paren
else else
{ {
// Output an error // Output an error
warning (false, "insertParent", "Can't insert parent form (%s) that has not the same DFN.", filename); warning (false, "insertParent", "Can't insert parent form (%s) that has not the same DFN.", filename.c_str());
} }
return false; return false;

View file

@ -171,7 +171,7 @@ CFormDfn *CFormLoader::loadFormDfn (const std::string &filename, bool forceLoad)
else else
{ {
// Output error // Output error
warning (false, "loadFormDfn", "Can't open the form file (%s).", filename); warning (false, "loadFormDfn", "Can't open the form file (%s).", filename.c_str());
// Delete the formDfn // Delete the formDfn
delete formDfn; delete formDfn;
@ -182,7 +182,7 @@ CFormDfn *CFormLoader::loadFormDfn (const std::string &filename, bool forceLoad)
catch (const Exception &e) catch (const Exception &e)
{ {
// Output error // Output error
warning (false, "loadFormDfn", "Error while loading the form (%s): %s", filename, e.what()); warning (false, "loadFormDfn", "Error while loading the form (%s): %s", filename.c_str(), e.what());
// Delete the formDfn // Delete the formDfn
delete formDfn; delete formDfn;
@ -257,7 +257,7 @@ UForm *CFormLoader::loadForm (const std::string &filename)
else else
{ {
// Output error // Output error
warning (false, "loadForm", "Can't open the form file (%s).", filename); warning (false, "loadForm", "Can't open the form file (%s).", filename.c_str());
// Delete the form // Delete the form
delete form; delete form;
@ -279,7 +279,7 @@ UForm *CFormLoader::loadForm (const std::string &filename)
catch (const Exception &e) catch (const Exception &e)
{ {
// Output error // Output error
warning (false, "loadForm", "Error while loading the form (%s): %s", filename, e.what()); warning (false, "loadForm", "Error while loading the form (%s): %s", filename.c_str(), e.what());
// Delete the form // Delete the form
delete form; delete form;
@ -317,7 +317,7 @@ void CFormLoader::warning (bool exception, const std::string &function, const ch
va_end( args ); va_end( args );
// Set the warning // Set the warning
NLGEORGES::warning (exception, "(CFormLoader::%s) : %s", function, buffer); NLGEORGES::warning (exception, "(CFormLoader::%s) : %s", function.c_str(), buffer);
} }
// *************************************************************************** // ***************************************************************************

View file

@ -1800,7 +1800,7 @@ namespace NLGUI
addLine(arg1, ls.toString(2), ls.toString(3), ls.toString(4)); addLine(arg1, ls.toString(2), ls.toString(3), ls.toString(4));
return 0; return 0;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
int CGroupSubMenu::luaAddIconLine(CLuaState &ls) int CGroupSubMenu::luaAddIconLine(CLuaState &ls)
{ {
@ -1816,7 +1816,7 @@ namespace NLGUI
addLine(arg1, ls.toString(2), ls.toString(3), ls.toString(4), string(), ls.toString(5)); addLine(arg1, ls.toString(2), ls.toString(3), ls.toString(4), string(), ls.toString(5));
return 0; return 0;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
int CGroupSubMenu::luaAddLineAtIndex(CLuaState &ls) int CGroupSubMenu::luaAddLineAtIndex(CLuaState &ls)
{ {

View file

@ -100,8 +100,8 @@ namespace NLGUI
_PointerMiddleDownY = _PointerY; _PointerMiddleDownY = _PointerY;
} }
} }
// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
void CViewPointerBase::setPointerRightDown (bool pd) void CViewPointerBase::setPointerRightDown (bool pd)
{ {
_PointerRightDown = pd; _PointerRightDown = pd;
@ -147,7 +147,7 @@ namespace NLGUI
{ {
x = _PointerDownX; x = _PointerDownX;
y = _PointerDownY; y = _PointerDownY;
return _PointerDown; return _PointerDown;
} }
@ -156,7 +156,7 @@ namespace NLGUI
{ {
x = _PointerMiddleDownX; x = _PointerMiddleDownX;
y = _PointerMiddleDownY; y = _PointerMiddleDownY;
return _PointerMiddleDown; return _PointerMiddleDown;
} }
@ -165,7 +165,7 @@ namespace NLGUI
{ {
x = _PointerRightDownX; x = _PointerRightDownX;
y = _PointerRightDownY; y = _PointerRightDownY;
return _PointerRightDown; return _PointerRightDown;
} }

View file

@ -828,17 +828,18 @@ 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 loopback ip address, it's ok
if (!addr[i].isLoopbackIPAddress()) 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 ())
{ {
break; // it's ok, we can try // it's ok, we can try
break;
} }
} }
@ -1272,7 +1273,8 @@ 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 {
// default network
//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())
@ -1293,7 +1295,6 @@ 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())
{ {
if (nid != 0xFF) if (nid != 0xFF)
{ {
// not a default network. There's a problem with the selected connectionID, so try to find a valid one // not a default network. There's a problem with the selected connectionID, so try to find a valid one

View file

@ -6,7 +6,7 @@
<lua file="webig.lua" /> <lua file="webig.lua" />
<lua file="json.lua" /> <lua file="json.lua" />
<lua file="sceneedit.lua" /> <lua file="sceneedit.lua" />
<!-- //////////// STYLE : webigchat_desc /////////// --> <!-- //////////// STYLE : webigchat_desc /////////// -->
<style style="webigchat_desc" type="text" fontsize="12" justification="dont_clip_word" color="0 0 0 255" global_color="false" multi_line="true" multi_line_space="0" line_maxw="320" multi_line_maxw_only="true" /> <style style="webigchat_desc" type="text" fontsize="12" justification="dont_clip_word" color="0 0 0 255" global_color="false" multi_line="true" multi_line_space="0" line_maxw="320" multi_line_maxw_only="true" />
<!-- //////////// STYLE : webigchat_option /////////// --> <!-- //////////// STYLE : webigchat_option /////////// -->

View file

@ -559,7 +559,7 @@ void checkUnderCursor()
selectedInstance.getMaterial(j).setShininess( 1000.0f ); selectedInstance.getMaterial(j).setShininess( 1000.0f );
} }
} }
selectedInstanceURL = instref.ContextURL; selectedInstanceURL = instref.ContextURL;
if (instref.ContextText.empty()) if (instref.ContextText.empty())
{ {

View file

@ -536,11 +536,11 @@ CShapeInstanceReference CEntityManager::createInstance(const string& shape, cons
if (!Scene) return nullinstref; if (!Scene) return nullinstref;
UInstance instance = Scene->createInstance(shape); UInstance instance = Scene->createInstance(shape);
if(!instance.empty()) if(!instance.empty())
{ {
UMovePrimitive *primitive = NULL; UMovePrimitive *primitive = NULL;
if (PACS && haveCollisions) if (PACS && haveCollisions)
{ {
primitive = PACS->addCollisionablePrimitive(dynamicWI, 1); primitive = PACS->addCollisionablePrimitive(dynamicWI, 1);
@ -732,9 +732,8 @@ bool CEntityManager::instancesRemoved()
return instRemoved; return instRemoved;
} }
bool CEntityManager::setupInstance(uint32 idx, const vector<string> &keys, const vector<string> &values)
{
bool CEntityManager::setupInstance(uint32 idx, const vector<string> &keys, const vector<string> &values) {
if (!Scene || idx >= _ShapeInstances.size() || _ShapeInstances[idx].Deleted) if (!Scene || idx >= _ShapeInstances.size() || _ShapeInstances[idx].Deleted)
return false; return false;
@ -881,6 +880,8 @@ bool CEntityManager::setupInstance(uint32 idx, const vector<string> &keys, const
primitive->setObstacle(active); primitive->setObstacle(active);
} }
} }
return true;
} }
@ -920,7 +921,7 @@ CShapeInstanceReference CEntityManager::getShapeInstanceUnderPos(float x, float
_ShapeInstances[i].Instance.getShapeAABBox(bbox); _ShapeInstances[i].Instance.getShapeAABBox(bbox);
CVector bbox_min; CVector bbox_min;
CVector bbox_max; CVector bbox_max;
if (bbox.getCenter() == CVector::Null) if (bbox.getCenter() == CVector::Null)
{ {
bbox_min = CVector(-0.5f, -0.5f, -0.5f); bbox_min = CVector(-0.5f, -0.5f, -0.5f);
@ -931,9 +932,9 @@ CShapeInstanceReference CEntityManager::getShapeInstanceUnderPos(float x, float
bbox_min = bbox.getMin(); bbox_min = bbox.getMin();
bbox_max = bbox.getMax(); bbox_max = bbox.getMax();
} }
bbox.setMinMax((bbox_min*_ShapeInstances[i].Instance.getScale().x)+_ShapeInstances[i].Instance.getPos(), (bbox_max*_ShapeInstances[i].Instance.getScale().x)+_ShapeInstances[i].Instance.getPos()); bbox.setMinMax((bbox_min*_ShapeInstances[i].Instance.getScale().x)+_ShapeInstances[i].Instance.getPos(), (bbox_max*_ShapeInstances[i].Instance.getScale().x)+_ShapeInstances[i].Instance.getPos());
if(bbox.intersect(pos, pos+dir*100.0f)) if(bbox.intersect(pos, pos+dir*100.0f))
{ {
float dist = (bbox.getCenter()-pos).norm(); float dist = (bbox.getCenter()-pos).norm();

View file

@ -271,7 +271,7 @@ void HandleSystemCursorCapture(const CEvent &event)
{ {
CEventMouseDown &em = (CEventMouseDown &) event; CEventMouseDown &em = (CEventMouseDown &) event;
DownMouseButtons |= em.Button & (leftButton | middleButton | rightButton); DownMouseButtons |= em.Button & (leftButton | middleButton | rightButton);
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() ); CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
if (cursor) if (cursor)
{ {
@ -279,7 +279,7 @@ void HandleSystemCursorCapture(const CEvent &event)
cursor->setPointerMiddleDown(em.Button == middleButton); cursor->setPointerMiddleDown(em.Button == middleButton);
cursor->setPointerRightDown(em.Button == rightButton); cursor->setPointerRightDown(em.Button == rightButton);
} }
Driver->setCapture(true); Driver->setCapture(true);
} }

View file

@ -2586,7 +2586,7 @@ class CAHAddShape : public IActionHandler
} }
} }
} }
if (transparency.empty()) if (transparency.empty())
::makeInstanceTransparent(instance, 255, false); ::makeInstanceTransparent(instance, 255, false);
else else
@ -2654,7 +2654,6 @@ class CAHAddShape : public IActionHandler
}; };
REGISTER_ACTION_HANDLER (CAHAddShape, "add_shape"); REGISTER_ACTION_HANDLER (CAHAddShape, "add_shape");
class CAHRemoveShapes : public IActionHandler class CAHRemoveShapes : public IActionHandler
{ {
virtual void execute (CCtrlBase * /* pCaller */, const string &Params) virtual void execute (CCtrlBase * /* pCaller */, const string &Params)

File diff suppressed because it is too large Load diff

View file

@ -219,7 +219,7 @@ private:
static int getMouseRightDown(CLuaState &ls); static int getMouseRightDown(CLuaState &ls);
static int getShapeIdAt(CLuaState &ls); static int getShapeIdAt(CLuaState &ls);
static int setupShape(CLuaState &ls); static int setupShape(CLuaState &ls);
static void setMouseCursor(const std::string texture); static void setMouseCursor(const std::string &texture);
// open the window to do a tell to 'player', if 'msg' is not empty, then the message will be sent immediatly // open the window to do a tell to 'player', if 'msg' is not empty, then the message will be sent immediatly
// else, current command of the chat window will be replaced with tell 'player' // else, current command of the chat window will be replaced with tell 'player'
static void tell(const ucstring &player, const ucstring &msg); static void tell(const ucstring &player, const ucstring &msg);

View file

@ -484,19 +484,19 @@ bool CTool::computeNearestValidSurfaceFromHeightMap(float x, float y, NLMISC::CV
const CScenarioEntryPoints::CCompleteIsland *islandDesc = getEditor().getIslandCollision().getCurrIslandDesc(); const CScenarioEntryPoints::CCompleteIsland *islandDesc = getEditor().getIslandCollision().getCurrIslandDesc();
if (!islandDesc) return false; if (!islandDesc) return false;
sint mapX = (sint) (x - islandDesc->XMin); sint mapX = (sint) (x - islandDesc->XMin);
sint mapY = (sint) (y - islandDesc->YMin); sint mapY = (sint) (y - islandDesc->YMin);
if (mapX < 0 || mapY < 0 || mapX >= (islandDesc->XMax - islandDesc->XMin) || mapY >= (islandDesc->YMax - islandDesc->YMin)) return false; if (mapX < 0 || mapY < 0 || mapX >= (islandDesc->XMax - islandDesc->XMin) || mapY >= (islandDesc->YMax - islandDesc->YMin)) return false;
sint hmZ = heightMap(mapX, mapY); sint hmZ = heightMap(mapX, mapY);
if (hmZ >= 0x7ffe) return false; // not an accessible pos if (hmZ >= 0x7ffe) return false; // not an accessible pos
if (!isIslandValidPos(heightMap, *islandDesc, x + 0.5f, y) || if (!isIslandValidPos(heightMap, *islandDesc, x + 0.5f, y) ||
!isIslandValidPos(heightMap, *islandDesc, x - 0.5f, y) || !isIslandValidPos(heightMap, *islandDesc, x - 0.5f, y) ||
!isIslandValidPos(heightMap, *islandDesc, x, y + 0.5f) || !isIslandValidPos(heightMap, *islandDesc, x, y + 0.5f) ||
!isIslandValidPos(heightMap, *islandDesc, x, y - 0.5f)) return false; !isIslandValidPos(heightMap, *islandDesc, x, y - 0.5f)) return false;
float z = 1.f + 2.f * hmZ; float z = 1.f + 2.f * hmZ;
// this is a possibly valid position // this is a possibly valid position
// compute nearest surface from here, and see if not far from the intersection // compute nearest surface from here, and see if not far from the intersection
@ -515,7 +515,7 @@ bool CTool::computeNearestValidSurfaceFromHeightMap(float x, float y, NLMISC::CV
inter1Found = inter1Found && normal1.z >= minAngleSin; inter1Found = inter1Found && normal1.z >= minAngleSin;
inter2Found = inter2Found && normal2.z >= minAngleSin; inter2Found = inter2Found && normal2.z >= minAngleSin;
if (!inter1Found && !inter2Found) return false; if (!inter1Found && !inter2Found) return false;
if (inter1Found && inter2Found) if (inter1Found && inter2Found)
{ {
// because z in heightmap in usually a 'ceil' of real height, tends to favor surface below // because z in heightmap in usually a 'ceil' of real height, tends to favor surface below
@ -797,7 +797,7 @@ bool CTool::isMouseCaptured()
} }
// ********************************************************************************************************* // *********************************************************************************************************
void CTool::setMouseCursor(const char *cursorTexture) void CTool::setMouseCursor(const std::string &cursorTexture)
{ {
//H_AUTO(R2_CTool_setMouseCursor) //H_AUTO(R2_CTool_setMouseCursor)
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() ); CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );

View file

@ -224,8 +224,7 @@ public:
// Get mouse y position // Get mouse y position
static sint32 getMouseY(); static sint32 getMouseY();
// Set the current mouse cursor // Set the current mouse cursor
static void setMouseCursor(const char *cursorTexture); static void setMouseCursor(const std::string &cursorTexture);
static void setMouseCursor(const std::string &cursorTexture) { setMouseCursor(cursorTexture.c_str()); }
/** Compute a view vector (with its direction z set to 1) from coordinate of the mouse on screen /** Compute a view vector (with its direction z set to 1) from coordinate of the mouse on screen
* If the mouse is on the island map, then a vector looking down from heights will be returned * If the mouse is on the island map, then a vector looking down from heights will be returned
*/ */

View file

@ -414,21 +414,21 @@ void CToolChoosePos::updateBeforeRender()
{ {
if (_MultiPos && isShiftDown() && !_MultiPosLocked) if (_MultiPos && isShiftDown() && !_MultiPosLocked)
{ {
setMouseCursor(_CursValidMulti.c_str()); setMouseCursor(_CursValidMulti);
} }
else else
{ {
setMouseCursor(_CursValid.c_str()); setMouseCursor(_CursValid);
} }
} }
else else
{ {
setMouseCursor(_CursInvalid.c_str()); setMouseCursor(_CursInvalid);
} }
} }
else else
{ {
setMouseCursor(_CursValid.c_str()); setMouseCursor(_CursValid);
} }
} }

View file

@ -596,7 +596,7 @@ void CToolCreateEntity::updateBeforeRender()
} }
CGroupMap *worldMap = getWorldMap(); CGroupMap *worldMap = getWorldMap();
if (worldMap) worldMap->setSelectionAxis(_ValidArray); if (worldMap) worldMap->setSelectionAxis(_ValidArray);
setMouseCursor(_ValidArray ? _CursValid.c_str() : _CursInvalid.c_str()); setMouseCursor(_ValidArray ? _CursValid : _CursInvalid);
} }
// *************************************************************** // ***************************************************************