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

Cleaned up the mapflag system #2943

Merged
merged 15 commits into from Jul 19, 2018
Merged

Cleaned up the mapflag system #2943

merged 15 commits into from Jul 19, 2018

Conversation

aleos89
Copy link
Contributor

@aleos89 aleos89 commented Feb 28, 2018

  • Addressed Issue(s): N/A

  • Server Mode: Pre-renewal and Renewal

  • Description of Pull Request:

    • Created setter and getter functions.
    • Adjusted all calls to use these functions.
    • Cleaned up several functions to be more dynamic to reduce redundancy that was all over the place.
    • Renamed nosumstarmiracle to nosunmoonstarmiracle.
    • Adjusted skill_damage mapflag to use proper defined constants.
      Thanks to @Lemongrass3110 for a lot of help!

* Created setter and getter functions.
* Adjusted all calls to use these functions.
* Cleaned up several functions to be more dynamic to reduce redundancy that was all over the place.
* Renamed nosumstarmiracle to nosunmoonstarmiracle.
* Adjusted skill_damage mapflag to use proper defined constants.
Thanks to @Lemongrass3110 for a lot of help!
@aleos89 aleos89 added the status:code-review Pull Request that requires reviewing from other developers before being pushed to master label Feb 28, 2018
@mrjnumber1
Copy link

really like this change, ideally adding a new mapflag is as painless as possible and all these cases are handled dynamically though.

Copy link
Member

@secretdataz secretdataz left a comment

Choose a reason for hiding this comment

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

Looks better overall.
The struct map_flag inside struct map_data could be converted to a key-value map for a more simpler map-flag adding procedure when we need to add one.
This way we could get rid of all cases in the switch in the getter and setter function on map-flags and only care for ones that need special handling.

sd->pvp_lost = 0;
mf = script_getnum(st, 3);

if( mf <= MF_MIN || mf > MF_MAX ){
Copy link
Member

Choose a reason for hiding this comment

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

Should be mf < MF_MIN or adjust MF_MIN's value since it shares the same value with MF_NOMEMO.

Copy link
Member

Choose a reason for hiding this comment

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

There are more occurrences of this but I forgot to comment ;w;

src/map/map.cpp Outdated
@@ -4319,37 +4319,493 @@ void map_skill_damage_free(struct map_data *m) {
* @param other Rate to Other target
* @param caster Caster type
**/
void map_skill_damage_add(struct map_data *m, uint16 skill_id, int pc, int mob, int boss, int other, uint8 caster) {
void map_skill_damage_add(struct map_data *m, uint16 skill_id, int rate[SKILLDMG_MAX], uint16 caster) {
Copy link
Member

Choose a reason for hiding this comment

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

Array size has no effect in this context. It will be converted into a pointer anyways.

sd->pvp_lost = 0;
mf = script_getnum(st, 3);

if( mf <= MF_MIN || mf > MF_MAX ){
Copy link
Member

Choose a reason for hiding this comment

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

Should be mf < MF_MIN or adjust MF_MIN's value since it currently shares the same value with MF_NOMEMO, making the flag unavailable.

@aleos89 aleos89 added the status:inprogress Issue that has begun resolution by a developer label Apr 5, 2018
* Converted mapflags to C++ map container.
* This allows for much more simple and less code than previously required.
* Converted drop_list to vector.
* Converted skill_damage ERS into vector and increased limit from UINT8 to UINT16.
Thanks to @Lemongrass3110!
* Refactored global maps into a vector.
* Resolves sketchy memmoves when deleting maps.
Thanks to @Lemongrass3110!
@aleos89 aleos89 removed the status:inprogress Issue that has begun resolution by a developer label Jul 11, 2018
* Enumerated nightmare mapflag drop types.
* Refactored some final direct mapflag adjustments.
* Adjusted map ID check to also check for the cap.
* Converted map_setmapflag_sub to return bool.
* Cleaned up initialization of mapflag union arguments to C++ standard.
* Corrected MF_SKILL_DAMAGE error message.
* Adjusted a few final things.
Thanks to @Lemongrass3110!
@aleos89 aleos89 merged commit a942853 into master Jul 19, 2018
@aleos89 aleos89 deleted the cleanup/mapflags branch July 19, 2018 00:00
@aleos89 aleos89 removed the status:code-review Pull Request that requires reviewing from other developers before being pushed to master label Jul 19, 2018
@ghost ghost mentioned this pull request Jul 19, 2018
SeravySensei pushed a commit to SeravySensei/rathena that referenced this pull request Jan 26, 2019
* Created setter and getter functions.
* Adjusted all calls to use these functions.
* Converted mapflags to C++ map container.
* Converted drop_list to vector.
* Converted skill_damage ERS into vector and increased limit from UINT8 to UINT16.
* Cleaned up several functions to be more dynamic to reduce redundancy that was all over the place.
* Renamed nosumstarmiracle to nosunmoonstarmiracle.
* Adjusted skill_damage mapflag to use proper defined constants.
* Refactored map index into a vector.
Thanks to @Lemongrass3110 for a lot of help and @secretdataz!
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.

None yet

4 participants