nofGeologist::nofGeologist(SerializedGameData& sgd, const unsigned obj_id) : nofFlagWorker(sgd, obj_id), signs(sgd.PopUnsignedShort())
{
    unsigned available_nodes_count = sgd.PopUnsignedInt();
    for(unsigned i = 0; i < available_nodes_count; ++i)
    {
        MapPoint p = sgd.PopMapPoint();
        available_nodes.push_back(p);
    }

    node_goal = sgd.PopMapPoint();

    for(unsigned i = 0; i < 5; ++i)
        resAlreadyFound[i] = sgd.PopBool();
}
nofBuildingWorker::nofBuildingWorker(SerializedGameData& sgd, const unsigned obj_id)
    : noFigure(sgd, obj_id), state(State(sgd.PopUnsignedChar()))
{
    if(fs != FS_GOHOME && fs != FS_WANDER)
    {
        workplace = sgd.PopObject<nobUsual>(GOT_UNKNOWN);
        ware = GoodType(sgd.PopUnsignedChar());
        was_sounding = sgd.PopBool();
    } else
    {
        workplace = nullptr;
        ware = GD_NOTHING;
        was_sounding = false;
    }
}
Esempio n. 3
0
noShip::noShip(SerializedGameData& sgd, const unsigned obj_id) :
    noMovable(sgd, obj_id),
    player(sgd.PopUnsignedChar()),
    state(State(sgd.PopUnsignedChar())),
    seaId_(sgd.PopUnsignedShort()),
    goal_harbor_id(sgd.PopUnsignedInt()),
    goal_dir(sgd.PopUnsignedChar()),
    name(sgd.PopString()),
    curRouteIdx(sgd.PopUnsignedInt()),
    route_(sgd.PopUnsignedInt()),
    lost(sgd.PopBool()),
    remaining_sea_attackers(sgd.PopUnsignedInt()),
    home_harbor(sgd.PopUnsignedInt()),
    covered_distance(sgd.PopUnsignedInt())
{
    for(unsigned i = 0; i < route_.size(); ++i)
        route_[i] = sgd.PopUnsignedChar();
    sgd.PopObjectContainer(figures, GOT_UNKNOWN);
    sgd.PopObjectContainer(wares, GOT_WARE);
}
Esempio n. 4
0
nofCarrier::nofCarrier(SerializedGameData& sgd, unsigned int obj_id)
    : noFigure(sgd, obj_id),
      ct( CarrierType(sgd.PopUnsignedChar()) ),
      state( CarrierState(sgd.PopUnsignedChar()) ),
      fat( sgd.PopBool() ),
      workplace( sgd.PopObject<RoadSegment>(GOT_ROADSEGMENT) ),
      carried_ware( sgd.PopObject<Ware>(GOT_WARE) ),
      productivity_ev(sgd.PopEvent()),
      productivity(sgd.PopUnsignedInt()),
      worked_gf(sgd.PopUnsignedInt()),
      since_working_gf(sgd.PopUnsignedInt()),
      next_animation(0)
{

    if(state == CARRS_BOATCARRIER_WANDERONWATER)
    {
        shore_path.resize(sgd.PopUnsignedInt());
        for(std::vector<unsigned char>::iterator it = shore_path.begin(); it != shore_path.end(); ++it)
            *it = sgd.PopUnsignedChar();
    }
}
Esempio n. 5
0
fowBuildingSite::fowBuildingSite(SerializedGameData& sgd) :
    planing(sgd.PopBool()),
    type(BuildingType(sgd.PopUnsignedChar())),
    nation(Nation(sgd.PopUnsignedChar())),
    build_progress(sgd.PopUnsignedChar())
{}
Esempio n. 6
0
nofWarehouseWorker::nofWarehouseWorker(SerializedGameData& sgd, const unsigned obj_id) : noFigure(sgd, obj_id),
    carried_ware(sgd.PopObject<Ware>(GOT_WARE)),
    shouldBringWareIn(sgd.PopBool()),
    fat(sgd.PopBool())
{
}
Esempio n. 7
0
noFire::noFire(SerializedGameData& sgd, const unsigned obj_id)
    : noCoordBase(sgd, obj_id), isBig(sgd.PopBool()), dead_event(sgd.PopEvent()), was_sounding(false), last_sound(0), next_interval(0)
{}
Esempio n. 8
0
void GameWorld::Deserialize(SerializedGameData& sgd)
{
    // Headinformationen
    width_ = sgd.PopUnsignedShort();
    height_ = sgd.PopUnsignedShort();
    lt = LandscapeType(sgd.PopUnsignedChar());

    // Initialisierungen
    Init();

    // Obj-ID-Counter setzen
    GameObject::SetObjIDCounter(sgd.PopUnsignedInt());

    // Trade graphs
    // Only if trade is enabled
    if(GAMECLIENT.GetGGS().isEnabled(ADDON_TRADE))
    {
        tgs.resize(sgd.PopUnsignedChar());
        for(unsigned i = 0; i < tgs.size(); ++i)
            tgs[i] = new TradeGraph(sgd, this);
    }

    // Alle Weltpunkte serialisieren
    for(unsigned i = 0; i < map_size; ++i)
    {
        for(unsigned z = 0; z < 3; ++z)
        {
            nodes[i].roads[z] = sgd.PopUnsignedChar();
            nodes[i].roads_real[z] = nodes[i].roads[z] ? true : false;
        }


        nodes[i].altitude = sgd.PopUnsignedChar();
        nodes[i].shadow = sgd.PopUnsignedChar();
        nodes[i].t1 = TerrainType(sgd.PopUnsignedChar());
        nodes[i].t2 = TerrainType(sgd.PopUnsignedChar());
        nodes[i].resources = sgd.PopUnsignedChar();
        nodes[i].reserved = sgd.PopBool();
        nodes[i].owner = sgd.PopUnsignedChar();
        for(unsigned b = 0; b < 4; ++b)
            nodes[i].boundary_stones[b] = sgd.PopUnsignedChar();
        nodes[i].bq = BuildingQuality(sgd.PopUnsignedChar());
        for(unsigned z = 0; z < GAMECLIENT.GetPlayerCount(); ++z)
        {
            MapNode::FoWData& fow = nodes[i].fow[z];
            fow.visibility = Visibility(sgd.PopUnsignedChar());
            // Nur im FoW können FOW-Objekte stehen
            if(fow.visibility == VIS_FOW)
            {
                fow.last_update_time = sgd.PopUnsignedInt();
                fow.object = sgd.PopFOWObject();
                for(unsigned r = 0; r < 3; ++r)
                    fow.roads[r] = sgd.PopUnsignedChar();
                fow.owner = sgd.PopUnsignedChar();
                for(unsigned b = 0; b < 4; ++b)
                    fow.boundary_stones[b] = sgd.PopUnsignedChar();
            }
            else
            {
                fow.last_update_time = 0;
                fow.object = NULL;
                for(unsigned r = 0; r < 3; ++r)
                    fow.roads[r] = 0;
                fow.owner = 0;
                for(unsigned b = 0; b < 4; ++b)
                    fow.boundary_stones[b] = 0;
            }
        }
        nodes[i].obj = sgd.PopObject<noBase>(GOT_UNKNOWN);
        sgd.PopObjectContainer(nodes[i].figures, GOT_UNKNOWN);
        nodes[i].sea_id = sgd.PopUnsignedShort();
        nodes[i].harbor_id = sgd.PopUnsignedInt();

        if (nodes[i].harbor_id)
        {
            GameWorldBase::HarborPos p(MapPoint((MapCoord) (i % width_), (MapCoord) (i / width_)));
            harbor_pos.push_back(p);
        }
    }

    // Katapultsteine deserialisieren
    sgd.PopObjectContainer(catapult_stones, GOT_CATAPULTSTONE);

    // Meeresinformationen deserialisieren
    seas.resize(sgd.PopUnsignedInt());
    for(unsigned i = 0; i < seas.size(); ++i)
    {
        seas[i].nodes_count = sgd.PopUnsignedInt();
    }

    // Hafenpositionen serialisieren
    harbor_pos.resize(sgd.PopUnsignedInt());
    for(unsigned i = 0; i < harbor_pos.size(); ++i)
    {
        harbor_pos[i].pos = sgd.PopMapPoint();
        for(unsigned z = 0; z < 6; ++z)
            harbor_pos[i].cps[z].sea_id = sgd.PopUnsignedShort();
        for(unsigned z = 0; z < 6; ++z)
        {
            harbor_pos[i].neighbors[z].resize(sgd.PopUnsignedInt());
            for(unsigned c = 0; c < harbor_pos[i].neighbors[z].size(); ++c)
            {
                harbor_pos[i].neighbors[z][c].id = sgd.PopUnsignedInt();
                harbor_pos[i].neighbors[z][c].distance = sgd.PopUnsignedInt();
            }
        }
    }

    sgd.PopObjectContainer(harbor_building_sites_from_sea, GOT_BUILDINGSITE);

    // BQ neu berechnen
    for(unsigned y = 0; y < height_; ++y)
    {
        for(unsigned x = 0; x < width_; ++x)
        {
            SetBQ(MapPoint(x, y), GAMECLIENT.GetPlayerID());
        }
    }

    tr.GenerateOpenGL(*this);

    // Zum HQ am Anfang springen, falls dieses existiert
    if(GetPlayer(GAMECLIENT.GetPlayerID()).hqPos.x != 0xFFFF)
        this->MoveToMapObject(GetPlayer(GAMECLIENT.GetPlayerID()).hqPos);
}
Esempio n. 9
0
nofFisher::nofFisher(SerializedGameData& sgd, const unsigned obj_id) : nofFarmhand(sgd, obj_id),
    fishing_dir(sgd.PopUnsignedChar()),
    successful(sgd.PopBool())
{
}
Esempio n. 10
0
nofCharburner::nofCharburner(SerializedGameData& sgd, const unsigned obj_id) : nofFarmhand(sgd, obj_id),
    harvest(sgd.PopBool()),
    wt(WareType(sgd.PopUnsignedChar()))
{
}
Esempio n. 11
0
nobHarborBuilding::ExplorationExpeditionInfo::ExplorationExpeditionInfo(SerializedGameData& sgd) :
    active(sgd.PopBool()),
    scouts(sgd.PopUnsignedInt())
{
}
Esempio n. 12
0
nobHarborBuilding::ExpeditionInfo::ExpeditionInfo(SerializedGameData& sgd) :
    boards(sgd.PopUnsignedInt()),
    stones(sgd.PopUnsignedInt()),
    active(sgd.PopBool()),
    builder(sgd.PopBool())
{}
Esempio n. 13
0
nofArmorer::nofArmorer(SerializedGameData& sgd, const unsigned obj_id) : nofWorkman(sgd, obj_id),
    sword_shield(sgd.PopBool())
{
}
Esempio n. 14
0
nobHQ::nobHQ(SerializedGameData& sgd, const unsigned obj_id) : nobBaseWarehouse(sgd, obj_id), isTent_(sgd.PopBool())
{
    gwg->GetMilitarySquares().Add(this);
}
Esempio n. 15
0
nobHQ::nobHQ(SerializedGameData& sgd, const unsigned obj_id) : nobBaseWarehouse(sgd, obj_id), isTent_(sgd.PopBool())
{
    gwg->GetMilitarySquares().Add(this);

    // Startpos setzen
    GAMECLIENT.GetPlayer(player).hqPos = this->pos;
}