]> git.pond.sub.org Git - empserver/blobdiff - src/lib/update/land.c
update: Factor out common plague reporting
[empserver] / src / lib / update / land.c
index 0cc99ef26b465cd70c073db7e8543316be4e0576..5929c4a7acce0395768e084053fd5cfe8e5129d3 100644 (file)
@@ -141,46 +141,9 @@ upd_land(struct lndstr *lp, int etus, struct bp *bp, int build)
            ptime = lp->lnd_ptime;
            if (pstage != PLG_HEALTHY) {
                n = plague_people(np, lp->lnd_item, &pstage, &ptime, etus);
-               switch (n) {
-               case PLG_DYING:
-                   wu(0, lp->lnd_own,
-                      "PLAGUE deaths reported on %s\n", prland(lp));
-                   nreport(lp->lnd_own, N_DIE_PLAGUE, 0, 1);
-                   break;
-               case PLG_INFECT:
-                   wu(0, lp->lnd_own, "%s battling PLAGUE\n", prland(lp));
-                   break;
-               case PLG_INCUBATE:
-                   /* Are we still incubating? */
-                   if (n == pstage) {
-                       /* Yes. Will it turn "infectious" next time? */
-                       if (ptime <= etus) {
-                           /* Yes.  Report an outbreak. */
-                           wu(0, lp->lnd_own,
-                              "Outbreak of PLAGUE on %s!\n", prland(lp));
-                           nreport(lp->lnd_own, N_OUT_PLAGUE, 0, 1);
-                       }
-                   } else {
-                       /* It has already moved on to "infectious" */
-                       wu(0, lp->lnd_own,
-                          "%s battling PLAGUE\n", prland(lp));
-                   }
-                   break;
-               case PLG_EXPOSED:
-                   /* Has the plague moved to "incubation" yet? */
-                   if (n != pstage) {
-                       /* Yes. Will it turn "infectious" next time? */
-                       if (ptime <= etus) {
-                           /* Yes.  Report an outbreak. */
-                           wu(0, lp->lnd_own,
-                              "Outbreak of PLAGUE on %s!\n", prland(lp));
-                           nreport(lp->lnd_own, N_OUT_PLAGUE, 0, 1);
-                       }
-                   }
-                   break;
-               default:
-                   break;
-               }
+               if (n != PLG_HEALTHY)
+                   plague_report(lp->lnd_own, n, pstage, ptime, etus,
+                                 "on", prland(lp));
                lp->lnd_pstage = pstage;
                lp->lnd_ptime = ptime;
            }