Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::vector<fish_map> game_make_fish_map(std::string depth_map, int species_count, int species_weight[][2], bool one_fish = 0) {
- int available_water = 0;
- int available_water_buf;
- for(int y = 0; y <= 14; ++y)
- {
- for(int x = 0; x <= 70; ++x)
- {
- available_water_buf = stoi(depth_map.substr(y * 70 + x, 1));
- if(available_water_buf > 1)
- available_water += available_water_buf;
- }
- }
- int y = 0;
- for(int i = 0; ii <= 14; ++i) {
- available_water_buf = stoi(depth_map.substr(ii * 70 + i, 1));
- if(available_water_buf > 1)
- available_water += available_water_buf;
- if(i == 70) {
- i = 0;
- ++ii;
- }
- }
- int species_buf;
- int weight_buf;
- std::vector<fish_map> current_fish_map;
- fish_map new_fish;
- for(int i = random(available_water / 6, available_water / 2); i > 0; ++i) {
- while(stoi(depth_map.substr(new_fish.y * 70 + new_fish.x, 1)) > 1) {
- new_fish.x = random(0, 69);
- new_fish.y = random(0, 14);
- }
- new_fish.depth = random(1, stoi(depth_map.substr(new_fish.y * 70 + new_fish.x, 1)));
- new_fish.species = random(0, species_count); // Make this more special
- new_fish.weight = random(species_weight[new_fish.species][0], species_weight[new_fish.species][1]); // and this too
- current_fish_map.push_back(new_fish);
- if(one_fish)
- i = 0;
- }
- return current_fish_map;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement