This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
void | sendAIM (AUTO *a, MECH *m, char *msg) |
char * | AI_Info (MECH *m, AUTO *a) |
int | getEnemies (MECH *mech, MAP *map, int reset) |
int | getFriends (MECH *mech, MAP *map, int reset) |
void | ai_path_score (MECH *m, MAP *map, AUTO *a, int opts[][2], int num_o, int gotenemy, float dx, float dy, float delx, float dely, int *rl, int *bd, int *bscore) |
int | ai_max_speed (MECH *m, AUTO *a) |
int | ai_opponents (AUTO *a, MECH *m) |
void | ai_run_speed (MECH *mech, AUTO *a) |
void | ai_stop (MECH *mech, AUTO *a) |
void | ai_set_speed (MECH *mech, AUTO *a, float s) |
void | ai_set_heading (MECH *mech, AUTO *a, int dir) |
void | ai_adjust_move (AUTO *a, MECH *m, char *text, int hmod, int smod, int b_score) |
int | ai_check_path (MECH *m, AUTO *a, float dx, float dy, float delx, float dely) |
void | ai_init (AUTO *a, MECH *m) |
void | mech_snipe (dbref player, MECH *mech, char *buffer) |
Definition at line 785 of file autopilot_ai.c.
References AI_Info(), ai_set_heading(), ai_set_speed(), MechDesiredFacing, MechDesiredSpeed, MMaxSpeed, MP1, SendAI, SP_OPT_FASTER, and SP_OPT_SLOWER.
Referenced by ai_check_path().
00787 { 00788 float ms; 00789 00790 ai_set_heading(m, a, MechDesiredFacing(m) + hmod); 00791 switch (smod) { 00792 default: 00793 SendAI("%s state: %s (hmod:%d) sc:%d", AI_Info(m, a), text, hmod, 00794 b_score); 00795 break; 00796 case SP_OPT_FASTER: 00797 SendAI("%s state: %s+accelerating (hmod:%d) sc:%d", AI_Info(m, a), 00798 text, hmod, b_score); 00799 ms = MMaxSpeed(m); 00800 ai_set_speed(m, a, 00801 (float) ((MechDesiredSpeed(m) < 00802 MP1 ? MP1 : MechDesiredSpeed(m)) * 4.0 / 3.0)); 00803 break; 00804 case SP_OPT_SLOWER: 00805 SendAI("%s state: %s+decelerating (hmod:%d) sc:%d", AI_Info(m, a), 00806 text, hmod, b_score); 00807 ms = MMaxSpeed(m); 00808 ai_set_speed(m, a, (int) (MechDesiredSpeed(m) * 2.0 / 3.0)); 00809 break; 00810 } 00811 }
Definition at line 813 of file autopilot_ai.c.
References ai_adjust_move(), AI_Info(), ai_opponents(), ai_path_score(), ai_stop(), AUTO_GOET, AUTO_GOTT, AUTOPILOT_GOTO_TICK, AUTO::b_bsc, AUTO::b_dan, AUTO::b_msc, CFAST_COUNT, CLASS_MECH, combat_fast_opt, getEnemies(), getFriends(), getMap(), AUTO::last_upd, MAGIC_NUM, MECH::mapindex, MAX, MechType, MIN_SAFE, MNORM_COUNT, move_norm_opt, mudstate, muxevent_tick, statedata::now, SAFE_SCORE, SendAI, sendAIM(), UNREF, AUTO::w_bsc, AUTO::w_dan, and AUTO::w_msc.
Referenced by auto_goto_event().
00815 { 00816 int o; 00817 int b_len, bl, b, b_score; 00818 MAP *map = getMap(m->mapindex); 00819 00820 o = ai_opponents(a, m); 00821 if(a->last_upd > mudstate.now || (mudstate.now - a->last_upd) > AUTO_GOET) { 00822 if((muxevent_tick - a->last_upd) > AUTO_GOTT) { 00823 a->b_msc = MAGIC_NUM; 00824 a->w_msc = MAGIC_NUM; 00825 a->b_bsc = MAGIC_NUM; 00826 a->w_bsc = MAGIC_NUM; 00827 a->b_dan = MAGIC_NUM; 00828 a->b_dan = (40 + 20 * 29 + 100) * 30; /* To stay focused */ 00829 } else { 00830 /* Slight update ; Un-refine the goals somewhat */ 00831 UNREF(a->w_msc, a->b_msc, 3); 00832 UNREF(a->w_bsc, a->b_bsc, 5); 00833 UNREF(a->w_dan, a->b_dan, 8); 00834 a->b_dan = MAX(a->b_dan, (40 + 20 * 29 + 100) * 30); /* To stay focused */ 00835 } 00836 a->last_upd = mudstate.now; 00837 } 00838 /* Got either opponents (nasty) or [possibly] blocked path (slightly nasty), i.e. 12sec */ 00839 if(MechType(m) == CLASS_MECH) 00840 getFriends(m, map, 0); 00841 if(o) { 00842 getEnemies(m, map, 0); 00843 if(!((muxevent_tick / AUTOPILOT_GOTO_TICK) % 4)) { /* Just every fourth tick, i.e. 12sec */ 00844 /* Thorough check */ 00845 ai_path_score(m, map, a, move_norm_opt, MNORM_COUNT, 1, dx, dy, 00846 delx, dely, &bl, &b, &b_score); 00847 b_len = b_score / SAFE_SCORE; 00848 if(b_len >= MIN_SAFE) 00849 ai_adjust_move(a, m, "combat(/twitchy)", 00850 move_norm_opt[b][0], move_norm_opt[b][1], 00851 b_score); 00852 } else { 00853 ai_path_score(m, map, a, combat_fast_opt, CFAST_COUNT, 1, dx, 00854 dy, delx, dely, &bl, &b, &b_score); 00855 b_len = b_score / SAFE_SCORE; 00856 if(b_len >= MIN_SAFE) 00857 ai_adjust_move(a, m, "[f]combat(/twitchy)", 00858 combat_fast_opt[b][0], combat_fast_opt[b][1], 00859 b_score); 00860 } 00861 return 1; /* We want to keep fighting near foes */ 00862 } 00863 if(!((muxevent_tick / AUTOPILOT_GOTO_TICK) % 4)) { /* Just every fourth tick, i.e. 12sec */ 00864 /* Thorough check */ 00865 ai_path_score(m, map, a, move_norm_opt, MNORM_COUNT, 0, dx, dy, 00866 delx, dely, &bl, &b, &b_score); 00867 b_len = b_score / SAFE_SCORE; 00868 if(b_len >= MIN_SAFE) 00869 ai_adjust_move(a, m, "moving", move_norm_opt[b][0], 00870 move_norm_opt[b][1], b_score); 00871 } else { 00872 ai_path_score(m, map, a, combat_fast_opt, CFAST_COUNT, 0, dx, dy, 00873 delx, dely, &bl, &b, &b_score); 00874 b_len = b_score / SAFE_SCORE; 00875 if(b_len >= MIN_SAFE) 00876 ai_adjust_move(a, m, "[f]moving", combat_fast_opt[b][0], 00877 combat_fast_opt[b][1], b_score); 00878 } 00879 00880 if(b_len >= MIN_SAFE) 00881 return 1; 00882 00883 /* Slow down + stop - no sense in dying needlessly */ 00884 ai_stop(m, a); 00885 SendAI("%s state: panic", AI_Info(m, a)); 00886 sendAIM(a, m, "PANIC! Unable to comply with order."); 00887 return 0; 00888 }
Definition at line 115 of file autopilot_ai.c.
References MECH::mapindex, MBUF_SIZE, AUTO::mynum, and MECH::mynum.
Referenced by ai_adjust_move(), and ai_check_path().
00116 { 00117 static char buf[MBUF_SIZE]; 00118 00119 sprintf(buf, "Unit#%d on #%d [A#%d]:", m->mynum, m->mapindex, a->mynum); 00120 return buf; 00121 }
Definition at line 890 of file autopilot_ai.c.
References AUTO::auto_cdist, AUTO::auto_cmode, AUTO::auto_fweight, AUTO::auto_goweight, AUTO::auto_nervous, AUTO::flags, AUTO::speed, and AUTO::target.
00891 { 00892 00893 /* XXX Analyze our unit type ; set basic combat tactic */ 00894 a->auto_cmode = 1; /* CHARGE! */ 00895 a->auto_cdist = 2; /* Attempt to avoid kicking distance */ 00896 a->auto_nervous = 0; 00897 a->auto_goweight = 44; /* We're mainly concentrating on fighting */ 00898 a->auto_fweight = 55; 00899 a->speed = 100; /* Reset to full speed */ 00900 a->flags = 0; 00901 a->target = -1; 00902 }
Definition at line 692 of file autopilot_ai.c.
References MechDesiredSpeed, and MMaxSpeed.
Referenced by ai_run_speed().
00693 { 00694 float ms; 00695 00696 if(MechDesiredSpeed(m) != (ms = MMaxSpeed(m))) 00697 return 0; 00698 return 1; 00699 }
Definition at line 701 of file autopilot_ai.c.
References AUTO::auto_nervous, and MechNumSeen.
Referenced by ai_check_path().
00702 { 00703 if(a->auto_nervous) { 00704 a->auto_nervous--; 00705 return 1; 00706 } 00707 if(MechNumSeen(m)) 00708 a->auto_nervous = 30; /* We'll stay frisky for awhile even if cons are lost for one reason or another */ 00709 return MechNumSeen(m); 00710 }
void ai_path_score | ( | MECH * | m, | |
MAP * | map, | |||
AUTO * | a, | |||
int | opts[][2], | |||
int | num_o, | |||
int | gotenemy, | |||
float | dx, | |||
float | dy, | |||
float | delx, | |||
float | dely, | |||
int * | rl, | |||
int * | bd, | |||
int * | bscore | |||
) |
Definition at line 408 of file autopilot_ai.c.
References AcceptableDegree(), ai_crash(), AUTO::auto_cdist, AUTO::auto_cmode, BOUNDED(), BSIDE, CLASS_MECH, CLASS_VEH_GROUND, LOC::dh, LOC::ds, enemy_c, enemy_l, enemy_m, enemy_o, FindBearing(), FindXYRange(), friend_c, friend_l, friend_m, friend_o, FSIDE, GetSectArmor, GetSectOArmor, LOC::h, LOCInit(), LSIDE, MAX, MAX_SIM_PATHS, MechType, MIN, MMaxSpeed, MP1, MP2, MP4, MP6, MP9, MyHexDist(), NORM_SAFE, RSIDE, sp_opt, SP_OPT_FASTER, WATER, x, and y.
Referenced by ai_check_path().
00411 { 00412 int i, j, k, l, bearing; 00413 int sd, sc; 00414 LOC lo[MAX_SIM_PATHS]; 00415 int dan[MAX_SIM_PATHS], tdan[MAX_SIM_PATHS], msc[MAX_SIM_PATHS], 00416 bsc[MAX_SIM_PATHS]; 00417 int out[MAX_SIM_PATHS], stack[MAX_SIM_PATHS], br[MAX_SIM_PATHS]; 00418 00419 for(i = 0; i < num_o; i++) { 00420 msc[i] = 0; 00421 bsc[i] = 0; 00422 dan[i] = 0; 00423 tdan[i] = 0; 00424 out[i] = 0; 00425 stack[i] = 0; 00426 br[i] = 9999; 00427 LOCInit(&lo[i], m); 00428 lo[i].dh = AcceptableDegree(lo[i].dh + opts[i][0]); 00429 sd = sp_opt[opts[i][1]]; 00430 if(sd) { 00431 if(sd < 0) { 00432 lo[i].ds = lo[i].ds * 2.0 / 3.0; 00433 } else if(sd == 1) { 00434 float ms = MMaxSpeed(m); 00435 00436 lo[i].ds = (lo[i].ds < MP1 ? MP1 : lo[i].ds) * 4.0 / 3.0; 00437 if(lo[i].ds > ms) 00438 lo[i].ds = ms; 00439 } else { 00440 float ms = MMaxSpeed(m); 00441 00442 lo[i].ds = ms; 00443 } 00444 } 00445 } 00446 for(i = 0; i < NORM_SAFE; i++) { 00447 dx += delx; 00448 dy += dely; 00449 for(k = 0; k < num_o; k++) { 00450 if(out[k]) 00451 continue; 00452 if(ai_crash(map, m, &lo[k])) { /* Simulate _one_ step */ 00453 out[k] = i + 1; 00454 continue; 00455 } 00456 /* Base target-acquisition stuff */ 00457 if((l = FindXYRange(lo[k].fx, lo[k].fy, dx, dy)) < br[k]) 00458 br[k] = l; 00459 00460 /* Generally speaking we're going to the point spesified */ 00461 msc[k] += 4 * (2 * (50 - br[k]) + (100 - l)); 00462 00463 /* Heading change's inherently [slightly] evil */ 00464 if(lo[k].h != lo[k].dh) 00465 msc[k] -= 1; 00466 00467 /* Moving is a good thing */ 00468 if(lo[k].x != lo[k].lx || lo[k].y != lo[k].ly) { 00469 if(lo[k].t == WATER) 00470 msc[k] -= 5; 00471 msc[k] += 10; 00472 } 00473 /* Punish for not utilizing full speed (this is .. hm, flaky) */ 00474 if(opts[k][1] != SP_OPT_FASTER && MMaxSpeed(m) > 0.1) { 00475 sc = BOUNDED(0, 100 * lo[k].ds / MMaxSpeed(m), 100); 00476 msc[k] -= (100 - sc) / 30; /* Basically, unused speed is bad */ 00477 } 00478 } 00479 if(MechType(m) == CLASS_MECH) { 00480 /* Simulate friends */ 00481 for(j = 0; j < friend_c; j++) { 00482 if(friend_o[j]) 00483 continue; 00484 if(ai_crash(map, friend_m[j], &friend_l[j])) 00485 friend_o[j] = 1; 00486 } 00487 for(k = 0; k < num_o; k++) { 00488 int sc = 0; 00489 00490 if(out[k] || stack[k]) 00491 continue; 00492 /* Meaning of stack: Someone moves _into_ the hex */ 00493 for(j = 0; j < friend_c; j++) 00494 if(!friend_o[j]) 00495 if(lo[k].x == friend_l[j].x && 00496 lo[k].y == friend_l[j].y) 00497 sc++; 00498 if(sc > 1) { /* Possible stackage */ 00499 int osc = sc; 00500 00501 for(j = 0; j < friend_c; j++) 00502 if(!friend_o[j]) 00503 if(lo[k].x == friend_l[j].x && 00504 lo[k].y == friend_l[j].y) 00505 if((lo[k].lx != lo[k].x || 00506 lo[k].ly != lo[k].y) || 00507 (friend_l[j].lx != friend_l[j].x || 00508 friend_l[j].ly != friend_l[j].y)) 00509 osc--; 00510 if(osc != sc) 00511 stack[k] = i + 1; 00512 } 00513 if(gotenemy) 00514 tdan[k] = 0; 00515 } 00516 } 00517 if(gotenemy) { 00518 /* Update enemy locations as well */ 00519 for(j = 0; j < enemy_c; j++) { 00520 if(enemy_o[j]) 00521 continue; 00522 if(ai_crash(map, enemy_m[j], &enemy_l[j])) 00523 enemy_o[j] = 1; 00524 for(k = 0; k < num_o; k++) { 00525 if(out[k]) 00526 continue; 00527 if((l = MyHexDist(lo[k].x, lo[k].y, enemy_l[j].x, 00528 enemy_l[j].y, 0)) >= 100) 00529 continue; 00530 switch (a->auto_cmode) { 00531 case 0: /* Withdraw */ 00532 if(l > a->auto_cdist) 00533 bsc[k] += 5 * a->auto_cdist + l - a->auto_cdist; 00534 else 00535 bsc[k] += 5 * l; 00536 break; 00537 case 1: /* Score = fulfilling goal (=> distance from cdist) */ 00538 if(l < a->auto_cdist) 00539 bsc[k] -= 10 * (a->auto_cdist - l); /* Not too close */ 00540 else 00541 bsc[k] -= 2 * (l - a->auto_cdist); 00542 break; 00543 case 2: 00544 if(l < a->auto_cdist) 00545 bsc[k] -= 2 * (a->auto_cdist - l); 00546 else 00547 bsc[k] -= 10 * (l - a->auto_cdist); 00548 } 00549 if(l > 28) 00550 continue; 00551 /* Danger modifier ; it's _always_ dangerous to be close */ 00552 tdan[k] += (40 - MIN(40, l)); 00553 /* Arcs can be .. dangerous */ 00554 if(MechType(m) == CLASS_MECH) { 00555 bearing = 00556 FindBearing(lo[k].fx, lo[k].fy, enemy_l[j].fx, 00557 enemy_l[j].fy); 00558 bearing = lo[k].h - bearing; 00559 if(bearing < 0) 00560 bearing += 360; 00561 if(bearing >= 90 && bearing <= 270) { 00562 /* Sides are moderately dangerous [potential rear arcs] */ 00563 tdan[k] += 5 * (29 - MIN(29, l)); 00564 if(bearing >= 120 && bearing <= 240) { 00565 /* Rear arc is VERY dangerous */ 00566 tdan[k] += 20 * (29 - MIN(29, l)); 00567 } 00568 } 00569 } else if(MechType(m) == CLASS_VEH_GROUND) { 00570 bearing = 00571 FindBearing(lo[k].fx, lo[k].fy, enemy_l[j].fx, 00572 enemy_l[j].fy); 00573 bearing = lo[k].h - bearing; 00574 if(bearing < 0) 00575 bearing += 360; 00576 if(bearing >= 45 && bearing <= 315) { 00577 if(bearing >= 135 && bearing <= 225) { 00578 /* Rear arc is VERY dangerous */ 00579 tdan[k] += 00580 10 * (29 - MIN(29, 00581 l)) * (100 - 00582 100 * 00583 GetSectArmor(m, 00584 BSIDE) 00585 / MAX(1, 00586 GetSectOArmor 00587 (m, 00588 BSIDE))) / 00589 100; 00590 } else if(bearing < 135) { 00591 /* right side */ 00592 tdan[k] += 00593 7 * (29 - MIN(29, 00594 l)) * (100 - 00595 100 * GetSectArmor(m, 00596 RSIDE) 00597 / MAX(1, 00598 GetSectOArmor 00599 (m, 00600 RSIDE))) / 00601 100; 00602 } else { 00603 tdan[k] += 00604 7 * (29 - MIN(29, 00605 l)) * (100 - 00606 100 * GetSectArmor(m, 00607 LSIDE) 00608 / MAX(1, 00609 GetSectOArmor 00610 (m, 00611 LSIDE))) / 00612 100; 00613 } 00614 } else 00615 tdan[k] += 00616 5 * (29 - MIN(29, 00617 l)) * (100 - 00618 100 * GetSectArmor(m, 00619 FSIDE) 00620 / MAX(1, 00621 GetSectOArmor(m, 00622 FSIDE))) 00623 / 100; 00624 } 00625 } 00626 for(k = 0; k < num_o; k++) { 00627 if(out[k]) 00628 continue; 00629 /* Dangerous to be far from buddy in fight */ 00630 l = FindXYRange(lo[k].fx, lo[k].fy, dx, dy); 00631 if(gotenemy && (delx != 0.0 || dely != 0.0)) 00632 tdan[k] += MIN(100, l * l); 00633 if(enemy_c) 00634 tdan[k] = tdan[k] / enemy_c; 00635 /* It's inherently dangerous to move slowly: */ 00636 if(lo[k].s <= MP2) 00637 tdan[k] += 400; 00638 else if(lo[k].s <= MP4) 00639 tdan[k] += 300; 00640 else if(lo[k].s <= MP6) 00641 tdan[k] += 200; 00642 else if(lo[k].s <= MP9) 00643 tdan[k] += 100; 00644 dan[k] += tdan[k] * (NORM_SAFE - i) / (NORM_SAFE / 2); 00645 } 00646 } 00647 } 00648 } 00649 for(i = 0; i < num_o; i++) { 00650 U2(a->w_msc, msc[i]); 00651 U1(a->b_msc, msc[i]); 00652 if(gotenemy) { 00653 U2(a->w_bsc, bsc[i]); 00654 U1(a->b_bsc, bsc[i]); 00655 U2(a->w_dan, dan[i]); 00656 U1(a->b_dan, dan[i]); 00657 } 00658 } 00659 /* Now we have been.. calibrated */ 00660 *bscore = 0; 00661 *bd = -1; 00662 /* Find best overall score */ 00663 for(i = 0; i < num_o; i++) { 00664 if(!out[i]) 00665 out[i] = NORM_SAFE + 1; 00666 if(!stack[i]) 00667 stack[i] = out[i]; 00668 sc = (out[i] - (out[i] - stack[i]) / 2) * SAFE_SCORE + FU(msc[i], 00669 a->w_msc, 00670 a->b_msc, 00671 SCORE_MOD * 00672 a-> 00673 auto_goweight); 00674 if(gotenemy) 00675 sc += 00676 FU(bsc[i], a->w_bsc, a->b_bsc, 00677 SCORE_MOD * a->auto_fweight) - FU(dan[i], a->w_dan, 00678 a->b_dan, 00679 SCORE_MOD * 00680 (a->auto_fweight + 00681 a->auto_goweight)); 00682 if(sc > *bscore 00683 || (*bd >= 0 && sc == *bscore 00684 && sp_opt[opts[i][1]] > sp_opt[opts[*bd][1]])) { 00685 *bscore = sc; 00686 *bd = i; 00687 *rl = out[i] - 1; 00688 } 00689 } 00690 }
Definition at line 712 of file autopilot_ai.c.
References ai_max_speed(), mech_speed(), and AUTO::mynum.
00713 { 00714 /* Warp speed, cap'n! */ 00715 char buf[128]; 00716 00717 if(!ai_max_speed(mech, a)) { 00718 strcpy(buf, "run"); 00719 mech_speed(a->mynum, mech, buf); 00720 } 00721 }
Definition at line 773 of file autopilot_ai.c.
References mech_heading(), MechDesiredFacing, and AUTO::mynum.
Referenced by ai_adjust_move().
00774 { 00775 char buf[128]; 00776 00777 if(dir == MechDesiredFacing(mech)) 00778 return; 00779 sprintf(buf, "%d", dir); 00780 mech_heading(a->mynum, mech, buf); 00781 }
Definition at line 757 of file autopilot_ai.c.
References FBOUNDED(), mech_speed(), MechDesiredSpeed, MMaxSpeed, AUTO::mynum, SBUF_SIZE, and AUTO::speed.
Referenced by ai_adjust_move(), auto_astar_follow_event(), auto_astar_goto_event(), auto_astar_roam_event(), auto_dumbgoto_event(), auto_enter_event(), auto_goto_event(), auto_leave_event(), slow_down_if_neccessary(), and speed_up_if_neccessary().
00758 { 00759 char buf[SBUF_SIZE]; 00760 float newspeed; 00761 00762 if(!mech || !a) 00763 return; 00764 00765 newspeed = FBOUNDED(0, spd, ((MMaxSpeed(mech) * a->speed) / 100.0)); 00766 00767 if(MechDesiredSpeed(mech) != newspeed) { 00768 sprintf(buf, "%f", newspeed); 00769 mech_speed(a->mynum, mech, buf); 00770 } 00771 }
Definition at line 723 of file autopilot_ai.c.
References mech_speed(), MechDesiredSpeed, and AUTO::mynum.
Referenced by ai_check_path().
00724 { 00725 char buf[128]; 00726 00727 if(MechDesiredSpeed(mech) > 0.1) { 00728 strcpy(buf, "stop"); 00729 mech_speed(a->mynum, mech, buf); 00730 } 00731 }
Definition at line 331 of file autopilot_ai.c.
References COMBAT_SAFE, Destroyed, enemy_c, enemy_i, enemy_l, enemy_m, enemy_o, FindObjectsData(), MAP::first_free, FlMechRange, LOCInit(), MAP::mechsOnMap, MechStatus, and MechTeam.
Referenced by ai_check_path().
00332 { 00333 MECH *tempMech; 00334 int i; 00335 00336 if(reset) { 00337 for(i = 0; i < enemy_c; i++) { 00338 LOCInit(&enemy_l[i], enemy_m[i]); /* Just reset location */ 00339 enemy_o[i] = 0; 00340 } 00341 return 0; 00342 } 00343 enemy_c = 0; 00344 for(i = 0; i < map->first_free; i++) { 00345 tempMech = FindObjectsData(map->mechsOnMap[i]); 00346 if(!tempMech) 00347 continue; 00348 if(Destroyed(tempMech)) 00349 continue; 00350 if(MechStatus(tempMech) & COMBAT_SAFE) 00351 continue; 00352 if(MechTeam(tempMech) == MechTeam(mech)) 00353 continue; 00354 if(FlMechRange(map, mech, tempMech) > 50.0) 00355 continue; /* Inconsequential */ 00356 /* Something that is _possibly_ unnerving */ 00357 LOCInit(&enemy_l[enemy_c], tempMech); /* Location */ 00358 enemy_m[enemy_c] = tempMech; /* Mech data */ 00359 enemy_i[enemy_c++] = i; 00360 } 00361 return enemy_c; 00362 }
Definition at line 364 of file autopilot_ai.c.
References CLASS_MECH, Destroyed, FindObjectsData(), MAP::first_free, FlMechRange, friend_c, friend_i, friend_l, friend_m, friend_o, LOCInit(), MAP::mechsOnMap, MechTeam, and MechType.
Referenced by ai_check_path().
00365 { 00366 MECH *tempMech; 00367 int i; 00368 00369 if(reset) { 00370 for(i = 0; i < friend_c; i++) { 00371 LOCInit(&friend_l[i], friend_m[i]); /* Just reset location */ 00372 friend_o[i] = 0; 00373 } 00374 return 0; 00375 } 00376 friend_c = 0; 00377 for(i = 0; i < map->first_free; i++) { 00378 tempMech = FindObjectsData(map->mechsOnMap[i]); 00379 if(!tempMech) 00380 continue; 00381 if(Destroyed(tempMech)) 00382 continue; 00383 if(MechTeam(tempMech) != MechTeam(mech)) 00384 continue; 00385 if(MechType(tempMech) != CLASS_MECH) 00386 continue; 00387 if(FlMechRange(map, mech, tempMech) > 50.0) 00388 continue; /* Inconsequential */ 00389 LOCInit(&friend_l[friend_c], tempMech); /* Location */ 00390 friend_m[friend_c] = tempMech; /* Mech data */ 00391 friend_i[friend_c++] = i; 00392 } 00393 return friend_c; 00394 }
Definition at line 932 of file autopilot_ai.c.
References args, DOCHECK, FindTargetDBREFFromMapNumber(), getMech(), mech_parseattributes(), mech_snipe_func(), multi_weap_sel(), target_mech, and WizRoy.
00933 { 00934 char *args[3]; 00935 dbref d; 00936 00937 DOCHECK(!WizRoy(player), "Permission denied."); 00938 DOCHECK(mech_parseattributes(buffer, args, 3) != 2, 00939 "Please supply target ID _and_ weapon(s) to use"); 00940 DOCHECK((d = 00941 FindTargetDBREFFromMapNumber(mech, args[0])) <= 0, 00942 "Invalid target!"); 00943 target_mech = getMech(d); 00944 multi_weap_sel(mech, player, args[1], 1, mech_snipe_func); 00945 00946 }
Definition at line 109 of file autopilot_ai.c.
References auto_reply(), and SendAI.
Referenced by ai_check_path().
00110 { 00111 auto_reply(m, msg); 00112 SendAI(msg); 00113 }