| 94 | 
           cycrow | 
           1 | 
              | 
        
        
            | 
            | 
           2 | 
           #include "GameDirectories.h"
  | 
        
        
            | 
            | 
           3 | 
           #include "GameExe.h"
  | 
        
        
            | 
            | 
           4 | 
           #include "Packages.h"
  | 
        
        
           | 95 | 
           cycrow | 
           5 | 
           #include "GameExe.h"
  | 
        
        
           | 94 | 
           cycrow | 
           6 | 
              | 
        
        
            | 
            | 
           7 | 
           namespace SPK {
  | 
        
        
            | 
            | 
           8 | 
              | 
        
        
           | 95 | 
           cycrow | 
           9 | 
           	CGameDirectories::CGameDirectories(const Utils::String &mydoc) : _pSelected(NULL),
  | 
        
        
           | 94 | 
           cycrow | 
           10 | 
           		_pCurrentItr(NULL),
  | 
        
        
            | 
            | 
           11 | 
           		_iLanguage(0)
  | 
        
        
            | 
            | 
           12 | 
           	{
  | 
        
        
            | 
            | 
           13 | 
           		_pDirs = new std::vector<SGameDir *>();
  | 
        
        
           | 95 | 
           cycrow | 
           14 | 
              | 
        
        
            | 
            | 
           15 | 
           		_updateControlledDirs(mydoc);
  | 
        
        
           | 94 | 
           cycrow | 
           16 | 
           	}
  | 
        
        
            | 
            | 
           17 | 
              | 
        
        
            | 
            | 
           18 | 
           	CGameDirectories::~CGameDirectories(void)
  | 
        
        
            | 
            | 
           19 | 
           	{
  | 
        
        
            | 
            | 
           20 | 
           		clear();
  | 
        
        
            | 
            | 
           21 | 
           		delete _pDirs;
  | 
        
        
           | 95 | 
           cycrow | 
           22 | 
           		_lControlledDirs.MemoryClear();
  | 
        
        
           | 94 | 
           cycrow | 
           23 | 
           	}
  | 
        
        
            | 
            | 
           24 | 
              | 
        
        
            | 
            | 
           25 | 
           	bool CGameDirectories::add(const Utils::String &dir, const Utils::String &name, int iGame, const Utils::String &addon, bool bLoad)
  | 
        
        
            | 
            | 
           26 | 
           	{
  | 
        
        
            | 
            | 
           27 | 
           		for ( std::vector<SGameDir *>::iterator itr = _pDirs->begin(); itr != _pDirs->end(); itr++ ) {
  | 
        
        
            | 
            | 
           28 | 
           			if ( dir.Compare((*itr)->dir) ) return false;
  | 
        
        
            | 
            | 
           29 | 
           		}
  | 
        
        
            | 
            | 
           30 | 
              | 
        
        
            | 
            | 
           31 | 
           		_add(dir, name, iGame, addon, bLoad);
  | 
        
        
            | 
            | 
           32 | 
           		return true;
  | 
        
        
            | 
            | 
           33 | 
           	}
  | 
        
        
            | 
            | 
           34 | 
              | 
        
        
            | 
            | 
           35 | 
           	bool CGameDirectories::remove(const Utils::String &dir)
  | 
        
        
            | 
            | 
           36 | 
           	{
  | 
        
        
            | 
            | 
           37 | 
           		for ( std::vector<SGameDir *>::iterator itr = _pDirs->begin(); itr != _pDirs->end(); itr++ ) {
  | 
        
        
            | 
            | 
           38 | 
           			if ( dir.Compare((*itr)->dir) ) {
  | 
        
        
            | 
            | 
           39 | 
           				delete (*itr);
  | 
        
        
            | 
            | 
           40 | 
           				_pDirs->erase(itr);
  | 
        
        
            | 
            | 
           41 | 
           				return true;
  | 
        
        
            | 
            | 
           42 | 
           			}
  | 
        
        
            | 
            | 
           43 | 
           		}
  | 
        
        
            | 
            | 
           44 | 
              | 
        
        
            | 
            | 
           45 | 
           		return false;
  | 
        
        
            | 
            | 
           46 | 
           	}
  | 
        
        
            | 
            | 
           47 | 
              | 
        
        
            | 
            | 
           48 | 
           	bool CGameDirectories::findDir(const Utils::String &dir)
  | 
        
        
            | 
            | 
           49 | 
           	{
  | 
        
        
            | 
            | 
           50 | 
           		SGameDir *d = _findGameDir(dir);
  | 
        
        
            | 
            | 
           51 | 
           		if ( d ) {
  | 
        
        
            | 
            | 
           52 | 
           			_pCurrentItr = d;
  | 
        
        
            | 
            | 
           53 | 
           			return true;
  | 
        
        
            | 
            | 
           54 | 
           		}
  | 
        
        
            | 
            | 
           55 | 
              | 
        
        
            | 
            | 
           56 | 
           		return false;
  | 
        
        
            | 
            | 
           57 | 
           	}
  | 
        
        
            | 
            | 
           58 | 
              | 
        
        
            | 
            | 
           59 | 
           	bool CGameDirectories::parse(const Utils::String &data, CPackages *pPackages)
  | 
        
        
            | 
            | 
           60 | 
           	{
  | 
        
        
            | 
            | 
           61 | 
           		int iGame = data.token(";", 2).tokens(" ", 1).toLong();
  | 
        
        
            | 
            | 
           62 | 
           		SGameExe *exe = pPackages->GetGameExe()->GetGame(iGame);
  | 
        
        
            | 
            | 
           63 | 
           		_add(data.token(";", 1), data.token(";", 2).tokens(" ", 2), iGame, (exe) ? exe->sAddon : Utils::String::Null(), data.token(";", 3).toBool());
  | 
        
        
            | 
            | 
           64 | 
              | 
        
        
            | 
            | 
           65 | 
           		return true;
  | 
        
        
            | 
            | 
           66 | 
           	}
  | 
        
        
            | 
            | 
           67 | 
              | 
        
        
            | 
            | 
           68 | 
           	bool CGameDirectories::writeData(CyStringList *lines)
  | 
        
        
            | 
            | 
           69 | 
           	{
  | 
        
        
            | 
            | 
           70 | 
           		bool writeAny = false;
  | 
        
        
            | 
            | 
           71 | 
           		for(std::vector<SGameDir *>::const_iterator itr = _pDirs->begin(); itr != _pDirs->end(); itr++) {
  | 
        
        
            | 
            | 
           72 | 
           			SGameDir *gd = *itr;
  | 
        
        
            | 
            | 
           73 | 
           			lines->PushBack(CyString("GameDir:" + gd->dir + ";" + Utils::String::Number(gd->iGame) + " " + gd->name + ((gd->bLoad) ? ";1" : ";0")));
  | 
        
        
            | 
            | 
           74 | 
           			writeAny = true;
  | 
        
        
            | 
            | 
           75 | 
           		}
  | 
        
        
            | 
            | 
           76 | 
              | 
        
        
            | 
            | 
           77 | 
           		return writeAny;
  | 
        
        
            | 
            | 
           78 | 
           	}
  | 
        
        
            | 
            | 
           79 | 
              | 
        
        
            | 
            | 
           80 | 
           	void CGameDirectories::updateCurrentVFS()
  | 
        
        
            | 
            | 
           81 | 
           	{
  | 
        
        
            | 
            | 
           82 | 
           		if ( !_pCurrentItr ) return;
  | 
        
        
            | 
            | 
           83 | 
              | 
        
        
            | 
            | 
           84 | 
           		_pCurrentItr->pVfs->updateTexts(0);
  | 
        
        
            | 
            | 
           85 | 
           	}
  | 
        
        
            | 
            | 
           86 | 
              | 
        
        
            | 
            | 
           87 | 
           	void CGameDirectories::clear()
  | 
        
        
            | 
            | 
           88 | 
           	{
  | 
        
        
            | 
            | 
           89 | 
           		for ( std::vector<SGameDir *>::iterator itr = _pDirs->begin(); itr != _pDirs->end(); itr++ ) {
  | 
        
        
            | 
            | 
           90 | 
           			delete *itr;
  | 
        
        
            | 
            | 
           91 | 
           		}
  | 
        
        
            | 
            | 
           92 | 
           		_pDirs->clear();
  | 
        
        
            | 
            | 
           93 | 
           	}
  | 
        
        
            | 
            | 
           94 | 
              | 
        
        
            | 
            | 
           95 | 
           	bool CGameDirectories::setSelectedGameDirectory(int iGame, bool temp)
  | 
        
        
            | 
            | 
           96 | 
           	{
  | 
        
        
            | 
            | 
           97 | 
           		_pTemporary = NULL;
  | 
        
        
            | 
            | 
           98 | 
           		if ( temp ) _pTemporary = _pSelected;
  | 
        
        
            | 
            | 
           99 | 
           		_pSelected = _findGameDir(iGame);
  | 
        
        
            | 
            | 
           100 | 
           		return hasSelected();
  | 
        
        
            | 
            | 
           101 | 
           	}
  | 
        
        
            | 
            | 
           102 | 
              | 
        
        
            | 
            | 
           103 | 
           	bool CGameDirectories::setSelectedDirectory(const Utils::String &dir, bool temp)
  | 
        
        
            | 
            | 
           104 | 
           	{
  | 
        
        
            | 
            | 
           105 | 
           		_pTemporary = NULL;
  | 
        
        
            | 
            | 
           106 | 
           		if ( temp ) _pTemporary = _pSelected;
  | 
        
        
            | 
            | 
           107 | 
           		_pSelected = _findGameDir(dir);
  | 
        
        
            | 
            | 
           108 | 
           		return hasSelected();
  | 
        
        
            | 
            | 
           109 | 
           	}
  | 
        
        
            | 
            | 
           110 | 
              | 
        
        
            | 
            | 
           111 | 
           	void CGameDirectories::reselectTemporaryDirectory()
  | 
        
        
            | 
            | 
           112 | 
           	{
  | 
        
        
            | 
            | 
           113 | 
           		if ( _pTemporary ) _pSelected = _pTemporary;
  | 
        
        
            | 
            | 
           114 | 
           		_pTemporary = NULL;
  | 
        
        
            | 
            | 
           115 | 
           	}
  | 
        
        
            | 
            | 
           116 | 
              | 
        
        
            | 
            | 
           117 | 
           	void CGameDirectories::setLanguage(int iLang)
  | 
        
        
            | 
            | 
           118 | 
           	{
  | 
        
        
            | 
            | 
           119 | 
           		_iLanguage = iLang;
  | 
        
        
            | 
            | 
           120 | 
           	}
  | 
        
        
            | 
            | 
           121 | 
              | 
        
        
            | 
            | 
           122 | 
           	void CGameDirectories::setLoad(bool bLoad)
  | 
        
        
            | 
            | 
           123 | 
           	{
  | 
        
        
            | 
            | 
           124 | 
           		if ( _pCurrentItr ) _pCurrentItr->bLoad = bLoad;
  | 
        
        
            | 
            | 
           125 | 
           	}
  | 
        
        
            | 
            | 
           126 | 
              | 
        
        
            | 
            | 
           127 | 
           	bool CGameDirectories::isDir(const Utils::String &dir) const
  | 
        
        
            | 
            | 
           128 | 
           	{
  | 
        
        
            | 
            | 
           129 | 
           		for ( std::vector<SGameDir *>::iterator itr = _pDirs->begin(); itr != _pDirs->end(); itr++ ) {
  | 
        
        
            | 
            | 
           130 | 
           			if ( dir.Compare((*itr)->dir) ) return true;
  | 
        
        
            | 
            | 
           131 | 
           		}
  | 
        
        
            | 
            | 
           132 | 
              | 
        
        
            | 
            | 
           133 | 
           		return false;
  | 
        
        
            | 
            | 
           134 | 
           	}
  | 
        
        
            | 
            | 
           135 | 
              | 
        
        
            | 
            | 
           136 | 
           	bool CGameDirectories::hasSelected() const
  | 
        
        
            | 
            | 
           137 | 
           	{
  | 
        
        
            | 
            | 
           138 | 
           		return (_pSelected) ? true : false;
  | 
        
        
            | 
            | 
           139 | 
           	}
  | 
        
        
            | 
            | 
           140 | 
              | 
        
        
            | 
            | 
           141 | 
           	bool CGameDirectories::isEmpty() const
  | 
        
        
            | 
            | 
           142 | 
           	{
  | 
        
        
            | 
            | 
           143 | 
           		return _pDirs->empty();
  | 
        
        
            | 
            | 
           144 | 
           	}
  | 
        
        
            | 
            | 
           145 | 
              | 
        
        
            | 
            | 
           146 | 
           	int CGameDirectories::highestGame() const
  | 
        
        
            | 
            | 
           147 | 
           	{
  | 
        
        
            | 
            | 
           148 | 
           		int highest = 1;
  | 
        
        
            | 
            | 
           149 | 
           		for(std::vector<SGameDir *>::const_iterator itr = _pDirs->begin(); itr != _pDirs->end(); itr++) {
  | 
        
        
            | 
            | 
           150 | 
           			if ( (*itr)->iGame > highest )
  | 
        
        
            | 
            | 
           151 | 
           				highest = (*itr)->iGame;
  | 
        
        
            | 
            | 
           152 | 
           		}
  | 
        
        
            | 
            | 
           153 | 
              | 
        
        
            | 
            | 
           154 | 
           		return highest;
  | 
        
        
            | 
            | 
           155 | 
           	}
  | 
        
        
            | 
            | 
           156 | 
              | 
        
        
            | 
            | 
           157 | 
           	Utils::String CGameDirectories::currentName() const
  | 
        
        
            | 
            | 
           158 | 
           	{
  | 
        
        
            | 
            | 
           159 | 
           		if ( !_pCurrentItr ) return Utils::String::Null();
  | 
        
        
            | 
            | 
           160 | 
           		return _pCurrentItr->name;
  | 
        
        
            | 
            | 
           161 | 
           	}
  | 
        
        
            | 
            | 
           162 | 
              | 
        
        
            | 
            | 
           163 | 
           	int CGameDirectories::currentGame() const
  | 
        
        
            | 
            | 
           164 | 
           	{
  | 
        
        
            | 
            | 
           165 | 
           		if ( !_pCurrentItr ) return -1;
  | 
        
        
            | 
            | 
           166 | 
           		return _pCurrentItr->iGame;
  | 
        
        
            | 
            | 
           167 | 
           	}
  | 
        
        
            | 
            | 
           168 | 
              | 
        
        
            | 
            | 
           169 | 
           	bool CGameDirectories::currentLoad() const
  | 
        
        
            | 
            | 
           170 | 
           	{
  | 
        
        
            | 
            | 
           171 | 
           		if ( !_pCurrentItr ) return false;
  | 
        
        
            | 
            | 
           172 | 
           		return _pCurrentItr->bLoad;
  | 
        
        
            | 
            | 
           173 | 
           	}
  | 
        
        
            | 
            | 
           174 | 
              | 
        
        
            | 
            | 
           175 | 
           	CVirtualFileSystem *CGameDirectories::selectedVFS() const
  | 
        
        
            | 
            | 
           176 | 
           	{
  | 
        
        
            | 
            | 
           177 | 
           		if ( _pSelected ) return _pSelected->pVfs;
  | 
        
        
            | 
            | 
           178 | 
           		return NULL;
  | 
        
        
            | 
            | 
           179 | 
           	}
  | 
        
        
            | 
            | 
           180 | 
              | 
        
        
           | 95 | 
           cycrow | 
           181 | 
           	void CGameDirectories::syncWithControlled(CGameExe *exe)
  | 
        
        
            | 
            | 
           182 | 
           	{
  | 
        
        
            | 
            | 
           183 | 
           		for(CListNode<Utils::SStringList> *node = _lControlledDirs.Front(); node; node = node->next()) {
  | 
        
        
            | 
            | 
           184 | 
           			Utils::SStringList *str = node->Data();
  | 
        
        
            | 
            | 
           185 | 
           			add(exe->GetProperDir(str->str), str->data, exe->GetGameType(str->str), exe->GetAddonDir(str->str), true);
  | 
        
        
            | 
            | 
           186 | 
           		}
  | 
        
        
            | 
            | 
           187 | 
           	}
  | 
        
        
            | 
            | 
           188 | 
              | 
        
        
           | 94 | 
           cycrow | 
           189 | 
           	Utils::String CGameDirectories::findText(int iLanguage, int iPage, int iID, Utils::String missing)
  | 
        
        
            | 
            | 
           190 | 
           	{
  | 
        
        
            | 
            | 
           191 | 
           		if ( iLanguage == 0 ) iLanguage = _iLanguage;
  | 
        
        
            | 
            | 
           192 | 
           		if ( _pSelected ) {
  | 
        
        
            | 
            | 
           193 | 
           			if ( _pSelected->pVfs->textExists(iLanguage, iPage, iID) ) {
  | 
        
        
            | 
            | 
           194 | 
           				return _pSelected->pVfs->findText(iLanguage, iPage, iID);
  | 
        
        
            | 
            | 
           195 | 
           			}
  | 
        
        
            | 
            | 
           196 | 
           		}
  | 
        
        
            | 
            | 
           197 | 
              | 
        
        
            | 
            | 
           198 | 
           		return missing;
  | 
        
        
            | 
            | 
           199 | 
           	}
  | 
        
        
            | 
            | 
           200 | 
              | 
        
        
            | 
            | 
           201 | 
           	Utils::String CGameDirectories::findText(int iGame, int iLanguage, int iPage, int iID)
  | 
        
        
            | 
            | 
           202 | 
           	{
  | 
        
        
            | 
            | 
           203 | 
           		if ( iLanguage == 0 ) iLanguage = _iLanguage;
  | 
        
        
            | 
            | 
           204 | 
           		if ( iGame == -1 ) {
  | 
        
        
            | 
            | 
           205 | 
           			for ( int game = (GAME_MAX - 1); game >= 0; game-- ) {
  | 
        
        
            | 
            | 
           206 | 
           				SGameDir *gd = _findGameDir(game - 1);
  | 
        
        
            | 
            | 
           207 | 
           				if ( !gd ) continue;
  | 
        
        
            | 
            | 
           208 | 
           				if ( gd->pVfs->textExists(iLanguage, iPage, iID) ) {
  | 
        
        
            | 
            | 
           209 | 
           					return gd->pVfs->findText(iLanguage, iPage, iID);
  | 
        
        
            | 
            | 
           210 | 
           				}
  | 
        
        
            | 
            | 
           211 | 
           			}
  | 
        
        
            | 
            | 
           212 | 
           		}
  | 
        
        
            | 
            | 
           213 | 
           		else {
  | 
        
        
            | 
            | 
           214 | 
           			SGameDir *gd = _findGameDir(iGame);
  | 
        
        
            | 
            | 
           215 | 
           			if ( gd ) {
  | 
        
        
            | 
            | 
           216 | 
           				if ( gd->pVfs->textExists(iLanguage, iPage, iID) ) {
  | 
        
        
            | 
            | 
           217 | 
           					return gd->pVfs->findText(iLanguage, iPage, iID);
  | 
        
        
            | 
            | 
           218 | 
           				}
  | 
        
        
            | 
            | 
           219 | 
           			}
  | 
        
        
            | 
            | 
           220 | 
           		}
  | 
        
        
            | 
            | 
           221 | 
              | 
        
        
            | 
            | 
           222 | 
           		return Utils::String::Null();
  | 
        
        
            | 
            | 
           223 | 
           	}
  | 
        
        
            | 
            | 
           224 | 
              | 
        
        
            | 
            | 
           225 | 
           	Utils::String CGameDirectories::first(int iGame)
  | 
        
        
            | 
            | 
           226 | 
           	{
  | 
        
        
            | 
            | 
           227 | 
           		if ( _pDirs->empty() ) return Utils::String::Null();
  | 
        
        
            | 
            | 
           228 | 
              | 
        
        
            | 
            | 
           229 | 
           		_pCurrentItr = *_pDirs->begin();
  | 
        
        
            | 
            | 
           230 | 
           		if ( iGame > -1 && _pCurrentItr->iGame != iGame ) return next(iGame);
  | 
        
        
            | 
            | 
           231 | 
           		return (_pCurrentItr) ? _pCurrentItr->dir : Utils::String::Null();
  | 
        
        
            | 
            | 
           232 | 
           	}
  | 
        
        
            | 
            | 
           233 | 
              | 
        
        
            | 
            | 
           234 | 
           	Utils::String CGameDirectories::next(int iGame)
  | 
        
        
            | 
            | 
           235 | 
           	{
  | 
        
        
            | 
            | 
           236 | 
           		if ( !_pCurrentItr ) return Utils::String::Null();
  | 
        
        
            | 
            | 
           237 | 
              | 
        
        
            | 
            | 
           238 | 
           		bool found = false;
  | 
        
        
            | 
            | 
           239 | 
           		for(std::vector<SGameDir *>::iterator itr = _pDirs->begin(); itr != _pDirs->end(); itr++) {
  | 
        
        
            | 
            | 
           240 | 
           			if ( (*itr) == _pCurrentItr ) found = true;
  | 
        
        
            | 
            | 
           241 | 
           			else if ( found && ((*itr)->iGame == iGame || iGame == -1) ) {
  | 
        
        
            | 
            | 
           242 | 
           				_pCurrentItr = *(itr);
  | 
        
        
            | 
            | 
           243 | 
           				return (_pCurrentItr) ? _pCurrentItr->dir : Utils::String::Null();
  | 
        
        
            | 
            | 
           244 | 
           			}
  | 
        
        
            | 
            | 
           245 | 
           		}
  | 
        
        
            | 
            | 
           246 | 
              | 
        
        
            | 
            | 
           247 | 
           		return Utils::String::Null();
  | 
        
        
            | 
            | 
           248 | 
           	}
  | 
        
        
            | 
            | 
           249 | 
              | 
        
        
            | 
            | 
           250 | 
           	Utils::String CGameDirectories::firstShield()
  | 
        
        
            | 
            | 
           251 | 
           	{
  | 
        
        
            | 
            | 
           252 | 
           		if ( !_pSelected ) return Utils::String::Null();
  | 
        
        
            | 
            | 
           253 | 
           		return _pSelected->pVfs->firstShield();
  | 
        
        
            | 
            | 
           254 | 
           	}
  | 
        
        
            | 
            | 
           255 | 
              | 
        
        
            | 
            | 
           256 | 
           	Utils::String CGameDirectories::nextShield()
  | 
        
        
            | 
            | 
           257 | 
           	{
  | 
        
        
            | 
            | 
           258 | 
           		if ( !_pSelected ) return Utils::String::Null();
  | 
        
        
            | 
            | 
           259 | 
           		return _pSelected->pVfs->nextShield();
  | 
        
        
            | 
            | 
           260 | 
           	}
  | 
        
        
            | 
            | 
           261 | 
              | 
        
        
            | 
            | 
           262 | 
           	Utils::String CGameDirectories::firstComponentSection()
  | 
        
        
            | 
            | 
           263 | 
           	{
  | 
        
        
            | 
            | 
           264 | 
           		if ( !_pSelected ) return Utils::String::Null();
  | 
        
        
            | 
            | 
           265 | 
           		return _pSelected->pVfs->firstComponentSection();
  | 
        
        
            | 
            | 
           266 | 
           	}
  | 
        
        
            | 
            | 
           267 | 
              | 
        
        
            | 
            | 
           268 | 
           	Utils::String CGameDirectories::nextComponentSection()
  | 
        
        
            | 
            | 
           269 | 
           	{
  | 
        
        
            | 
            | 
           270 | 
           		if ( !_pSelected ) return Utils::String::Null();
  | 
        
        
            | 
            | 
           271 | 
           		return _pSelected->pVfs->nextComponentSection();
  | 
        
        
            | 
            | 
           272 | 
           	}
  | 
        
        
            | 
            | 
           273 | 
              | 
        
        
            | 
            | 
           274 | 
           	Utils::String CGameDirectories::firstDummySection()
  | 
        
        
            | 
            | 
           275 | 
           	{
  | 
        
        
            | 
            | 
           276 | 
           		if ( !_pSelected ) return Utils::String::Null();
  | 
        
        
            | 
            | 
           277 | 
           		return _pSelected->pVfs->firstDummySection();
  | 
        
        
            | 
            | 
           278 | 
           	}
  | 
        
        
            | 
            | 
           279 | 
              | 
        
        
            | 
            | 
           280 | 
           	Utils::String CGameDirectories::nextDummySection()
  | 
        
        
            | 
            | 
           281 | 
           	{
  | 
        
        
            | 
            | 
           282 | 
           		if ( !_pSelected ) return Utils::String::Null();
  | 
        
        
            | 
            | 
           283 | 
           		return _pSelected->pVfs->nextDummySection();
  | 
        
        
            | 
            | 
           284 | 
           	}
  | 
        
        
            | 
            | 
           285 | 
              | 
        
        
            | 
            | 
           286 | 
           	Utils::String CGameDirectories::firstBodiesSection()
  | 
        
        
            | 
            | 
           287 | 
           	{
  | 
        
        
            | 
            | 
           288 | 
           		if ( !_pSelected ) return Utils::String::Null();
  | 
        
        
            | 
            | 
           289 | 
           		return _pSelected->pVfs->firstBodiesSection();
  | 
        
        
            | 
            | 
           290 | 
           	}
  | 
        
        
            | 
            | 
           291 | 
              | 
        
        
            | 
            | 
           292 | 
           	Utils::String CGameDirectories::nextBodiesSection()
  | 
        
        
            | 
            | 
           293 | 
           	{
  | 
        
        
            | 
            | 
           294 | 
           		if ( !_pSelected ) return Utils::String::Null();
  | 
        
        
            | 
            | 
           295 | 
           		return _pSelected->pVfs->nextBodiesSection();
  | 
        
        
            | 
            | 
           296 | 
           	}
  | 
        
        
            | 
            | 
           297 | 
              | 
        
        
            | 
            | 
           298 | 
           	Utils::String CGameDirectories::firstCockpit()
  | 
        
        
            | 
            | 
           299 | 
           	{
  | 
        
        
            | 
            | 
           300 | 
           		if ( !_pSelected ) return Utils::String::Null();
  | 
        
        
            | 
            | 
           301 | 
           		return _pSelected->pVfs->firstCockpit();
  | 
        
        
            | 
            | 
           302 | 
           	}
  | 
        
        
            | 
            | 
           303 | 
              | 
        
        
            | 
            | 
           304 | 
           	Utils::String CGameDirectories::nextCockpit()
  | 
        
        
            | 
            | 
           305 | 
           	{
  | 
        
        
            | 
            | 
           306 | 
           		if ( !_pSelected ) return Utils::String::Null();
  | 
        
        
            | 
            | 
           307 | 
           		return _pSelected->pVfs->nextCockpit();
  | 
        
        
            | 
            | 
           308 | 
           	}
  | 
        
        
            | 
            | 
           309 | 
              | 
        
        
            | 
            | 
           310 | 
           	std::pair<Utils::String, Utils::String> CGameDirectories::firstLaser()
  | 
        
        
            | 
            | 
           311 | 
           	{
  | 
        
        
            | 
            | 
           312 | 
           		if ( !_pSelected ) return std::make_pair<Utils::String, Utils::String>(Utils::String::Null(), Utils::String::Null());
  | 
        
        
            | 
            | 
           313 | 
           		return _pSelected->pVfs->firstLaser();
  | 
        
        
            | 
            | 
           314 | 
           	}
  | 
        
        
            | 
            | 
           315 | 
              | 
        
        
            | 
            | 
           316 | 
           	std::pair<Utils::String, Utils::String> CGameDirectories::nextLaser()
  | 
        
        
            | 
            | 
           317 | 
           	{
  | 
        
        
            | 
            | 
           318 | 
           		if ( !_pSelected ) return std::make_pair<Utils::String, Utils::String>(Utils::String::Null(), Utils::String::Null());
  | 
        
        
            | 
            | 
           319 | 
           		return _pSelected->pVfs->nextLaser();
  | 
        
        
            | 
            | 
           320 | 
           	}
  | 
        
        
            | 
            | 
           321 | 
              | 
        
        
            | 
            | 
           322 | 
           	std::pair<Utils::String, Utils::String> CGameDirectories::firstMissile()
  | 
        
        
            | 
            | 
           323 | 
           	{
  | 
        
        
            | 
            | 
           324 | 
           		if ( !_pSelected ) return std::make_pair<Utils::String, Utils::String>(Utils::String::Null(), Utils::String::Null());
  | 
        
        
            | 
            | 
           325 | 
           		return _pSelected->pVfs->firstMissile();
  | 
        
        
            | 
            | 
           326 | 
           	}
  | 
        
        
            | 
            | 
           327 | 
              | 
        
        
            | 
            | 
           328 | 
           	std::pair<Utils::String, Utils::String> CGameDirectories::nextMissile()
  | 
        
        
            | 
            | 
           329 | 
           	{
  | 
        
        
            | 
            | 
           330 | 
           		if ( !_pSelected ) return std::make_pair<Utils::String, Utils::String>(Utils::String::Null(), Utils::String::Null());
  | 
        
        
            | 
            | 
           331 | 
           		return _pSelected->pVfs->nextMissile();
  | 
        
        
            | 
            | 
           332 | 
           	}
  | 
        
        
            | 
            | 
           333 | 
              | 
        
        
            | 
            | 
           334 | 
           	SGameDir *CGameDirectories::_findGameDir(int iGame) const
  | 
        
        
            | 
            | 
           335 | 
           	{
  | 
        
        
            | 
            | 
           336 | 
           		if ( iGame == -1 ) {
  | 
        
        
            | 
            | 
           337 | 
           			for ( int game = (GAME_MAX - 1); game >= 0; game-- ) {
  | 
        
        
            | 
            | 
           338 | 
           				SGameDir *gd = _findGameDir(game);
  | 
        
        
            | 
            | 
           339 | 
           				if ( !gd ) continue;
  | 
        
        
            | 
            | 
           340 | 
           				return gd;
  | 
        
        
            | 
            | 
           341 | 
           			}
  | 
        
        
            | 
            | 
           342 | 
           		}
  | 
        
        
            | 
            | 
           343 | 
           		else {
  | 
        
        
            | 
            | 
           344 | 
           			for(std::vector<SGameDir *>::const_iterator itr = _pDirs->begin(); itr != _pDirs->end(); itr++) {
  | 
        
        
            | 
            | 
           345 | 
           				if ( (*itr)->iGame == iGame ) return *itr;
  | 
        
        
            | 
            | 
           346 | 
           			}
  | 
        
        
            | 
            | 
           347 | 
           		}
  | 
        
        
            | 
            | 
           348 | 
           		return NULL;
  | 
        
        
            | 
            | 
           349 | 
           	}
  | 
        
        
            | 
            | 
           350 | 
              | 
        
        
            | 
            | 
           351 | 
           	SGameDir *CGameDirectories::_findGameDir(const Utils::String &dir) const
  | 
        
        
            | 
            | 
           352 | 
           	{
  | 
        
        
            | 
            | 
           353 | 
           		for(std::vector<SGameDir *>::const_iterator itr = _pDirs->begin(); itr != _pDirs->end(); itr++) {
  | 
        
        
            | 
            | 
           354 | 
           			if ( (*itr)->dir.Compare(dir) )
  | 
        
        
            | 
            | 
           355 | 
           				return *itr;
  | 
        
        
            | 
            | 
           356 | 
           		}
  | 
        
        
            | 
            | 
           357 | 
              | 
        
        
            | 
            | 
           358 | 
           		return NULL;
  | 
        
        
            | 
            | 
           359 | 
           	}
  | 
        
        
            | 
            | 
           360 | 
              | 
        
        
            | 
            | 
           361 | 
           	void CGameDirectories::_add(const Utils::String &dir, const Utils::String &name, int iGame, const Utils::String &addon, bool bLoad)
  | 
        
        
            | 
            | 
           362 | 
           	{
  | 
        
        
            | 
            | 
           363 | 
           		SGameDir *gd = new SGameDir;
  | 
        
        
            | 
            | 
           364 | 
              | 
        
        
            | 
            | 
           365 | 
           		gd->dir = dir;
  | 
        
        
            | 
            | 
           366 | 
           		gd->name = name;
  | 
        
        
            | 
            | 
           367 | 
           		gd->iGame = iGame;
  | 
        
        
            | 
            | 
           368 | 
              | 
        
        
            | 
            | 
           369 | 
           		gd->bLoad = bLoad;
  | 
        
        
            | 
            | 
           370 | 
           		gd->pVfs = new CVirtualFileSystem();
  | 
        
        
            | 
            | 
           371 | 
           		gd->pVfs->setLanguage(44);
  | 
        
        
            | 
            | 
           372 | 
           		gd->pVfs->LoadFilesystem(gd->dir);
  | 
        
        
            | 
            | 
           373 | 
           		gd->pVfs->SetAddon(addon);
  | 
        
        
            | 
            | 
           374 | 
              | 
        
        
            | 
            | 
           375 | 
           		_pDirs->push_back(gd);
  | 
        
        
            | 
            | 
           376 | 
           	}
  | 
        
        
           | 95 | 
           cycrow | 
           377 | 
              | 
        
        
            | 
            | 
           378 | 
           	void CGameDirectories::_updateControlledDirs(const Utils::String &mydoc)
  | 
        
        
            | 
            | 
           379 | 
           	{
  | 
        
        
            | 
            | 
           380 | 
           		_lControlledDirs.MemoryClear();
  | 
        
        
            | 
            | 
           381 | 
              | 
        
        
            | 
            | 
           382 | 
           		CFileIO configFile(mydoc + "/Egosoft/pluginmanager.dat");
  | 
        
        
            | 
            | 
           383 | 
           		if ( configFile.startRead() ) {
  | 
        
        
            | 
            | 
           384 | 
           			while(!configFile.atEnd()) {
  | 
        
        
            | 
            | 
           385 | 
           				Utils::String line = configFile.readEndOfLine();
  | 
        
        
            | 
            | 
           386 | 
           				if ( line.token(":", 1).Compare("DirExe") ) {
  | 
        
        
            | 
            | 
           387 | 
           					Utils::String rest = line.tokens(":", 2).removeFirstSpace();
  | 
        
        
            | 
            | 
           388 | 
           					if ( rest.countToken("|" ) > 2 )
  | 
        
        
            | 
            | 
           389 | 
           						_lControlledDirs.pushBack(rest.token("|", 3), rest.token("|", 2));
  | 
        
        
            | 
            | 
           390 | 
           					else
  | 
        
        
            | 
            | 
           391 | 
           						_lControlledDirs.pushBack(rest.token("|", 2), rest.token("|", 1));
  | 
        
        
            | 
            | 
           392 | 
           				}
  | 
        
        
            | 
            | 
           393 | 
           			}
  | 
        
        
            | 
            | 
           394 | 
           		}
  | 
        
        
            | 
            | 
           395 | 
           	}
  | 
        
        
           | 94 | 
           cycrow | 
           396 | 
           }
  |