2006-01-19 Al Riddoch <alriddoch@zepler.org>
* aiclient/ClientAccount.cpp, aiclient/ClientAccount.h,
aiclient/ClientConnection.cpp, aiclient/ClientConnection.h,
aiclient/client.cpp, aiclient/client.h, client/BaseClient.cpp,
client/BaseClient.h, client/CharacterClient.cpp,
client/CharacterClient.h, client/ClientConnection.cpp,
client/ClientConnection.h, client/CreatorClient.cpp,
client/CreatorClient.h, client/ObserverClient.cpp,
client/ObserverClient.h, client/Py_CreatorClient.cpp,
client/Py_CreatorClient.h, client/client.cpp,
client/define_world.cpp, client/define_world.h, common/Add.h,
common/Affect.h, common/AtlasFileLoader.cpp,
common/AtlasFileLoader.h, common/Attack.h, common/BaseEntity.cpp,
common/BaseEntity.h, common/BaseWorld.cpp, common/BaseWorld.h,
common/Burn.h, common/Chop.h, common/Connect.h, common/CustomOp.cpp,
common/CustomOp.h, common/CustomOp_impl.h, common/Cut.h,
common/Database.cpp, common/Database.h, common/Delve.h, common/Dig.h,
common/Eat.h, common/FormattedXMLWriter.cpp,
common/FormattedXMLWriter.h, common/Generic.h, common/Load.h,
common/Monitor.h, common/Mow.h, common/Nourish.h,
common/OOGThing.cpp, common/OOGThing.h, common/Property.cpp,
common/Property.h, common/Property_impl.h, common/Save.h,
common/Setup.h, common/Tick.h, common/Unseen.h, common/Update.h,
common/Use.h, common/Wield.h, common/accountbase.cpp,
common/accountbase.h, common/const.cpp, common/const.h,
common/custom.cpp, common/debug.h, common/globals.cpp,
common/globals.h, common/id.cpp, common/id.h, common/inheritance.cpp,
common/inheritance.h, common/inheritance_impl.h, common/log.cpp,
common/log.h, common/newid.cpp, common/nls.h, common/op_switch.h,
common/operations.cpp, common/operations.h, common/random.h,
common/refno.h, common/serialno.cpp, common/serialno.h,
common/system.cpp, common/system.h, common/terrain_utils.cpp,
common/terrain_utils.h, common/type_utils.h, common/types.h,
common/utility.cpp, common/utility.h, modules/DateTime.cpp,
modules/DateTime.h, modules/Location.cpp, modules/Location.h,
modules/WorldTime.cpp, modules/WorldTime.h, physics/BBox.cpp,
physics/BBox.h, physics/Collision.cpp, physics/Collision.h,
physics/Quaternion.cpp, physics/Quaternion.h, physics/Vector3D.cpp,
physics/Vector3D.h, physics/VectorPol.h, rulesets/Area.cpp,
rulesets/Area.h, rulesets/AreaProperty.cpp, rulesets/AreaProperty.h,
rulesets/ArithmeticScript.cpp, rulesets/ArithmeticScript.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/CalendarProperty.cpp, rulesets/CalendarProperty.h,
rulesets/Character.cpp, rulesets/Character.h, rulesets/Combat.cpp,
rulesets/Combat.h, rulesets/Container.cpp, rulesets/Container.h,
rulesets/Creator.cpp, rulesets/Creator.h, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/EntityProperties.cpp,
rulesets/Entity_getLocation.h, rulesets/Fell.cpp, rulesets/Fell.h,
rulesets/Food.cpp, rulesets/Food.h, rulesets/Line.cpp,
rulesets/Line.h, rulesets/LineProperty.cpp, rulesets/LineProperty.h,
rulesets/MemEntity.cpp, rulesets/MemEntity.h, rulesets/MemMap.cpp,
rulesets/MemMap.h, rulesets/MemMap_methods.h,
rulesets/MindFactory.cpp, rulesets/MindFactory.h, rulesets/Missile.h,
rulesets/Motion.cpp, rulesets/Motion.h, rulesets/Movement.cpp,
rulesets/Movement.h, rulesets/Pedestrian.cpp, rulesets/Pedestrian.h,
rulesets/Plant.cpp, rulesets/Plant.h, rulesets/Py_BBox.cpp,
rulesets/Py_BBox.h, rulesets/Py_EntityWrapper.h,
rulesets/Py_Location.cpp, rulesets/Py_Location.h,
rulesets/Py_Map.cpp, rulesets/Py_Map.h, rulesets/Py_Mind.cpp,
rulesets/Py_Mind.h, rulesets/Py_Object.cpp, rulesets/Py_Object.h,
rulesets/Py_Operation.cpp, rulesets/Py_Operation.h,
rulesets/Py_Oplist.cpp, rulesets/Py_Oplist.h, rulesets/Py_Optime.cpp,
rulesets/Py_Optime.h, rulesets/Py_Point3D.cpp, rulesets/Py_Point3D.h,
rulesets/Py_Property.cpp, rulesets/Py_Property.h,
rulesets/Py_Quaternion.cpp, rulesets/Py_Quaternion.h,
rulesets/Py_RootEntity.cpp, rulesets/Py_RootEntity.h,
rulesets/Py_Statistics.cpp, rulesets/Py_Statistics.h,
rulesets/Py_Task.cpp, rulesets/Py_Task.h, rulesets/Py_Thing.cpp,
rulesets/Py_Thing.h, rulesets/Py_Vector3D.cpp,
rulesets/Py_Vector3D.h, rulesets/Py_World.cpp, rulesets/Py_World.h,
rulesets/Py_WorldTime.cpp, rulesets/Py_WorldTime.h,
rulesets/PythonArithmeticScript.cpp,
rulesets/PythonArithmeticScript.h, rulesets/PythonMindScript.cpp,
rulesets/PythonMindScript.h, rulesets/PythonScript.cpp,
rulesets/PythonScript.h, rulesets/PythonThingScript.cpp,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Python_API.cpp,
rulesets/Python_API.h, rulesets/Python_Script_Utils.h,
rulesets/Script.cpp, rulesets/Script.h, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Statistics.cpp, rulesets/Statistics.h,
rulesets/StatisticsProperty.cpp, rulesets/StatisticsProperty.h,
rulesets/Structure.cpp, rulesets/Structure.h, rulesets/Task.cpp,
rulesets/Task.h, rulesets/TaskScript.cpp, rulesets/TaskScript.h,
rulesets/TerrainProperty.cpp, rulesets/TerrainProperty.h,
rulesets/Thing.cpp, rulesets/Thing.h, rulesets/ThingFactory.cpp,
rulesets/ThingFactory.h, rulesets/World.cpp, rulesets/World.h,
rulesets/attributes.h, server/Account.cpp, server/Account.h,
server/Admin.cpp, server/Admin.h, server/ArithmeticFactory.cpp,
server/ArithmeticFactory.h, server/CommClient.cpp,
server/CommClient.h, server/CommIdleSocket.cpp,
server/CommIdleSocket.h, server/CommListener.cpp,
server/CommListener.h, server/CommLocalClient.cpp,
server/CommLocalClient.h, server/CommMDNSPublisher.cpp,
server/CommMDNSPublisher.h, server/CommMaster.cpp,
server/CommMaster.h, server/CommMetaClient.cpp,
server/CommMetaClient.h, server/CommPSQLSocket.cpp,
server/CommPSQLSocket.h, server/CommPeer.cpp,
server/CommPeer.h, server/CommPeerListener.cpp,
server/CommPeerListener.h, server/CommRemoteClient.cpp,
server/CommRemoteClient.h, server/CommServer.cpp,
server/CommServer.h, server/CommSlaveClient.cpp,
server/CommSlaveClient.h, server/CommSlaveListener.cpp,
server/CommSlaveListener.h, server/CommSocket.cpp,
server/CommSocket.h, server/CommUnixListener.cpp,
server/CommUnixListener.h, server/Connection.cpp,
server/Connection.h, server/Connection_methods.h,
server/EntityFactory.cpp, server/EntityFactory.h,
server/ExternalMind.cpp, server/ExternalMind.h,
server/Idle.cpp, server/Idle.h, server/Lobby.cpp, server/Lobby.h,
server/Master.cpp, server/Master.h, server/Peer.cpp, server/Peer.h,
server/Persistance.cpp, server/Persistance.h,
server/PersistantThingFactory.cpp, server/PersistantThingFactory.h,
server/PersistantThingFactory_impl.h, server/Persistor.cpp,
server/Persistor.h, server/Persistor_impl.h,
server/Player.cpp, server/Player.h, server/Restoration.cpp,
server/Restoration.h, server/Restorer.cpp, server/Restorer.h,
server/Restorer_impl.h, server/ScriptFactory.cpp,
server/ScriptFactory.h, server/ServerRouting.cpp,
server/ServerRouting.h, server/ServerRouting_methods.h,
server/SlaveClientConnection.cpp, server/SlaveClientConnection.h,
server/TaskFactory.cpp, server/TaskFactory.h,
server/TrustedConnection.cpp, server/TrustedConnection.h,
server/WorldRouter.cpp, server/WorldRouter.h,
server/server.cpp, server/server.h, server/slave.cpp,
tests/Areatest.cpp, tests/BaseEntitytest.cpp,
tests/Charactertest.cpp, tests/Containertest.cpp,
tests/Creatortest.cpp, tests/EntityExerciser.h,
tests/EntityFactorytest.cpp, tests/Entitytest.cpp,
tests/Foodtest.cpp, tests/IGEntityExerciser.h,
tests/Linetest.cpp, tests/Locationtest.cpp, tests/OOGThingtest.cpp,
tests/Planttest.cpp, tests/Propertytest.cpp, tests/Stackabletest.cpp,
tests/Structuretest.cpp, tests/Tasktest.cpp, tests/TestWorld.h,
tests/Thingtest.cpp, tests/WorldTimetest.cpp, tests/Worldtest.cpp,
tests/allOperations.h, tests/collisiontest.cpp, tests/consttest.cpp,
tests/distancetest.cpp, tests/emergencetest.cpp,
tests/inheritancetest.cpp, tests/logtest.cpp, tests/randomtest.cpp,
tests/systemtest.cpp, tests/transformtest.cpp,
tests/type_utilstest.cpp, tests/utilitytest.cpp,
tools/AdminClient.cpp, tools/AdminClient.h, tools/cyaddrules.cpp,
tools/cycmd.cpp, tools/cyconfig.cpp, tools/cyconvertrules.cpp,
tools/cyctrl.cpp, tools/cydbload.cpp, tools/cydumprules.cpp,
tools/cyisoload.cpp, tools/cyloadrules.cpp, tools/cypasswd.cpp,
tools/cywatchdog.cpp: Replace the copyright and license statements
with new versions that include disclaimer of warranty, and
permit distribution under later versions of the GPL.
2006-01-19 02:17:06 +00:00
|
|
|
// Cyphesis Online RPG Server and AI Engine
|
2005-05-18 22:32:58 +00:00
|
|
|
// Copyright (C) 2000-2005 Alistair Riddoch
|
2006-01-19 Al Riddoch <alriddoch@zepler.org>
* aiclient/ClientAccount.cpp, aiclient/ClientAccount.h,
aiclient/ClientConnection.cpp, aiclient/ClientConnection.h,
aiclient/client.cpp, aiclient/client.h, client/BaseClient.cpp,
client/BaseClient.h, client/CharacterClient.cpp,
client/CharacterClient.h, client/ClientConnection.cpp,
client/ClientConnection.h, client/CreatorClient.cpp,
client/CreatorClient.h, client/ObserverClient.cpp,
client/ObserverClient.h, client/Py_CreatorClient.cpp,
client/Py_CreatorClient.h, client/client.cpp,
client/define_world.cpp, client/define_world.h, common/Add.h,
common/Affect.h, common/AtlasFileLoader.cpp,
common/AtlasFileLoader.h, common/Attack.h, common/BaseEntity.cpp,
common/BaseEntity.h, common/BaseWorld.cpp, common/BaseWorld.h,
common/Burn.h, common/Chop.h, common/Connect.h, common/CustomOp.cpp,
common/CustomOp.h, common/CustomOp_impl.h, common/Cut.h,
common/Database.cpp, common/Database.h, common/Delve.h, common/Dig.h,
common/Eat.h, common/FormattedXMLWriter.cpp,
common/FormattedXMLWriter.h, common/Generic.h, common/Load.h,
common/Monitor.h, common/Mow.h, common/Nourish.h,
common/OOGThing.cpp, common/OOGThing.h, common/Property.cpp,
common/Property.h, common/Property_impl.h, common/Save.h,
common/Setup.h, common/Tick.h, common/Unseen.h, common/Update.h,
common/Use.h, common/Wield.h, common/accountbase.cpp,
common/accountbase.h, common/const.cpp, common/const.h,
common/custom.cpp, common/debug.h, common/globals.cpp,
common/globals.h, common/id.cpp, common/id.h, common/inheritance.cpp,
common/inheritance.h, common/inheritance_impl.h, common/log.cpp,
common/log.h, common/newid.cpp, common/nls.h, common/op_switch.h,
common/operations.cpp, common/operations.h, common/random.h,
common/refno.h, common/serialno.cpp, common/serialno.h,
common/system.cpp, common/system.h, common/terrain_utils.cpp,
common/terrain_utils.h, common/type_utils.h, common/types.h,
common/utility.cpp, common/utility.h, modules/DateTime.cpp,
modules/DateTime.h, modules/Location.cpp, modules/Location.h,
modules/WorldTime.cpp, modules/WorldTime.h, physics/BBox.cpp,
physics/BBox.h, physics/Collision.cpp, physics/Collision.h,
physics/Quaternion.cpp, physics/Quaternion.h, physics/Vector3D.cpp,
physics/Vector3D.h, physics/VectorPol.h, rulesets/Area.cpp,
rulesets/Area.h, rulesets/AreaProperty.cpp, rulesets/AreaProperty.h,
rulesets/ArithmeticScript.cpp, rulesets/ArithmeticScript.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/CalendarProperty.cpp, rulesets/CalendarProperty.h,
rulesets/Character.cpp, rulesets/Character.h, rulesets/Combat.cpp,
rulesets/Combat.h, rulesets/Container.cpp, rulesets/Container.h,
rulesets/Creator.cpp, rulesets/Creator.h, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/EntityProperties.cpp,
rulesets/Entity_getLocation.h, rulesets/Fell.cpp, rulesets/Fell.h,
rulesets/Food.cpp, rulesets/Food.h, rulesets/Line.cpp,
rulesets/Line.h, rulesets/LineProperty.cpp, rulesets/LineProperty.h,
rulesets/MemEntity.cpp, rulesets/MemEntity.h, rulesets/MemMap.cpp,
rulesets/MemMap.h, rulesets/MemMap_methods.h,
rulesets/MindFactory.cpp, rulesets/MindFactory.h, rulesets/Missile.h,
rulesets/Motion.cpp, rulesets/Motion.h, rulesets/Movement.cpp,
rulesets/Movement.h, rulesets/Pedestrian.cpp, rulesets/Pedestrian.h,
rulesets/Plant.cpp, rulesets/Plant.h, rulesets/Py_BBox.cpp,
rulesets/Py_BBox.h, rulesets/Py_EntityWrapper.h,
rulesets/Py_Location.cpp, rulesets/Py_Location.h,
rulesets/Py_Map.cpp, rulesets/Py_Map.h, rulesets/Py_Mind.cpp,
rulesets/Py_Mind.h, rulesets/Py_Object.cpp, rulesets/Py_Object.h,
rulesets/Py_Operation.cpp, rulesets/Py_Operation.h,
rulesets/Py_Oplist.cpp, rulesets/Py_Oplist.h, rulesets/Py_Optime.cpp,
rulesets/Py_Optime.h, rulesets/Py_Point3D.cpp, rulesets/Py_Point3D.h,
rulesets/Py_Property.cpp, rulesets/Py_Property.h,
rulesets/Py_Quaternion.cpp, rulesets/Py_Quaternion.h,
rulesets/Py_RootEntity.cpp, rulesets/Py_RootEntity.h,
rulesets/Py_Statistics.cpp, rulesets/Py_Statistics.h,
rulesets/Py_Task.cpp, rulesets/Py_Task.h, rulesets/Py_Thing.cpp,
rulesets/Py_Thing.h, rulesets/Py_Vector3D.cpp,
rulesets/Py_Vector3D.h, rulesets/Py_World.cpp, rulesets/Py_World.h,
rulesets/Py_WorldTime.cpp, rulesets/Py_WorldTime.h,
rulesets/PythonArithmeticScript.cpp,
rulesets/PythonArithmeticScript.h, rulesets/PythonMindScript.cpp,
rulesets/PythonMindScript.h, rulesets/PythonScript.cpp,
rulesets/PythonScript.h, rulesets/PythonThingScript.cpp,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Python_API.cpp,
rulesets/Python_API.h, rulesets/Python_Script_Utils.h,
rulesets/Script.cpp, rulesets/Script.h, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Statistics.cpp, rulesets/Statistics.h,
rulesets/StatisticsProperty.cpp, rulesets/StatisticsProperty.h,
rulesets/Structure.cpp, rulesets/Structure.h, rulesets/Task.cpp,
rulesets/Task.h, rulesets/TaskScript.cpp, rulesets/TaskScript.h,
rulesets/TerrainProperty.cpp, rulesets/TerrainProperty.h,
rulesets/Thing.cpp, rulesets/Thing.h, rulesets/ThingFactory.cpp,
rulesets/ThingFactory.h, rulesets/World.cpp, rulesets/World.h,
rulesets/attributes.h, server/Account.cpp, server/Account.h,
server/Admin.cpp, server/Admin.h, server/ArithmeticFactory.cpp,
server/ArithmeticFactory.h, server/CommClient.cpp,
server/CommClient.h, server/CommIdleSocket.cpp,
server/CommIdleSocket.h, server/CommListener.cpp,
server/CommListener.h, server/CommLocalClient.cpp,
server/CommLocalClient.h, server/CommMDNSPublisher.cpp,
server/CommMDNSPublisher.h, server/CommMaster.cpp,
server/CommMaster.h, server/CommMetaClient.cpp,
server/CommMetaClient.h, server/CommPSQLSocket.cpp,
server/CommPSQLSocket.h, server/CommPeer.cpp,
server/CommPeer.h, server/CommPeerListener.cpp,
server/CommPeerListener.h, server/CommRemoteClient.cpp,
server/CommRemoteClient.h, server/CommServer.cpp,
server/CommServer.h, server/CommSlaveClient.cpp,
server/CommSlaveClient.h, server/CommSlaveListener.cpp,
server/CommSlaveListener.h, server/CommSocket.cpp,
server/CommSocket.h, server/CommUnixListener.cpp,
server/CommUnixListener.h, server/Connection.cpp,
server/Connection.h, server/Connection_methods.h,
server/EntityFactory.cpp, server/EntityFactory.h,
server/ExternalMind.cpp, server/ExternalMind.h,
server/Idle.cpp, server/Idle.h, server/Lobby.cpp, server/Lobby.h,
server/Master.cpp, server/Master.h, server/Peer.cpp, server/Peer.h,
server/Persistance.cpp, server/Persistance.h,
server/PersistantThingFactory.cpp, server/PersistantThingFactory.h,
server/PersistantThingFactory_impl.h, server/Persistor.cpp,
server/Persistor.h, server/Persistor_impl.h,
server/Player.cpp, server/Player.h, server/Restoration.cpp,
server/Restoration.h, server/Restorer.cpp, server/Restorer.h,
server/Restorer_impl.h, server/ScriptFactory.cpp,
server/ScriptFactory.h, server/ServerRouting.cpp,
server/ServerRouting.h, server/ServerRouting_methods.h,
server/SlaveClientConnection.cpp, server/SlaveClientConnection.h,
server/TaskFactory.cpp, server/TaskFactory.h,
server/TrustedConnection.cpp, server/TrustedConnection.h,
server/WorldRouter.cpp, server/WorldRouter.h,
server/server.cpp, server/server.h, server/slave.cpp,
tests/Areatest.cpp, tests/BaseEntitytest.cpp,
tests/Charactertest.cpp, tests/Containertest.cpp,
tests/Creatortest.cpp, tests/EntityExerciser.h,
tests/EntityFactorytest.cpp, tests/Entitytest.cpp,
tests/Foodtest.cpp, tests/IGEntityExerciser.h,
tests/Linetest.cpp, tests/Locationtest.cpp, tests/OOGThingtest.cpp,
tests/Planttest.cpp, tests/Propertytest.cpp, tests/Stackabletest.cpp,
tests/Structuretest.cpp, tests/Tasktest.cpp, tests/TestWorld.h,
tests/Thingtest.cpp, tests/WorldTimetest.cpp, tests/Worldtest.cpp,
tests/allOperations.h, tests/collisiontest.cpp, tests/consttest.cpp,
tests/distancetest.cpp, tests/emergencetest.cpp,
tests/inheritancetest.cpp, tests/logtest.cpp, tests/randomtest.cpp,
tests/systemtest.cpp, tests/transformtest.cpp,
tests/type_utilstest.cpp, tests/utilitytest.cpp,
tools/AdminClient.cpp, tools/AdminClient.h, tools/cyaddrules.cpp,
tools/cycmd.cpp, tools/cyconfig.cpp, tools/cyconvertrules.cpp,
tools/cyctrl.cpp, tools/cydbload.cpp, tools/cydumprules.cpp,
tools/cyisoload.cpp, tools/cyloadrules.cpp, tools/cypasswd.cpp,
tools/cywatchdog.cpp: Replace the copyright and license statements
with new versions that include disclaimer of warranty, and
permit distribution under later versions of the GPL.
2006-01-19 02:17:06 +00:00
|
|
|
//
|
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
|
// along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2001-04-18 10:37:09 +00:00
|
|
|
|
2002-07-14 21:04:50 +00:00
|
|
|
#include "World.h"
|
|
|
|
|
|
2004-11-02 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.cpp, rulesets/Entity.h: Make get(), set(), and
addToMessage() non-virtual, and convert them to using new property
mechanism. Add the necessary properties in the constructor.
* rulesets/Area.cpp, rulesets/Area.h, rulesets/Character.cpp,
rulesets/Character.h, rulesets/Line.cpp, rulesets/Line.h,
rulesets/Plant.cpp, rulesets/Plant.h, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/World.cpp, rulesets/World.h:
Remove virtual get() set() and addToMessage() methods. These
are now entirely in Entity.
* rulesets/World.cpp, rulesets/World.h: Remove some functions
for handling terrain data now handled by properties.
Clean up Set code to get rid of nasty unnecessary exception
try / catch block.
2004-11-02 20:44:24 +00:00
|
|
|
#include "TerrainProperty.h"
|
2005-12-14 17:16:21 +00:00
|
|
|
#include "CalendarProperty.h"
|
2004-11-02 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.cpp, rulesets/Entity.h: Make get(), set(), and
addToMessage() non-virtual, and convert them to using new property
mechanism. Add the necessary properties in the constructor.
* rulesets/Area.cpp, rulesets/Area.h, rulesets/Character.cpp,
rulesets/Character.h, rulesets/Line.cpp, rulesets/Line.h,
rulesets/Plant.cpp, rulesets/Plant.h, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/World.cpp, rulesets/World.h:
Remove virtual get() set() and addToMessage() methods. These
are now entirely in Entity.
* rulesets/World.cpp, rulesets/World.h: Remove some functions
for handling terrain data now handled by properties.
Clean up Set code to get rid of nasty unnecessary exception
try / catch block.
2004-11-02 20:44:24 +00:00
|
|
|
|
2003-03-07 00:22:12 +00:00
|
|
|
#include "common/log.h"
|
2003-03-21 Al Riddoch <alriddoch@zepler.org>
* client/Py_CreatorClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, rulesets/MemMap.cpp, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Thing.cpp, rulesets/Thing.h,
server/Account.cpp, server/Admin.cpp, server/Connection.cpp,
server/Lobby.cpp, server/ServerRouting.cpp:
Use a more efficient technique to set the attributes on
operation arguments without a copy.
* common/BaseEntity.cpp, rulesets/Entity.cpp, rulesets/Thing.h,
rulesets/World.cpp, server/WorldRouter.cpp:
Move handling IG Look ops into the IG code in rulesets.
2003-03-21 00:04:53 +00:00
|
|
|
#include "common/const.h"
|
|
|
|
|
#include "common/debug.h"
|
2005-06-28 14:35:31 +00:00
|
|
|
#include "common/inheritance.h"
|
2002-07-14 21:04:50 +00:00
|
|
|
|
2005-09-26 Al Riddoch <alriddoch@zepler.org>
* common/BaseEntity.cpp, common/custom.cpp, common/op_switch.h,
common/types.h, rulesets/BaseMind.cpp, rulesets/Character.cpp,
rulesets/Creator.cpp, rulesets/Food.cpp, rulesets/Plant.cpp,
rulesets/Thing.cpp, rulesets/World.cpp, server/Admin.cpp,
server/Admin.cpp: Replace OpNo enumeration with defines for the
integer class numbers. Expand the switch statements used for op
dispatch because runtime extended op definitions don't have a const
number.
* server/EntityFactory.cpp: Re-order installation of ops to ensure
the number registered in enumeration maps is the one returned by
the Atlas factories.
* rulesets/Character.cpp: Improve debug output for op handling when
debug is enabled for this file.
2005-09-26 00:06:19 +00:00
|
|
|
#include "common/Delve.h"
|
|
|
|
|
#include "common/Dig.h"
|
|
|
|
|
#include "common/Eat.h"
|
|
|
|
|
#include "common/Mow.h"
|
2005-07-01 01:12:44 +00:00
|
|
|
#include "common/Nourish.h"
|
|
|
|
|
|
2003-04-19 00:34:24 +00:00
|
|
|
#include <Mercator/Terrain.h>
|
2004-06-20 22:58:18 +00:00
|
|
|
#include <Mercator/Segment.h>
|
2005-05-05 00:22:05 +00:00
|
|
|
#include <Mercator/TileShader.h>
|
|
|
|
|
#include <Mercator/FillShader.h>
|
|
|
|
|
#include <Mercator/ThresholdShader.h>
|
|
|
|
|
#include <Mercator/DepthShader.h>
|
|
|
|
|
#include <Mercator/GrassShader.h>
|
|
|
|
|
#include <Mercator/Surface.h>
|
|
|
|
|
|
|
|
|
|
#include <wfmath/atlasconv.h>
|
2003-04-19 00:34:24 +00:00
|
|
|
|
2005-08-27 14:52:12 +00:00
|
|
|
#include <Atlas/Objects/Operation.h>
|
|
|
|
|
#include <Atlas/Objects/Anonymous.h>
|
2001-04-18 10:37:09 +00:00
|
|
|
|
2004-11-16 12:27:27 +00:00
|
|
|
#include <sstream>
|
|
|
|
|
|
2003-09-10 21:40:27 +00:00
|
|
|
#include <cassert>
|
|
|
|
|
|
2003-03-21 Al Riddoch <alriddoch@zepler.org>
* client/Py_CreatorClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, rulesets/MemMap.cpp, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Thing.cpp, rulesets/Thing.h,
server/Account.cpp, server/Admin.cpp, server/Connection.cpp,
server/Lobby.cpp, server/ServerRouting.cpp:
Use a more efficient technique to set the attributes on
operation arguments without a copy.
* common/BaseEntity.cpp, rulesets/Entity.cpp, rulesets/Thing.h,
rulesets/World.cpp, server/WorldRouter.cpp:
Move handling IG Look ops into the IG code in rulesets.
2003-03-21 00:04:53 +00:00
|
|
|
static const bool debug_flag = false;
|
|
|
|
|
|
2004-12-03 Al Riddoch <alriddoch@zepler.org>
* client/BaseClient.cpp, client/BaseClient.h,
client/CharacterClient.cpp, client/CharacterClient.h,
client/ClientConnection.cpp, client/ClientConnection.h,
client/CreatorClient.cpp, client/CreatorClient.h,
client/Py_CreatorClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, common/BaseWorld.h, common/custom.cpp,
common/inheritance.cpp, common/inheritance.h,
common/inheritance_impl.h, common/op_switch.h, common/type_utils.h,
common/types.h, common/utility.cpp, common/utility.h,
modules/Location.cpp, rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/Character.cpp, rulesets/Character.h, rulesets/Creator.cpp,
rulesets/Creator.h, rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/EntityProperties.cpp, rulesets/Entity_getLocation.h,
rulesets/Food.cpp, rulesets/Food.h, rulesets/MemMap.cpp,
rulesets/MemMap.h, rulesets/Missile.h, rulesets/Pedestrian.cpp,
rulesets/Plant.cpp, rulesets/Plant.h, rulesets/Py_Mind.cpp,
rulesets/Py_Object.cpp, rulesets/Py_Operation.cpp,
rulesets/Py_Operation.h, rulesets/Py_Thing.cpp,
rulesets/PythonMindScript.h, rulesets/PythonScript.h,
rulesets/PythonThingScript.h, rulesets/Python_API.cpp,
rulesets/Script.cpp, rulesets/Script.h, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h,
server/Account.cpp, server/Account.h server/Admin.cpp, server/Admin.h,
server/CommClient.cpp, server/Connection.cpp, server/Connection.h,
server/EntityFactory.cpp, server/EntityFactory.h, server/Lobby.cpp,
server/Lobby.h, server/Persistance.cpp, server/Persistance.h,
server/Persistor.cpp, server/Player.cpp, server/Player.h,
server/ServerRouting.cpp, server/ServerRouting.h,
server/TrustedConnection.cpp, server/TrustedConnection.h,
server/WorldRouter.cpp, server/WorldRouter.h, tests/Areatest.cpp,
tests/Charactertest.cpp, tests/Creatortest.cpp,
tests/EntityExerciser.h, tests/Entitytest.cpp, tests/Foodtest.cpp,
tests/IGEntityExerciser.h, tests/Linetest.cpp, tests/Planttest.cpp,
tests/Stackabletest.cpp, tests/Structuretest.cpp, tests/Thingtest.cpp,
tests/Worldtest.cpp, tests/allOperations.h, tests/inheritancetest.cpp,
tests/utilitytest.cpp, tools/cycmd.cpp:
Modify the entity interface so that all Operation methods
take references to RootOperation, as its cleaner, and requires
less nasty casts. Clean up operations in headers generally.
2004-12-03 14:49:13 +00:00
|
|
|
using Atlas::Message::ListType;
|
2004-08-07 Al Riddoch <alriddoch@zepler.org>
* common/BaseEntity.cpp, common/BaseEntity.h, common/BaseWorld.h,
common/Database.cpp, common/Database.h, common/FormattedXMLWriter.cpp,
common/FormattedXMLWriter.h, common/accountbase.cpp,
common/accountbase.h, common/custom.cpp, common/inheritance.cpp,
common/inheritance.h, common/operations.h, common/type_utils.h,
common/utility.cpp, common/utility.h, modules/Location.cpp,
modules/Location.h, rulesets/Area.cpp, rulesets/Area.h,
rulesets/BaseMind.cpp, rulesets/Character.cpp, rulesets/Character.h,
rulesets/Creator.cpp, rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/Entity_getLocation.h, rulesets/Food.cpp, rulesets/Line.cpp,
rulesets/Line.h, rulesets/MemMap.cpp, rulesets/MemMap.h,
rulesets/Pedestrian.cpp, rulesets/Plant.cpp, rulesets/Plant.h,
rulesets/Py_Mind.cpp, rulesets/Py_Object.cpp, rulesets/Py_Object.h,
rulesets/Py_Operation.cpp, rulesets/Py_Thing.cpp,
rulesets/Python_API.cpp, rulesets/Stackable.cpp, rulesets/Stackable.h,
rulesets/Thing.cpp, rulesets/World.cpp, rulesets/World.h,
server/Account.cpp, server/Account.h, server/Admin.cpp,
server/Admin.h, server/CommClient.cpp, server/CommClient.h,
server/CommListener.cpp, server/CommListener.h,
server/CommLocalClient.cpp, server/CommLocalClient.h,
server/CommMetaClient.h, server/CommPSQLSocket.h,
server/CommRemoteClient.cpp, server/CommRemoteClient.h,
server/CommServer.cpp, server/CommServer.h, server/CommSocket.cpp,
server/CommSocket.h, server/CommUnixListener.cpp,
server/CommUnixListener.h, server/Connection.cpp,
server/Connection.h, server/EntityFactory.cpp,
server/EntityFactory.h, server/Lobby.cpp, server/Lobby.h,
server/Persistance.cpp, server/Persistance.h,
server/PersistantThingFactory.h, server/Persistor.cpp,
server/Player.cpp, server/Player.h, server/Restorer.h,
server/Restorer_impl.h, server/ServerRouting.cpp,
server/ServerRouting.h, server/TrustedConnection.cpp,
server/TrustedConnection.h, server/WorldRouter.cpp,
server/WorldRouter.h: Convert code to using Atlas Message
typedefs as found in Atlas-C++ 0.6 to aid conversion later.
2004-08-16 14:26:47 +00:00
|
|
|
using Atlas::Message::FloatType;
|
2005-08-27 14:52:12 +00:00
|
|
|
using Atlas::Objects::Root;
|
2005-05-09 18:52:15 +00:00
|
|
|
using Atlas::Objects::Operation::Create;
|
2004-12-03 Al Riddoch <alriddoch@zepler.org>
* client/BaseClient.cpp, client/BaseClient.h,
client/CharacterClient.cpp, client/CharacterClient.h,
client/ClientConnection.cpp, client/ClientConnection.h,
client/CreatorClient.cpp, client/CreatorClient.h,
client/Py_CreatorClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, common/BaseWorld.h, common/custom.cpp,
common/inheritance.cpp, common/inheritance.h,
common/inheritance_impl.h, common/op_switch.h, common/type_utils.h,
common/types.h, common/utility.cpp, common/utility.h,
modules/Location.cpp, rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/Character.cpp, rulesets/Character.h, rulesets/Creator.cpp,
rulesets/Creator.h, rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/EntityProperties.cpp, rulesets/Entity_getLocation.h,
rulesets/Food.cpp, rulesets/Food.h, rulesets/MemMap.cpp,
rulesets/MemMap.h, rulesets/Missile.h, rulesets/Pedestrian.cpp,
rulesets/Plant.cpp, rulesets/Plant.h, rulesets/Py_Mind.cpp,
rulesets/Py_Object.cpp, rulesets/Py_Operation.cpp,
rulesets/Py_Operation.h, rulesets/Py_Thing.cpp,
rulesets/PythonMindScript.h, rulesets/PythonScript.h,
rulesets/PythonThingScript.h, rulesets/Python_API.cpp,
rulesets/Script.cpp, rulesets/Script.h, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h,
server/Account.cpp, server/Account.h server/Admin.cpp, server/Admin.h,
server/CommClient.cpp, server/Connection.cpp, server/Connection.h,
server/EntityFactory.cpp, server/EntityFactory.h, server/Lobby.cpp,
server/Lobby.h, server/Persistance.cpp, server/Persistance.h,
server/Persistor.cpp, server/Player.cpp, server/Player.h,
server/ServerRouting.cpp, server/ServerRouting.h,
server/TrustedConnection.cpp, server/TrustedConnection.h,
server/WorldRouter.cpp, server/WorldRouter.h, tests/Areatest.cpp,
tests/Charactertest.cpp, tests/Creatortest.cpp,
tests/EntityExerciser.h, tests/Entitytest.cpp, tests/Foodtest.cpp,
tests/IGEntityExerciser.h, tests/Linetest.cpp, tests/Planttest.cpp,
tests/Stackabletest.cpp, tests/Structuretest.cpp, tests/Thingtest.cpp,
tests/Worldtest.cpp, tests/allOperations.h, tests/inheritancetest.cpp,
tests/utilitytest.cpp, tools/cycmd.cpp:
Modify the entity interface so that all Operation methods
take references to RootOperation, as its cleaner, and requires
less nasty casts. Clean up operations in headers generally.
2004-12-03 14:49:13 +00:00
|
|
|
using Atlas::Objects::Operation::Sight;
|
2005-07-01 01:12:44 +00:00
|
|
|
using Atlas::Objects::Operation::Nourish;
|
2005-08-27 14:52:12 +00:00
|
|
|
using Atlas::Objects::Entity::RootEntity;
|
|
|
|
|
using Atlas::Objects::Entity::Anonymous;
|
|
|
|
|
|
|
|
|
|
using Atlas::Objects::smart_dynamic_cast;
|
2004-08-07 Al Riddoch <alriddoch@zepler.org>
* common/BaseEntity.cpp, common/BaseEntity.h, common/BaseWorld.h,
common/Database.cpp, common/Database.h, common/FormattedXMLWriter.cpp,
common/FormattedXMLWriter.h, common/accountbase.cpp,
common/accountbase.h, common/custom.cpp, common/inheritance.cpp,
common/inheritance.h, common/operations.h, common/type_utils.h,
common/utility.cpp, common/utility.h, modules/Location.cpp,
modules/Location.h, rulesets/Area.cpp, rulesets/Area.h,
rulesets/BaseMind.cpp, rulesets/Character.cpp, rulesets/Character.h,
rulesets/Creator.cpp, rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/Entity_getLocation.h, rulesets/Food.cpp, rulesets/Line.cpp,
rulesets/Line.h, rulesets/MemMap.cpp, rulesets/MemMap.h,
rulesets/Pedestrian.cpp, rulesets/Plant.cpp, rulesets/Plant.h,
rulesets/Py_Mind.cpp, rulesets/Py_Object.cpp, rulesets/Py_Object.h,
rulesets/Py_Operation.cpp, rulesets/Py_Thing.cpp,
rulesets/Python_API.cpp, rulesets/Stackable.cpp, rulesets/Stackable.h,
rulesets/Thing.cpp, rulesets/World.cpp, rulesets/World.h,
server/Account.cpp, server/Account.h, server/Admin.cpp,
server/Admin.h, server/CommClient.cpp, server/CommClient.h,
server/CommListener.cpp, server/CommListener.h,
server/CommLocalClient.cpp, server/CommLocalClient.h,
server/CommMetaClient.h, server/CommPSQLSocket.h,
server/CommRemoteClient.cpp, server/CommRemoteClient.h,
server/CommServer.cpp, server/CommServer.h, server/CommSocket.cpp,
server/CommSocket.h, server/CommUnixListener.cpp,
server/CommUnixListener.h, server/Connection.cpp,
server/Connection.h, server/EntityFactory.cpp,
server/EntityFactory.h, server/Lobby.cpp, server/Lobby.h,
server/Persistance.cpp, server/Persistance.h,
server/PersistantThingFactory.h, server/Persistor.cpp,
server/Player.cpp, server/Player.h, server/Restorer.h,
server/Restorer_impl.h, server/ServerRouting.cpp,
server/ServerRouting.h, server/TrustedConnection.cpp,
server/TrustedConnection.h, server/WorldRouter.cpp,
server/WorldRouter.h: Convert code to using Atlas Message
typedefs as found in Atlas-C++ 0.6 to aid conversion later.
2004-08-16 14:26:47 +00:00
|
|
|
|
2005-05-10 16:32:28 +00:00
|
|
|
typedef enum { ROCK = 0, SAND = 1, GRASS = 2, SILT = 3, SNOW = 4} Surface;
|
2005-05-05 00:22:05 +00:00
|
|
|
|
2004-12-28 Al Riddoch <alriddoch@zepler.org>
* common/OOGThing.cpp, common/Property.cpp, common/Property.h,
common/Property_impl.h, common/inheritance.h, common/operations.cpp,
rulesets/World.cpp: Update some comments.
* rulesets/Task.h, rulesets/Task.cpp, tests/Tasktest.cpp,
rulesets/Fell.h, rulesets/Fell.cpp: New Task interface for
tasks which take a while to complete. Sample implentation provided
in the form of a Fell task for felling trees.
* rulesets/Character.cpp, rulesets/Character.h: Try out Task
implementation with Fell.
2004-12-28 02:14:17 +00:00
|
|
|
/// \brief Constructor for the World entity
|
2005-11-10 Al Riddoch <alriddoch@zepler.org>
* common/BaseEntity.h, common/BaseEntity.cpp: Add an integer ID
member variable, and accessor, and require it to be initialised
along with string ID in constructor.
* common/const.cpp, common/const.h: Add a const for the integer value
of the world ID.
* rulesets/Area.cpp, rulesets/Area.h, rulesets/BaseMind.cpp,
rulesets/BaseMind.h, rulesets/Character.cpp, rulesets/Character.h,
rulesets/Creator.cpp, rulesets/Creator.h, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/Food.cpp, rulesets/Food.h,
rulesets/Line.cpp, rulesets/Line.h, rulesets/MemEntity.cpp,
rulesets/MemEntity.h, rulesets/Plant.cpp, rulesets/Plant.h,
rulesets/Stackable.cpp, rulesets/Stackable.h, rulesets/Structure.cpp,
rulesets/Structure.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h: Add integer ID handling to
constructors of all in-game entity classes.
* rulesets/MemMap.cpp: Initialise integer ID of entities in the mind
map.
* rulesets/MindFactory.cpp, rulesets/MindFactory.h: Handle integer
ID when constructing mind objects.
* server/EntityFactory.cpp, server/EntityFactory.h,
server/PersistantThingFactory_impl.h: Handle integer
ID when contructing entity objects.
* server/Restoration.cpp, server/Restoration.h, server/Restorer.h,
server/Restorer_impl.h: Handle integer ID when restoring from
database.
* server/WorldRouter.cpp: Assign integer ID when constructing the
world.
2005-11-11 00:06:48 +00:00
|
|
|
World::World(const std::string & id, long intId) : World_parent(id, intId),
|
2005-05-17 18:00:50 +00:00
|
|
|
m_terrain(*new Mercator::Terrain(Mercator::Terrain::SHADED)),
|
|
|
|
|
m_tileShader(*new Mercator::TileShader)
|
2002-03-11 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.cpp: Eliminate unnecessary call to opEnumerate()
and enhance debugging output.
* server/Player.cpp: Correct the use of string.compare() in older
versions of libstdc++.
* common/types.h: Added enumeration for other operations, not
handled by the core, but considered valid. Added new type
for storing mapping between operation parents and their
enumerated type.
* common/op_switch.h: Separate handling of operations known to
be invalid from operations which are valid, but not explicitly
added to the core.
* common/inheritance.h, common/inheritance.cpp, common/custom.cpp:
Provide global operation mapping where enumeration of operations
can be looked up. Install all types handled by the core, and
types known to be used in scripts.
* common/BaseEntity.h, common/BaseEntity.cpp: Add object specific
operation mapping where operation types each object is subscribed
to can be enumerated, and others are rejected. Add mechanism
so that objects can add to the mapping, this subscribing to
operations. This makes enumerating operations much cheaper, and
eliminates the overhead of handling ops an object has no interest
in.
* rulesets/Thing.h, rulesets/Thing.cpp: Add mechanism so scripts
can subscribe to operations.
* rulesets/Character.h, rulesets/Character.cpp:
Add subscription mechanism for ops going to and from
the mind.
* rulesets/BaseMind.h, rulesets/BaseMind.cpp:
Add subscription mechanism for sight and sound perception
operations sub operations, and provide an interface to it
for scripts.
* server/Connection.cpp, server/Admin.cpp, server/Account.cpp,
rulesets/World.cpp, rulesets/World.h, rulesets/Thing.cpp,
rulesets/Stackable.cpp, rulesets/Plant.cpp, rulesets/Food.cpp,
rulesets/Character.cpp, rulesets/BaseMind.cpp:
Add subscriptions to operations for all core base classes.
* rulesets/Python_API.cpp: When script is created, go through
methods, and subscribe to the operations which are handled by
them.
* rulesets/Character.cpp: When calculating orientation of a walking
character, assume it is standing upright.
* physics/Vector3D.h: Add versions of mag() and distance() which
omit the square root calculations, so that when their values
are only used for comparison, the expensive square root
calculations can be ommited. Add new version of collision
and range checking functions which provide the optimal
interface to the application. Add versions of methods which
modify this rather than creating a new operation to eliminate
wasted copies.
* physics/Quaternion.cpp: Make use of faster interface provided
by Vector3D.
* physics/BBox.h: Add new version of collision checking function
which provides optimal interface to the application.
* modules/Location.h, modules/Location.cpp: Add new functions
to optimally calculate the distance between any two entities.
* modules/Location.h: Re-write collision and range functions to
make much more optimal use of Vector3D, BBox and distance
functionality.
* rulesets/Py_Vector3D.cpp, rulesets/Pedestrian.cpp,
rulesets/Movement.cpp, rulesets/Entity.cpp, rulesets/Character.cpp:
Eliminate implicit copies from vector arithmetic.
* rulesets/Pedestrian.cpp, rulesets/MemMap.cpp, common/const.h:
Re-write code which uses magnitude of vectors to use the square
of the magnitude instead, as it is much cheaper to calculate.
2002-03-11 18:24:19 +00:00
|
|
|
{
|
2004-11-02 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.cpp, rulesets/Entity.h: Make get(), set(), and
addToMessage() non-virtual, and convert them to using new property
mechanism. Add the necessary properties in the constructor.
* rulesets/Area.cpp, rulesets/Area.h, rulesets/Character.cpp,
rulesets/Character.h, rulesets/Line.cpp, rulesets/Line.h,
rulesets/Plant.cpp, rulesets/Plant.h, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/World.cpp, rulesets/World.h:
Remove virtual get() set() and addToMessage() methods. These
are now entirely in Entity.
* rulesets/World.cpp, rulesets/World.h: Remove some functions
for handling terrain data now handled by properties.
Clean up Set code to get rid of nasty unnecessary exception
try / catch block.
2004-11-02 20:44:24 +00:00
|
|
|
m_properties["terrain"] = new TerrainProperty(m_terrain, m_modifiedTerrain,
|
|
|
|
|
m_modifiedTerrain, a_terrain);
|
2005-12-14 17:16:21 +00:00
|
|
|
m_properties["calendar"] = new CalendarProperty(0);
|
2005-05-05 00:22:05 +00:00
|
|
|
|
2005-05-17 18:00:50 +00:00
|
|
|
m_tileShader.addShader(new Mercator::FillShader(), ROCK);
|
|
|
|
|
m_tileShader.addShader(new Mercator::BandShader(-2.f, 1.5f), SAND);
|
|
|
|
|
m_tileShader.addShader(new Mercator::GrassShader(1.f, 80.f, .5f, 1.f), GRASS);
|
|
|
|
|
m_tileShader.addShader(new Mercator::DepthShader(0.f, -10.f), SILT);
|
|
|
|
|
m_tileShader.addShader(new Mercator::HighShader(110.f), SNOW);
|
|
|
|
|
m_terrain.addShader(&m_tileShader, 0);
|
2002-03-11 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.cpp: Eliminate unnecessary call to opEnumerate()
and enhance debugging output.
* server/Player.cpp: Correct the use of string.compare() in older
versions of libstdc++.
* common/types.h: Added enumeration for other operations, not
handled by the core, but considered valid. Added new type
for storing mapping between operation parents and their
enumerated type.
* common/op_switch.h: Separate handling of operations known to
be invalid from operations which are valid, but not explicitly
added to the core.
* common/inheritance.h, common/inheritance.cpp, common/custom.cpp:
Provide global operation mapping where enumeration of operations
can be looked up. Install all types handled by the core, and
types known to be used in scripts.
* common/BaseEntity.h, common/BaseEntity.cpp: Add object specific
operation mapping where operation types each object is subscribed
to can be enumerated, and others are rejected. Add mechanism
so that objects can add to the mapping, this subscribing to
operations. This makes enumerating operations much cheaper, and
eliminates the overhead of handling ops an object has no interest
in.
* rulesets/Thing.h, rulesets/Thing.cpp: Add mechanism so scripts
can subscribe to operations.
* rulesets/Character.h, rulesets/Character.cpp:
Add subscription mechanism for ops going to and from
the mind.
* rulesets/BaseMind.h, rulesets/BaseMind.cpp:
Add subscription mechanism for sight and sound perception
operations sub operations, and provide an interface to it
for scripts.
* server/Connection.cpp, server/Admin.cpp, server/Account.cpp,
rulesets/World.cpp, rulesets/World.h, rulesets/Thing.cpp,
rulesets/Stackable.cpp, rulesets/Plant.cpp, rulesets/Food.cpp,
rulesets/Character.cpp, rulesets/BaseMind.cpp:
Add subscriptions to operations for all core base classes.
* rulesets/Python_API.cpp: When script is created, go through
methods, and subscribe to the operations which are handled by
them.
* rulesets/Character.cpp: When calculating orientation of a walking
character, assume it is standing upright.
* physics/Vector3D.h: Add versions of mag() and distance() which
omit the square root calculations, so that when their values
are only used for comparison, the expensive square root
calculations can be ommited. Add new version of collision
and range checking functions which provide the optimal
interface to the application. Add versions of methods which
modify this rather than creating a new operation to eliminate
wasted copies.
* physics/Quaternion.cpp: Make use of faster interface provided
by Vector3D.
* physics/BBox.h: Add new version of collision checking function
which provides optimal interface to the application.
* modules/Location.h, modules/Location.cpp: Add new functions
to optimally calculate the distance between any two entities.
* modules/Location.h: Re-write collision and range functions to
make much more optimal use of Vector3D, BBox and distance
functionality.
* rulesets/Py_Vector3D.cpp, rulesets/Pedestrian.cpp,
rulesets/Movement.cpp, rulesets/Entity.cpp, rulesets/Character.cpp:
Eliminate implicit copies from vector arithmetic.
* rulesets/Pedestrian.cpp, rulesets/MemMap.cpp, common/const.h:
Re-write code which uses magnitude of vectors to use the square
of the magnitude instead, as it is much cheaper to calculate.
2002-03-11 18:24:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
World::~World()
|
|
|
|
|
{
|
2003-07-21 02:36:58 +00:00
|
|
|
delete &m_terrain;
|
2005-05-17 18:00:50 +00:00
|
|
|
delete &m_tileShader;
|
2002-03-11 Al Riddoch <alriddoch@zepler.org>
* server/WorldRouter.cpp: Eliminate unnecessary call to opEnumerate()
and enhance debugging output.
* server/Player.cpp: Correct the use of string.compare() in older
versions of libstdc++.
* common/types.h: Added enumeration for other operations, not
handled by the core, but considered valid. Added new type
for storing mapping between operation parents and their
enumerated type.
* common/op_switch.h: Separate handling of operations known to
be invalid from operations which are valid, but not explicitly
added to the core.
* common/inheritance.h, common/inheritance.cpp, common/custom.cpp:
Provide global operation mapping where enumeration of operations
can be looked up. Install all types handled by the core, and
types known to be used in scripts.
* common/BaseEntity.h, common/BaseEntity.cpp: Add object specific
operation mapping where operation types each object is subscribed
to can be enumerated, and others are rejected. Add mechanism
so that objects can add to the mapping, this subscribing to
operations. This makes enumerating operations much cheaper, and
eliminates the overhead of handling ops an object has no interest
in.
* rulesets/Thing.h, rulesets/Thing.cpp: Add mechanism so scripts
can subscribe to operations.
* rulesets/Character.h, rulesets/Character.cpp:
Add subscription mechanism for ops going to and from
the mind.
* rulesets/BaseMind.h, rulesets/BaseMind.cpp:
Add subscription mechanism for sight and sound perception
operations sub operations, and provide an interface to it
for scripts.
* server/Connection.cpp, server/Admin.cpp, server/Account.cpp,
rulesets/World.cpp, rulesets/World.h, rulesets/Thing.cpp,
rulesets/Stackable.cpp, rulesets/Plant.cpp, rulesets/Food.cpp,
rulesets/Character.cpp, rulesets/BaseMind.cpp:
Add subscriptions to operations for all core base classes.
* rulesets/Python_API.cpp: When script is created, go through
methods, and subscribe to the operations which are handled by
them.
* rulesets/Character.cpp: When calculating orientation of a walking
character, assume it is standing upright.
* physics/Vector3D.h: Add versions of mag() and distance() which
omit the square root calculations, so that when their values
are only used for comparison, the expensive square root
calculations can be ommited. Add new version of collision
and range checking functions which provide the optimal
interface to the application. Add versions of methods which
modify this rather than creating a new operation to eliminate
wasted copies.
* physics/Quaternion.cpp: Make use of faster interface provided
by Vector3D.
* physics/BBox.h: Add new version of collision checking function
which provides optimal interface to the application.
* modules/Location.h, modules/Location.cpp: Add new functions
to optimally calculate the distance between any two entities.
* modules/Location.h: Re-write collision and range functions to
make much more optimal use of Vector3D, BBox and distance
functionality.
* rulesets/Py_Vector3D.cpp, rulesets/Pedestrian.cpp,
rulesets/Movement.cpp, rulesets/Entity.cpp, rulesets/Character.cpp:
Eliminate implicit copies from vector arithmetic.
* rulesets/Pedestrian.cpp, rulesets/MemMap.cpp, common/const.h:
Re-write code which uses magnitude of vectors to use the square
of the magnitude instead, as it is much cheaper to calculate.
2002-03-11 18:24:19 +00:00
|
|
|
}
|
|
|
|
|
|
2004-12-28 Al Riddoch <alriddoch@zepler.org>
* common/OOGThing.cpp, common/Property.cpp, common/Property.h,
common/Property_impl.h, common/inheritance.h, common/operations.cpp,
rulesets/World.cpp: Update some comments.
* rulesets/Task.h, rulesets/Task.cpp, tests/Tasktest.cpp,
rulesets/Fell.h, rulesets/Fell.cpp: New Task interface for
tasks which take a while to complete. Sample implentation provided
in the form of a Fell task for felling trees.
* rulesets/Character.cpp, rulesets/Character.h: Try out Task
implementation with Fell.
2004-12-28 02:14:17 +00:00
|
|
|
/// \brief Calculate the terrain height at the given x,y coordinates
|
2004-06-20 22:58:18 +00:00
|
|
|
float World::getHeight(float x, float y)
|
|
|
|
|
{
|
|
|
|
|
Mercator::Segment * s = m_terrain.getSegment(x, y);
|
2004-06-21 00:44:54 +00:00
|
|
|
if (s != 0 && !s->isValid()) {
|
2004-06-20 22:58:18 +00:00
|
|
|
s->populate();
|
|
|
|
|
}
|
|
|
|
|
return m_terrain.get(x, y);
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-06 01:41:17 +00:00
|
|
|
int World::getSurface(const Point3D & pos, int & material)
|
|
|
|
|
{
|
|
|
|
|
float x = pos.x(),
|
|
|
|
|
y = pos.y();
|
|
|
|
|
Mercator::Segment * segment = m_terrain.getSegment(x, y);
|
|
|
|
|
if (segment == 0) {
|
2005-05-10 16:48:00 +00:00
|
|
|
debug(std::cerr << "No terrain at this point" << std::endl << std::flush;);
|
2005-05-06 01:41:17 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (!segment->isValid()) {
|
|
|
|
|
segment->populate();
|
|
|
|
|
}
|
|
|
|
|
x = x - segment->getResolution() * segment->getXRef();
|
|
|
|
|
y = y - segment->getResolution() * segment->getYRef();
|
|
|
|
|
const Mercator::Segment::Surfacestore & surfaces = segment->getSurfaces();
|
|
|
|
|
WFMath::Vector<3> normal;
|
|
|
|
|
float height = -23;
|
|
|
|
|
segment->getHeightAndNormal(x, y, height, normal);
|
2005-05-10 16:48:00 +00:00
|
|
|
debug(std::cout << "At the point " << x << "," << y
|
|
|
|
|
<< " of the segment the height is " << height << std::endl;
|
|
|
|
|
std::cout << "The segment has " << surfaces.size()
|
|
|
|
|
<< std::endl << std::flush;);
|
2005-05-06 01:41:17 +00:00
|
|
|
if (surfaces.size() == 0) {
|
|
|
|
|
log(ERROR, "The terrain has no surface data");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
Mercator::Surface & tileSurface = *surfaces.begin()->second;
|
|
|
|
|
if (!tileSurface.isValid()) {
|
|
|
|
|
tileSurface.populate();
|
|
|
|
|
}
|
|
|
|
|
material = tileSurface((int)x, (int)y, 0);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-04 21:36:28 +00:00
|
|
|
void World::delveOperation(const Operation & op, OpVector & res)
|
|
|
|
|
{
|
2005-08-27 14:52:12 +00:00
|
|
|
if (op->getArgs().empty()) {
|
2005-05-06 01:41:17 +00:00
|
|
|
// This op comes from a tool, so sending error back is kinda pointless
|
2005-05-05 00:22:05 +00:00
|
|
|
error(op, "Delve op has no args", res, getId());
|
|
|
|
|
return;
|
|
|
|
|
}
|
2005-08-27 14:52:12 +00:00
|
|
|
const Root & arg = op->getArgs().front();
|
|
|
|
|
RootEntity delve_arg = smart_dynamic_cast<RootEntity>(arg);
|
|
|
|
|
if (!delve_arg.isValid()) {
|
|
|
|
|
error(op, "Delve op has malformed args", res, getId());
|
2005-05-05 00:22:05 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2005-08-27 14:52:12 +00:00
|
|
|
if (!delve_arg->hasAttrFlag(Atlas::Objects::Entity::POS_FLAG)) {
|
2005-05-06 01:41:17 +00:00
|
|
|
// This op comes from a tool, so sending error back is kinda pointless
|
2005-08-27 14:52:12 +00:00
|
|
|
error(op, "Delve op to world has no POS in args", res, getId());
|
2005-05-05 00:22:05 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
WFMath::Point<3> delve_pos;
|
2005-08-27 14:52:12 +00:00
|
|
|
if (fromStdVector(delve_pos, delve_arg->getPos()) != 0) {
|
|
|
|
|
error(op, "Delve op to world has bad POS in args", res, getId());
|
|
|
|
|
return;
|
|
|
|
|
}
|
2005-05-10 16:48:00 +00:00
|
|
|
debug(std::cout << "Got delve on world at " << delve_pos
|
|
|
|
|
<< std::endl << std::flush;);
|
2005-05-06 01:41:17 +00:00
|
|
|
int material;
|
2005-05-10 16:32:28 +00:00
|
|
|
if (getSurface(delve_pos, material) != 0) {
|
|
|
|
|
return;
|
2005-05-06 01:41:17 +00:00
|
|
|
}
|
2005-05-10 16:48:00 +00:00
|
|
|
debug(std::cout << "The material at this point is " << material
|
|
|
|
|
<< std::endl << std::flush;);
|
2005-05-10 16:32:28 +00:00
|
|
|
switch (material) {
|
|
|
|
|
case ROCK:
|
|
|
|
|
{
|
2005-08-27 14:52:12 +00:00
|
|
|
Create c;
|
|
|
|
|
Anonymous carg;
|
|
|
|
|
carg->setParents(std::list<std::string>(1, "boulder"));
|
|
|
|
|
carg->setName("boulder");
|
|
|
|
|
carg->setLoc(getId());
|
|
|
|
|
carg->setPos(delve_arg->getPos());
|
|
|
|
|
c->setArgs1(carg);
|
2005-05-10 16:32:28 +00:00
|
|
|
c->setTo(getId());
|
|
|
|
|
res.push_back(c);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case SNOW:
|
|
|
|
|
{
|
2005-08-27 14:52:12 +00:00
|
|
|
Create c;
|
|
|
|
|
Anonymous carg;
|
|
|
|
|
carg->setParents(std::list<std::string>(1, "ice"));
|
|
|
|
|
carg->setName("ice");;
|
|
|
|
|
carg->setLoc(getId());
|
|
|
|
|
carg->setPos(delve_arg->getPos());
|
|
|
|
|
c->setArgs1(carg);
|
2005-05-10 16:32:28 +00:00
|
|
|
c->setTo(getId());
|
|
|
|
|
res.push_back(c);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2005-05-06 01:41:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void World::digOperation(const Operation & op, OpVector & res)
|
|
|
|
|
{
|
2005-08-27 14:52:12 +00:00
|
|
|
if (op->getArgs().empty()) {
|
2005-05-06 01:41:17 +00:00
|
|
|
// This op comes from a tool, so sending error back is kinda pointless
|
2005-08-27 14:52:12 +00:00
|
|
|
error(op, "Dig op has no args", res, getId());
|
2005-05-05 00:22:05 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2005-08-27 14:52:12 +00:00
|
|
|
const Root & arg = op->getArgs().front();
|
|
|
|
|
RootEntity dig_arg = smart_dynamic_cast<RootEntity>(arg);
|
|
|
|
|
if (!dig_arg.isValid()) {
|
|
|
|
|
error(op, "Dig op has malformed args", res, getId());
|
2005-05-06 01:41:17 +00:00
|
|
|
return;
|
2005-05-05 00:22:05 +00:00
|
|
|
}
|
2005-08-27 14:52:12 +00:00
|
|
|
if (!dig_arg->hasAttrFlag(Atlas::Objects::Entity::POS_FLAG)) {
|
2005-05-06 01:41:17 +00:00
|
|
|
// This op comes from a tool, so sending error back is kinda pointless
|
2005-08-27 14:52:12 +00:00
|
|
|
error(op, "Dig op to world has no POS in args", res, getId());
|
2005-05-05 00:22:05 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2005-05-06 01:41:17 +00:00
|
|
|
WFMath::Point<3> dig_pos;
|
2005-08-27 14:52:12 +00:00
|
|
|
if (fromStdVector(dig_pos, dig_arg->getPos()) != 0) {
|
|
|
|
|
error(op, "Dig op to world has bad POS in args", res, getId());
|
|
|
|
|
return;
|
|
|
|
|
}
|
2005-05-10 16:48:00 +00:00
|
|
|
debug(std::cout << "Got dig on world at " << dig_pos
|
|
|
|
|
<< std::endl << std::flush;);
|
2005-05-06 01:41:17 +00:00
|
|
|
int material;
|
2005-05-10 16:32:28 +00:00
|
|
|
if (getSurface(dig_pos, material) != 0) {
|
|
|
|
|
return;
|
2005-05-06 01:41:17 +00:00
|
|
|
}
|
2005-05-10 16:48:00 +00:00
|
|
|
debug(std::cout << "The material at this point is " << material
|
|
|
|
|
<< std::endl << std::flush;);
|
2005-05-10 16:32:28 +00:00
|
|
|
switch (material) {
|
|
|
|
|
case SAND:
|
|
|
|
|
{
|
2005-08-27 14:52:12 +00:00
|
|
|
Create c;
|
|
|
|
|
Anonymous carg;
|
|
|
|
|
carg->setParents(std::list<std::string>(1, "pile"));
|
|
|
|
|
carg->setAttr("material", "sand");
|
|
|
|
|
carg->setName("sand");
|
|
|
|
|
carg->setLoc(getId());
|
|
|
|
|
carg->setPos(dig_arg->getPos());
|
|
|
|
|
c->setArgs1(carg);
|
2005-05-10 16:32:28 +00:00
|
|
|
c->setTo(getId());
|
|
|
|
|
res.push_back(c);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case GRASS:
|
|
|
|
|
{
|
2005-08-27 14:52:12 +00:00
|
|
|
Create c;
|
|
|
|
|
Anonymous carg;
|
|
|
|
|
carg->setParents(std::list<std::string>(1, "pile"));
|
|
|
|
|
carg->setAttr("material", "earth");
|
|
|
|
|
carg->setName("earth");
|
|
|
|
|
carg->setLoc(getId());
|
|
|
|
|
carg->setPos(dig_arg->getPos());
|
|
|
|
|
c->setArgs1(carg);
|
2005-05-10 16:32:28 +00:00
|
|
|
c->setTo(getId());
|
|
|
|
|
res.push_back(c);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case SILT:
|
|
|
|
|
{
|
2005-08-27 14:52:12 +00:00
|
|
|
Create c;
|
|
|
|
|
Anonymous carg;
|
|
|
|
|
carg->setParents(std::list<std::string>(1, "pile"));
|
|
|
|
|
carg->setAttr("material", "silt");
|
|
|
|
|
carg->setName("silt");
|
|
|
|
|
carg->setLoc(getId());
|
|
|
|
|
carg->setPos(dig_arg->getPos());
|
|
|
|
|
c->setArgs1(carg);
|
2005-05-10 16:32:28 +00:00
|
|
|
c->setTo(getId());
|
|
|
|
|
res.push_back(c);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2005-05-06 01:41:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void World::mowOperation(const Operation & op, OpVector & res)
|
|
|
|
|
{
|
2005-08-27 14:52:12 +00:00
|
|
|
if (op->getArgs().empty()) {
|
2005-05-06 01:41:17 +00:00
|
|
|
// This op comes from a tool, so sending error back is kinda pointless
|
|
|
|
|
error(op, "Delve op has no args", res, getId());
|
|
|
|
|
return;
|
|
|
|
|
}
|
2005-08-27 14:52:12 +00:00
|
|
|
const Root & arg = op->getArgs().front();
|
|
|
|
|
RootEntity mow_arg = smart_dynamic_cast<RootEntity>(arg);
|
|
|
|
|
if (!mow_arg.isValid()) {
|
|
|
|
|
error(op, "Mow op has malformed args", res, getId());
|
2005-05-06 01:41:17 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2005-08-27 14:52:12 +00:00
|
|
|
if (!mow_arg->hasAttrFlag(Atlas::Objects::Entity::POS_FLAG)) {
|
2005-05-06 01:41:17 +00:00
|
|
|
// This op comes from a tool, so sending error back is kinda pointless
|
2005-08-27 14:52:12 +00:00
|
|
|
error(op, "Mow op to world has no POS in args", res, getId());
|
2005-05-06 01:41:17 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
WFMath::Point<3> mow_pos;
|
2005-08-27 14:52:12 +00:00
|
|
|
if (fromStdVector(mow_pos, mow_arg->getPos()) != 0) {
|
|
|
|
|
error(op, "Mow op to world has bad POS in args", res, getId());
|
|
|
|
|
return;
|
|
|
|
|
}
|
2005-05-10 16:48:00 +00:00
|
|
|
debug(std::cout << "Got mow on world at " << mow_pos
|
|
|
|
|
<< std::endl << std::flush;);
|
2005-05-06 01:41:17 +00:00
|
|
|
int material;
|
2005-05-10 16:32:28 +00:00
|
|
|
if (getSurface(mow_pos, material) != 0) {
|
|
|
|
|
return;
|
2005-05-05 00:22:05 +00:00
|
|
|
}
|
2005-05-10 16:48:00 +00:00
|
|
|
debug(std::cout << "The material at this point is " << material
|
|
|
|
|
<< std::endl << std::flush;);
|
2005-05-10 16:32:28 +00:00
|
|
|
switch (material) {
|
|
|
|
|
case GRASS:
|
|
|
|
|
{
|
2005-08-27 14:52:12 +00:00
|
|
|
Create c;
|
|
|
|
|
Anonymous carg;
|
|
|
|
|
carg->setParents(std::list<std::string>(1, "grass"));
|
|
|
|
|
carg->setId(getId());
|
|
|
|
|
carg->setPos(mow_arg->getPos());;
|
|
|
|
|
c->setArgs1(carg);
|
2005-05-10 16:32:28 +00:00
|
|
|
c->setTo(getId());
|
|
|
|
|
res.push_back(c);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2005-05-04 21:36:28 +00:00
|
|
|
}
|
|
|
|
|
|
2005-06-28 14:35:31 +00:00
|
|
|
void World::EatOperation(const Operation & op, OpVector & res)
|
|
|
|
|
{
|
2005-08-27 14:52:12 +00:00
|
|
|
const std::string & from_id = op->getFrom();
|
2005-11-11 Al Riddoch <alriddoch@zepler.org>
* common/types.h, server/Persistance.h, common/BaseWorld.h,
common/BaseWorld.cpp, server/WorldRouter.cpp:
Switch core world map to reference by integer ID rather than string.
Add version of getEntity() which converts from string to integer
automatically.
* rulesets/Character.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/EntityFactory.cpp,
Use getEntity() when looking up an entity, so that conversion of
ID from string to integer is automatic.
* rulesets/BaseMind.cpp, rulesets/MemMap.cpp, rulesets/MemMap.h:
Switch to using integer IDs in MemMap's core mapping.
* server/Account.cpp, server/Account.h: Switch a few function
parameters to use integer ID values, making the code cleaner.
* server/Account.cpp, server/Admin.cpp, server/Persistance.cpp:
Handle string ID to integer conversions as required.
2005-11-11 02:04:56 +00:00
|
|
|
Entity * from = m_world->getEntity(from_id);
|
|
|
|
|
if (from == 0) {
|
2005-06-28 14:35:31 +00:00
|
|
|
log(ERROR, "World got eat op from non-existant entity.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2005-07-01 01:12:44 +00:00
|
|
|
|
|
|
|
|
Point3D from_pos = relativePos(m_location, from->m_location);
|
|
|
|
|
int material;
|
|
|
|
|
if (getSurface(from_pos, material) != 0) {
|
|
|
|
|
debug(std::cout << "no surface hit" << std::endl << std::flush;);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const std::string & from_type = from->getType();
|
2005-06-28 14:35:31 +00:00
|
|
|
if (Inheritance::instance().isTypeOf(from_type, "plant")) {
|
2005-07-01 01:12:44 +00:00
|
|
|
if (material == GRASS) {
|
|
|
|
|
debug(std::cout << "From grass" << std::endl << std::flush;);
|
2005-08-27 14:52:12 +00:00
|
|
|
Nourish nourish;
|
2005-07-01 01:12:44 +00:00
|
|
|
nourish->setTo(from_id);
|
2005-08-27 14:52:12 +00:00
|
|
|
Anonymous nour_arg;
|
|
|
|
|
nour_arg->setAttr("mass", log(from->getMass() + 1));
|
|
|
|
|
nourish->setArgs1(nour_arg);
|
2005-07-01 01:12:44 +00:00
|
|
|
res.push_back(nourish);
|
|
|
|
|
}
|
2005-06-28 14:35:31 +00:00
|
|
|
} else if (Inheritance::instance().isTypeOf(from_type, "character")) {
|
|
|
|
|
log(NOTICE, "Eat coming from an animal.");
|
2005-07-01 01:12:44 +00:00
|
|
|
if (material == GRASS) {
|
|
|
|
|
debug(std::cout << "From grass" << std::endl << std::flush;);
|
|
|
|
|
}
|
2005-06-28 14:35:31 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-06 Al Riddoch <alriddoch@zepler.org>
* client/BaseClient.cpp, client/BaseClient.h, client/CreatorClient.cpp,
client/CreatorClient.h, common/BaseEntity.cpp, common/BaseEntity.h,
common/BaseWorld.h, common/OOGThing.cpp, common/OOGThing.h,
common/op_switch.h, common/refno.h, common/types.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h, rulesets/Character.cpp,
rulesets/Character.h, rulesets/Creator.cpp, rulesets/Creator.h,
rulesets/Entity.cpp, rulesets/Entity.h, rulesets/Food.cpp,
rulesets/Food.h, rulesets/MemMap.cpp, rulesets/Plant.cpp,
rulesets/Plant.h, rulesets/Py_Map.cpp, rulesets/PythonMindScript.cpp,
rulesets/PythonThingScript.cpp, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h, server/Account.cpp,
server/Account.h, server/Admin.cpp, server/Admin.h,
server/CommClient.cpp, server/Connection.cpp, server/Connection.h,
server/Connection_methods.h, server/ExternalMind.cpp,
server/ExternalMind.h, server/Lobby.cpp, server/Lobby.h,
server/Player.cpp, server/Player.h, server/WorldRouter.cpp,
server/WorldRouter.h, tests/Creatortest.cpp, tests/Worldtest.cpp:
Add a new Operation typedef to clean up headers, and get round
limitation in doxygen.
2004-12-06 16:35:44 +00:00
|
|
|
void World::LookOperation(const Operation & op, OpVector & res)
|
2001-04-18 10:37:09 +00:00
|
|
|
{
|
2003-03-21 Al Riddoch <alriddoch@zepler.org>
* client/Py_CreatorClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, rulesets/MemMap.cpp, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Thing.cpp, rulesets/Thing.h,
server/Account.cpp, server/Admin.cpp, server/Connection.cpp,
server/Lobby.cpp, server/ServerRouting.cpp:
Use a more efficient technique to set the attributes on
operation arguments without a copy.
* common/BaseEntity.cpp, rulesets/Entity.cpp, rulesets/Thing.h,
rulesets/World.cpp, server/WorldRouter.cpp:
Move handling IG Look ops into the IG code in rulesets.
2003-03-21 00:04:53 +00:00
|
|
|
// Let the worldrouter know we have been looked at.
|
2003-09-10 21:40:27 +00:00
|
|
|
assert(m_world != 0);
|
2005-08-27 14:52:12 +00:00
|
|
|
|
2003-03-21 Al Riddoch <alriddoch@zepler.org>
* client/Py_CreatorClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, rulesets/MemMap.cpp, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Thing.cpp, rulesets/Thing.h,
server/Account.cpp, server/Admin.cpp, server/Connection.cpp,
server/Lobby.cpp, server/ServerRouting.cpp:
Use a more efficient technique to set the attributes on
operation arguments without a copy.
* common/BaseEntity.cpp, rulesets/Entity.cpp, rulesets/Thing.h,
rulesets/World.cpp, server/WorldRouter.cpp:
Move handling IG Look ops into the IG code in rulesets.
2003-03-21 00:04:53 +00:00
|
|
|
debug(std::cout << "World::Operation(Look)" << std::endl << std::flush;);
|
2005-11-11 Al Riddoch <alriddoch@zepler.org>
* common/types.h, server/Persistance.h, common/BaseWorld.h,
common/BaseWorld.cpp, server/WorldRouter.cpp:
Switch core world map to reference by integer ID rather than string.
Add version of getEntity() which converts from string to integer
automatically.
* rulesets/Character.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/EntityFactory.cpp,
Use getEntity() when looking up an entity, so that conversion of
ID from string to integer is automatic.
* rulesets/BaseMind.cpp, rulesets/MemMap.cpp, rulesets/MemMap.h:
Switch to using integer IDs in MemMap's core mapping.
* server/Account.cpp, server/Account.h: Switch a few function
parameters to use integer ID values, making the code cleaner.
* server/Account.cpp, server/Admin.cpp, server/Persistance.cpp:
Handle string ID to integer conversions as required.
2005-11-11 02:04:56 +00:00
|
|
|
const std::string & from_id = op->getFrom();
|
|
|
|
|
Entity * from = m_world->getEntity(from_id);
|
|
|
|
|
if (from == 0) {
|
2006-08-01 19:58:14 +00:00
|
|
|
log(ERROR, "Look op has invalid from");
|
|
|
|
|
return;
|
2003-03-21 Al Riddoch <alriddoch@zepler.org>
* client/Py_CreatorClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, rulesets/MemMap.cpp, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Thing.cpp, rulesets/Thing.h,
server/Account.cpp, server/Admin.cpp, server/Connection.cpp,
server/Lobby.cpp, server/ServerRouting.cpp:
Use a more efficient technique to set the attributes on
operation arguments without a copy.
* common/BaseEntity.cpp, rulesets/Entity.cpp, rulesets/Thing.h,
rulesets/World.cpp, server/WorldRouter.cpp:
Move handling IG Look ops into the IG code in rulesets.
2003-03-21 00:04:53 +00:00
|
|
|
}
|
|
|
|
|
|
2006-05-18 01:43:09 +00:00
|
|
|
// Pass entity to addPerceptive
|
|
|
|
|
m_world->addPerceptive(from);
|
|
|
|
|
|
2005-08-27 14:52:12 +00:00
|
|
|
Sight s;
|
2003-03-21 Al Riddoch <alriddoch@zepler.org>
* client/Py_CreatorClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, rulesets/MemMap.cpp, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Thing.cpp, rulesets/Thing.h,
server/Account.cpp, server/Admin.cpp, server/Connection.cpp,
server/Lobby.cpp, server/ServerRouting.cpp:
Use a more efficient technique to set the attributes on
operation arguments without a copy.
* common/BaseEntity.cpp, rulesets/Entity.cpp, rulesets/Thing.h,
rulesets/World.cpp, server/WorldRouter.cpp:
Move handling IG Look ops into the IG code in rulesets.
2003-03-21 00:04:53 +00:00
|
|
|
|
2005-08-27 14:52:12 +00:00
|
|
|
Anonymous sarg;
|
2006-02-10 00:48:30 +00:00
|
|
|
addToEntity(sarg);
|
2005-08-27 14:52:12 +00:00
|
|
|
s->setArgs1(sarg);
|
2003-03-21 Al Riddoch <alriddoch@zepler.org>
* client/Py_CreatorClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, rulesets/MemMap.cpp, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Thing.cpp, rulesets/Thing.h,
server/Account.cpp, server/Admin.cpp, server/Connection.cpp,
server/Lobby.cpp, server/ServerRouting.cpp:
Use a more efficient technique to set the attributes on
operation arguments without a copy.
* common/BaseEntity.cpp, rulesets/Entity.cpp, rulesets/Thing.h,
rulesets/World.cpp, server/WorldRouter.cpp:
Move handling IG Look ops into the IG code in rulesets.
2003-03-21 00:04:53 +00:00
|
|
|
|
2003-05-01 00:07:36 +00:00
|
|
|
// FIXME integrate setting terrain with setting contains.
|
2004-11-02 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.cpp, rulesets/Entity.h: Make get(), set(), and
addToMessage() non-virtual, and convert them to using new property
mechanism. Add the necessary properties in the constructor.
* rulesets/Area.cpp, rulesets/Area.h, rulesets/Character.cpp,
rulesets/Character.h, rulesets/Line.cpp, rulesets/Line.h,
rulesets/Plant.cpp, rulesets/Plant.h, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/World.cpp, rulesets/World.h:
Remove virtual get() set() and addToMessage() methods. These
are now entirely in Entity.
* rulesets/World.cpp, rulesets/World.h: Remove some functions
for handling terrain data now handled by properties.
Clean up Set code to get rid of nasty unnecessary exception
try / catch block.
2004-11-02 20:44:24 +00:00
|
|
|
|
2006-02-11 03:03:22 +00:00
|
|
|
std::list<std::string> & contlist = sarg->modifyContains();
|
|
|
|
|
contlist.clear();
|
2004-11-06 Al Riddoch <alriddoch@zepler.org>
* aiclient/ClientConnection.cpp, client/BaseClient.cpp,
client/CharacterClient.cpp, client/ClientConnection.cpp,
common/Database.cpp, common/FormattedXMLWriter.cpp,
common/inheritance.cpp, common/refno.h, common/terrain_utils.cpp,
common/type_utils.h, common/utility.cpp, modules/WorldTime.cpp,
modules/WorldTime.h, physics/Collision.cpp, rulesets/Area.cpp,
rulesets/BaseMind.cpp, rulesets/Character.cpp, rulesets/Entity.cpp,
rulesets/Line.cpp, rulesets/MemMap.cpp, rulesets/MemMap_methods.h,
rulesets/Movement.cpp, rulesets/Plant.cpp, rulesets/Py_Map.cpp,
rulesets/Py_Object.cpp, rulesets/Py_Operation.cpp,
rulesets/Py_Oplist.cpp, rulesets/PythonMindScript.cpp,
rulesets/PythonThingScript.cpp, rulesets/Python_API.cpp,
rulesets/Stackable.cpp, rulesets/TerrainProperty.cpp,
rulesets/Thing.cpp, rulesets/World.cpp, server/Account.cpp,
server/CommClient.cpp, server/CommServer.cpp, server/Connection.cpp,
server/EntityFactory.cpp, server/Lobby.cpp, server/Persistance.cpp,
server/Player.cpp, server/Restoration.cpp, server/ServerRouting.cpp,
server/WorldRouter.cpp, tests/EntityExerciser.h,
tests/IGEntityExerciser.h, tests/inheritancetest.cpp,
tools/cycmd.cpp, tools/cyconvertrules.cpp, tools/cydbload.cpp,
tools/cyloadrules.cpp:
Tweak for loops to avoid creating a temporary iterator each
iteration.
* tests/type_utilstest.cpp: New test for function which does
list conversions.
2004-11-06 20:36:03 +00:00
|
|
|
EntitySet::const_iterator Iend = m_contains.end();
|
|
|
|
|
for (EntitySet::const_iterator I = m_contains.begin(); I != Iend; ++I) {
|
2005-11-23 00:48:25 +00:00
|
|
|
float fromSquSize = (*I)->m_location.squareBoxSize();
|
2005-11-11 Al Riddoch <alriddoch@zepler.org>
* common/types.h, server/Persistance.h, common/BaseWorld.h,
common/BaseWorld.cpp, server/WorldRouter.cpp:
Switch core world map to reference by integer ID rather than string.
Add version of getEntity() which converts from string to integer
automatically.
* rulesets/Character.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/EntityFactory.cpp,
Use getEntity() when looking up an entity, so that conversion of
ID from string to integer is automatic.
* rulesets/BaseMind.cpp, rulesets/MemMap.cpp, rulesets/MemMap.h:
Switch to using integer IDs in MemMap's core mapping.
* server/Account.cpp, server/Account.h: Switch a few function
parameters to use integer ID values, making the code cleaner.
* server/Account.cpp, server/Admin.cpp, server/Persistance.cpp:
Handle string ID to integer conversions as required.
2005-11-11 02:04:56 +00:00
|
|
|
float dist = squareDistance((*I)->m_location, from->m_location);
|
2004-09-24 14:46:45 +00:00
|
|
|
float view_factor = fromSquSize / dist;
|
2004-05-12 09:39:20 +00:00
|
|
|
if (view_factor > consts::square_sight_factor) {
|
2004-08-17 18:17:30 +00:00
|
|
|
contlist.push_back((*I)->getId());
|
2003-03-21 Al Riddoch <alriddoch@zepler.org>
* client/Py_CreatorClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, rulesets/MemMap.cpp, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Thing.cpp, rulesets/Thing.h,
server/Account.cpp, server/Admin.cpp, server/Connection.cpp,
server/Lobby.cpp, server/ServerRouting.cpp:
Use a more efficient technique to set the attributes on
operation arguments without a copy.
* common/BaseEntity.cpp, rulesets/Entity.cpp, rulesets/Thing.h,
rulesets/World.cpp, server/WorldRouter.cpp:
Move handling IG Look ops into the IG code in rulesets.
2003-03-21 00:04:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (contlist.empty()) {
|
|
|
|
|
debug(std::cout << "WARNING: contains empty." << std::endl << std::flush;);
|
2006-02-10 00:48:30 +00:00
|
|
|
sarg->removeAttr("contains");
|
2003-03-21 Al Riddoch <alriddoch@zepler.org>
* client/Py_CreatorClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, rulesets/MemMap.cpp, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Thing.cpp, rulesets/Thing.h,
server/Account.cpp, server/Admin.cpp, server/Connection.cpp,
server/Lobby.cpp, server/ServerRouting.cpp:
Use a more efficient technique to set the attributes on
operation arguments without a copy.
* common/BaseEntity.cpp, rulesets/Entity.cpp, rulesets/Thing.h,
rulesets/World.cpp, server/WorldRouter.cpp:
Move handling IG Look ops into the IG code in rulesets.
2003-03-21 00:04:53 +00:00
|
|
|
}
|
|
|
|
|
|
2005-08-27 14:52:12 +00:00
|
|
|
s->setTo(op->getFrom());
|
2004-09-03 Al Riddoch <alriddoch@zepler.org>
* client/CharacterClient.cpp, client/CharacterClient.h,
client/CommClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, common/OOGThing.cpp,
common/OOGThing.h, common/op_switch.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/Character.cpp, rulesets/Character.h,
rulesets/Creator.cpp, rulesets/Creator.h, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/Food.cpp, rulesets/Food.h,
rulesets/Missile.h, rulesets/Plant.cpp, rulesets/Plant.h,
rulesets/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
rulesets/Stackable.cpp, rulesets/Stackable.h, rulesets/Thing.cpp,
rulesets/Thing.h, rulesets/World.cpp, rulesets/World.h,
server/Account.cpp, server/Account.h, server/Admin.cpp,
server/Admin.h, server/CommClient.cpp, server/Connection.cpp,
server/Connection.h, server/ExternalMind.cpp, server/ExternalMind.h,
server/Lobby.cpp, server/Lobby.h, server/Player.cpp,
server/Player.h, server/WorldRouter.cpp:
Re-work basic op dispatch mechanism so result is passed by
a reference argument rather than returning by value.
2004-09-03 00:33:19 +00:00
|
|
|
res.push_back(s);
|
2001-04-18 10:37:09 +00:00
|
|
|
}
|
|
|
|
|
|
2004-12-06 Al Riddoch <alriddoch@zepler.org>
* client/BaseClient.cpp, client/BaseClient.h, client/CreatorClient.cpp,
client/CreatorClient.h, common/BaseEntity.cpp, common/BaseEntity.h,
common/BaseWorld.h, common/OOGThing.cpp, common/OOGThing.h,
common/op_switch.h, common/refno.h, common/types.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h, rulesets/Character.cpp,
rulesets/Character.h, rulesets/Creator.cpp, rulesets/Creator.h,
rulesets/Entity.cpp, rulesets/Entity.h, rulesets/Food.cpp,
rulesets/Food.h, rulesets/MemMap.cpp, rulesets/Plant.cpp,
rulesets/Plant.h, rulesets/Py_Map.cpp, rulesets/PythonMindScript.cpp,
rulesets/PythonThingScript.cpp, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h, server/Account.cpp,
server/Account.h, server/Admin.cpp, server/Admin.h,
server/CommClient.cpp, server/Connection.cpp, server/Connection.h,
server/Connection_methods.h, server/ExternalMind.cpp,
server/ExternalMind.h, server/Lobby.cpp, server/Lobby.h,
server/Player.cpp, server/Player.h, server/WorldRouter.cpp,
server/WorldRouter.h, tests/Creatortest.cpp, tests/Worldtest.cpp:
Add a new Operation typedef to clean up headers, and get round
limitation in doxygen.
2004-12-06 16:35:44 +00:00
|
|
|
void World::BurnOperation(const Operation & op, OpVector & res)
|
2001-04-18 10:37:09 +00:00
|
|
|
{
|
|
|
|
|
// Can't burn the world.
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-06 Al Riddoch <alriddoch@zepler.org>
* client/BaseClient.cpp, client/BaseClient.h, client/CreatorClient.cpp,
client/CreatorClient.h, common/BaseEntity.cpp, common/BaseEntity.h,
common/BaseWorld.h, common/OOGThing.cpp, common/OOGThing.h,
common/op_switch.h, common/refno.h, common/types.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h, rulesets/Character.cpp,
rulesets/Character.h, rulesets/Creator.cpp, rulesets/Creator.h,
rulesets/Entity.cpp, rulesets/Entity.h, rulesets/Food.cpp,
rulesets/Food.h, rulesets/MemMap.cpp, rulesets/Plant.cpp,
rulesets/Plant.h, rulesets/Py_Map.cpp, rulesets/PythonMindScript.cpp,
rulesets/PythonThingScript.cpp, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h, server/Account.cpp,
server/Account.h, server/Admin.cpp, server/Admin.h,
server/CommClient.cpp, server/Connection.cpp, server/Connection.h,
server/Connection_methods.h, server/ExternalMind.cpp,
server/ExternalMind.h, server/Lobby.cpp, server/Lobby.h,
server/Player.cpp, server/Player.h, server/WorldRouter.cpp,
server/WorldRouter.h, tests/Creatortest.cpp, tests/Worldtest.cpp:
Add a new Operation typedef to clean up headers, and get round
limitation in doxygen.
2004-12-06 16:35:44 +00:00
|
|
|
void World::MoveOperation(const Operation & op, OpVector & res)
|
2001-04-18 10:37:09 +00:00
|
|
|
{
|
|
|
|
|
// Can't move the world.
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-06 Al Riddoch <alriddoch@zepler.org>
* client/BaseClient.cpp, client/BaseClient.h, client/CreatorClient.cpp,
client/CreatorClient.h, common/BaseEntity.cpp, common/BaseEntity.h,
common/BaseWorld.h, common/OOGThing.cpp, common/OOGThing.h,
common/op_switch.h, common/refno.h, common/types.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h, rulesets/Character.cpp,
rulesets/Character.h, rulesets/Creator.cpp, rulesets/Creator.h,
rulesets/Entity.cpp, rulesets/Entity.h, rulesets/Food.cpp,
rulesets/Food.h, rulesets/MemMap.cpp, rulesets/Plant.cpp,
rulesets/Plant.h, rulesets/Py_Map.cpp, rulesets/PythonMindScript.cpp,
rulesets/PythonThingScript.cpp, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h, server/Account.cpp,
server/Account.h, server/Admin.cpp, server/Admin.h,
server/CommClient.cpp, server/Connection.cpp, server/Connection.h,
server/Connection_methods.h, server/ExternalMind.cpp,
server/ExternalMind.h, server/Lobby.cpp, server/Lobby.h,
server/Player.cpp, server/Player.h, server/WorldRouter.cpp,
server/WorldRouter.h, tests/Creatortest.cpp, tests/Worldtest.cpp:
Add a new Operation typedef to clean up headers, and get round
limitation in doxygen.
2004-12-06 16:35:44 +00:00
|
|
|
void World::DeleteOperation(const Operation & op, OpVector & res)
|
2001-04-18 10:37:09 +00:00
|
|
|
{
|
|
|
|
|
// Deleting has no effect.
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-04 21:36:28 +00:00
|
|
|
void World::OtherOperation(const Operation & op, OpVector & res)
|
|
|
|
|
{
|
2006-07-31 22:58:35 +00:00
|
|
|
int class_no = op->getClassNo();
|
2005-05-04 21:36:28 +00:00
|
|
|
|
2006-07-31 22:58:35 +00:00
|
|
|
if (class_no == Atlas::Objects::Operation::DELVE_NO) {
|
2005-05-04 21:36:28 +00:00
|
|
|
delveOperation(op, res);
|
2006-07-31 22:58:35 +00:00
|
|
|
} else if (class_no == Atlas::Objects::Operation::DIG_NO) {
|
2005-05-06 01:41:17 +00:00
|
|
|
digOperation(op, res);
|
2006-07-31 22:58:35 +00:00
|
|
|
} else if (class_no == Atlas::Objects::Operation::MOW_NO) {
|
2005-05-06 01:41:17 +00:00
|
|
|
mowOperation(op, res);
|
2005-05-04 21:36:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|