mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
Handling custom properties of resources (except of guards).
This commit is contained in:
parent
644a494589
commit
f518ffdfac
@ -95,7 +95,7 @@ public:
|
||||
|
||||
//do sth
|
||||
static void changePrimSkill(int ID, int which, int val);
|
||||
void showInfoDialog(int player, std::string text, std::vector<SComponent*> * components);
|
||||
void showInfoDialog(int player, std::string text, std::vector<SComponent*> * components); //TODO: obslugiwac nulle
|
||||
void showSelDialog(int player, std::string text, std::vector<CSelectableComponent*>*components, IChosen * asker);
|
||||
void giveResource(int player, int which, int val);
|
||||
void showCompInfo(int player, SComponent * comp);
|
||||
|
29
CLua.cpp
29
CLua.cpp
@ -478,19 +478,28 @@ void CPickable::onHeroVisit(CGObjectInstance *os, int heroID)
|
||||
{
|
||||
case 79:
|
||||
{
|
||||
//TODO: handle guards (when battles are finished)
|
||||
CResourceObjInfo * t2 = static_cast<CResourceObjInfo *>(os->info);
|
||||
int val;
|
||||
switch(os->subID)
|
||||
if(t2->amount)
|
||||
val = t2->amount;
|
||||
else
|
||||
{
|
||||
case 6:
|
||||
val = 500 + (rand()%6)*100;
|
||||
break;
|
||||
case 0: case 2:
|
||||
val = 6 + (rand()%5);
|
||||
break;
|
||||
default:
|
||||
val = 3 + (rand()%3);
|
||||
break;
|
||||
switch(os->subID)
|
||||
{
|
||||
case 6:
|
||||
val = 500 + (rand()%6)*100;
|
||||
break;
|
||||
case 0: case 2:
|
||||
val = 6 + (rand()%5);
|
||||
break;
|
||||
default:
|
||||
val = 3 + (rand()%3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(t2->message.length())
|
||||
cb->showInfoDialog(cb->getHeroOwner(heroID),t2->message,&std::vector<SComponent*>());
|
||||
SComponent ccc(SComponent::resource,os->subID,val);
|
||||
ccc.description = CGI->objh->advobtxt[113];
|
||||
boost::algorithm::replace_first(ccc.description,"%s",CGI->objh->restypes[os->subID]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user