Subversion Repositories spk

Rev

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

Rev 231 Rev 299
Line 6... Line 6...
6
 
6
 
7
// old style compression (needed to convert old formats)
7
// old style compression (needed to convert old formats)
8
#include "../../HiP/HiP.h"
8
#include "../../HiP/HiP.h"
9
 
9
 
10
#include "TextDB.h"
10
#include "TextDB.h"
-
 
11
#include <Languages.h>
11
 
12
 
12
//TODO: remove this
13
//TODO: remove this
13
unsigned char *LineByLineRead ( unsigned char *data, const Utils::String &end, Utils::String *readData )
14
unsigned char *LineByLineRead ( unsigned char *data, const Utils::String &end, Utils::String *readData )
14
{
15
{
15
	Utils::String line;
16
	Utils::String line;
Line 490... Line 491...
490
	return false;
491
	return false;
491
}
492
}
492
 
493
 
493
Utils::WString CSpkFile::scriptTypeString(int lang) const
494
Utils::WString CSpkFile::scriptTypeString(int lang) const
494
{
495
{
495
	int iType = m_iScriptType;
496
	int scriptType = -1;
496
 
-
 
497
	if ( this->IsLibrary() )
497
	if (this->IsLibrary())
498
		return L"Library";
498
		scriptType = SCRIPTTYPE_LIBRARY;
499
	else if ( this->IsPackageUpdate() )
499
	else if (this->IsPackageUpdate())
500
		return L"Package Update";
500
		scriptType = SCRIPTTYPE_UPDATE;
501
	else if ( this->IsCustomStart() )
501
	else if (this->IsCustomStart())
502
		return L"Custom Start";
502
		scriptType = SCRIPTTYPE_CUSTOMSTART;
503
	else if ( this->IsPatch() )
503
	else if (this->IsPatch())
504
		return L"Patch";
504
		scriptType = SCRIPTTYPE_PATCH;
505
	else if ( m_iScriptType == SCRIPTTYPE_CUSTOM )
505
	else if (m_iScriptType == SCRIPTTYPE_CUSTOM)
506
	{
506
	{
507
		Utils::WString type = this->customScriptType(lang);
507
		Utils::WString type = this->customScriptType(lang);
508
		if ( !type.empty() )
508
		if (!type.empty())
509
			return type;
509
			return type;
510
		iType = -1;
-
 
511
	}
510
	}
512
 
511
 
513
	if (iType == -1)  // no script type
512
	if (scriptType == -1)
514
	{
513
	{
515
		if ( this->IsFakePatch() )
514
		if (this->IsFakePatch())
-
 
515
			scriptType = SCRIPTTYPE_FAKEPATCH;
-
 
516
		else
516
			return L"Fake Patch";
517
			scriptType = m_iScriptType;
517
	}
518
	}
518
 
519
 
519
	Utils::WString sType = CSpkFile::GetScriptTypeStringStatic(m_iScriptType);
520
	Utils::WString sType = CSpkFile::GetScriptTypeStringStatic(m_iScriptType, lang);
520
 
-
 
521
	if ( sType.empty() )
521
	return (sType.empty()) ? L"Other" : sType;
522
		return L"Other";
-
 
523
 
-
 
524
	return sType;
-
 
525
}
522
}
526
 
523
 
527
int CSpkFile::ConvertScriptType(const Utils::WString &sType)
524
int CSpkFile::ConvertScriptType(const Utils::WString &sType)
528
{
525
{
529
	for ( int i = 0; i < SCRIPTTYPE_MAX; i++ )
526
	for ( int i = 0; i < SCRIPTTYPE_MAX; i++ )
530
	{
527
	{
531
		if ( sType.Compare(CSpkFile::GetScriptTypeStringStatic(i)) )
528
		if ( sType.Compare(CSpkFile::GetScriptTypeStringStatic(i, 0)) )
532
			return i;
529
			return i;
533
	}
530
	}
534
 
531
 
535
	return -1;
532
	return -1;
536
}
533
}
537
 
534
 
538
Utils::WString CSpkFile::GetScriptTypeStringStatic(int type)
535
Utils::WString CSpkFile::GetScriptTypeStringStatic(int type, int iLang)
539
{
536
{
-
 
537
	if (iLang)
-
 
538
	{
-
 
539
		CLanguages* langList = CLanguages::Instance();
-
 
540
		langList->pushLanguage(iLang);
-
 
541
		Utils::WString text = langList->findText(LS_SCRIPTTYPE, type);
-
 
542
		if (!text.empty())
-
 
543
		{
-
 
544
			langList->popLanguage();
-
 
545
			return text;
-
 
546
		}
-
 
547
		langList->popLanguage();
-
 
548
	}
-
 
549
 
540
	switch ( type )
550
	switch ( type )
541
	{
551
	{
-
 
552
		case SCRIPTTYPE_LIBRARY:
-
 
553
			return L"Library";
-
 
554
		case SCRIPTTYPE_UPDATE:
-
 
555
			return L"Package Update";
-
 
556
		case SCRIPTTYPE_CUSTOMSTART:
-
 
557
			return L"Custom Start";
-
 
558
		case SCRIPTTYPE_PATCH:
-
 
559
			return L"Patch";
-
 
560
		case SCRIPTTYPE_FAKEPATCH:
-
 
561
			return L"Fake Patch";
542
		case SCRIPTTYPE_CUSTOM:
562
		case SCRIPTTYPE_CUSTOM:
543
			return L"Custom";
563
			return L"Custom";
544
		case SCRIPTTYPE_NAVIGATION:
564
		case SCRIPTTYPE_NAVIGATION:
545
			return L"Navigation";
565
			return L"Navigation";
546
		case SCRIPTTYPE_COMBAT:
566
		case SCRIPTTYPE_COMBAT:
Line 575... Line 595...
575
			return L"General Mod";
595
			return L"General Mod";
576
		case SCRIPTTYPE_TOTAL:
596
		case SCRIPTTYPE_TOTAL:
577
			return L"Totel Conversion";
597
			return L"Totel Conversion";
578
		case SCRIPTTYPE_WINGCOMMAND:
598
		case SCRIPTTYPE_WINGCOMMAND:
579
			return L"Wing Command";
599
			return L"Wing Command";
-
 
600
		case SCRIPTTYPE_OTHER:
-
 
601
			return L"Other";
580
	}
602
	}
581
 
603
 
582
	return L"Other";
604
	return L"Other";
583
}
605
}
584
 
606