// boards.h
class CBoardData {
public:
friend class CBoardList;
CBoardData ()
{ memset (&m_pNext, 0, sizeof (CBoardData) - sizeof (CPtrList)); }
~CBoardData ();
CBoardData *GetNext () { return m_pNext; }
void SetNext (CBoardData* n) { m_pNext = n; }
CBoardData *GetPrev () { return m_pPrev; }
void SetPrev (CBoardData* n) { m_pPrev = n; }
void Read (char* pLine, FILE* fp);
void WriteAllNotes ();
void RemoveNote (CNoteData *pnote);
POSITION GetFirstNotePosition ()
{ return m_NList.GetHeadPosition (); }
CNoteData *GetNextNote (POSITION& pos)
{ return (CNoteData*) m_NList.GetNext (pos); }
CNoteData *GetNoteByNumber (int n)
{ ASSERT (n > 0); return (CNoteData*) m_NList.FindIndex (n); }
void AddNote (CNoteData* n) { m_NList.AddTail (n); ++num_posts; }
protected:
CPtrList m_NList; // notes list
private:
CBoardData *m_pNext; // Next board in list
CBoardData *m_pPrev; // Previous board in list
public:
char *note_file; // NC, Filename to save notes to
char *read_group; // NC, Can restrict a board to a
char *post_group; // NC, council, clan, guild etc
char *extra_readers; // NC, Can give read rights to players
char *extra_removers; // NC, Can give remove rights to players
int board_obj; // Vnum of board object
short num_posts; // Number of notes on this board
short min_read_level; // Minimum level to read a note
short min_post_level; // Minimum level to post a note
short min_remove_level; // Minimum level to remove a note
short max_posts; // Maximum amount of notes allowed
int type; // Normal board or mail board?
};
class CBoardList : public CPtrList {
public:
void Load ();
CBoardData *ReadBoard (FILE *fp);
void WriteBoardsFile ();
CBoardData *GetBoard (CObjData *obj);
void AddBoard (CBoardData* board) { ASSERT (board); AddTail (board); }
CBoardData *GetNext (POSITION& pos)
{ ASSERT (pos != NULL);
return (CBoardData*) CPtrList::GetNext (pos); }
void RemoveAll (); // override of CPtrList RemoveAll
};
extern CBoardList BoardList;
#ifdef SMAUGSERVER_CPP
CBoardList BoardList;
#endif