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);
|
const TerrainTile * tile = LOCPLINT->cb->getTileInfo(mp);
|
||||||
if (tile)
|
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);
|
CRClickPopupInt *rcpi = new CRClickPopupInt(temp,true);
|
||||||
GH.pushInt(rcpi);
|
GH.pushInt(rcpi);
|
||||||
}
|
}
|
||||||
|
@ -501,7 +501,7 @@ static void listenForEvents()
|
|||||||
delete ev;
|
delete ev;
|
||||||
continue;
|
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();
|
client->stop();
|
||||||
delete ev;
|
delete ev;
|
||||||
|
@ -666,13 +666,25 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
|
|||||||
{
|
{
|
||||||
if(!down && mySpell!=-1)
|
if(!down && mySpell!=-1)
|
||||||
{
|
{
|
||||||
|
int spellCost = LOCPLINT->cb->getSpellCost(&CGI->spellh->spells[mySpell], owner->myHero);
|
||||||
//we will cast a spell
|
//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;
|
int spell = mySpell;
|
||||||
owner->fexitb();
|
owner->fexitb();
|
||||||
LOCPLINT->battleInt->castThisSpell(spell);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ public:
|
|||||||
std::vector<CGTownBuilding*> bonusingBuildings;
|
std::vector<CGTownBuilding*> bonusingBuildings;
|
||||||
std::vector<ui32> possibleSpells, obligatorySpells;
|
std::vector<ui32> possibleSpells, obligatorySpells;
|
||||||
std::vector<std::vector<ui32> > spells; //spells[level] -> vector of spells, first will be available in guild
|
std::vector<std::vector<ui32> > spells; //spells[level] -> vector of spells, first will be available in guild
|
||||||
std::set<CCastleEvent> events;
|
std::set<CCastleEvent> events;
|
||||||
std::pair<si32, si32> bonusValue;//var to store town bonuses (rampart = resources from mystic pond);
|
std::pair<si32, si32> bonusValue;//var to store town bonuses (rampart = resources from mystic pond);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -222,8 +222,8 @@ void CMapHeader::initFromMemory( const unsigned char *bufor, int &i )
|
|||||||
{
|
{
|
||||||
version = (Eformat)(readNormalNr(bufor,i)); i+=4; //map version
|
version = (Eformat)(readNormalNr(bufor,i)); i+=4; //map version
|
||||||
areAnyPLayers = readChar(bufor,i); //invalid on some maps
|
areAnyPLayers = readChar(bufor,i); //invalid on some maps
|
||||||
height = width = (readNormalNr(bufor,i)); i+=4; // wymiary mapy
|
height = width = (readNormalNr(bufor,i)); i+=4; // dimensions of map
|
||||||
twoLevel = readChar(bufor,i); //czy sa lochy
|
twoLevel = readChar(bufor,i); //if there is underground
|
||||||
int pom;
|
int pom;
|
||||||
name = readString(bufor,i);
|
name = readString(bufor,i);
|
||||||
description= 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].canHumanPlay = bufor[i++];
|
||||||
players[pom].canComputerPlay = 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)
|
switch(version)
|
||||||
{
|
{
|
||||||
@ -295,6 +295,7 @@ void CMapHeader::loadPlayerInfo( int &pom, const unsigned char * bufor, int &i )
|
|||||||
else
|
else
|
||||||
players[pom].p7= -1;
|
players[pom].p7= -1;
|
||||||
|
|
||||||
|
//factions this player can choose
|
||||||
players[pom].allowedFactions = 0;
|
players[pom].allowedFactions = 0;
|
||||||
players[pom].allowedFactions += bufor[i++];
|
players[pom].allowedFactions += bufor[i++];
|
||||||
if(version != RoE)
|
if(version != RoE)
|
||||||
|
@ -1341,7 +1341,13 @@ CMapHandler::~CMapHandler()
|
|||||||
for(int i=0; i < staticRiverDefs.size(); i++)
|
for(int i=0; i < staticRiverDefs.size(); i++)
|
||||||
delete staticRiverDefs[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()
|
CMapHandler::CMapHandler()
|
||||||
|
@ -106,7 +106,6 @@ public:
|
|||||||
std::vector<std::vector<SDL_Surface *> > terrainGraphics; // [terrain id] [view type] [rotation type]
|
std::vector<std::vector<SDL_Surface *> > terrainGraphics; // [terrain id] [view type] [rotation type]
|
||||||
std::vector<CDefEssential *> roadDefs;
|
std::vector<CDefEssential *> roadDefs;
|
||||||
std::vector<CDefEssential *> staticRiverDefs;
|
std::vector<CDefEssential *> staticRiverDefs;
|
||||||
std::vector<CDefEssential*> defs;
|
|
||||||
|
|
||||||
std::map<std::string, CDefEssential*> loadedDefs; //pointers to loaded defs (key is filename, uppercase)
|
std::map<std::string, CDefEssential*> loadedDefs; //pointers to loaded defs (key is filename, uppercase)
|
||||||
|
|
||||||
|
@ -750,6 +750,7 @@ CGameHandler::~CGameHandler(void)
|
|||||||
applier = NULL;
|
applier = NULL;
|
||||||
delete gs;
|
delete gs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameHandler::init(StartInfo *si, int Seed)
|
void CGameHandler::init(StartInfo *si, int Seed)
|
||||||
{
|
{
|
||||||
Mapa *map = new Mapa(si->mapname);
|
Mapa *map = new Mapa(si->mapname);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user