Forums WoW Modding Support Archives TrinityCore Discord Archives [DiscordArchive] what is the reason for making Update return timePassed?

[DiscordArchive] what is the reason for making Update return timePassed?

[DiscordArchive] what is the reason for making Update return timePassed?

Pages (4): 1 2 3 4 Next
rektbyfaith
Administrator
0
06-11-2024, 04:43 PM
#1
Archived author: Tea • Posted: 2024-06-11T16:43:21.490000+00:00
Original source

what is the reason for making Update return timePassed?
rektbyfaith
06-11-2024, 04:43 PM #1

Archived author: Tea • Posted: 2024-06-11T16:43:21.490000+00:00
Original source

what is the reason for making Update return timePassed?

rektbyfaith
Administrator
0
06-11-2024, 04:44 PM
#2
Archived author: Takenbacon • Posted: 2024-06-11T16:44:28.430000+00:00
Original source

some functions want a diff, in which I'd rather give it the exact time rather than the interval
rektbyfaith
06-11-2024, 04:44 PM #2

Archived author: Takenbacon • Posted: 2024-06-11T16:44:28.430000+00:00
Original source

some functions want a diff, in which I'd rather give it the exact time rather than the interval

rektbyfaith
Administrator
0
06-11-2024, 04:44 PM
#3
Archived author: Tea • Posted: 2024-06-11T16:44:29.989000+00:00
Original source

and what is different to existing timers in Timer.h that makes new classes neccessary?
rektbyfaith
06-11-2024, 04:44 PM #3

Archived author: Tea • Posted: 2024-06-11T16:44:29.989000+00:00
Original source

and what is different to existing timers in Timer.h that makes new classes neccessary?

rektbyfaith
Administrator
0
06-11-2024, 04:46 PM
#4
Archived author: Takenbacon • Posted: 2024-06-11T16:46:28.844000+00:00
Original source

``` _weatherUpdateTimer.Update(t_diff);
if (_weatherUpdateTimer.Passed())
{
for (auto&& zoneInfo : _zoneDynamicInfo)
if (zoneInfo.second.DefaultWeather && !zoneInfo.second.DefaultWeather->Update(_weatherUpdateTimer.GetInterval()))
zoneInfo.second.DefaultWeather.reset();

_weatherUpdateTimer.Reset();
}```

for example would roughly translate to

``` if (uint32 const timePassed = _weatherUpdateTimer.Update(t_diff))
{
for (auto&& zoneInfo : _zoneDynamicInfo)
if (zoneInfo.second.DefaultWeather && !zoneInfo.second.DefaultWeather->Update(timePassed))
zoneInfo.second.DefaultWeather.reset();
}```

simplifying the usage
rektbyfaith
06-11-2024, 04:46 PM #4

Archived author: Takenbacon • Posted: 2024-06-11T16:46:28.844000+00:00
Original source

``` _weatherUpdateTimer.Update(t_diff);
if (_weatherUpdateTimer.Passed())
{
for (auto&& zoneInfo : _zoneDynamicInfo)
if (zoneInfo.second.DefaultWeather && !zoneInfo.second.DefaultWeather->Update(_weatherUpdateTimer.GetInterval()))
zoneInfo.second.DefaultWeather.reset();

_weatherUpdateTimer.Reset();
}```

for example would roughly translate to

``` if (uint32 const timePassed = _weatherUpdateTimer.Update(t_diff))
{
for (auto&& zoneInfo : _zoneDynamicInfo)
if (zoneInfo.second.DefaultWeather && !zoneInfo.second.DefaultWeather->Update(timePassed))
zoneInfo.second.DefaultWeather.reset();
}```

simplifying the usage

rektbyfaith
Administrator
0
06-11-2024, 04:46 PM
#5
Archived author: Takenbacon • Posted: 2024-06-11T16:46:59.976000+00:00
Original source

would change the behavior of the class, don't want to break anything (currently)
rektbyfaith
06-11-2024, 04:46 PM #5

Archived author: Takenbacon • Posted: 2024-06-11T16:46:59.976000+00:00
Original source

would change the behavior of the class, don't want to break anything (currently)

rektbyfaith
Administrator
0
06-11-2024, 05:07 PM
#6
Archived author: Takenbacon • Posted: 2024-06-11T17:07:20.825000+00:00
Original source

effectively just trying to reduce the amount of unnecessary code with timers. in most, if not all use cases I don't think we actually need to have Reset, Update and Passed called separately
rektbyfaith
06-11-2024, 05:07 PM #6

Archived author: Takenbacon • Posted: 2024-06-11T17:07:20.825000+00:00
Original source

effectively just trying to reduce the amount of unnecessary code with timers. in most, if not all use cases I don't think we actually need to have Reset, Update and Passed called separately

rektbyfaith
Administrator
0
06-11-2024, 05:08 PM
#7
Archived author: Takenbacon • Posted: 2024-06-11T17:08:12.958000+00:00
Original source

as well as with the template I can initialize without needing to be separately called during the constructor
rektbyfaith
06-11-2024, 05:08 PM #7

Archived author: Takenbacon • Posted: 2024-06-11T17:08:12.958000+00:00
Original source

as well as with the template I can initialize without needing to be separately called during the constructor

rektbyfaith
Administrator
0
06-11-2024, 05:08 PM
#8
Archived author: Takenbacon • Posted: 2024-06-11T17:08:21.850000+00:00
Original source

e.g. SimpleIntervalTimer<Milliseconds, 1000> _weatherUpdateTimer;
rektbyfaith
06-11-2024, 05:08 PM #8

Archived author: Takenbacon • Posted: 2024-06-11T17:08:21.850000+00:00
Original source

e.g. SimpleIntervalTimer<Milliseconds, 1000> _weatherUpdateTimer;

rektbyfaith
Administrator
0
06-11-2024, 05:34 PM
#9
Archived author: Tea • Posted: 2024-06-11T17:34:42.243000+00:00
Original source

i would prefer to see existing uses migrated too instead of adding more timer class confusion
rektbyfaith
06-11-2024, 05:34 PM #9

Archived author: Tea • Posted: 2024-06-11T17:34:42.243000+00:00
Original source

i would prefer to see existing uses migrated too instead of adding more timer class confusion

rektbyfaith
Administrator
0
06-11-2024, 05:36 PM
#10
Archived author: Tea • Posted: 2024-06-11T17:36:50.482000+00:00
Original source

SimpleCountdownTimer looks like its just a TimeTracker that has a return value in Update
rektbyfaith
06-11-2024, 05:36 PM #10

Archived author: Tea • Posted: 2024-06-11T17:36:50.482000+00:00
Original source

SimpleCountdownTimer looks like its just a TimeTracker that has a return value in Update

Pages (4): 1 2 3 4 Next
Recently Browsing
 
Recently Browsing