Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / client / src / ig_season_callback.cpp
blob6b5701950794e4578352bc0800c4b366d58e42d2
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #include "stdpch.h"
19 #include "ig_season_callback.h"
20 #include "weather.h"
21 #include "character_cl.h"
22 #include "client_sheets/entity_sheet.h"
23 #include "entities.h"
25 CIGSeasonCallback IGSeasonCallback;
27 void CIGSeasonCallback::instanceGroupAdded(NL3D::UInstanceGroup *ig)
29 H_AUTO(RZ_IGSeasonCallback)
30 // Set the season texture for all the buildings
32 uint8 selectedTextureSet = (uint8) computeCurrSeason();
34 const uint numInstances = ig->getNumInstance();
35 for(uint k = 0; k < numInstances; k++)
37 NL3D::UInstance instance = ig->getInstance (k);
38 if (!instance.empty())
39 instance.selectTextureSet(selectedTextureSet); // TODO Nico : instant loading here (async not useful)
41 // for all the bot objects, force to rebuild them to update their textures
42 for (uint k = 0; k < CLFECOMMON::INVALID_SLOT; ++k)
44 CCharacterCL *charCL = dynamic_cast<CCharacterCL *>(EntitiesMngr.entity(k));
45 if (charCL && charCL->getSheet())
47 std::string sheetName = charCL->getSheet()->Id.toString();
48 static const char *botObjectPrefix = "object_";
49 if (NLMISC::nlstricmp(sheetName.substr(0, strlen(botObjectPrefix)), botObjectPrefix) == 0)
51 for(uint k = 0; k < charCL->instances().size(); ++k)
53 charCL->instances()[k].selectTextureSet(selectedTextureSet, false); // want immediate change here (frozen any way ...)
55 if (!charCL->instance().empty())
57 charCL->instance().selectTextureSet(selectedTextureSet);