Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Stadtwachstum Release vs Nightly R8788
#9
wenn man die ganze Routine so schreibt dann geht es

Zitat:static const building_desc_t* get_city_building_from_list(const vector_tpl<const building_desc_t*>& list, int level, uint16 time, climate cl, uint32 clusters, koord minsize, koord maxsize )
{
    weighted_vector_tpl<const building_desc_t *> selections(16);

//    DBG_MESSAGE("hausbauer_t::get_aus_liste()","target level %i", level );
    const building_desc_t *desc_at_least=NULL;
    FOR(vector_tpl<building_desc_t const*>, const desc, list) {
        if( (desc->is_allowed_climate(cl)   || cl==MAX_CLIMATES  )  &&
             desc->get_distribution_weight() > 0  &&
             desc->is_available(time)  &&
             // size check
             desc->get_x() <= maxsize.x  &&  desc->get_y() <= maxsize.y  &&
             desc->get_x() >= minsize.x  &&  desc->get_y() >= minsize.y  ) {
            desc_at_least = desc;
            const int thislevel = desc->get_level();
            if( thislevel > level ) {
                if (selections.empty()) {
                    // Nothing of the correct level. Continue with search on a higher level.
                    level = thislevel;
                }
                else {
                    // We already found something of the correct level; stop.
                    break;
                }
            }
            if( thislevel == level ) {
//                DBG_MESSAGE("hausbauer_t::get_city_building_from_list()","appended %s at %i", desc->get_name(), thislevel );
                /* Level, time period, and climate are all OK.
                 * Now modify the chance rating by a factor based on the clusters.
                */
                // FIXME: the factor should be configurable by the pakset/
                int chance = desc->get_distribution_weight();
                if(  clusters  ) {
                    uint32 my_clusters = desc->get_clusters();
                    if(  my_clusters & clusters  ) {
                        chance *= stadt_t::get_cluster_factor();
                    }
                    else {
                        chance /= stadt_t::get_cluster_factor();
                    }
                }
                selections.append(desc, chance);
            }

        }
    }

    if(selections.get_sum_weight()==0) {
        // this is some level below, but at least it is something
        return desc_at_least;
    }
    if(selections.get_count()==1) {
        return selections.front();
    }
    // now there is something to choose
    return pick_any_weighted(selections);
}

[Bild: 3k_city.png]

aber ich bekomme schon wieder meine Allergie Sick
Zitieren


Nachrichten in diesem Thema
Stadtwachstum Release vs Nightly R8788 - von makie - 16-07-2019, Tuesday-12:54:06
RE: Stadtwachstum Release vs Nightly R8788 - von Pumuckl999 - 16-07-2019, Tuesday-15:01:17
RE: Stadtwachstum Release vs Nightly R8788 - von makie - 16-07-2019, Tuesday-15:40:34
RE: Stadtwachstum Release vs Nightly R8788 - von Leartin - 16-07-2019, Tuesday-15:59:31
RE: Stadtwachstum Release vs Nightly R8788 - von prissi - 17-07-2019, Wednesday-05:26:02
RE: Stadtwachstum Release vs Nightly R8788 - von makie - 17-07-2019, Wednesday-08:28:14
RE: Stadtwachstum Release vs Nightly R8788 - von Pumuckl999 - 17-07-2019, Wednesday-20:35:59
RE: Stadtwachstum Release vs Nightly R8788 - von makie - 27-07-2019, Saturday-23:17:29
RE: Stadtwachstum Release vs Nightly R8788 - von makie - 28-07-2019, Sunday-01:35:38
RE: Stadtwachstum Release vs Nightly R8788 - von prissi - 28-07-2019, Sunday-15:43:51
RE: Stadtwachstum Release vs Nightly R8788 - von makie - 28-07-2019, Sunday-21:24:03
RE: Stadtwachstum Release vs Nightly R8788 - von makie - 28-07-2019, Sunday-23:51:28
RE: Stadtwachstum Release vs Nightly R8788 - von prissi - 29-07-2019, Monday-18:21:25
RE: Stadtwachstum Release vs Nightly R8788 - von makie - 29-07-2019, Monday-18:47:34
RE: Stadtwachstum Release vs Nightly R8788 - von prissi - 01-08-2019, Thursday-16:15:17
RE: Stadtwachstum Release vs Nightly R8788 - von prissi - 06-08-2019, Tuesday-17:45:42
RE: Stadtwachstum Release vs Nightly R8788 - von makie - 06-08-2019, Tuesday-17:51:23
RE: Stadtwachstum Release vs Nightly R8788 - von makie - 06-08-2019, Tuesday-19:34:12
RE: Stadtwachstum Release vs Nightly R8788 - von Leartin - 06-08-2019, Tuesday-20:31:54
RE: Stadtwachstum Release vs Nightly R8788 - von makie - 06-08-2019, Tuesday-21:08:11
RE: Stadtwachstum Release vs Nightly R8788 - von Leartin - 12-08-2019, Monday-20:02:33
RE: Stadtwachstum Release vs Nightly R8788 - von prissi - 11-08-2019, Sunday-17:24:59
RE: Stadtwachstum Release vs Nightly R8788 - von makie - 11-08-2019, Sunday-20:46:46
RE: Stadtwachstum Release vs Nightly R8788 - von makie - 13-08-2019, Tuesday-21:46:45
RE: Stadtwachstum Release vs Nightly R8788 - von Leartin - 14-08-2019, Wednesday-07:56:03
RE: Stadtwachstum Release vs Nightly R8788 - von prissi - 17-08-2019, Saturday-05:31:13

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste