following up on a mines issue...

Describe your experience with the latest version of FreeOrion to help us improve it.

Moderator: Oberlus

Forum rules
Always mention the exact version of FreeOrion you are testing.

When reporting an issue regarding the AI, if possible provide the relevant AI log file and a save game file that demonstrates the issue.
Post Reply
Message
Author
User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

following up on a mines issue...

#1 Post by Dilvish »

from this post:
Afdal wrote:System defense mines attack allied teammates. I once blew up an entire fleet by accident my teammate was making on the very turn they finished production because we both owned planets in the same system and it was hilarious.
I had bookmarked this post to follow up on later when I had the chance, which I'm now doing. It looks to me that all the scope clauses of the mine techs include a restriction to

Code: Select all

OwnedBy EnemyOf Source.Owner
so the content scripting itself looks to me like it is fine. It's possible that the EnemyOf clause is not working right, but I can't help but wonder if there might also have been an enemy planet in that system (perhaps stealthed) which also was protected by mine tech. Before going through the trouble of setting up a suitable test I'd like to get some more evidence that there really is a problem with the mines. Afdal, if you're around and still have a saved game, screenshots or other info from that problem, or if anyone else has experience with allies and mines (whether successful experience or problematic) please post.

While I'm looking at mines, some of the followup discussion in that thread had proposed scaling damage by hull structure; it seems to me quite reasonable to let the mine damage be the greater of the current points damage (cumulative 2, 6, 14 for Mines I, II, III) or some % of max hull (I think the intent was to be more powerful than the 25% Adv Dmg Control repair), so how about scaling the %'s as 10%, 25%, 45% cumulative for Mines I, II, III ?
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: following up on a mines issue...

#2 Post by Geoff the Medio »

Looking at the code for the EmpireAfilliation condition, I'm inclined to think that EnemyOf isn't properly considering diplomatic status:

Code: Select all

 switch (m_affiliation) {
case AFFIL_SELF:
    return m_empire_id != ALL_EMPIRES && candidate->OwnedBy(m_empire_id);
    break;
case AFFIL_ENEMY:
    return m_empire_id != ALL_EMPIRES && !candidate->Unowned() && !candidate->OwnedBy(m_empire_id);
    break;
case AFFIL_ALLY: {
    if (m_empire_id == ALL_EMPIRES)
        return false;
    DiplomaticStatus status = Empires().GetDiplomaticStatus(m_empire_id, candidate->Owner());
    return (status == DIPLO_PEACE);
}
case AFFIL_ANY:
    return true;
    //return !candidate->Unowned();
    break;
default:
    return false;
    break;
}
AFFIL_ALLY could probably do with a break; at the end as well.

User avatar
Bigjoe5
Designer and Programmer
Posts: 2058
Joined: Tue Aug 14, 2007 6:33 pm
Location: Orion

Re: following up on a mines issue...

#3 Post by Bigjoe5 »

On a tangential note, I'm really confused as to why any of those return statements need breaks after them.
Warning: Antarans in dimensional portal are closer than they appear.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: following up on a mines issue...

#4 Post by Geoff the Medio »

Bigjoe5 wrote:On a tangential note, I'm really confused as to why any of those return statements need breaks after them.
Just to be consistent / formal. Making a habit of putting them in means you're less likely to forget when when it is actually necessary...

User avatar
em3
Vacuum Dragon
Posts: 630
Joined: Sun Sep 25, 2011 2:51 pm

Re: following up on a mines issue...

#5 Post by em3 »

Geoff the Medio wrote:
Bigjoe5 wrote:On a tangential note, I'm really confused as to why any of those return statements need breaks after them.
Just to be consistent / formal. Making a habit of putting them in means you're less likely to forget when when it is actually necessary...
I'm surprised this code does not raise "unreachable code" warnings on some compilers.
https://github.com/mmoderau
[...] for Man has earned his right to hold this planet against all comers, by virtue of occasionally producing someone totally batshit insane. - Randall Munroe, title text to xkcd #556

Post Reply