Skip to content

Commit

Permalink
Refactor: Replaced surfacelist_t with C++ SurfaceSet
Browse files Browse the repository at this point in the history
Also continued updating the DMU implementation so that it uses
de::MapElement.
  • Loading branch information
skyjake committed Jan 15, 2013
1 parent fa5089d commit 5c51bc0
Show file tree
Hide file tree
Showing 9 changed files with 191 additions and 279 deletions.
12 changes: 6 additions & 6 deletions doomsday/engine/include/map/gamemap.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ class GameMap
EntityDatabase* entityDatabase;

PlaneSet trackedPlanes;
surfacelist_t scrollingSurfaces;
surfacelist_t decoratedSurfaces;
surfacelist_t glowingSurfaces;
SurfaceSet scrollingSurfaces;
SurfaceSet decoratedSurfaces;
SurfaceSet glowingSurfaces;

struct blockmap_s* mobjBlockmap;
struct blockmap_s* polyobjBlockmap;
Expand Down Expand Up @@ -609,23 +609,23 @@ struct generators_s* GameMap_Generators(GameMap* map);
* @param map GameMap instance.
* @return List of decorated surfaces.
*/
surfacelist_t* GameMap_DecoratedSurfaces(GameMap* map);
SurfaceSet* GameMap_DecoratedSurfaces(GameMap* map);

/**
* Retrieve a pointer to the glowing surface list for this map.
*
* @param map GameMap instance.
* @return List of glowing surfaces.
*/
surfacelist_t* GameMap_GlowingSurfaces(GameMap* map);
SurfaceSet* GameMap_GlowingSurfaces(GameMap* map);

/**
* Retrieve a pointer to the scrolling surface list for this map.
*
* @param map GameMap instance.
* @return List of scrolling surfaces.
*/
surfacelist_t* GameMap_ScrollingSurfaces(GameMap* map);
SurfaceSet* GameMap_ScrollingSurfaces(GameMap* map);

/**
* Retrieve a pointer to the tracked plane list for this map.
Expand Down
10 changes: 0 additions & 10 deletions doomsday/engine/include/map/p_mapdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,6 @@ typedef struct runtime_mapdata_header_s {
int type; // One of the DMU type constants.
} runtime_mapdata_header_t;

typedef struct surfacelistnode_s {
void* data;
struct surfacelistnode_s* next;
} surfacelistnode_t;

typedef struct surfacelist_s {
uint num;
surfacelistnode_t* head;
} surfacelist_t;

// Map entity definitions.
struct mapentitydef_s;

Expand Down
8 changes: 4 additions & 4 deletions doomsday/engine/include/map/r_world.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ boolean R_UpdateSurface(Surface *suf, boolean forceUpdate);
* @param sl The surface list to add the surface to.
* @param suf The surface to add to the list.
*/
void R_SurfaceListAdd(surfacelist_t* sl, Surface* suf);
boolean R_SurfaceListRemove(surfacelist_t* sl, const Surface* suf);
void R_SurfaceListClear(surfacelist_t* sl);
void R_SurfaceListAdd(SurfaceSet* sl, Surface *suf);
boolean R_SurfaceListRemove(SurfaceSet* sl, Surface *suf);
void R_SurfaceListClear(SurfaceSet* sl);

/**
* Iterate the list of surfaces making a callback for each.
Expand All @@ -191,7 +191,7 @@ void R_SurfaceListClear(surfacelist_t* sl);
* a callback returns a zero value.
* @param context Is passed to the callback function.
*/
boolean R_SurfaceListIterate(surfacelist_t* sl, boolean (*callback) (Surface* suf, void*), void* context);
boolean R_SurfaceListIterate(SurfaceSet* sl, boolean (*callback) (Surface *suf, void*), void* context);

void R_MarkDependantSurfacesForDecorationUpdate(Plane* pln);

Expand Down
3 changes: 3 additions & 0 deletions doomsday/engine/include/map/surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# error "map/surface.h requires C++"
#endif

#include <QSet>
#include "resource/r_data.h"
#include "resource/material.h"
#include "map/p_dmu.h"
Expand Down Expand Up @@ -70,6 +71,8 @@ class Surface : public de::MapElement
~Surface();
};

typedef QSet<Surface *> SurfaceSet;

/**
* Mark the surface as requiring a full update. To be called
* during engine reset.
Expand Down
Loading

0 comments on commit 5c51bc0

Please sign in to comment.