[516d32]: 2da.h Maximize Restore History

Download this file

2da.h    143 lines (125 with data), 3.8 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// 2da.h: interface for the C2da class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_2DA_H__D3555E4F_E3B8_492D_ABEA_638AF2B91177__INCLUDED_)
#define AFX_2DA_H__D3555E4F_E3B8_492D_ABEA_638AF2B91177__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "chitem.h"
class CStringMapCompiler: public CStringMapToCompiler
{
public:
~CStringMapCompiler()
{
CString key;
compiler_data value;
POSITION pos;
pos=GetStartPosition();
while(pos)
{
GetNextAssoc(pos, key, value);
if(value.parameters)
{
delete [] value.parameters;
value.parameters=NULL;
}
}
}
};
class C2da
{
public:
C2da();
virtual ~C2da();
void new_2da();
void AddRow(int row, CString label, CString def);
int AddColumn(int col, CString label, CString def);
int RemoveRow(int row);
int RemoveColumn(int col);
int Read2DAFromFile(int fhandle, int ml);
int Write2DAToFile(int fhandle);
int CopyColumn(int col);
int CopyRow(int row);
int PasteColumn(int col);
int PasteRow(int row);
CString GetValue(int row, int col);
void inline killcopyrow()
{
if(copyrow) delete [] copyrow;
copyrow=0;
crows=0;
}
void inline killcopycol()
{
if(copycol) delete [] copycol;
copycol=0;
ccols=0;
}
CString header;
CString defvalue;
int rows;
int cols;
CString *copyrow;
int crows;
CString *copycol;
int ccols;
CString *collabels;
CPtrList data;
};
class Cids
{
public:
Cids();
virtual ~Cids();
void new_ids();
void AddRow(int row, CString label, CString def);
int RemoveRow(int row);
int ReadIDSFromFile(int fhandle, int ml);
int WriteIDSToFile(int fhandle);
CString header;
bool label;
int rows;
CPtrList *data;
};
#define MUSCOLUMN 3 //the number of columns
class Cmus
{
public:
Cmus();
virtual ~Cmus();
void new_mus();
void AddRow(int row, CString arg1, CString arg2, CString arg3);
int RemoveRow(int row);
int ReadMusFromFile(int fhandle, int ml);
int WriteMusToFile(int fhandle);
CString internal;
int rows;
CPtrList *data;
};
extern CStringMapCompiler action_data;
extern CStringMapCompiler trigger_data;
extern C2da the_2da;
extern Cids the_ids;
extern Cmus the_mus;
extern long creature_strrefs[SND_SLOT_COUNT]; //for copy/paste operation (persistent)
int Write2daArrayToFile(CString daname, CStringMapArray &refs, CString *columnames, int columns);
int Write2daMapToFile(CString daname, CStringMapInt &refs, CString columname);
int Write2daListToFile(CString daname, CStringList &refs, CString columname);
int ReadWeapProfs(loc_entry entry);
int Read2da(loc_entry entry, CStringList &refs);
int Read2daRow(loc_entry entry, CStringList &refs, int first);
int Read2daString(loc_entry entry, CString2List &refs, int startcolumn);
int Read2daStrref(loc_entry entry, CIntMapInt &refs, int column);
int Read2daArray(loc_entry entry, CStringMapArray &refs, int columns); //maximum 3
int Read2daInt(loc_entry entry, CStringMapInt &refs, int removeall);
int Read2daField(CString daname, int line, int column);
int Read2daColumn(loc_entry entry, CStringList &refs, int column, bool caps);
int ReadIds(loc_entry entry, CStringList &refs, int add);
int ReadSongIds(loc_entry entry, CString2List &refs);
int ReadIds2(loc_entry entry, CString *refs, int maxindex);
int ReadIds3(loc_entry entry, CString *refs, int maxindex, CStringMapCompiler &atdata, int trigger_or_action);
int ReadIds4(loc_entry entry, CStringMapInt &refs);
int read_effect_descs(); // setting up opcode descriptions
int add_compiler_data(CString prototype, int cnt, CStringMapCompiler &atdata, int trigger_or_action);
#endif // !defined(AFX_2DA_H__D3555E4F_E3B8_492D_ABEA_638AF2B91177__INCLUDED_)