forked from teamnwah/openmw-tes3coop
[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
|
void WorldstateFunctions::SetHour(double hour) noexcept
|
||||||
{
|
{
|
||||||
writeWorldstate.hour = hour;
|
writeWorldstate.time.hour = hour;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldstateFunctions::SetDay(int day) noexcept
|
void WorldstateFunctions::SetDay(int day) noexcept
|
||||||
{
|
{
|
||||||
writeWorldstate.day = day;
|
writeWorldstate.time.day = day;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldstateFunctions::SetMonth(int month) noexcept
|
void WorldstateFunctions::SetMonth(int month) noexcept
|
||||||
{
|
{
|
||||||
writeWorldstate.month = month;
|
writeWorldstate.time.month = month;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldstateFunctions::SetYear(int year) noexcept
|
void WorldstateFunctions::SetYear(int year) noexcept
|
||||||
{
|
{
|
||||||
writeWorldstate.year = year;
|
writeWorldstate.time.year = year;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldstateFunctions::SetDaysPassed(int daysPassed) noexcept
|
void WorldstateFunctions::SetDaysPassed(int daysPassed) noexcept
|
||||||
{
|
{
|
||||||
writeWorldstate.daysPassed = daysPassed;
|
writeWorldstate.time.daysPassed = daysPassed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldstateFunctions::SetTimeScale(double timeScale) noexcept
|
void WorldstateFunctions::SetTimeScale(double timeScale) noexcept
|
||||||
{
|
{
|
||||||
writeWorldstate.timeScale = timeScale;
|
writeWorldstate.time.timeScale = timeScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldstateFunctions::SetPlayerCollisionState(bool state) noexcept
|
void WorldstateFunctions::SetPlayerCollisionState(bool state) noexcept
|
||||||
|
|
|
@ -20,23 +20,23 @@ namespace mwmp
|
||||||
{
|
{
|
||||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
|
|
||||||
if (worldstate.hour != -1)
|
if (worldstate.time.hour != -1)
|
||||||
world->setHour(worldstate.hour);
|
world->setHour(worldstate.time.hour);
|
||||||
|
|
||||||
if (worldstate.day != -1)
|
if (worldstate.time.day != -1)
|
||||||
world->setDay(worldstate.day);
|
world->setDay(worldstate.time.day);
|
||||||
|
|
||||||
if (worldstate.month != -1)
|
if (worldstate.time.month != -1)
|
||||||
world->setMonth(worldstate.month);
|
world->setMonth(worldstate.time.month);
|
||||||
|
|
||||||
if (worldstate.year != -1)
|
if (worldstate.time.year != -1)
|
||||||
world->setYear(worldstate.year);
|
world->setYear(worldstate.time.year);
|
||||||
|
|
||||||
if (worldstate.daysPassed != -1)
|
if (worldstate.time.daysPassed != -1)
|
||||||
world->setDaysPassed(worldstate.daysPassed);
|
world->setDaysPassed(worldstate.time.daysPassed);
|
||||||
|
|
||||||
if (worldstate.timeScale != -1)
|
if (worldstate.time.timeScale != -1)
|
||||||
world->setTimeScale(worldstate.timeScale);
|
world->setTimeScale(worldstate.time.timeScale);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,23 +33,18 @@ namespace mwmp
|
||||||
|
|
||||||
BaseWorldstate()
|
BaseWorldstate()
|
||||||
{
|
{
|
||||||
month = -1;
|
time.year = -1;
|
||||||
day = -1;
|
time.month = -1;
|
||||||
hour = -1;
|
time.day = -1;
|
||||||
|
time.hour = -1;
|
||||||
|
|
||||||
daysPassed = -1;
|
time.daysPassed = -1;
|
||||||
timeScale = -1;
|
time.timeScale = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
RakNet::RakNetGUID guid;
|
RakNet::RakNetGUID guid;
|
||||||
|
|
||||||
float hour;
|
mwmp::Time time;
|
||||||
int day;
|
|
||||||
int month;
|
|
||||||
int year;
|
|
||||||
|
|
||||||
int daysPassed;
|
|
||||||
float timeScale;
|
|
||||||
|
|
||||||
bool hasPlayerCollision;
|
bool hasPlayerCollision;
|
||||||
bool hasActorCollision;
|
bool hasActorCollision;
|
||||||
|
|
|
@ -13,11 +13,11 @@ void PacketWorldTime::Packet(RakNet::BitStream *bs, bool send)
|
||||||
{
|
{
|
||||||
WorldstatePacket::Packet(bs, send);
|
WorldstatePacket::Packet(bs, send);
|
||||||
|
|
||||||
RW(worldstate->hour, send);
|
RW(worldstate->time.hour, send);
|
||||||
RW(worldstate->day, send);
|
RW(worldstate->time.day, send);
|
||||||
RW(worldstate->month, send);
|
RW(worldstate->time.month, send);
|
||||||
RW(worldstate->year, send);
|
RW(worldstate->time.year, send);
|
||||||
|
|
||||||
RW(worldstate->daysPassed, send);
|
RW(worldstate->time.daysPassed, send);
|
||||||
RW(worldstate->timeScale, send);
|
RW(worldstate->time.timeScale, send);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue