Beispiel #1
0
void InitVarList(
  struct TVariableList *ptVarList)
{
  if (ptVarList != NULL)
  {
    if (ptVarList->ptThis != NULL)
      InitVar(ptVarList->ptThis);
    if (ptVarList->ptNext != NULL)
      InitVarList(ptVarList->ptNext);
  }
}
Beispiel #2
0
void _stdcall RunAfterLoad() {
	g_pServer		=	CLIB_GameSRV::GetInstance();		//(CLIB_GameSRV*)*((char**)0x100CB8B0);
	g_pPartyBUFF	=	(CPartyBUFF*)*((char**)0x100CB8B4);
	g_pZoneLIST		=	CZoneLIST::GetInstance();			//(CZoneLIST*)*((char**)0x100CB8C0);
	g_pUserLIST		=	(CUserLIST*)*((char**)0x100CBA1C);
	g_pObjMGR		=	(CObjMNG*)*((char**)0x100CBA24);
	g_pThreadSQL	=	(GS_CThreadSQL*)*((char**)0x100CBA30);
	g_pThreadLOG	=	(GS_CThreadLOG*)*((char**)0x100CBA34);
	g_pThreadGUILD	=	(CThreadGUILD*)*((char**)0x100CBA3C);
	g_pQuestDATA	=   (CQuestDATA*)(0x100CC040);

	g_TblZONE		=	(STBVALUE**)*((char**)0x100CBFDC);	// 0x100CBFDC - 0x20 (m_ppDATA)
	g_TblSTATUS		=	(STBVALUE**)*((char**)0x100CBF2C);

	InitVarList();
	CleanAllPvpNpcs();
	gHasLoaded = true;
	StartZoneCrashThread();
}
Beispiel #3
0
void InitStateMachine(
  struct TStateMachine *ptMachine)
/****************************************************************************/
/* Initialises one single statemachine.                                     */
/* The current state is initalised, and all action records are updated.     */
/* In each action record, the ptNextState pointer is substituted.           */
/* If the corresponding pcNextStateName is not found in the list of states, */
/* an error is generated. (In the previous internal releases of AutoTest    */
/* the ptNextState field was not available, and the states were searched    */
/* during runtime.)                                                         */
/****************************************************************************/
{
  struct TStateList *ptStateListWalker;
  struct TActionList *ptActionListWalker;
  struct TTransitionList *ptTransitionListWalker;
  struct TState *ptState;

  /* Initialise the initial state. Which is the first mentioned state..     */

  ptMachine->ptCurrentState = ptMachine->ptStates->ptThis;

  ptMachine->ptActionInProgress = NULL;
  ptMachine->ptRunningTimer = NULL;
  ptMachine->ptRunningTimerTransition = NULL;
  ptMachine->ptStateInTimer = NULL;


  /* Next, reset all variables                                              */

  InitVarList(ptMachine->ptLocalVars);

  /* Next, initialise an eventually rescue state                            */
  if (ptMachine->pcRescueStateName != NULL)
  {
    ptMachine->ptRescueState = FindState(ptMachine->pcRescueStateName,
                                         ptMachine->ptStates);
    if (ptMachine->ptRescueState == NULL)
    {
      AddError2("Rescue State %s not defined.", ptMachine->pcRescueStateName);
    }
  }
  else
  {
    ptMachine->ptRescueState = NULL;
  }

  /* Next, initialise all states.                                           */
  for (ptStateListWalker = ptMachine->ptStates;
       ptStateListWalker != NULL; ptStateListWalker = ptStateListWalker->ptNext)
  {
    if (ptStateListWalker->ptThis != NULL)
    {
      /* In a state, initialise all transitions:                            */

      for (ptTransitionListWalker = ptStateListWalker->ptThis->ptTransitionList;
           ptTransitionListWalker != NULL;
           ptTransitionListWalker = ptTransitionListWalker->ptNext)
      {

        ptTransitionListWalker->ptThis->lTransitionCounter = 0;

        /* In a transition: Initialise all actions                          */
        /*  - set the lActionCounter to 0,                                  */
        for (ptActionListWalker = ptTransitionListWalker->ptThis->ptActionList;
             ptActionListWalker != NULL;
             ptActionListWalker = ptActionListWalker->ptNext)

        {
          ptActionListWalker->ptThis->lActionCounter = 0;

          InitVarList(ptActionListWalker->ptThis->ptVarList);
        }

        /* In a state, initialise all transitions:                          */
        /*  - initialise all ptNextState, based on pcNextStateName          */

        if (ptTransitionListWalker->ptThis != NULL)
        {
          if (ptTransitionListWalker->ptThis->pcNextStateName == NULL)
          {
            /* No new statename intended. This is only allowed by a         */
            /* transition containing a TERMINATE transition...              */

            if ((ptTransitionListWalker->ptThis->ptActionList->ptThis->
                 iActionType != TERMINATE_ACTION)
/* && (ptTransitionListWalker->ptThis->ptActionList->ptThis->iActionType != END_ACTION) */
              )
            {
              AddError2("In line nr. %d, a next state must be defined",
                        ptTransitionListWalker->ptThis->ptActionList->ptThis->
                        iSourceLineNumber);
            }
          }
          else if (*(ptTransitionListWalker->ptThis->pcNextStateName) == '\0')
          {
            /* No statename mentinoned, the next state is intended..        */
            ptTransitionListWalker->ptThis->ptNextState =
              ptStateListWalker->ptNext->ptThis;
            if (ptTransitionListWalker->ptThis->ptNextState == NULL)
            {
              AddError3("In line nr. %d, implicit next state is defined. %s",
                        ptTransitionListWalker->ptThis->ptActionList->ptThis->
                        iSourceLineNumber,
                        "This is only allowed if there IS a next state..");

            }
          }
          else
          {
            ptState = FindState(ptTransitionListWalker->ptThis->pcNextStateName,
                                ptMachine->ptStates);
            if (ptState == NULL)
            {
              AddError3("In line nr. %d, state %s does not exist",
                        ptTransitionListWalker->ptThis->ptActionList->ptThis->
                        iSourceLineNumber,
                        ptTransitionListWalker->ptThis->pcNextStateName);
            }
            else
            {
              ptTransitionListWalker->ptThis->ptNextState = ptState;
              Increment(&(ptState->iRefCount));
            }
          }
        }
      }
    }
  }
}