Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/base/patrol.cc61
1 files changed, 32 insertions, 29 deletions
diff --git a/src/game/base/patrol.cc b/src/game/base/patrol.cc
index 52944de..48f687e 100644
--- a/src/game/base/patrol.cc
+++ b/src/game/base/patrol.cc
@@ -268,36 +268,40 @@ void Patrol::frame(const unsigned long elapsed)
continue;
}
- // add NPC
- NPC *npc = new NPC(patrol_profile, shipmodel);
+ const size_t nbships = 1 + math::randomi(item->amount());
+ for (size_t i = 0; i < nbships; i++) {
- // set NPC name
- if (shipmodel->npc_name().size()) {
- npc->set_name(shipmodel->npc_name());
- }
-
- // set NPC color
- if (faction()) {
- faction()->apply(npc);
- }
-
- // patrol ships are not dockable
- if (npc->has_flag(core::Entity::Dockable)) {
- unset_flag(core::Entity::Dockable);
- // delete menus
- for (Menus::iterator mit = npc->menus().begin(); mit != npc->menus().end(); mit++) {
- delete (*mit);
- (*mit) = 0;
+ // add NPC
+ NPC *npc = new NPC(patrol_profile, shipmodel);
+
+ // set NPC name
+ if (shipmodel->npc_name().size()) {
+ npc->set_name(shipmodel->npc_name());
+ }
+
+ // set NPC color
+ if (faction()) {
+ faction()->apply(npc);
}
- npc->menus().clear();
+
+ // patrol ships are not dockable
+ if (npc->has_flag(core::Entity::Dockable)) {
+ unset_flag(core::Entity::Dockable);
+ // delete menus
+ for (Menus::iterator mit = npc->menus().begin(); mit != npc->menus().end(); mit++) {
+ delete (*mit);
+ (*mit) = 0;
+ }
+ npc->menus().clear();
+ }
+
+ // dock npc at spawn
+ npc->set_zone(spawn->zone());
+ npc->set_dock(spawn);
+
+ // add NPC to patrol
+ add_member(npc);
}
-
- // dock npc at spawn
- npc->set_zone(spawn->zone());
- npc->set_dock(spawn);
-
- // add NPC to patrol
- add_member(npc);
}
set_leader();
@@ -330,7 +334,7 @@ void Patrol::frame(const unsigned long elapsed)
patrol_leader->set_autopilot_target(waypoint()->target());
}
} else {
- patrol_launch_timeout = core::server()->timestamp() + 15000 + (unsigned long) math::randomi(15000);
+ patrol_launch_timeout = core::server()->timestamp() + 15000 + (unsigned long) math::randomi(30000);
}
} else {
patrol_launch_timeout = 0;
@@ -338,7 +342,6 @@ void Patrol::frame(const unsigned long elapsed)
}
} else {
-
patrol_leader->launch();
}