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:
27
CMT.cpp
27
CMT.cpp
@ -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
|
||||
{
|
||||
|
Reference in New Issue
Block a user