2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on
9 // TextViewDlg.cpp : implementation file
14 #include "textviewdlg.h"
20 static char THIS_FILE[] = __FILE__;
23 /////////////////////////////////////////////////////////////////////////////
24 // text_view_dlg dialog
26 text_view_dlg::text_view_dlg(CWnd* pParent /*=NULL*/)
27 : CDialog(text_view_dlg::IDD, pParent)
29 //{{AFX_DATA_INIT(text_view_dlg)
34 void text_view_dlg::DoDataExchange(CDataExchange* pDX)
36 CDialog::DoDataExchange(pDX);
37 //{{AFX_DATA_MAP(text_view_dlg)
38 DDX_Text(pDX, IDC_EDIT1, m_edit);
42 BEGIN_MESSAGE_MAP(text_view_dlg, CDialog)
43 //{{AFX_MSG_MAP(text_view_dlg)
44 ON_EN_SETFOCUS(IDC_EDIT1, OnSetfocusEdit1)
48 /////////////////////////////////////////////////////////////////////////////
49 // text_view_dlg message handlers
51 void text_view_dlg::set(int ship_class)
53 char line[256], line2[256];
54 int i, j, found = 0, comment = 0;
60 fp = cfopen("ships.tbl", "r");
63 while (cfgets(line, 255, fp)) {
64 while (line[strlen(line) - 1] == '\n')
65 line[strlen(line) - 1] = 0;
67 for (i=j=0; line[i]; i++) {
68 if (line[i] == '/' && line[i+1] == '/')
71 if (line[i] == '/' && line[i+1] == '*') {
77 if (line[i] == '*' && line[i+1] == '/') {
88 if (!strnicmp(line2, "$Name:", 6)) {
91 while (line2[i] == ' ' || line2[i] == '\t')
94 if (!stricmp(line2 + i, Ship_info[ship_class].name))
107 void text_view_dlg::OnSetfocusEdit1()
109 ((CEdit *) GetDlgItem(IDC_EDIT1)) -> SetSel(-1, -1);