Update of /cvsroot/netrek/server/Vanilla/robotd In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26631/robotd Modified Files: assault.c decide.c defs.h robot.c Log Message: merge from jerub darcs 2006-05-12 Index: defs.h =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/defs.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- defs.h 22 Apr 2006 02:16:46 -0000 1.4 +++ defs.h 12 May 2006 03:44:48 -0000 1.5 @@ -227,7 +227,7 @@ /* client version of UDPDIAG */ #define UDPDIAG(x) { if (udpDebug) { printf("UDP: "); printf x; }} #define V_UDPDIAG(x) /*UDPDIAG(x)*/ -#endif +#endif /* ATM */ #define RANDOM() rand() #define SRANDOM(x) srand(x) Index: decide.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/decide.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- decide.c 22 Apr 2006 02:16:46 -0000 1.3 +++ decide.c 12 May 2006 03:44:48 -0000 1.4 @@ -238,18 +238,21 @@ else if(!unknownpl(_state.assault_planet) && _state.assault_planet->pl_armies < 5){ unassault_c("already bombed."); + check_ogg(NULL,20000); /* test JKH */ check_bomb(NULL); return; } if(myteam_bombing(_state.assault_planet, _state.assault_planet->pl_mydist)){ unassault_c("somebody else bombing"); + check_ogg(NULL,20000); /* test JKH */ check_bomb(NULL); return; } if(_state.assault_planet->pl_mydist < 20000 && pl_defended(_state.assault_planet, 2)){ unassault_c("planet defended"); + check_ogg(NULL,20000); /* test JKH */ check_bomb(NULL); return; } Index: robot.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/robot.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- robot.c 22 Apr 2006 02:16:46 -0000 1.3 +++ robot.c 12 May 2006 03:44:48 -0000 1.4 @@ -626,6 +626,7 @@ && MYFUEL() > 25) req_detonate(""); #endif + #ifdef nodef /* debug */ if(num_hits > 0 && me->p_speed > 6){ Index: assault.c =================================================================== RCS file: /cvsroot/netrek/server/Vanilla/robotd/assault.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- assault.c 22 Apr 2006 02:16:46 -0000 1.2 +++ assault.c 12 May 2006 03:44:48 -0000 1.3 @@ -43,6 +43,30 @@ } } +/* determine if there is risk of death due to res of opponent */ +static int risk_res_death(struct planet *pl) +{ + if (pl == NULL) return 0; + /* One of the home planets identified by server etc/sysdef PLANETS */ + if (pl->pl_flags & PLHOME) return 1; + /* Altair in standard position */ + if (pl->pl_no == 7 && pl->pl_x == 11000 && pl->pl_y == 75000) return 1; + /* Draconis in standard position */ + if (pl->pl_no == 16 && pl->pl_x == 28000 && pl->pl_y == 23000) return 1; + /* Scorpii in standard position */ + if (pl->pl_no == 26 && pl->pl_x == 70720 && pl->pl_y == 26320) return 1; + /* Within rectangular phaser distance of any home planet res point */ + int i; + for (i=0,pl=planets;i<MAXPLANETS;i++,pl++) { + if (pl->pl_flags & PLHOME) { + if(ABS(pl->pl_x - me->p_x) < 12000 && ABS(pl->pl_y - me->p_y) < 12000) { + return 1; + } + } + } + return 0; +} + goto_assault_planet() { Player *e = _state.closest_e; @@ -70,9 +94,18 @@ /* bug -- crashes into people */ /* don't cloak if we're far from planet */ + /* start within assuming you don't need cloak */ + cloak = 0; + if(!inl && pdist > 20000) cloak = 0; + /* cloak bomb near enemy core, so you don't get res-killed */ + + if (pdist < 7000) { + if (risk_res_death(pl)) cloak = 1; + } + if(pdist < 10000 && edist < 18000) cloak = 1; @@ -135,22 +168,32 @@ assault_planet() { - Player *e = _state.closest_e; - struct player *j = e?e->p:NULL; - struct planet *pl = _state.assault_planet; - int armies = pl->pl_armies; + Player *e = _state.closest_e; + struct player *j = e?e->p:NULL; + struct planet *pl = _state.assault_planet; + int cloak; + int armies = pl->pl_armies; #ifdef nodef if(!do_cloak(0)) req_cloak_off(); #endif - if(e && e->p && isAlive(e->p)){ - if(e->dist < 10000) - req_cloak_on(); - else - req_cloak_off("enemy farther than 10000"); + + cloak=0; /* start assuming you don't need to cloak */ + + if (e && e->p && isAlive(e->p)){ /* cloak when enemy is near */ + if(e->dist < 10000) { + cloak=1; + } } - + + /* cloak bomb near enemy core, so you don't get res-killed */ + if (risk_res_death(pl)) cloak = 1; + + if(cloak) + req_cloak_on(); + else + req_cloak_off("no cloak in assault_planet()"); if(armies > 4){ req_bomb();