Re: Enemy SB can force two allyers to fight each other? |
Tue, 22 November 2005 21:06 |
|
|
Quote: | 3. ALL attacking players must have a lower player number than the player number of the player with the defending starbase. If one attacking player is a higher player number the bug doesn't trigger.
|
I will re-check the test and verify then I will update the post.
Ptolemy
Though we often ask how and why, we must also do to get the answers to the questions.Report message to a moderator
|
|
|
Re: Enemy SB can force two allyers to fight each other? |
Tue, 22 November 2005 23:07 |
|
|
Note that this problem gets wierder the more tests that are done. Defending ships can be in the battle and the allies still kill each other. Additionally, I haven't been able to get a ship set to freind of all the races on the battle board.
Ptolemy
Though we often ask how and why, we must also do to get the answers to the questions.Report message to a moderator
|
|
|
|
|
|
Re: Enemy SB can force two allyers to fight each other? |
Mon, 29 June 2009 09:43 |
|
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. 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. 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
|
|
|
|