Browse Source

poprawki z przesuwaniem oraz wczytywanie drużyn

mateuszb 18 years ago
parent
commit
ea099358f5
3 changed files with 41 additions and 8 deletions
  1. 10 1
      CAmbarCendamo.cpp
  2. 11 7
      CMT.cpp
  3. 20 0
      map.h

+ 10 - 1
CAmbarCendamo.cpp

@@ -247,9 +247,18 @@ void CAmbarCendamo::deh3m()
 	case timeExpires:
 		{
 			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;
 	int rumNr = readNormalNr(i,4);i+=4;
 	for (int it=0;it<rumNr;it++)

+ 11 - 7
CMT.cpp

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

+ 20 - 0
map.h

@@ -1,7 +1,25 @@
 #ifndef 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
 {
+	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|)
 //4 bajty na d³ugoœæ nazwy zdarzenia
 //nazwa zdarzenia (bajty dodatkowe)
@@ -59,6 +77,7 @@ struct PlayerInfo
 	bool hasMainTown;
 	bool generateHeroAtMainTown;
 	Location posOfMainTown;
+	int team;
 };
 struct LossCondition
 {
@@ -146,5 +165,6 @@ struct Mapa
 	LossCondition lossCondition;
 	EvictoryConditions victoryCondition; //victory conditions
 	CspecificVictoryConidtions * vicConDetails; // used only if vistory conditions aren't standard
+	int howManyTeams;
 };
 #endif //MAPD