| 776 | } |
| 777 | |
| 778 | void 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 |
no test coverage detected