예제 #1
0
void Starting() {
    string str;

    cout<<"join"<<endl;

    cin>>str>>ID;
    assert(str=="id");

    cin>>str>>FirstPlayerID;
    assert(str=="first");

    cin>>str;
    assert(str=="init");
    for (int i=0; i<13; i++) {
        cin>>str;
        Hand.push_back(MakeTile(str));
        PushTile(MakeTile(str));
        AppearTile(MakeTile(str));
    }

    Algo_Initialize();
}
예제 #2
0
void Gaming() {
    string str;
    string ntile;
    tile T;
    int a,b,c;
    while(true) {
        cin>>str;
        if (str=="pick") {
            cin>>ntile;
            T=MakeTile(ntile);
            AppearTile(T);
            Hand.push_back(T);
            ActionAfterPick(T);
        }
        if (str=="mpick") {
            cin>>a;
        }
예제 #3
0
tile MakeTile(string str){
	return MakeTile(str.c_str());
}
예제 #4
0
	void Map::LoadLayer(const unsigned char* bLayer, int layerID)
	{
		//Décompression base64
		size_t out = 0;
		unsigned char* data = base64_decode(bLayer, strlen((const char*)bLayer), &out);
		int cptx, cpty;
		cptx = 0;
		cpty = 0;
		int gid, tx, ty;
		int max = 0;
		for(int i = 0; i < out; i += 4)
		{
			gid = data[i] | data[i + 1] << 8 | data[i + 2] << 16 |  data[i + 3] << 24;

			if(layerID == 0)
			{
				gid -= 1;
				ty = (gid)>>4;
				tx = (gid)%16;
				//tx = gid-(tx<<4);
				//Vérification de tiles spécial entités
				if(tx == 1 && ty == 0)
				{
					//Gemme
					worldMan->LoadEntity("gemme", (cptx*16)<<8, (cpty*16)<<8, 16, 16, 0, 0, 0);
					tx = ty = 0;
				}
				else if(tx == 2 && ty == 0)
				{
					//Gemme
					worldMan->LoadEntity("fullstar", (cptx*16)<<8, (cpty*16)<<8, 16, 16, 0, 0, 0);
					tx = ty = 0;
				}
				else if(tx == 3 && ty == 0)
				{
					//Peaks vers le haut
					worldMan->LoadEntity("peaks", (cptx*16)<<8, (cpty*16)<<8, 16, 16, 0, 0, 0);
					tx = ty = 0;
				}
				if(tx == 4 && ty == 0)
				{
					//Gemme
					worldMan->LoadEntity("dbloc", (cptx*16)<<8, (cpty*16)<<8, 16, 16, 0, 0, 0);
					tx = ty = 0;
				}
				else if(tx == 6 && ty == 0)
				{
					//Gemme
					worldMan->LoadEntity("womie", (cptx*16), (cpty*16), 16, 16, 0, 0, 0);
					tx = ty = 0;
				}
				else if(tx == 7 && ty == 0)
				{
					//Gemme
					worldMan->LoadEntity("wopic", (cptx*16), (cpty*16), 16, 16, 0, 0, 0);
					tx = ty = 0;
				}
				else if(tx == 8 && ty == 0)
				{
					//Gemme
					worldMan->LoadEntity("extralife", (cptx*16)<<8, (cpty*16)<<8, 16, 16, 0, 0, 0);
					tx = ty = 0;
				}
				else if(tx == 9 && ty == 0)
				{
					//Peaks vers le bas
					worldMan->LoadEntity("peaks", (cptx*16)<<8, (cpty*16)<<8, 16, 16, 1, 0, 0);
					tx = ty = 0;
				}
				else if(tx == 10 && ty == 0)
				{
					//Peaks vers le bas
					worldMan->LoadEntity("peaks", (cptx*16)<<8, (cpty*16)<<8, 16, 16, 2, 0, 0);
					tx = ty = 0;
				}
				else if(tx == 11 && ty == 0)
				{
					//Peaks vers le bas
					worldMan->LoadEntity("peaks", (cptx*16)<<8, (cpty*16)<<8, 16, 16, 3, 0, 0);
					tx = ty = 0;
				}
			}

			if(layerID == 3)
			{
				gid -= 257;
				ty = (gid)/8;
				tx = (gid)%8;
			}

			/*if(layerID == 3)
			{
				if(gid != 0)
				{
					ulDebug("gid : %d - tx : %d , ty : %d\n", gid, tx, ty);
				}
			}*/

			sMapArray[layerID * (mMapWidthHeight) + (cptx * mMapHeight) + cpty] = MakeTile(tx, ty, 0, 0, 0);
			if(max < layerID * (mMapWidthHeight) + (cptx * mMapHeight) + cpty)
				max = layerID * (mMapWidthHeight) + (cptx * mMapHeight) + cpty;
			cptx++;
			if(cptx > mMapWidth-1)
			{
				cptx = 0;
				cpty++;
			}
		}