mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
* enter can be used to open window with selected hero/town
* fixed slider behavior when showing less maps/games than available slots * added a few missing sounds for creatures * fixed problems with artifacts info caused by bug in serialization * fixed bug in Scholar's serializetion * all stacks features will be serialized (should fix problems with missing premies from artifacts) * proper serialization of HeroBonus, fixes some problems/crashes * resource silos won't give resources on the first day * fixed problems with removing artifacts when all visiblebackpack slots are full
This commit is contained in:
parent
5b25b21a15
commit
cff70406f1
@ -1534,6 +1534,16 @@ void CAdvMapInt::keyPressed(const SDL_KeyboardEvent & key)
|
||||
}
|
||||
}
|
||||
return;
|
||||
case SDLK_RETURN:
|
||||
{
|
||||
if(!active || !selection || key.state != SDL_PRESSED)
|
||||
return;
|
||||
if(selection->ID == 34)
|
||||
LOCPLINT->openHeroWindow(static_cast<const CGHeroInstance*>(selection));
|
||||
else if(selection->ID == 98)
|
||||
LOCPLINT->openTownWindow(static_cast<const CGTownInstance*>(selection));
|
||||
return;
|
||||
}
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@ -127,6 +127,10 @@ void CBuildingRect::hover(bool on)
|
||||
{
|
||||
LOCPLINT->castleInt->hBuild = NULL;
|
||||
LOCPLINT->statusbar->clear();
|
||||
|
||||
//call mouseMoved in other buildings, cursor might have been moved while they were inactive (eg. because of r-click popup)
|
||||
for(size_t i = 0; i < LOCPLINT->castleInt->buildings.size(); i++)
|
||||
LOCPLINT->castleInt->buildings[i]->mouseMoved(LOCPLINT->current->motion);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -166,7 +170,7 @@ void CBuildingRect::clickRight (tribool down)
|
||||
}
|
||||
void CBuildingRect::mouseMoved (const SDL_MouseMotionEvent & sEvent)
|
||||
{
|
||||
if(area)
|
||||
if(area && isItIn(&pos,sEvent.x, sEvent.y))
|
||||
{
|
||||
if(CSDL_Ext::SDL_GetPixel(area,sEvent.x-pos.x,sEvent.y-pos.y) == 0) //hovered pixel is inside this building
|
||||
{
|
||||
|
@ -710,7 +710,7 @@ void CArtPlace::clickLeft(boost::logic::tribool down)
|
||||
{
|
||||
if(ourArt && ourArt->id == 0)
|
||||
return; //this is handled separately
|
||||
if(!ourWindow->activeArtPlace) //nothing has benn clicked
|
||||
if(!ourWindow->activeArtPlace) //nothing has bewn clicked
|
||||
{
|
||||
if(ourArt) //to prevent selecting empty slots (bugfix to what GrayFace reported)
|
||||
{
|
||||
@ -720,47 +720,22 @@ void CArtPlace::clickLeft(boost::logic::tribool down)
|
||||
}
|
||||
else //perform artifact substitution
|
||||
{
|
||||
//chceck if swap is possible
|
||||
if(this->fitsHere(ourWindow->activeArtPlace->ourArt) && ourWindow->activeArtPlace->fitsHere(this->ourArt))
|
||||
if(slotID >= 19) //we are an backpack slot - remove active artifact and put it to the last free pos in backpack
|
||||
{ //TODO: putting artifacts in the middle of backpack (pushing following arts)
|
||||
|
||||
LOCPLINT->cb->swapArtifacts(ourWindow->curHero,ourWindow->activeArtPlace->slotID,ourWindow->curHero,ourWindow->curHero->artifacts.size()+19);
|
||||
}
|
||||
//check if swap is possible
|
||||
else if(this->fitsHere(ourWindow->activeArtPlace->ourArt) && ourWindow->activeArtPlace->fitsHere(this->ourArt))
|
||||
{
|
||||
int destSlot = slotID,
|
||||
srcSlot = ourWindow->activeArtPlace->slotID;
|
||||
|
||||
LOCPLINT->cb->swapArtifacts(ourWindow->curHero,destSlot,ourWindow->curHero,srcSlot);
|
||||
|
||||
//const CArtifact * pmh = ourArt;
|
||||
//ourArt = ourWindow->activeArtPlace->ourArt;
|
||||
//ourWindow->activeArtPlace->ourArt = pmh;
|
||||
|
||||
////set texts
|
||||
//if(pmh)
|
||||
// ourWindow->activeArtPlace->text = pmh->Description();
|
||||
//else
|
||||
// ourWindow->activeArtPlace->text = std::string();
|
||||
//if(ourArt)
|
||||
// text = ourArt->Description();
|
||||
//else
|
||||
// text = std::string();
|
||||
|
||||
ourWindow->activeArtPlace->clicked = false;
|
||||
ourWindow->activeArtPlace = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
int backID = -1;
|
||||
for(size_t g=0; g<ourWindow->backpack.size(); ++g)
|
||||
{
|
||||
if(ourWindow->backpack[g]==this) //if user wants to put something to backpack
|
||||
{
|
||||
backID = g;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(backID>=0) //put to backpack
|
||||
{
|
||||
LOCPLINT->cb->swapArtifacts(ourWindow->curHero,ourWindow->activeArtPlace->slotID,ourWindow->curHero,ourWindow->curHero->artifacts.size()+19);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(!down && clicked)
|
||||
|
@ -189,7 +189,11 @@ void Button::select(bool on)
|
||||
|
||||
void Slider::updateSlid()
|
||||
{
|
||||
float perc = ((float)whereAreWe)/((float)positionsAmnt-capacity);
|
||||
float perc = -1.0f;
|
||||
if(positionsAmnt > capacity)
|
||||
perc = ((float)whereAreWe)/((float)positionsAmnt-capacity);
|
||||
else
|
||||
perc = 0;
|
||||
float myh;
|
||||
if (vertical)
|
||||
{
|
||||
@ -1570,7 +1574,7 @@ void CPreGame::printMapsFrom(int from)
|
||||
}
|
||||
void CPreGame::showScenList()
|
||||
{
|
||||
if (currentTab!=&ourScenSel->mapsel)
|
||||
if (currentTab != &ourScenSel->mapsel)
|
||||
{
|
||||
ourScenSel->listShowed=true;
|
||||
ourScenSel->mapsel.show();
|
||||
|
@ -100,6 +100,7 @@ Nosferatu NOSFATTK.wav NOSFDFND.wav NOSFKILL.wav NOSFMOVE.wav NOSFSHOT.wav NOSFW
|
||||
ObsidianGargoyle OGRGATTK.wav OGRGDFND.wav OGRGKILL.wav OGRGMOVE.wav invalid OGRGWNCE.wav
|
||||
Ogre OGREATTK.wav OGREDFND.wav OGREKILL.wav OGREMOVE.wav invalid OGREWNCE.wav
|
||||
OgreMage OGRMATTK.wav OGRMDFND.wav OGRMKILL.wav OGRMMOVE.wav OGRMSHOT.wav OGRMWNCE.wav
|
||||
OgreShaman TRLLATTK.wav TRLLDFND.wav TRLLKILL.wav TRLLMOVE.wav invalid TRLLWNCE.wav
|
||||
Orc OORCATTK.wav OORCDFND.wav OORCKILL.wav OORCMOVE.wav OORCSHOT.wav OORCWNCE.wav
|
||||
OrcChieftain ORCCATTK.wav ORCCDFND.wav ORCCKILL.wav ORCCMOVE.wav ORCCSHOT.wav ORCCWNCE.wav
|
||||
Peasant PSNTATTK.wav PSNTDFND.wav PSNTKILL.wav PSNTMOVE.wav invalid PSNTWNCE.wav
|
||||
@ -123,6 +124,7 @@ Single-HornedDemon SHDMATTK.wav SHDMDFND.wav SHDMKILL.wav SHDMMOVE.wav invalid S
|
||||
Skeleton SKELATTK.wav SKELDFND.wav SKELKILL.wav SKELMOVE.wav invalid SKELWNCE.wav
|
||||
SkeletonWarrior SKLWATTK.wav SKLWDFND.wav SKLWKILL.wav SKLWMOVE.wav invalid SKLWWNCE.wav
|
||||
Sprite SPRTATTK.wav SPRTDFND.wav SPRTKILL.wav SPRTMOVE.wav invalid SPRTWNCE.wav
|
||||
StoneElemental MAGMATTK.wav MAGMDFND.wav MAGMKILL.wav MAGMMOVE.wav invalid MAGMWNCE.wav
|
||||
StoneGargoyle SGRGATTK.wav SGRGDFND.wav SGRGKILL.wav SGRGMOVE.wav invalid SGRGWNCE.wav
|
||||
StoneGolem SGLMATTK.wav SGLMDFND.wav SGLMKILL.wav SGLMMOVE.wav invalid SGLMWNCE.wav
|
||||
StormElemental STORATTK.wav STORDFND.wav STORKILL.wav STORMOVE.wav STORSHOT.wav STORWNCE.wav
|
||||
@ -132,6 +134,7 @@ Treefolk TREEATTK.wav TREEDFND.wav TREEKILL.wav TREEMOVE.wav invalid TREEWNCE.wa
|
||||
Troglodyte TROGATTK.wav TROGDFND.wav TROGKILL.wav TROGMOVE.wav invalid TROGWNCE.wav
|
||||
Unicorn UNICATTK.wav UNICDFND.wav UNICKILL.wav UNICMOVE.wav invalid UNICWNCE.wav
|
||||
Vampire VAMPATTK.wav VAMPDFND.wav VAMPKILL.wav VAMPMOVE.wav invalid VAMPWNCE.wav VAMPEXT1.wav VAMPEXT2.wav
|
||||
warrior NMADATTK.wav NMADDFND.wav NMADKILL.wav NMADMOVE.wav invalid NMADWNCE.wav
|
||||
WarUnicorn WUNCATTK.wav WUNCDFND.wav WUNCKILL.wav WUNCMOVE.wav WUNCSHOT.wav WUNCWNCE.wav
|
||||
WaterElemental WELMATTK.wav WELMDFND.wav WELMKILL.wav WELMMOVE.wav invalid WELMWNCE.wav
|
||||
Wight WGHTATTK.wav WGHTDFND.wav WGHTKILL.wav WGHTMOVE.wav invalid WGHTWNCE.wav
|
||||
@ -144,23 +147,9 @@ Zealot ZELTATTK.wav ZELTDFND.wav ZELTKILL.wav ZELTMOVE.wav ZELTSHOT.wav ZELTWNCE
|
||||
Zombie ZOMBATTK.wav ZOMBDFND.wav ZOMBKILL.wav ZOMBMOVE.wav invalid ZOMBWNCE.wav
|
||||
ZombieLord ZMBLATTK.wav ZMBLDFND.wav ZMBLKILL.wav ZMBLMOVE.wav invalid ZMBLWNCE.wav
|
||||
|
||||
# todo - troll ?
|
||||
# TRLLATTK.wav TRLLDFND.wav TRLLKILL.wav TRLLMOVE.wav invalid TRLLWNCE.wav
|
||||
|
||||
# todo - nomad ?
|
||||
# NMADATTK.wav NMADDFND.wav NMADKILL.wav NMADMOVE.wav invalid NMADWNCE.wav
|
||||
|
||||
# todo - magma ?
|
||||
# MAGMATTK.wav MAGMDFND.wav MAGMKILL.wav MAGMMOVE.wav invalid MAGMWNCE.wav
|
||||
|
||||
|
||||
# Missing entries
|
||||
# 125 StoneElemental
|
||||
# 128 FireElemental
|
||||
# 129 FireElemental
|
||||
# 137 Sharpshooter
|
||||
# 142 warrior
|
||||
# 144 OgreShaman
|
||||
# 149 ArrowTower
|
||||
# 150 SupremeArchangel
|
||||
# 151 DiamondDragon
|
||||
|
@ -131,10 +131,8 @@
|
||||
123 IceElemental
|
||||
124 NOTUSED
|
||||
125 StoneElemental
|
||||
126 ElectricityElemental
|
||||
127 StormElemental
|
||||
128 FireElemental
|
||||
129 FireElemental
|
||||
129 ElectricityElemental
|
||||
130 Firebird
|
||||
131 Pheonix
|
||||
132 AzureDragon
|
||||
|
@ -78,7 +78,8 @@ void CArtHandler::loadArtifacts(bool onlyTxt)
|
||||
artifacts.push_back(nart);
|
||||
}
|
||||
sortArts();
|
||||
addBonuses();
|
||||
if(!onlyTxt)
|
||||
addBonuses();
|
||||
}
|
||||
|
||||
int CArtHandler::convertMachineID(int id, bool creToArt )
|
||||
@ -319,3 +320,12 @@ void CArtHandler::addBonuses()
|
||||
giveArtBonus(125,HeroBonus::ENEMY_CANT_ESCAPE,0); //Shackles of War
|
||||
giveArtBonus(126,HeroBonus::BLOCK_SPELLS_ABOVE_LEVEL,0);//Orb of Inhibition
|
||||
}
|
||||
|
||||
void CArtHandler::clear()
|
||||
{
|
||||
artifacts.clear();
|
||||
treasures.clear();
|
||||
minors.clear();
|
||||
majors.clear();
|
||||
relics.clear();
|
||||
}
|
@ -47,6 +47,7 @@ public:
|
||||
void loadArtifacts(bool onlyTxt);
|
||||
void sortArts();
|
||||
void addBonuses();
|
||||
void clear();
|
||||
static int convertMachineID(int id, bool creToArt);
|
||||
CArtHandler();
|
||||
|
||||
|
@ -168,7 +168,17 @@ void CSoundHandler::initCreaturesSounds(std::vector<CCreature> &creatures)
|
||||
|
||||
if (str.good() || (str.eof() && wince != ""))
|
||||
{
|
||||
int id = CGI->creh->nameToID[cname];
|
||||
int id = -1;
|
||||
|
||||
std::map<std::string,int>::iterator i = CGI->creh->nameToID.find(cname);
|
||||
if(i != CGI->creh->nameToID.end())
|
||||
id = i->second;
|
||||
else
|
||||
{
|
||||
tlog1 << "Sound info for an unknown creature: " << cname << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
CCreature &c = creatures[id];
|
||||
|
||||
if (c.sounds.killed != soundBase::invalid)
|
||||
|
@ -504,7 +504,7 @@ public:
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & static_cast<CGObjectInstance&>(*this);
|
||||
h & bonusType & id;
|
||||
h & bonusType & bonusID;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -154,9 +154,6 @@ public:
|
||||
ui16 position; //position on battlefield
|
||||
ui8 counterAttacks; //how many counter attacks can be performed more in this turn (by default set at the beginning of the round to 1)
|
||||
si16 shots; //how many shots left
|
||||
//ui8 speed; //speed of stack with hero bonus
|
||||
//si32 attack; //attack of stack with hero bonus
|
||||
//si32 defense; //defense of stack with hero bonus
|
||||
si8 morale, luck; //base stack luck/morale
|
||||
|
||||
std::vector<StackFeature> features;
|
||||
@ -195,12 +192,12 @@ public:
|
||||
ui32 id;
|
||||
h & id;
|
||||
creature = &VLC->creh->creatures[id];
|
||||
features = creature->abilities;
|
||||
//features = creature->abilities;
|
||||
}
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & ID & amount & baseAmount & firstHPleft & owner & slot & attackerOwned & position & state & counterAttacks
|
||||
& shots & morale & luck;
|
||||
& shots & morale & luck & features;
|
||||
if(h.saving)
|
||||
save(h,version);
|
||||
else
|
||||
|
@ -66,7 +66,7 @@ struct DLL_EXPORT HeroBonus
|
||||
}
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & duration & type & source & val & id & description;
|
||||
h & duration & type & subtype & source & val & id & description;
|
||||
}
|
||||
|
||||
static bool OneDay(const HeroBonus &hb)
|
||||
|
@ -76,9 +76,9 @@ struct StackFeature
|
||||
SPELL_EFFECT
|
||||
};
|
||||
|
||||
ECombatFeatures type;
|
||||
EDuration duration;
|
||||
ESource source;
|
||||
ui8 type;//ECombatFeatures
|
||||
ui8 duration;//EDuration
|
||||
ui8 source;//ESource
|
||||
ui16 turnsRemain; //if duration is N_TURNS it describes how long the effect will last
|
||||
si16 subtype; //subtype of bonus/feature
|
||||
si32 value;
|
||||
|
@ -690,7 +690,7 @@ void CGameHandler::newTurn()
|
||||
}
|
||||
for(std::vector<CGTownInstance *>::iterator j=i->second.towns.begin();j!=i->second.towns.end();j++)//handle towns
|
||||
{
|
||||
if(vstd::contains((**j).builtBuildings,15)) //there is resource silo
|
||||
if(gs->day && vstd::contains((**j).builtBuildings,15)) //not first day and there is resource silo
|
||||
{
|
||||
if((**j).town->primaryRes == 127) //we'll give wood and ore
|
||||
{
|
||||
@ -718,7 +718,7 @@ void CGameHandler::newTurn()
|
||||
}
|
||||
n.cres.push_back(sac);
|
||||
}
|
||||
if((gs->day) && i->first<PLAYER_LIMIT)//not the first day and town not neutral
|
||||
if(gs->day && i->first<PLAYER_LIMIT)//not the first day and town not neutral
|
||||
r.res[6] += (**j).dailyIncome();
|
||||
}
|
||||
n.res.push_back(r);
|
||||
|
Loading…
Reference in New Issue
Block a user