- fix for issue 772

- fixed some issues in zstream that prevented to use "getline" in zipped streams 
- added a "pooled buffers" system to keep a cache of file descriptors. This is potentially dangerous though, but shaves several seconds of loading time on the PSP. If problems arise on other platforms I'll make it a compilation parameter
- gracefully fail when calling manacost information on a not properly initialized mana cost
This commit is contained in:
wagic.the.homebrew
2011-12-28 16:14:08 +00:00
parent 9e80314f6d
commit 591f0e0d30
12 changed files with 276 additions and 61 deletions
+18 -1
View File
@@ -351,11 +351,23 @@ ManaCost::~ManaCost()
void ManaCost::x()
{
if (cost.size() <= (size_t)Constants::NB_Colors)
{
DebugTrace("Seems ManaCost was not properly initialized");
return;
}
cost[Constants::NB_Colors] = 1;
}
int ManaCost::hasX()
{
if (cost.size() <= (size_t)Constants::NB_Colors)
{
DebugTrace("Seems ManaCost was not properly initialized");
return 0;
}
return cost[Constants::NB_Colors];
}
@@ -465,6 +477,11 @@ void ManaCost::copy(ManaCost * _manaCost)
int ManaCost::getCost(int color)
{
if (cost.size() <= (size_t)color)
{
DebugTrace("Seems ManaCost was not properly initialized");
return 0;
}
return cost[color];
}
@@ -477,7 +494,7 @@ ManaCostHybrid * ManaCost::getHybridCost(unsigned int i)
int ManaCost::hasColor(int color)
{
if (cost[color])
if (getCost(color))
return 1;
for (size_t i = 0; i < hybrids.size(); i++)
{