1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

* resource bar

* function in CCallback for getting onfo about res
* giving resources at the beginning of game
* moved several txt files to /config subfolder
* minor changes
This commit is contained in:
Michał W. Urbańczyk
2007-09-16 17:21:23 +00:00
parent 3ce6c4bf70
commit 7d4aa0c803
17 changed files with 119 additions and 8 deletions

27
CMT.cpp
View File

@ -85,7 +85,32 @@ TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX, *GEORM;
void initGameState(CGameInfo * cgi)
{
cgi->state->currentPlayer = 0;
/******************RESOURCES****************************************************/
//TODO: zeby komputer dostawal inaczej niz gracz
std::vector<int> startres;
std::ifstream tis("config/startres.txt");
int k;
for (int j=0;j<cgi->scenarioOps.difficulty;j++)
{
tis >> k;
for (int z=0;z<RESOURCE_QUANTITY;z++)
tis>>k;
}
tis >> k;
for (int i=0;i<RESOURCE_QUANTITY;i++)
{
tis >> k;
startres.push_back(k);
}
tis.close();
for (std::map<int,PlayerState>::iterator i = cgi->state->players.begin(); i!=cgi->state->players.end(); i++)
{
(*i).second.resources.resize(RESOURCE_QUANTITY);
for (int x=0;x<RESOURCE_QUANTITY;x++)
(*i).second.resources[x] = startres[x];
}
/*************************HEROES************************************************/
for (int i=0; i<cgi->heroh->heroInstances.size();i++) //heroes instances
{