Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring of existing cheats (see #1679) #1688

Merged
merged 18 commits into from
Dec 14, 2024

Conversation

kubaau
Copy link
Contributor

@kubaau kubaau commented Jul 28, 2024

First few commits from PR #1679 :

  • refactors existing cheat code ("winter" code, toggle human AI player, armageddon) into new Cheats and CheatCommandTracker classes

Copy link
Member

@Flamefire Flamefire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great use of the circular buffer, good idea!

It does make sense to separate the cheats and the key/command tracker although I don't really like putting the cheats into the world class or having the command tracker be a part of the cheats creating a cyclic dependency and having to do cheats.trackX -> tracker.trackX

So maybe add an instance of each class to the game interface?

libs/s25main/world/GameWorldBase.h Outdated Show resolved Hide resolved
libs/s25main/CheatCommandTracker.cpp Outdated Show resolved Hide resolved
libs/s25main/CheatCommandTracker.cpp Outdated Show resolved Hide resolved
libs/s25main/CheatCommandTracker.cpp Show resolved Hide resolved
libs/s25main/CheatCommandTracker.cpp Outdated Show resolved Hide resolved
libs/s25main/Cheats.h Outdated Show resolved Hide resolved
libs/s25main/Cheats.h Outdated Show resolved Hide resolved
libs/s25main/desktops/dskGameInterface.cpp Outdated Show resolved Hide resolved
libs/s25main/desktops/dskGameInterface.cpp Show resolved Hide resolved
libs/s25main/Cheats.cpp Outdated Show resolved Hide resolved
@kubaau kubaau force-pushed the cheats_refactoring branch 2 times, most recently from 0aa5e63 to f6baefc Compare August 5, 2024 15:34
@kubaau kubaau requested a review from Flamefire August 5, 2024 15:47
@kubaau kubaau force-pushed the cheats_refactoring branch 3 times, most recently from 97793f3 to 0665d3d Compare December 13, 2024 23:01
@kubaau kubaau force-pushed the cheats_refactoring branch from 0665d3d to 5934fd7 Compare December 13, 2024 23:18
@kubaau kubaau force-pushed the cheats_refactoring branch from 5934fd7 to 92e9c95 Compare December 13, 2024 23:25
@kubaau
Copy link
Contributor Author

kubaau commented Dec 13, 2024

Great use of the circular buffer, good idea!

It does make sense to separate the cheats and the key/command tracker although I don't really like putting the cheats into the world class or having the command tracker be a part of the cheats creating a cyclic dependency and having to do cheats.trackX -> tracker.trackX

So maybe add an instance of each class to the game interface?

Moved CheatCommandTracker out of Cheats and into dskGameInterface as it is its only user.

@kubaau
Copy link
Contributor Author

kubaau commented Dec 13, 2024

@Flamefire Please review the updates. Sorry for the huge delay :D

@kubaau kubaau force-pushed the cheats_refactoring branch 2 times, most recently from 02cfb70 to 543fd96 Compare December 14, 2024 02:03
@kubaau kubaau force-pushed the cheats_refactoring branch from 543fd96 to e761d04 Compare December 14, 2024 02:06
Copy link
Member

@Flamefire Flamefire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks! But see the comment for the future.

tests/s25Main/integration/testCheats.cpp Show resolved Hide resolved
@Flamefire Flamefire merged commit 79fa5fe into Return-To-The-Roots:master Dec 14, 2024
21 checks passed
@kubaau kubaau deleted the cheats_refactoring branch December 14, 2024 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants