5 #include "gb/bombard.h" 11 #include "gb/GB_server.h" 12 #include "gb/buffers.h" 14 #include "gb/files_shl.h" 19 #include "gb/shootblast.h" 21 #include "gb/tweakables.h" 26 int bombard(Ship *ship, Planet *planet, Race *r) {
35 bzero((
char *)Nuked,
sizeof(Nuked));
38 Shiplist shiplist(planet->ships);
39 for (
auto s : shiplist) {
40 if (s.alive && s.type == ShipType::OTYPE_PLANDEF &&
41 s.owner != ship->owner) {
42 sprintf(buf,
"Bombardment of %s cancelled, PDNs are present.\n",
44 warn(ship->owner, ship->governor, buf);
55 if (smap.get(x, y).owner && smap.get(x, y).owner != ship->owner &&
56 (smap.get(x, y).condition != SectorType::SEC_WASTED)) {
57 if (
isset(r->atwar, smap.get(x, y).owner) ||
58 (ship->type == ShipType::OTYPE_BERS &&
59 smap.get(x, y).owner == ship->special.mind.target))
75 str =
MIN(Shipdata[ship->type][ABIL_GUNS] * (100 - ship->damage) / 100.,
79 bzero(Nuked,
sizeof(Nuked));
80 oldown = smap.get(x, y).owner;
81 ship->destruct -= str;
87 if (numdest < 0) numdest = 0;
90 sprintf(telegram_buf,
"REPORT from ship #%lu\n\n", ship->number);
91 strcat(telegram_buf, short_buf);
92 sprintf(buf,
"sector %d,%d (owner %d). %d sectors destroyed.\n", x, y,
94 strcat(telegram_buf, buf);
95 notify(ship->owner, ship->governor, telegram_buf);
98 sprintf(telegram_buf,
"ALERT from planet /%s/%s\n",
99 Stars[ship->storbits]->name,
100 Stars[ship->storbits]->pnames[ship->pnumorbits]);
101 sprintf(buf,
"%c%lu%s bombarded sector %d,%d; %d sectors destroyed.\n",
102 Shipltrs[ship->type], ship->number, ship->name, x, y, numdest);
103 strcat(telegram_buf, buf);
104 sprintf(buf,
"%c%lu %s [%d] bombards %s/%s\n", Shipltrs[ship->type],
105 ship->number, ship->name, ship->owner,
106 Stars[ship->storbits]->name,
107 Stars[ship->storbits]->pnames[ship->pnumorbits]);
108 for (player_t i = 1; i <= Num_races; i++)
109 if (Nuked[i - 1] && i != ship->owner)
110 warn(i, Stars[ship->storbits]->governor[i - 1], telegram_buf);
116 if (!ship->notified) {
118 sprintf(telegram_buf,
119 "Bulletin\n\n %c%lu %s has no weapons to bombard with.\n",
120 Shipltrs[ship->type], ship->number, ship->name);
121 warn(ship->owner, ship->governor, telegram_buf);
129 if (!ship->notified) {
131 sprintf(telegram_buf,
"Report from %c%lu %s\n\n", Shipltrs[ship->type],
132 ship->number, ship->name);
133 sprintf(buf,
"Planet /%s/%s has been saturation bombed.\n",
134 Stars[ship->storbits]->name,
135 Stars[ship->storbits]->pnames[ship->pnumorbits]);
136 strcat(telegram_buf, buf);
137 notify(ship->owner, ship->governor, telegram_buf);
void post(const char *origmsg, int type)
int bombard(Ship *, Planet *, Race *)
int shoot_ship_to_planet(Ship *, Planet *, int, int, int, SectorMap &, int, int, char *, char *)
char * prin_ship_orbits(Ship *s)
void putsmap(SectorMap &map, Planet &p)
SectorMap getsmap(const Planet &p)
int Getxysect(const Planet &p, int *x, int *y, int r)