mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-23 07:36:16 +00:00
Fixed: Client side issues
This commit is contained in:
parent
655b79ce7b
commit
8ffcceaffd
5 changed files with 102 additions and 55 deletions
|
@ -925,27 +925,31 @@ void CChatGroupWindow::saveFreeTeller(NLMISC::IStream &f)
|
||||||
{
|
{
|
||||||
f.serialVersion(2);
|
f.serialVersion(2);
|
||||||
|
|
||||||
// Save the free teller only if it is present in the friend list to avoid the only-growing situation
|
sint32 nNbFreeTellerSaved = 0;
|
||||||
// because free tellers are never deleted in game if we save/load all the free tellers, we just create more
|
|
||||||
// and more container.
|
|
||||||
|
|
||||||
uint32 i, nNbFreeTellerSaved = 0;
|
|
||||||
for (i = 0; i < _FreeTellers.size(); ++i)
|
|
||||||
if (PeopleInterraction.FriendList.getIndexFromName(_FreeTellers[i]->getUCTitle()) != -1)
|
|
||||||
nNbFreeTellerSaved++;
|
|
||||||
|
|
||||||
f.serial(nNbFreeTellerSaved);
|
f.serial(nNbFreeTellerSaved);
|
||||||
|
|
||||||
for (i = 0; i < _FreeTellers.size(); ++i)
|
// Don't save the free tellers
|
||||||
{
|
//// Save the free teller only if it is present in the friend list to avoid the only-growing situation
|
||||||
CGroupContainer *pGC = _FreeTellers[i];
|
//// because free tellers are never deleted in game if we save/load all the free tellers, we just create more
|
||||||
|
//// and more container.
|
||||||
|
|
||||||
if (PeopleInterraction.FriendList.getIndexFromName(pGC->getUCTitle()) != -1)
|
//uint32 i, nNbFreeTellerSaved = 0;
|
||||||
{
|
//for (i = 0; i < _FreeTellers.size(); ++i)
|
||||||
ucstring sTitle = pGC->getUCTitle();
|
// if (PeopleInterraction.FriendList.getIndexFromName(_FreeTellers[i]->getUCTitle()) != -1)
|
||||||
f.serial(sTitle);
|
// nNbFreeTellerSaved++;
|
||||||
}
|
|
||||||
}
|
//f.serial(nNbFreeTellerSaved);
|
||||||
|
|
||||||
|
//for (i = 0; i < _FreeTellers.size(); ++i)
|
||||||
|
//{
|
||||||
|
// CGroupContainer *pGC = _FreeTellers[i];
|
||||||
|
|
||||||
|
// if (PeopleInterraction.FriendList.getIndexFromName(pGC->getUCTitle()) != -1)
|
||||||
|
// {
|
||||||
|
// ucstring sTitle = pGC->getUCTitle();
|
||||||
|
// f.serial(sTitle);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
|
@ -974,11 +978,12 @@ void CChatGroupWindow::loadFreeTeller(NLMISC::IStream &f)
|
||||||
ucstring sTitle;
|
ucstring sTitle;
|
||||||
f.serial(sTitle);
|
f.serial(sTitle);
|
||||||
|
|
||||||
CGroupContainer *pGC = createFreeTeller(sTitle, "");
|
// Don't actually create the free teller
|
||||||
|
//CGroupContainer *pGC = createFreeTeller(sTitle, "");
|
||||||
|
|
||||||
// With version 1 all tells are active because windows information have "title based" ids and no "sID based".
|
//// With version 1 all tells are active because windows information have "title based" ids and no "sID based".
|
||||||
if ((ver == 1) && (pGC != NULL))
|
//if ((ver == 1) && (pGC != NULL))
|
||||||
pGC->setActive(false);
|
// pGC->setActive(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,12 @@ NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupComboBox, std::string, "combo_box");
|
||||||
|
|
||||||
extern bool loginFinished;
|
extern bool loginFinished;
|
||||||
|
|
||||||
|
// Compare strings
|
||||||
|
static inline bool lt_text(const std::pair<int,ucstring> &s1, const std::pair<int,ucstring> &s2)
|
||||||
|
{
|
||||||
|
return toLower(s1.second) < toLower(s2.second);
|
||||||
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
CDBGroupComboBox::CDBGroupComboBox(const TCtorParam ¶m)
|
CDBGroupComboBox::CDBGroupComboBox(const TCtorParam ¶m)
|
||||||
: CInterfaceGroup(param)
|
: CInterfaceGroup(param)
|
||||||
|
@ -173,7 +179,7 @@ void CDBGroupComboBox::checkCoords ()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_ViewText->setText(_Texts[_CacheSelection]);
|
_ViewText->setText(_Texts[_CacheSelection].second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,7 +211,7 @@ void CDBGroupComboBox::resetTexts()
|
||||||
void CDBGroupComboBox::addText(const ucstring &text)
|
void CDBGroupComboBox::addText(const ucstring &text)
|
||||||
{
|
{
|
||||||
dirt();
|
dirt();
|
||||||
_Texts.push_back(text);
|
_Texts.push_back(make_pair(_Texts.size(), text));
|
||||||
_Textures.push_back(std::string());
|
_Textures.push_back(std::string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +220,7 @@ void CDBGroupComboBox::setText(uint i, const ucstring &text)
|
||||||
{
|
{
|
||||||
dirt();
|
dirt();
|
||||||
if(i<_Texts.size())
|
if(i<_Texts.size())
|
||||||
_Texts[i]= text;
|
_Texts[i].second= text;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
@ -223,14 +229,14 @@ void CDBGroupComboBox::insertText(uint i, const ucstring &text)
|
||||||
dirt();
|
dirt();
|
||||||
if(i<_Texts.size())
|
if(i<_Texts.size())
|
||||||
{
|
{
|
||||||
addText(_Texts[_Texts.size()-1]);
|
addText(_Texts[_Texts.size()-1].second);
|
||||||
|
|
||||||
for(uint t=i; t<_Texts.size()-1; t++)
|
for(uint t=i; t<_Texts.size()-1; t++)
|
||||||
{
|
{
|
||||||
_Texts[t+1] = _Texts[t];
|
_Texts[t+1] = _Texts[t];
|
||||||
_Textures[t+1] = _Textures[t];
|
_Textures[t+1] = _Textures[t];
|
||||||
}
|
}
|
||||||
_Texts[i]= text;
|
_Texts[i] = make_pair(i, text);
|
||||||
_Textures[i] = std::string();
|
_Textures[i] = std::string();
|
||||||
}
|
}
|
||||||
else if(i==_Texts.size())
|
else if(i==_Texts.size())
|
||||||
|
@ -246,13 +252,13 @@ void CDBGroupComboBox::setTexture(uint i, const ucstring &texture)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void CDBGroupComboBox::removeText(uint i)
|
void CDBGroupComboBox::removeText(uint nPos)
|
||||||
{
|
{
|
||||||
dirt();
|
dirt();
|
||||||
if(i<_Texts.size())
|
if(nPos<_Texts.size())
|
||||||
{
|
{
|
||||||
_Texts.erase( _Texts.begin()+i );
|
_Texts.erase( _Texts.begin()+nPos );
|
||||||
_Textures.erase( _Textures.begin()+i );
|
_Textures.erase( _Textures.begin()+nPos );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,11 +267,37 @@ const ucstring &CDBGroupComboBox::getText(uint i) const
|
||||||
{
|
{
|
||||||
static ucstring null;
|
static ucstring null;
|
||||||
if(i<_Texts.size())
|
if(i<_Texts.size())
|
||||||
return _Texts[i];
|
return _Texts[i].second;
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
const uint &CDBGroupComboBox::getTextId(uint i) const
|
||||||
|
{
|
||||||
|
static uint null = 0;
|
||||||
|
if(i<_Texts.size())
|
||||||
|
return _Texts[i].first;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
uint CDBGroupComboBox::getTextPos(uint nId) const
|
||||||
|
{
|
||||||
|
for(uint i=0; i<_Texts.size(); i++)
|
||||||
|
{
|
||||||
|
if(nId == _Texts[i].first) {return i;}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
void CDBGroupComboBox::sortText()
|
||||||
|
{
|
||||||
|
sort(_Texts.begin(), _Texts.end(), lt_text);
|
||||||
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
const ucstring &CDBGroupComboBox::getTexture(uint i) const
|
const ucstring &CDBGroupComboBox::getTexture(uint i) const
|
||||||
{
|
{
|
||||||
|
@ -355,7 +387,7 @@ void CDBGroupComboBox::setViewText(const ucstring & text)
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
ucstring CDBGroupComboBox::getViewText() const
|
ucstring CDBGroupComboBox::getViewText() const
|
||||||
{
|
{
|
||||||
return _ViewText->getText();
|
return _ViewText->getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
|
@ -66,9 +66,12 @@ public:
|
||||||
void setText(uint i, const ucstring &text);
|
void setText(uint i, const ucstring &text);
|
||||||
void insertText(uint i, const ucstring &text);
|
void insertText(uint i, const ucstring &text);
|
||||||
const ucstring &getText(uint i) const;
|
const ucstring &getText(uint i) const;
|
||||||
|
const uint &getTextId(uint i) const;
|
||||||
|
uint getTextPos(uint nId) const;
|
||||||
const ucstring &getTexture(uint i) const;
|
const ucstring &getTexture(uint i) const;
|
||||||
void removeText(uint i);
|
void removeText(uint nPos);
|
||||||
uint getNumTexts() const {return (uint)_Texts.size();}
|
uint getNumTexts() const {return (uint)_Texts.size();}
|
||||||
|
void sortText();
|
||||||
|
|
||||||
// selection
|
// selection
|
||||||
void setSelection(sint32 val);
|
void setSelection(sint32 val);
|
||||||
|
@ -125,32 +128,32 @@ public:
|
||||||
protected:
|
protected:
|
||||||
friend class CHandlerComboBoxSelectStart;
|
friend class CHandlerComboBoxSelectStart;
|
||||||
|
|
||||||
bool _LinkedToDB; // if not linked to db, then _NotLinkedToDBSelection is used instead
|
bool _LinkedToDB; // if not linked to db, then _NotLinkedToDBSelection is used instead
|
||||||
bool _Setuped;
|
bool _Setuped;
|
||||||
bool _DirtySelection;
|
bool _DirtySelection;
|
||||||
sint32 _CacheSelection;
|
sint32 _CacheSelection;
|
||||||
|
|
||||||
// sint32
|
// sint32
|
||||||
CInterfaceProperty _Selection;
|
CInterfaceProperty _Selection;
|
||||||
sint32 _NotLinkedToDBSelection;
|
sint32 _NotLinkedToDBSelection;
|
||||||
std::vector<ucstring> _Texts;
|
std::vector<std::pair<uint, ucstring>> _Texts;
|
||||||
std::vector<ucstring> _Textures;
|
std::vector<ucstring> _Textures;
|
||||||
|
|
||||||
// Action Handler called on combo click
|
// Action Handler called on combo click
|
||||||
std::string _AHOnSelectStart;
|
std::string _AHOnSelectStart;
|
||||||
|
|
||||||
// Action handler called when the content is changed
|
// Action handler called when the content is changed
|
||||||
std::string _AHOnChange;
|
std::string _AHOnChange;
|
||||||
std::string _AHOnChangeParams;
|
std::string _AHOnChangeParams;
|
||||||
bool _CallingOnChangeActionHandler; // avoid infinite loop here
|
bool _CallingOnChangeActionHandler; // avoid infinite loop here
|
||||||
|
|
||||||
|
|
||||||
// Children
|
// Children
|
||||||
CViewText *_ViewText;
|
CViewText *_ViewText;
|
||||||
CCtrlBaseButton *_SelectButton;
|
CCtrlBaseButton *_SelectButton;
|
||||||
|
|
||||||
bool _IsExternViewText;
|
bool _IsExternViewText;
|
||||||
ucstring _ExternViewText;
|
ucstring _ExternViewText;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -259,8 +259,8 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity)
|
||||||
if (strnicmp(sFame.c_str(),"tribe_",6)==0)
|
if (strnicmp(sFame.c_str(),"tribe_",6)==0)
|
||||||
{
|
{
|
||||||
tribeName = true;
|
tribeName = true;
|
||||||
// always display title for tribe
|
//// always display title for tribe
|
||||||
title = true;
|
//title = true;
|
||||||
theTribeName = STRING_MANAGER::CStringManagerClient::getFactionLocalizedName(sFame);
|
theTribeName = STRING_MANAGER::CStringManagerClient::getFactionLocalizedName(sFame);
|
||||||
// tribeName stuff disable any guild name
|
// tribeName stuff disable any guild name
|
||||||
guildName= false;
|
guildName= false;
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "../user_entity.h"
|
#include "../user_entity.h"
|
||||||
#include "ctrl_button.h"
|
#include "ctrl_button.h"
|
||||||
#include "group_editbox.h"
|
#include "group_editbox.h"
|
||||||
|
#include "dbgroup_combo_box.h"
|
||||||
#include "../string_manager_client.h"
|
#include "../string_manager_client.h"
|
||||||
#include "group_container.h"
|
#include "group_container.h"
|
||||||
#include "action_handler.h"
|
#include "action_handler.h"
|
||||||
|
@ -79,7 +80,8 @@ static CGroupMap *LastClickedMap = NULL;
|
||||||
static CCtrlButton *LastSelectedLandMark = NULL;
|
static CCtrlButton *LastSelectedLandMark = NULL;
|
||||||
static bool UseUserPositionForLandMark = false;
|
static bool UseUserPositionForLandMark = false;
|
||||||
static const char *WIN_LANDMARK_NAME="ui:interface:enter_landmark_name";
|
static const char *WIN_LANDMARK_NAME="ui:interface:enter_landmark_name";
|
||||||
|
// Loaded position of user landmark types
|
||||||
|
static std::vector<uint> LoadedPosition;
|
||||||
|
|
||||||
////////////
|
////////////
|
||||||
// GLOBAL //
|
// GLOBAL //
|
||||||
|
@ -110,6 +112,10 @@ static void popupLandMarkNameDialog()
|
||||||
CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(gc->getGroup("eb"));
|
CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(gc->getGroup("eb"));
|
||||||
if (!eb) return;
|
if (!eb) return;
|
||||||
|
|
||||||
|
// Load ComboBox for Landmarks & sort entries
|
||||||
|
CDBGroupComboBox *cb = dynamic_cast<CDBGroupComboBox *>(gc->getGroup("landmarktypes"));
|
||||||
|
cb->sortText();
|
||||||
|
|
||||||
if (LastSelectedLandMark)
|
if (LastSelectedLandMark)
|
||||||
{
|
{
|
||||||
CGroupMap *map = dynamic_cast<CGroupMap *>(LastSelectedLandMark->getParent());
|
CGroupMap *map = dynamic_cast<CGroupMap *>(LastSelectedLandMark->getParent());
|
||||||
|
@ -117,12 +123,12 @@ static void popupLandMarkNameDialog()
|
||||||
|
|
||||||
const CUserLandMark userLM = map->getUserLandMark(LastSelectedLandMark);
|
const CUserLandMark userLM = map->getUserLandMark(LastSelectedLandMark);
|
||||||
|
|
||||||
im->getDbProp( "UI:TEMP:LANDMARKTYPE" )->setValue8(userLM.Type);
|
im->getDbProp( "UI:TEMP:LANDMARKTYPE" )->setValue8(cb->getTextPos(userLM.Type));
|
||||||
eb->setInputString(userLM.Title);
|
eb->setInputString(userLM.Title);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
im->getDbProp( "UI:TEMP:LANDMARKTYPE" )->setValue8(CUserLandMark::Misc);
|
im->getDbProp( "UI:TEMP:LANDMARKTYPE" )->setValue8(cb->getTextPos(CUserLandMark::Misc));
|
||||||
eb->setInputString(ucstring());
|
eb->setInputString(ucstring());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,6 +138,7 @@ static void popupLandMarkNameDialog()
|
||||||
|
|
||||||
static void closeLandMarkNameDialog()
|
static void closeLandMarkNameDialog()
|
||||||
{
|
{
|
||||||
|
LoadedPosition.clear();
|
||||||
CInterfaceManager *im = CInterfaceManager::getInstance();
|
CInterfaceManager *im = CInterfaceManager::getInstance();
|
||||||
CGroupContainer *gc = dynamic_cast<CGroupContainer *>(im->getElementFromId(WIN_LANDMARK_NAME));
|
CGroupContainer *gc = dynamic_cast<CGroupContainer *>(im->getElementFromId(WIN_LANDMARK_NAME));
|
||||||
if (!gc) return;
|
if (!gc) return;
|
||||||
|
|
Loading…
Reference in a new issue