EmberThread.cpp

EmberMUD-0.9.43/src/BCB4/EmberThread.cpp · 1.5 KB

From the archive EmberMUD-0.9.43.tar.gz

Download the archive   « Back to the archive contents

//---------------------------------------------------------------------------

#include <vcl\vcl.h>

#pragma hdrstop



#define CPP 1



#include <time.h>

#include "EmberForm.h"

#include "merc.h"

#include "EmberThread.h"



extern "C" int 		embermain	( int argc, char **argv );



//---------------------------------------------------------------------------

//   Important: Methods and properties of objects in VCL can only be

//   used in a method called using Synchronize, for example:

//

//      Synchronize(UpdateCaption);

//

//   where UpdateCaption could look like:

//

//      void __fastcall Ember::UpdateCaption()

//      {

//        Form1->Caption = "Updated in a thread";

//      }

//---------------------------------------------------------------------------



extern bool MudDown;

extern char tbuff[MAX_STRING_LENGTH];



__fastcall Ember::Ember(bool CreateSuspended)

	: TThread(CreateSuspended)

{

	FreeOnTerminate=false;

}

//---------------------------------------------------------------------------

void __fastcall Ember::Execute()

{

	char *argv[2];



	MudDown=false;

    StatusUp();

    argv[0]="embergui.exe";

    argv[1]=Port.c_str();

	embermain( 2, argv );

    MudDown=true;

    StatusDown();

}

//---------------------------------------------------------------------------

void __fastcall Ember::AddMessage()

{

	Form1->Channels->Lines->Add(tbuff);

}

//---------------------------------------------------------------------------



Site Stats

Snippets: 1791
Codebases: 571