tibia-rme/source/spawn_brush.cpp
dalkon 886cbc23a7 Lots of changes
Removed libxml2 to use pugixml.
Fixed a bug with the progress bar.
Changed some things in most xml files that pugixml did not like.
Updated the Visual Studio project.
Any NULL symbol has been changed to nullptr.
This most probably broke the CMake that was recently added.
And probably some other things.
2014-01-22 20:16:17 +01:00

52 lines
1.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 = nullptr;
}
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 == nullptr) {
tile->spawn = newd Spawn(max(1, *(int*)parameter));
}
}