Technical support > Feature Requests

Researchers no longer available after finished research

<< < (2/2)

EsbenMoseHansen:
Here's a patch for the disappearing scientists problem

--- Code: ---
Index: src/client/cl_research.c
===================================================================
--- src/client/cl_research.c    (revision 2931)
+++ src/client/cl_research.c    (working copy)
@@ -837,8 +837,16 @@
                                MN_AddNewMessage(_("Research finished"), messageBuffer, qfalse, MSG_RESEARCH, tech);

 /*                             B_ClearBuilding(&gd.buildings[tech->base_idx][tech->lab]);*/
+                               while (tech->scientists>0) {
+                                       employee_t* employee = E_GetAssignedEmployee(&gd.bases[tech->base_idx], EMPL_SCIENTIST);
+                                       if (employee) {
+                                               employee->buildingID = -1;
+                                       } else {
+                                               Sys_Error("CL_CheckResearchStatus: More scientists assigned to tech than scientists assigned total.\n");
+                                       }
+                                       tech->scientists--; /* Moved here to avoid inf loop in case of data struction corruption*/
+                               }
                                tech->base_idx = -1;
-                               tech->scientists = 0;
                                RS_MarkResearched(tech->id);
                                researchListPos = 0;
                                newResearch++;

--- End code ---

I tried to post this on the issue tracker on sourceforge, without much success.

Hoehrer:
Thanks for that patch, i'll apply it as soon as i get some quirks out of it ... There already exist some functions that will handle all the assignment-stuff.

Thanks,
Werner

Navigation

[0] Message Index

[*] Previous page

Go to full version