Advertisement
Guest User

Untitled

a guest
Jan 9th, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.50 KB | None | 0 0
  1. diff -Naur -x '*.o' -x .git -x CMakeFiles -x lua -x sqlite -x '*.s' -x cmake_install.cmake -x jthread -x Makefile ../git/minetest.modif/src/clientlinkableobject.cpp src/clientlinkableobject.cpp
  2. --- ../git/minetest.modif/src/clientlinkableobject.cpp 1970-01-01 01:00:00.000000000 +0100
  3. +++ src/clientlinkableobject.cpp 2012-01-09 20:18:12.000000000 +0100
  4. @@ -0,0 +1,121 @@
  5. +/*
  6. +Minetest-c55
  7. +Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
  8. +Copyright (C) 2012 sapier sapier at gmx dot net
  9. +
  10. +This program is free software; you can redistribute it and/or modify
  11. +it under the terms of the GNU General Public License as published by
  12. +the Free Software Foundation; either version 2 of the License, or
  13. +(at your option) any later version.
  14. +
  15. +This program is distributed in the hope that it will be useful,
  16. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. +GNU General Public License for more details.
  19. +
  20. +You should have received a copy of the GNU General Public License along
  21. +with this program; if not, write to the Free Software Foundation, Inc.,
  22. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  23. +*/
  24. +
  25. +#include "clientlinkableobject.h"
  26. +
  27. +ClientLinkableObject::ClientLinkableObject() {
  28. +
  29. + this->m_Parent = NULL;
  30. +}
  31. +
  32. +ClientLinkableObject::~ClientLinkableObject() {
  33. + if (this->isLinked())
  34. + this->unlink(this);
  35. +}
  36. +
  37. +
  38. +void ClientLinkableObject::link(ClientLinkableObject* entity) {
  39. + //TODO check if entity is already linkt (shouldn't be the case but just to be sure)
  40. + this->m_LinkedObjects.push_back(entity);
  41. +}
  42. +
  43. +void ClientLinkableObject::unlink(ClientLinkableObject* entity) {
  44. + this->m_LinkedObjects.remove(entity);
  45. +}
  46. +
  47. +
  48. +void ClientLinkableObject::stepLinkedObjects(v3f pos,float dtime) {
  49. + for(std::list<ClientLinkableObject*>::iterator i = this->m_LinkedObjects.begin();
  50. + i != this->m_LinkedObjects.end(); i++) {
  51. + (*i)->setPosition(pos,dtime);
  52. + }
  53. +}
  54. +
  55. +bool ClientLinkableObject::handleLinkUnlinkMessages(u8 cmd,std::istringstream* is,ClientEnvironment *m_env) {
  56. + if(cmd == AO_Message_type::Link) // Link entity
  57. + {
  58. + //Object to link entity to
  59. + u16 object_id = readU16(*is);
  60. + //offset against linked object
  61. + v3f offset = readV3F1000(*is);
  62. +
  63. + ClientActiveObject* parent_cao = m_env->getActiveObject(object_id);
  64. +
  65. + ClientLinkableObject* parent = dynamic_cast<ClientLinkableObject*>(parent_cao);
  66. +
  67. + if (parent != NULL) {
  68. + this->linkEntity(offset,parent);
  69. + }
  70. + else {
  71. + errorstream << "Invalid object to link to!" << std::endl;
  72. + }
  73. + return true;
  74. +
  75. + }
  76. + else if(cmd == AO_Message_type::UnLink) // UnLink entity
  77. + {
  78. + if (this->m_Parent == NULL) {
  79. + errorstream << "Unlinking object not linked!" << std::endl;
  80. + }
  81. +
  82. + this->unlinkEntity();
  83. + return true;
  84. + }
  85. +
  86. + return false;
  87. +}
  88. +
  89. +
  90. +bool ClientLinkableObject::linkEntity(v3f offset, ClientLinkableObject* parent) {
  91. + //already linked unlink first
  92. + if (this->m_Parent != NULL) {
  93. + return false;
  94. + }
  95. +
  96. + //TODO add linkchain support
  97. + if (this->m_LinkedObjects.size() > 0) {
  98. + return false;
  99. + }
  100. +
  101. + parent->link(this);
  102. + this->m_linkOffset = offset;
  103. + this->m_Parent = parent;
  104. + return true;
  105. +}
  106. +
  107. +
  108. +bool ClientLinkableObject::unlinkEntity() {
  109. + if (this->m_Parent != NULL) {
  110. +
  111. + this->m_Parent->unlink(this);
  112. + this->m_Parent = NULL;
  113. + return true;
  114. +
  115. + }
  116. +
  117. + return false;
  118. +}
  119. +
  120. +bool ClientLinkableObject::isLinked() {
  121. + if (this->m_Parent != NULL)
  122. + return true;
  123. + else
  124. + return false;
  125. +}
  126. diff -Naur -x '*.o' -x .git -x CMakeFiles -x lua -x sqlite -x '*.s' -x cmake_install.cmake -x jthread -x Makefile ../git/minetest.modif/src/clientlinkableobject.h src/clientlinkableobject.h
  127. --- ../git/minetest.modif/src/clientlinkableobject.h 1970-01-01 01:00:00.000000000 +0100
  128. +++ src/clientlinkableobject.h 2012-01-09 20:19:48.000000000 +0100
  129. @@ -0,0 +1,66 @@
  130. +/*
  131. +Minetest-c55
  132. +Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
  133. +Copyright (C) 2012 sapier sapier at gmx dot net
  134. +
  135. +This program is free software; you can redistribute it and/or modify
  136. +it under the terms of the GNU General Public License as published by
  137. +the Free Software Foundation; either version 2 of the License, or
  138. +(at your option) any later version.
  139. +
  140. +This program is distributed in the hope that it will be useful,
  141. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  142. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  143. +GNU General Public License for more details.
  144. +
  145. +You should have received a copy of the GNU General Public License along
  146. +with this program; if not, write to the Free Software Foundation, Inc.,
  147. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  148. +*/
  149. +
  150. +#ifndef CLIENTLINKABLEOBJECT_H_
  151. +#define CLIENTLINKABLEOBJECT_H_
  152. +
  153. +#include <list>
  154. +#include <sstream>
  155. +#include <irrlichttypes.h>
  156. +#include "clientobject.h"
  157. +#include "environment.h"
  158. +#include "content_object.h"
  159. +#include "utility.h"
  160. +#include "log.h"
  161. +
  162. +
  163. +
  164. +class ClientLinkableObject {
  165. + public:
  166. + ClientLinkableObject();
  167. + ~ClientLinkableObject();
  168. + //internal communication between entitys NOT to be used by user
  169. + void link(ClientLinkableObject* entity);
  170. + void unlink(ClientLinkableObject* entity);
  171. +
  172. + virtual void setPosition(v3f toset, float dtime) = 0;
  173. +
  174. + protected:
  175. + void stepLinkedObjects(v3f pos,float dtime);
  176. +
  177. + bool handleLinkUnlinkMessages(u8 cmd,std::istringstream* is,ClientEnvironment *m_env);
  178. +
  179. +
  180. + //user driven functions (exported by lua)
  181. + bool linkEntity(v3f offset, ClientLinkableObject* parent);
  182. + bool unlinkEntity();
  183. +
  184. + bool isLinked();
  185. + v3f m_linkOffset;
  186. +
  187. +
  188. + private:
  189. + ClientLinkableObject* m_Parent;
  190. +
  191. + std::list<ClientLinkableObject*> m_LinkedObjects;
  192. +};
  193. +
  194. +
  195. +#endif /* CLIENTLINKABLEOBJECT_H_ */
  196. diff -Naur -x '*.o' -x .git -x CMakeFiles -x lua -x sqlite -x '*.s' -x cmake_install.cmake -x jthread -x Makefile ../git/minetest.modif/src/clientobject.h src/clientobject.h
  197. --- ../git/minetest.modif/src/clientobject.h 2012-01-09 20:40:04.000000000 +0100
  198. +++ src/clientobject.h 2012-01-09 19:46:06.000000000 +0100
  199. @@ -1,6 +1,6 @@
  200. /*
  201. Minetest-c55
  202. -Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
  203. +Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
  204.  
  205. This program is free software; you can redistribute it and/or modify
  206. it under the terms of the GNU General Public License as published by
  207. diff -Naur -x '*.o' -x .git -x CMakeFiles -x lua -x sqlite -x '*.s' -x cmake_install.cmake -x jthread -x Makefile ../git/minetest.modif/src/CMakeLists.txt src/CMakeLists.txt
  208. --- ../git/minetest.modif/src/CMakeLists.txt 2012-01-09 20:40:04.000000000 +0100
  209. +++ src/CMakeLists.txt 2012-01-09 19:43:21.000000000 +0100
  210. @@ -115,6 +115,7 @@
  211. content_sao_firefly.cpp
  212. content_sao_mobv2.cpp
  213. content_sao_test.cpp
  214. + serverlinkableobject.cpp
  215. mapgen.cpp
  216. content_nodemeta.cpp
  217. content_mapnode.cpp
  218. @@ -177,6 +178,7 @@
  219. content_cao_firefly.cpp
  220. content_cao_mobv2.cpp
  221. content_cao_test.cpp
  222. + clientlinkableobject.cpp
  223. mesh.cpp
  224. mapblock_mesh.cpp
  225. farmesh.cpp
  226. diff -Naur -x '*.o' -x .git -x CMakeFiles -x lua -x sqlite -x '*.s' -x cmake_install.cmake -x jthread -x Makefile ../git/minetest.modif/src/content_cao_lua.cpp src/content_cao_lua.cpp
  227. --- ../git/minetest.modif/src/content_cao_lua.cpp 2012-01-09 20:40:04.000000000 +0100
  228. +++ src/content_cao_lua.cpp 2012-01-09 19:42:09.000000000 +0100
  229. @@ -43,6 +43,7 @@
  230. {
  231. if(gamedef == NULL)
  232. ClientActiveObject::registerType(LuaEntityCAO::getType(), LuaEntityCAO::create);
  233. +
  234. }
  235.  
  236. void LuaEntityCAO::initialize(const std::string &data)
  237. @@ -177,35 +178,40 @@
  238.  
  239. void LuaEntityCAO::step(float dtime, ClientEnvironment *env)
  240. {
  241. - if(m_prop->physical){
  242. - core::aabbox3d<f32> box = m_prop->collisionbox;
  243. - box.MinEdge *= BS;
  244. - box.MaxEdge *= BS;
  245. - collisionMoveResult moveresult;
  246. - f32 pos_max_d = BS*0.25; // Distance per iteration
  247. - v3f p_pos = m_position;
  248. - v3f p_velocity = m_velocity;
  249. - IGameDef *gamedef = env->getGameDef();
  250. - moveresult = collisionMovePrecise(&env->getMap(), gamedef,
  251. - pos_max_d, box, dtime, p_pos, p_velocity);
  252. - // Apply results
  253. - m_position = p_pos;
  254. - m_velocity = p_velocity;
  255. -
  256. - bool is_end_position = moveresult.collides;
  257. - pos_translator.update(m_position, is_end_position, dtime);
  258. - pos_translator.translate(dtime);
  259. - updateNodePos();
  260. + //if liked movement is handled by parent entity
  261. + if(!this->isLinked()) {
  262. + if(m_prop->physical){
  263. + core::aabbox3d<f32> box = m_prop->collisionbox;
  264. + box.MinEdge *= BS;
  265. + box.MaxEdge *= BS;
  266. + collisionMoveResult moveresult;
  267. + f32 pos_max_d = BS*0.25; // Distance per iteration
  268. + v3f p_pos = m_position;
  269. + v3f p_velocity = m_velocity;
  270. + IGameDef *gamedef = env->getGameDef();
  271. + moveresult = collisionMovePrecise(&env->getMap(), gamedef,
  272. + pos_max_d, box, dtime, p_pos, p_velocity);
  273. + // Apply results
  274. + m_position = p_pos;
  275. + m_velocity = p_velocity;
  276. +
  277. + bool is_end_position = moveresult.collides;
  278. + pos_translator.update(m_position, is_end_position, dtime);
  279. + pos_translator.translate(dtime);
  280. + updateNodePos();
  281.  
  282. - m_velocity += dtime * m_acceleration;
  283. - } else {
  284. - m_position += dtime * m_velocity + 0.5 * dtime * dtime * m_acceleration;
  285. - m_velocity += dtime * m_acceleration;
  286. - pos_translator.update(m_position, pos_translator.aim_is_end, pos_translator.anim_time);
  287. - pos_translator.translate(dtime);
  288. - updateNodePos();
  289. + m_velocity += dtime * m_acceleration;
  290. + } else {
  291. + m_position += dtime * m_velocity + 0.5 * dtime * dtime * m_acceleration;
  292. + m_velocity += dtime * m_acceleration;
  293. + pos_translator.update(m_position, pos_translator.aim_is_end, pos_translator.anim_time);
  294. + pos_translator.translate(dtime);
  295. + updateNodePos();
  296. + }
  297. }
  298.  
  299. + stepLinkedObjects(this->m_position,dtime);
  300. +
  301. m_anim_timer += dtime;
  302. if(m_anim_timer >= m_anim_framelength){
  303. m_anim_timer -= m_anim_framelength;
  304. @@ -352,4 +358,20 @@
  305.  
  306. updateTexturePos();
  307. }
  308. + else if (handleLinkUnlinkMessages(cmd,&is,this->m_env))
  309. + {
  310. + //Link unlink already done in handleLinkUnlinkMessages!
  311. + }
  312. }
  313. +
  314. +void LuaEntityCAO::setPosition(v3f toset, float dtime){
  315. +
  316. + if (this->isLinked()) {
  317. + this->m_position = toset + this->m_linkOffset;
  318. +
  319. + pos_translator.update(m_position, pos_translator.aim_is_end, pos_translator.anim_time);
  320. + pos_translator.translate(dtime);
  321. + updateNodePos();
  322. + }
  323. +
  324. +}
  325. diff -Naur -x '*.o' -x .git -x CMakeFiles -x lua -x sqlite -x '*.s' -x cmake_install.cmake -x jthread -x Makefile ../git/minetest.modif/src/content_cao_lua.h src/content_cao_lua.h
  326. --- ../git/minetest.modif/src/content_cao_lua.h 2012-01-09 20:40:04.000000000 +0100
  327. +++ src/content_cao_lua.h 2012-01-09 19:39:48.000000000 +0100
  328. @@ -20,10 +20,12 @@
  329. #ifndef CONTENT_COA_LUA_H_
  330. #define CONTENT_COA_LUA_H_
  331.  
  332. +#include <list>
  333. #include "content_cao.h"
  334. +#include "clientlinkableobject.h"
  335. #include "luaentity_common.h"
  336.  
  337. -class LuaEntityCAO : public ClientActiveObject
  338. +class LuaEntityCAO : public ClientActiveObject, public ClientLinkableObject
  339. {
  340. private:
  341. core::aabbox3d<f32> m_selection_box;
  342. @@ -61,6 +63,8 @@
  343. inline v3f getPosition()
  344. { return pos_translator.vect_show; }
  345.  
  346. + void setPosition(v3f toset, float dtime);
  347. +
  348. void addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
  349. IrrlichtDevice *irr);
  350.  
  351. diff -Naur -x '*.o' -x .git -x CMakeFiles -x lua -x sqlite -x '*.s' -x cmake_install.cmake -x jthread -x Makefile ../git/minetest.modif/src/content_sao_lua.cpp src/content_sao_lua.cpp
  352. --- ../git/minetest.modif/src/content_sao_lua.cpp 2012-01-09 20:40:04.000000000 +0100
  353. +++ src/content_sao_lua.cpp 2012-01-09 20:08:37.000000000 +0100
  354. @@ -277,6 +277,10 @@
  355.  
  356. void LuaEntitySAO::sendPosition(bool do_interpolate, bool is_movement_end)
  357. {
  358. + //don't send position updates if linked
  359. + if (isLinked()) {
  360. + return;
  361. + }
  362. m_last_sent_move_precision = m_base_position.getDistanceFrom(
  363. m_last_sent_position);
  364. m_last_sent_position_timer = 0;
  365. @@ -311,3 +315,11 @@
  366. m_messages_out.push_back(aom);
  367. }
  368.  
  369. +bool LuaEntitySAO::linkEntity(ServerActiveObject* parent,v3f offset) {
  370. + return ServerLinkableObject::linkEntity(parent,offset,getId(), &m_messages_out);
  371. +}
  372. +
  373. +bool LuaEntitySAO::unlinkEntity() {
  374. + return ServerLinkableObject::unlinkEntity(getId(), &m_messages_out);
  375. +}
  376. +
  377. diff -Naur -x '*.o' -x .git -x CMakeFiles -x lua -x sqlite -x '*.s' -x cmake_install.cmake -x jthread -x Makefile ../git/minetest.modif/src/content_sao_lua.h src/content_sao_lua.h
  378. --- ../git/minetest.modif/src/content_sao_lua.h 2012-01-09 20:40:04.000000000 +0100
  379. +++ src/content_sao_lua.h 2012-01-09 20:06:19.000000000 +0100
  380. @@ -21,10 +21,11 @@
  381. #define CONTENT_SAO_LUA_H_
  382.  
  383. #include "content_sao.h"
  384. +#include "serverlinkableobject.h"
  385. #include "scriptapi.h"
  386. #include "luaentity_common.h"
  387.  
  388. -class LuaEntitySAO : public ServerActiveObject
  389. +class LuaEntitySAO : public ServerActiveObject, public ServerLinkableObject
  390. {
  391. public:
  392. LuaEntitySAO(ServerEnvironment *env, v3f pos,
  393. @@ -54,6 +55,10 @@
  394. void setSprite(v2s16 p, int num_frames, float framelength,
  395. bool select_horiz_by_yawpitch);
  396. std::string getName();
  397. +
  398. + bool linkEntity(ServerActiveObject* parent,v3f offset);
  399. + bool unlinkEntity();
  400. +
  401. private:
  402. void sendPosition(bool do_interpolate, bool is_movement_end);
  403.  
  404. diff -Naur -x '*.o' -x .git -x CMakeFiles -x lua -x sqlite -x '*.s' -x cmake_install.cmake -x jthread -x Makefile ../git/minetest.modif/src/scriptapi.cpp src/scriptapi.cpp
  405. --- ../git/minetest.modif/src/scriptapi.cpp 2012-01-09 20:40:04.000000000 +0100
  406. +++ src/scriptapi.cpp 2012-01-09 02:15:46.000000000 +0100
  407. @@ -2176,6 +2176,58 @@
  408. return 1;
  409. }
  410.  
  411. + // link(parent, offset)
  412. + static int l_link(lua_State *L)
  413. + {
  414. + ObjectRef *ref_child = checkobject(L, 1);
  415. + ObjectRef *ref_parent = checkobject(L, 2);
  416. + v3f offset = checkFloatPos(L, 3);
  417. + std::cout << "parameters read" << std::endl;
  418. +
  419. + ServerActiveObject *child = getobject(ref_child);
  420. + ServerActiveObject *parent = getobject(ref_parent);
  421. +
  422. + if (child == NULL) return 0;
  423. + if (parent == NULL) return 0;
  424. +
  425. +
  426. + LuaEntitySAO* child_lua = dynamic_cast<LuaEntitySAO*>(child);
  427. + LuaEntitySAO* parent_lua = dynamic_cast<LuaEntitySAO*>(parent);
  428. +
  429. + if (child_lua == NULL) return 0;
  430. + if (parent_lua == NULL) return 0;
  431. +
  432. + if (child_lua->linkEntity(parent_lua,offset)) {
  433. + lua_pushboolean(L, true);
  434. + return 1;
  435. + }
  436. + else {
  437. + return 0;
  438. + }
  439. + }
  440. +
  441. + // unlink()
  442. + static int l_unlink(lua_State *L)
  443. + {
  444. + ObjectRef *ref = checkobject(L, 1);
  445. +
  446. + ServerActiveObject *obj = getobject(ref);
  447. +
  448. + if (obj == NULL) return 0;
  449. +
  450. + LuaEntitySAO* tolink = dynamic_cast<LuaEntitySAO*>(obj);
  451. +
  452. + if (tolink == NULL) return 0;
  453. +
  454. + if (tolink->unlinkEntity()) {
  455. + lua_pushboolean(L, true);
  456. + return 1;
  457. + }
  458. + else {
  459. + return 0;
  460. + }
  461. + }
  462. +
  463. public:
  464. ObjectRef(ServerActiveObject *object):
  465. m_object(object)
  466. @@ -2273,6 +2325,8 @@
  467. method(ObjectRef, get_look_dir),
  468. method(ObjectRef, get_look_pitch),
  469. method(ObjectRef, get_look_yaw),
  470. + method(ObjectRef, link),
  471. + method(ObjectRef, unlink),
  472. {0,0}
  473. };
  474.  
  475. diff -Naur -x '*.o' -x .git -x CMakeFiles -x lua -x sqlite -x '*.s' -x cmake_install.cmake -x jthread -x Makefile ../git/minetest.modif/src/serverlinkableobject.cpp src/serverlinkableobject.cpp
  476. --- ../git/minetest.modif/src/serverlinkableobject.cpp 1970-01-01 01:00:00.000000000 +0100
  477. +++ src/serverlinkableobject.cpp 2012-01-09 20:09:55.000000000 +0100
  478. @@ -0,0 +1,61 @@
  479. +/*
  480. +Minetest-c55
  481. +Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
  482. +Copyright (C) 2012 sapier sapier at gmx dot net
  483. +
  484. +This program is free software; you can redistribute it and/or modify
  485. +it under the terms of the GNU General Public License as published by
  486. +the Free Software Foundation; either version 2 of the License, or
  487. +(at your option) any later version.
  488. +
  489. +This program is distributed in the hope that it will be useful,
  490. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  491. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  492. +GNU General Public License for more details.
  493. +
  494. +You should have received a copy of the GNU General Public License along
  495. +with this program; if not, write to the Free Software Foundation, Inc.,
  496. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  497. +*/
  498. +
  499. +#include "serverlinkableobject.h"
  500. +
  501. +
  502. +ServerLinkableObject::ServerLinkableObject() {
  503. + this->m_Linked = false;
  504. +}
  505. +
  506. +ServerLinkableObject::~ServerLinkableObject() {}
  507. +
  508. +bool ServerLinkableObject::linkEntity(ServerActiveObject* parent,v3f offset,u16 id, Queue<ActiveObjectMessage>* message_queue) {
  509. + //check if entity is in correct state
  510. + if (this->m_Linked == true) {
  511. + return false;
  512. + }
  513. + std::ostringstream os(std::ios::binary);
  514. + writeU8(os, AO_Message_type::Link);
  515. + // parameters
  516. + writeU16(os, parent->getId());
  517. + writeV3F1000(os, offset);
  518. +
  519. + this->m_Linked = true;
  520. + // create message and add to list
  521. + ActiveObjectMessage aom(id, false, os.str());
  522. + message_queue->push_back(aom);
  523. + return true;
  524. +}
  525. +
  526. +bool ServerLinkableObject::unlinkEntity(u16 id, Queue<ActiveObjectMessage>* message_queue) {
  527. + //check if entity is in correct state
  528. + if (this->m_Linked == false) {
  529. + return false;
  530. + }
  531. +
  532. + this->m_Linked = false;
  533. + std::ostringstream os(std::ios::binary);
  534. + writeU8(os, AO_Message_type::UnLink);
  535. + // create message and add to list
  536. + ActiveObjectMessage aom(id, false, os.str());
  537. + message_queue->push_back(aom);
  538. + return true;
  539. +}
  540. diff -Naur -x '*.o' -x .git -x CMakeFiles -x lua -x sqlite -x '*.s' -x cmake_install.cmake -x jthread -x Makefile ../git/minetest.modif/src/serverlinkableobject.h src/serverlinkableobject.h
  541. --- ../git/minetest.modif/src/serverlinkableobject.h 1970-01-01 01:00:00.000000000 +0100
  542. +++ src/serverlinkableobject.h 2012-01-09 20:19:59.000000000 +0100
  543. @@ -0,0 +1,46 @@
  544. +/*
  545. +Minetest-c55
  546. +Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
  547. +Copyright (C) 2012 sapier sapier at gmx dot net
  548. +
  549. +This program is free software; you can redistribute it and/or modify
  550. +it under the terms of the GNU General Public License as published by
  551. +the Free Software Foundation; either version 2 of the License, or
  552. +(at your option) any later version.
  553. +
  554. +This program is distributed in the hope that it will be useful,
  555. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  556. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  557. +GNU General Public License for more details.
  558. +
  559. +You should have received a copy of the GNU General Public License along
  560. +with this program; if not, write to the Free Software Foundation, Inc.,
  561. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  562. +*/
  563. +
  564. +#ifndef SERVERLINKABLEOBJECT_H_
  565. +#define SERVERLINKABLEOBJECT_H_
  566. +
  567. +#include <sstream>
  568. +#include <irrlichttypes.h>
  569. +#include "serverobject.h"
  570. +#include "content_object.h"
  571. +
  572. +class ServerLinkableObject {
  573. + public:
  574. + ServerLinkableObject();
  575. + ~ServerLinkableObject();
  576. +
  577. + virtual bool linkEntity(ServerActiveObject* parent,v3f offset) = 0;
  578. + virtual bool unlinkEntity() = 0;
  579. +
  580. + protected:
  581. + inline bool isLinked() { return m_Linked; }
  582. + bool linkEntity(ServerActiveObject* parent,v3f offset,u16 id, Queue<ActiveObjectMessage>* message_queue);
  583. + bool unlinkEntity(u16 id, Queue<ActiveObjectMessage>* message_queue);
  584. + private:
  585. + bool m_Linked;
  586. +
  587. +};
  588. +
  589. +#endif /* SERVERLINKABLEOBJECT_H_ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement