Changed: Merge changes from next patch

This commit is contained in:
kervala 2011-06-14 19:34:28 +02:00
parent beff0f1b26
commit 3410218c50
4 changed files with 39 additions and 8 deletions

View file

@ -48,6 +48,7 @@
#include "view_bitmap.h" #include "view_bitmap.h"
#include "action_handler_tools.h" #include "action_handler_tools.h"
#include "../connection.h" #include "../connection.h"
#include "../client_chat_manager.h"
// Game specific includes // Game specific includes
#include "../motion/user_controls.h" #include "../motion/user_controls.h"
@ -99,6 +100,8 @@ extern bool IsInRingSession;
// Context help // Context help
extern void contextHelp (const std::string &help); extern void contextHelp (const std::string &help);
extern CClientChatManager ChatMngr;
void beastOrder (const std::string &orderStr, const std::string &beastIndexStr, bool confirmFree = true); void beastOrder (const std::string &orderStr, const std::string &beastIndexStr, bool confirmFree = true);
@ -973,6 +976,9 @@ public:
// Create the message for the server to execute a phrase. // Create the message for the server to execute a phrase.
sendMsgToServer("GUILD:QUIT"); sendMsgToServer("GUILD:QUIT");
CGuildManager::getInstance()->closeAllInterfaces(); CGuildManager::getInstance()->closeAllInterfaces();
if (PeopleInterraction.TheUserChat.Filter.getTargetGroup() == CChatGroup::guild)
ChatMngr.updateChatModeAndButton(CChatGroup::say);
} }
}; };
REGISTER_ACTION_HANDLER( CHandlerDoQuitGuild, "do_quit_guild"); REGISTER_ACTION_HANDLER( CHandlerDoQuitGuild, "do_quit_guild");

View file

@ -79,6 +79,10 @@ bool CDBViewNumber::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
if (ptr) _Positive = convertBool(ptr); if (ptr) _Positive = convertBool(ptr);
else _Positive = false; else _Positive = false;
ptr = xmlGetProp (cur, (xmlChar*)"format");
if (ptr) _Format = convertBool(ptr);
else _Format = false;
ptr = xmlGetProp (cur, (xmlChar*)"divisor"); ptr = xmlGetProp (cur, (xmlChar*)"divisor");
if (ptr) fromString((const char*)ptr, _Divisor); if (ptr) fromString((const char*)ptr, _Divisor);
@ -98,6 +102,30 @@ bool CDBViewNumber::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
return true; return true;
} }
// ***************************************************************************
// Helper function
ucstring formatThousands(const ucstring& s, const ucstring& separator)
{
int j;
int k;
int topI = s.length() - 1;
if (topI < 4) return s;
ucstring ns;
do
{
for (j = topI, k = 0; j >= 0 && k < 3; --j, ++k )
{
ns = s[j] + ns; // new char is added to front of ns
if( j > 0 && k == 2) ns = separator + ns; // j > 0 means still more digits
}
topI -= 3;
} while(topI >= 0);
return ns;
}
// *************************************************************************** // ***************************************************************************
void CDBViewNumber::checkCoords() void CDBViewNumber::checkCoords()
{ {
@ -106,8 +134,10 @@ void CDBViewNumber::checkCoords()
if (_Cache != val) if (_Cache != val)
{ {
_Cache= val; _Cache= val;
if (_Positive) setText(val >= 0 ? ((string)_Prefix)+toString(val)+(string)_Suffix : "?"); static ucstring separator = NLMISC::CI18N::get("uiThousandsSeparator");
else setText( ((string)_Prefix)+toString(val)+(string)_Suffix ); ucstring value = _Format ? formatThousands(toString(val), separator) : toString(val);
if (_Positive) setText(val >= 0 ? ( ucstring(_Prefix) + value + ucstring(_Suffix) ) : ucstring("?"));
else setText( ucstring(_Prefix) + value + ucstring(_Suffix) );
} }
} }

View file

@ -57,6 +57,7 @@ protected:
CInterfaceProperty _Number; CInterfaceProperty _Number;
sint64 _Cache; sint64 _Cache;
bool _Positive; // only positive values are displayed bool _Positive; // only positive values are displayed
bool _Format; // the number will be formatted (like "1,000,000") if >= 10k
sint64 _Divisor, _Modulo; sint64 _Divisor, _Modulo;
// string to append to the value (eg: meters) // string to append to the value (eg: meters)
CStringShared _Suffix; CStringShared _Suffix;

View file

@ -29,7 +29,6 @@
#include "group_html.h" #include "group_html.h"
#include "../init_main_loop.h" #include "../init_main_loop.h"
#include "inventory_manager.h" #include "inventory_manager.h"
#include "../client_chat_manager.h"
#include "../connection.h" #include "../connection.h"
#include "../entity_cl.h" #include "../entity_cl.h"
@ -49,7 +48,6 @@ using namespace std;
using namespace NLMISC; using namespace NLMISC;
extern CPeopleInterraction PeopleInterraction; extern CPeopleInterraction PeopleInterraction;
extern CClientChatManager ChatMngr;
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupListAscensor, std::string, "list_sheet_guild"); NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupListAscensor, std::string, "list_sheet_guild");
@ -541,10 +539,6 @@ void CGuildManager::closeAllInterfaces()
CGroupContainer *pGuildChat = dynamic_cast<CGroupContainer*>(pIM->getElementFromId(WIN_GUILD_CHAT)); CGroupContainer *pGuildChat = dynamic_cast<CGroupContainer*>(pIM->getElementFromId(WIN_GUILD_CHAT));
if (pGuildChat != NULL) if (pGuildChat != NULL)
pGuildChat->setActive(false); pGuildChat->setActive(false);
if (PeopleInterraction.TheUserChat.Filter.getTargetGroup() == CChatGroup::guild)
ChatMngr.updateChatModeAndButton(CChatGroup::say);
} }
// *************************************************************************** // ***************************************************************************