| 235 | } |
| 236 | |
| 237 | GameValue UnitCreate(const GameState* state, GameValuePar oper1, GameValuePar oper2) |
| 238 | { |
| 239 | GameStringType type = oper1; |
| 240 | const GameArrayType& array = oper2; |
| 241 | |
| 242 | Vector3 pos; |
| 243 | AIGroup* grp; |
| 244 | float skill = 0.5; |
| 245 | Rank rank = RankPrivate; |
| 246 | RString init; |
| 247 | switch (array.Size()) |
| 248 | { |
| 249 | case 5: |
| 250 | { |
| 251 | if (array[4].GetType() != GameString) |
| 252 | { |
| 253 | state->TypeError(GameString, array[4].GetType()); |
| 254 | return NOTHING; |
| 255 | } |
| 256 | GameStringType rankName = array[4]; |
| 257 | rank = GetEnumValue<Rank>((const char*)rankName); |
| 258 | if (rank == INT_MIN) |
| 259 | { |
| 260 | rank = RankPrivate; |
| 261 | } |
| 262 | } |
| 263 | case 4: |
| 264 | { |
| 265 | if (array[3].GetType() != GameScalar) |
| 266 | { |
| 267 | state->TypeError(GameScalar, array[3].GetType()); |
| 268 | return NOTHING; |
| 269 | } |
| 270 | skill = array[3]; |
| 271 | } |
| 272 | case 3: |
| 273 | { |
| 274 | if (array[2].GetType() != GameString) |
| 275 | { |
| 276 | state->TypeError(GameString, array[2].GetType()); |
| 277 | return NOTHING; |
| 278 | } |
| 279 | init = array[2]; |
| 280 | } |
| 281 | case 2: |
| 282 | { |
| 283 | if (!GetRelPos(state, pos, array[0])) |
| 284 | { |
| 285 | // state->SetError(EvalGen); |
| 286 | return NOTHING; |
| 287 | } |
| 288 | grp = GetGroup(array[1]); |
| 289 | if (!grp) |
| 290 | { |
| 291 | return NOTHING; |
| 292 | } |
| 293 | } |
| 294 | break; |
nothing calls this directly
no test coverage detected