forked from DFHack/stonesense
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
6,102 additions
and
6,102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,163 +1,163 @@ | ||
#include "common.h" | ||
#include "ConditionalSprite.h" | ||
#include "Tile.h" | ||
#include "GameBuildings.h" | ||
#include "GUI.h" | ||
|
||
/* RootTile */ | ||
|
||
RootTile::RootTile() | ||
: SpriteNode() | ||
{ | ||
//cout << "RootTile +" << endl; | ||
} | ||
|
||
RootTile::~RootTile(void) | ||
{ | ||
//cout << "RootTile -" << endl; | ||
uint32_t max = (uint32_t)children.size(); | ||
for(uint32_t i=0; i<max; i++) { | ||
delete(children[i]); | ||
} | ||
} | ||
|
||
bool RootTile::copyToTile(Tile* b) | ||
{ | ||
bool haveMatch = false; | ||
uint32_t max = (uint32_t)children.size(); | ||
|
||
for(uint32_t i=0; i<max; i++) { | ||
if (children[i]->copyToTile(b)) { | ||
haveMatch = true; | ||
} | ||
} | ||
return haveMatch; | ||
} | ||
|
||
void RootTile::addChild(SpriteNode* child) | ||
{ | ||
children.push_back(child); | ||
} | ||
|
||
/* SpriteTile */ | ||
|
||
SpriteTile::SpriteTile() | ||
: ConditionalNode(), SpriteNode() | ||
{ | ||
//cout << "SpriteTile +" << endl; | ||
conditions = NULL; | ||
elsenode = NULL; | ||
} | ||
|
||
SpriteTile::~SpriteTile(void) | ||
{ | ||
//cout << "SpriteTile -" << endl; | ||
delete(elsenode); | ||
delete(conditions); | ||
uint32_t max = (uint32_t)children.size(); | ||
for(uint32_t i=0; i<max; i++) { | ||
delete(children[i]); | ||
} | ||
}; | ||
|
||
bool SpriteTile::copyToTile(Tile* b) | ||
{ | ||
bool condMatch = false; | ||
if (conditions == NULL) { | ||
condMatch = true; | ||
} else { | ||
condMatch = conditions->Matches( b ); | ||
} | ||
|
||
bool haveMatch=false; | ||
if (condMatch) { | ||
uint32_t max = (uint32_t)children.size(); | ||
for(uint32_t i=0; i<max; i++) { | ||
if (children[i]->copyToTile(b)) { | ||
haveMatch = true; | ||
} | ||
} | ||
} else if (elsenode != NULL) { | ||
haveMatch = elsenode->copyToTile(b); | ||
} | ||
return haveMatch; | ||
} | ||
|
||
bool SpriteTile::addCondition(TileCondition* cond) | ||
{ | ||
if (conditions != NULL) { | ||
LogError("Too many condition elements for SpriteTile\n"); | ||
return false; | ||
} | ||
conditions = cond; | ||
return true; | ||
} | ||
|
||
void SpriteTile::addChild(SpriteNode* child) | ||
{ | ||
children.push_back(child); | ||
} | ||
|
||
void SpriteTile::addElse(SpriteNode* child) | ||
{ | ||
elsenode = child; | ||
} | ||
|
||
|
||
/* RotationTile */ | ||
|
||
RotationTile::RotationTile() | ||
: ConditionalNode(), SpriteNode() | ||
{ | ||
//cout << "SpriteTile +" << endl; | ||
} | ||
|
||
RotationTile::~RotationTile(void) | ||
{ | ||
//cout << "SpriteTile -" << endl; | ||
uint32_t max = (uint32_t)children.size(); | ||
for(uint32_t i=0; i<max; i++) { | ||
delete(children[i]); | ||
} | ||
}; | ||
|
||
bool RotationTile::copyToTile(Tile* b) | ||
{ | ||
int index = ssState.Rotation; | ||
int max = (int)children.size(); | ||
if (max == 0) { | ||
return false; | ||
} | ||
while (index >= max) { | ||
index = index - max; | ||
} | ||
return children[index]->copyToTile(b); | ||
} | ||
|
||
bool RotationTile::addCondition(TileCondition* cond) | ||
{ | ||
LogError("Condition elements not permitted for RotationTile\n"); | ||
return false; | ||
} | ||
|
||
void RotationTile::addChild(SpriteNode* child) | ||
{ | ||
children.push_back(child); | ||
} | ||
|
||
/* SpriteElement */ | ||
|
||
SpriteElement::SpriteElement() | ||
: SpriteNode() | ||
{ | ||
//cout << "SpriteElement +" << endl; | ||
sprite.set_sheetindex(-1); | ||
} | ||
|
||
bool SpriteElement::copyToTile(Tile* b) | ||
{ | ||
if (sprite.get_sheetindex() > -1) { | ||
b->building.sprites.push_back(sprite); | ||
} | ||
return true; | ||
} | ||
#include "common.h" | ||
#include "ConditionalSprite.h" | ||
#include "Tile.h" | ||
#include "GameBuildings.h" | ||
#include "GUI.h" | ||
|
||
/* RootTile */ | ||
|
||
RootTile::RootTile() | ||
: SpriteNode() | ||
{ | ||
//cout << "RootTile +" << endl; | ||
} | ||
|
||
RootTile::~RootTile(void) | ||
{ | ||
//cout << "RootTile -" << endl; | ||
uint32_t max = (uint32_t)children.size(); | ||
for(uint32_t i=0; i<max; i++) { | ||
delete(children[i]); | ||
} | ||
} | ||
|
||
bool RootTile::copyToTile(Tile* b) | ||
{ | ||
bool haveMatch = false; | ||
uint32_t max = (uint32_t)children.size(); | ||
|
||
for(uint32_t i=0; i<max; i++) { | ||
if (children[i]->copyToTile(b)) { | ||
haveMatch = true; | ||
} | ||
} | ||
return haveMatch; | ||
} | ||
|
||
void RootTile::addChild(SpriteNode* child) | ||
{ | ||
children.push_back(child); | ||
} | ||
|
||
/* SpriteTile */ | ||
|
||
SpriteTile::SpriteTile() | ||
: ConditionalNode(), SpriteNode() | ||
{ | ||
//cout << "SpriteTile +" << endl; | ||
conditions = NULL; | ||
elsenode = NULL; | ||
} | ||
|
||
SpriteTile::~SpriteTile(void) | ||
{ | ||
//cout << "SpriteTile -" << endl; | ||
delete(elsenode); | ||
delete(conditions); | ||
uint32_t max = (uint32_t)children.size(); | ||
for(uint32_t i=0; i<max; i++) { | ||
delete(children[i]); | ||
} | ||
}; | ||
|
||
bool SpriteTile::copyToTile(Tile* b) | ||
{ | ||
bool condMatch = false; | ||
if (conditions == NULL) { | ||
condMatch = true; | ||
} else { | ||
condMatch = conditions->Matches( b ); | ||
} | ||
|
||
bool haveMatch=false; | ||
if (condMatch) { | ||
uint32_t max = (uint32_t)children.size(); | ||
for(uint32_t i=0; i<max; i++) { | ||
if (children[i]->copyToTile(b)) { | ||
haveMatch = true; | ||
} | ||
} | ||
} else if (elsenode != NULL) { | ||
haveMatch = elsenode->copyToTile(b); | ||
} | ||
return haveMatch; | ||
} | ||
|
||
bool SpriteTile::addCondition(TileCondition* cond) | ||
{ | ||
if (conditions != NULL) { | ||
LogError("Too many condition elements for SpriteTile\n"); | ||
return false; | ||
} | ||
conditions = cond; | ||
return true; | ||
} | ||
|
||
void SpriteTile::addChild(SpriteNode* child) | ||
{ | ||
children.push_back(child); | ||
} | ||
|
||
void SpriteTile::addElse(SpriteNode* child) | ||
{ | ||
elsenode = child; | ||
} | ||
|
||
|
||
/* RotationTile */ | ||
|
||
RotationTile::RotationTile() | ||
: ConditionalNode(), SpriteNode() | ||
{ | ||
//cout << "SpriteTile +" << endl; | ||
} | ||
|
||
RotationTile::~RotationTile(void) | ||
{ | ||
//cout << "SpriteTile -" << endl; | ||
uint32_t max = (uint32_t)children.size(); | ||
for(uint32_t i=0; i<max; i++) { | ||
delete(children[i]); | ||
} | ||
}; | ||
|
||
bool RotationTile::copyToTile(Tile* b) | ||
{ | ||
int index = ssState.Rotation; | ||
int max = (int)children.size(); | ||
if (max == 0) { | ||
return false; | ||
} | ||
while (index >= max) { | ||
index = index - max; | ||
} | ||
return children[index]->copyToTile(b); | ||
} | ||
|
||
bool RotationTile::addCondition(TileCondition* cond) | ||
{ | ||
LogError("Condition elements not permitted for RotationTile\n"); | ||
return false; | ||
} | ||
|
||
void RotationTile::addChild(SpriteNode* child) | ||
{ | ||
children.push_back(child); | ||
} | ||
|
||
/* SpriteElement */ | ||
|
||
SpriteElement::SpriteElement() | ||
: SpriteNode() | ||
{ | ||
//cout << "SpriteElement +" << endl; | ||
sprite.set_sheetindex(-1); | ||
} | ||
|
||
bool SpriteElement::copyToTile(Tile* b) | ||
{ | ||
if (sprite.get_sheetindex() > -1) { | ||
b->building.sprites.push_back(sprite); | ||
} | ||
return true; | ||
} |
Oops, something went wrong.