INNER CODE UNIT · C

customData

acoto87/war1 · src/war_ai.c:98

    WarAICustomData* customData = (WarAICustomData*)wm_alloc(sizeof(WarAICustomData));
    customData->index = 0;

    WarAICommandList* commands = &customData->commands;
    WarAICommandListInit(commands, wm_globalAllocator());

    WarUnitType townHall = wu_getUnitTypeForRace(WAR_UNIT_TOWNHALL_HUMANS, aiPlayer->race);
    WarAICommandListAdd(commands, wai_createUnitRequest(context, aiPlayer, townHall, 1));
    WarAICommandListAdd(commands, wai_createWaitForUnit(context, aiPlayer, townHall, 1));

    WarUnitType worker = wu_getUnitTypeForRace(WAR_UNIT_PEASANT, aiPlayer->race);
    WarAICommandListAdd(commands, wai_createUnitRequest(context, aiPlayer, worker, 2));
    WarAICommandListAdd(commands, wai_createWaitForUnit(context, aiPlayer, worker, 2));
    WarAICommandListAdd(commands, wai_createUnitRequest(context, aiPlayer, worker, 2));
    WarAICommandListAdd(commands, wai_createWaitForUnit(context, aiPlayer, worker, 4));

    ai->customData = customData;
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…