Subversion Repositories spk

Rev

Rev 94 | Rev 101 | 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);
42
		bool writeData(CyStringList *lines);
43
		void updateCurrentVFS();
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
 
54
		bool isDir(const Utils::String &dir) const;
55
		bool hasSelected() const;
56
		bool isEmpty() const;
57
		int highestGame() const;
58
 
59
		Utils::String currentName() const;
60
		int currentGame() const;
61
		bool currentLoad() const;
62
		CVirtualFileSystem *selectedVFS() const;
63
 
95 cycrow 64
		void syncWithControlled(CGameExe *exe);
65
 
94 cycrow 66
		Utils::String findText(int iGame, int iLanguage, int iPage, int iID);
67
		Utils::String findText(int iLanguage, int iPage, int iID, Utils::String missing = Utils::String::Null());
68
 
69
		Utils::String first(int iGame = -1);
70
		Utils::String next(int iGame = -1);
71
 
72
		Utils::String firstShield();
73
		Utils::String nextShield();
74
		Utils::String firstComponentSection();
75
		Utils::String nextComponentSection();
76
		Utils::String firstDummySection();
77
		Utils::String nextDummySection();
78
		Utils::String firstBodiesSection();
79
		Utils::String nextBodiesSection();
80
		Utils::String firstCockpit();
81
		Utils::String nextCockpit();
82
		std::pair<Utils::String, Utils::String> firstLaser();
83
		std::pair<Utils::String, Utils::String> nextLaser();
84
		std::pair<Utils::String, Utils::String> firstMissile();
85
		std::pair<Utils::String, Utils::String> nextMissile();
86
 
87
	private:
88
		SGameDir *_findGameDir(int iGame) const;	
89
		SGameDir *_findGameDir(const Utils::String &dir) const;	
90
		void _add(const Utils::String &dir, const Utils::String &name, int iGame, const Utils::String &addon, bool bLoad);
95 cycrow 91
 
92
		void _updateControlledDirs(const Utils::String &mydoc);
94 cycrow 93
	};
94
 
95
}