コード例 #1
0
ファイル: manips.c プロジェクト: barak/ivtools-cvs
boolean TextManip::HandleKey (Event& e) {
    World* world = GetViewer()->GetWorld();
    char c = e.keystring[0];
    boolean manipulating = true;

    switch (c) {
        case '\007':  world->RingBell(1); break;
        case '\001':  BeginningOfLine(); break;
        case '\005':  EndOfLine(); break;
        case '\006':  ForwardCharacter(1); break;
        case '\002':  BackwardCharacter(1); break;
        case '\016':  ForwardLine(1); break;
        case '\020':  BackwardLine(1); break;
        case '\013':  DeleteLine(); break;
        case '\004':  DeleteCharacter(1); break;
        case '\010':  DeleteCharacter(-1); break;
        case '\177':  DeleteCharacter(-1); break;
        case '\011':  InsertCharacter('\t'); break;
        case '\015':  if (_multiline) InsertCharacter('\n'); break;
        case '\033':  manipulating = false; break;
        default:
            if (!iscntrl(c & 0x7f)) {
                InsertCharacter(c);
            }
            break;
    }
    return manipulating;
}
コード例 #2
0
ファイル: DataServer.cpp プロジェクト: AkiraJue/OpenMuS9
void JGCharDelRequest(LPSDHP_CHARDELETE lpMsg,int aIndex)
{
	SDHP_CHARDELETERESULT pResult;

	char szAccountID[MAX_IDSTRING+1] = {0};
	char szName[MAX_IDSTRING+1] = {0};
	char szGuild[MAX_IDSTRING] = {0};

	pResult.h.c = PMHC_BYTE;
	pResult.h.size = sizeof( pResult );
	pResult.h.headcode = 0x05;

	memcpy(szAccountID,lpMsg->AccountID,MAX_IDSTRING);
	memcpy(szName,lpMsg->Name,MAX_IDSTRING);
	memcpy(szGuild,lpMsg->GuildName,sizeof(lpMsg->GuildName));

	memcpy(pResult.AccountID,szAccountID,MAX_IDSTRING);

	pResult.Number = lpMsg->Number;

	if(strlen(szAccountID) < 4 || strlen(szName) < 4)
		pResult.Result = 0;
	else
		pResult.Result = DeleteCharacter(szAccountID,szName,szGuild,lpMsg->Guild);

	DataSend(aIndex,(LPBYTE)&pResult,pResult.h.size);
}
コード例 #3
0
ファイル: cdogsed.c プロジェクト: kodephys/cdogs-sdl
static void Delete(int xc, int yc)
{
	Mission *mission = CampaignGetCurrentMission(&gCampaign);
	switch (yc)
	{
	case YC_CHARACTERS:
		DeleteCharacter(mission, xc);
		break;

	case YC_SPECIALS:
		DeleteSpecial(mission, xc);
		break;

	case YC_ITEMS:
		DeleteItem(mission, xc);
		break;

	default:
		if (yc >= YC_OBJECTIVES)
		{
			DeleteObjective(mission, yc - YC_OBJECTIVES);
		}
		else
		{
			DeleteMission(&gCampaign);
		}
		AdjustYC(&yc);
		break;
	}
	fileChanged = 1;
	Setup(0);
}
コード例 #4
0
void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
{
    CHECK_PACKET_SIZE(recv_data, 8);
    uint8 fail = CHAR_DELETE_SUCCESS;

    uint64 guid;
    recv_data >> guid;

    if(objmgr.GetPlayer((uint32)guid) != NULL)
        fail = CHAR_DELETE_FAILED; // "Char deletion failed"
    else
        fail = DeleteCharacter((uint32)guid);

    OutPacket(SMSG_CHAR_DELETE, 1, &fail);
    if(fail == CHAR_DELETE_SUCCESS)
        sLogonCommHandler.UpdateAccountCount(GetAccountId(), -1);
}
コード例 #5
0
ファイル: editor.c プロジェクト: AdventureKing/UTSASCHOOLWORK
static void ExecuteCommand(bufferADT buffer, string line)
{
    int i;

    switch (toupper(line[0])) {
      case 'I': for (i = 1; line[i] != '\0'; i++) {
                    InsertCharacter(buffer, line[i]);
                }
                break;
      case 'D': DeleteCharacter(buffer); break;
      case 'F': MoveCursorForward(buffer); break;
      case 'B': MoveCursorBackward(buffer); break;
      case 'J': MoveCursorToStart(buffer); break;
      case 'E': MoveCursorToEnd(buffer); break;
      case 'H': HelpCommand(); break;
      case 'Q': exit(0);
      default:  printf("Illegal command\n"); break;
    }
}
コード例 #6
0
ファイル: CharacterHandler.cpp プロジェクト: lev1976g/easywow
void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
{
    CHECK_PACKET_SIZE(recv_data, 8);
    uint8 fail = E_CHAR_DELETE_SUCCESS;

    uint64 guid;
    recv_data >> guid;

    if (objmgr.GetPlayer((uint32)guid) != NULL)
    {
        // "Char deletion failed"
        fail = E_CHAR_DELETE_FAILED;
    }
    else
    {
        fail = DeleteCharacter((uint32)guid);
    }
    OutPacket(SMSG_CHAR_DELETE, 1, &fail);
}
コード例 #7
0
ファイル: Fonts.cpp プロジェクト: YoungBot/Engine
void Fonts::UpdateTextInput(float deltaTime)
{
	deltaTime;
	PrintLogToFile();
	AddHelpText();
	ClearAllText();

	if (m_startType==false)
	{
		return;
	}
	if (s_theInputSystem->WasKeyJustDown(VK_ESCAPE))
	{
		s_text = "";
		m_log[m_log.size() - 1] = s_text;
		m_startType = false;
		m_doShowConsole = false;
		return;
	}
	if (s_theInputSystem->WasKeyJustDown(VK_UP))
	{
		if ((checkLineNum-1)>=0)
		{
			checkLineNum--;		
			
		}
		else
			checkLineNum = m_log.size()-1;
		if (m_log[checkLineNum][0]!='>')
		{
			s_text = ">" + m_log[checkLineNum];
		}
		
		m_log[m_log.size() - 1] = s_text;
	}
	if (s_theInputSystem->WasKeyJustDown(VK_LEFT))
	{
		if (curserPositionInString>0)
		{
			curserPositionInString--;
		}
	}
	if (s_theInputSystem->WasKeyJustDown(VK_RIGHT))
	{
		if (curserPositionInString < s_text.length()-1)
		{
			curserPositionInString++;
		}
	}
	if (s_theInputSystem->WasKeyJustDown(VK_DOWN))
	{
		if ((checkLineNum) < (int)m_log.size() - 1)
		{
			checkLineNum++;			
		}
		else
			checkLineNum = 0;
		if (m_log[checkLineNum][0] != '>')
		{
			s_text = ">" + m_log[checkLineNum];
		}
		m_log[m_log.size() - 1] = s_text;
	}
	if (s_theInputSystem->WasKeyJustDown(VK_BACK))
	{
		//if (s_text.length()>1)
		//{
		//	s_text = s_text.substr(0, s_text.length() - 1);
		//}
		//
		//m_log[m_log.size() - 1] = s_text;
		DeleteCharacter();
	}
	m_log[m_log.size() - 1] = s_text;
	if (s_theInputSystem->WasKeyJustDown(VK_RETURN))
	{
		if (s_text == ">")
		{
			s_text = "";
			m_startType = false;
			return;
		}
		else
		{
			m_log[m_log.size() - 1] = CutDoubleString(s_text,'>','\n');
			RunConsoleFromLine(m_log[m_log.size() - 1].c_str());
			m_log.push_back("");
			s_text = "";
			m_startType = false;
			checkLineNum = m_log.size()-1;
		}
		curserPositionInString = 0;
		return;
	}

	for (int i = 0; i < NUMBER_OF_VIRTUAL_KEYS; i++)
	{
		if (s_theInputSystem->WasKeyJustDown(i))
		{
			if (s_theInputSystem->IsKeyDown(VK_SHIFT))
			{
				if (i>=65 && i<=90)
				{
					//s_text += (char)i;
					//curserPositionInString++;
					InsertCharacter(i);
					return;
				}
				if (i == 57)
				{
					//s_text += 40;  //'('
					//curserPositionInString++;
					InsertCharacter(i);
					return;
				}
				if (i == 48)
				{
					//s_text += 41;  //')'
					//curserPositionInString++;
					InsertCharacter(i);
					return;
				}
			}
			if (i == 32)
			{
				InsertCharacter(i);
			}
			if (i >= 65 && i <= 90)
			{
				InsertCharacter(i+32);
				return;
			}
			if (i>=188 && i<=191)
			{
				InsertCharacter(i-144);
				return;
			}
			if (i == 186)
			{
				InsertCharacter(59);
				return;
			}
			if (i<=57 && i >=48)
			{
				InsertCharacter(i);
			}
			
		}
	}
}
コード例 #8
0
ファイル: charsed.c プロジェクト: devmabbott/cdogs-sdl
void EditCharacters(TCampaignSetting * setting)
{
	int done = 0;
	int c = 0;
	int index = 0;
	int xc = 0, yc = 0;
	TBadGuy scrap;
	int x, y, buttons, tag;

	memset(&scrap, 0, sizeof(scrap));
	SetMouseRects(localClicks);

	while (!done) {
		Display(setting, index, xc, yc);

		do {
			GetEvent(&c, &x, &y, &buttons);
			if (buttons) {
				if (XYToCharacterIndex(x, y, &tag)) {
					if (tag >= 0
					    && tag <
					    setting->characterCount)
						index = tag;
					c = DUMMY;
				} else if (GetMouseRectTag(x, y, &tag)) {
					xc = (tag >> 8);
					yc = (tag & 0xFF);
					AdjustYC(&yc);
					AdjustXC(yc, &xc);
					c = (buttons ==
					     1 ? PAGEUP : PAGEDOWN);
				}
			}
		}
		while (!c);

		switch (c) {
		case HOME:
			if (index > 0)
				index--;
			break;

		case END:
			if (index < setting->characterCount - 1)
				index++;
			break;

		case INSERT:
			InsertCharacter(setting, index, NULL);
			fileChanged = 1;
			break;

		case ALT_X:
			scrap = setting->characters[index];

		case DELETE:
			DeleteCharacter(setting, &index);
			fileChanged = 1;
			break;

		case ALT_C:
			scrap = setting->characters[index];
			break;

		case ALT_V:
			InsertCharacter(setting, index, &scrap);
			fileChanged = 1;
			break;

		case ALT_N:
			InsertCharacter(setting, setting->characterCount,
					NULL);
			index = setting->characterCount - 1;
			fileChanged = 1;
			break;

		case ARROW_UP:
			yc--;
			AdjustYC(&yc);
			AdjustXC(yc, &xc);
			break;

		case ARROW_DOWN:
			yc++;
			AdjustYC(&yc);
			AdjustXC(yc, &xc);
			break;

		case ARROW_LEFT:
			xc--;
			AdjustXC(yc, &xc);
			break;

		case ARROW_RIGHT:
			xc++;
			AdjustXC(yc, &xc);
			break;

		case PAGEUP:
			Change(setting, index, yc, xc, 1);
			fileChanged = 1;
			break;

		case PAGEDOWN:
			Change(setting, index, yc, xc, -1);
			fileChanged = 1;
			break;

		case ESCAPE:
			done = 1;
			break;
		}
	}
}