diff --git a/main.c b/main.c index 648058c..af4cdd6 100755 --- a/main.c +++ b/main.c @@ -132,16 +132,37 @@ void handleAction(t_action action, t_dude dude){ addFight(dude, *((t_dude*)(target.data))); break; case PICK : - - // TODO + // if target is resource : + // put target in inventory + // put grass on target break; case PUT : + // if target is grass or road or corpse + // target = inventory + // inventory = NULL + // else if target is spawn and inventory is food + // spawn.food ++ break; case WORK : + // switch target + // case rock -> stone + // case berries -> food + // case tree -> wood + // case grass -> road + // case road -> grass + // case stone -> wall + // case wood -> sign + // case sign -> wood + // case iron_ore -> iron + // case iron -> sword + // case corpse -> grass break; case WAIT : + // ... break; case COMMUNICATE : + // if target is sign -> set sign message + // if target is dude -> sent message to dude break; } } @@ -149,32 +170,41 @@ void handleAction(t_action action, t_dude dude){ void generateImg(){ int i, j; Uint32 color; + t_dude* dudeData; + int* spawnData; for(i=0; iteam == ORANGE ? 0xFF8000 : 0x9900FF; + break; + case SPAWN : + spawnData = (int*)map[i][j].data; + color = *spawnData == ORANGE ? 0xFFC080 : 0xD596FF; + break; + + case WALL : color = 0xE6B2A1; break; + case ROAD : color = 0xEDB287; break; + case SWORD : color = 0xEBEBEB; break; + case SIGN : color = 0xA37A50; break; default : color = 0x0000FF; break; // bleu absolu = bug } putpixel(img, i, j, color); //img->pixels[j * WIDTH + i] = color; } - printf("\n"); } }