From: <ma...@us...> - 2013-02-24 20:39:26
|
Revision: 8609 http://planeshift.svn.sourceforge.net/planeshift/?rev=8609&view=rev Author: magodra Date: 2013-02-24 20:39:20 +0000 (Sun, 24 Feb 2013) Log Message: ----------- - Added /reload locations to the reload command. Modified Paths: -------------- trunk/data/help.xml trunk/src/server/adminmanager.cpp trunk/src/server/adminmanager.h Modified: trunk/data/help.xml =================================================================== --- trunk/data/help.xml 2013-02-24 20:19:53 UTC (rev 8608) +++ trunk/data/help.xml 2013-02-24 20:39:20 UTC (rev 8609) @@ -3376,9 +3376,10 @@ </topic> <topic name="/reload"> <Contents> - <content type="text">/reload item + <content type="text">/reload [item|serveroptions|mathscript|path|locations] -Reloads the currently targeted item from the database.</content> +Reloads enties from the database. Item reload the currently targeted item from the database. For serveroptions, mathscript, path, and locations +all data is reloaded.</content> </Contents> </topic> <topic name="/runscript"> Modified: trunk/src/server/adminmanager.cpp =================================================================== --- trunk/src/server/adminmanager.cpp 2013-02-24 20:19:53 UTC (rev 8608) +++ trunk/src/server/adminmanager.cpp 2013-02-24 20:39:20 UTC (rev 8609) @@ -3841,6 +3841,7 @@ subCommandList.Push("serveroptions","#Reload all the server options"); subCommandList.Push("mathscript","#Reload all the mathscripts"); subCommandList.Push("path","#Reload all the path data"); + subCommandList.Push("locations","#Reload all the location data"); size_t index = 1; @@ -7268,6 +7269,19 @@ return id; } +void AdminManager::ShowLocations(Client* client) +{ + if(client->LocationIsDisplaying()) + { + csList<iSector*>::Iterator iter = client->GetLocationDisplaying(); + while(iter.HasNext()) + { + iSector* sector = iter.Next(); + ShowLocations(client, sector); + } + } +} + void AdminManager::ShowLocations(Client* client, iSector* sector) { csList<Location*> list; @@ -7303,6 +7317,26 @@ } } +void AdminManager::HideAllLocations(bool clearSelected) +{ + ClientIterator i(*clients); + while(i.HasNext()) + { + Client* client = i.Next(); + + // Cleare selected while we are iterating over the clients. + if(clearSelected) + { + client->SetSelectedLocationID(-1); + } + + if(client->LocationIsDisplaying()) + { + HideLocations(client); + } + } +} + void AdminManager::HideLocations(Client* client) { if(client->LocationIsDisplaying()) @@ -7341,6 +7375,20 @@ } } +void AdminManager::RedisplayAllLocations() +{ + ClientIterator i(*clients); + while(i.HasNext()) + { + Client* client = i.Next(); + + if(client->LocationIsDisplaying()) + { + ShowLocations(client); + } + } +} + void AdminManager::UpdateDisplayLocation(Location* location) { ClientIterator i(*clients); @@ -12246,6 +12294,19 @@ psserver->SendSystemOK(client->GetClientNum(), "Successfully reloaded path network."); } + else if(data->subCmd == "locations") + { + HideAllLocations(true); // And cleare Selected Locations + + delete locations; + locations = new LocationManager(); + locations->Load(EntityManager::GetSingleton().GetEngine(),db); + + RedisplayAllLocations(); + + psserver->SendSystemOK(client->GetClientNum(), "Successfully reloaded locations."); + + } } void AdminManager::HandleListWarnings(psAdminCmdMessage &msg, AdminCmdData* cmddata, Client* client) Modified: trunk/src/server/adminmanager.h =================================================================== --- trunk/src/server/adminmanager.h 2013-02-24 20:19:53 UTC (rev 8608) +++ trunk/src/server/adminmanager.h 2013-02-24 20:39:20 UTC (rev 8609) @@ -3775,8 +3775,20 @@ /** * Handle display of locations */ + void ShowLocations(Client* client); + + /** + * Handle display of locations + */ void ShowLocations(Client* client, iSector* sector); + /** + * Hide all locations for all clients. + * + * @param clearSelected Clear selected location when iterating. + */ + void HideAllLocations(bool clearSelected); + /** Hide all locations for one client. */ void HideLocations(Client* client); @@ -3785,6 +3797,11 @@ */ void HideLocations(Client* client, iSector* sector); + /** + * Show locations for all clients that have enabled display. + */ + void RedisplayAllLocations(); + /** Update location to all clients displaying locations. */ void UpdateDisplayLocation(Location* location); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |