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

fix missing scoreboard for battleground type 2 #2849

Merged

Conversation

AnnieRuru
Copy link
Contributor

@AnnieRuru AnnieRuru commented Sep 25, 2020

Pull Request Prelude

Issues addressed

#2848

Changes Proposed

cap the value as 1 or 2 only
if it is 0, it becomes 1(default), and if it is over 2, becomes 2

guild_vs2	mapflag	battleground

tested is 1, because the sscanf return 0 didn't found w4

Affected Branches

  • Master

Known Issues and TODO List

blame #2654 ... yeah its @Emistry again

src/map/npc.c Outdated
@@ -5028,7 +5028,7 @@ static const char *npc_parse_mapflag(const char *w1, const char *w2, const char
struct map_zone_data *zone;
if (state != 0) {
if (w4 != NULL && sscanf(w4, "%d", &state) == 1)
map->list[m].flag.battleground = (state != 0) ? 1 : 0;
map->list[m].flag.battleground = cap_value(state, 1, 2);
Copy link
Contributor

Choose a reason for hiding this comment

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

may be better cap from 0? cap_value(state, 0, 2)
because with your code if put parameter as 0, it will be used as 1, i think this is wrong.

Copy link
Contributor Author

@AnnieRuru AnnieRuru Sep 26, 2020

Choose a reason for hiding this comment

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

	else if (strcmpi(w3, "battleground") == 0) {
		struct map_zone_data *zone;
		if (state != 0) {
			if (w4 != NULL && sscanf(w4, "%d", &state) == 1)
				map->list[m].flag.battleground = (state != 0) ? 1 : 0;
			else
				map->list[m].flag.battleground = 1; // Default value
		} else {
			map->list[m].flag.battleground = 0;
		}

wait, you mean we can use

prontera	mapflag	battleground	0
--same as--
//prontera	mapflag	battleground // not declare it

to turn off the mapflag ?? then what's the point of adding a mapflag line then ?


another point I want to make is this line works perfectly fine

setmapflag "prontera", MF_BATTLEGROUND, 2; 

src\map\script.c

static BUILDIN(setmapflag) {...
case MF_BATTLEGROUND: map->list[m].flag.battleground = (val <= 0 || val > 2) ? 1 : val; break;

even this line also said, if set type into 0, default to 1

Copy link
Contributor

@4144 4144 Sep 26, 2020

Choose a reason for hiding this comment

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

yes i mean this, but i not saw check before. it blocks 0 already. 0 goind in other branch of if.
this can be need if don't want remove map flag but want disable it.

hm, but may be add value validation check? and if it not valid, show error message?
because old and new code silently accept any values...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I really don't see the point of using value 0
there are already *removemapflag script command that can remove a mapflag

just changing the value 1 into 0 doesn't mean anything, but doing it doesn't cost me my arm or leg, so I'll do it

@AnnieRuru
Copy link
Contributor Author

just remember after doing this change, now will create inconsistent

prontera	mapflag	battleground	0

which doesn't do anything ...... !!!

while the *setmapflag script command can only set value 1 or 2

@Kenpachi2k13 Kenpachi2k13 added this to the Release v2020.11.16 milestone Oct 29, 2020
@Kenpachi2k13 Kenpachi2k13 linked an issue Oct 29, 2020 that may be closed by this pull request
@MishimaHaruna MishimaHaruna merged commit 0457b68 into HerculesWS:master Nov 16, 2020
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.

battleground type 2 score board has gone missing
4 participants