MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / doUpdateMap

Method doUpdateMap

plugins/dm.gameconnection/GameConnection.cpp:778–800  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

776}
777
778void GameConnection::doUpdateMap()
779{
780 try {
781 if (!_engine->isAlive())
782 return; //no connection, don't even try
783
784 // Get map diff
785 std::string diff = saveMapDiff(_mapObserver.getChanges());
786 if (diff.empty()) {
787 return; //TODO: fail
788 }
789
790 std::string response = executeGenericRequest(actionPreamble("reloadmap-diff") + "content:\n" + diff);
791 if (response.find("HotReload: SUCCESS") != std::string::npos) {
792 //success: clear current diff, so that we don't reapply it next time
793 _mapObserver.clear();
794 }
795 }
796 catch (const DisconnectException&) {
797 //disconnected: will be handled during next think
798 return;
799 }
800}
801
802//-------------------------------------------------------------
803

Callers 1

GameConnectionPanelMethod · 0.80

Calls 6

saveMapDiffFunction · 0.85
actionPreambleFunction · 0.85
isAliveMethod · 0.45
emptyMethod · 0.45
findMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected