edit: Report sector loss and gain properly for key 'L'

Send bulletin to owner and report news exactly like for key 'o'.

Also print a "sector duplicated" message, just for consistency with
other keys.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2013-01-26 08:58:14 +01:00
parent a41c74967d
commit fec5ad692d
6 changed files with 136 additions and 15 deletions

67
src/lib/subs/actofgod.c Normal file
View file

@ -0,0 +1,67 @@
/*
* Empire - A multi-player, client/server Internet based war game.
* Copyright (C) 1986-2013, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure, Markus Armbruster
*
* Empire is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ---
*
* See files README, COPYING and CREDITS in the root of the source
* tree for related information and legal notices. It is expected
* that future projects/authors will amend these files as needed.
*
* ---
*
* actofgod.c: Deity meddling subroutines
*
* Known contributors to this file:
* Markus Armbruster, 2013
*/
#include <config.h>
#include "actofgod.h"
#include "file.h"
#include "news.h"
#include "optlist.h"
#include "player.h"
#include "prototypes.h"
static void
nreport_divine_aid(natid whom, int goodness)
{
if (opt_GODNEWS && getnatp(whom)->nat_stat != STAT_GOD && goodness)
nreport(player->cnum, goodness > 0 ? N_AIDS : N_HURTS, whom, 1);
}
void
report_god_takes(char *prefix, char *what, natid from)
{
if (from && from != player->cnum) {
wu(0, from, "%s%s taken from you by an act of %s!\n",
prefix, what, cname(player->cnum));
nreport_divine_aid(from, -1);
}
}
void
report_god_gives(char *prefix, char *what, natid to)
{
if (to && to != player->cnum) {
wu(0, to, "%s%s given to you by an act of %s!\n",
prefix, what, cname(player->cnum));
nreport_divine_aid(to, 1);
}
}