tibia-rme/source/spawn_brush.cpp
Hampus Joakim Nilsson 8dbc487ef2 Initial commit of RME 3.0.
Clean git repository since the old svn / git mess was pretty much
unrecoverable unfortunetly. I would have liked to keep the history
for posterity, but that proved to be a futile quest.
2012-06-29 16:45:30 +02:00

52 lines
1 KiB
C++

//////////////////////////////////////////////////////////////////////
// This file is part of Remere's Map Editor
//////////////////////////////////////////////////////////////////////
#include "main.h"
#include "spawn_brush.h"
#include "basemap.h"
#include "spawn.h"
//=============================================================================
// Spawn brush
SpawnBrush::SpawnBrush() :
Brush()
{
}
SpawnBrush::~SpawnBrush() {
}
int SpawnBrush::getLookID() const {
return 0;
}
std::string SpawnBrush::getName() const {
return "Spawn Brush";
}
bool SpawnBrush::canDraw(BaseMap* map, Position pos) const {
Tile* tile = map->getTile(pos);
if(tile) {
if(tile->spawn) {
return false;
}
}
return true;
}
void SpawnBrush::undraw(BaseMap* map, Tile* tile) {
delete tile->spawn;
tile->spawn = NULL;
}
void SpawnBrush::draw(BaseMap* map, Tile* tile, void* parameter) {
ASSERT(tile);
ASSERT(parameter); // Should contain an int which is the size of the newd spawn
if(tile->spawn == NULL) {
tile->spawn = newd Spawn(max(1, *(int*)parameter));
}
}