Exemple #1
0
struct Plot* CreatePlot(int _Type, void* _Data, struct BigGuy* _Owner, struct BigGuy* _Target) {
	struct Plot* _Plot = (struct Plot*) malloc(sizeof(struct Plot));

	Assert(_Type >=0 && _Type < PLOT_SIZE);
	Assert(_Owner != NULL);
	_Plot->Type = _Type;
	ConstructLinkedList(&_Plot->Side[0]);
	ConstructLinkedList(&_Plot->SideAsk[0]);
	ConstructLinkedList(&_Plot->Side[1]);
	ConstructLinkedList(&_Plot->SideAsk[1]);
	PlotJoin(_Plot, PLOT_ATTACKERS, _Owner);
	PlotJoin(_Plot, PLOT_DEFENDERS, _Target);
	_Plot->SidePower[PLOT_ATTACKERS] = 0;
	_Plot->SidePower[PLOT_DEFENDERS] = 0;
	_Plot->Threat[PLOT_ATTACKERS] = 0;
	_Plot->Threat[PLOT_DEFENDERS] = 0;
	_Plot->WarScore = 0;
	_Plot->MaxScore = PLOT_OVERTHROW_MAXSCORE;
	_Plot->CurrActList = 0;
	_Plot->PlotData = _Data;
	_Plot->HasStarted = false;
	for(int i = 0; i < PLOT_SIDES; ++i) {
		for(int j = 0; j < BGSKILL_SIZE; ++j) {
			_Plot->StatMods[i][j] = 0;
		}
	}
//	CreateObject(&_Plot->Object, OBJECT_PLOT);
	PushEvent(EVENT_NEWPLOT, BigGuyHome(_Owner), _Plot);
	if(_Target != NULL)
		BigGuyPlotTarget(_Target, _Plot);
	RBInsert(&g_GameWorld.PlotList, _Plot);
	PLOT_CURRACTLIST(_Plot) = NULL;
	PLOT_PREVACTLIST(_Plot) = NULL;
	return _Plot;
}
Exemple #2
0
int main(int argc, char const *argv[])
{
	
  RBTree* tree = RBCreate();
  while(true){
    int num = 0;

    printf("please enter num: \n");
    scanf("%d", &num);

    if(num == 0){
      break;
    }

    int i=0;

    RBInsert(tree, num, num);

    int size = 0;
    char** preorder = preorderTraversal(tree, &size);
    
    for(i=0;i<size;i++){
      printf("%s\n", preorder[i]);
    }
    free(preorder); 
  }
  
  RBDestroy(tree);

	return 0;
}
Exemple #3
0
void MissionInsert(struct MissionEngine* _Engine, struct Mission* _Mission) {
	if(RBSearch(&_Engine->MissionId, _Mission) != NULL) {
		Log(ELOG_WARNING, "Mission cannot be loaded id %f is already in use.", _Mission->Id);
		return;
	}
	RBInsert(&_Engine->MissionId, _Mission);
	if((_Mission->Flags & MISSION_FEVENT) != 0) {
		LnkLstPushBack(&_Engine->EventMissions[_Mission->TriggerEvent], _Mission);
	}
	if((_Mission->Flags & MISSION_FONLYTRIGGER) == 0) {
		LnkLstPushBack(&_Engine->MissionsTrigger, _Mission);	
	}
}
Exemple #4
0
void Clust::InsertMetric(unsigned uIndex1, unsigned uIndex2, float dMetric)
	{
	RBInsert(uIndex1, uIndex2, dMetric);
	}