Esempio n. 1
0
//------------------------------------------------------------------------------
// UITrackPopup::AddMenuList
// Explain:  메류 항목 추가 
//			새로운 항목이 추가 될 때만 ListBox의 크기가 조절된다.
// Date : 2005-05-17,Author: Lee Ki-hwan
//------------------------------------------------------------------------------
void CUITrackPopup::AddMenuList( CTString strText, COLOR colText, int nCommandNum)
{
	AddString( 0, strText, colText );

	m_vecCommandList.push_back(nCommandNum); // [sora] command값 저장

	if (CUIListBox::GetScrollBar() == FALSE)
		CUIListBox::ChangeLineCount(m_vecString[0].vecString.size());
		
	if( m_nMaxCharCount < strText.Length() ) // 최대 글자수를 저장해 놓는다~
	{
		m_nMaxCharCount = strText.Length();
	}
	
#if defined G_RUSSIA
	if( strText.Length() > m_strLongestStringInMenu.Length() )	
	{
		m_strLongestStringInMenu = strText;
	}
#else
		Resize();
#endif

	// 일단은 숨겨 놓구 
	Hide();
}
Esempio n. 2
0
void CUIQuestBook::AddQuestListToMessageBoxL(const int& iMessageBoxType)
{
	CUIManager* pUIManager = CUIManager::getSingleton();
	Quest* pQuest = GAMEDATAMGR()->GetQuest();

	if (pQuest == NULL)
		return;

	int iQuestIndex = -1;
	CTString strQuestTitle;
	int count;

	count = pQuest->GetCompleteQuestCount();

	for( int iComplete = 0; iComplete < count; ++iComplete )
	{
		iQuestIndex = pQuest->GetCompleteQuestIndex(iComplete);

		CQuestDynamicData qdd(CQuestSystem::Instance().GetStaticData(iQuestIndex));				
		strQuestTitle = qdd.GetName();

		if( 0 == strQuestTitle.Length() )
		{
			if (_pNetwork->m_ubGMLevel > 1)
				strQuestTitle.PrintF("Index : %d", iQuestIndex);
			else
				continue;
		}

		pUIManager->AddMessageBoxLString( iMessageBoxType, FALSE, strQuestTitle, ciQuestClassifier + iQuestIndex, 0xF2F200FF, CTString("A") );
	}

	count = pQuest->GetProceedQuestCount();

	for( int iNew = 0; iNew < count; ++iNew )
	{
		iQuestIndex = pQuest->GetProceedQuestIndex(iNew);

		CQuestDynamicData qdd(CQuestSystem::Instance().GetStaticData(iQuestIndex));				
		strQuestTitle = qdd.GetName();

		if( 0 == strQuestTitle.Length() )
		{
			if (_pNetwork->m_ubGMLevel > 1)
				strQuestTitle.PrintF("Index : %d", iQuestIndex);
			else
				continue;
		}

		pUIManager->AddMessageBoxLString( iMessageBoxType, FALSE, strQuestTitle, ciQuestClassifier + iQuestIndex, 0xF2F200FF, CTString("Q") );
	}
}
Esempio n. 3
0
void CUITrackPopup::DeleteMenuList( int nCol, int nIndex )
{
	CTString strMenu =GetString(nCol, nIndex);

	RemoveString(nIndex, nCol);	

	// 해당 라인의 command 삭제
	std::vector<int>::iterator iter = m_vecCommandList.begin();
	iter += nIndex;
	m_vecCommandList.erase(iter);

	int nMaxLengthIdx = 0;

	if( strMenu.Length() == m_nMaxCharCount )
	{
		m_nMaxCharCount =0;
		for(int i=0; i<m_vecString[nCol].vecString.size(); ++i)
		{
			if( m_vecString[nCol].vecString[i].Length() > m_nMaxCharCount )
			{
				m_nMaxCharCount =m_vecString[nCol].vecString[i].Length();
				nMaxLengthIdx = i;
			}
		}
	}

#if defined G_RUSSIA
	m_strLongestStringInMenu = m_vecString[nCol].vecString[nMaxLengthIdx];
#else
	Resize();
#endif
}
Esempio n. 4
0
// ----------------------------------------------------------------------------
// Name : AddListSubjectString()
// Desc :
// ----------------------------------------------------------------------------
void CUIHelp::AddListSubjectString( CTString &strSubject )
{
	CTString	strTemp = strSubject;
	
	INDEX	nLength = strTemp.Length();
	if( nLength > HELP_LIST_SUBJECT_MAX_CHAR )
	{
		// Check splitting position for 2 byte characters
		int		nSplitPos = HELP_LIST_SUBJECT_MAX_CHAR - 4;
		BOOL	b2ByteChar = FALSE;
		for( int iPos = 0; iPos < nSplitPos; iPos++ )
		{
			if( strTemp[iPos] & 0x80 )
				b2ByteChar = !b2ByteChar;
			else
				b2ByteChar = FALSE;
		}

		if( b2ByteChar )
			nSplitPos--;

		// Trim right
		strTemp.TrimRight( nSplitPos );
		strTemp += CTString( "..." );
	}

	m_lbListContent.AddString( 0, strTemp, 0xFFAD60FF );
}
Esempio n. 5
0
CTString CUIQuestBook::MakeTitleString(CTString strTitle, int iSplitPos)
{
	if( strTitle.Length() <= iSplitPos )
		return strTitle;

	BOOL b2ByteChar = FALSE;

	for( int iPos = 0; iPos < iSplitPos; ++iPos )
	{
		if( strTitle[iPos] & 0x80 )
			b2ByteChar = !b2ByteChar;
		else
			b2ByteChar = FALSE;
	}

	if( b2ByteChar )
		iSplitPos--;

	CTString	strTemp, strTemp2;
	strTitle.Split( iSplitPos, strTemp, strTemp2 );

	strTemp += _s("...");

	return strTemp;
}
Esempio n. 6
0
// ----------------------------------------------------------------------------
// Name : AddString()
// Desc : 
// ----------------------------------------------------------------------------
void CUIPetItemMix::AddString ( CTString& strText, COLOR colText )
{
	int nLength =  strText.Length();

	if( nLength >= _iMaxMsgStringChar )
	{
		nLength -= nLength - _iMaxMsgStringChar;
		
		do
		{
			if ( strText[nLength] == ' ' )
			{
				break;
			}

		} while ( nLength-- );

		CTString strTemp2, strTemp;

		strText.Split( nLength, strTemp2, strTemp );
		m_lbPreconditionDesc.AddString ( 0, strTemp2, colText );

		strTemp2.PrintF ( "%s", strTemp );
		
		m_lbPreconditionDesc.AddString ( 0, strTemp2, colText );

	}
	else 
	{
		m_lbPreconditionDesc.AddString ( 0, strText, colText );
	}

}
Esempio n. 7
0
static void GenerateFont(void)
{
  if(!_bInitialized) return;
  try {
    _iiFont.Clear();
    _iiGrid.Clear();

    _iiFont.ii_Width = GetIntFromControl(ICB_TEX_WIDTH);
    _iiFont.ii_Height = GetIntFromControl(ICB_TEX_HEIGHT);
    _iiFont.ii_BitsPerPixel = 32;

    _iiGrid.ii_Width = _iiFont.ii_Width;
    _iiGrid.ii_Height = _iiFont.ii_Height;
    _iiGrid.ii_BitsPerPixel = _iiFont.ii_BitsPerPixel;

    SLONG slSize = _iiFont.ii_Width*_iiFont.ii_Height * _iiFont.ii_BitsPerPixel/8;
    _iiFont.ii_Picture = (UBYTE*)AllocMemory(slSize);
    _iiGrid.ii_Picture = (UBYTE*)AllocMemory(slSize);

    memset(_iiFont.ii_Picture,0,slSize);
    memset(_iiGrid.ii_Picture,0,slSize);

    CTString strFontName = GetFontName();
    if(strFontName.Length() == 0) {
      throw("No font selected");
    }


    ULONG ulFlags = GetFontFlags();
    INDEX iFontSize = GetIntFromControl(IEC_FONT_SIZE);
    INDEX iFirstChar = GetIntFromControl(IEC_FIRST_CHAR);
    INDEX iLastChar = GetIntFromControl(IEC_LAST_CHAR);
    INDEX iAlignH  = GetComboIndex(IDC_ALIGN_H);
    INDEX iAlignV  = GetComboIndex(IDC_ALIGN_V);
    INDEX iPaddingX = GetIntFromControl(IEC_PADDINGX);
    INDEX iPaddingY = GetIntFromControl(IEC_PADDINGY);
    INDEX iWidthAdd = GetIntFromControl(IEC_WIDTH_ADD);
    INDEX iHeightAdd = GetIntFromControl(IEC_HEIGHT_ADD);
    INDEX ctShadows = GetIntFromControl(IEC_SHADOW_PASSES);
    
    if(ulFlags&FNT_HAS_SHADOW) {
      iPaddingX+=ctShadows;
      iPaddingY+=ctShadows;
      iWidthAdd+=ctShadows;
      iHeightAdd+=ctShadows;
    }

    _pfdCurrentFont = NULL;
    GenerateFont_t(_fdFont,_iiFont,_iiGrid,strFontName,iFontSize,iLastChar,iFirstChar,iAlignH,iAlignV,iPaddingX,iPaddingY,iWidthAdd,iHeightAdd,ulFlags,ctShadows);
    _pfdCurrentFont = &_fdFont;

    RefreshCanvas();
  } catch (char *strErr) {
    MessageBox(_hWnd,strErr,0,0);
  }
}
Esempio n. 8
0
void StringSplit(std::vector<CTString>& vecOutput, CTString strInput, ULONG ulColumnWidth)
{
	CDrawPort* pDrawPort = CUIManager::getSingleton()->GetDrawPort();

	ULONG ulWidth = 0;
#if defined(G_RUSSIA)
	ulWidth = UTIL_HELP()->GetNoFixedWidth(_pfdDefaultFont, strInput.str_String);
#else	//	defined(G_RUSSIA)
	ulWidth = pDrawPort->GetTextWidth2(strInput);
#endif	//	defined(G_RUSSIA)
	
	if (ulWidth <= ulColumnWidth)
	{
		strInput.TrimSpacesLeft();
		strInput.TrimSpacesRight();
		vecOutput.push_back(strInput);
		return;
	}
	
	char szTemp[4];
	int len = strInput.Length(), pos = 0;
	ulWidth = 0;
	for (int i = 0, j = 0; i < len; j = 0)
	{
		if (IsDBCSLeadByte(strInput[i]))
			szTemp[j++] = strInput[i++];
		szTemp[j++] = strInput[i++];
		szTemp[j] = 0;
		ULONG ulTempWidth = 0;
#if defined(G_RUSSIA)
		ulTempWidth = UTIL_HELP()->GetNoFixedWidth(_pfdDefaultFont, szTemp);
#else	//	defined(G_RUSSIA)
		ulTempWidth = pDrawPort->GetTextWidth2(szTemp);
#endif	//	defined(G_RUSSIA)
		if (ulWidth + ulTempWidth > ulColumnWidth &&
			!(j == 1 && (szTemp[0] == '.' || szTemp[0] == ',' || szTemp[0] == ' ')))
			break;

		pos = i;
		ulWidth += ulTempWidth;
		if( strInput[pos] == '\n' || strInput[pos] == '\r' )
		{
			pos++;
			break;
		}	
	}
	CTString strLeft, strRight;
	strInput.Split(pos, strLeft, strRight);
	strLeft.TrimSpacesLeft();
	strLeft.TrimSpacesRight();
	vecOutput.push_back(strLeft);

	if (strRight.Length() > 0)
		StringSplit(vecOutput, strRight, ulColumnWidth);
}
Esempio n. 9
0
// ----------------------------------------------------------------------------
// Name : SetText()
// Desc :
// ----------------------------------------------------------------------------
void CUICheckButton::SetText( CTString &strText )
{
	int	nLength = strText.Length();
	m_bValidText = nLength > 0;

	if( m_bValidText )
		m_strText = strText;

	if( m_nTextSY == 0 )
		m_nTextSY = ( m_nHeight - _pUIFontTexMgr->GetFontHeight() ) / 2;
}
Esempio n. 10
0
/* Find index of a substring in a string (returns -1 if not found). */
INDEX CTString::FindSubstr(const CTString &strSub)
{
  INDEX ct = Length();
  INDEX ctSub = strSub.Length();
  for (INDEX i=0; i<ct-ctSub+1; i++) {
    for (INDEX iSub=0; iSub<ctSub; iSub++) {
      if ((*this)[i+iSub]!=strSub[iSub]) {
        goto wrong;
      }
    }
    return i;
wrong:;
  }
  return -1;
}
// save skeleton list file 
BOOL CSeriousSkaStudioApp::SaveSkeletonListFile(CSkeleton &skl, BOOL bConvert)
{
  DisableRendering();
  CTFileName fnSkeletonList = skl.GetName();
  fnSkeletonList = fnSkeletonList.NoExt() + ".asl";
  try {
    fnSkeletonList.RemoveApplicationPath_t();
  }
  catch(char *){}

  // back up current skeleton list file
  CTString strBackUp;
  try {
    strBackUp.Load_t(fnSkeletonList);
  }
  catch(char*){}

  CTFileStream ostrFile;
  try {
    ostrFile.Create_t(fnSkeletonList,CTStream::CM_TEXT);
    SaveSkeletonList_t(skl,ostrFile);
    ostrFile.Close();
  } catch(char *strError) {
    ErrorMessage(strError);
    EnableRendering();
    return FALSE;
  }

  if(bConvert) {
    if(!ConvertSkeleton(fnSkeletonList)) {
      // convert failed
      if(strBackUp.Length()>0) {
        // try returning old mesh list file
        try {
          strBackUp.Save_t(fnSkeletonList);
        }
        catch(char*){}
      }
    }
  }
  EnableRendering();
  return TRUE;
}
// save mesh list file
BOOL CSeriousSkaStudioApp::SaveMeshListFile(MeshInstance &mshi, BOOL bConvert)
{
  DisableRendering();
  // get mesh list filename
  CTFileName fnMeshList = mshi.mi_pMesh->GetName();
  fnMeshList = fnMeshList.NoExt() + ".aml";
  try {
    fnMeshList.RemoveApplicationPath_t();
  } catch(char *){}
  CTString strBackUp;
  try {
    // back up current mesh list file
    strBackUp.Load_t(fnMeshList);
  } catch(char*){}
  // save mesh instance in new mesh list file
  CTFileStream ostrFile;
  try {
    ostrFile.Create_t(fnMeshList,CTStream::CM_TEXT);
    SaveMeshInstance_t(mshi,ostrFile);
    ostrFile.Close();
  } catch(char *strError) {
    ErrorMessage(strError);
    EnableRendering();
    return FALSE;
  }

  // if new mesh list file needs to be converted
  if(bConvert) {
    if(!ConvertMesh(fnMeshList)) {
      // convert failed
      if(strBackUp.Length()>0) {
        // try returning old mesh list file
        try {
          strBackUp.Save_t(fnMeshList);
        } catch(char*){}
      }
    }
  }
  EnableRendering();
  return TRUE;
}
Esempio n. 13
0
// strip decorations from the string
CTString CTString::Undecorated(void) const
{
  // make a copy of the string to hold the result - we will rewrite it without the codes
  CTString strResult = *this;

  // start at the beginning of both strings
  const char *pchSrc = str_String;
  char *pchDst = strResult.str_String;

  // while the source is not finished
  while(pchSrc[0]!=0) {
    // if the source char is not escape char
    if (pchSrc[0]!='^') {
      // copy it over
      *pchDst++ = *pchSrc++;
      // go to next char
      continue;
    }
    // check the next char
    switch(pchSrc[1]) {
      // if one of the control codes, skip corresponding number of characters
      case 'c':  pchSrc += 2+FindZero((UBYTE*)pchSrc+2,6);  break;
      case 'a':  pchSrc += 2+FindZero((UBYTE*)pchSrc+2,2);  break;
      case 'f':  pchSrc += 2+FindZero((UBYTE*)pchSrc+2,2);  break;
      case 'b':  case 'i':  case 'r':  case 'o':
      case 'C':  case 'A':  case 'F':  case 'B':  case 'I':  pchSrc+=2;  break;
      // if it is the escape char again, skip the first escape and copy the char
      case '^':  pchSrc++; *pchDst++ = *pchSrc++; break;
      // if it is something else
      default:
        // just copy over the control char
        *pchDst++ = *pchSrc++;
        break;
    }
  }
  *pchDst++ = 0;
  ASSERT(strResult.Length()<=Length());
  return strResult;
}
Esempio n. 14
0
static void LoadCharTable(const CTFileName &fnCharTable) {
  if(fnCharTable.Length() == 0) {
    ClearCharTable();
    return;
  }

  try {
    SetDlgItemText(_hWnd,IDC_CHARACTER_TABLE,(const char*)(fnCharTable.FileName() + fnCharTable.FileExt()));
    _strCharTable.Load_t(fnCharTable);
    INDEX iLen = _strCharTable.Length();
    memset(&_aubCharTable[0],0,sizeof(_aubCharTable));

    for(INDEX ic=0;ic<iLen;ic++) {
      unsigned char ch = _strCharTable[ic];
      _aubCharTable[ch] = 1;
    }
    _aubCharTable[10] = 0;
    _aubCharTable[13] = 0;
    _fnCharacterTable = fnCharTable;
  } catch(char *strErr) {
    MessageBox(_hWnd,strErr,0,0);
  }
}
Esempio n. 15
0
// ----------------------------------------------------------------------------
// Name : Create()
// Desc :
// ----------------------------------------------------------------------------
void CUICheckButton::Create( CUIWindow *pParentWnd, int nX, int nY, int nWidth, int nHeight,
								CTString &strText, BOOL bCheckRegionLeft, int nTextSX, int nCheckRegion )
{
	CUIWindow::Create(pParentWnd, nX, nY, nWidth, nHeight);

	int	nLength = strText.Length();
	m_bValidText = nLength > 0;
	m_nTextSY = ( nHeight - _pUIFontTexMgr->GetFontHeight() ) / 2;

	if( m_bValidText )
		m_strText = strText;

	if( bCheckRegionLeft )
	{
		m_nTextSX = -nTextSX;
		m_rcCheckRegion.SetRect( -nCheckRegion, 0, nWidth, nHeight );
	}
	else
	{
		m_nTextSX = nTextSX;
		m_rcCheckRegion.SetRect( 0, 0, nWidth + nCheckRegion, nHeight );
	}
}
Esempio n. 16
0
// ----------------------------------------------------------------------------
// Name : AddString()
// Desc :
// ----------------------------------------------------------------------------
void CUIMixNew::AddString( CTString &strDesc )
{
	if( m_nStringCount >= MAX_MIXNEW_STRING )
		return;
	
	// Get length of string
	INDEX	nLength = strDesc.Length();
	INDEX	limitstrpos = _iMaxMsgStringChar;
	if( nLength == 0 )
		return;
#if defined(G_THAI)
	nLength = FindThaiLen(strDesc);
	limitstrpos = (_iMaxMsgStringChar-1)*(_pUIFontTexMgr->GetFontWidth()+_pUIFontTexMgr->GetFontSpacing());
#else
	nLength = strDesc.Length();
	limitstrpos = _iMaxMsgStringChar;
#endif

	int iPos;
	// If length of string is less than max char
	if( nLength <= limitstrpos )
	{
		// Check line character		
		for( iPos = 0; iPos < strDesc.Length(); iPos++ )
		{
			if( strDesc[iPos] == '\n' || strDesc[iPos] == '\r' )
				break;
		}
		
		// Not exist
		if( iPos == nLength )
			m_strMixDesc[m_nStringCount++] = strDesc;
		else
		{
			// Split string
			CTString	strTemp;
			strDesc.Split( iPos, m_strMixDesc[m_nStringCount++], strTemp );
			
			// Trim line character
			if( strTemp[0] == '\r' && strTemp[1] == '\n' )
				strTemp.TrimLeft( strTemp.Length() - 2 );
			else
				strTemp.TrimLeft( strTemp.Length() - 1 );
			
			AddString( strTemp );
		}
	}
	// Need multi-line
	else
	{
		// Check splitting position for 2 byte characters
		int		nSplitPos = limitstrpos;
		BOOL	b2ByteChar = FALSE;
#if defined(G_THAI)
		for( iPos = 0; iPos < strDesc.Length(); iPos++ )
		{
			if(nSplitPos < FindThaiLen(strDesc,0,iPos))
				break;
		}
		nSplitPos = iPos;
#else
		for( iPos = 0; iPos < nSplitPos; iPos++ )
		{
			if( strDesc[iPos] & 0x80 )
				b2ByteChar = !b2ByteChar;
			else
				b2ByteChar = FALSE;
		}
		
		if( b2ByteChar )
			nSplitPos--;
#endif
		// Check line character
		for( iPos = 0; iPos < nSplitPos; iPos++ )
		{
			if( strDesc[iPos] == '\n' || strDesc[iPos] == '\r' )
				break;
		}
		
		// Not exist
		if( iPos == nSplitPos )
		{
			// Split string
			CTString	strTemp;
#ifdef LINE_CHANGE_BY_WORD
			if( strDesc[nSplitPos] != ' ' )
			{
				for(int i = iPos; i>=0; --i)
				{
					if( strDesc[i] == ' ' )
					{
						iPos = i;
						break;
					}
				}
			}
#endif
			strDesc.Split( nSplitPos, m_strMixDesc[m_nStringCount++], strTemp );
			
			// Trim space
			if( strTemp[0] == ' ' )
			{
				int	nTempLength = strTemp.Length();
				for( iPos = 1; iPos < nTempLength; iPos++ )
				{
					if( strTemp[iPos] != ' ' )
						break;
				}
				
				strTemp.TrimLeft( strTemp.Length() - iPos );
			}
			
			AddString( strTemp );
		}
		else
		{
			// Split string
			CTString	strTemp;
			strDesc.Split( iPos, m_strMixDesc[m_nStringCount++], strTemp );
			
			// Trim line character
			if( strTemp[0] == '\r' && strTemp[1] == '\n' )
				strTemp.TrimLeft( strTemp.Length() - 2 );
			else
				strTemp.TrimLeft( strTemp.Length() - 1 );
			
			AddString( strTemp );
		}
	}
}
Esempio n. 17
0
// ----------------------------------------------------------------------------
// Name : AddString()
// Desc :
// ----------------------------------------------------------------------------
void CUICompound::AddString( CTString &strDesc )
{
	if( m_nStringCount >= MAX_COMPOUND_STRING )
		return;

	// Get length of string
	INDEX	nLength = strDesc.Length();
	if( nLength == 0 )
		return;
	// wooss 051002
#if defined(G_THAI)
	{
		int		iPos;
		// Get length of string
		INDEX	nThaiLen = FindThaiLen(strDesc);
		INDEX	nChatMax= (_iMaxMsgStringChar-1)*(_pUIFontTexMgr->GetFontWidth()+_pUIFontTexMgr->GetFontSpacing());
		if( nLength == 0 )
			return;
		// If length of string is less than max char
		if( nThaiLen <= nChatMax )
		{
		// Check line character
			for( iPos = 0; iPos < nLength; iPos++ )
			{
				if( strDesc[iPos] == '\n' || strDesc[iPos] == '\r' )
					break;
			}

			// Not exist
			if( iPos == nLength )
				m_strDesc[m_nStringCount++] = strDesc;
			else
			{
				// Split string
				CTString	strTemp;
				strDesc.Split( iPos, m_strDesc[m_nStringCount++], strTemp );

				// Trim line character
				if( strTemp[0] == '\r' && strTemp[1] == '\n' )
					strTemp.TrimLeft( strTemp.Length() - 2 );
				else
					strTemp.TrimLeft( strTemp.Length() - 1 );

				AddString( strTemp );
			}
		}
		// Need multi-line
		else
		{
			// Check splitting position for 2 byte characters
			int		nSplitPos = _iMaxMsgStringChar;
			BOOL	b2ByteChar = FALSE;
			for( iPos = 0; iPos < nLength; iPos++ )
			{
				if(nChatMax < FindThaiLen(strDesc,0,iPos))
					break;
			}
			nSplitPos = iPos;

			// Check line character
			for( iPos = 0; iPos < nSplitPos; iPos++ )
			{
				if( strDesc[iPos] == '\n' || strDesc[iPos] == '\r' )
					break;
			}

			// Not exist
			if( iPos == nSplitPos )
			{
				// Split string
				CTString	strTemp;
				strDesc.Split( nSplitPos, m_strDesc[m_nStringCount++], strTemp );

				// Trim space
				if( strTemp[0] == ' ' )
				{
					int	nTempLength = strTemp.Length();
					for( iPos = 1; iPos < nTempLength; iPos++ )
					{
						if( strTemp[iPos] != ' ' )
							break;
					}

					strTemp.TrimLeft( strTemp.Length() - iPos );
				}

				AddString( strTemp );
			}
			else
			{
				// Split string
				CTString	strTemp;
				strDesc.Split( iPos, m_strDesc[m_nStringCount++], strTemp );

				// Trim line character
				if( strTemp[0] == '\r' && strTemp[1] == '\n' )
					strTemp.TrimLeft( strTemp.Length() - 2 );
				else
					strTemp.TrimLeft( strTemp.Length() - 1 );

				AddString( strTemp );
			}

		}
		
	}
#else
	{	
		// If length of string is less than max char
		if( nLength <= _iMaxMsgStringChar )
		{
			// Check line character
			int iPos;
			for( iPos = 0; iPos < nLength; iPos++ )
			{
				if( strDesc[iPos] == '\n' || strDesc[iPos] == '\r' )
					break;
			}

			// Not exist
			if( iPos == nLength )
				m_strDesc[m_nStringCount++] = strDesc;
			else
			{
				// Split string
				CTString	strTemp;
				strDesc.Split( iPos, m_strDesc[m_nStringCount++], strTemp );

				// Trim line character
				if( strTemp[0] == '\r' && strTemp[1] == '\n' )
					strTemp.TrimLeft( strTemp.Length() - 2 );
				else
					strTemp.TrimLeft( strTemp.Length() - 1 );

				AddString( strTemp );
			}
		}
		// Need multi-line
		else
		{
			// Check splitting position for 2 byte characters
			int		nSplitPos = _iMaxMsgStringChar;
			BOOL	b2ByteChar = FALSE;
			int		iPos;
			for( iPos = 0; iPos < nSplitPos; iPos++ )
			{
				if( strDesc[iPos] & 0x80 )
					b2ByteChar = !b2ByteChar;
				else
					b2ByteChar = FALSE;
			}

			if( b2ByteChar )
				nSplitPos--;

			// Check line character
			for( iPos = 0; iPos < nSplitPos; iPos++ )
			{
				if( strDesc[iPos] == '\n' || strDesc[iPos] == '\r' )
					break;
			}

			// Not exist
			if( iPos == nSplitPos )
			{
				// Split string
				CTString	strTemp;
				strDesc.Split( nSplitPos, m_strDesc[m_nStringCount++], strTemp );

				// Trim space
				if( strTemp[0] == ' ' )
				{
					int	nTempLength = strTemp.Length();
					for( iPos = 1; iPos < nTempLength; iPos++ )
					{
						if( strTemp[iPos] != ' ' )
							break;
					}

					strTemp.TrimLeft( strTemp.Length() - iPos );
				}

				AddString( strTemp );
			}
			else
			{
				// Split string
				CTString	strTemp;
				strDesc.Split( iPos, m_strDesc[m_nStringCount++], strTemp );

				// Trim line character
				if( strTemp[0] == '\r' && strTemp[1] == '\n' )
					strTemp.TrimLeft( strTemp.Length() - 2 );
				else
					strTemp.TrimLeft( strTemp.Length() - 1 );

				AddString( strTemp );
			}
		}
	}
#endif
}
Esempio n. 18
0
// ----------------------------------------------------------------------------
// Name : AddReadingString()
// Desc :
// ----------------------------------------------------------------------------
void CUIHelp::AddReadingString( CUIListBox& lbList, CTString &strContent, COLOR colContent, int iMaxChar )
{
	// Get length of string
	INDEX	nLength = strContent.Length();
	if( nLength == 0 )
		return;

	// wooss 051002
#if defined (THAI)
	// Get length of string
	INDEX	nThaiLen = FindThaiLen(strContent);
	INDEX	nChatMax= (iMaxChar-1)*(_pUIFontTexMgr->GetFontWidth()+_pUIFontTexMgr->GetFontSpacing());
	if( nLength == 0 )
		return;
	// If length of string is less than max char
	if( nThaiLen <= nChatMax )
	{
		// Check line character
		for( int iPos = 0; iPos < nLength; iPos++ )
		{
			if( strContent[iPos] == '\n' || strContent[iPos] == '\r' )
				break;	
		}

		// Not exist
		if( iPos == nLength )
		{
			lbList.AddString( 0, strContent, colContent );
		}
		else
		{
			// Split string
			CTString	strTemp, strTemp2;
			strContent.Split( iPos, strTemp2, strTemp );
			lbList.AddString( 0, strTemp2, colContent );

			// Trim line character
			if( strTemp[0] == '\r' && strTemp[1] == '\n' )
				strTemp.TrimLeft( strTemp.Length() - 2 );
			else
				strTemp.TrimLeft( strTemp.Length() - 1 );

			AddReadingString( lbList, strTemp, colContent );
		}
	}
	// Need multi-line
	else
	{
		// Check splitting position for 2 byte characters
		int		nSplitPos = iMaxChar;
		BOOL	b2ByteChar = FALSE;
		for( int iPos = 0; iPos < nLength; iPos++ )
		{
			if(nChatMax < FindThaiLen(strContent,0,iPos))
				break;
		}
		nSplitPos = iPos;

		// Check line character
		for( iPos = 0; iPos < nSplitPos; iPos++ )
		{
			if( strContent[iPos] == '\n' || strContent[iPos] == '\r' )
				break;
		}

		// Not exist
		if( iPos == nSplitPos )
		{
			// Split string
			CTString	strTemp, strTemp2;
			strContent.Split( nSplitPos, strTemp2, strTemp );
			lbList.AddString( 0, strTemp2, colContent );

			// Trim space
			if( strTemp[0] == ' ' )
			{
				int	nTempLength = strTemp.Length();
				for( iPos = 1; iPos < nTempLength; iPos++ )
				{
					if( strTemp[iPos] != ' ' )
						break;
				}

				strTemp.TrimLeft( strTemp.Length() - iPos );
			}

			AddReadingString( lbList, strTemp, colContent );
		}
		else
		{
			// Split string
			CTString	strTemp, strTemp2;
			strContent.Split( iPos, strTemp2, strTemp );
			lbList.AddString( 0, strTemp2, colContent );

			// Trim line character
			if( strTemp[0] == '\r' && strTemp[1] == '\n' )
				strTemp.TrimLeft( strTemp.Length() - 2 );
			else
				strTemp.TrimLeft( strTemp.Length() - 1 );

			AddReadingString( lbList, strTemp, colContent );
		}

	}
#else
	// If length of string is less than max char
	if( nLength <= iMaxChar )
	{
		// Check line character
		int iPos;
		for( iPos = 0; iPos < nLength; iPos++ )
		{
			if( strContent[iPos] == '\n' || strContent[iPos] == '\r' )
				break;	
		}

		// Not exist
		if( iPos == nLength )
		{
			lbList.AddString( 0, strContent, colContent );
		}
		else
		{
			// Split string
			CTString	strTemp, strTemp2;
			strContent.Split( iPos, strTemp2, strTemp );
			lbList.AddString( 0, strTemp2, colContent );

			// Trim line character
			if( strTemp[0] == '\r' && strTemp[1] == '\n' )
				strTemp.TrimLeft( strTemp.Length() - 2 );
			else
				strTemp.TrimLeft( strTemp.Length() - 1 );

			AddReadingString( lbList, strTemp, colContent );
		}
	}
	// Need multi-line
	else
	{
		// Check splitting position for 2 byte characters
		int		nSplitPos = iMaxChar;
		BOOL	b2ByteChar = FALSE;
		int		iPos;
		for( iPos = 0; iPos < nSplitPos; iPos++ )
		{
			if( strContent[iPos] & 0x80 )
				b2ByteChar = !b2ByteChar;
			else
				b2ByteChar = FALSE;
		}

		if( b2ByteChar )
			nSplitPos--;

		// Check line character		
		for( iPos = 0; iPos < nSplitPos; iPos++ )
		{
			if( strContent[iPos] == '\n' || strContent[iPos] == '\r' )
				break;
		}

		// Not exist
		if( iPos == nSplitPos )
		{
			// Split string
			CTString	strTemp, strTemp2;
			strContent.Split( nSplitPos, strTemp2, strTemp );
			lbList.AddString( 0, strTemp2, colContent );

			// Trim space
			if( strTemp[0] == ' ' )
			{
				int	nTempLength = strTemp.Length();
				for( iPos = 1; iPos < nTempLength; iPos++ )
				{
					if( strTemp[iPos] != ' ' )
						break;
				}

				strTemp.TrimLeft( strTemp.Length() - iPos );
			}

			AddReadingString( lbList, strTemp, colContent );
		}
		else
		{
			// Split string
			CTString	strTemp, strTemp2;
			strContent.Split( iPos, strTemp2, strTemp );
			lbList.AddString( 0, strTemp2, colContent );

			// Trim line character
			if( strTemp[0] == '\r' && strTemp[1] == '\n' )
				strTemp.TrimLeft( strTemp.Length() - 2 );
			else
				strTemp.TrimLeft( strTemp.Length() - 1 );

			AddReadingString( lbList, strTemp, colContent );
		}
	}
#endif
}
Esempio n. 19
0
// ----------------------------------------------------------------------------
// Name : AddReadingString()
// Desc :
// ----------------------------------------------------------------------------
void CUIHelp3::AddHelpString( CTString &strContent, COLOR colContent, int iMaxChar )
{
	// Get length of string
	INDEX	nLength = strContent.Length();
	if( nLength == 0 )
		return;

	// wooss 051002
#if defined (G_THAI)
	int		iPos;
	// Get length of string
	INDEX	nThaiLen = FindThaiLen(strContent);
	// [2011/08/24 : Sora]
	INDEX	nChatMax= m_lbContent.GetWidth() - 15;

	if( nLength == 0 )
		return;
	// If length of string is less than max char
	if( nThaiLen <= nChatMax )
	{
		// Check line character
		for( iPos = 0; iPos < nLength; iPos++ )
		{
			if( strContent[iPos] == '\n' || strContent[iPos] == '\r' )
				break;	
		}

		// Not exist
		if( iPos == nLength )
		{
			m_lbContent.AddString( 0, strContent, colContent );
		}
		else
		{
			// Split string
			CTString	strTemp, strTemp2;
			strContent.Split( iPos, strTemp2, strTemp );
			m_lbContent.AddString( 0, strTemp2, colContent );

			// Trim line character
			if( strTemp[0] == '\r' && strTemp[1] == '\n' )
				strTemp.TrimLeft( strTemp.Length() - 2 );
			else
				strTemp.TrimLeft( strTemp.Length() - 1 );

			AddHelpString( strTemp, colContent );
		}
	}
	// Need multi-line
	else
	{
		// Check splitting position for 2 byte characters
		int		nSplitPos = iMaxChar;
		BOOL	b2ByteChar = FALSE;
		for( iPos = 0; iPos < nLength; iPos++ )
		{
			if(nChatMax < FindThaiLen(strContent,0,iPos))
				break;
		}
		nSplitPos = iPos;

		// Check line character
		for( iPos = 0; iPos < nSplitPos; iPos++ )
		{
			if( strContent[iPos] == '\n' || strContent[iPos] == '\r' )
				break;
		}

		// Not exist
		if( iPos == nSplitPos )
		{
			// Split string
			CTString	strTemp, strTemp2;
			strContent.Split( nSplitPos, strTemp2, strTemp );
			m_lbContent.AddString( 0, strTemp2, colContent );

			// Trim space
			if( strTemp[0] == ' ' )
			{
				int	nTempLength = strTemp.Length();
				for( iPos = 1; iPos < nTempLength; iPos++ )
				{
					if( strTemp[iPos] != ' ' )
						break;
				}

				strTemp.TrimLeft( strTemp.Length() - iPos );
			}

			AddHelpString( strTemp, colContent );
		}
		else
		{
			// Split string
			CTString	strTemp, strTemp2;
			strContent.Split( iPos, strTemp2, strTemp );
			m_lbContent.AddString( 0, strTemp2, colContent );

			// Trim line character
			if( strTemp[0] == '\r' && strTemp[1] == '\n' )
				strTemp.TrimLeft( strTemp.Length() - 2 );
			else
				strTemp.TrimLeft( strTemp.Length() - 1 );

			AddHelpString( strTemp, colContent );
		}

	}
#else
	// If length of string is less than max char
	if( nLength <= iMaxChar )
	{
		// Check line character
		int iPos;
		for( iPos = 0; iPos < nLength; iPos++ )
		{
			if( strContent[iPos] == '\n' || strContent[iPos] == '\r' )
				break;	
		}

		// Not exist
		if( iPos == nLength )
		{
			m_lbContent.AddString( 0, strContent, colContent );
		}
		else
		{
			// Split string
			CTString	strTemp, strTemp2;
			strContent.Split( iPos, strTemp2, strTemp );
			m_lbContent.AddString( 0, strTemp2, colContent );

			// Trim line character
			if( strTemp[0] == '\r' && strTemp[1] == '\n' )
				strTemp.TrimLeft( strTemp.Length() - 2 );
			else
				strTemp.TrimLeft( strTemp.Length() - 1 );

			AddHelpString( strTemp, colContent );
		}
	}
	// Need multi-line
	else
	{
		// Check splitting position for 2 byte characters
		int		nSplitPos = iMaxChar;
		BOOL	b2ByteChar = FALSE;
		int		iPos;
		for( iPos = 0; iPos < nSplitPos; iPos++ )
		{
			if( strContent[iPos] & 0x80 )
				b2ByteChar = !b2ByteChar;
			else
				b2ByteChar = FALSE;
		}

		if( b2ByteChar )
			nSplitPos--;

		// Check line character		
		for( iPos = 0; iPos < nSplitPos; iPos++ )
		{
			if( strContent[iPos] == '\n' || strContent[iPos] == '\r' )
				break;
		}

		// Not exist
		if( iPos == nSplitPos )
		{
			// Split string
			CTString	strTemp, strTemp2;
						// Split string
#ifdef LINE_CHANGE_BY_WORD
			if( strContent[nSplitPos] != ' ' )
			{
				for(int i = iPos; i>=0; --i)
				{
					if( strContent[i] == ' ' )
					{
						iPos = i;
						break;
					}
				}
			}
#endif
			strContent.Split( iPos, strTemp2, strTemp );
			m_lbContent.AddString( 0, strTemp2, colContent );

			// Trim space
			if( strTemp[0] == ' ' )
			{
				int	nTempLength = strTemp.Length();
				for( iPos = 1; iPos < nTempLength; iPos++ )
				{
					if( strTemp[iPos] != ' ' )
						break;
				}

				strTemp.TrimLeft( strTemp.Length() - iPos );
			}

			AddHelpString( strTemp, colContent );
		}
		else
		{
			// Split string
			CTString	strTemp, strTemp2;
			strContent.Split( iPos, strTemp2, strTemp );
			m_lbContent.AddString( 0, strTemp2, colContent );

			// Trim line character
			if( strTemp[0] == '\r' && strTemp[1] == '\n' )
				strTemp.TrimLeft( strTemp.Length() - 2 );
			else
				strTemp.TrimLeft( strTemp.Length() - 1 );

			AddHelpString( strTemp, colContent );
		}
	}
#endif
}
Esempio n. 20
0
void InitStreams(void)
{
  // obtain information about system
// !!! FIXME: Move this into an abstraction of some sort...
#ifdef PLATFORM_WIN32
  SYSTEM_INFO siSystemInfo;
  GetSystemInfo( &siSystemInfo);
  // and remember page size
  _ulPageSize = siSystemInfo.dwPageSize*16;   // cca. 64kB on WinNT/Win95
#else
  _ulPageSize = PAGESIZE;
#endif

  // keep a copy of path for setting purposes
  _fnmApp = _fnmApplicationPath;

  // if no mod defined yet
  if (_fnmMod=="") {
    // check for 'default mod' file
    LoadStringVar(CTString("DefaultMod.txt"), _fnmMod);
  }

  CPrintF(TRANSV("Current mod: %s\n"),
            (_fnmMod=="") ? TRANS("<none>") :
                            (const char *) (CTString&)_fnmMod);
  // if there is a mod active
  if (_fnmMod!="") {
    // load mod's include/exclude lists
    CPrintF(TRANSV("Loading mod include/exclude lists...\n"));
    BOOL bOK = FALSE;
    bOK |= LoadFileList(_afnmBaseWriteInc , CTString("BaseWriteInclude.lst"));
    bOK |= LoadFileList(_afnmBaseWriteExc , CTString("BaseWriteExclude.lst"));
    bOK |= LoadFileList(_afnmBaseBrowseInc, CTString("BaseBrowseInclude.lst"));
    bOK |= LoadFileList(_afnmBaseBrowseExc, CTString("BaseBrowseExclude.lst"));

    // if none found
    if (!bOK) {
      // the mod is not valid
      _fnmMod = CTString("");
      CPrintF(TRANSV("Error: MOD not found!\n"));
    // if mod is ok
    } else {
      // remember mod name (the parameter that is passed on cmdline)
      _strModName = _fnmMod;
      _strModName.DeleteChar(_strModName.Length()-1);
      _strModName = CTFileName(_strModName).FileName();
    }
  }
  // find eventual extension for the mod's dlls
  _strModExt = "";
  LoadStringVar(CTString("ModExt.txt"), _strModExt);


  CPrintF(TRANSV("Loading group files...\n"));

  CDynamicArray<CTString> *files = NULL;

  // for each group file in base directory
  files = _pFileSystem->FindFiles(_fnmApplicationPath, "*.gro");
  int max = files->Count();
  int i;

  // for each .gro file in the directory
  for (i = 0; i < max; i++) {
    // add it to active set
    UNZIPAddArchive( _fnmApplicationPath+((*files)[i]) );
  }
  delete files;

  // if there is a mod active
  if (_fnmMod!="") {
    // for each group file in mod directory
     files = _pFileSystem->FindFiles(_fnmApplicationPath+_fnmMod, "*.gro");
     max = files->Count();
     for (i = 0; i < max; i++) {
       UNZIPAddArchive( _fnmApplicationPath + _fnmMod + ((*files)[i]) );
     }
     delete files;
  }

  // if there is a CD path
  if (_fnmCDPath!="") {
    // for each group file on the CD
    files = _pFileSystem->FindFiles(_fnmCDPath, "*.gro");
    max = files->Count();
    for (i = 0; i < max; i++) {
      UNZIPAddArchive( _fnmCDPath + ((*files)[i]) );
    }
    delete files;

    // if there is a mod active
    if (_fnmMod!="") {
      // for each group file in mod directory
      files = _pFileSystem->FindFiles(_fnmCDPath+_fnmMod, "*.gro");
      max = files->Count();
      for (i = 0; i < max; i++) {
        UNZIPAddArchive( _fnmCDPath + _fnmMod + ((*files)[i]) );
      }
      delete files;
    }
  }

  // try to
  try {
    // read the zip directories
    UNZIPReadDirectoriesReverse_t();
  // if failed
  } catch( char *strError) {
    // report warning
    CPrintF( TRANS("There were group file errors:\n%s"), strError);
  }
  CPrintF("\n");

  const char *dirsep = CFileSystem::GetDirSeparator();
  LoadFileList(_afnmNoCRC, CTFILENAME("Data") + CTString(dirsep) + CTString("NoCRC.lst"));

  _pShell->SetINDEX(CTString("sys")+"_iCPU"+"Misc", 1);
}
Esempio n. 21
0
// ----------------------------------------------------------------------------
// Name : AddString()
// Desc :
// ----------------------------------------------------------------------------
void CUIGWMix::AddString( CTString &strDesc )
{
    if( m_nStringCount >= MAX_GW_MIX_STRING )
        return;

    // Get length of string
    INDEX	nLength = strDesc.Length();
    if( nLength == 0 )
        return;

    // If length of string is less than max char
    if( nLength <= _iMaxMsgStringChar )
    {
        // Check line character
        int iPos;
        for( iPos = 0; iPos < nLength; iPos++ )
        {
            if( strDesc[iPos] == '\n' || strDesc[iPos] == '\r' )
                break;
        }

        // Not exist
        if( iPos == nLength )
            m_strMixDesc[m_nStringCount++] = strDesc;
        else
        {
            // Split string
            CTString	strTemp;
            strDesc.Split( iPos, m_strMixDesc[m_nStringCount++], strTemp );

            // Trim line character
            if( strTemp[0] == '\r' && strTemp[1] == '\n' )
                strTemp.TrimLeft( strTemp.Length() - 2 );
            else
                strTemp.TrimLeft( strTemp.Length() - 1 );

            AddString( strTemp );
        }
    }
    // Need multi-line
    else
    {
        // Check splitting position for 2 byte characters
        int		nSplitPos = _iMaxMsgStringChar;
        BOOL	b2ByteChar = FALSE;
        int		iPos;
        for( iPos = 0; iPos < nSplitPos; iPos++ )
        {
            if( strDesc[iPos] & 0x80 )
                b2ByteChar = !b2ByteChar;
            else
                b2ByteChar = FALSE;
        }

        if( b2ByteChar )
            nSplitPos--;

        // Check line character
        for( iPos = 0; iPos < nSplitPos; iPos++ )
        {
            if( strDesc[iPos] == '\n' || strDesc[iPos] == '\r' )
                break;
        }

        // Not exist
        if( iPos == nSplitPos )
        {
            // Split string
            CTString	strTemp;
            strDesc.Split( nSplitPos, m_strMixDesc[m_nStringCount++], strTemp );

            // Trim space
            if( strTemp[0] == ' ' )
            {
                int	nTempLength = strTemp.Length();
                for( iPos = 1; iPos < nTempLength; iPos++ )
                {
                    if( strTemp[iPos] != ' ' )
                        break;
                }

                strTemp.TrimLeft( strTemp.Length() - iPos );
            }

            AddString( strTemp );
        }
        else
        {
            // Split string
            CTString	strTemp;
            strDesc.Split( iPos, m_strMixDesc[m_nStringCount++], strTemp );

            // Trim line character
            if( strTemp[0] == '\r' && strTemp[1] == '\n' )
                strTemp.TrimLeft( strTemp.Length() - 2 );
            else
                strTemp.TrimLeft( strTemp.Length() - 1 );

            AddString( strTemp );
        }
    }
}
Esempio n. 22
0
//-----------------------------------------------------------------------------
// Purpose: 캐릭터의 설명을 설정함.
// Input  : &strItemInfo - 
//			colItemInfo - 
//-----------------------------------------------------------------------------
void CUICreateChar::AddCharInfoString( CTString &strCharInfo, COLOR colCharInfo )
{
	if( m_nCurInfoLines >= MAX_CHARINFO_LINE )
		return;

	// Get length of string
	INDEX	nLength = strCharInfo.Length();
	if( nLength == 0 )
		return;

	// wooss 051002
#if defined(G_THAI)
	{
		int		iPos;
		// Get length of string
		INDEX	nThaiLen = FindThaiLen(strCharInfo);
		INDEX	nChatMax= (_iMaxCharInfoChar-1)*(_pUIFontTexMgr->GetFontWidth()+_pUIFontTexMgr->GetFontSpacing());
		if( nLength == 0 )
			return;
		// If length of string is less than max char
		if( nThaiLen <= nChatMax )
		{
			// Check line character
			for( iPos = 0; iPos < nLength; iPos++ )
			{
				if( strCharInfo[iPos] == '\n' || strCharInfo[iPos] == '\r' )
					break;	
			}

			// Not exist
			if( iPos == nLength )
			{
				m_strCharInfo[m_nCurInfoLines] = strCharInfo;
				m_colCharInfo[m_nCurInfoLines++] = colCharInfo;
			}
			else
			{
				// Split string
				CTString	strTemp;
				strCharInfo.Split( iPos, m_strCharInfo[m_nCurInfoLines], strTemp );
				m_colCharInfo[m_nCurInfoLines++] = colCharInfo;

				// Trim line character
				if( strTemp[0] == '\r' && strTemp[1] == '\n' )
					strTemp.TrimLeft( strTemp.Length() - 2 );
				else
					strTemp.TrimLeft( strTemp.Length() - 1 );

				AddCharInfoString( strTemp, colCharInfo );
			}
		}
		// Need multi-line
		else
		{
			// Check splitting position for 2 byte characters
			int		nSplitPos = _iMaxCharInfoChar;
			BOOL	b2ByteChar = FALSE;
			for( iPos = 0; iPos < nLength; iPos++ )
			{
				if(nChatMax < FindThaiLen(strCharInfo,0,iPos))
					break;
			}
			nSplitPos = iPos;

			// Check line character
			for( iPos = 0; iPos < nSplitPos; iPos++ )
			{
				if( strCharInfo[iPos] == '\n' || strCharInfo[iPos] == '\r' )
					break;
			}

			// Not exist
			if( iPos == nSplitPos )
			{
				// Split string
				CTString	strTemp;
				strCharInfo.Split( nSplitPos, m_strCharInfo[m_nCurInfoLines], strTemp );
				m_colCharInfo[m_nCurInfoLines++] = colCharInfo;

				// Trim space
				if( strTemp[0] == ' ' )
				{
					int	nTempLength = strTemp.Length();
					for( iPos = 1; iPos < nTempLength; iPos++ )
					{
						if( strTemp[iPos] != ' ' )
							break;
					}

					strTemp.TrimLeft( strTemp.Length() - iPos );
				}

				AddCharInfoString( strTemp, colCharInfo );
			}
			else
			{
				// Split string
				CTString	strTemp;
				strCharInfo.Split( iPos, m_strCharInfo[m_nCurInfoLines], strTemp );
				m_colCharInfo[m_nCurInfoLines++] = colCharInfo;

				// Trim line character
				if( strTemp[0] == '\r' && strTemp[1] == '\n' )
					strTemp.TrimLeft( strTemp.Length() - 2 );
				else
					strTemp.TrimLeft( strTemp.Length() - 1 );

				AddCharInfoString( strTemp, colCharInfo );
			}

		}
		
	} 
#else
 {
		// If length of string is less than max char
		if( nLength < _iMaxCharInfoChar )
		{
			// Check line character
			int iPos;
			for( iPos = 0; iPos < nLength; iPos++ )
			{
				if( strCharInfo[iPos] == '\n' || strCharInfo[iPos] == '\r' )
					break;	
			}

			// Not exist
			if( iPos == nLength )
			{
				m_strCharInfo[m_nCurInfoLines] = strCharInfo;
				m_colCharInfo[m_nCurInfoLines++] = colCharInfo;
			}
			else
			{
				// Split string
				CTString	strTemp;
				strCharInfo.Split( iPos, m_strCharInfo[m_nCurInfoLines], strTemp );
				m_colCharInfo[m_nCurInfoLines++] = colCharInfo;

				// Trim line character
				if( strTemp[0] == '\r' && strTemp[1] == '\n' )
					strTemp.TrimLeft( strTemp.Length() - 2 );
				else
					strTemp.TrimLeft( strTemp.Length() - 1 );

				AddCharInfoString( strTemp, colCharInfo );
			}
		}
		// Need multi-line
		else
		{
			// Check splitting position for 2 byte characters
			int		nSplitPos = _iMaxCharInfoChar;
			BOOL	b2ByteChar = FALSE;
			int		iPos;
			for( iPos = 0; iPos < nSplitPos; iPos++ )
			{
				if( strCharInfo[iPos] & 0x80 )
					b2ByteChar = !b2ByteChar;
				else
					b2ByteChar = FALSE;
			}

			if( b2ByteChar )
				nSplitPos--;

			// Check line character			
			for( iPos = 0; iPos < nSplitPos; iPos++ )
			{
				if( strCharInfo[iPos] == '\n' || strCharInfo[iPos] == '\r' )
					break;
			}

			// Not exist
			if( iPos == nSplitPos )
			{
				// Split string
				CTString	strTemp;
				strCharInfo.Split( nSplitPos, m_strCharInfo[m_nCurInfoLines], strTemp );
				m_colCharInfo[m_nCurInfoLines++] = colCharInfo;

				// Trim space
				if( strTemp[0] == ' ' )
				{
					int	nTempLength = strTemp.Length();
					for( iPos = 1; iPos < nTempLength; iPos++ )
					{
						if( strTemp[iPos] != ' ' )
							break;
					}

					strTemp.TrimLeft( strTemp.Length() - iPos );
				}

				AddCharInfoString( strTemp, colCharInfo );
			}
			else
			{
				// Split string
				CTString	strTemp;
				strCharInfo.Split( iPos, m_strCharInfo[m_nCurInfoLines], strTemp );
				m_colCharInfo[m_nCurInfoLines++] = colCharInfo;

				// Trim line character
				if( strTemp[0] == '\r' && strTemp[1] == '\n' )
					strTemp.TrimLeft( strTemp.Length() - 2 );
				else
					strTemp.TrimLeft( strTemp.Length() - 1 );

				AddCharInfoString( strTemp, colCharInfo );
			}
		}
	}
#endif
}
Esempio n. 23
0
//------------------------------------------------------------------------------
// CUISiegeWarfareDoc::EndWar
// Explain:  메세지 표시후 공성 종료
// Date : 2005-07-07,Author: Lee Ki-hwan
//------------------------------------------------------------------------------
void CUISiegeWarfareDoc::EndWar( int nZoneIndex, int nWinDefense, int nOwnerGuildIndex, CTString strOwnerGuildName, int nOwnerIndex, CTString strOwnerName, int nNextMonth, int nNextDay, int nNextWeek, int nNextHour )
{
	CUIManager* pUIManager = CUIManager::getSingleton();

	INDEX	i;
	if( nZoneIndex == 7 )
	{
		SetUIState( SWS_END );	
		// 공성이 끝나면 모든 문을 열어 둔다.
		// FIXME : 문 열어주기.	
		((CPlayerEntity*)CEntity::GetPlayerEntity(0))->OpenGate( 0, TRUE );
		((CPlayerEntity*)CEntity::GetPlayerEntity(0))->OpenGate( 1, TRUE );
		((CPlayerEntity*)CEntity::GetPlayerEntity(0))->OpenGate( 2, TRUE );

		if( _pNetwork->MyCharacterInfo.sbJoinFlagMerac == WCJF_NONE )
			return;	

		if( g_slZone == 7 )
			((CPlayerEntity*)CEntity::GetPlayerEntity(0))->PlayBGM( MUSIC_MERAC_FIELD );	

		// 이미지 출력 추가 
		_UISignBoard->ShowSingBoard ( 12, 7 );
			
		m_tmLeftTime = _pTimer->GetHighPrecisionTimer().GetMilliseconds();

		_pNetwork->MyCharacterInfo.sbJoinFlagMerac = WCJF_NONE;
		
		// Start My Guild, Enemy Guild Effect Start
		ACTORMGR()->SetJoinFlagMerac(WCJF_NONE);
	}
	else if( nZoneIndex == 4)
	{		
		// WSS_DRATAN_SEIGEWARFARE 2007/10/1 -------------------------------->>
		// 공성 종료 관련 수정...
		SetUIState( SWS_END ); // WSS_DRATAN_SEIGEWARFARE 2007/10/11 
		
		if( _pNetwork->MyCharacterInfo.sbJoinFlagDratan == WCJF_NONE )
			return;	
		// WSS_DRATAN_SIEGEWARFARE 2007/10/16
		//_pNetwork->MyCharacterInfo.sbJoinFlagDratan = WCJF_NONE;
		
		// Start My Guild, Enemy Guild Effect Start
		ACTORMGR()->SetJoinFlagMerac(WCJF_NONE);

		// -------------------------------------------------------------------<<

		// WSS_DRATAN_SIEGEWARFARE 0070725
		// TODO :: 드라탄 공성 종료 루틴
		((CPlayerEntity*)CEntity::GetPlayerEntity(0))->OpenGate( 3, TRUE );
		((CPlayerEntity*)CEntity::GetPlayerEntity(0))->OpenGate( 4, TRUE );
		((CPlayerEntity*)CEntity::GetPlayerEntity(0))->OpenGate( 5, TRUE );	
		((CPlayerEntity*)CEntity::GetPlayerEntity(0))->OpenGate( 6, TRUE );	
		((CPlayerEntity*)CEntity::GetPlayerEntity(0))->OpenGate( 7, TRUE );	

		pUIManager->GetSiegeWarfareNew()->SetWarState(FALSE);

		// WSS_DRATAN_SEIGEWARFARE 2007/08/14 -------------------------------->>
		// 390 ~ 399 공성 부활진지 초기화
		CTString tStr;
		for( i = 0; i < 10; i++)
		{	
			INDEX tNpcIdx = 390+i;
			_pNetwork->MyCharacterInfo.mQuarter[tNpcIdx] = -1;
			_pNetwork->MyCharacterInfo.mQuarterName[tNpcIdx] = CTString("");

			// Hard Cording ^^;; 어쩔수 없이....
			// 몹 이름 변경
			CMobData* MD = CMobData::getData(tNpcIdx);
			if(MD->GetMobIndex()>0)
			{
				tStr.PrintF(_S( 3685,"공성 부활진지%d"),tNpcIdx-389);
				MD->SetName(tStr);
			}		
		}	
		// -------------------------------------------------------------------<<

		if( pUIManager->GetSiegeWarfareNew()->IsEnabled()&&
			pUIManager->GetSiegeWarfareNew()->IsVisible() )
		{
			pUIManager->RearrangeOrder(UI_SIEGE_WARFARE_NEW,FALSE);
		}
		
		// WSS_DRATAN_SIEGEWARFARE 2007/10/17
		// 교감중 공성 종료 처리
		if( _pNetwork->MyCharacterInfo.bConsensus )
		{
			pUIManager->GetSiegeWarfareNew()->StopConsensus(_pNetwork->MyCharacterInfo.index);
		}			
		StopConsensusEffect(0,TRUE);
		
		// WSS_DRATAN_SIEGEWARFARE 2007/10/18
		// 상태 초기화
		((CPlayerEntity*)CEntity::GetPlayerEntity(0))->PlayerInit(false);

	}

	m_nZoneIndex = nZoneIndex;
	
	CTString strMessage1;
	CTString strMessage2;
	
	// 공성 끝났면 지도는 초기화 
	pUIManager->GetMap()->SetCurrentWorldMap( _pNetwork->MyCharacterInfo.zoneNo, 0 );
	pUIManager->GetMap()->ReSetData();

	if( nWinDefense )
	{
		if( strOwnerGuildName.Length() <= 0 )
		{
			strMessage1.PrintF( _S( 2019, "[%s]지역 [%s]공성에 실패 하였습니다." ), 
			CZoneInfo::getSingleton()->GetZoneName( nZoneIndex ), GetCastleName( nZoneIndex ) );	
		}
		else
		{
			strMessage1.PrintF( _S(2020 , "[%s]지역 [%s]공성이 종료되었습니다. [%s]길드가 수성에 성공하였습니다." ),
			CZoneInfo::getSingleton()->GetZoneName( nZoneIndex ), GetCastleName( nZoneIndex ), strOwnerGuildName );		
		}
		
	}
	else
	{
		strMessage1.PrintF( _S(2021 , "[%s]지역 [%s]공성이 종료되었습니다. 새로운 성주로 [%s]길드의 [%s]길드장이 선출 되었습니다." ), 
			CZoneInfo::getSingleton()->GetZoneName( nZoneIndex ), GetCastleName( nZoneIndex ), strOwnerGuildName, strOwnerName );	
	}
	
	strMessage2.PrintF(_S( 2022, "다음 공성전 신청은 %d월 %d일 %s요일 오후 %d시부터 신청이 가능합니다." ), 
		nNextMonth, nNextDay, pUIManager->GetWeekToString( nNextWeek ), nNextHour );	
	// [2012/06/04 : Sora] ITS 8986 공성시작전 공성시작 지점으로 이동 시 캐릭터 이동불가 상태 발생 수정
	// 공성 메시지 출력하면서 해당 UI를 활성화 시켜주어햐 한다. 공성 메시지 출력 방식 변경
	pUIManager->GetSiegeWarfare()->SetNotice( strMessage1, strMessage2 );
	
	// Date : 2005-11-18(오후 4:27:13), By Lee Ki-hwan
	// 메세지 박스 표시 추가 
	pUIManager->CloseMessageBox( MSGCMD_NULL );
	
	CUIMsgBox_Info	MsgBoxInfo;
	MsgBoxInfo.SetMsgBoxInfo( _S(2341, "공성 종료" ), UMBS_OK, UI_NONE, MSGCMD_NULL );
	MsgBoxInfo.AddString( strMessage1 );
	pUIManager->CreateMessageBox( MsgBoxInfo );
		
}
Esempio n. 24
0
PIX GetFixedTextWidth( const CTString &strText, CFontData *pfd)
{
  return strText.Length()*pfd->fd_pixCharWidth;
}