mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
* significant speed-up in def loading
* bugfixes (player's id - player's serial mismatches)
This commit is contained in:
parent
26592feb02
commit
f1e40d5e86
@ -185,6 +185,17 @@ void CBattleInterface::bSurrenderf()
|
||||
|
||||
void CBattleInterface::bFleef()
|
||||
{
|
||||
for(int i=0; i<LOCPLINT->objsToBlit.size(); ++i)
|
||||
{
|
||||
if( dynamic_cast<CBattleInterface*>( LOCPLINT->objsToBlit[i] ) )
|
||||
{
|
||||
LOCPLINT->objsToBlit.erase(LOCPLINT->objsToBlit.begin()+i);
|
||||
}
|
||||
}
|
||||
deactivate();
|
||||
|
||||
LOCPLINT->adventureInt->activate();
|
||||
delete this;
|
||||
}
|
||||
|
||||
void CBattleInterface::bAutofightf()
|
||||
|
@ -435,9 +435,27 @@ int CCallback::swapCreatures(const CGObjectInstance *s1, const CGObjectInstance
|
||||
if(!S2->slots[p2].first)
|
||||
S2->slots.erase(p2);
|
||||
if(s1->tempOwner<PLAYER_LIMIT)
|
||||
CGI->playerint[s1->tempOwner]->garrisonChanged(s1);
|
||||
{
|
||||
for(int b=0; b<CGI->playerint.size(); ++b)
|
||||
{
|
||||
if(CGI->playerint[b]->playerID == s1->tempOwner)
|
||||
{
|
||||
CGI->playerint[b]->garrisonChanged(s1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if((s2->tempOwner<PLAYER_LIMIT) && (s2 != s1))
|
||||
CGI->playerint[s2->tempOwner]->garrisonChanged(s2);
|
||||
{
|
||||
for(int b=0; b<CGI->playerint.size(); ++b)
|
||||
{
|
||||
if(CGI->playerint[b]->playerID == s2->tempOwner)
|
||||
{
|
||||
CGI->playerint[b]->garrisonChanged(s2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -607,7 +625,14 @@ void CScriptCallback::heroVisitCastle(CGObjectInstance * ob, int heroID)
|
||||
if(n = dynamic_cast<CGTownInstance*>(ob))
|
||||
{
|
||||
n->visitingHero = CGI->state->getHero(heroID,0);
|
||||
CGI->playerint[getHeroOwner(heroID)]->heroVisitsTown(CGI->state->getHero(heroID,0),n);
|
||||
for(int b=0; b<CGI->playerint.size(); ++b)
|
||||
{
|
||||
if(CGI->playerint[b]->playerID == getHeroOwner(heroID))
|
||||
{
|
||||
CGI->playerint[b]->heroVisitsTown(CGI->state->getHero(heroID,0),n);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
@ -86,13 +86,23 @@ void CGameState::battle(CCreatureSet * army1, CCreatureSet * army2, int3 tile, C
|
||||
curB->activeStack = i;
|
||||
if(stacks[i]->alive) //niech interfejs ruszy oddzialem
|
||||
{
|
||||
if(CGI->playerint[(stacks[i]->owner)?(hero2->tempOwner):(hero1->tempOwner)]->human)
|
||||
unsigned char owner = (stacks[i]->owner)?(hero2->tempOwner):(hero1->tempOwner);
|
||||
unsigned char serialOwner = -1;
|
||||
for(int g=0; g<CGI->playerint.size(); ++g)
|
||||
{
|
||||
((CPlayerInterface*)CGI->playerint[(stacks[i]->owner)?(hero2->tempOwner):(hero1->tempOwner)])->activeStack(stacks[i]->ID);
|
||||
if(CGI->playerint[g]->playerID == owner)
|
||||
{
|
||||
serialOwner = g;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(CGI->playerint[serialOwner]->human)
|
||||
{
|
||||
((CPlayerInterface*)CGI->playerint[serialOwner])->activeStack(stacks[i]->ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
//CGI->playerint[(stacks[i]->owner)?(hero2->tempOwner):(hero1->tempOwner)]->activeStack(stacks[i]->ID);
|
||||
//CGI->playerint[serialOwner]->activeStack(stacks[i]->ID);
|
||||
}
|
||||
}
|
||||
//sprawdzic czy po tej akcji ktoras strona nie wygrala bitwy
|
||||
|
@ -16,13 +16,13 @@ enum EDefType {TOWN_DEF, HERO_DEF, CREATURES_DEF, SEERHUT_DEF, RESOURCE_DEF, TER
|
||||
class CAmbarCendamo
|
||||
{
|
||||
public:
|
||||
/////////////////zmienne skladowe
|
||||
/////////////////member variables
|
||||
Mapa map;
|
||||
std::ifstream * is; // stream used to read map file
|
||||
int andame; // length of map file
|
||||
unsigned char * bufor; // here we store map bytecode
|
||||
std::vector<CDefHandler*> defs;
|
||||
/////////////////funkcje skladowe
|
||||
/////////////////member functions
|
||||
CAmbarCendamo (const char * tie); // c-tor; tie is the path of the map file
|
||||
CAmbarCendamo (unsigned char * map); // c-tor; map is pointer to array containing map; it is not copied, so don't delete
|
||||
~CAmbarCendamo (); // d-tor
|
||||
|
@ -777,9 +777,7 @@ int CCreatureAnimation::nextFrame(SDL_Surface *dest, int x, int y)
|
||||
i, add, FullHeight,FullWidth,
|
||||
TotalRowLength, // dlugosc przeczytanego segmentu
|
||||
NextSpriteOffset, RowAdd;
|
||||
std::ifstream Fdef;
|
||||
unsigned char SegmentType, SegmentLength, BL, BR;
|
||||
unsigned char * TempDef; //memory
|
||||
|
||||
std::string FTemp;
|
||||
|
||||
@ -795,20 +793,7 @@ int CCreatureAnimation::nextFrame(SDL_Surface *dest, int x, int y)
|
||||
RightMargin = FullWidth - SpriteWidth - LeftMargin;
|
||||
BottomMargin = FullHeight - SpriteHeight - TopMargin;
|
||||
|
||||
BMPHeader tb;
|
||||
tb.x = FullWidth;
|
||||
tb.y = FullHeight;
|
||||
tb.dataSize2 = tb.dataSize1 = tb.x*tb.y;
|
||||
tb.fullSize = tb.dataSize1+436;
|
||||
tb._h3=tb.fullSize-36;
|
||||
|
||||
//add = (int)(4*(((float)1) - ((int)(((int)((float)FullWidth/(float)4))-((float)FullWidth/(float)4)))));
|
||||
add = 4 - FullWidth%4;
|
||||
/*if (add==4)
|
||||
add=0;*/ //moved to defcompression dependent block
|
||||
|
||||
//ret = SDL_CreateRGBSurface(SDL_SWSURFACE, FullWidth, FullHeight, 8, 0, 0, 0, 0);
|
||||
//int tempee2 = readNormalNr(0,4,((unsigned char *)tempee.c_str()));
|
||||
|
||||
int BaseOffsetor = BaseOffset = i;
|
||||
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user