Changeset 8485 in orxonox.OLD for branches/script_engine/src/lib
- Timestamp:
- Jun 15, 2006, 5:33:25 PM (19 years ago)
- Location:
- branches/script_engine/src/lib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/script_engine/src/lib/coord/p_node.h
r8186 r8485 103 103 /** @returns the absolute position */ 104 104 inline const Vector& getAbsCoor () const { return this->absCoordinate; }; 105 /** @returns the absolute X coordinate. */ 106 inline float getAbsCoorX() { return this->absCoordinate.x; }; 107 /** @returns the absolute Y Coordinate */ 108 inline float getAbsCoorY() { return this->absCoordinate.y; }; 109 /** @returns the absolute Z Coordinate */ 110 inline float getAbsCoorZ() { return this->absCoordinate.z; }; 111 105 112 void shiftCoor (const Vector& shift); 106 113 void shiftCoor (float x, float y, float z) { this->shiftCoor(Vector(x, y, z)); }; -
branches/script_engine/src/lib/script_engine/script.cc
r8408 r8485 192 192 bool Script::pushParam(int param, std::string& toFunction) 193 193 { 194 if(currentFunction .compare(toFunction) == 0)194 if(currentFunction == toFunction) 195 195 { 196 196 lua_pushnumber(luaState, (lua_Number) param); … … 267 267 returnCount--; 268 268 } 269 else 270 printf("ERROR: Form %s : trying to retreive non bolean value",this->currentFile.c_str()); 269 271 } 270 272 return returnValue; … … 313 315 } 314 316 317 bool Script::registerStandartClasses() 318 { 319 bool success = false; 320 321 //success = this->registerClass(std::string("Vector")); 322 323 return success; 324 } 325 326 327 bool Script::registerClass( const std::string& className) 328 { 329 BaseObject* scriptClass = ClassList::getObject(className, CL_SCRIPT_CLASS); 330 //printf("The script class for %s is at %p \n",className.c_str(),scriptClass); 331 WorldObject tmpObj; 332 if (scriptClass != NULL) 333 { 334 tmpObj.type = className; 335 if( !classIsRegistered(className) ) 336 { 337 static_cast<ScriptClass*>(scriptClass)->registerClass(this); 338 tmpObj.name = ""; 339 registeredObjects.push_back(tmpObj); 340 return true; 341 } 342 } 343 return false; 344 345 } 315 346 316 347 bool Script::classIsRegistered(const std::string& type) -
branches/script_engine/src/lib/script_engine/script.h
r8408 r8485 58 58 59 59 int reportError(int error); //!< Get errormessage from the lua stack and print it. 60 bool registerStandartClasses(); //!< Register all the classes that the script might need 61 bool registerClass(const std::string& className); //!< Register a class but dont add any instances 60 62 bool classIsRegistered(const std::string& type); //!< Checks wheter the class "type" has already been registered with the script 61 63 bool objectIsAdded(const std::string& name); //!< Checks wheter the object "name" has already been added to the script -
branches/script_engine/src/lib/util/executor/executor_lua.h
r8408 r8485 183 183 184 184 185 /////////// 186 //// 3 //// 187 /////////// 188 //! Executes a Function with a lua_State* parameter. 189 template<class T, typename type0, typename type1, typename type2> class ExecutorLua3 : public Executor 190 { 191 public: 192 /** 193 * @brief Constructor of a ExecutorXML 194 * @param function a Function to call 195 */ 196 ExecutorLua3(void(T::*function)(type0, type1, type2)) 197 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>()) 198 { 199 this->functionPointer = function; 200 this->functorType = Executor_Objective | Executor_NoLoadString; 201 } 202 203 /** 204 * @brief executes the Command on BaseObject 205 * @param object the BaseObject to execute this Executor on 206 * @param loadString ignored in this case 207 */ 208 virtual void operator()(BaseObject* object, const SubString& = SubString()) const 209 { 210 PRINTF(1)("no usefull executor\n"); 211 } 212 213 virtual void operator()(BaseObject* object, int& count, void* values) const 214 { 215 lua_State* state = (lua_State*)values; 216 count = 0; 217 218 (dynamic_cast<T*>(object)->*(functionPointer))( 219 fromLua<type0>(state, 1), 220 fromLua<type1>(state, 2), 221 fromLua<type2>(state, 3) ); 222 } 223 224 /** 225 * @returns a _new_ Copy of this Executor 226 */ 227 virtual Executor* clone () const 228 { 229 return new ExecutorLua3<T, type0, type1, type2>(this->functionPointer); 230 } 231 private: 232 void (T::*functionPointer)(type0, type1, type2); 233 }; 234 185 235 186 236 … … 210 260 this->functorType = Executor_Objective | Executor_NoLoadString; 211 261 } 212 262 213 263 /** 214 264 * @brief executes the Command on BaseObject
Note: See TracChangeset
for help on using the changeset viewer.