[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; writeWorldstate.month = month;
} }
void WorldstateFunctions::SetDaysPassed(int daysPassed) noexcept
{
writeWorldstate.daysPassed = daysPassed;
}
void WorldstateFunctions::SetTimeScale(double timeScale) noexcept void WorldstateFunctions::SetTimeScale(double timeScale) noexcept
{ {
writeWorldstate.timeScale = timeScale; writeWorldstate.timeScale = timeScale;

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

@ -200,13 +200,23 @@ namespace MWBase
/* /*
Start of tes3mp addition 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; virtual void setTimeScale(float timeScale) = 0;
/* /*
End of tes3mp addition 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; virtual void setHour (double hour) = 0;
///< Set in-game time hour. ///< Set in-game time hour.

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

@ -868,7 +868,7 @@ namespace MWWorld
/* /*
Start of tes3mp addition 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) void World::setTimeScale(float timeScale)
{ {
@ -878,6 +878,19 @@ namespace MWWorld
End of tes3mp addition 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) void World::setHour (double hour)
{ {
if (hour<0) if (hour<0)

@ -309,13 +309,23 @@ namespace MWWorld
/* /*
Start of tes3mp addition 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; void setTimeScale(float timeScale) override;
/* /*
End of tes3mp addition 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; void setHour (double hour) override;
///< Set in-game time hour. ///< Set in-game time hour.

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

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

Loading…
Cancel
Save