// ----- Update & end of turn void cCentreManager::UpdateCentre() // Start_Building_Process_A { cTariff tariff; stringstream ss; string girlName; sBrothel* current = (sBrothel*)m_Parent; u_int restjob = JOB_CENTREREST; u_int matronjob = JOB_CENTREMANAGER; u_int firstjob = JOB_CENTREREST; u_int lastjob = JOB_THERAPY; current->m_Finance.zero(); current->m_AntiPregUsed = 0; m_Rehab_Patient_Time = 0; sGirl* cgirl = current->m_Girls; while (cgirl) { current->m_Filthiness++; if (cgirl->health() <= 0) // Remove any dead bodies from last week { current->m_Filthiness++; // `J` Death is messy sGirl* DeadGirl = 0; girlName = cgirl->m_Realname; DeadGirl = cgirl; // If there are more girls to process cgirl = (cgirl->m_Next) ? cgirl->m_Next : 0; // increase all the girls fear and hate of the player for letting her die (weather his fault or not) UpdateAllGirlsStat(current, STAT_PCFEAR, 2); UpdateAllGirlsStat(current, STAT_PCHATE, 1); ss.str(""); ss << girlName << " has died from her injuries, the other girls all fear and hate you a little more."; DeadGirl->m_Events.AddMessage(ss.str(), IMGTYPE_DEATH, EVENT_DANGER); g_MessageQue.AddToQue(ss.str(), COLOR_RED); ss.str(""); ss << girlName << " has died from her injuries. Her body will be removed by the end of the week."; DeadGirl->m_Events.AddMessage(ss.str(), IMGTYPE_DEATH, EVENT_SUMMARY); RemoveGirl(0, DeadGirl); DeadGirl = 0; // cleanup } else { cgirl->m_Events.Clear(); // Clear the girls' events from the last turn cgirl->where_is_she = 0; cgirl->m_InStudio = false; cgirl->m_InArena = false; cgirl->m_InCentre = true; cgirl->m_InClinic = false; cgirl->m_InFarm = false; cgirl->m_InHouse = false; cgirl->m_Pay = cgirl->m_Tips = 0; // `J` Check for out of building jobs and set yesterday jobs for everyone first if (cgirl->m_DayJob < firstjob || cgirl->m_DayJob > lastjob) cgirl->m_DayJob = restjob; if (cgirl->m_NightJob < firstjob || cgirl->m_NightJob > lastjob) cgirl->m_NightJob = restjob; if (cgirl->m_PrevDayJob != 255 && (cgirl->m_PrevDayJob < firstjob || cgirl->m_PrevDayJob > lastjob)) cgirl->m_PrevDayJob = 255; if (cgirl->m_PrevNightJob != 255 && (cgirl->m_PrevNightJob < firstjob || cgirl->m_PrevNightJob > lastjob)) cgirl->m_PrevNightJob = 255; cgirl->m_YesterDayJob = cgirl->m_DayJob; // `J` set what she did yesterday cgirl->m_YesterNightJob = cgirl->m_NightJob; // `J` set what she did yesternight cgirl->m_Refused_To_Work_Day = cgirl->m_Refused_To_Work_Night = false; string summary = ""; g_Girls.AddTiredness(cgirl); // `J` moved all girls add tiredness to one place do_food_and_digs(current, cgirl); // Brothel only update for girls accommodation level g_Girls.updateGirlAge(cgirl, true); // update birthday counter and age the girl g_Girls.HandleChildren(cgirl, summary); // handle pregnancy and children growing up g_Girls.updateSTD(cgirl); // health loss to STD's NOTE: Girl can die g_Girls.updateHappyTraits(cgirl); // Update happiness due to Traits NOTE: Girl can die updateGirlTurnBrothelStats(cgirl); // Update daily stats Now only runs once per day g_Girls.updateGirlTurnStats(cgirl); // Stat Code common to Dugeon and Brothel if (cgirl->m_JustGaveBirth) // if she gave birth, let her rest this week { if (cgirl->m_DayJob != restjob) cgirl->m_PrevDayJob = cgirl->m_DayJob; if (cgirl->m_NightJob != restjob) cgirl->m_PrevNightJob = cgirl->m_NightJob; cgirl->m_DayJob = cgirl->m_NightJob = restjob; } cgirl = cgirl->m_Next; } } UpdateGirls(current, 0); // Run the Day Shift UpdateGirls(current, 1); // Run the Nighty Shift if (current->m_Filthiness < 0) current->m_Filthiness = 0; if (current->m_SecurityLevel < 0) current->m_SecurityLevel = 0; g_Gold.brothel_accounts(current->m_Finance, current->m_id); cgirl = current->m_Girls; while (cgirl) { g_Girls.updateTemp(cgirl); // update temp stuff g_Girls.EndDayGirls(current, cgirl); cgirl = cgirl->m_Next; } }
void cDungeon::Update() { /* * WD: GetNumGirlsOnJob() not testing if the girl worked * */ sGirl* TorturerGirlref = 0; string girlName; stringstream msg; stringstream ss; // Reser counters m_NumGirlsTort = m_NumCustsTort = 0; // WD: Did we torture the girls bool tort = g_Brothels.TortureDone(); // WD: If so, who is the Torturer if (tort) { TorturerGirlref = g_Brothels.WhoHasTorturerJob(); } /********************************* * DO ALL DUNGEON GIRLS *********************************/ if (m_Girls) { sDungeonGirl* current = m_Girls; while (current) { sGirl* girl = current->m_Girl; // girl->m_Tort = false;// WD: Move till after Girls have been tortured so that we dont torture twice week girlName = girl->m_Realname; ss.str(""); msg.str(""); // Check for dead girls if (girl->health() <= 0) { // remove dead bodies from last week if (current->m_Reason == DUNGEON_DEAD) { sDungeonGirl* temp = current; current = current->m_Next; msg << girlName << "'s body has been removed from the dungeon since she was dead."; g_MessageQue.AddToQue(msg.str(), COLOR_RED); delete RemoveGirl(temp); continue; } // Mark as dead else { m_NumberDied++; current->m_Reason = DUNGEON_DEAD; SetGameFlag(FLAG_DUNGEONGIRLDIE); continue; } } /* * DAILY Processing */ string summary = ""; current->m_Weeks++; // the number of weeks they have been in the dungeon g_Girls.CalculateGirlType(girl); // update the fetish traits g_Girls.updateGirlAge(girl, true); // update birthday counter and age the girl g_Girls.updateTemp(girl); // update temp stuff g_Girls.EndDayGirls(g_Brothels.GetBrothel(0), girl); g_Girls.HandleChildren(girl, summary); // handle pregnancy and children growing up g_Girls.updateSTD(girl); // health loss to STD's - NOTE: Girl can die g_Girls.updateHappyTraits(girl); // Update happiness due to Traits - NOTE: Girl can die updateGirlTurnDungeonStats(current); // Update stats g_Girls.updateGirlTurnStats(girl); // Stat Code common to Dugeon and Brothel // Check again for dead girls if (g_Girls.GetStat(girl, STAT_HEALTH) <= 0) { m_NumberDied++; current->m_Reason = DUNGEON_DEAD; SetGameFlag(FLAG_DUNGEONGIRLDIE); msg.str(""); ss.str(""); msg << girlName << gettext(" has died in the dungeon."); girl->m_Events.AddMessage(msg.str(), IMGTYPE_DEATH, EVENT_DANGER); ss << girlName << gettext(" has died. Her body will be removed by the end of the week.\n"); girl->m_Events.AddMessage(ss.str(), IMGTYPE_DEATH, EVENT_SUMMARY); // if there is a torturer send her a message if (tort) { msg.str(""); msg << girlName << gettext(" has died in the dungeon under her care!"); TorturerGirlref->m_Events.AddMessage(msg.str(), IMGTYPE_PROFILE, EVENT_DUNGEON); } current = current->m_Next; continue; } // Have dungeon girls tortured by the Torturer if (tort) { cGirlTorture gt(current, TorturerGirlref); } /* `J` merged WARNING MESSAGES and SUMMARY MESSAGES * Allow girl sorting in turn summary */ // `J` set the basics msg.str(""); ss.str(""); msg << girlName << gettext(" is languish in the dungeon.\n\n"); int msgtype = EVENT_DUNGEON; int imgtype = IMGTYPE_PROFILE; int nHealth = girl->health(); int nTired = girl->tiredness(); // `J` check them for dangers or warnings if (nHealth < 20 || nTired > 80) { msg << gettext("DANGER: ") << girlName; msgtype = EVENT_DANGER; } else if (nHealth < 40 || nTired > 60) { msg << gettext("WARNING: ") << girlName; msgtype = EVENT_WARNING; } // `J` did msgtype change? if (msgtype != EVENT_DUNGEON) { if (girl->m_Tort) { msg << gettext(" was tortured this week."); imgtype = IMGTYPE_TORTURE; if (nHealth < 40 || nTired > 60) { msg << gettext("\nShe"); } } if (nHealth < 20) { msg << gettext(" is severely injured"); } else if (nHealth < 40) { msg << gettext(" is injured"); } if (nHealth < 40 && nTired > 60) { msg << gettext(" and"); } else if (nTired > 60) { msg << gettext(" is"); } else { msg << gettext("."); } if (nTired > 80) { msg << gettext(" exhausted, it may effect her health."); } else if (nTired > 60) { msg << gettext(" tired."); } msg << gettext("\n\nHer health is ") << nHealth << gettext(".\nHer tiredness is ") << nTired << "."; } girl->m_Events.AddMessage(msg.str(), imgtype, msgtype); girl->m_Tort = false; // loop next dungeon girl current = current->m_Next; } /* * WD: Torturer Girl summary * Processed after all dGirls */ if (tort) { msg.str(""); msg << TorturerGirlref->m_Realname << gettext(" has tortured ") << m_NumGirlsTort << gettext(" girls in the Dungeon."); TorturerGirlref->m_Events.AddMessage(msg.str(), IMGTYPE_PROFILE, EVENT_DUNGEON); } } /********************************* * DO ALL CUSTOMERS *********************************/ if (m_Custs) { sDungeonCust* current = m_Custs; while (current) { current->m_Tort = false; if (current->m_Health <= 0) { m_NumberDied++; current->m_Reason = DUNGEON_DEAD; SetGameFlag(FLAG_DUNGEONCUSTDIE); } if (current->m_Reason == DUNGEON_DEAD) { sDungeonCust* temp = current; current = current->m_Next; RemoveCust(temp); continue; } /* * lose health if not feeding * * Mod: removed "no-effect" branch to silence * compiler */ if (!current->m_Feeding) current->m_Health -= 5; current->m_Weeks++; if (current->m_Health <= 0) { m_NumberDied++; current->m_Reason = DUNGEON_DEAD; SetGameFlag(FLAG_DUNGEONCUSTDIE); } current = current->m_Next; } } }