aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden
diff options
context:
space:
mode:
authorMcCabe Maxsted2010-06-16 00:18:36 -0700
committerMcCabe Maxsted2010-07-03 15:20:05 -0700
commitb08845f2adc0590ec3616fc16ea35efc26f0d700 (patch)
treee45a91ab4085bcb529e865677053a54210f659df /linden
parentMade the login panel screen labels sentence-case (diff)
downloadmeta-impy-b08845f2adc0590ec3616fc16ea35efc26f0d700.zip
meta-impy-b08845f2adc0590ec3616fc16ea35efc26f0d700.tar.gz
meta-impy-b08845f2adc0590ec3616fc16ea35efc26f0d700.tar.bz2
meta-impy-b08845f2adc0590ec3616fc16ea35efc26f0d700.tar.xz
Updated hippo grid manager to include groups and voice info
Diffstat (limited to 'linden')
-rw-r--r--linden/indra/newview/hippoGridManager.cpp46
-rw-r--r--linden/indra/newview/hippoGridManager.h264
-rw-r--r--linden/indra/newview/hippoLimits.cpp5
-rw-r--r--linden/indra/newview/llstartup.cpp4
4 files changed, 168 insertions, 151 deletions
diff --git a/linden/indra/newview/hippoGridManager.cpp b/linden/indra/newview/hippoGridManager.cpp
index 10d115a..0160233 100644
--- a/linden/indra/newview/hippoGridManager.cpp
+++ b/linden/indra/newview/hippoGridManager.cpp
@@ -40,11 +40,14 @@ HippoGridInfo HippoGridInfo::FALLBACK_GRIDINFO("");
40// Initialize 40// Initialize
41 41
42HippoGridInfo::HippoGridInfo(const std::string &gridNick) : 42HippoGridInfo::HippoGridInfo(const std::string &gridNick) :
43 mPlatform(PLATFORM_OTHER), 43 mPlatform(PLATFORM_OTHER),
44 mRenderCompat(true), 44 mGridNick(gridNick),
45 mCurrencySymbol("OS$"), 45 mVoiceConnector("SLVoice"),
46 mRealCurrencySymbol("US$"), 46 mRenderCompat(true),
47 mDirectoryFee(30) 47 mMaxAgentGroups(-1),
48 mCurrencySymbol("OS$"),
49 mRealCurrencySymbol("US$"),
50 mDirectoryFee(30)
48{ 51{
49 std::string nick = gridNick; 52 std::string nick = gridNick;
50 mGridNick = sanitizeGridNick( nick ); 53 mGridNick = sanitizeGridNick( nick );
@@ -432,33 +435,36 @@ bool HippoGridInfo::retrieveGridInfo()
432 435
433std::string HippoGridInfo::getUploadFee() const 436std::string HippoGridInfo::getUploadFee() const
434{ 437{
435 std::string fee; 438 std::string fee;
436 formatFee(fee, LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(), true); 439 formatFee(fee, LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(), true);
437 return fee; 440 return fee;
438} 441}
439 442
440std::string HippoGridInfo::getGroupCreationFee() const 443std::string HippoGridInfo::getGroupCreationFee() const
441{ 444{
442 std::string fee; 445 std::string fee;
443 formatFee(fee, LLGlobalEconomy::Singleton::getInstance()->getPriceGroupCreate(), false); 446 formatFee(fee, LLGlobalEconomy::Singleton::getInstance()->getPriceGroupCreate(), false);
444 return fee; 447 return fee;
445} 448}
446 449
447std::string HippoGridInfo::getDirectoryFee() const 450std::string HippoGridInfo::getDirectoryFee() const
448{ 451{
449 std::string fee; 452 std::string fee;
450 formatFee(fee, mDirectoryFee, true); 453 formatFee(fee, mDirectoryFee, true);
451 if (fee != LLTrans::getString("hippo_label_free")) fee += "/" + LLTrans::getString("hippo_label_week"); 454 if (fee != LLTrans::getString("hippo_label_free")) fee += "/" + LLTrans::getString("hippo_label_week");
452 return fee; 455 return fee;
453} 456}
454 457
455void HippoGridInfo::formatFee(std::string &fee, int cost, bool showFree) const 458void HippoGridInfo::formatFee(std::string &fee, int cost, bool showFree) const
456{ 459{
457 if (showFree && (cost == 0)) { 460 if (showFree && (cost == 0))
458 fee = LLTrans::getString("hippo_label_free"); 461 {
459 } else { 462 fee = LLTrans::getString("hippo_label_free");
460 fee = llformat("%s%d", getCurrencySymbol().c_str(), cost); 463 }
461 } 464 else
465 {
466 fee = llformat("%s%d", getCurrencySymbol().c_str(), cost);
467 }
462} 468}
463 469
464 470
@@ -584,7 +590,7 @@ HippoGridInfo* HippoGridManager::getGrid(const std::string &grid) const
584 return it->second; 590 return it->second;
585 } else { 591 } else {
586 return 0; 592 return 0;
587 } 593 }
588} 594}
589 595
590 596
diff --git a/linden/indra/newview/hippoGridManager.h b/linden/indra/newview/hippoGridManager.h
index d99918b..b304722 100644
--- a/linden/indra/newview/hippoGridManager.h
+++ b/linden/indra/newview/hippoGridManager.h
@@ -21,150 +21,156 @@ class LLSD;
21class HippoGridInfo 21class HippoGridInfo
22{ 22{
23public: 23public:
24 enum Platform { 24 enum Platform {
25 PLATFORM_OTHER = 0, 25 PLATFORM_OTHER = 0,
26 PLATFORM_OPENSIM, 26 PLATFORM_OPENSIM,
27 PLATFORM_SECONDLIFE, 27 PLATFORM_SECONDLIFE,
28 PLATFORM_LAST 28 PLATFORM_LAST
29 }; 29 };
30 enum SearchType { 30 enum SearchType {
31 SEARCH_ALL_EMPTY, 31 SEARCH_ALL_EMPTY,
32 SEARCH_ALL_QUERY, 32 SEARCH_ALL_QUERY,
33 SEARCH_ALL_TEMPLATE 33 SEARCH_ALL_TEMPLATE
34 }; 34 };
35 35
36 explicit HippoGridInfo(const std::string &gridNick); 36 explicit HippoGridInfo(const std::string &gridNick);
37 37
38 Platform getPlatform(); 38 Platform getPlatform();
39 bool isOpenSimulator() const; 39 bool isOpenSimulator() const;
40 bool isSecondLife() const; 40 bool isSecondLife() const;
41 const std::string& getGridNick() const; 41 const std::string& getGridNick() const;
42 const std::string& getGridName() const; 42 const std::string& getGridName() const;
43 const std::string& getLoginUri() const; 43 const std::string& getLoginUri() const;
44 const std::string& getLoginPage() const; 44 const std::string& getLoginPage() const;
45 const std::string& getHelperUri() const; 45 const std::string& getHelperUri() const;
46 const std::string& getWebSite() const; 46 const std::string& getWebSite() const;
47 const std::string& getSupportUrl() const; 47 const std::string& getSupportUrl() const;
48 const std::string& getRegisterUrl() const; 48 const std::string& getRegisterUrl() const;
49 const std::string& getPasswordUrl() const; 49 const std::string& getPasswordUrl() const;
50 const std::string& getSearchUrl() const; 50 const std::string& getSearchUrl() const;
51 const std::string& getFirstName() const; 51 const std::string& getFirstName() const;
52 const std::string& getLastName() const; 52 const std::string& getLastName() const;
53 const std::string& getAvatarPassword() const; 53 const std::string& getAvatarPassword() const;
54 std::string getSearchUrl(SearchType ty, bool is_web) const; 54 const std::string &getVoiceConnector() const { return mVoiceConnector; }
55 bool isRenderCompat() const; 55 std::string getSearchUrl(SearchType ty, bool is_web) const;
56 56 bool isRenderCompat() const;
57 const std::string& getCurrencySymbol() const; 57 int getMaxAgentGroups() const { return mMaxAgentGroups; }
58 const std::string& getRealCurrencySymbol() const; 58
59 std::string getUploadFee() const; 59 const std::string& getCurrencySymbol() const;
60 std::string getGroupCreationFee() const; 60 const std::string& getRealCurrencySymbol() const;
61 std::string getDirectoryFee() const; 61 std::string getUploadFee() const;
62 62 std::string getGroupCreationFee() const;
63 void setPlatform (const std::string &platform); 63 std::string getDirectoryFee() const;
64 void setPlatform (Platform platform); 64
65 void setGridName (const std::string &gridName); 65 void setPlatform (const std::string &platform);
66 void setLoginUri (const std::string &loginUri); 66 void setPlatform (Platform platform);
67 void setLoginPage(const std::string &loginPage); 67 void setGridName (const std::string &gridName);
68 void setHelperUri(const std::string &helperUri); 68 void setLoginUri (const std::string &loginUri);
69 void setWebSite (const std::string &website); 69 void setLoginPage(const std::string &loginPage);
70 void setSupportUrl(const std::string &url); 70 void setHelperUri(const std::string &helperUri);
71 void setRegisterUrl(const std::string &url); 71 void setWebSite (const std::string &website);
72 void setPasswordUrl(const std::string &url); 72 void setSupportUrl(const std::string &url);
73 void setSearchUrl(const std::string &url); 73 void setRegisterUrl(const std::string &url);
74 void setRenderCompat(bool compat); 74 void setPasswordUrl(const std::string &url);
75 void setFirstName(const std::string &firstName); 75 void setSearchUrl(const std::string &url);
76 void setLastName(const std::string &lastName); 76 void setRenderCompat(bool compat);
77 void setAvatarPassword(const std::string &avatarPassword); 77 void setMaxAgentGroups(int max) { mMaxAgentGroups = max; }
78 78 void setFirstName(const std::string &firstName);
79 void setCurrencySymbol(const std::string &sym); 79 void setLastName(const std::string &lastName);
80 void setRealCurrencySymbol(const std::string &sym); 80 void setAvatarPassword(const std::string &avatarPassword);
81 void setDirectoryFee(int fee); 81 void setVoiceConnector(const std::string &vc) { mVoiceConnector = vc; }
82 82
83 bool retrieveGridInfo(); 83 void setCurrencySymbol(const std::string &sym);
84 84 void setRealCurrencySymbol(const std::string &sym);
85 static const char *getPlatformString(Platform platform); 85 void setDirectoryFee(int fee);
86 static std::string sanitizeGridNick(std::string &gridnick); 86
87 87 bool retrieveGridInfo();
88 static HippoGridInfo FALLBACK_GRIDINFO; 88
89 static void initFallback(); 89 static const char *getPlatformString(Platform platform);
90 static std::string sanitizeGridNick(std::string &gridnick);
91
92 static HippoGridInfo FALLBACK_GRIDINFO;
93 static void initFallback();
90 94
91private: 95private:
92 Platform mPlatform; 96 Platform mPlatform;
93 std::string mGridNick; 97 std::string mGridNick;
94 std::string mGridName; 98 std::string mGridName;
95 std::string mLoginUri; 99 std::string mLoginUri;
96 std::string mLoginPage; 100 std::string mLoginPage;
97 std::string mHelperUri; 101 std::string mHelperUri;
98 std::string mWebSite; 102 std::string mWebSite;
99 std::string mSupportUrl; 103 std::string mSupportUrl;
100 std::string mRegisterUrl; 104 std::string mRegisterUrl;
101 std::string mPasswordUrl; 105 std::string mPasswordUrl;
102 std::string mSearchUrl; 106 std::string mSearchUrl;
103 std::string mFirstName; 107 std::string mVoiceConnector;
104 std::string mLastName; 108 std::string mFirstName;
105 std::string mAvatarPassword; 109 std::string mLastName;
106 bool mRenderCompat; 110 std::string mAvatarPassword;
107 111 bool mRenderCompat;
108 std::string mCurrencySymbol; 112 int mMaxAgentGroups;
109 std::string mRealCurrencySymbol; 113
110 int mDirectoryFee; 114 std::string mCurrencySymbol;
111 115 std::string mRealCurrencySymbol;
112 // for parsing grid info XML 116 int mDirectoryFee;
113 enum XmlState { 117
114 XML_VOID, XML_GRIDNICK, XML_PLATFORM, XML_GRIDNAME, 118 // for parsing grid info XML
115 XML_LOGINURI, XML_LOGINPAGE, XML_HELPERURI, 119 enum XmlState {
116 XML_WEBSITE, XML_SUPPORT, XML_REGISTER, XML_PASSWORD, XML_SEARCH 120 XML_VOID, XML_GRIDNICK, XML_PLATFORM, XML_GRIDNAME,
117 }; 121 XML_LOGINURI, XML_LOGINPAGE, XML_HELPERURI,
118 XmlState mXmlState; 122 XML_WEBSITE, XML_SUPPORT, XML_REGISTER, XML_PASSWORD, XML_SEARCH
119 123 };
120 static std::string sanitizeUri(std::string &uri); 124 XmlState mXmlState;
121 void formatFee(std::string &fee, int cost, bool showFree) const; 125
122 126 static std::string sanitizeUri(std::string &uri);
123 static void onXmlElementStart(void *userData, const XML_Char *name, const XML_Char **atts); 127 void formatFee(std::string &fee, int cost, bool showFree) const;
124 static void onXmlElementEnd(void *userData, const XML_Char *name); 128
125 static void onXmlCharacterData(void *userData, const XML_Char *s, int len); 129 static void onXmlElementStart(void *userData, const XML_Char *name, const XML_Char **atts);
130 static void onXmlElementEnd(void *userData, const XML_Char *name);
131 static void onXmlCharacterData(void *userData, const XML_Char *s, int len);
126}; 132};
127 133
128 134
129class HippoGridManager 135class HippoGridManager
130{ 136{
131public: 137public:
132 HippoGridManager(); 138 HippoGridManager();
133 ~HippoGridManager(); 139 ~HippoGridManager();
134 140
135 void init(); 141 void init();
136 void saveFile(); 142 void saveFile();
137 void discardAndReload(); 143 void discardAndReload();
138 144
139 HippoGridInfo* getGrid(const std::string &grid) const; 145 HippoGridInfo* getGrid(const std::string &grid) const;
140 HippoGridInfo* getConnectedGrid() const; 146 HippoGridInfo* getConnectedGrid() const;
141 HippoGridInfo* getCurrentGrid() const; 147 HippoGridInfo* getCurrentGrid() const;
142 const std::string& getDefaultGridNick() const; 148 const std::string& getDefaultGridNick() const;
143 const std::string& getCurrentGridNick() const; 149 const std::string& getCurrentGridNick() const;
144 150
145 void setDefaultGrid(const std::string &grid); 151 void setDefaultGrid(const std::string &grid);
146 void setCurrentGrid(const std::string &grid); 152 void setCurrentGrid(const std::string &grid);
147 void setCurrentGridAsConnected(); 153 void setCurrentGridAsConnected();
148 154
149 void addGrid(HippoGridInfo *grid); 155 void addGrid(HippoGridInfo *grid);
150 void deleteGrid(const std::string &grid); 156 void deleteGrid(const std::string &grid);
151 157
152 typedef std::map<std::string, HippoGridInfo*>::iterator GridIterator; 158 typedef std::map<std::string, HippoGridInfo*>::iterator GridIterator;
153 GridIterator beginGrid() { return mGridInfo.begin(); } 159 GridIterator beginGrid() { return mGridInfo.begin(); }
154 GridIterator endGrid() { return mGridInfo.end(); } 160 GridIterator endGrid() { return mGridInfo.end(); }
155 161
156private: 162private:
157 std::map<std::string, HippoGridInfo*> mGridInfo; 163 std::map<std::string, HippoGridInfo*> mGridInfo;
158 std::string mDefaultGrid; 164 std::string mDefaultGrid;
159 std::string mCurrentGrid; 165 std::string mCurrentGrid;
160 HippoGridInfo *mConnectedGrid; 166 HippoGridInfo *mConnectedGrid;
161 int mDefaultGridsVersion; 167 int mDefaultGridsVersion;
162 168
163 void cleanup(); 169 void cleanup();
164 void loadFromFile(); 170 void loadFromFile();
165 void parseFile(const std::string &fileName, bool mergeIfNewer); 171 void parseFile(const std::string &fileName, bool mergeIfNewer);
166 void parseUrl(const char *url, bool mergeIfNewer); 172 void parseUrl(const char *url, bool mergeIfNewer);
167 void parseData(LLSD &gridInfo, bool mergeIfNewer); 173 void parseData(LLSD &gridInfo, bool mergeIfNewer);
168}; 174};
169 175
170 176
diff --git a/linden/indra/newview/hippoLimits.cpp b/linden/indra/newview/hippoLimits.cpp
index 0777ca3..92e2ed3 100644
--- a/linden/indra/newview/hippoLimits.cpp
+++ b/linden/indra/newview/hippoLimits.cpp
@@ -42,7 +42,8 @@ void HippoLimits::setLimits()
42 42
43void HippoLimits::setOpenSimLimits() 43void HippoLimits::setOpenSimLimits()
44{ 44{
45 mMaxAgentGroups = 100; 45 mMaxAgentGroups = gHippoGridManager->getConnectedGrid()->getMaxAgentGroups();
46 if (mMaxAgentGroups < 0) mMaxAgentGroups = 50;
46 mMaxPrimScale = 256.0f; 47 mMaxPrimScale = 256.0f;
47 mMinPrimScale = 0.001f; 48 mMinPrimScale = 0.001f;
48 mMaxHeight = 10000.0f; 49 mMaxHeight = 10000.0f;
@@ -50,7 +51,7 @@ void HippoLimits::setOpenSimLimits()
50 51
51 if (gHippoGridManager->getConnectedGrid()->isRenderCompat()) { 52 if (gHippoGridManager->getConnectedGrid()->isRenderCompat()) {
52 llinfos << "Using rendering compatible OpenSim limits" << llendl; 53 llinfos << "Using rendering compatible OpenSim limits" << llendl;
53 mMinHoleSize = 0.05f; 54 mMinHoleSize = 0.05f;
54 mMaxHollow = 0.95f; 55 mMaxHollow = 0.95f;
55 } 56 }
56 else 57 else
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp
index 63e0b4d..ac81b9c 100644
--- a/linden/indra/newview/llstartup.cpp
+++ b/linden/indra/newview/llstartup.cpp
@@ -1689,6 +1689,10 @@ bool idle_startup()
1689 if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setRealCurrencySymbol(tmp); 1689 if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setRealCurrencySymbol(tmp);
1690 tmp = LLUserAuth::getInstance()->getResponse("directory_fee"); 1690 tmp = LLUserAuth::getInstance()->getResponse("directory_fee");
1691 if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setDirectoryFee(atoi(tmp.c_str())); 1691 if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setDirectoryFee(atoi(tmp.c_str()));
1692 tmp = LLUserAuth::getInstance()->getResponse("max_groups");
1693 if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setMaxAgentGroups(atoi(tmp.c_str()));
1694 tmp = LLUserAuth::getInstance()->getResponse("VoiceConnector");
1695 if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setVoiceConnector(tmp);
1692 gHippoGridManager->saveFile(); 1696 gHippoGridManager->saveFile();
1693 gHippoLimits->setLimits(); 1697 gHippoLimits->setLimits();
1694 1698