Fix css style order when using external css files
[ryzomcore.git] / ryzom / client / src / r2 / tool_choose_pos_lua.cpp
blob5efaaae20b872d1525dff3fbb79e0a1fd2ee3c00
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 "editor.h"
20 #include "tool_choose_pos_lua.h"
22 #include "nel/misc/vectord.h"
24 #ifdef DEBUG_NEW
25 #define new DEBUG_NEW
26 #endif
28 using namespace NLPACS;
29 using namespace NLMISC;
31 namespace R2
34 // ***************************************************************
35 CToolChoosePosLua::CToolChoosePosLua(uint ghostSlot,
36 const CLuaObject &validFunc,
37 const CLuaObject &cancelFunc,
38 const std::string &toolName,
39 const std::string &cursValid,
40 const std::string &cursInvalid,
41 const std::vector<CPolygon2D> &polyList,
42 const CPrimLook &polyValidLook,
43 const CPrimLook &polyInvalidLook
44 ) : CToolChoosePos(ghostSlot,
45 cursValid,
46 cursInvalid,
47 polyList,
48 polyValidLook,
49 polyInvalidLook
51 _ToolName(toolName)
53 _ValidFunc = validFunc;
54 _CancelFunc = cancelFunc;
55 _Commited = false;
58 // ***************************************************************
59 void CToolChoosePosLua::commit(const NLMISC::CVector &createPosition, float /* createAngle */)
61 //H_AUTO(R2_CToolChoosePosLua_commit)
62 nlassert(!_Commited);
63 if (_ValidFunc.isFunction())
65 CLuaState &lua = *_ValidFunc.getLuaState();
66 lua.push(createPosition.x);
67 lua.push(createPosition.y);
68 lua.push(createPosition.z);
69 _ValidFunc.callNoThrow(3, 0);
71 _Commited = true;
74 // *********************************************************************************************************
75 void CToolChoosePosLua::cancel()
77 //H_AUTO(R2_CToolChoosePosLua_cancel)
78 if (_Commited) return;
79 if (_CancelFunc.isFunction())
81 _CancelFunc.callNoThrow(0, 0);
87 } // R2