From 4e8f1857a4e154a1fbe71ca4e29b9c6c36b59c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= Date: Wed, 20 Jan 2016 21:20:39 +0200 Subject: [PATCH] Refactor|World|libdoomsday: Moved EntityDatabase/Def, World::map() to libdoomsday Continuing the work of cleaning up the architecture: moved basic basic common components to libdoomsday. --- doomsday/apps/client/include/m_nodepile.h | 6 +-- .../client/include/world/clientserverworld.h | 7 --- doomsday/apps/client/include/world/map.h | 6 --- doomsday/apps/client/src/dd_main.cpp | 2 +- doomsday/apps/client/src/world/api_map.cpp | 2 +- .../apps/client/src/world/api_mapedit.cpp | 6 +-- .../client/src/world/clientserverworld.cpp | 44 +++++++++---------- doomsday/apps/client/src/world/map.cpp | 8 +--- .../include/doomsday}/EntityDatabase | 0 .../include/doomsday}/world/entitydatabase.h | 16 +++---- .../include/doomsday}/world/entitydef.h | 7 ++- .../libdoomsday/include/doomsday/world/map.h | 9 ++++ .../include/doomsday}/world/propertyvalue.h | 10 +++-- .../include/doomsday/world/world.h | 17 +++++++ .../src/world/entitydatabase.cpp | 9 ++-- .../src/world/entitydef.cpp | 36 +++++++-------- doomsday/apps/libdoomsday/src/world/map.cpp | 7 +++ .../src/world/propertyvalue.cpp | 6 +-- doomsday/apps/libdoomsday/src/world/world.cpp | 19 ++++++++ doomsday/apps/server/CMakeLists.txt | 6 --- 20 files changed, 120 insertions(+), 103 deletions(-) rename doomsday/apps/{client/include => libdoomsday/include/doomsday}/EntityDatabase (100%) rename doomsday/apps/{client/include => libdoomsday/include/doomsday}/world/entitydatabase.h (92%) rename doomsday/apps/{client/include => libdoomsday/include/doomsday}/world/entitydef.h (96%) rename doomsday/apps/{client/include => libdoomsday/include/doomsday}/world/propertyvalue.h (96%) rename doomsday/apps/{client => libdoomsday}/src/world/entitydatabase.cpp (98%) rename doomsday/apps/{client => libdoomsday}/src/world/entitydef.cpp (94%) rename doomsday/apps/{client => libdoomsday}/src/world/propertyvalue.cpp (93%) diff --git a/doomsday/apps/client/include/m_nodepile.h b/doomsday/apps/client/include/m_nodepile.h index 978c3f4c5f..e6e4211e7f 100644 --- a/doomsday/apps/client/include/m_nodepile.h +++ b/doomsday/apps/client/include/m_nodepile.h @@ -1,4 +1,4 @@ -/** @file +/** @file m_nodepile.h Specialized Node Allocation * * @authors Copyright © 2003-2013 Jaakko Keränen * @authors Copyright © 2009-2013 Daniel Swanson @@ -17,10 +17,6 @@ * http://www.gnu.org/licenses */ -/* - * m_nodepile.h: Specialized Node Allocation - */ - #ifndef __DOOMSDAY_NODEPILE_H__ #define __DOOMSDAY_NODEPILE_H__ diff --git a/doomsday/apps/client/include/world/clientserverworld.h b/doomsday/apps/client/include/world/clientserverworld.h index 7f0d78e6b1..436548877c 100644 --- a/doomsday/apps/client/include/world/clientserverworld.h +++ b/doomsday/apps/client/include/world/clientserverworld.h @@ -79,15 +79,8 @@ class ClientServerWorld : public World */ void update(); - /** - * Returns @c true if a map is currently loaded. - */ - bool hasMap() const; - /** * Provides access to the currently loaded map. - * - * @see hasMap() */ de::Map &map() const; diff --git a/doomsday/apps/client/include/world/map.h b/doomsday/apps/client/include/world/map.h index ae8e4d3a76..dc9ccb8acf 100644 --- a/doomsday/apps/client/include/world/map.h +++ b/doomsday/apps/client/include/world/map.h @@ -67,7 +67,6 @@ class BiasTracker; namespace de { class Blockmap; -class EntityDatabase; #ifdef __CLIENT__ class LightGrid; #endif @@ -626,11 +625,6 @@ class Map : public world::Map public: // Data structures ------------------------------------------------------- - /** - * Provides access to the entity database. - */ - EntityDatabase &entityDatabase() const; - /** * Provides access to the primary @ref Mesh geometry owned by the map. Note that * further meshes may be assigned to individual elements of the map should their diff --git a/doomsday/apps/client/src/dd_main.cpp b/doomsday/apps/client/src/dd_main.cpp index ae3b1e429b..397826dba8 100644 --- a/doomsday/apps/client/src/dd_main.cpp +++ b/doomsday/apps/client/src/dd_main.cpp @@ -62,6 +62,7 @@ #include #include #include +#include #ifdef __CLIENT__ # include "clientapp.h" @@ -78,7 +79,6 @@ #include "gl/svg.h" #include "world/clientserverworld.h" -#include "world/entitydef.h" #include "world/map.h" #include "world/p_players.h" diff --git a/doomsday/apps/client/src/world/api_map.cpp b/doomsday/apps/client/src/world/api_map.cpp index 05f3c322ea..cf518220c8 100644 --- a/doomsday/apps/client/src/world/api_map.cpp +++ b/doomsday/apps/client/src/world/api_map.cpp @@ -30,12 +30,12 @@ #include #include #include +#include #include "network/net_main.h" #include "world/blockmap.h" #include "world/dmuargs.h" -#include "world/entitydatabase.h" #include "world/linesighttest.h" #include "world/maputil.h" #include "world/p_players.h" diff --git a/doomsday/apps/client/src/world/api_mapedit.cpp b/doomsday/apps/client/src/world/api_mapedit.cpp index a4ec7e904e..315c63e5fe 100644 --- a/doomsday/apps/client/src/world/api_mapedit.cpp +++ b/doomsday/apps/client/src/world/api_mapedit.cpp @@ -25,15 +25,15 @@ #include #include #include -#include "dd_main.h" +#include +#include -#include "world/entitydatabase.h" +#include "dd_main.h" #include "world/map.h" #include "world/polyobjdata.h" #include "Plane" #include "Sector" #include "Surface" - #include "edit_map.h" using namespace de; diff --git a/doomsday/apps/client/src/world/clientserverworld.cpp b/doomsday/apps/client/src/world/clientserverworld.cpp index 48d63707d1..eb7c8a64dc 100644 --- a/doomsday/apps/client/src/world/clientserverworld.cpp +++ b/doomsday/apps/client/src/world/clientserverworld.cpp @@ -303,8 +303,6 @@ DENG2_PIMPL(ClientServerWorld) { Binder binder; ///< Doomsday Script bindings for the World. Record worldModule; - - Map *map = nullptr; ///< Current map. Record fallbackMapInfo; ///< Used when no effective MapInfo definition. timespan_t time = 0; ///< World-wide time. @@ -452,10 +450,10 @@ DENG2_PIMPL(ClientServerWorld) /** * Replace the current map with @a map. */ - void makeCurrent(Map *newMap) + void makeCurrent(Map *map) { // This is now the current map (if any). - map = newMap; + self.setMap(map); if(!map) return; // We cannot make an editable map current. @@ -688,6 +686,8 @@ DENG2_PIMPL(ClientServerWorld) /// @todo Split this into subtasks (load, make current, cache assets). bool changeMap(res::MapManifest *mapManifest = nullptr) { + Map *map = self.mapPtr(); + #ifdef __CLIENT__ if(map) { @@ -706,7 +706,9 @@ DENG2_PIMPL(ClientServerWorld) #ifdef __CLIENT__ R_DestroyContactLists(); #endif - delete map; map = nullptr; + delete map; + self.setMap(nullptr); + Z_FreeTags(PU_MAP, PU_PURGELEVEL - 1); // Are we just unloading the current map? @@ -744,13 +746,13 @@ DENG2_PIMPL(ClientServerWorld) // Output a human-readable report of any issues encountered during conversion. reporter.writeLog(); - return map != nullptr; + return self.hasMap(); } #ifdef __CLIENT__ void updateHandOrigin() { - DENG2_ASSERT(hand != nullptr && map != nullptr); + DENG2_ASSERT(hand != nullptr && self.hasMap()); viewdata_t const *viewData = &::viewPlayer->viewport(); hand->setOrigin(viewData->current.origin + viewData->frontVec.xzy() * handDistance); @@ -771,16 +773,14 @@ ClientServerWorld::ClientServerWorld() , d(new Instance(this)) {} -bool ClientServerWorld::hasMap() const -{ - return d->map != nullptr; -} - Map &ClientServerWorld::map() const { - if(d->map) return *d->map; - /// @throw MapError Attempted with no map loaded. - throw MapError("ClientServerWorld::map", "No map is currently loaded"); + if(!hasMap()) + { + /// @throw MapError Attempted with no map loaded. + throw MapError("ClientServerWorld::map", "No map is currently loaded"); + } + return World::map().as(); } bool ClientServerWorld::changeMap(de::Uri const &mapUri) @@ -838,9 +838,9 @@ void ClientServerWorld::update() }); // Update the current map, also. - if(d->map) + if(hasMap()) { - d->map->update(); + map().update(); } } @@ -876,13 +876,13 @@ timespan_t ClientServerWorld::time() const void ClientServerWorld::tick(timespan_t elapsed) { #ifdef __CLIENT__ - if(d->map) + if(hasMap()) { - d->map->skyAnimator().advanceTime(elapsed); + map().skyAnimator().advanceTime(elapsed); if(DD_IsSharpTick()) { - d->map->thinkers().forAll(reinterpret_cast(gx.MobjThinker), 0x1, [] (thinker_t *th) + map().thinkers().forAll(reinterpret_cast(gx.MobjThinker), 0x1, [] (thinker_t *th) { Mobj_AnimateHaloOcclussion(*reinterpret_cast(th)); return LoopContinue; @@ -902,7 +902,7 @@ Hand &ClientServerWorld::hand(coord_t *distance) const { d->hand.reset(new Hand()); audienceForFrameEnd() += *d->hand; - if(d->map) + if(hasMap()) { d->updateHandOrigin(); } @@ -922,7 +922,7 @@ void ClientServerWorld::beginFrame(bool resetNextViewer) void ClientServerWorld::endFrame() { - if(d->map && d->hand) + if(hasMap() && d->hand) { d->updateHandOrigin(); diff --git a/doomsday/apps/client/src/world/map.cpp b/doomsday/apps/client/src/world/map.cpp index 07ac377f4c..7462b2badf 100644 --- a/doomsday/apps/client/src/world/map.cpp +++ b/doomsday/apps/client/src/world/map.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #ifdef __CLIENT__ # include "clientapp.h" @@ -51,7 +52,6 @@ #include "world/clientserverworld.h" // ddMapSetup, validCount #include "world/blockmap.h" #include "world/lineblockmap.h" -#include "world/entitydatabase.h" #include "world/lineowner.h" #include "world/p_object.h" #include "world/polyobjdata.h" @@ -164,7 +164,6 @@ DENG2_PIMPL(Map) // std::unique_ptr thinkers; Sky sky; - EntityDatabase entityDatabase; std::unique_ptr mobjBlockmap; std::unique_ptr polyobjBlockmap; @@ -2395,11 +2394,6 @@ bool Map::identifySoundEmitter(SoundEmitter const &emitter, Sector **sector, return (*sector != 0 || *poly != 0|| *plane != 0|| *surface != 0); } -EntityDatabase &Map::entityDatabase() const -{ - return d->entityDatabase; -} - void Map::initNodePiles() { LOG_AS("Map"); diff --git a/doomsday/apps/client/include/EntityDatabase b/doomsday/apps/libdoomsday/include/doomsday/EntityDatabase similarity index 100% rename from doomsday/apps/client/include/EntityDatabase rename to doomsday/apps/libdoomsday/include/doomsday/EntityDatabase diff --git a/doomsday/apps/client/include/world/entitydatabase.h b/doomsday/apps/libdoomsday/include/doomsday/world/entitydatabase.h similarity index 92% rename from doomsday/apps/client/include/world/entitydatabase.h rename to doomsday/apps/libdoomsday/include/doomsday/world/entitydatabase.h index 8734b0ee35..9d0cacb535 100644 --- a/doomsday/apps/client/include/world/entitydatabase.h +++ b/doomsday/apps/libdoomsday/include/doomsday/world/entitydatabase.h @@ -17,17 +17,15 @@ * 02110-1301 USA */ -#ifndef DENG_WORLD_ENTITYDATABASE_H -#define DENG_WORLD_ENTITYDATABASE_H +#ifndef LIBDOOMSDAY_WORLD_ENTITYDATABASE_H +#define LIBDOOMSDAY_WORLD_ENTITYDATABASE_H #include #include -#include "api_mapedit.h" // valuetype_t -#include "world/entitydef.h" -#include "world/propertyvalue.h" - -namespace de { +#include "valuetype.h" +#include "entitydef.h" +#include "propertyvalue.h" /** * An EntityDatabase is used in the process of transferring mobj spawn spot @@ -87,6 +85,4 @@ class EntityDatabase DENG2_PRIVATE(d) }; -} // namespace de - -#endif // DENG_WORLD_ENTITYDATABASE_H +#endif // LIBDOOMSDAY_WORLD_ENTITYDATABASE_H diff --git a/doomsday/apps/client/include/world/entitydef.h b/doomsday/apps/libdoomsday/include/doomsday/world/entitydef.h similarity index 96% rename from doomsday/apps/client/include/world/entitydef.h rename to doomsday/apps/libdoomsday/include/doomsday/world/entitydef.h index f491640809..42ebed305b 100644 --- a/doomsday/apps/client/include/world/entitydef.h +++ b/doomsday/apps/libdoomsday/include/doomsday/world/entitydef.h @@ -18,12 +18,11 @@ * 02110-1301 USA */ -#ifndef DENG_WORLD_ENTITYDEF_H -#define DENG_WORLD_ENTITYDEF_H +#ifndef LIBDOOMSDAY_WORLD_ENTITYDEF_H +#define LIBDOOMSDAY_WORLD_ENTITYDEF_H #include "dd_share.h" #include "api_mapedit.h" -#include "m_nodepile.h" #include #include @@ -130,4 +129,4 @@ void P_ShutdownMapEntityDefs(); } // extern "C" #endif -#endif // DENG_WORLD_ENTITYDEF_H +#endif // LIBDOOMSDAY_WORLD_ENTITYDEF_H diff --git a/doomsday/apps/libdoomsday/include/doomsday/world/map.h b/doomsday/apps/libdoomsday/include/doomsday/world/map.h index 2e7c6cfe1f..2229d8a5fa 100644 --- a/doomsday/apps/libdoomsday/include/doomsday/world/map.h +++ b/doomsday/apps/libdoomsday/include/doomsday/world/map.h @@ -24,6 +24,8 @@ #include #include +class EntityDatabase; + namespace world { /** @@ -65,6 +67,13 @@ class LIBDOOMSDAY_PUBLIC Map */ void setManifest(res::MapManifest *newManifest); + /** + * Provides access to the entity database. + */ + EntityDatabase &entityDatabase() const; + + DENG2_AS_IS_METHODS() + public: /// Notified when the map is about to be deleted. DENG2_DEFINE_AUDIENCE2(Deletion, void mapBeingDeleted(Map const &map)) diff --git a/doomsday/apps/client/include/world/propertyvalue.h b/doomsday/apps/libdoomsday/include/doomsday/world/propertyvalue.h similarity index 96% rename from doomsday/apps/client/include/world/propertyvalue.h rename to doomsday/apps/libdoomsday/include/doomsday/world/propertyvalue.h index 606b96ddea..14f01a8191 100644 --- a/doomsday/apps/client/include/world/propertyvalue.h +++ b/doomsday/apps/libdoomsday/include/doomsday/world/propertyvalue.h @@ -22,10 +22,12 @@ * 02110-1301 USA */ -#ifndef DENG_DATA_PROPERTYVALUE_H -#define DENG_DATA_PROPERTYVALUE_H +#ifndef LIBDOOMSDAY_WORLD_PROPERTYVALUE_H +#define LIBDOOMSDAY_WORLD_PROPERTYVALUE_H -#include "de_base.h" +#include "valuetype.h" +#include +#include class PropertyValue { @@ -179,4 +181,4 @@ class PropertyFloatValue : public PropertyValue */ PropertyValue* BuildPropertyValue(valuetype_t type, void* valueAdr); -#endif // DENG_DATA_PROPERTYVALUE_H +#endif // LIBDOOMSDAY_WORLD_PROPERTYVALUE_H diff --git a/doomsday/apps/libdoomsday/include/doomsday/world/world.h b/doomsday/apps/libdoomsday/include/doomsday/world/world.h index 642c3ebd76..a7371af477 100644 --- a/doomsday/apps/libdoomsday/include/doomsday/world/world.h +++ b/doomsday/apps/libdoomsday/include/doomsday/world/world.h @@ -24,6 +24,8 @@ #include #include +namespace world { class Map; } + /** * Base class for the game world. * @@ -39,9 +41,24 @@ class LIBDOOMSDAY_PUBLIC World : public de::System virtual void reset(); + /** + * Returns @c true if a map is currently loaded. + */ + bool hasMap() const; + + /** + * Provides access to the currently loaded map. + * + * @see hasMap() + */ + world::Map &map() const; + // Systems observe the passage of time. void timeChanged(de::Clock const &) override; +protected: + void setMap(world::Map *map); + public: /// Notified whenever the "current" map changes. DENG2_DEFINE_AUDIENCE2(MapChange, void worldMapChanged()) diff --git a/doomsday/apps/client/src/world/entitydatabase.cpp b/doomsday/apps/libdoomsday/src/world/entitydatabase.cpp similarity index 98% rename from doomsday/apps/client/src/world/entitydatabase.cpp rename to doomsday/apps/libdoomsday/src/world/entitydatabase.cpp index 5a937d1375..9e95e145f0 100644 --- a/doomsday/apps/client/src/world/entitydatabase.cpp +++ b/doomsday/apps/libdoomsday/src/world/entitydatabase.cpp @@ -18,12 +18,13 @@ * 02110-1301 USA */ -#include "de_platform.h" -#include "world/entitydatabase.h" +#include "doomsday/world/entitydatabase.h" #include #include +using namespace de; + // An entity is a set of one or more properties. // Key is the unique identifier of said property in the // MapEntityPropertyDef it is derived from. @@ -35,8 +36,6 @@ typedef std::map Entities; // Entities are grouped in sets by their unique identifier. typedef std::map EntitySet; -namespace de { - DENG2_PIMPL(EntityDatabase) { EntitySet entitySets; @@ -142,5 +141,3 @@ void EntityDatabase::setProperty(MapEntityPropertyDef const *def, int elementInd // Add a new record. entity->insert(std::pair(def->id, value)); } - -} // namespace de diff --git a/doomsday/apps/client/src/world/entitydef.cpp b/doomsday/apps/libdoomsday/src/world/entitydef.cpp similarity index 94% rename from doomsday/apps/client/src/world/entitydef.cpp rename to doomsday/apps/libdoomsday/src/world/entitydef.cpp index dc9965ec71..038def0141 100644 --- a/doomsday/apps/client/src/world/entitydef.cpp +++ b/doomsday/apps/libdoomsday/src/world/entitydef.cpp @@ -18,8 +18,12 @@ * 02110-1301 USA */ -#include "de_base.h" -#include "world/entitydef.h" +//#include "de_base.h" +#include "doomsday/world/entitydef.h" +#include "doomsday/world/world.h" +#include "doomsday/world/map.h" +#include "doomsday/world/propertyvalue.h" +#include "doomsday/EntityDatabase" #include #include @@ -29,10 +33,6 @@ #include #include -#include "world/map.h" -#include "world/propertyvalue.h" -#include "EntityDatabase" - using namespace de; // Map entity definitions. @@ -316,11 +316,11 @@ static void setValue(void *dst, valuetype_t dstType, PropertyValue const &pvalue DENG_EXTERN_C byte P_GetGMOByte(int entityId, int elementIndex, int propertyId) { byte returnVal = 0; - if(App_World().hasMap()) + if(World::get().hasMap()) { try { - EntityDatabase &db = App_World().map().entityDatabase(); + EntityDatabase &db = World::get().map().entityDatabase(); MapEntityPropertyDef *propDef = entityPropertyDef(entityId, propertyId); setValue(&returnVal, DDVT_BYTE, db.property(propDef, elementIndex)); @@ -337,11 +337,11 @@ DENG_EXTERN_C byte P_GetGMOByte(int entityId, int elementIndex, int propertyId) DENG_EXTERN_C short P_GetGMOShort(int entityId, int elementIndex, int propertyId) { short returnVal = 0; - if(App_World().hasMap()) + if(World::get().hasMap()) { try { - EntityDatabase &db = App_World().map().entityDatabase(); + EntityDatabase &db = World::get().map().entityDatabase(); MapEntityPropertyDef *propDef = entityPropertyDef(entityId, propertyId); setValue(&returnVal, DDVT_SHORT, db.property(propDef, elementIndex)); @@ -358,11 +358,11 @@ DENG_EXTERN_C short P_GetGMOShort(int entityId, int elementIndex, int propertyId DENG_EXTERN_C int P_GetGMOInt(int entityId, int elementIndex, int propertyId) { int returnVal = 0; - if(App_World().hasMap()) + if(World::get().hasMap()) { try { - EntityDatabase &db = App_World().map().entityDatabase(); + EntityDatabase &db = World::get().map().entityDatabase(); MapEntityPropertyDef *propDef = entityPropertyDef(entityId, propertyId); setValue(&returnVal, DDVT_INT, db.property(propDef, elementIndex)); @@ -379,11 +379,11 @@ DENG_EXTERN_C int P_GetGMOInt(int entityId, int elementIndex, int propertyId) DENG_EXTERN_C fixed_t P_GetGMOFixed(int entityId, int elementIndex, int propertyId) { fixed_t returnVal = 0; - if(App_World().hasMap()) + if(World::get().hasMap()) { try { - EntityDatabase &db = App_World().map().entityDatabase(); + EntityDatabase &db = World::get().map().entityDatabase(); MapEntityPropertyDef *propDef = entityPropertyDef(entityId, propertyId); setValue(&returnVal, DDVT_FIXED, db.property(propDef, elementIndex)); @@ -400,11 +400,11 @@ DENG_EXTERN_C fixed_t P_GetGMOFixed(int entityId, int elementIndex, int property DENG_EXTERN_C angle_t P_GetGMOAngle(int entityId, int elementIndex, int propertyId) { angle_t returnVal = 0; - if(App_World().hasMap()) + if(World::get().hasMap()) { try { - EntityDatabase &db = App_World().map().entityDatabase(); + EntityDatabase &db = World::get().map().entityDatabase(); MapEntityPropertyDef *propDef = entityPropertyDef(entityId, propertyId); setValue(&returnVal, DDVT_ANGLE, db.property(propDef, elementIndex)); @@ -421,11 +421,11 @@ DENG_EXTERN_C angle_t P_GetGMOAngle(int entityId, int elementIndex, int property DENG_EXTERN_C float P_GetGMOFloat(int entityId, int elementIndex, int propertyId) { float returnVal = 0; - if(App_World().hasMap()) + if(World::get().hasMap()) { try { - EntityDatabase &db = App_World().map().entityDatabase(); + EntityDatabase &db = World::get().map().entityDatabase(); MapEntityPropertyDef *propDef = entityPropertyDef(entityId, propertyId); setValue(&returnVal, DDVT_FLOAT, db.property(propDef, elementIndex)); diff --git a/doomsday/apps/libdoomsday/src/world/map.cpp b/doomsday/apps/libdoomsday/src/world/map.cpp index 2b2432c08c..1933d016b4 100644 --- a/doomsday/apps/libdoomsday/src/world/map.cpp +++ b/doomsday/apps/libdoomsday/src/world/map.cpp @@ -18,6 +18,7 @@ */ #include "doomsday/world/map.h" +#include "doomsday/EntityDatabase" using namespace de; @@ -26,6 +27,7 @@ namespace world { DENG2_PIMPL(Map) , DENG2_OBSERVES(Record, Deletion) { + EntityDatabase entityDatabase; res::MapManifest *manifest = nullptr; ///< Not owned, may be @c nullptr. Instance(Public *i) : Base(i) @@ -90,4 +92,9 @@ void Map::setManifest(res::MapManifest *newManifest) if(d->manifest) d->manifest->audienceForDeletion() += d; } +EntityDatabase &Map::entityDatabase() const +{ + return d->entityDatabase; +} + } // namespace world diff --git a/doomsday/apps/client/src/world/propertyvalue.cpp b/doomsday/apps/libdoomsday/src/world/propertyvalue.cpp similarity index 93% rename from doomsday/apps/client/src/world/propertyvalue.cpp rename to doomsday/apps/libdoomsday/src/world/propertyvalue.cpp index 43b27ebc87..141e05b92f 100644 --- a/doomsday/apps/client/src/world/propertyvalue.cpp +++ b/doomsday/apps/libdoomsday/src/world/propertyvalue.cpp @@ -1,4 +1,4 @@ -/** @file propertyvalue.cpp Data types for representing property values. +/** @file propertyvalue.cpp Data types for representing property values. * @ingroup data * * @authors Copyright © 2013 Daniel Swanson @@ -18,9 +18,9 @@ * 02110-1301 USA */ -#include +#include "doomsday/world/propertyvalue.h" -#include "world/propertyvalue.h" +#include using namespace de; diff --git a/doomsday/apps/libdoomsday/src/world/world.cpp b/doomsday/apps/libdoomsday/src/world/world.cpp index e119e7640f..46f9daccd5 100644 --- a/doomsday/apps/libdoomsday/src/world/world.cpp +++ b/doomsday/apps/libdoomsday/src/world/world.cpp @@ -29,10 +29,13 @@ static World *theWorld = nullptr; DENG2_PIMPL(World) { + world::Map *map = nullptr; + Instance(Public *i) : Base(i) { theWorld = thisPublic; } + ~Instance() { theWorld = nullptr; @@ -74,6 +77,22 @@ void World::timeChanged(Clock const &) // Nothing to do. } +void World::setMap(world::Map *map) +{ + d->map = map; +} + +bool World::hasMap() const +{ + return d->map != nullptr; +} + +world::Map &World::map() const +{ + DENG2_ASSERT(hasMap()); + return *d->map; +} + World &World::get() { DENG2_ASSERT(theWorld); diff --git a/doomsday/apps/server/CMakeLists.txt b/doomsday/apps/server/CMakeLists.txt index e9719d0761..bdf040e23e 100644 --- a/doomsday/apps/server/CMakeLists.txt +++ b/doomsday/apps/server/CMakeLists.txt @@ -92,8 +92,6 @@ set (SHARED_WITH_CLIENT ${src}/include/world/bspleaf.h ${src}/include/world/bspnode.h ${src}/include/world/convexsubspace.h - ${src}/include/world/entitydatabase.h - ${src}/include/world/entitydef.h ${src}/include/world/impulseaccumulator.h ${src}/include/world/interceptor.h ${src}/include/world/line.h @@ -108,7 +106,6 @@ set (SHARED_WITH_CLIENT ${src}/include/world/plane.h ${src}/include/world/polyobj.h ${src}/include/world/polyobjdata.h - ${src}/include/world/propertyvalue.h ${src}/include/world/reject.h ${src}/include/world/sector.h ${src}/include/world/sky.h @@ -187,8 +184,6 @@ set (SHARED_WITH_CLIENT ${src}/src/world/bspnode.cpp ${src}/src/world/convexsubspace.cpp ${src}/src/world/dmuargs.cpp - ${src}/src/world/entitydatabase.cpp - ${src}/src/world/entitydef.cpp ${src}/src/world/impulseaccumulator.cpp ${src}/src/world/interceptor.cpp ${src}/src/world/line.cpp @@ -203,7 +198,6 @@ set (SHARED_WITH_CLIENT ${src}/src/world/plane.cpp ${src}/src/world/polyobj.cpp ${src}/src/world/polyobjdata.cpp - ${src}/src/world/propertyvalue.cpp ${src}/src/world/reject.cpp ${src}/src/world/sector.cpp ${src}/src/world/sectorcluster.cpp