Exemplo n.º 1
0
	void KilledUnit(Unit* who)
	{
		if(urand(0,1))
			Say(16987,"Oh c'est cassé !");
		else
			Say(16988,"Papa va faire des nouveaux jouets avec toi !");
	}
Exemplo n.º 2
0
	void KilledUnit(Unit* who)
	{
		if(urand(0,1))
			Say(15529,"Pardonnez moi.");
		else
			Say(15530,"De votre mort renaîtra la vie !");
	}
Exemplo n.º 3
0
/**
 * \brief Execute a module with arguments.
 * \see __super::GetCommandCount
 * \param self the object
 * \param args the given arguments
 * \return PyObject* the result of the opreation
 */
PyObject* PyApi::Execute(PyObject *self, PyObject *args) const
{
  try
  {
    char* module = nullptr;
    char* cmdLine = nullptr;
    const auto isPrivileged = 0;
    if (!PyArg_ParseTuple(args, "s|sp", &module, &cmdLine, &isPrivileged))
    {
      Say(L"<b>Error : </b> Missing Module and/or command line.<br>Format is <i>am.execute( module [, commandLine[,isPrivileged=False]])</i>");
      return Fail();
    }

    // run it
    const auto result = __super::Execute(HelperApi::Widen(module).c_str(), HelperApi::Widen(cmdLine).c_str(), (isPrivileged == 1), nullptr);

    // tell the user it did not work
    if (!result)
    {
      Say(L"<b>Error : </b> There was an error executing the request, please check the parameters.");
      return Fail();
    }

    // return the result.
    return Py_BuildValue("b", result);
  }
  catch( ... )
  {
    return Fail();
  }
}
Exemplo n.º 4
0
U32 tcPersonWanted(U32 persId)
{
    U32 hours, i = 0, caught = 0;
    Person john = dbGetObject(Person_John_Gludo);
    Person miles = dbGetObject(Person_Miles_Chickenwing);
    LIST *bubble;
    LIST *jobs = txtGoKey(OBJECTS_ENUM_TXT, "enum_JobE");
    char line[TXT_KEY_LENGTH], name[TXT_KEY_LENGTH];

    dbGetObjectName(persId, name);

    bubble = txtGoKey(BUSINESS_TXT, "BURGLAR_RECOG");

    sprintf(line, "%s %s.", NODE_NAME(GetNthNode(bubble, 3)), name);

    RemoveNode(bubble, NODE_NAME(GetNthNode(bubble, 3)));
    CreateNode(bubble, 0L, line);

    SetPictID(john->PictID);
    Bubble(bubble, 0, 0L, 0L);
    RemoveList(bubble);

    Say(BUSINESS_TXT, 0, miles->PictID, "ARREST_HIM");
    livesInUnSet(London_London_1, persId);
    tcMoveAPerson(persId, Location_Nirvana);

    hours = CalcRandomNr(4L, 7L);

    while ((i++) < hours) {
	AddVTime(60);
	inpDelay(35);
	ShowTime(2);
    }

    if (tcGuyCanEscape(dbGetObject(persId)) > CalcRandomNr(100, 255)) {	/* Flucht gelingt */
	Say(BUSINESS_TXT, 0, john->PictID, "ESCAPED");

	livesInSet(London_Escape, persId);
    } else {			/* nicht */

	Say(BUSINESS_TXT, 0, john->PictID, "ARRESTED");

	livesInSet(London_Jail, persId);

	caught = tcPersonQuestioning(dbGetObject(persId));
    }

    RemoveList(jobs);

    return caught;
}
Exemplo n.º 5
0
extern  void    W2Modify( a_window *wnd, int row, int piece )
{
    w2_struct   *w2 = WndExtra( wnd );

    piece=piece;
    if( row == 0 ) {
        Say( "Modify title" );
    } else if( row == 1 ) {
        Say( "Shouldn't get this event" );
    } else {
        row += w2->top - TITLE_SIZE;
        Say2( "Modify", w2->words[row] );
    }
}
Exemplo n.º 6
0
BOOL ExecuteEnchantQueue(LPENCHANTINFO EnchInfo)
{
    if (!GameReady() || !EnchInfo)
        return FALSE;

    UnitAny* pPlayer = D2CLIENT_GetPlayerUnit();
    if (EnchInfo->dwPlayerId == pPlayer->dwUnitId)
        return FALSE;

    
    if (EnchInfo->nEnchantType == ENCHANT_ME)
    {
        for(Room1* pRoom1 = pPlayer->pAct->pRoom1; pRoom1; pRoom1 = pRoom1->pRoomNext)
            for (UnitAny* pUnit = pRoom1->pFirstUnit; pUnit; pUnit = pUnit->pListNext)
                if (pUnit->dwType == UNIT_PLAYER && pUnit->dwUnitId == EnchInfo->dwPlayerId)
                {
                    CastOnUnit(D2S_ENCHANT, pUnit, FALSE);
                    return TRUE;
                }
        
        if (!bSilentBots)
            Say("You're out of range!");

        return FALSE;
    }

    if(EnchInfo->nEnchantType == ENCHANT_MERC)
    {
        for (Room1* pRoom1 = pPlayer->pAct->pRoom1; pRoom1; pRoom1 = pRoom1->pRoomNext)
            for (UnitAny* pUnit = pRoom1->pFirstUnit; pUnit; pUnit = pUnit->pListNext)
                if (pUnit->dwType == UNIT_NPC && IsMercClassId(pUnit->dwTxtFileNo))
                {
                    DWORD dwOwner = D2CLIENT_GetMonsterOwner(pUnit->dwUnitId);
                    if (dwOwner == EnchInfo->dwPlayerId)
                    {
                        CastOnUnit(D2S_ENCHANT, pUnit, FALSE);
                        return TRUE;
                    }
                }

        if (!bSilentBots)
            Say("Couldn't find your mercenary!");

        return FALSE;
    }

    return FALSE;
}
Exemplo n.º 7
0
static VOID APIENTRY ServiceRequests( VOID )
{
    USHORT              len;
    pmhelp_packet       data;

    WinCreateMsgQueue( Hab, 0 );
    for( ;; ) {
        if( DosRead( InStream, &data, sizeof( data ), &len ) != 0 ) break;
        if( len != sizeof( data ) ) break;
        switch( data.command ) {
        case PMHELP_LOCK:
            PidDebugee = data.pid;
            TidDebugee = data.tid;
            LockIt();
            break;
        case PMHELP_UNLOCK:
            PidDebugee = data.pid;
            TidDebugee = data.tid;
            UnLockIt();
            break;
        case PMHELP_EXIT:
            WinPostMsg( hwndClient, WM_QUIT, 0, 0 );/* Cause termination*/
            break;
        }
        WinInvalidateRegion( hwndClient, 0L, FALSE );
    }
    Say( "Read Failed" );
}
Exemplo n.º 8
0
//------------------------------------------------------------------------------
int vl::glcheck(const char* file, int line)
{
  unsigned int glerr = glGetError();
  // if an OpenGL context is available this must be clear!
  if ( glGetError() )
  {
    Log::bug( Say("%s:%n: NO OPENGL CONTEXT ACTIVE!\n") << file << line );
  }
  else
  if (glerr != GL_NO_ERROR)
  {
    String msg( (char*)getGLErrorString(glerr) );
    Log::bug( Say("glGetError() [%s:%n]: %s\n") << file << line << msg );
  }
  return glerr;
}
Exemplo n.º 9
0
void tcSellCar(U32 ObjectID)
{
    LIST *bubble;
    U32 offer;
    Car car;
    Person marc = (Person) dbGetObject(Person_Marc_Smith);

    car = (Car) dbGetObject(ObjectID);
    offer = tcGetCarTraderOffer(car);

    if (tcRGetCarAge(car) < 1)
	bubble =
	    txtGoKeyAndInsert(BUSINESS_TXT, "ANGEBOT_1", tcRGetCarValue(car),
			      offer, NULL);
    else
	bubble =
	    txtGoKeyAndInsert(BUSINESS_TXT, "ANGEBOT", tcRGetCarValue(car),
			      tcRGetCarAge(car), offer, NULL);

    SetPictID(marc->PictID);
    Bubble(bubble, 0, 0L, 0L);
    RemoveList(bubble);

    if ((Say(BUSINESS_TXT, 0, MATT_PICTID, "VERKAUF")) == 0) {
	tcAddPlayerMoney(offer);

	hasSet(Person_Marc_Smith, ObjectID);
	hasUnSet(Person_Matt_Stuvysunt, ObjectID);
    }

    gfxShow(27, GFX_NO_REFRESH | GFX_ONE_STEP, 0L, -1L, -1L);
    AddVTime(97);
}
Exemplo n.º 10
0
/**
 * \brief say a message
 * \see __super::say
 * \param self the object
 * \param args the given arguments
 * \return PyObject* the result of the opreation
 */
PyObject* PyApi::Say(PyObject *self, PyObject *args) const
{
  try
  {
    char* msg;
    auto slen = 0;
    auto nElapse = 0;
    auto nFadeOut = 0;

    // the last argument is optional
    if (!PyArg_ParseTuple(args, "s#i|i", &msg, &slen, &nElapse, &nFadeOut))
    {
      Say( L"<b>Error : </b> Missing or more values or invalid format.<br><i>am.say( msg, elapse [, fade=0])</i>");

      //  just return false.
      return Fail();
    }

    // display the message
    // and we can now display the message.
    const auto result = __super::Say(HelperApi::Widen(msg).c_str(), nElapse, nFadeOut);

    // return true.
    return Py_BuildValue("b", result);
  }
  catch(...)
  {
    return Fail();
  }
}
Exemplo n.º 11
0
/**
 * \brief Get the URL
 * \see __super::GetUrl
 * \param self the object
 * \param args the given arguments
 * \return PyObject* the result of the opreation
 */
PyObject* PyApi::GetUrl(PyObject *self, PyObject *args) const
{
  try
  {
    unsigned idx = 0;
    auto iQuote = 1;
    if (!PyArg_ParseTuple(args, "I|p", &idx, &iQuote))
    {
      Say(L"<b>Error : </b> Missing index number.<br>Format is <i>am.geturl( index [,quote=True] )</i>");
      return Fail();
    }

    MYODD_STRING sValue;
    if (!__super::GetUrl(idx, sValue, (iQuote == 1)))
    {
      // return false, nothing was found.
      return Py_BuildValue("b", false);
    }

    USES_CONVERSION;
    // we have a string
    return Py_BuildValue("s", T_T2A(sValue.c_str()));
  }
  catch( ... )
  {
    return Fail();
  }
}
Exemplo n.º 12
0
/**
 * \brief Find an acton... by index/
 * \see __super::Remove an action
 * \param self the object
 * \param args the given arguments
 * \return PyObject* the result of the opreation
 */
PyObject* PyApi::FindAction(PyObject *self, PyObject *args) const
{
  try
  {
    unsigned idx = 0;
    char* szText = nullptr;
    if (!PyArg_ParseTuple(args, "Is", &idx, &szText))
    {
      Say(L"<b>Error : </b> Missing index number.<br>Format is <i>am.findAction( <b>index</b>, <b>string</b> )</i>");
      return Fail();
    }

    const auto action = HelperApi::FindAction(idx, HelperApi::Widen(szText));
    if (action == nullptr )
    {
      // we have nothing
      return Py_BuildValue("b", false);
    }

    USES_CONVERSION;
    // we have a string
    return Py_BuildValue("s", T_T2A(action->File().c_str()));
  }
  catch( ... )
  {
    return Fail();
  }
}
Exemplo n.º 13
0
    void JustDied(Unit *victim)
    {
        if (pInstance)
            SetInstanceData(TYPE_FREYA, DONE);
		Say(15531,"Son emprise sur moi se dissipe. J'y vois de nouveau clair. Merci, héros");
		uint8 TreeAlive = 0;
		if(Creature* IronBranch = GetInstanceCreature(DATA_FREYA_ANCIENT_1))
			if(IronBranch->isAlive())
				TreeAlive++;
		if(Creature* BrightLeaf = GetInstanceCreature(DATA_FREYA_ANCIENT_2))
			if(BrightLeaf->isAlive())
				TreeAlive++;
		if(Creature* StoneBark = GetInstanceCreature(DATA_FREYA_ANCIENT_3))
			if(StoneBark->isAlive())
				TreeAlive++;

		switch(TreeAlive)
		{
			case 1:
				pInstance->CompleteAchievementForGroup(m_difficulty ? 3185 : 3177);
				break;
			case 2:
				pInstance->CompleteAchievementForGroup(m_difficulty ? 3186 : 3178);
				break;
			case 3:
				pInstance->CompleteAchievementForGroup(m_difficulty ? 3187 : 3179);
				break;
			default:
				break;
		}
		
		GiveEmblemsToGroup((m_difficulty) ? CONQUETE : VAILLANCE);
    }
Exemplo n.º 14
0
void Agent::SetRecvdMsg(std::string strmsg){
		
		std::cout<<"The agent "<< GetSelfUnum() <<" recvd msg - "<<strmsg<<std::endl;
		unsigned pos = strmsg.find("X");
		unsigned Ppos = strmsg.find("p");
		unsigned len = pos - Ppos-1;
		std::string sub0 = strmsg.substr(Ppos+1,len);
		int passer = atoi(sub0.c_str());
		//std::cout<<"X is at "<<pos<<std::endl;
		std::string sub = strmsg.substr(pos+1);
		int value = atoi(sub.c_str());
		int passerX = GetWorldState().GetTeammate(passer).GetPos().X();
		int passeeX = GetWorldState().GetTeammate(value).GetPos().X();
		if(passeeX<=passerX){
			SetCenter(passer);
			std::cout<<"backpass detected"<<std::endl;
		}
		else{
			SetCenter(-1);
			SetResetVal(true);
		}
		SetTargetUnum(value);
		std::cout<<"Target player is "<<value<<std::endl;
		if(value==GetSelfUnum()){
			std::cout<<"Player "<<GetSelfUnum()<<" setting follow ball"<<std::endl;
			SetFollowBall(true);
		}
		else
			SetFollowBall(false);
		if(strmsg.substr(0,3).compare("cus")==0){
			std::string resend = "r"+strmsg;
			while(!Say(resend));
		}
	}
Exemplo n.º 15
0
void RQuit(string msg)
{
	Say(msg);

	// Let player explode

	Quit();
}
Exemplo n.º 16
0
static void GetPassword( void )
{
    char        buff[80];

    buff[0] = '\0';
    Password( "What ees da passwurd?", buff, 80 );
    Say( buff );
}
Exemplo n.º 17
0
void NPrint( int num, char *cp )
{
	char c;

	c = cp[num];
	cp[num] = 0;
	Say( cp );
	cp[num] = c;
}
Exemplo n.º 18
0
extern  void    W4Modify( a_window *wnd, int row, int piece )
{
    wnd=wnd;piece=piece;
    if( row < 0 ) {
        Say( "Shouldn't get this event" );
    } else {
        Say2( "Modify", Stuff[ row ] );
    }
}
Exemplo n.º 19
0
void tcColorCar(Car car)
{
    LIST *colors, *bubble;
    ubyte choice;
    U32 costs;
    Person marc = (Person) dbGetObject(Person_Marc_Smith);

    costs = (U32)tcColorCosts(car);

    bubble = txtGoKeyAndInsert(BUSINESS_TXT, "LACKIEREN", (U32) costs, NULL);

    SetPictID(marc->PictID);
    Bubble(bubble, 0, 0L, 0L);
    RemoveList(bubble);

    if (Say(BUSINESS_TXT, 0, MATT_PICTID, "LACKIEREN_ANT") == 0) {
	colors = txtGoKey(OBJECTS_ENUM_TXT, "enum_ColorE");

	txtPutCharacter(colors, 0, '*');

	if (tcSpendMoney(costs, 1)) {
	    char exp[TXT_KEY_LENGTH];

	    txtGetFirstLine(BUSINESS_TXT, "NO_CHOICE", exp);
	    ExpandObjectList(colors, exp);

	    if (ChoiceOk
		(choice =
		 Bubble(colors, (ubyte) car->ColorIndex, 0L, 0L), GET_OUT,
		 colors)) {
		car->ColorIndex = (ubyte) choice;

		SetCarColors(car->ColorIndex);
		gfxPrepareRefresh();
		PlayAnim("Umlackieren", 3000, GFX_DONT_SHOW_FIRST_PIC);

		inpSetWaitTicks(200L);

		inpWaitFor(INP_LBUTTONP | INP_TIME);

		StopAnim();
		inpSetWaitTicks(1L);

		gfxRefresh();
		/*gfxShow(26,GFX_NO_REFRESH|GFX_ONE_STEP,0L,-1L,-1L);*/
		/*gfxShow((uword)car->PictID,GFX_NO_REFRESH|GFX_OVERLAY,1L,-1L,-1L);*/
	    }
	}

	RemoveList(colors);
    }

    AddVTime(137);
}
Exemplo n.º 20
0
void lsShowRaster(U32 areaID, ubyte perc)
{
    LSArea area = dbGetObject(areaID);
    struct ObjectNode *node;
    S32 count, i;
    LIST *objects;

    gfxShow(154, GFX_NO_REFRESH | GFX_ONE_STEP, 0, -1, -1);

    SetObjectListAttr(OLF_PRIVATE_LIST, Object_LSObject);
    AskAll(area, ConsistOfRelationID, BuildObjectList);
    objects = ObjectListPrivate;

    /*lsSortObjectList(&objects);*/

    if (!(LIST_EMPTY(objects))) {
	count = (GetNrOfNodes(objects) * perc) / 255;

	for (node = (struct ObjectNode *) LIST_HEAD(objects), i = 0;
	     (NODE_SUCC((NODE *) node)) && (i < count);
	     node = (struct ObjectNode *) NODE_SUCC((NODE *) node), i++) {
	    LSObject lso = OL_DATA(node);

	    switch (lso->Type) {
	    case Item_Mauer:
	    case Item_Mauerecke:
	    case Item_Steinmauer:
		lsFadeRasterObject(areaID, lso, 1);
		break;
	    default:
		break;
	    }
	}

	for (node = (struct ObjectNode *) LIST_HEAD(objects), i = 0;
	     (NODE_SUCC((NODE *) node)) && (i < count);
	     node = (struct ObjectNode *) NODE_SUCC((NODE *) node), i++) {
	    LSObject lso = OL_DATA(node);

	    switch (lso->Type) {
	    case Item_Mauer:
	    case Item_Mauerecke:
	    case Item_Steinmauer:
		break;
	    default:
		lsFadeRasterObject(areaID, lso, 1);
		break;
	    }
	}
    } else
	Say(THECLOU_TXT, 0, MATT_PICTID, "KEIN_GRUNDRISS");

    RemoveList(objects);
}
void NPrintF( int num, char *fmt, ... )
{
	char s[240];
	va_list ap;

	va_start( ap, format );
	vsprintf( s, fmt, ap );
	va_end( ap );
	s[num] = 0;
	Say( s );
}
Exemplo n.º 22
0
U32 tcPersonQuestioning(Person person)
{
    U32 caught = 0;
    Person john = dbGetObject(Person_John_Gludo);
    Person miles = dbGetObject(Person_Miles_Chickenwing);

    if (person != dbGetObject(Person_Matt_Stuvysunt)) {
	if (tcGuyTellsAll(person) > CalcRandomNr(0, 180)) {	/* er spricht */
	    Say(BUSINESS_TXT, 0, john->PictID, "ER_GESTEHT");
	    Say(BUSINESS_TXT, 0, miles->PictID, "GUTE_ARBEIT");
	    caught = 1;
	} else			/* er spricht nicht */
	    Say(BUSINESS_TXT, 0, john->PictID, "ER_GESTEHT_NICHT");
    } else {
	Say(BUSINESS_TXT, 0, john->PictID, "ER_GESTEHT_NICHT");
	caught = 1;
    }

    return caught;
}
Exemplo n.º 23
0
void *key_thread( void *arg ) {
	struct termios t;

	tcgetattr(STDIN_FILENO, &t); //get the current terminal I/O structure
	t.c_lflag &= ~ICANON; //Manipulate the flag bits to do what you want it to do
	tcsetattr(STDIN_FILENO, TCSANOW, &t); //Apply the new settings

	char key = ' ';
	while( !exit_bot ) {
		key = getchar();
		switch( key ) {
			case 49: // '1'
				finished_quest = true;
				missing_quest  = true;
				printf( "[%s] Restarting loop as requested\n", currentDateTime().c_str());
				break;
			case 50: // '2'
				printf( "[%s] X/Y: %i,%i - HP: %i - Current Quest: %i - Kills/Req: %i of %i\n", currentDateTime().c_str(), player_x, player_y, player_health, lastQL.curquest, lastQL.curkills, lastQL.reqkills );
				break;
			case 51: // '3'
				requestLog( player_id );
				break;
			case 52: // '4'
				printf( "[%s] Dumping Unit Map to File\n", currentDateTime().c_str());
				dumpUnitMap();
				break;
			case 53: // '5'
				printf( "[%s] Sending logout\n", currentDateTime().c_str());
				finished_quest = true;
				missing_quest  = true;
				logout( player_id );
				break;
			case 54: // '6'
				ping_success = false;
				doLogin();
				break;
			case 55: // '7'
				have_quest = false;
				finished_quest = true;
				missing_quest  = true;
				Say( player_id, (char*)"-quitquest", 10 );
				printf( "[%s] Forcing player to abandon quest and start over\n", currentDateTime().c_str());
				break;
			case 48:
				printf( "[%s] Logging off and exiting\n", currentDateTime().c_str());
				finished_quest = true;
				missing_quest  = true;
				logout( player_id );
				SLEEP( 200 );
				exit_bot = true;
				break;
		}
	}
}
Exemplo n.º 24
0
void ChatPanel::OnSay(wxCommandEvent& /*unused*/)
{
	if (Say(m_say_text->GetValue()))
		m_say_text->SetValue(wxEmptyString);
	/*
	Say("\x02Test\x02Test");
	Say("\x02\x02Test\x02Test");
	Say("Test\x02Test");
	Say("TestTes\x02t");
	Say("TestTest\x02");
*/
}
Exemplo n.º 25
0
void tcCarInGarage(U32 carID)
{
    ubyte choice1 = 0;
    Car matts_car;
    Person marc = (Person) dbGetObject(Person_Marc_Smith);

    matts_car = (Car) dbGetObject(carID);

    while (choice1 != 5) {
	ShowMenuBackground();

	switch (choice1 = Say(BUSINESS_TXT, choice1, 7, "GARAGE")) {
	case 0:
	    /* Analyse des Wagens */
	    tcCarGeneralOverhoul(matts_car);
	    break;
	case 1:
	    /* Karosserie */
	    tcRepairCar(matts_car, "BodyRepair");
	    break;
	case 2:
	    /* Reifen */
	    tcRepairCar(matts_car, "TyreRepair");
	    break;
	case 3:
	    /* Motor  */
	    tcRepairCar(matts_car, "MotorRepair");
	    break;
	case 4:
	    if (carID != Car_Jaguar_XK_1950)
		tcColorCar(matts_car);
	    else
		Say(BUSINESS_TXT, 0, marc->PictID, "JAGUAR_COLOR");
	    break;
	default:
	    break;
	}
    }
}
Exemplo n.º 26
0
int main( int argc, char* argv[] )
{
	strcpy( AppFileName, (char*)argv[0] );

	BeAIMApplication myApplication;
	if( myApplication.InitCheck() != B_OK ) {
		Say( "Error initializing BeAIM. Exiting." );
		return 1;
	}

	myApplication.Run();

	return 0;
}
Exemplo n.º 27
0
static ubyte tcCarFound(Car car, U32 time)
{
    S32 i = 0, hours;
    Person john = dbGetObject(Person_John_Gludo);
    Person miles = dbGetObject(Person_Miles_Chickenwing);
    ubyte found = 0;

    /* Der Jaguar darf nicht gefunden werden - sonst k�nnte er ja */
    /* nicht explodieren! */

    if (car != dbGetObject(Car_Jaguar_XK_1950)) {
	if (tcIsCarRecognised(car, time)) {	/* Wagen wird erkannt! */
	    Say(BUSINESS_TXT, 0, john->PictID, "CAR_RECOG");

	    hours = CalcRandomNr(2L, 5L);

	    while ((i++) < hours) {
		AddVTime(60);
		inpDelay(35);
		ShowTime(2);
	    }

	    if (!tcIsCarRecognised(car, time)) {	/* Wagen wird nicht gefunden */
		Say(BUSINESS_TXT, 0, john->PictID, "CAR_NOT_FOUND");
		car->Strike = CalcRandomNr(200, 255);
	    } else {		/* Wagen wird gefunden! */

		found = 1;
		Say(BUSINESS_TXT, 0, john->PictID, "CAR_FOUND");
		Say(BUSINESS_TXT, 0, miles->PictID, "GUTE_ARBEIT");
		UnSet(dbGetObject(Person_Matt_Stuvysunt), Relation_has, car);
	    }
	}
    }

    return found;
}
Exemplo n.º 28
0
S32 tcEscapeFromBuilding(U32 escBits)
{
    Person gludo = dbGetObject(Person_John_Gludo);
    ubyte escapeSucc = FAHN_NOT_ESCAPED;
    S32 timeLeft = INT32_MAX;

    /* Fluchtbilder zeigen! */
    livSetAllInvisible();
    lsSetDarkness(((LSArea) dbGetObject(lsGetActivAreaID()))->uch_Darkness);

    if (escBits & FAHN_ESCAPE) {
	gfxShow(213, GFX_NO_REFRESH | GFX_ONE_STEP, 0, -1, -1);
	inpDelay(80);

	gfxShow(215, GFX_NO_REFRESH | GFX_ONE_STEP, 0, -1, -1);
	inpDelay(80);
    }

    /*
     * Behandlung von "Umstellt"
     * sowie Berechnung eines Fluchtversuches (in jedem Flucht - fall)
     */

    if (!(escBits & FAHN_SURROUNDED)) {
	if ((escBits & FAHN_ALARM) || (escBits & FAHN_QUIET_ALARM)) {
	    Building build = dbGetObject(Search.BuildingId);

	    timeLeft =
		build->PoliceTime - (Search.TimeOfBurglary -
				     Search.TimeOfAlarm);
	    timeLeft -= tcCalcEscapeTime();

	    if (timeLeft > 0)
		escapeSucc = FAHN_ESCAPED;
	} else
	    escapeSucc = FAHN_ESCAPED;
    }

    if (escapeSucc == FAHN_ESCAPED) {
	gfxShow(211, GFX_NO_REFRESH | GFX_ONE_STEP, 0, -1, -1);
	inpDelay(120);
    } else {
	Say(BUSINESS_TXT, 0, gludo->PictID, "UMSTELLT");	/* noch ein Umstellt */
	timeLeft = 0;		/* wenn Zeit nicht gereicht hat */
    }

    return timeLeft;
}
 void declareID(VLXStructure* obj)
 {
   if (obj->uid() != "#NULL")
   {
     const std::map< std::string, ref<VLXStructure> >::const_iterator it = mLinkMap->find(obj->uid());
     if (it == mLinkMap->end())
       (*mLinkMap)[obj->uid()] = obj;
     else
     {
       if ( it->second != obj )
       {
         mError = DuplicateID;
         Log::error( Say("ID '%s' used by '%s' is already assigned to another node '%s'!\n") << obj->uid() << obj->tag() << it->second->tag() );
       }
     }
   }
 }
Exemplo n.º 30
0
void main( int argc, char *argv[] )
{
    SECURITY_ATTRIBUTES attr;

    argc=argc;argv=argv;
#if 0
    if( argc > 1 && (argv[1][0] == 'q' || argv[1][0] == 'Q') ) {
        h = CreateFile( PREFIX DEFAULT_NAME, GENERIC_WRITE, 0,
                NULL, OPEN_EXISTING, 0, NULL );
        if( h != INVALID_HANDLE_VALUE ) {
            done = LNK_SHUTDOWN;
            WriteFile( h, &done, sizeof( done ), &sent, NULL );
            CloseHandle( h );
        }
        exit( 0 );
    }
#endif
    SemReadUp = CreateSemaphore( NULL, 0, 1, READUP_NAME );
    SemReadDone = CreateSemaphore( NULL, 0, 1, READDONE_NAME );
    SemWritten = CreateSemaphore( NULL, 0, 1, WRITTEN_NAME );
    MemHdl = CreateFileMapping( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 1024, SHARED_MEM_NAME  );
    SharedMem = MapViewOfFile( MemHdl, FILE_MAP_WRITE, 0, 0, 0 );
    CmdProc = getenv( "ComSpec" );
    if( CmdProc == NULL ) {
        fprintf( stderr, "Unable to find command processor\n" );
        exit( 1 );
    }
    SetConsoleCtrlHandler( NULL, FALSE );
    SetConsoleCtrlHandler( Ignore, TRUE );
    //NYI: need to accept name for link pipe
    attr.nLength = sizeof( attr );
    attr.lpSecurityDescriptor = NULL;
    attr.bInheritHandle = TRUE;
    NulHdl = CreateFile( "NUL", GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, &attr, OPEN_EXISTING, 0, NULL );
    if( NulHdl == INVALID_HANDLE_VALUE ) {
        fprintf( stderr, "Unable to open NUL device\n" );
        exit( 1 );
    }
    EnumWindows( HideWindows , 0 );

    Say(( "LNK_UP\n" ));
    for( ;; ) {
        ProcessConnection();
    }
}