Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] it feels a little ugly to have a few random config checks in the middle of this function, so maybe w

[DiscordArchive] it feels a little ugly to have a few random config checks in the middle of this function, so maybe w

[DiscordArchive] it feels a little ugly to have a few random config checks in the middle of this function, so maybe w

rektbyfaith
Administrator
0
02-24-2025, 08:44 PM
#1
Archived author: Takenbacon • Posted: 2025-02-24T20:44:00.454000+00:00
Original source

it feels a little ugly to have a few random config checks in the middle of this function, so maybe we just validate after?
rektbyfaith
02-24-2025, 08:44 PM #1

Archived author: Takenbacon • Posted: 2025-02-24T20:44:00.454000+00:00
Original source

it feels a little ugly to have a few random config checks in the middle of this function, so maybe we just validate after?

rektbyfaith
Administrator
0
02-24-2025, 08:47 PM
#2
Archived author: Takenbacon • Posted: 2025-02-24T20:47:47.408000+00:00
Original source

encapsulating it in a function looks a little better, but still feels out of place. ‍♂️

``` SetConfigValue<float>(RATE_HEALTH, "Rate.Health", 1, ConfigData::Reloadable::Yes, [](float& value)
{
if (value < 0)
{
LOG_ERROR("server.loading", "Rate.Health ({}) must be > 0. Using 1 instead.", value);
value = 1;
}
});```
rektbyfaith
02-24-2025, 08:47 PM #2

Archived author: Takenbacon • Posted: 2025-02-24T20:47:47.408000+00:00
Original source

encapsulating it in a function looks a little better, but still feels out of place. ‍♂️

``` SetConfigValue<float>(RATE_HEALTH, "Rate.Health", 1, ConfigData::Reloadable::Yes, [](float& value)
{
if (value < 0)
{
LOG_ERROR("server.loading", "Rate.Health ({}) must be > 0. Using 1 instead.", value);
value = 1;
}
});```

rektbyfaith
Administrator
0
02-24-2025, 08:53 PM
#3
Archived author: Tereneckla • Posted: 2025-02-24T20:53:15.390000+00:00
Original source

more generic? just a lambda that returns a boolean + text
rektbyfaith
02-24-2025, 08:53 PM #3

Archived author: Tereneckla • Posted: 2025-02-24T20:53:15.390000+00:00
Original source

more generic? just a lambda that returns a boolean + text

rektbyfaith
Administrator
0
02-24-2025, 08:57 PM
#4
Archived author: Tereneckla • Posted: 2025-02-24T20:57:06.640000+00:00
Original source

```cpp
SetConfigValue<float>(RATE_HEALTH, "Rate.Health", 1, ConfigData::Reloadable::Yes, [](float& value){ return value < 0;}, "> 0");
```
rektbyfaith
02-24-2025, 08:57 PM #4

Archived author: Tereneckla • Posted: 2025-02-24T20:57:06.640000+00:00
Original source

```cpp
SetConfigValue<float>(RATE_HEALTH, "Rate.Health", 1, ConfigData::Reloadable::Yes, [](float& value){ return value < 0;}, "> 0");
```

rektbyfaith
Administrator
0
02-24-2025, 08:57 PM
#5
Archived author: Takenbacon • Posted: 2025-02-24T20:57:36.462000+00:00
Original source

but that would change functionality
rektbyfaith
02-24-2025, 08:57 PM #5

Archived author: Takenbacon • Posted: 2025-02-24T20:57:36.462000+00:00
Original source

but that would change functionality

rektbyfaith
Administrator
0
02-24-2025, 08:58 PM
#6
Archived author: Tereneckla • Posted: 2025-02-24T20:58:51.912000+00:00
Original source

it would be less customizable, but would be enough for validating
rektbyfaith
02-24-2025, 08:58 PM #6

Archived author: Tereneckla • Posted: 2025-02-24T20:58:51.912000+00:00
Original source

it would be less customizable, but would be enough for validating

rektbyfaith
Administrator
0
02-24-2025, 09:03 PM
#7
Archived author: Takenbacon • Posted: 2025-02-24T21:03:42.124000+00:00
Original source

works for me. if fails validation use default value and log an error
rektbyfaith
02-24-2025, 09:03 PM #7

Archived author: Takenbacon • Posted: 2025-02-24T21:03:42.124000+00:00
Original source

works for me. if fails validation use default value and log an error

rektbyfaith
Administrator
0
02-24-2025, 09:16 PM
#8
Archived author: Takenbacon • Posted: 2025-02-24T21:16:57.009000+00:00
Original source

definitely looks a lot better not having random ass if statements
[Image: image.png?ex=690c6788&is=690b1608&hm=42e...896b2ecda&]
rektbyfaith
02-24-2025, 09:16 PM #8

Archived author: Takenbacon • Posted: 2025-02-24T21:16:57.009000+00:00
Original source

definitely looks a lot better not having random ass if statements
[Image: image.png?ex=690c6788&is=690b1608&hm=42e...896b2ecda&]

rektbyfaith
Administrator
0
02-24-2025, 09:22 PM
#9
Archived author: sudlud • Posted: 2025-02-24T21:22:04.518000+00:00
Original source

Sweet
rektbyfaith
02-24-2025, 09:22 PM #9

Archived author: sudlud • Posted: 2025-02-24T21:22:04.518000+00:00
Original source

Sweet

rektbyfaith
Administrator
0
02-24-2025, 11:15 PM
#10
Archived author: walkline • Posted: 2025-02-24T23:15:23.786000+00:00
Original source

<@160329888107069440> I think I made an initial implementation of your suggestion - https://github.com/walkline/azerothcore-...6f6be5def4
But to be honest, in my tests, the original ground position finding (with placing a dot) works well, or at least, I haven’t encountered any issues with it on WMOs or places with vmaps support. I have a feeling that the client tolerates the approach we are currently using in the core. However, I would be glad to be proven wrong.
rektbyfaith
02-24-2025, 11:15 PM #10

Archived author: walkline • Posted: 2025-02-24T23:15:23.786000+00:00
Original source

<@160329888107069440> I think I made an initial implementation of your suggestion - https://github.com/walkline/azerothcore-...6f6be5def4
But to be honest, in my tests, the original ground position finding (with placing a dot) works well, or at least, I haven’t encountered any issues with it on WMOs or places with vmaps support. I have a feeling that the client tolerates the approach we are currently using in the core. However, I would be glad to be proven wrong.

Recently Browsing
 
Recently Browsing