Subversion Repositories spk

Rev

Rev 252 | Rev 269 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 252 Rev 254
Line 3542... Line 3542...
3542
	return str;
3542
	return str;
3543
}
3543
}
3544
 
3544
 
3545
void CBaseFile::_addWaresToList(int iLang, CLinkList<SWareEntry> &list, const Utils::WString &wares, enum WareTypes eType)
3545
void CBaseFile::_addWaresToList(int iLang, CLinkList<SWareEntry> &list, const Utils::WString &wares, enum WareTypes eType)
3546
{
3546
{
-
 
3547
	if (_pTextDB)
-
 
3548
	{
3547
	std::vector<Utils::WString> w;
3549
		std::vector<Utils::WString> w;
3548
	wares.tokenise(L"\n", w);
3550
		wares.tokenise(L"\n", w);
3549
	
3551
 
3550
	for(size_t i = 0; i < w.size(); i++) {
3552
		for (size_t i = 0; i < w.size(); i++) {
3551
		int textId = w[i].token(L";", 7).toLong();
3553
			int textId = w[i].token(L";", 7).toLong();
3552
		int useLang = iLang;
3554
			int useLang = iLang;
3553
		if ( !_pTextDB->exists(useLang, 17, textId) )
3555
			if (!_pTextDB->exists(useLang, 17, textId))
3554
			useLang = 44;
3556
				useLang = 44;
3555
		if ( !_pTextDB->exists(useLang, 17, textId) )
3557
			if (!_pTextDB->exists(useLang, 17, textId))
3556
			useLang = 49;
3558
				useLang = 49;
3557
		if ( _pTextDB->exists(useLang, 17, textId) ) {	
3559
			if (_pTextDB->exists(useLang, 17, textId)) {
3558
			SWareEntry *ware = new SWareEntry;
3560
				SWareEntry* ware = new SWareEntry;
3559
			ware->name = _pTextDB->get(useLang, 17, textId);
3561
				ware->name = _pTextDB->get(useLang, 17, textId);
3560
			ware->description = _pTextDB->get(useLang, 17, textId + 1);
3562
				ware->description = _pTextDB->get(useLang, 17, textId + 1);
3561
			ware->id = w[i].token(L";", -2);
3563
				ware->id = w[i].token(L";", -2);
3562
			ware->relval = w[i].token(L";", 9).toLong();
3564
				ware->relval = w[i].token(L";", 9).toLong();
3563
			ware->notority = w[i].token(L";", 14).toLong();
3565
				ware->notority = w[i].token(L";", 14).toLong();
3564
			ware->type = eType;
3566
				ware->type = eType;
3565
			ware->position = i;
3567
				ware->position = i;
3566
			ware->package = this;
3568
				ware->package = this;
3567
			list.push_back(ware);
3569
				list.push_back(ware);
-
 
3570
			}
3568
		}
3571
		}
3569
	}
3572
	}
3570
}
3573
}
3571
 
3574
 
3572
bool CBaseFile::readWares(int iLang, CLinkList<SWareEntry> &list, const Utils::WString &empWares)
3575
bool CBaseFile::readWares(int iLang, CLinkList<SWareEntry> &list, const Utils::WString &empWares)
3573
{
3576
{
-
 
3577
	if (_pTextDB)
-
 
3578
	{
3574
	_pTextDB->setLanguage(iLang);
3579
		_pTextDB->setLanguage(iLang);
3575
 
3580
 
3576
	// now go through all emp wares and get the ones we have text for
3581
		// now go through all emp wares and get the ones we have text for
3577
	_addWaresToList(iLang, list, empWares, Ware_EMP);
3582
		_addWaresToList(iLang, list, empWares, Ware_EMP);
3578
	_addWaresToList(iLang, list, builtInWares(), Ware_BuiltIn);
3583
		_addWaresToList(iLang, list, builtInWares(), Ware_BuiltIn);
3579
 
3584
 
3580
	return true;
3585
		return true;
-
 
3586
	}
-
 
3587
 
-
 
3588
	return false;
3581
}
3589
}
3582
 
3590
 
3583
bool CBaseFile::_readCommands(int iLang, int iStartID, CLinkList<SCommandSlot> &list)
3591
bool CBaseFile::_readCommands(int iLang, int iStartID, CLinkList<SCommandSlot> &list)
3584
{
3592
{
-
 
3593
	if (_pTextDB)
-
 
3594
	{
3585
	_pTextDB->setLanguage(iLang);
3595
		_pTextDB->setLanguage(iLang);
3586
 
3596
 
3587
	for(int i = 2; i <= 13; i++) {
3597
		for (int i = 2; i <= 13; i++) {
3588
		for(int j = 0; j < 64; j++) {
3598
			for (int j = 0; j < 64; j++) {
3589
			int id = (i * 100) + j;
3599
				int id = (i * 100) + j;
3590
			if ( _pTextDB->exists(iLang, iStartID + 2, id) ) {
3600
				if (_pTextDB->exists(iLang, iStartID + 2, id)) {
-
 
3601
					SCommandSlot* slot = new SCommandSlot;
-
 
3602
					list.push_back(slot);
-
 
3603
 
-
 
3604
					slot->id = _pTextDB->get(iLang, iStartID, id);
-
 
3605
					slot->name = _pTextDB->get(iLang, iStartID + 2, id);
-
 
3606
					slot->shortName = _pTextDB->get(iLang, iStartID + 3, id);
-
 
3607
					slot->info = _pTextDB->get(iLang, iStartID + 14, id);
-
 
3608
					slot->slot = id;
-
 
3609
					slot->package = this;
-
 
3610
				}
-
 
3611
			}
-
 
3612
		}
-
 
3613
 
-
 
3614
		for (int i = 1400; i <= 2000; i++) {
-
 
3615
			if (_pTextDB->exists(iLang, iStartID + 2, i)) {
-
 
3616
				SCommandSlot* slot = new SCommandSlot;
-
 
3617
				list.push_back(slot);
-
 
3618
 
-
 
3619
				slot->id = _pTextDB->get(iLang, iStartID, i);
-
 
3620
				slot->name = _pTextDB->get(iLang, iStartID + 2, i);
-
 
3621
				slot->shortName = _pTextDB->get(iLang, iStartID + 3, i);
-
 
3622
				slot->info = _pTextDB->get(iLang, iStartID + 14, i);
-
 
3623
				slot->slot = i;
-
 
3624
				slot->package = this;
-
 
3625
			}
-
 
3626
		}
-
 
3627
 
-
 
3628
		for (int i = 6000; i <= 9999; i++) {
-
 
3629
			if (_pTextDB->exists(iLang, iStartID + 2, i)) {
3591
				SCommandSlot *slot = new SCommandSlot;
3630
				SCommandSlot* slot = new SCommandSlot;
3592
				list.push_back(slot);
3631
				list.push_back(slot);
3593
 
3632
 
3594
				slot->id = _pTextDB->get(iLang, iStartID, id);
3633
				slot->id = _pTextDB->get(iLang, iStartID, i);
3595
				slot->name = _pTextDB->get(iLang, iStartID + 2, id);
3634
				slot->name = _pTextDB->get(iLang, iStartID + 2, i);
3596
				slot->shortName = _pTextDB->get(iLang, iStartID + 3, id);
3635
				slot->shortName = _pTextDB->get(iLang, iStartID + 3, i);
3597
				slot->info = _pTextDB->get(iLang, iStartID + 14, id);
3636
				slot->info = _pTextDB->get(iLang, iStartID + 14, i);
3598
				slot->slot = id;
3637
				slot->slot = i;
3599
				slot->package = this;
3638
				slot->package = this;
3600
 			}
3639
			}
3601
		}
3640
		}
3602
	}
-
 
3603
 
3641
 
3604
	for(int i = 1400; i <= 2000; i++) {
-
 
3605
		if ( _pTextDB->exists(iLang, iStartID + 2, i) ) {
-
 
3606
			SCommandSlot *slot = new SCommandSlot;
-
 
3607
			list.push_back(slot);
-
 
3608
 
-
 
3609
			slot->id = _pTextDB->get(iLang, iStartID, i);
-
 
3610
			slot->name = _pTextDB->get(iLang, iStartID + 2, i);
-
 
3611
			slot->shortName = _pTextDB->get(iLang, iStartID + 3, i);
-
 
3612
			slot->info = _pTextDB->get(iLang, iStartID + 14, i);
-
 
3613
			slot->slot = i;
3642
		return true;
3614
			slot->package = this;
-
 
3615
		}
-
 
3616
	}
-
 
3617
 
-
 
3618
	for(int i = 6000; i <= 9999; i++) {
-
 
3619
		if ( _pTextDB->exists(iLang, iStartID + 2, i) ) {
-
 
3620
			SCommandSlot *slot = new SCommandSlot;
-
 
3621
			list.push_back(slot);
-
 
3622
 
-
 
3623
			slot->id = _pTextDB->get(iLang, iStartID, i);
-
 
3624
			slot->name = _pTextDB->get(iLang, iStartID + 2, i);
-
 
3625
			slot->shortName = _pTextDB->get(iLang, iStartID + 3, i);
-
 
3626
			slot->info = _pTextDB->get(iLang, iStartID + 14, i);
-
 
3627
			slot->slot = i;
-
 
3628
			slot->package = this;
-
 
3629
		}
-
 
3630
	}
3643
	}
3631
 
3644
 
3632
	return true;
3645
	return false;
3633
}
3646
}
3634
 
3647
 
3635
bool CBaseFile::readWingCommands(int iLang, CLinkList<SCommandSlot> &list)
3648
bool CBaseFile::readWingCommands(int iLang, CLinkList<SCommandSlot> &list)
3636
{
3649
{
3637
	return _readCommands(iLang, 2028, list);
3650
	return _readCommands(iLang, 2028, list);