26 inline double random() {
return (
double) rand() / (double) RAND_MAX; }
31 : name(n), regnum(reg), type(t), design_name(d), design(0),
32 count(c), iff(i), leader(false), dead_count(0), available(c),
33 carrier(0), plan_value(0), launch_time(-1e6), jump_time(0),
34 sustained_damage(0), target(0), group(0), heading(0)
38 : name(u.name), regnum(u.regnum), type(u.type), design_name(u.design_name),
39 design(u.design), count(u.count), iff(u.iff),
40 dead_count(u.dead_count), available(u.available),
41 leader(u.leader), region(u.region), location(u.location),
42 carrier(u.carrier), plan_value(0), launch_time(u.launch_time),
43 jump_time(u.jump_time), sustained_damage(u.sustained_damage),
44 target(0), group(0), heading(u.heading)
89 static char desc[256];
101 sprintf_s(desc,
"%s-%s %s", design->
abrv, (
const char*) regnum, (
const char*) name);
103 sprintf_s(desc,
"%s %s", design->
abrv, (
const char*) name);
105 if (dead_count > 0) {
214 if (unit == 0 || unit ==
this)
220 double distance = (location - unit->location).length();
222 if (type > unit->type)
235 if (tgt == 0 || tgt ==
this || available < 1)
241 double effectiveness = 1;
242 double distance = (location - tgt->location).length();
267 return type * effectiveness;
274 return type * effectiveness;
276 return type * 0.1 * effectiveness;
323 location = carrier->location;
334 else if (!tgt->attackers.
contains(
this))
335 tgt->attackers.
append(
this);
344 target->attackers.
remove(
this);
353 int value_killed = 0;
365 value_killed += KillGroup(g);
380 dead_count += killed;
394 value_killed += KillGroup(g);