I want to realize a function, that automatically starts a new research topic after 10 seconds if a research facility is free and the user switched on an option "enable auto-research"
I want to implement the function in the source code file "hci.c" more precisely in void intCheckResearchButton(void)
Code: Select all
/*Checks to see if there are any research topics to do and flashes the button -
only if research facility is free*/
void intCheckResearchButton(void)
{
UWORD index, count;
STRUCTURE *psStruct;
BOOL resFree = false;
for (psStruct = interfaceStructList(); psStruct != NULL; psStruct =
psStruct->psNext)
{
if (psStruct->pStructureType->type == REF_RESEARCH &&
psStruct->status == SS_BUILT &&
((RESEARCH_FACILITY *)psStruct->pFunctionality)->psSubject == NULL)
{
addConsoleMessage(_("Research Facility is free!"), LEFT_JUSTIFY, SYSTEM_MESSAGE);
resFree = true;
break;
}
}
if (resFree)
{
//set to value that won't be reached in fillResearchList
//needs to be UWORD sized for the Patches
index = (UWORD)(numResearch + 1);
//index = (UBYTE)(numResearch + 1);
//calculate the list
count = fillResearchList(pList,selectedPlayer, index, MAXRESEARCH);
if (count)
{
//set the research reticule button to flash
flashReticuleButton(IDRET_RESEARCH);
}
}
}
Code: Select all
if (research facility is free)
{
get first unresearched topic
start this topic in free research facility
}

