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; }
void ConstructMissionEngine(struct MissionEngine* _Engine) { _Engine->MissionId.Table = NULL; _Engine->MissionId.Size = 0; _Engine->MissionId.ICallback = (RBCallback) MissionIdSearch; _Engine->MissionId.SCallback = (RBCallback) MissionIdInsert; for(int i = 0; i < MEVENT_SIZE; ++i) { ConstructLinkedList(&_Engine->EventMissions[i]); } }
struct LinkedList* CreateLinkedList() { struct LinkedList* _List = (struct LinkedList*) malloc(sizeof(struct LinkedList)); ConstructLinkedList(_List); return _List; }