|
|
@ -2118,7 +2118,7 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
|
|
|
|
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
|
|
//CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
|
|
|
|
|
|
|
|
|
|
CInterfaceGroup *pList = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND));
|
|
|
|
CInterfaceGroup *pList = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND));
|
|
|
|
if (pList == NULL)
|
|
|
|
if (pList == NULL)
|
|
|
@ -2197,7 +2197,7 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
|
|
|
|
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
|
|
//CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
|
|
CInterfaceGroup *pList = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND));
|
|
|
|
CInterfaceGroup *pList = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND));
|
|
|
|
pList->clearGroups();
|
|
|
|
pList->clearGroups();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2208,32 +2208,56 @@ REGISTER_ACTION_HANDLER (CAHResetMainlandList, "reset_mainland_list");
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
class CAHMainlandSelect : public IActionHandler
|
|
|
|
class CAHMainlandSelect : public IActionHandler
|
|
|
|
{
|
|
|
|
{
|
|
|
|
virtual void execute (CCtrlBase *pCaller, const string &/* Params */)
|
|
|
|
virtual void execute (CCtrlBase *pCaller, const std::string &Params)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nlinfo("CAHMainlandSelect called");
|
|
|
|
//nlinfo("CAHMainlandSelect called");
|
|
|
|
|
|
|
|
struct CUnpush : public CInterfaceElementVisitor
|
|
|
|
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
|
|
{
|
|
|
|
|
|
|
|
CCtrlBase *Ref;
|
|
|
|
|
|
|
|
virtual void visitCtrl(CCtrlBase *ctrl)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (ctrl == Ref) return;
|
|
|
|
|
|
|
|
CCtrlBaseButton *but = dynamic_cast<CCtrlBaseButton*>(ctrl);
|
|
|
|
|
|
|
|
if (but)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
but->setPushed(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
CInterfaceGroup *list = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND));
|
|
|
|
|
|
|
|
if (!list)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
CCtrlButton *pCB = NULL;
|
|
|
|
// unselect
|
|
|
|
// Unselect
|
|
|
|
if (Params.empty())
|
|
|
|
if (MainlandSelected.asInt() != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pCB = dynamic_cast<CCtrlButton*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND ":"+toString(MainlandSelected)+":but"));
|
|
|
|
CUnpush unpusher;
|
|
|
|
if (pCB != NULL)
|
|
|
|
unpusher.Ref = pCaller;
|
|
|
|
pCB->setPushed(false);
|
|
|
|
list->visit(&unpusher);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pCB = dynamic_cast<CCtrlButton*>(pCaller);
|
|
|
|
// now select
|
|
|
|
if (pCB != NULL)
|
|
|
|
uint32 mainland;
|
|
|
|
|
|
|
|
if (Params.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string name = pCB->getId();
|
|
|
|
CCtrlButton *pCB = dynamic_cast<CCtrlButton*>(pCaller);
|
|
|
|
|
|
|
|
if (!pCB)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string name = pCB->getId();
|
|
|
|
name = name.substr(0, name.rfind(':'));
|
|
|
|
name = name.substr(0, name.rfind(':'));
|
|
|
|
uint32 mainland;
|
|
|
|
|
|
|
|
fromString(name.substr(name.rfind(':')+1,name.size()), mainland);
|
|
|
|
if (!fromString(name.substr(name.rfind(':')+1, name.size()), mainland))
|
|
|
|
MainlandSelected = (TSessionId)mainland;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
pCB->setPushed(true);
|
|
|
|
pCB->setPushed(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
if (!fromString(Params, mainland))
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// and store
|
|
|
|
|
|
|
|
MainlandSelected = (TSessionId)mainland;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
REGISTER_ACTION_HANDLER (CAHMainlandSelect, "mainland_select");
|
|
|
|
REGISTER_ACTION_HANDLER (CAHMainlandSelect, "mainland_select");
|
|
|
@ -2438,7 +2462,7 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
|
|
|
|
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
|
|
//CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
|
|
CInterfaceGroup *pList = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_KEYSET));
|
|
|
|
CInterfaceGroup *pList = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_KEYSET));
|
|
|
|
pList->clearGroups();
|
|
|
|
pList->clearGroups();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2449,21 +2473,18 @@ REGISTER_ACTION_HANDLER (CAHResetKeysetList, "reset_keyset_list");
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
class CAHResetKeysetSelect : public IActionHandler
|
|
|
|
class CAHResetKeysetSelect : public IActionHandler
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
std::string getIdPostFix(const std::string fullId)
|
|
|
|
std::string getIdPostFix(const std::string fullId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string::size_type pos = fullId.find_last_of(":");
|
|
|
|
std::string::size_type pos = fullId.find_last_of(":");
|
|
|
|
if (pos != std::string::npos)
|
|
|
|
if (pos != std::string::npos)
|
|
|
|
{
|
|
|
|
|
|
|
|
return fullId.substr(pos + 1);
|
|
|
|
return fullId.substr(pos + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
virtual void execute (CCtrlBase *pCaller, const string &/* Params */)
|
|
|
|
|
|
|
|
|
|
|
|
virtual void execute(CCtrlBase *pCaller, const std::string &Params)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!pCaller) return;
|
|
|
|
|
|
|
|
// 'unpush' all groups but the caller
|
|
|
|
// 'unpush' all groups but the caller
|
|
|
|
//
|
|
|
|
|
|
|
|
struct CUnpush : public CInterfaceElementVisitor
|
|
|
|
struct CUnpush : public CInterfaceElementVisitor
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CCtrlBase *Ref;
|
|
|
|
CCtrlBase *Ref;
|
|
|
@ -2477,31 +2498,41 @@ public:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
|
|
|
|
|
|
CInterfaceGroup *list = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_KEYSET));
|
|
|
|
CInterfaceGroup *list = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_KEYSET));
|
|
|
|
if (list)
|
|
|
|
if (!list)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// unselect
|
|
|
|
CUnpush unpusher;
|
|
|
|
CUnpush unpusher;
|
|
|
|
unpusher.Ref = pCaller;
|
|
|
|
unpusher.Ref = pCaller;
|
|
|
|
list->visit(&unpusher);
|
|
|
|
list->visit(&unpusher);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// now select
|
|
|
|
CCtrlBaseButton *but = dynamic_cast<CCtrlBaseButton*>(pCaller);
|
|
|
|
CCtrlBaseButton *but = dynamic_cast<CCtrlBaseButton*>(pCaller);
|
|
|
|
if (but)
|
|
|
|
if (but)
|
|
|
|
{
|
|
|
|
|
|
|
|
but->setPushed(true);
|
|
|
|
but->setPushed(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string id;
|
|
|
|
|
|
|
|
if (Params.empty())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!pCaller) return;
|
|
|
|
|
|
|
|
if (!pCaller->getParent()) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
id = getIdPostFix(pCaller->getParent()->getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//
|
|
|
|
else
|
|
|
|
|
|
|
|
id = getIdPostFix(Params);
|
|
|
|
|
|
|
|
|
|
|
|
GameKeySet = "keys.xml";
|
|
|
|
GameKeySet = "keys.xml";
|
|
|
|
RingEditorKeySet = "keys_r2ed.xml";
|
|
|
|
RingEditorKeySet = "keys_r2ed.xml";
|
|
|
|
if (!pCaller->getParent()) return;
|
|
|
|
|
|
|
|
// compute the 2 filenames from the id
|
|
|
|
// compute the two filenames from the id
|
|
|
|
// if id is in the built-in keysets :
|
|
|
|
// if id is in the built-in keysets
|
|
|
|
CConfigFile::CVar *keySetVar = ClientCfg.ConfigFile.getVarPtr(KeySetVarName);
|
|
|
|
CConfigFile::CVar *keySetVar = ClientCfg.ConfigFile.getVarPtr(KeySetVarName);
|
|
|
|
if (keySetVar && keySetVar->size() != 0)
|
|
|
|
if (keySetVar && keySetVar->size() > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (uint k = 0; k < keySetVar->size(); ++k)
|
|
|
|
for (uint k = 0; k < keySetVar->size(); ++k)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string id = getIdPostFix(pCaller->getParent()->getId());
|
|
|
|
|
|
|
|
if (keySetVar->asString(k) == id)
|
|
|
|
if (keySetVar->asString(k) == id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GameKeySet = "keys" + string(id.empty() ? "" : "_") + id + ".xml";
|
|
|
|
GameKeySet = "keys" + string(id.empty() ? "" : "_") + id + ".xml";
|
|
|
@ -2510,17 +2541,15 @@ public:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// ... else maybe from a previous character ?
|
|
|
|
|
|
|
|
if (CFile::isExists("save/keys_" + getIdPostFix(pCaller->getParent()->getId()) + ".xml") )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
GameKeySet = "keys_" + getIdPostFix(pCaller->getParent()->getId()) + ".xml";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CFile::isExists("save/keys_r2ed_" + getIdPostFix(pCaller->getParent()->getId()) + ".xml") )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
RingEditorKeySet = "keys_r2ed_" + getIdPostFix(pCaller->getParent()->getId()) + ".xml";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// NB : key file will be copied for real when the new 'character summary' is
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// else maybe from a previous character?
|
|
|
|
|
|
|
|
if (CFile::isExists("save/keys_" + id + ".xml"))
|
|
|
|
|
|
|
|
GameKeySet = "keys_" + id + ".xml";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CFile::isExists("save/keys_r2ed_" + id + ".xml"))
|
|
|
|
|
|
|
|
RingEditorKeySet = "keys_r2ed_" + id + ".xml";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// NB: key file will be copied for real when the new character summary is
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
REGISTER_ACTION_HANDLER (CAHResetKeysetSelect, "keyset_select");
|
|
|
|
REGISTER_ACTION_HANDLER (CAHResetKeysetSelect, "keyset_select");
|
|
|
|