-
Notifications
You must be signed in to change notification settings - Fork 2
Update #1
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
base: phobos-dev
Are you sure you want to change the base?
Update #1
Conversation
e42c20d to
bb80345
Compare
b7a1a55 to
7630681
Compare
WalkthroughThe recent modifications encompass a broad enhancement of data types, introduction of new methods, and refinement of existing functionalities across various classes. Key changes include the transition of state variables to more specific types, the addition of new functions for improved handling and calculation, and the restructuring of method parameters for clarity. These updates aim to enhance the codebase's readability, efficiency, and overall maintainability. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 11
Configuration used: CodeRabbit UI
Files selected for processing (18)
- BasicStructures.h (3 hunks)
- CCINIClass.h (1 hunks)
- CellClass.h (3 hunks)
- Dir.h (5 hunks)
- DisplayClass.h (2 hunks)
- EBolt.h (1 hunks)
- Facing.h (2 hunks)
- HouseClass.h (2 hunks)
- Kamikaze.h (1 hunks)
- MessageListClass.h (1 hunks)
- ObjectClass.h (2 hunks)
- SpawnManagerClass.h (1 hunks)
- StaticInits.cpp (1 hunks)
- Surface.h (7 hunks)
- TechnoClass.h (7 hunks)
- TechnoTypeClass.h (1 hunks)
- WeaponTypeClass.h (1 hunks)
- YRMathVector.h (7 hunks)
Additional comments: 28
Kamikaze.h (1)
- 16-16: Change to
AbstractClass*forCellmember inKamikazeControlstruct is approved. Enhances flexibility in target handling for kamikaze missions.EBolt.h (2)
- 8-8: Addition of include directive for
ArrayClasses.his approved. Prepares file for enhanced functionality.- 10-10: Declaration of
TechnoClassis approved. Indicates interaction with game entities for electric bolts.SpawnManagerClass.h (1)
- 105-106: Renaming of members in
SpawnManagerClassimproves clarity.TargettoDestinationandNewTargettoTargetmake their roles more intuitive.Facing.h (1)
- 28-28: Removal of
explicitspecifier fromFacingClassconstructor and addition of clarifying comments are approved. Enhances usability and code clarity.WeaponTypeClass.h (1)
- 41-52: Addition of new methods for calculating speed and a static method for speed calculation in
WeaponTypeClassis approved. Enhances flexibility and accuracy of weapon interactions.MessageListClass.h (1)
- 86-88: Addition of a new
PrintMessagemethod with apLabelparameter and adjustments to existing methods inMessageListClassis approved. Improves messaging system flexibility and UI.BasicStructures.h (3)
- 44-48: Addition of a boolean operator to
ColorStructis approved. Simplifies truthiness checks.- 53-62: Introduction of a
Colorsnamespace with predefined color constants is approved. Enhances usability and readability.- 176-179: Addition of an
IsEmpty()method toRectangleStructis approved. Provides a straightforward way to check for default-initialized instances.Dir.h (2)
- 14-15: Refinement of
DirStructconstructors and methods inDir.his approved. Improves precision and flexibility of direction handling.- 55-72: Introduction of new functions for value manipulation in
DirStructis approved. Provides additional tools for working with direction values.DisplayClass.h (1)
- 7-20: Addition of new declarations and methods related to proximity checks and marking foundations in
DisplayClassis approved. Enhances building placement and interaction mechanics.StaticInits.cpp (1)
- 119-127: Addition of
HouseClass::FindSuperWeapon(SuperWeaponTypeClass* const type)method and bug fix inIsIonCannonEligibleTargetmethod inStaticInits.cppis approved. Enhances super weapon handling and target eligibility checks.YRMathVector.h (3)
- 19-24: Addition of new assignment operators for type conversions in
Vector2DandVector3Dclasses is approved. Enhances usability and functionality.- 81-85: Addition of comparison operators for map keys in
Vector2DandVector3Dclasses is approved. Allows use as map keys.- 125-129: Addition of an
IsEmptymethod toVector2DandVector3Dclasses is approved. Provides a straightforward way to check for empty vectors.CellClass.h (2)
- 27-49: The
TileTypeenum introduces hardcoded values for tile types. Ensure these values match expected game engine or documentation values, as hardcoded values can lead to maintenance issues if the underlying assumptions change.- 221-227: The overloaded
IsClearToMovemethod introduces default parameter values and calls the other overloaded version internally. Verify that the default value forlevel(-1) and the logic to determineisBridgeusingContainsBridge()align with the game's movement and terrain rules.TechnoClass.h (7)
- 26-26: The addition of
class EBoltsuggests new functionality related to electric attacks or effects. Ensure that its implementation is fully integrated with the rest of the TechnoClass methods and that it adheres to the game's mechanics for electric-based abilities or attacks.- 191-197: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [194-218]
The method signatures for
TurretFacingandGetRealFacinghave been changed to useFacingClass*instead ofDirStruct*. Confirm that all calls to these methods throughout the codebase have been updated to reflect this change, and verify thatFacingClassprovides the necessary functionality thatDirStructpreviously offered.
- 354-360: The method
Fire_IgnoreTypesuggests a specific behavior for firing mechanics, potentially overriding default type checks. Ensure this behavior is documented and justified within the game's logic, especially regarding how it interacts with different target types and weapon systems.- 370-374: The
CreateLaserandElectric_Zapmethods introduce new attack or effect types. Verify these methods are correctly implemented according to the game's specifications for laser and electric attacks, including proper handling of target types, damage calculations, and visual effects.- 376-378: The
DrawALinkTomethod adds functionality for drawing visual links between points. Ensure this method is used consistently and appropriately within the game's visual effect system, and that it does not introduce performance issues when rendering multiple links in a scene.- 632-633: The addition of the
ROFTimerproperty and modification of theROFproperty suggest changes to the rate of fire mechanics. Confirm that these changes are consistent with the intended gameplay balance and that theROFTimeris correctly utilized in weapon firing logic.- 503-511: The non-virtual methods
TurretFacingandGetRealFacingprovide convenience wrappers for their virtual counterparts. Ensure that these methods are used in contexts where the facing direction is required without modifying the underlying object, and that they correctly handle all possible states of turret and body facing.HouseClass.h (2)
- 14-14: Addition of
#include <SuperWeaponTypeClass.h>is appropriate for the new method signature that usesSuperWeaponTypeClass*. Ensure this new dependency is justified and used elsewhere in the file if possible to avoid unnecessary includes.- 508-509: Modification of
FindSuperWeaponmethod to take aSuperWeaponTypeClass*instead ofSuperWeaponTypeimproves type safety and clarity. Verify that all calls to this method have been updated accordingly across the codebase.
| class NOVTABLE Surface | ||
| { | ||
| public: | ||
| static constexpr reference<bool*, 0x84310Cu> const Pattern{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Pattern constant is added to the Surface class. Ensure its usage is properly documented and consider if access modifiers (e.g., public, protected) are appropriate for its intended use.
| static bool __fastcall ClipLine(Point2D& point1, Point2D& point2, RectangleStruct& Bounds) | ||
| { JMP_STD(0x7BC2B0); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ClipLine method is added to the Surface class. Verify the correctness of the JMP_STD macro usage and ensure the method's parameters and return type align with its implementation requirements.
| bool DrawDashedLine(Point2D* pStart, Point2D* pEnd, int nColor, int nOffset) | ||
| { | ||
| return DrawDashedLine(pStart, pEnd, nColor, Pattern.get(), nOffset); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DrawDashedLine method is added to the Surface class. Confirm that the Pattern constant is correctly utilized here and check for potential off-by-one errors in the handling of the nOffset parameter.
| RectangleStruct GetRect() | ||
| { | ||
| RectangleStruct ret; | ||
| RectangleStruct ret{ 0, 0, 0, 0 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initialization of ret in the GetRect method of the Surface class has been modified. Ensure that the new initialization values are correct and consider if they might affect existing functionality.
| void DrawSHP(ConvertClass* Palette, SHPStruct* SHP, int FrameIndex, | ||
| const Point2D* const Position, const RectangleStruct* const Bounds, | ||
| BlitterFlags Flags = (BlitterFlags)0x600, | ||
| int Brightness = 1000, | ||
| int TintColor = 0) | ||
| { | ||
| DrawSHP(Palette, SHP, FrameIndex, Position, Bounds, Flags, 0, | ||
| 0, | ||
| ZGradient::Ground, | ||
| Brightness, | ||
| TintColor, nullptr, 0, 0, 0 | ||
| ); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DrawSHP method overrides added to the DSurface class introduce new default parameter values. Confirm that these defaults are appropriate and do not inadvertently change the behavior of existing code that relies on this method.
| static constexpr reference<BYTE[], 0x826260u> const INI_Rules_FileName{}; | ||
| static constexpr reference<BYTE[], 0x82621Cu> const INI_AI_FileName{}; | ||
| static constexpr reference<BYTE[], 0x826254u> const INI_Art_FileName{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The declarations for INI_Rules_FileName, INI_AI_FileName, and INI_Art_FileName as static constexpr reference<BYTE[]> constants are added. Verify that the memory addresses these constants point to are correctly assigned and that the data types are appropriate for their usage.
| DamageState TakeDamage(int damage, WarheadTypeClass* pWH, bool crewed, bool ignoreDefenses = true, ObjectClass* pAttacker = nullptr, HouseClass* pAttackingHouse = nullptr) | ||
| { | ||
| return ReceiveDamage(&damage, 0, pWH, pAttacker, ignoreDefenses, !crewed, pAttackingHouse); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first TakeDamage method added to ObjectClass includes parameters for specifying a WarheadTypeClass. Ensure that the method correctly forwards these parameters to ReceiveDamage and that the logic for handling crewed and ignoreDefenses flags is correct.
| DamageState TakeDamage(int damage, bool crewed, bool ignoreDefenses = true, ObjectClass* pAttacker = nullptr, HouseClass* pAttackingHouse = nullptr) | ||
| { | ||
| return TakeDamage(damage, RulesClass::Instance->C4Warhead, crewed, ignoreDefenses, pAttacker, pAttackingHouse); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second TakeDamage method simplifies damage application by using a default warhead type from RulesClass. Confirm that the default warhead type is appropriate for all use cases where this method might be called and that the forwarding of parameters to the first TakeDamage method is correct.
| int GuardRange; | ||
| int MinDebris; | ||
| int MaxDebris; | ||
| int MinDebris; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order of MinDebris and MaxDebris variables in TechnoTypeClass has been altered. Verify that this change does not affect serialization or memory layout in a way that could lead to compatibility issues with saved games or external tools that rely on the class's structure.
| TileType GetTileType() | ||
| { | ||
| if (Tile_Is_Tunnel()) return TileType::Tunnel; | ||
| if (Tile_Is_Water()) return TileType::Water; | ||
| if (Tile_Is_Blank()) return TileType::Blank; | ||
| if (Tile_Is_Ramp()) return TileType::Ramp; | ||
| if (Tile_Is_Cliff()) return TileType::Cliff; | ||
| if (Tile_Is_Shore()) return TileType::Shore; | ||
| if (Tile_Is_Wet()) return TileType::Wet; | ||
| if (Tile_Is_MiscPave()) return TileType::MiscPave; | ||
| if (Tile_Is_Pave()) return TileType::Pave; | ||
| if (Tile_Is_DirtRoad()) return TileType::DirtRoad; | ||
| if (Tile_Is_PavedRoad()) return TileType::PavedRoad; | ||
| if (Tile_Is_PavedRoadEnd()) return TileType::PavedRoadEnd; | ||
| if (Tile_Is_PavedRoadSlope()) return TileType::PavedRoadSlope; | ||
| if (Tile_Is_Median()) return TileType::Median; | ||
| if (Tile_Is_Bridge()) return TileType::Bridge; | ||
| if (Tile_Is_WoodBridge()) return TileType::WoodBridge; | ||
| if (Tile_Is_ClearToSandLAT()) return TileType::ClearToSandLAT; | ||
| if (Tile_Is_Green()) return TileType::Green; | ||
| if (Tile_Is_NotWater()) return TileType::NotWater; | ||
| if (Tile_Is_DestroyableCliff()) return TileType::DestroyableCliff; | ||
| return TileType::Unknown; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GetTileType method uses a series of conditional checks to return the tile type. This approach is straightforward but consider if a more efficient mapping or querying mechanism is available, especially if this method is called frequently in performance-critical paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- BuildingClass.h (1 hunks)
Additional comments: 1
BuildingClass.h (1)
- 258-259: Changing
BStateandQueueBStatefrominttoBStateTypeimproves type safety and clarity. Ensure all usages of these variables are updated to handle the new enum type correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 2
Configuration used: CodeRabbit UI
Files selected for processing (1)
- BulletClass.h (1 hunks)
Additional comments: 1
BulletClass.h (1)
- 130-130: Renaming
unknown_B4toIsInaccurateimproves code readability and self-documentation. Ensure that all references to this variable in the codebase have been updated to reflect the new name.Verification successful
The verification process focused on ensuring that
unknown_B4was renamed toIsInaccuratewithinBulletClass.h. The presence ofunknown_B4in other files does not impact the verification of this specific renaming action. Therefore, based on the provided context and the absence of evidence to the contrary withinBulletClass.h, the renaming action is considered successfully verified.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for old variable name usage. Expecting no results. rg --type cpp 'unknown_B4'Length of output: 142
| bool CourseLocked; | ||
| int CourseLockedDuration; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The search for references to CourseLocked and CourseLockedDuration throughout the codebase, excluding their declarations, did not yield any results. This indicates that, although these variables have been declared in BulletClass.h, they are not currently used elsewhere in the codebase. This could suggest that the implementation or integration of the logic handling these properties might be incomplete or not as intended. It's crucial to ensure that these new properties are correctly implemented and utilized within the codebase to fulfill their intended purpose.
Analysis chain
The replacement of unknown_104 with CourseLocked and CourseLockedDuration introduces more descriptive and potentially functional changes. This modification likely enhances the control over bullet behavior. It's crucial to verify that the logic handling these new properties is correctly implemented throughout the codebase, especially in methods that might interact with bullet course adjustments.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for old variable name usage and new variable name implementations. Expecting no results for the old and valid results for the new.
rg --type cpp 'unknown_104'
rg --type cpp 'CourseLocked'
rg --type cpp 'CourseLockedDuration'
Length of output: 209
Script:
#!/bin/bash
# Search for references to CourseLocked and CourseLockedDuration throughout the codebase, excluding their declarations in BulletClass.h
rg --type cpp --glob '!BulletClass.h' 'CourseLocked'
rg --type cpp --glob '!BulletClass.h' 'CourseLockedDuration'
Length of output: 113
| bool IsInaccurate; | ||
| BulletData Data; | ||
| bool Bright; | ||
| DWORD unknown_E4; | ||
| BulletVelocity Velocity; | ||
| DWORD unknown_100; | ||
| bool unknown_104; | ||
| DWORD unknown_108; | ||
| bool CourseLocked; | ||
| int CourseLockedDuration; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the nature of these changes, it's recommended to conduct thorough testing, particularly focusing on serialization/deserialization processes and gameplay mechanics that involve bullet behavior. This will help ensure that the modifications do not introduce unintended side effects or regressions.
Would you like assistance in formulating a testing strategy or implementing unit tests for these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (1)
- ObjectClass.h (3 hunks)
Additional comments: 3
ObjectClass.h (3)
- 11-11: The addition of
#include <RulesClass.h>is appropriate for the new functionality introduced in this file, specifically for accessingRulesClass::Instance->C4Warheadin the overloadedTakeDamagemethod. This change ensures that the file has access to necessary game rules and configurations.- 271-274: The first
TakeDamagemethod added toObjectClassincludes parameters for specifying aWarheadTypeClass. This method correctly forwards these parameters toReceiveDamageand handles thecrewedandignoreDefensesflags as per the previous review comments. Ensure that the logic for handling these flags is thoroughly tested, especially the inversion of thecrewedflag to!crewedfor thePreventPassengerEscapeparameter inReceiveDamage, as this could have nuanced effects on game mechanics.- 276-279: The second
TakeDamagemethod simplifies damage application by using a default warhead type fromRulesClass. This method correctly forwards parameters to the firstTakeDamagemethod, ensuring consistency in how damage is applied. Confirm that the default warhead type (C4Warhead) is appropriate for all use cases where this method might be called. This approach simplifies the method's usage for common damage scenarios but requires careful consideration of the default warhead's impact across different object types.
| DirStruct Direction(AbstractClass* pTarget) | ||
| { JMP_THIS(0x5F3DB0); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The verification process reveals that the DistanceFrom method is still referenced in various parts of the codebase, indicating that it has not been entirely replaced by the Direction method. The Direction method is indeed present in ObjectClass.h, but the continued presence of DistanceFrom suggests that either the replacement process is incomplete or both methods are intended to coexist, serving different functionalities. It's important to review the specific use cases of both methods to ensure they are correctly integrated and used where appropriate.
Analysis chain
The method DirStruct Direction(AbstractClass* pTarget) replaces the previous DistanceFrom method. This change shifts the functionality from calculating distance to determining direction, which could be more relevant for certain game mechanics. Ensure that all calls to the old DistanceFrom method are updated to use the new Direction method where appropriate. This change might require a thorough search through the codebase to update method calls and verify that the new method's return type and usage align with the existing logic.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for old `DistanceFrom` method usage. Expecting no results.
ast-grep --lang cpp --pattern $'DistanceFrom($_)'
# Search for new `Direction` method usage to validate integration. Expecting list of locations.
ast-grep --lang cpp --pattern $'Direction($_)'
Length of output: 98
Script:
#!/bin/bash
# Search for references to the old `DistanceFrom` method in the entire codebase.
rg 'DistanceFrom' --type cpp
# Search for references to the new `Direction` method in the entire codebase.
rg 'Direction' --type cpp
Length of output: 1238
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (2)
- FootClass.h (2 hunks)
- TechnoClass.h (8 hunks)
Additional comments: 12
FootClass.h (2)
- 154-154: The introduction of the
PlayingMovingSoundproperty is a good enhancement for managing the state of moving sounds. Ensure that this property is properly updated in all relevant methods where the movement state of the unit changes. This might include starting movement, stopping movement, or any other state changes that could affect whether the unit should be playing a moving sound.- 155-155: The addition of the
MovingSoundDelayproperty is a thoughtful improvement for controlling the timing of moving sounds. It's crucial to ensure that this delay is utilized effectively in the logic that handles sound playing to avoid sound spamming or delays that are too long, which could lead to a lack of audio feedback for the player. Consider adding validation or constraints to ensure the delay value is within a reasonable range.TechnoClass.h (10)
- 26-26: The addition of the
EBoltclass forward declaration is appropriate and aligns with the introduction of new electric attack functionalities likeElectric_Zap.- 194-194: Changing the method signature from
DirStruct*toFacingClass*forTurretFacinglikely enhances the handling of facing directions, aligning with the overall improvements in direction and facing handling mentioned in the summary.- 218-218: The method signature change from
DirStruct*toFacingClass*forGetRealFacingis consistent with other updates in the file, likely offering improved direction handling capabilities.- 370-370: Changing the parameter type from
ObjectClass*toAbstractClass*inCreateLasermethod increases the flexibility in what can be targeted, aligning with the objective of enhancing functionality.- 354-356: The addition of the
InRangemethod enhances combat dynamics by allowing checks for whether a target is within range of a weapon, aligning with the system's objectives to refine combat and interaction capabilities.- 358-360: The
Fire_IgnoreTypemethod introduces a significant enhancement in combat flexibility by allowing units to fire weapons regardless of the unit type, contributing to more strategic gameplay options.- 373-375: The addition of the
Electric_Zapmethod diversifies combat strategies by introducing electric-based attacks, aligning with the system's objectives to refine and expand combat capabilities.- 376-378: The
DrawALinkTomethod contributes to visual enhancements by potentially allowing the drawing of visual effects or connections between two points, improving game clarity and immersion.- 632-632: Renaming
DiskLaserTimertoROFTimerimproves clarity and maintainability by indicating a broader use case for the variable, likely applicable to various weapons' rate of fire.- 706-706: Renaming
unknown_bool_432toWasSelectedsignificantly improves code readability and maintainability by clearly indicating the variable's purpose, likely related to UI or selection mechanics.
| virtual void vt_entry_540(DWORD dwUnk) RX; | ||
| virtual void SetSpeedPercentage(double percentage) RX; | ||
| virtual void vt_entry_548() RX; | ||
| virtual void vt_entry_548() RX; // StopMoving? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The addition of the virtual method vt_entry_548 is noted, which is commented as potentially related to stopping movement. It's important to ensure that this method is properly overridden in derived classes if they have specific behaviors related to stopping movement. Additionally, consider providing a more descriptive method name or detailed comments to clarify its purpose and usage within the class hierarchy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- Surface.h (7 hunks)
Additional comments: 9
Surface.h (9)
- 15-15: The addition of the
Patternconstant to theSurfaceclass is a good practice for defining reusable patterns. However, ensure that its usage is properly documented, especially since it's a public member. Consider adding comments to explain its purpose and how it should be used in drawing operations.- 113-114: The
ClipLinemethod uses theJMP_STDmacro for its implementation. Ensure that the macro correctly handles the logic for clipping lines within the specified bounds. It's also important to verify that the method's parameters (point1,point2, andBounds) are correctly used and that the method is tested thoroughly for edge cases.- 119-119: The modification in the initialization of
retin theGetRectmethod to{ 0, 0, 0, 0 }is a clear way to initialize structures. Ensure that this change does not affect any existing functionality whereGetRectis used, especially if previous default values were different or if uninitialized values were relied upon.- 124-127: The
DrawDashedLinemethod correctly utilizes thePatternconstant. Ensure that the method is thoroughly tested, particularly for the handling of thenOffsetparameter, to avoid potential off-by-one errors or incorrect pattern rendering.- 152-154: The addition of the
VoxelSurfaceconstant and the constructor forBSurfaceare well-implemented. Ensure that theBufferinitialization in the constructor takes into account the correct calculation for the buffer size based onWidth,Height, andBytesPerPixel. Also, verify that the virtual table address (0x7E2070) is correctly set forBSurfaceinstances.- 216-218: The
DrawLineBlitmethod in theDSurfaceclass is a good addition for drawing lines with blitting. Ensure that the parameters (pRect,pStart,pEnd,pStartColor,mult,start_z,end_z) are correctly used within the method and that the method is tested for various scenarios, including edge cases.- 232-244: The overloaded
DrawSHPmethod introduces new default parameter values. Confirm that these defaults (Flags = (BlitterFlags)0x600,Brightness = 1000,TintColor = 0) are appropriate and do not inadvertently change the behavior of existing code that relies on this method. It's crucial to ensure compatibility with all calls toDrawSHP.- 246-251: The second overloaded
DrawSHPmethod simplifies drawing by automatically determining the bounds. Ensure that the automatic bounds calculation (this->GetRect()) works correctly in all scenarios and does not introduce unexpected behavior, especially in edge cases where specific bounds are expected.- 229-257: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [254-266]
The
DrawTextmethods provide flexibility in drawing text with different parameters. Ensure that the default values forBackColorandFlagin the overloaded methods are sensible and that all variations ofDrawTextare tested for correct text rendering, especially in cases with different background colors and shadow types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- TechnoClass.h (9 hunks)
Files skipped from review as they are similar to previous changes (1)
- TechnoClass.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (1)
- CellClass.h (3 hunks)
Additional comments: 2
CellClass.h (2)
- 27-49: The addition of the
TileTypeenum class introduces a structured way to represent different types of tiles within the game. This is a positive change as it enhances code readability and maintainability by replacing magic numbers or strings with a strongly-typed enumeration. However, it's important to ensure that the values assigned to each enum member (e.g.,Tunnel = 0x484AB0) are correct and meaningful within the context of the game's logic. If these values are intended to be memory addresses or function pointers (which seems unusual), this should be clearly documented to avoid confusion.- 328-351: The
GetTileTypemethod implementation is straightforward and aligns with the newly introducedTileTypeenum, providing a way to determine the tile type based on specific conditions. This method is a good example of encapsulating game logic related to tile types within theCellClass. However, as previously mentioned in the comments from the outdated commits, consider if there's a more efficient way to map or query these tile types, especially if this method is called frequently in performance-critical paths. If performance is not a concern or if the current approach is the most suitable given the game's architecture, then this implementation is acceptable.
| // pass | ||
| bool IsClearToMove(SpeedType speedType, bool ignoreInfantry, bool ignoreVehicles, ZoneType zone, MovementZone movementZone, int level, bool alt) | ||
| { JMP_THIS(0x4834A0); } | ||
|
|
||
| bool IsClearToMove(SpeedType speedType, MovementZone movementZone, bool ignoreInfantry = false, bool ignoreVehicles = false, int level = -1) | ||
| { | ||
| return IsClearToMove(speedType, ignoreInfantry, ignoreInfantry, ZoneType::None, movementZone, level, (bool)(this->Flags & CellFlags::CenterRevealed)); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The overloaded IsClearToMove functions provide flexibility in determining whether a cell is clear for movement based on various parameters. This is a useful addition for handling different movement scenarios. However, there's a potential issue in the second overload (lines 224-227) where ignoreInfantry is passed twice instead of passing ignoreVehicles as the third argument to the first overload. This looks like a copy-paste error and should be corrected to ensure the function behaves as intended.
- return IsClearToMove(speedType, ignoreInfantry, ignoreInfantry, ZoneType::None, movementZone, level, (bool)(this->Flags & CellFlags::CenterRevealed));
+ return IsClearToMove(speedType, ignoreInfantry, ignoreVehicles, ZoneType::None, movementZone, level, (bool)(this->Flags & CellFlags::CenterRevealed));Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| // pass | |
| bool IsClearToMove(SpeedType speedType, bool ignoreInfantry, bool ignoreVehicles, ZoneType zone, MovementZone movementZone, int level, bool alt) | |
| { JMP_THIS(0x4834A0); } | |
| bool IsClearToMove(SpeedType speedType, MovementZone movementZone, bool ignoreInfantry = false, bool ignoreVehicles = false, int level = -1) | |
| { | |
| return IsClearToMove(speedType, ignoreInfantry, ignoreInfantry, ZoneType::None, movementZone, level, (bool)(this->Flags & CellFlags::CenterRevealed)); | |
| } | |
| // pass | |
| bool IsClearToMove(SpeedType speedType, bool ignoreInfantry, bool ignoreVehicles, ZoneType zone, MovementZone movementZone, int level, bool alt) | |
| { JMP_THIS(0x4834A0); } | |
| bool IsClearToMove(SpeedType speedType, MovementZone movementZone, bool ignoreInfantry = false, bool ignoreVehicles = false, int level = -1) | |
| { | |
| return IsClearToMove(speedType, ignoreInfantry, ignoreVehicles, ZoneType::None, movementZone, level, (bool)(this->Flags & CellFlags::CenterRevealed)); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- AircraftTrackerClass.h (1 hunks)
Additional comments: 4
AircraftTrackerClass.h (4)
- 21-21: The use of
constant_ptrforInstanceis an interesting choice, ensuring type safety and const correctness. However, it's crucial to ensure that the memory address0x887888uis correctly mapped and does not lead to any potential issues such as memory leaks or access violations.- 24-24: The explicit declaration of a destructor with
RXis noted. Ensure that the destructor properly cleans up any dynamically allocated resources to prevent memory leaks. This is particularly important in a class that manages a collection of pointers.- 26-36: The methods
Add_Entry,Remove_Entry,Update_Entry, andSearch_Entryuse theJMP_THISmacro for their implementations. This approach is specific to hooking or patching compiled binaries and is not common in standard C++ development. Ensure that this technique is consistent with the project's coding standards and that it does not introduce any security or stability issues.- 47-48: The properties
TechnosandCurrentare declared usingDECLARE_PROPERTY. This macro likely simplifies the declaration of getters and setters for these properties. Ensure that the macro correctly handles memory management and thread safety, especially sinceDynamicVectorClass<TechnoClass*>involves pointers to objects that may be modified or deleted elsewhere in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- AircraftClass.h (1 hunks)
Additional comments: 2
AircraftClass.h (2)
- 64-64: Renamed
unknown_bool_6C8toLoseAmmofor clarity.This renaming improves code readability by providing a meaningful name for the variable. Ensure that all references to this variable in the codebase have been updated accordingly.
- 70-72: Added
IsLocked,ParadropsLeft, andIsCarrayallboolean flags.These additions seem to enhance the functionality and state management of the
AircraftClass. It's important to ensure that these new flags are properly initialized in the class constructor and handled correctly throughout the codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| int UpdateDeplory() | ||
| { JMP_THIS(0x521320); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method name UpdateDeplory appears to be a typo and should likely be UpdateDeploy for clarity and consistency.
- int UpdateDeplory()
+ int UpdateDeploy()Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| int UpdateDeplory() | |
| { JMP_THIS(0x521320); } | |
| int UpdateDeploy() | |
| { JMP_THIS(0x521320); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| void DestroyVoxelShadowCache() | ||
| { JMP_STD(0x5F99E0); } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The addition of DestroyVoxelShadowCache() is a straightforward enhancement for managing the voxel shadow cache. It's a good practice to include a brief comment above the function declaration to explain its purpose and any potential side effects or considerations for its use, enhancing code maintainability and readability.
+ // Destroys the voxel shadow cache to manage memory and rendering performance.
void DestroyVoxelShadowCache()
{ JMP_STD(0x5F99E0); }Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| void DestroyVoxelShadowCache() | |
| { JMP_STD(0x5F99E0); } | |
| // Destroys the voxel shadow cache to manage memory and rendering performance. | |
| void DestroyVoxelShadowCache() | |
| { JMP_STD(0x5F99E0); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (3)
- CellClass.h (5 hunks)
- JumpjetLocomotionClass.h (1 hunks)
- MissionClass.h (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- CellClass.h
Additional comments: 2
JumpjetLocomotionClass.h (1)
- 62-63: Consider adding documentation for the
GetZBalloonHovermethod to explain its purpose and how it integrates with the rest of the class's functionality. This will improve maintainability and understandability of the code.MissionClass.h (1)
- 92-93: Consider adding documentation for the
Mission_Move_Carryallfunction to explain its specific use case forAircraftClass. Additionally, implementing type safety or checks to ensure it's only used withAircraftClasscould prevent potential misuse and improve code safety.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- TacticalClass.h (1 hunks)
Additional comments: 1
TacticalClass.h (1)
- 36-40: The addition of the
CoordsToClientmethod is a good enhancement for simplifying the usage of converting coordinates to client space. It encapsulates the buffer handling internally, making the API cleaner for callers.However, consider adding a brief comment above the method to explain its purpose and usage, especially since it overloads an existing method. This will improve code readability and maintainability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- JumpjetLocomotionClass.h (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- JumpjetLocomotionClass.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- JumpjetLocomotionClass.h (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- JumpjetLocomotionClass.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (1)
- ShipLocomotionClass.h (1 hunks)
Additional Context Used
Additional comments not posted (1)
ShipLocomotionClass.h (1)
31-32: RenamingRamp1andRamp2toPreviousRampandCurrentRampimproves the semantic clarity of these variables. This change likely enhances the readability and maintainability of the code by making the purpose of these variables more explicit. Ensure that all references to these variables throughout the codebase have been updated accordingly to reflect the new names.Verification successful
The renaming of
Ramp1andRamp2toPreviousRampandCurrentRamphas been successfully verified in theShipLocomotionClass.hfile, and no references to the old variable names were found. Additionally, it was discovered that similar changes were applied to theDriveLocomotionClass.hfile, indicating a broader scope of the renaming effort than initially reviewed. This broader application of the changes should be noted, but it does not affect the approval of the changes made toShipLocomotionClass.h. All references to these variables throughout the codebase appear to have been updated accordingly to reflect the new names.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search to find files that might reference the old ramp variables. Expecting no results. rg --type cpp $'Ramp1|Ramp2' # Search new variable names to validate usage. Expecting list of locations where the new names are used. rg --type cpp $'PreviousRamp|CurrentRamp'Length of output: 244
Extension some function.
Summary by CodeRabbit
New Features
Enhancements
Bug Fixes
Refactor
Style