Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! 2.6/7 » The Academy » Enemy SB can force two allyers to fight each other?
Re: Enemy SB can force two allyers to fight each other? Mon, 29 June 2009 09:43 Go to previous messageGo to previous message
magic9mushroom is currently offline magic9mushroom

 
Commander

Messages: 1361
Registered: May 2008
wasp wrote on Sat, 06 June 2009 02:58

XyliGUN wrote on Sat, 19 November 2005 05:00

According to Starbase FAQ:
Quote:

Another weird situation is that if race B shows up and everyone has set everyone to friend but your default order is to "attack everyone" (which matters for your starbase) than the two friends will shoot each other while your starbase (again none of your ships present) sits back and watches ...

There is a situation where SB can force two allyers to attack each other.



I think I have nailed this one down. Cool Somewhere in the target selection algorithm ther must be code that looks something like

int who = battle_plans[starbase_owner][0].attack_who;

switch(who) {
    case NOBODY:
       break;
    case ENEMIES:
    case FRIENDS_ENEMIES:
       /* skipped, these work correctly */
       break;
    case EVERYONE: /* BUG!! */
       targets[fleet_owner] |= ~(1 << starbase_owner);
       break;
    default: /* BUG!! */
       targets[fleet_owner] |= 1 << (who - 4);
}


fleet_owner is uninitialized at this point, and starbase_owner should be used instead. It appears that fleet_value usually contains a valid race number from a previous call to this function leading to the behaviour observed by Ptolemy.

However, in unfortunate cases
(for example, try it with every fleet in the galaxy in the same battle), fleet_owner is garbage, resulting in a buffer overrun and the game crashing or worse. Note that setting the default battle plan to either attack everyone or a single race will trigger this bug.

Luckily a small patch to the binary is enough to fix this. Very Happy I put up a fixed version of JRC4 on my site.


Oh my, now that's dedication.

Be sure to tell the FreeStars people.

Report message to a moderator

 
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: What's the difference???
Next Topic: exploding minefields
Goto Forum:
  


Current Time: Sun Jun 16 20:43:51 EDT 2024