| 1031 | } |
| 1032 | |
| 1033 | bool DisplayArcadeUnit::CanDestroy() |
| 1034 | { |
| 1035 | if (!Display::CanDestroy()) |
| 1036 | { |
| 1037 | return false; |
| 1038 | } |
| 1039 | |
| 1040 | if (_exit == IDC_OK) |
| 1041 | { |
| 1042 | CEdit* edit = dynamic_cast<CEdit*>(GetCtrl(IDC_ARCUNIT_TEXT)); |
| 1043 | if (edit) |
| 1044 | { |
| 1045 | RString text = edit->GetText(); |
| 1046 | if (text.GetLength() > 0) |
| 1047 | { |
| 1048 | if (!GWorld->GetGameState()->IdtfGoodName(text)) |
| 1049 | { |
| 1050 | CreateMsgBox(MB_BUTTON_OK, LocalizeString(IDS_MSG_VEH_NAME)); |
| 1051 | return false; |
| 1052 | } |
| 1053 | // check if text is not used |
| 1054 | for (int i = 0; i < _template->groups.Size(); i++) |
| 1055 | { |
| 1056 | ArcadeGroupInfo& gInfo = _template->groups[i]; |
| 1057 | for (int j = 0; j < gInfo.units.Size(); j++) |
| 1058 | { |
| 1059 | if (i == _indexGroup && j == _index) |
| 1060 | { |
| 1061 | continue; |
| 1062 | } |
| 1063 | if (stricmp(text, gInfo.units[j].name) == 0) |
| 1064 | { |
| 1065 | CreateMsgBox(MB_BUTTON_OK, LocalizeString(IDS_MSG_VEH_TEXT_USED)); |
| 1066 | return false; |
| 1067 | } |
| 1068 | } |
| 1069 | for (int j = 0; j < gInfo.sensors.Size(); j++) |
| 1070 | { |
| 1071 | if (stricmp(text, gInfo.sensors[j].name) == 0) |
| 1072 | { |
| 1073 | CreateMsgBox(MB_BUTTON_OK, LocalizeString(IDS_MSG_VEH_TEXT_USED)); |
| 1074 | return false; |
| 1075 | } |
| 1076 | } |
| 1077 | } |
| 1078 | for (int j = 0; j < _template->emptyVehicles.Size(); j++) |
| 1079 | { |
| 1080 | if (_indexGroup == -1 && j == _index) |
| 1081 | { |
| 1082 | continue; |
| 1083 | } |
| 1084 | if (stricmp(text, _template->emptyVehicles[j].name) == 0) |
| 1085 | { |
| 1086 | CreateMsgBox(MB_BUTTON_OK, LocalizeString(IDS_MSG_VEH_TEXT_USED)); |
| 1087 | return false; |
| 1088 | } |
| 1089 | } |
| 1090 | for (int j = 0; j < _template->sensors.Size(); j++) |
nothing calls this directly
no test coverage detected