/*
 *  Arcanum Editor - ROM area editor
 *  Copyright (C) 1999  Lucas Wall <kthulhu@usa.net>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *
 *  If you make changes to the source and want to make the public you can
 *  mail the diferences to me <kthulhu@usa.net> and I'll add them to the
 *  main distribution. Of course your name will be added to the program with
 *  information about the changes you made.
 *
 *
 *  Packed on Thu Aug 19 03:02:16 1999
 *
 */


/*
 * File: arcaedDoc.h
 *
 * Changes:
 *
 * 19/08/99 Lucas Wall <kthulhu@usa.net>
 *          First source release. Its quite messy and has no
 *          comments. I never planed to release the source code... :-)
 *
 */


// arcaedDoc.h : interface of the CArcaedDoc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_ARCAEDDOC_H__936C28CF_FCCD_11D2_803D_00002168229C__INCLUDED_)
#define AFX_ARCAEDDOC_H__936C28CF_FCCD_11D2_803D_00002168229C__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include "RoomData.h"
#include "ResetData.h"
#include "MobProgData.h"
#include "ObjData.h"
#include "MobData.h"
#include "ShopData.h"

class CArcaedDoc : public CDocument
{
protected: // create from serialization only
	CArcaedDoc();
	DECLARE_DYNCREATE(CArcaedDoc)

// Attributes
public:
	CString m_name;
	CString m_builders;
	int m_maxvnum;
	int m_minvnum;
	CString m_credits;
	int m_security;
	int m_nivelmin;
	int m_nivelmax;
	CArray< CRoomData*, CRoomData* > m_rooms;
	CArray< CResetData*, CResetData* > m_resets;
	CArray< CMobProgData*, CMobProgData* > m_mobprogs;
	CArray< CObjData*, CObjData* > m_objs;
	CArray< CMobData*, CMobData* > m_mobs;
	CArray< CNumStrData*, CNumStrData* > m_recu;
	int m_map_maxlevel, m_map_minlevel;

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CArcaedDoc)
	public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
	//}}AFX_VIRTUAL

// Implementation
public:
	int m_size;
	void MakeResetList();
	void UpdateRoomResets();
	void save_area( CArchive &ar );
	void save_areaold( CArchive &ar );
	void save_mobs( CArchive &ar );
	void save_mobprog( CArchive &ar );
	void save_objects( CArchive &ar );
	void save_rooms( CArchive &ar );
	void save_shops( CArchive &ar );
	void save_resets( CArchive &ar );
	void save_specials( CArchive &ar );
	int EditObj( CObjData *obj );
	int EditMob( CMobData *mob );
	int FindFreeRoomVnum();
	int FindFreeObjVnum();
	int FindFreeMobVnum();
	int FindFreeMobProgVnum();
	int EditRoom( CRoomData *room );
	void MoveRooms( int x, int y, int dir, int nivel, int size );
	int FindRoom( int vnum, int exclude = -1 );
	int FindObj( int vnum, int exclude = -1 );
	int FindMob( int vnum, int exclude = -1 );
	int FindMobProg( int vnum, int exclude = -1 );
	void AdjustRoom( int nindex, int x, int y, int nivel, int dir, int size );
	void AdjustMap( int size );
	void load_specials( CArchive & ar );
	void load_socials( CArchive & ar );
	void load_mobprog( CArchive & ar );
	void load_shops( CArchive & ar );
	void load_resets( CArchive & ar );
	void load_help( CArchive & ar );
	void load_none( CArchive & ar );
	void load_rooms( CArchive & ar );
	void load_area( CArchive & ar );
	void load_objects( CArchive & ar );
	void load_mobs( CArchive & ar );
	void load_areaold( CArchive & ar );
	virtual ~CArcaedDoc();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CArcaedDoc)
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_ARCAEDDOC_H__936C28CF_FCCD_11D2_803D_00002168229C__INCLUDED_)