1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

poprawki z przesuwaniem oraz wczytywanie drużyn

This commit is contained in:
mateuszb 2007-06-07 17:45:56 +00:00
parent b531cf169a
commit ea099358f5
3 changed files with 41 additions and 8 deletions

View File

@ -247,9 +247,18 @@ void CAmbarCendamo::deh3m()
case timeExpires: case timeExpires:
{ {
map.lossCondition.timeLimit = readNormalNr(i++,2); map.lossCondition.timeLimit = readNormalNr(i++,2);
i++;
} }
} }
i+=88; map.howManyTeams=bufor[i++]; //read number of teams
if(map.howManyTeams>0) //read team numbers
{
for(int rr=0; rr<8; ++rr)
{
map.players[rr].team=bufor[i++];
}
}
i+=87;
THC std::cout<<"Wczytywanie naglowka: "<<th.getDif()<<std::endl; THC std::cout<<"Wczytywanie naglowka: "<<th.getDif()<<std::endl;
int rumNr = readNormalNr(i,4);i+=4; int rumNr = readNormalNr(i,4);i+=4;
for (int it=0;it<rumNr;it++) for (int it=0;it<rumNr;it++)

18
CMT.cpp
View File

@ -221,7 +221,7 @@ int _tmain(int argc, _TCHAR* argv[])
// fclose(ko);fclose(zr); // fclose(ko);fclose(zr);
//} //}
THC timeHandler tmh; THC timeHandler tmh;
CAmbarCendamo * ac = new CAmbarCendamo("3gryf"); CAmbarCendamo * ac = new CAmbarCendamo("4gryf");
THC std::cout<<"Wczytywanie pliku: "<<tmh.getDif()<<std::endl; THC std::cout<<"Wczytywanie pliku: "<<tmh.getDif()<<std::endl;
ac->deh3m(); ac->deh3m();
THC std::cout<<"Rozpoznawianie pliku lacznie: "<<tmh.getDif()<<std::endl; THC std::cout<<"Rozpoznawianie pliku lacznie: "<<tmh.getDif()<<std::endl;
@ -257,22 +257,26 @@ int _tmain(int argc, _TCHAR* argv[])
{ {
case SDLK_LEFT: case SDLK_LEFT:
{ {
xx--; if(xx>0)
xx--;
break; break;
} }
case (SDLK_RIGHT): case (SDLK_RIGHT):
{ {
xx++; if(xx<ac->map.width-33)
xx++;
break; break;
} }
case (SDLK_UP): case (SDLK_UP):
{ {
yy--; if(yy>0)
yy--;
break; break;
} }
case (SDLK_DOWN): case (SDLK_DOWN):
{ {
yy++; if(yy<ac->map.height-25)
yy++;
break; break;
} }
case (SDLK_q): case (SDLK_q):
@ -290,7 +294,7 @@ int _tmain(int argc, _TCHAR* argv[])
catch(...) catch(...)
{ continue; } { continue; }
SDL_Delay(100); //give time for another apps SDL_Delay(50); //give time for other apps
} }
return 0; return 0;
} }
@ -299,4 +303,4 @@ int _tmain(int argc, _TCHAR* argv[])
printf("Coś poszło nie tak: %s/n",SDL_GetError()); printf("Coś poszło nie tak: %s/n",SDL_GetError());
return -1; return -1;
} }
} }

20
map.h
View File

@ -1,7 +1,25 @@
#ifndef MAPD #ifndef MAPD
#define MAPD #define MAPD
#include <string>
#include <vector>
struct Sresource
{
std::string resName; //name of this resource
int amount; //it can be greater and lesser than 0
};
struct TimeEvent struct TimeEvent
{ {
std::string eventName;
std::string message;
std::vector<Sresource> decIncRes; //decreases / increases of resources
unsigned int whichPlayers; //which players are affected by this event (+1 - first, +2 - second, +4 - third, +8 - fourth etc.)
bool areHumansAffected;
bool areCompsAffected;
int firstAfterNDays; //how many days after appears this event
int nextAfterNDays; //how many days after the epperance before appaers this event
//bajty wydarzeñ (59 + |teksty|) //bajty wydarzeñ (59 + |teksty|)
//4 bajty na d³ugoœæ nazwy zdarzenia //4 bajty na d³ugoœæ nazwy zdarzenia
//nazwa zdarzenia (bajty dodatkowe) //nazwa zdarzenia (bajty dodatkowe)
@ -59,6 +77,7 @@ struct PlayerInfo
bool hasMainTown; bool hasMainTown;
bool generateHeroAtMainTown; bool generateHeroAtMainTown;
Location posOfMainTown; Location posOfMainTown;
int team;
}; };
struct LossCondition struct LossCondition
{ {
@ -146,5 +165,6 @@ struct Mapa
LossCondition lossCondition; LossCondition lossCondition;
EvictoryConditions victoryCondition; //victory conditions EvictoryConditions victoryCondition; //victory conditions
CspecificVictoryConidtions * vicConDetails; // used only if vistory conditions aren't standard CspecificVictoryConidtions * vicConDetails; // used only if vistory conditions aren't standard
int howManyTeams;
}; };
#endif //MAPD #endif //MAPD