Пример #1
0
GameManager::GameManager()
	: Frame( gui, "GameManager", rect(0,0,gui->Width(),gui->Height()) )
{
	mMap = NULL;
	mPlayer = NULL;
	mNet = NULL;
	mLoader = NULL;
	//mParty = NULL;

	game = this;

	buildDirectoryTree(DIR_PROFILE);

	UpdateAppTitle();

	logger.Write("Loading user settings");
	LoadUserData();

	mMap = NULL;
	mShowJoinParts = sti(mUserData.GetValue("MapSettings", "JoinParts"));
	mShowAddresses = sti(mUserData.GetValue("MapSettings", "ShowAddresses"));

	logger.Write("Starting IrcNet");
	mNet = new IrcNet();
	mNet->mRealname = "guest";

	hookNetListeners();

	logger.Write("Loading LocalActor");
	mPlayer = new LocalActor();
	mPlayer->SetName(mUserData.GetValue("MapSettings", "Nick"));
	if (mPlayer->GetName().empty())
		mPlayer->SetName("fro_user");

	timers->AddProcess("gameproc",
						timer_gameManagerProcess,
						NULL,
						this);

	logger.Write("Initializing Login");

	new LoginDialog();

	ToggleGameMode(MODE_ACTION);

	//Backpack* pack = new Backpack();

	console->HookCommand("net_info", callback_consoleNetInfo);
	console->HookCommand("avatarout", callback_consoleOutputAvatar);
	console->HookCommand("test", callback_consoleTestMap);
	console->HookCommand("screendraw", callback_consoleScreenDraw);
	console->HookCommand("drawrects", callback_consoleDrawRects);
	console->HookCommand("debugmap", callback_consoleMapDebug);
	console->HookCommand("makecol", callback_consoleMakeCol);
	console->HookCommand("player_flags", callback_consolePlayerFlags);
}
Пример #2
0
//---------------------------------------------------------------------------
void __fastcall TTerminalManager::DoSetActiveTerminal(TTerminal * value, bool AutoReconnect)
{
  if (ActiveTerminal != value)
  {
    // here used to be call to TCustomScpExporer::UpdateSessionData (now UpdateTerminal)
    // but it seems to be duplicate to call from TCustomScpExporer::TerminalChanging

    TTerminal * PActiveTerminal = ActiveTerminal;
    FActiveTerminal = value;
    // moved from else block of next if (ActiveTerminal) statement
    // so ScpExplorer can update its caption
    UpdateAppTitle();
    if (ScpExplorer)
    {
      if (ActiveTerminal && (ActiveTerminal->Status == ssOpened))
      {
        TerminalReady();
      }
      else
      {
        ScpExplorer->Terminal = NULL;
        ScpExplorer->Queue = NULL;
      }
    }

    if (PActiveTerminal && !PActiveTerminal->Active)
    {
      SaveTerminal(PActiveTerminal);
    }

    if (ActiveTerminal)
    {
      if (!PActiveTerminal)
      {
        CreateLogMemo();
      }
      assert(LogMemo);
      LogMemo->SessionLog = ActiveTerminal->Log;

      int Index = ActiveTerminalIndex;
      if (!ActiveTerminal->Active && !FTerminationMessages->Strings[Index].IsEmpty())
      {
        UnicodeString Message = FTerminationMessages->Strings[Index];
        FTerminationMessages->Strings[Index] = L"";
        if (AutoReconnect)
        {
          ReconnectActiveTerminal();
        }
        else
        {
          Exception * E = new ESshFatal(NULL, Message);
          try
          {
            // finally show pending terminal message,
            // this gives user also possibility to reconnect
            ActiveTerminal->ShowExtendedException(E);
          }
          __finally
          {
            delete E;
          }
        }
      }
    }