|
@@ -85,36 +85,10 @@ TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX, *GEORM;
|
|
|
|
|
|
void initGameState(CGameInfo * cgi)
|
|
|
{
|
|
|
- /******************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
|
|
|
{
|
|
|
- if (!cgi->heroh->heroInstances[i]->type || cgi->heroh->heroInstances[i]->owner<0)
|
|
|
+ if (!cgi->heroh->heroInstances[i]->type || cgi->heroh->heroInstances[i]->owner<0 || cgi->heroh->heroInstances[i]->owner==255)
|
|
|
continue;
|
|
|
CHeroInstance * vhi = new CHeroInstance();
|
|
|
*vhi=*(cgi->heroh->heroInstances[i]);
|
|
@@ -147,6 +121,31 @@ void initGameState(CGameInfo * cgi)
|
|
|
|
|
|
cgi->state->players[vhi->owner].heroes.push_back(vhi);
|
|
|
|
|
|
+ }
|
|
|
+ /******************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];
|
|
|
+
|
|
|
}
|
|
|
/*************************FOG**OF**WAR******************************************/
|
|
|
for(std::map<int, PlayerState>::iterator k=cgi->state->players.begin(); k!=cgi->state->players.end(); ++k)
|
|
@@ -288,6 +287,8 @@ int _tmain(int argc, _TCHAR* argv[])
|
|
|
cgi->playerColors.push_back(p);//pink
|
|
|
p.r = 0x84; p.g = 0x84; p.b = 0x84;//gray
|
|
|
cgi->neutralColor = p;//gray
|
|
|
+
|
|
|
+ cgi->playerColorInfo.push_back(cgi->spriteh->giveDef("agemLL.def")); //todo: finish
|
|
|
//colors initialized
|
|
|
|
|
|
cgi->townh = new CTownHandler;
|