/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2018, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2021, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure, Markus Armbruster
*
* Empire is free software: you can redistribute it and/or modify
static int tend_land(struct shpstr *tenderp, int, char *units);
int
-tend(void)
+c_tend(void)
{
struct nstr_item targets;
struct nstr_item tenders;
pr("%s out of %s\n", prship(&tender), ip->i_name);
break;
}
+ if (amt < 0 && tender.shp_item[ip->i_uid] == maxtender)
+ break;
}
pr("%d total %s transferred %s %s\n",
total, ip->i_name, (amt > 0) ? "off of" : "to",
int can_take = to_max - to->shp_item[ip->i_uid];
int transfer;
- if (ip->i_uid == I_CIVIL && from->shp_own != to->shp_own)
+ if (!to_max) {
+ pr("%s cannot hold any %s\n", prship(to), ip->i_name);
+ return 0;
+ }
+ if (ip->i_uid == I_CIVIL && from->shp_own != to->shp_own) {
+ pr("%s civilians refuse to board %s!\n",
+ from->shp_own == player->cnum ? "Your" : "Foreign",
+ prship(to));
return 0;
+ }
if (!can_give) {
pr("No %s on %s\n", ip->i_name, prship(from));
return 0;
}
+ if (!can_take) {
+ pr("%s can't hold more %s\n", prship(to), ip->i_name);
+ return 0;
+ }
transfer = MIN(can_give, amt);
transfer = MIN(can_take, transfer);
- if (transfer == 0)
- return 0;
from->shp_item[ip->i_uid] -= transfer;
to->shp_item[ip->i_uid] += transfer;
if (to->shp_own != player->cnum) {