Environment::getTimeOfDay Always returning same value

User avatar
BrandonReese
Member
 
Posts: 836
Joined: Wed Sep 12, 2012 00:44
GitHub: bremaweb
IRC: BrandonReese
In-game: BrandonReese

Environment::getTimeOfDay Always returning same value

by BrandonReese » Thu Jun 18, 2015 18:43

I have been working on adding ambient sounds on the client side and I have ran into a problem with getTimeOfDay. It's probably a C++ noob problem. I have created a new class, ambiance.cpp. In client.cpp I initialize m_ambiance in Client::Client and pass m_env to the ambiance class constructor (https://github.com/Bremaweb/minetest/bl ... t.cpp#L284). m_env works fine with .getLocalPlayer(), .getMap().getNodeNoEx(), etc... but when I use m_env.getTimeOfDay() it always returns 9000 (https://github.com/Bremaweb/minetest/bl ... e.cpp#L177).

Is anybody willing to shed some light on what I might have done wrong, or what .getTimeOfDay may be doing wrong?
 

TeTpaAka
Member
 
Posts: 131
Joined: Sat Dec 28, 2013 21:54

Re: Environment::getTimeOfDay Always returning same value

by TeTpaAka » Sat Jun 20, 2015 11:20

https://github.com/Bremaweb/minetest/bl ... ance.h#L28
You probably want a pointer to the environment instead of a hard copy.

Also my compiler complains about the use of c++11. If you want this code to be included to the main codebase, you should avoid c++11.
 


Return to Minetest Engine

Who is online

Users browsing this forum: No registered users and 22 guests

cron