Subversion Repositories spk

Rev

Rev 101 | Rev 197 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
94 cycrow 1
#pragma once
2
 
3
#include <vector>
4
#include "spkdefines.h"
95 cycrow 5
#include "Utils/StringList.h"
94 cycrow 6
 
7
class CPackages;
95 cycrow 8
class CGameExe;
94 cycrow 9
 
10
namespace SPK {
11
 
12
	class CVirtualFileSystem;
13
 
14
	typedef struct SGameDir {
15
		bool			bLoad;
16
		Utils::String	dir;
17
		Utils::String	name;
18
		int				iGame;
19
		CVirtualFileSystem *pVfs;
20
//		SGameExe		*pExe;
21
	} SGameDir;
22
 
23
	tclass CGameDirectories
24
	{
25
	private:
26
		std::vector<SGameDir *> *_pDirs;
95 cycrow 27
		Utils::CStringList	_lControlledDirs;
94 cycrow 28
		SGameDir	*_pCurrentItr;
29
		SGameDir	*_pSelected;
30
		SGameDir	*_pTemporary;
31
		int			 _iLanguage;
32
 
33
	public:
95 cycrow 34
		CGameDirectories(const Utils::String &mydoc);
94 cycrow 35
		~CGameDirectories(void);
36
 
37
		bool add(const Utils::String &dir, const Utils::String &name, int iGame, const Utils::String &addon, bool bLoad);
38
		bool remove(const Utils::String &dir);
39
 
40
		bool parse(const Utils::String &data, CPackages *pPackages);
41
		bool findDir(const Utils::String &dir);
123 cycrow 42
		bool writeData(Utils::CStringList *lines);
101 cycrow 43
		void updateCurrentVFS(bool bReload);
94 cycrow 44
 
45
		void clear();
46
 
47
		bool setSelectedGameDirectory(int iGame, bool temp = false);
48
		bool setSelectedDirectory(const Utils::String &dir, bool temp = false);
49
		void reselectTemporaryDirectory();
50
		void setLanguage(int iLang);
51
 
52
		void setLoad(bool bLoad);
53
 
101 cycrow 54
		bool isAllTextLoaded() const;
94 cycrow 55
		bool isDir(const Utils::String &dir) const;
56
		bool hasSelected() const;
57
		bool isEmpty() const;
58
		int highestGame() const;
59
 
60
		Utils::String currentName() const;
61
		int currentGame() const;
62
		bool currentLoad() const;
63
		CVirtualFileSystem *selectedVFS() const;
64
 
95 cycrow 65
		void syncWithControlled(CGameExe *exe);
66
 
94 cycrow 67
		Utils::String findText(int iGame, int iLanguage, int iPage, int iID);
68
		Utils::String findText(int iLanguage, int iPage, int iID, Utils::String missing = Utils::String::Null());
69
 
70
		Utils::String first(int iGame = -1);
71
		Utils::String next(int iGame = -1);
72
 
73
		Utils::String firstShield();
74
		Utils::String nextShield();
75
		Utils::String firstComponentSection();
76
		Utils::String nextComponentSection();
77
		Utils::String firstDummySection();
78
		Utils::String nextDummySection();
79
		Utils::String firstBodiesSection();
80
		Utils::String nextBodiesSection();
81
		Utils::String firstCockpit();
82
		Utils::String nextCockpit();
83
		std::pair<Utils::String, Utils::String> firstLaser();
84
		std::pair<Utils::String, Utils::String> nextLaser();
85
		std::pair<Utils::String, Utils::String> firstMissile();
86
		std::pair<Utils::String, Utils::String> nextMissile();
87
 
88
	private:
89
		SGameDir *_findGameDir(int iGame) const;	
90
		SGameDir *_findGameDir(const Utils::String &dir) const;	
91
		void _add(const Utils::String &dir, const Utils::String &name, int iGame, const Utils::String &addon, bool bLoad);
95 cycrow 92
 
93
		void _updateControlledDirs(const Utils::String &mydoc);
94 cycrow 94
	};
95
 
96
}