]> git.pond.sub.org Git - empserver/blobdiff - src/lib/common/hap_fact.c
Update copyright notice
[empserver] / src / lib / common / hap_fact.c
index 94efa32eced3551085489adab0877bc65dbed553..a1436633091fa9e0967356efc0918c6fdd3476ab 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
  *  ---
  *
  *  hap_fact.c: Happiness effect on che
- * 
+ *
  *  Known contributors to this file:
  *     Steve McClure, 1996
  */
 
 #include <config.h>
 
-#include <stdio.h>
-#include <ctype.h>
 #include "misc.h"
-#include "player.h"
-#include "xy.h"
 #include "nat.h"
 #include "nsc.h"
-#include "common.h"
+#include "player.h"
+#include "prototypes.h"
+#include "xy.h"
 
 double
 hap_fact(struct natstr *tnat, struct natstr *vnat)
@@ -62,3 +60,11 @@ hap_fact(struct natstr *tnat, struct natstr *vnat)
        hap_fact = 0.8;
     return hap_fact;
 }
+
+/* Return happiness required to keep NP's citizens happy.  */
+double
+hap_req(struct natstr *np)
+{
+    return (np->nat_level[NAT_TLEV] - 40.0) / 40.0
+       + np->nat_level[NAT_ELEV] / 3.0;
+}