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