tuomount / Open-Realms-of-Stars

4X Strategy game
GNU General Public License v2.0
134 stars 32 forks source link

Format Diplomacy code #721

Closed BottledByte closed 10 months ago

BottledByte commented 10 months ago

Reformat Diplomacy code to fix and reduce verbosity of comments, remove redundant fields and sort remaining fields. Also remove some duplicate code.

BottledByte commented 10 months ago

Additionally, there seems to be unused DiplomacyBonusType DIPLOMAT_CAPTURED. Can it be deleted? It appears to me that deletion could once again break save files (not an issue, just a note).

And there is a lot of hardcoded SpaceRace "flavor" code in Diplomacy code, that calculates "value" and "lasting" of a bonus based on race. IMHO this whole code should be scrapped and replaced with constant bonuses for now. In the future, it could evaluate properties of a diplomacy bonus based on PlayerInfo.

@tuomount Are OK with deletion of DIPLOMAT_CAPTURED and removing DiplomacyBonus SpaceRace "flavor" (making it generic)? I would do a follow-up PR with said changes.

tuomount commented 10 months ago

Additionally, there seems to be unused DiplomacyBonusType DIPLOMAT_CAPTURED. Can it be deleted? It appears to me that deletion could once again break save files (not an issue, just a note).

At some point I had idea at there could way to capture diplomats, but that just wasn't done. So yes it can be deleted. It probably breaks save files, but that's fine as you said. Back when this was planned I had done leaders yet. If this would be done now it would something do with leaders.

And there is a lot of hardcoded SpaceRace "flavor" code in Diplomacy code, that calculates "value" and "lasting" of a bonus based on race. IMHO this whole code should be scrapped and replaced with constant bonuses for now. In the future, it could evaluate properties of a diplomacy bonus based on PlayerInfo.

Constant values seem fine. This can be also related to race traits. For example race with radiosynthesis would love if someone bombs planet with nukes, as long as it would not be their planets.

@tuomount Are OK with deletion of DIPLOMAT_CAPTURED and removing DiplomacyBonus SpaceRace "flavor" (making it generic)? I would do a follow-up PR with said changes.

Yes, both sound good.