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

Method askForSave

radiantcore/map/Map.cpp:814–848  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

812}
813
814bool Map::askForSave(const std::string& title)
815{
816 if (!isModified())
817 {
818 // Map is not modified, return positive
819 return true;
820 }
821
822 // Ask the user
823 auto answer = radiant::FileSaveConfirmation::SendAndReceiveAnswer(getSaveConfirmationText(), title);
824
825 if (answer == radiant::FileSaveConfirmation::Action::Cancel)
826 {
827 return false;
828 }
829
830 if (answer == radiant::FileSaveConfirmation::Action::SaveChanges)
831 {
832 // The user wants to save the map
833 if (isUnnamed())
834 {
835 // Map still unnamed, try to save the map with a new name
836 // and take the return value from the other routine.
837 return saveAs();
838 }
839 else
840 {
841 // Map is named, save it
842 save();
843 }
844 }
845
846 // Default behaviour: allow the action
847 return true;
848}
849
850bool Map::saveAs()
851{

Callers 2

newMapMethod · 0.45
openMapFromArchiveMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected