1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

small improvements, bugfixes etc.

This commit is contained in:
mateuszb 2008-01-30 14:19:35 +00:00
parent 2b4e5ff2e2
commit 974d27aacc
8 changed files with 23 additions and 60 deletions

View File

@ -183,7 +183,7 @@ void CHeroWindow::setHero(const CGHeroInstance *hero)
portraitArea->text = hero->biography; portraitArea->text = hero->biography;
delete garInt; delete garInt;
garInt = new CGarrisonInt(80, 494, 8, 0, curBack, 13, 482, curHero); garInt = new CGarrisonInt(80, 493, 8, 0, curBack, 13, 482, curHero);
for(int g=0; g<primSkillAreas.size(); ++g) for(int g=0; g<primSkillAreas.size(); ++g)
{ {
@ -899,7 +899,7 @@ void CArtPlace::clickLeft(boost::logic::tribool down)
} }
else else
{ {
bool backID = -1; int backID = -1;
for(int g=0; g<ourWindow->backpack.size(); ++g) for(int g=0; g<ourWindow->backpack.size(); ++g)
{ {
if(ourWindow->backpack[g]==this) //if user wants to put something to backpack if(ourWindow->backpack[g]==this) //if user wants to put something to backpack

View File

@ -23,6 +23,8 @@
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
using namespace CSDL_Ext; using namespace CSDL_Ext;
extern TTF_Font * GEOR16;
class OCM_HLP_CGIN class OCM_HLP_CGIN
{ {
public: public:
@ -150,7 +152,7 @@ void CGarrisonSlot::show()
char* buf = new char[15]; char* buf = new char[15];
itoa(count,buf,10); itoa(count,buf,10);
blitAt(CGI->creh->bigImgs[creature->idNumber],pos); blitAt(CGI->creh->bigImgs[creature->idNumber],pos);
printTo(buf,pos.x+56,pos.y+62,GEOR13,zwykly); printTo(buf,pos.x+56,pos.y+62,GEOR16,zwykly);
if(owner->highlighted==this) if(owner->highlighted==this)
blitAt(CGI->creh->bigImgs[-1],pos); blitAt(CGI->creh->bigImgs[-1],pos);
updateRect(&pos,ekran); updateRect(&pos,ekran);

View File

@ -509,11 +509,11 @@ Uint32 CSDL_Ext::colorToUint32(const SDL_Color * color)
{ {
Uint32 ret = 0; Uint32 ret = 0;
ret+=color->unused; ret+=color->unused;
ret*=256; ret<<=8; //*=256
ret+=color->b; ret+=color->b;
ret*=256; ret<<=8; //*=256
ret+=color->g; ret+=color->g;
ret*=256; ret<<=8; //*=256
ret+=color->r; ret+=color->r;
return ret; return ret;
} }
@ -733,7 +733,7 @@ int readNormalNr (std::istream &in, int bytCon)
{ {
in.read((char*)&byte,1); in.read((char*)&byte,1);
ret+=byte*amp; ret+=byte*amp;
amp*=256; amp<<=8;
} }
} }
else return -1; else return -1;

View File

@ -919,8 +919,6 @@ void CAmbarCendamo::deh3m()
spec->artifacts.push_back(NULL); spec->artifacts.push_back(NULL);
} }
} }
for(int t=spec->artifacts.size(); t<10; ++t)
spec->artifacts.push_back(NULL);
} //artifacts } //artifacts
else else
{ {
@ -944,6 +942,9 @@ void CAmbarCendamo::deh3m()
spec->artifWorn[17] = NULL; spec->artifWorn[17] = NULL;
spec->artifWorn[5] = NULL; spec->artifWorn[5] = NULL;
} }
for(int t=spec->artifacts.size(); t<10; ++t) //it does make sense, even it is not obvious ;]
spec->artifacts.push_back(NULL);
spec->guardRange = readNormalNr(i, 1); ++i; spec->guardRange = readNormalNr(i, 1); ++i;
if(spec->guardRange == 0xff) if(spec->guardRange == 0xff)
spec->isGuarding = false; spec->isGuarding = false;

View File

@ -16,7 +16,7 @@ int readNormalNr (int pos, int bytCon, unsigned char * str)
for (int i=0; i<bytCon; i++) for (int i=0; i<bytCon; i++)
{ {
ret+=str[pos+i]*amp; ret+=str[pos+i]*amp;
amp*=256; amp<<=8;
} }
} }
else return -1; else return -1;

View File

@ -46,7 +46,7 @@ int readNormalNr2 (unsigned char* bufor, int &iter, int bytCon)
for (int i=iter; i<iter+bytCon; i++) for (int i=iter; i<iter+bytCon; i++)
{ {
ret+=bufor[i]*amp; ret+=bufor[i]*amp;
amp*=256; amp<<=8;
} }
iter+=bytCon; iter+=bytCon;
return ret; return ret;

View File

@ -8,7 +8,7 @@ int readNormalNr (unsigned char * bufor, int pos, int bytCon = 4)
for (int i=0; i<bytCon; i++) for (int i=0; i<bytCon; i++)
{ {
ret+=bufor[pos+i]*amp; ret+=bufor[pos+i]*amp;
amp*=256; amp<<=8;
} }
return ret; return ret;
} }

View File

@ -693,13 +693,14 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
{ {
int imgVal = 8; int imgVal = 8;
SDL_Surface * tb; SDL_Surface * tb;
if(((CHeroObjInfo*)themp->info)->myInstance->type==NULL)
continue;
std::vector<Cimage> & iv = ((CHeroObjInfo*)themp->info)->myInstance->type->heroClass->moveAnim->ourImages;
switch(themp->moveDir) switch(themp->moveDir)
{ {
case 1: case 1:
{ {
if(((CHeroObjInfo*)themp->info)->myInstance->type==NULL)
continue;
std::vector<Cimage> & iv = ((CHeroObjInfo*)themp->info)->myInstance->type->heroClass->moveAnim->ourImages;
int gg; int gg;
for(gg=0; gg<iv.size(); ++gg) for(gg=0; gg<iv.size(); ++gg)
{ {
@ -717,9 +718,6 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
} }
case 2: case 2:
{ {
if(((CHeroObjInfo*)themp->info)->myInstance->type==NULL)
continue;
std::vector<Cimage> & iv = ((CHeroObjInfo*)themp->info)->myInstance->type->heroClass->moveAnim->ourImages;
int gg; int gg;
for(gg=0; gg<iv.size(); ++gg) for(gg=0; gg<iv.size(); ++gg)
{ {
@ -737,9 +735,6 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
} }
case 3: case 3:
{ {
if(((CHeroObjInfo*)themp->info)->myInstance->type==NULL)
continue;
std::vector<Cimage> & iv = ((CHeroObjInfo*)themp->info)->myInstance->type->heroClass->moveAnim->ourImages;
int gg; int gg;
for(gg=0; gg<iv.size(); ++gg) for(gg=0; gg<iv.size(); ++gg)
{ {
@ -757,9 +752,6 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
} }
case 4: case 4:
{ {
if(((CHeroObjInfo*)themp->info)->myInstance->type==NULL)
continue;
std::vector<Cimage> & iv = ((CHeroObjInfo*)themp->info)->myInstance->type->heroClass->moveAnim->ourImages;
int gg; int gg;
for(gg=0; gg<iv.size(); ++gg) for(gg=0; gg<iv.size(); ++gg)
{ {
@ -777,9 +769,6 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
} }
case 5: case 5:
{ {
if(((CHeroObjInfo*)themp->info)->myInstance->type==NULL)
continue;
std::vector<Cimage> & iv = ((CHeroObjInfo*)themp->info)->myInstance->type->heroClass->moveAnim->ourImages;
int gg; int gg;
for(gg=0; gg<iv.size(); ++gg) for(gg=0; gg<iv.size(); ++gg)
{ {
@ -797,9 +786,6 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
} }
case 6: //ok case 6: //ok
{ {
if(((CHeroObjInfo*)themp->info)->myInstance->type==NULL)
continue;
std::vector<Cimage> & iv = ((CHeroObjInfo*)themp->info)->myInstance->type->heroClass->moveAnim->ourImages;
int gg; int gg;
for(gg=0; gg<iv.size(); ++gg) for(gg=0; gg<iv.size(); ++gg)
{ {
@ -817,9 +803,6 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
} }
case 7: case 7:
{ {
if(((CHeroObjInfo*)themp->info)->myInstance->type==NULL)
continue;
std::vector<Cimage> & iv = ((CHeroObjInfo*)themp->info)->myInstance->type->heroClass->moveAnim->ourImages;
int gg; int gg;
for(gg=0; gg<iv.size(); ++gg) for(gg=0; gg<iv.size(); ++gg)
{ {
@ -837,9 +820,6 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
} }
case 8: case 8:
{ {
if(((CHeroObjInfo*)themp->info)->myInstance->type==NULL)
continue;
std::vector<Cimage> & iv = ((CHeroObjInfo*)themp->info)->myInstance->type->heroClass->moveAnim->ourImages;
int gg; int gg;
for(gg=0; gg<iv.size(); ++gg) for(gg=0; gg<iv.size(); ++gg)
{ {
@ -861,13 +841,14 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
{ {
int imgVal = 8; int imgVal = 8;
SDL_Surface * tb; SDL_Surface * tb;
if(((CHeroObjInfo*)themp->info)->myInstance->type==NULL)
continue;
std::vector<Cimage> & iv = ((CHeroObjInfo*)themp->info)->myInstance->type->heroClass->moveAnim->ourImages;
switch(themp->moveDir) switch(themp->moveDir)
{ {
case 1: case 1:
{ {
if(((CHeroObjInfo*)themp->info)->myInstance->type==NULL)
continue;
std::vector<Cimage> & iv = ((CHeroObjInfo*)themp->info)->myInstance->type->heroClass->moveAnim->ourImages;
int gg; int gg;
for(gg=0; gg<iv.size(); ++gg) for(gg=0; gg<iv.size(); ++gg)
{ {
@ -890,9 +871,6 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
} }
case 2: case 2:
{ {
if(((CHeroObjInfo*)themp->info)->myInstance->type==NULL)
continue;
std::vector<Cimage> & iv = ((CHeroObjInfo*)themp->info)->myInstance->type->heroClass->moveAnim->ourImages;
int gg; int gg;
for(gg=0; gg<iv.size(); ++gg) for(gg=0; gg<iv.size(); ++gg)
{ {
@ -915,9 +893,6 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
} }
case 3: case 3:
{ {
if(((CHeroObjInfo*)themp->info)->myInstance->type==NULL)
continue;
std::vector<Cimage> & iv = ((CHeroObjInfo*)themp->info)->myInstance->type->heroClass->moveAnim->ourImages;
int gg; int gg;
for(gg=0; gg<iv.size(); ++gg) for(gg=0; gg<iv.size(); ++gg)
{ {
@ -940,9 +915,6 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
} }
case 4: case 4:
{ {
if(((CHeroObjInfo*)themp->info)->myInstance->type==NULL)
continue;
std::vector<Cimage> & iv = ((CHeroObjInfo*)themp->info)->myInstance->type->heroClass->moveAnim->ourImages;
int gg; int gg;
for(gg=0; gg<iv.size(); ++gg) for(gg=0; gg<iv.size(); ++gg)
{ {
@ -965,9 +937,6 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
} }
case 5: case 5:
{ {
if(((CHeroObjInfo*)themp->info)->myInstance->type==NULL)
continue;
std::vector<Cimage> & iv = ((CHeroObjInfo*)themp->info)->myInstance->type->heroClass->moveAnim->ourImages;
int gg; int gg;
for(gg=0; gg<iv.size(); ++gg) for(gg=0; gg<iv.size(); ++gg)
{ {
@ -990,9 +959,6 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
} }
case 6: case 6:
{ {
if(((CHeroObjInfo*)themp->info)->myInstance->type==NULL)
continue;
std::vector<Cimage> & iv = ((CHeroObjInfo*)themp->info)->myInstance->type->heroClass->moveAnim->ourImages;
int gg; int gg;
for(gg=0; gg<iv.size(); ++gg) for(gg=0; gg<iv.size(); ++gg)
{ {
@ -1015,9 +981,6 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
} }
case 7: case 7:
{ {
if(((CHeroObjInfo*)themp->info)->myInstance->type==NULL)
continue;
std::vector<Cimage> & iv = ((CHeroObjInfo*)themp->info)->myInstance->type->heroClass->moveAnim->ourImages;
int gg; int gg;
for(gg=0; gg<iv.size(); ++gg) for(gg=0; gg<iv.size(); ++gg)
{ {
@ -1040,9 +1003,6 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
} }
case 8: case 8:
{ {
if(((CHeroObjInfo*)themp->info)->myInstance->type==NULL)
continue;
std::vector<Cimage> & iv = ((CHeroObjInfo*)themp->info)->myInstance->type->heroClass->moveAnim->ourImages;
int gg; int gg;
for(gg=0; gg<iv.size(); ++gg) for(gg=0; gg<iv.size(); ++gg)
{ {