forked from mirror/openmw-tes3mp
[General] Use Time struct for time in BaseWorldstate
This commit is contained in:
parent
a4b588d1b5
commit
b4802e4201
4 changed files with 31 additions and 36 deletions
|
@ -106,32 +106,32 @@ void WorldstateFunctions::SetWeatherTransitionFactor(double transitionFactor) no
|
|||
|
||||
void WorldstateFunctions::SetHour(double hour) noexcept
|
||||
{
|
||||
writeWorldstate.hour = hour;
|
||||
writeWorldstate.time.hour = hour;
|
||||
}
|
||||
|
||||
void WorldstateFunctions::SetDay(int day) noexcept
|
||||
{
|
||||
writeWorldstate.day = day;
|
||||
writeWorldstate.time.day = day;
|
||||
}
|
||||
|
||||
void WorldstateFunctions::SetMonth(int month) noexcept
|
||||
{
|
||||
writeWorldstate.month = month;
|
||||
writeWorldstate.time.month = month;
|
||||
}
|
||||
|
||||
void WorldstateFunctions::SetYear(int year) noexcept
|
||||
{
|
||||
writeWorldstate.year = year;
|
||||
writeWorldstate.time.year = year;
|
||||
}
|
||||
|
||||
void WorldstateFunctions::SetDaysPassed(int daysPassed) noexcept
|
||||
{
|
||||
writeWorldstate.daysPassed = daysPassed;
|
||||
writeWorldstate.time.daysPassed = daysPassed;
|
||||
}
|
||||
|
||||
void WorldstateFunctions::SetTimeScale(double timeScale) noexcept
|
||||
{
|
||||
writeWorldstate.timeScale = timeScale;
|
||||
writeWorldstate.time.timeScale = timeScale;
|
||||
}
|
||||
|
||||
void WorldstateFunctions::SetPlayerCollisionState(bool state) noexcept
|
||||
|
|
|
@ -20,23 +20,23 @@ namespace mwmp
|
|||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
|
||||
if (worldstate.hour != -1)
|
||||
world->setHour(worldstate.hour);
|
||||
if (worldstate.time.hour != -1)
|
||||
world->setHour(worldstate.time.hour);
|
||||
|
||||
if (worldstate.day != -1)
|
||||
world->setDay(worldstate.day);
|
||||
if (worldstate.time.day != -1)
|
||||
world->setDay(worldstate.time.day);
|
||||
|
||||
if (worldstate.month != -1)
|
||||
world->setMonth(worldstate.month);
|
||||
if (worldstate.time.month != -1)
|
||||
world->setMonth(worldstate.time.month);
|
||||
|
||||
if (worldstate.year != -1)
|
||||
world->setYear(worldstate.year);
|
||||
if (worldstate.time.year != -1)
|
||||
world->setYear(worldstate.time.year);
|
||||
|
||||
if (worldstate.daysPassed != -1)
|
||||
world->setDaysPassed(worldstate.daysPassed);
|
||||
if (worldstate.time.daysPassed != -1)
|
||||
world->setDaysPassed(worldstate.time.daysPassed);
|
||||
|
||||
if (worldstate.timeScale != -1)
|
||||
world->setTimeScale(worldstate.timeScale);
|
||||
if (worldstate.time.timeScale != -1)
|
||||
world->setTimeScale(worldstate.time.timeScale);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -33,23 +33,18 @@ namespace mwmp
|
|||
|
||||
BaseWorldstate()
|
||||
{
|
||||
month = -1;
|
||||
day = -1;
|
||||
hour = -1;
|
||||
time.year = -1;
|
||||
time.month = -1;
|
||||
time.day = -1;
|
||||
time.hour = -1;
|
||||
|
||||
daysPassed = -1;
|
||||
timeScale = -1;
|
||||
time.daysPassed = -1;
|
||||
time.timeScale = -1;
|
||||
}
|
||||
|
||||
RakNet::RakNetGUID guid;
|
||||
|
||||
float hour;
|
||||
int day;
|
||||
int month;
|
||||
int year;
|
||||
|
||||
int daysPassed;
|
||||
float timeScale;
|
||||
mwmp::Time time;
|
||||
|
||||
bool hasPlayerCollision;
|
||||
bool hasActorCollision;
|
||||
|
|
|
@ -13,11 +13,11 @@ void PacketWorldTime::Packet(RakNet::BitStream *bs, bool send)
|
|||
{
|
||||
WorldstatePacket::Packet(bs, send);
|
||||
|
||||
RW(worldstate->hour, send);
|
||||
RW(worldstate->day, send);
|
||||
RW(worldstate->month, send);
|
||||
RW(worldstate->year, send);
|
||||
RW(worldstate->time.hour, send);
|
||||
RW(worldstate->time.day, send);
|
||||
RW(worldstate->time.month, send);
|
||||
RW(worldstate->time.year, send);
|
||||
|
||||
RW(worldstate->daysPassed, send);
|
||||
RW(worldstate->timeScale, send);
|
||||
RW(worldstate->time.daysPassed, send);
|
||||
RW(worldstate->time.timeScale, send);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue