(String targetname, GameExportsImpl gameExports)
| 152 | */ |
| 153 | |
| 154 | public static SubgameEntity G_PickTarget(String targetname, GameExportsImpl gameExports) { |
| 155 | int num_choices = 0; |
| 156 | int MAXCHOICES = 8; |
| 157 | SubgameEntity[] choice = new SubgameEntity[MAXCHOICES]; |
| 158 | |
| 159 | if (targetname == null) { |
| 160 | gameExports.gameImports.dprintf("G_PickTarget called with null targetname\n"); |
| 161 | return null; |
| 162 | } |
| 163 | |
| 164 | EdictIterator es = null; |
| 165 | |
| 166 | while ((es = G_Find(es, findByTargetName, targetname, gameExports)) != null) { |
| 167 | choice[num_choices++] = es.o; |
| 168 | if (num_choices == MAXCHOICES) |
| 169 | break; |
| 170 | } |
| 171 | |
| 172 | if (num_choices == 0) { |
| 173 | gameExports.gameImports.dprintf("G_PickTarget: target " + targetname + " not found\n"); |
| 174 | return null; |
| 175 | } |
| 176 | |
| 177 | return choice[Lib.rand() % num_choices]; |
| 178 | } |
| 179 | |
| 180 | private static final float[] VEC_UP = { 0, -1, 0 }; |
| 181 |
no test coverage detected