Adds a script to the current editable script. We will not allow this if the script is not locked, so we should allow then to unlock it at this point.
| 212 | // Adds a script to the current editable script. We will not allow this if the script is not locked, |
| 213 | // so we should allow then to unlock it at this point. |
| 214 | void CScriptWizard::OnAddScript() { |
| 215 | char scrname[MAX_SCRNAME]; |
| 216 | |
| 217 | scrname[0] = 0; |
| 218 | |
| 219 | if (strlen(ScriptFileName) == 0) { |
| 220 | OutrageMessageBox("There is no script file to add a script to! You must make one."); |
| 221 | return; |
| 222 | } |
| 223 | |
| 224 | // check if current module is locked by us. |
| 225 | if (mng_FindTrackLock(ScriptFileName, PAGETYPE_GAMEFILE) == -1) |
| 226 | OutrageMessageBox("Warning: This script is not locked by you.\nAny changes you make will not be permanent."); |
| 227 | |
| 228 | // request a name for this new script! |
| 229 | CAddScriptDialog dlg(this); |
| 230 | if (dlg.DoModal() == IDOK) { |
| 231 | // add script to listbox, then select it, then run editor |
| 232 | CListBox *lb = (CListBox *)GetDlgItem(IDC_SCR_LISTBOX); |
| 233 | char *tempstr = AddScriptBlockToScript(m_ScriptSource, (LPCSTR)dlg.m_Name, (LPCSTR)dlg.m_TypeName); |
| 234 | mem_free(m_ScriptSource); |
| 235 | m_ScriptSource = tempstr; |
| 236 | UpdateScriptListbox(); |
| 237 | lb->SelectString(-1, (LPCSTR)dlg.m_Name); |
| 238 | OnEditScript(); |
| 239 | } else { |
| 240 | OutrageMessageBox("A script name is required to continue. Cancelling action."); |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | void CScriptWizard::OnAddEvent() { |
| 245 | CListBox *listbox = (CListBox *)GetDlgItem(IDC_SCREVT_LISTBOX); |
nothing calls this directly
no test coverage detected