[General] Make it possible to set days passed via WorldTime

0.6.3
David Cernat 7 years ago
parent 74c2a0b311
commit 4acf93b7db

@ -27,6 +27,11 @@ void WorldstateFunctions::SetMonth(int month) noexcept
writeWorldstate.month = month;
}
void WorldstateFunctions::SetDaysPassed(int daysPassed) noexcept
{
writeWorldstate.daysPassed = daysPassed;
}
void WorldstateFunctions::SetTimeScale(double timeScale) noexcept
{
writeWorldstate.timeScale = timeScale;

@ -7,6 +7,7 @@
{"SetHour", WorldstateFunctions::SetHour},\
{"SetDay", WorldstateFunctions::SetDay},\
{"SetMonth", WorldstateFunctions::SetMonth},\
{"SetDaysPassed", WorldstateFunctions::SetDaysPassed},\
{"SetTimeScale", WorldstateFunctions::SetTimeScale},\
\
{"SendWorldTime", WorldstateFunctions::SendWorldTime}
@ -18,7 +19,6 @@ public:
/**
* \brief Set the world's hour in the worldstate stored on the server.
*
* \param pid The player ID.
* \param hour The hour.
* \return void
*/
@ -27,7 +27,6 @@ public:
/**
* \brief Set the world's day in the worldstate stored on the server.
*
* \param pid The player ID.
* \param day The day.
* \return void
*/
@ -36,12 +35,19 @@ public:
/**
* \brief Set the world's month in the worldstate stored on the server.
*
* \param pid The player ID.
* \param month The month.
* \return void
*/
static void SetMonth(int month) noexcept;
/**
* \brief Set the world's days passed in the worldstate stored on the server.
*
* \param daysPassed The days passed.
* \return void
*/
static void SetDaysPassed(int daysPassed) noexcept;
/**
* \brief Set the world's time scale in the worldstate stored on the server.
*

@ -200,13 +200,23 @@ namespace MWBase
/*
Start of tes3mp addition
Make it possible to set a custom timescale from a server
Make it possible to set a custom timeScale from elsewhere
*/
virtual void setTimeScale(float timeScale) = 0;
/*
End of tes3mp addition
*/
/*
Start of tes3mp addition
Make it possible to set the number of days passed from elsewhere
*/
virtual void setDaysPassed(int daysPassed) = 0;
/*
End of tes3mp addition
*/
virtual void setHour (double hour) = 0;
///< Set in-game time hour.

@ -30,6 +30,9 @@ namespace mwmp
if (worldstate.month != -1)
world->setMonth(worldstate.month);
if (worldstate.daysPassed != -1)
world->setDaysPassed(worldstate.daysPassed);
if (worldstate.timeScale != -1)
world->setTimeScale(worldstate.timeScale);
}

@ -868,7 +868,7 @@ namespace MWWorld
/*
Start of tes3mp addition
Make it possible to set a custom timescale from a server
Make it possible to set a custom timeScale from elsewhere
*/
void World::setTimeScale(float timeScale)
{
@ -878,6 +878,19 @@ namespace MWWorld
End of tes3mp addition
*/
/*
Start of tes3mp addition
Make it possible to set the number of days passed from elsewhere
*/
void World::setDaysPassed(int days)
{
mDaysPassed->setInteger(days);
}
/*
End of tes3mp addition
*/
void World::setHour (double hour)
{
if (hour<0)

@ -309,13 +309,23 @@ namespace MWWorld
/*
Start of tes3mp addition
Make it possible to set a custom timescale from a server
Make it possible to set a custom timeScale from elsewhere
*/
void setTimeScale(float timeScale) override;
/*
End of tes3mp addition
*/
/*
Start of tes3mp addition
Make it possible to set the number of days passed from elsewhere
*/
void setDaysPassed(int daysPassed) override;
/*
End of tes3mp addition
*/
void setHour (double hour) override;
///< Set in-game time hour.

@ -17,6 +17,8 @@ namespace mwmp
month = -1;
day = -1;
hour = -1;
daysPassed = -1;
timeScale = -1;
}
@ -25,6 +27,8 @@ namespace mwmp
int month;
int day;
double hour;
int daysPassed;
float timeScale;
bool isValid;

@ -16,5 +16,7 @@ void PacketWorldTime::Packet(RakNet::BitStream *bs, bool send)
RW(worldstate->month, send);
RW(worldstate->day, send);
RW(worldstate->hour, send);
RW(worldstate->daysPassed, send);
RW(worldstate->timeScale, send);
}

Loading…
Cancel
Save