mirror of
https://github.com/glest/glest-source.git
synced 2025-02-25 04:02:30 +01:00
- added more error details when some errors are generated
This commit is contained in:
parent
14bd71c250
commit
6c9ba8bea4
@ -483,19 +483,18 @@ void Faction::applyDiscount(const ProducibleType *p, int discount)
|
||||
}
|
||||
|
||||
//apply static production (for starting units)
|
||||
void Faction::applyStaticCosts(const ProducibleType *p)
|
||||
{
|
||||
void Faction::applyStaticCosts(const ProducibleType *p) {
|
||||
assert(p != NULL);
|
||||
//decrease static resources
|
||||
for(int i=0; i<p->getCostCount(); ++i)
|
||||
{
|
||||
for(int i=0; i<p->getCostCount(); ++i) {
|
||||
const ResourceType *rt= p->getCost(i)->getType();
|
||||
assert(rt != NULL);
|
||||
if(rt->getClass() == rcStatic)
|
||||
{
|
||||
if(rt == NULL) {
|
||||
throw runtime_error("rt == NULL");
|
||||
}
|
||||
if(rt->getClass() == rcStatic) {
|
||||
int cost= p->getCost(i)->getAmount();
|
||||
if(cost > 0)
|
||||
{
|
||||
if(cost > 0) {
|
||||
incResourceAmount(rt, -cost);
|
||||
}
|
||||
}
|
||||
|
@ -119,11 +119,14 @@ void SurfaceAtlas::checkDimensions(const Pixmap2D *p) {
|
||||
if(p == NULL) {
|
||||
throw runtime_error("Bad surface texture pixmap (NULL)");
|
||||
}
|
||||
else if(surfaceSize == -1){
|
||||
else if(surfaceSize == -1) {
|
||||
surfaceSize= p->getW();
|
||||
//printf("Setting surfaceSize = %d for pixmap [%s]\n",surfaceSize,p->getPath().c_str());
|
||||
}
|
||||
else if(p->getW() != surfaceSize || p->getH() != surfaceSize) {
|
||||
throw runtime_error("Bad surface texture dimensions");
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Bad surface texture dimensions, expected surfaceSize = %d, texture w = %d, h = %d",surfaceSize,p->getW(),p->getH());
|
||||
throw runtime_error(szBuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user