mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
parent
b0a587ff08
commit
23a32ebf7a
@ -569,7 +569,7 @@ void CTerrainRect::clickRight(tribool down, bool previousState)
|
||||
const TerrainTile * tile = LOCPLINT->cb->getTileInfo(mp);
|
||||
if (tile)
|
||||
{
|
||||
CSimpleWindow * temp = CMessage::genWindow(VLC->generaltexth->terrainNames[tile->tertype],LOCPLINT->playerID,true);
|
||||
CSimpleWindow * temp = CMessage::genWindow(VLC->generaltexth->terrainNames[tile->tertype], LOCPLINT->playerID, true);
|
||||
CRClickPopupInt *rcpi = new CRClickPopupInt(temp,true);
|
||||
GH.pushInt(rcpi);
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ static void listenForEvents()
|
||||
delete ev;
|
||||
continue;
|
||||
}
|
||||
else if (ev->type == SDL_USEREVENT && ev->user.code == 2)
|
||||
else if (ev->type == SDL_USEREVENT && ev->user.code == 2) //something want to quit to main menu
|
||||
{
|
||||
client->stop();
|
||||
delete ev;
|
||||
|
@ -666,13 +666,25 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if(!down && mySpell!=-1)
|
||||
{
|
||||
int spellCost = LOCPLINT->cb->getSpellCost(&CGI->spellh->spells[mySpell], owner->myHero);
|
||||
//we will cast a spell
|
||||
if(LOCPLINT->battleInt && LOCPLINT->cb->battleCanCastSpell() && LOCPLINT->cb->getSpellCost(&CGI->spellh->spells[mySpell], owner->myHero) <= owner->myHero->mana) //if battle window is open
|
||||
if(LOCPLINT->battleInt && LOCPLINT->cb->battleCanCastSpell() && spellCost <= owner->myHero->mana) //if battle window is open
|
||||
{
|
||||
int spell = mySpell;
|
||||
owner->fexitb();
|
||||
LOCPLINT->battleInt->castThisSpell(spell);
|
||||
}
|
||||
else
|
||||
{
|
||||
//insufficient mana
|
||||
if(spellCost > owner->myHero->mana)
|
||||
{
|
||||
std::vector<SComponent*> comps;
|
||||
char msgBuf[500];
|
||||
sprintf(msgBuf, CGI->generaltexth->allTexts[206].c_str(), spellCost, owner->myHero->mana);
|
||||
LOCPLINT->showInfoDialog(std::string(msgBuf), comps);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,8 +222,8 @@ void CMapHeader::initFromMemory( const unsigned char *bufor, int &i )
|
||||
{
|
||||
version = (Eformat)(readNormalNr(bufor,i)); i+=4; //map version
|
||||
areAnyPLayers = readChar(bufor,i); //invalid on some maps
|
||||
height = width = (readNormalNr(bufor,i)); i+=4; // wymiary mapy
|
||||
twoLevel = readChar(bufor,i); //czy sa lochy
|
||||
height = width = (readNormalNr(bufor,i)); i+=4; // dimensions of map
|
||||
twoLevel = readChar(bufor,i); //if there is underground
|
||||
int pom;
|
||||
name = readString(bufor,i);
|
||||
description= readString(bufor,i);
|
||||
@ -271,7 +271,7 @@ void CMapHeader::loadPlayerInfo( int &pom, const unsigned char * bufor, int &i )
|
||||
{
|
||||
players[pom].canHumanPlay = bufor[i++];
|
||||
players[pom].canComputerPlay = bufor[i++];
|
||||
if ((!(players[pom].canHumanPlay || players[pom].canComputerPlay)))
|
||||
if ((!(players[pom].canHumanPlay || players[pom].canComputerPlay))) //if nobody can play with this player
|
||||
{
|
||||
switch(version)
|
||||
{
|
||||
@ -295,6 +295,7 @@ void CMapHeader::loadPlayerInfo( int &pom, const unsigned char * bufor, int &i )
|
||||
else
|
||||
players[pom].p7= -1;
|
||||
|
||||
//factions this player can choose
|
||||
players[pom].allowedFactions = 0;
|
||||
players[pom].allowedFactions += bufor[i++];
|
||||
if(version != RoE)
|
||||
|
@ -1341,7 +1341,13 @@ CMapHandler::~CMapHandler()
|
||||
for(int i=0; i < staticRiverDefs.size(); i++)
|
||||
delete staticRiverDefs[i];
|
||||
|
||||
//TODO: delete border graphics
|
||||
//TODO: why this code makes VCMI crash?
|
||||
/*for(int i=0; i < terrainGraphics.size(); ++i)
|
||||
{
|
||||
for(int j=0; j < terrainGraphics[i].size(); ++j)
|
||||
SDL_FreeSurface(terrainGraphics[i][j]);
|
||||
}
|
||||
terrainGraphics.clear();*/
|
||||
}
|
||||
|
||||
CMapHandler::CMapHandler()
|
||||
|
@ -106,7 +106,6 @@ public:
|
||||
std::vector<std::vector<SDL_Surface *> > terrainGraphics; // [terrain id] [view type] [rotation type]
|
||||
std::vector<CDefEssential *> roadDefs;
|
||||
std::vector<CDefEssential *> staticRiverDefs;
|
||||
std::vector<CDefEssential*> defs;
|
||||
|
||||
std::map<std::string, CDefEssential*> loadedDefs; //pointers to loaded defs (key is filename, uppercase)
|
||||
|
||||
|
@ -750,6 +750,7 @@ CGameHandler::~CGameHandler(void)
|
||||
applier = NULL;
|
||||
delete gs;
|
||||
}
|
||||
|
||||
void CGameHandler::init(StartInfo *si, int Seed)
|
||||
{
|
||||
Mapa *map = new Mapa(si->mapname);
|
||||
|
Loading…
x
Reference in New Issue
Block a user