Beispiel #1
0
void TradeGraph::Serialize(SerializedGameData& sgd) const
{
    sgd.PushUnsignedChar(player);
    sgd.PushMapPoint(size);
    for(unsigned i = 0; i < trade_graph.size(); ++i)
        trade_graph[i].Serialize(sgd);
}
Beispiel #2
0
TradeGraph::TradeGraph(SerializedGameData& sgd, const GameWorldGame* const gwg) :
    gwg(gwg), player(sgd.PopUnsignedChar()), size(sgd.PopMapPoint()),
    trade_graph(size.x* size.y)
{
    for(unsigned i = 0; i < trade_graph.size(); ++i)
        trade_graph[i].Deserialize(sgd);
}
nobBaseWarehouse::nobBaseWarehouse(SerializedGameData& sgd, const unsigned obj_id) : nobBaseMilitary(sgd, obj_id)
{
    sgd.PopObjectContainer(waiting_wares, GOT_WARE);
    fetch_double_protection = sgd.PopBool();
    sgd.PopObjectContainer(dependent_figures, GOT_UNKNOWN);
    sgd.PopObjectContainer(dependent_wares, GOT_WARE);

    producinghelpers_event = sgd.PopObject<EventManager::Event>(GOT_EVENT);
    recruiting_event = sgd.PopObject<EventManager::Event>(GOT_EVENT);
    empty_event = sgd.PopObject<EventManager::Event>(GOT_EVENT);
    store_event = sgd.PopObject<EventManager::Event>(GOT_EVENT);

    for(unsigned i = 0; i < 5; ++i)
    {
        reserve_soldiers_available[i] = sgd.PopUnsignedInt();
        reserve_soldiers_claimed_visual[i] = reserve_soldiers_claimed_real[i] = sgd.PopUnsignedInt();
    }

    for(unsigned i = 0; i < WARE_TYPES_COUNT; ++i)
    {
        inventory.visual.goods[i] = sgd.PopUnsignedInt();
        inventory.real.goods[i] = sgd.PopUnsignedInt();
        inventorySettings.wares[i] = inventorySettingsVisual.wares[i] = static_cast<InventorySetting>(sgd.PopUnsignedChar());
    }
    for(unsigned i = 0; i < JOB_TYPES_COUNT; ++i)
    {
        inventory.visual.people[i] = sgd.PopUnsignedInt();
        inventory.real.people[i] = sgd.PopUnsignedInt();
        inventorySettings.figures[i] = inventorySettingsVisual.figures[i] = static_cast<InventorySetting>(sgd.PopUnsignedChar());
    }
}
Beispiel #4
0
void nofFlagWorker::Serialize_nofFlagWorker(SerializedGameData& sgd) const
{
    Serialize_noFigure(sgd);

    sgd.PushObject(flag, true);
    sgd.PushUnsignedChar(static_cast<unsigned char>(state));
}
void nobHarborBuilding::ExpeditionInfo::Serialize(SerializedGameData& sgd) const
{
    sgd.PushUnsignedInt(boards);
    sgd.PushUnsignedInt(stones);
    sgd.PushBool(active);
    sgd.PushBool(builder);
}
void noFire::Serialize_noFire(SerializedGameData& sgd) const
{
    Serialize_noCoordBase(sgd);

    sgd.PushBool(isBig);
    sgd.PushEvent(dead_event);
}
Beispiel #7
0
void noSign::Serialize_noSign(SerializedGameData& sgd) const
{
    Serialize_noDisappearingEnvObject(sgd);

    sgd.PushUnsignedChar(type);
    sgd.PushUnsignedChar(quantity);
}
Beispiel #8
0
void nofFisher::Serialize_nofFisher(SerializedGameData& sgd) const
{
    Serialize_nofFarmhand(sgd);

    sgd.PushUnsignedChar(fishing_dir);
    sgd.PushBool(successful);
}
void noShipBuildingSite::Serialize(SerializedGameData& sgd) const
{
    Serialize_noCoordBase(sgd);

    sgd.PushUnsignedChar(player);
    sgd.PushUnsignedChar(progress);
}
Beispiel #10
0
void nofCharburner::Serialize(SerializedGameData& sgd) const
{
    Serialize_nofFarmhand(sgd);

    sgd.PushBool(harvest);
    sgd.PushUnsignedChar(static_cast<unsigned char>(wt));
}
void fowBuildingSite::Serialize(SerializedGameData& sgd) const
{
    sgd.PushBool(planing);
    sgd.PushUnsignedChar(static_cast<unsigned char>(type));
    sgd.PushUnsignedChar(static_cast<unsigned char>(nation));
    sgd.PushUnsignedChar(build_progress);
}
Beispiel #12
0
void nofPlaner::Serialize_nofPlaner(SerializedGameData& sgd) const
{
    Serialize_noFigure(sgd);

    sgd.PushUnsignedChar(static_cast<unsigned char>(state));
    sgd.PushObject(building_site, true);
    sgd.PushUnsignedChar(static_cast<unsigned char>(pd));
}
Beispiel #13
0
void noStaticObject::Serialize_noStaticObject(SerializedGameData& sgd) const
{
    Serialize_noCoordBase(sgd);

    sgd.PushUnsignedShort(id);
    sgd.PushUnsignedShort(file);
    sgd.PushUnsignedChar(size);
}
Beispiel #14
0
Ware::Ware(SerializedGameData& sgd, const unsigned obj_id) : GameObject(sgd, obj_id),
    next_dir(sgd.PopUnsignedChar()),
    state(State(sgd.PopUnsignedChar())),
    location(sgd.PopObject<noRoadNode>(GOT_UNKNOWN)),
    type(GoodType(sgd.PopUnsignedChar())),
    goal(sgd.PopObject<noBaseBuilding>(GOT_UNKNOWN)),
    next_harbor(sgd.PopMapPoint())
{}
Beispiel #15
0
void nofWarehouseWorker::Serialize_nofWarehouseWorker(SerializedGameData& sgd) const
{
    Serialize_noFigure(sgd);

    sgd.PushObject(carried_ware, true);
    sgd.PushBool(shouldBringWareIn);
    sgd.PushBool(fat);
}
Beispiel #16
0
noAnimal::noAnimal(SerializedGameData& sgd, const unsigned obj_id) : noMovable(sgd, obj_id),
    species(Species(sgd.PopUnsignedChar())),
    state(State(sgd.PopUnsignedChar())),
    pause_way(sgd.PopUnsignedShort()),
    hunter(sgd.PopObject<nofHunter>(GOT_NOF_HUNTER)),
    sound_moment(0)
{
}
void nofActiveSoldier::Serialize_nofActiveSoldier(SerializedGameData& sgd) const
{
    Serialize_nofSoldier(sgd);

    sgd.PushUnsignedChar(static_cast<unsigned char>(state));
    sgd.PushObject(enemy, false);
    sgd.PushMapPoint(fightSpot_);
}
Beispiel #18
0
void noAnimal::Serialize_noAnimal(SerializedGameData& sgd) const
{
    Serialize_noMovable(sgd);

    sgd.PushUnsignedChar(static_cast<unsigned char>(species));
    sgd.PushUnsignedChar(static_cast<unsigned char>(state));
    sgd.PushUnsignedShort(pause_way);
    sgd.PushObject(hunter, true);
}
Beispiel #19
0
noTree::noTree(SerializedGameData& sgd, const unsigned obj_id) : noCoordBase(sgd, obj_id),
    type(sgd.PopUnsignedChar()),
    size(sgd.PopUnsignedChar()),
    state(State(sgd.PopUnsignedChar())),
    event(sgd.PopObject<EventManager::Event>(GOT_EVENT)),
    produce_animal_event(sgd.PopObject<EventManager::Event>(GOT_EVENT)),
    produce_animals(sgd.PopBool())
{
}
void BuildingRegister::Serialize(SerializedGameData& sgd) const
{
    sgd.PushObjectContainer(warehouses, false);
    sgd.PushObjectContainer(harbors, true);
    for(const auto& building : buildings)
        sgd.PushObjectContainer(building, true);
    sgd.PushObjectContainer(building_sites, true);
    sgd.PushObjectContainer(military_buildings, true);
}
Beispiel #21
0
noMovable::noMovable(SerializedGameData& sgd, const unsigned obj_id) : noCoordBase(sgd, obj_id),
    curMoveDir(sgd.PopUnsignedChar()),
    ascent(sgd.PopUnsignedChar()),
    current_ev(sgd.PopObject<EventManager::Event>(GOT_EVENT)),
    pause_walked_gf(sgd.PopUnsignedInt()),
    pause_event_length(sgd.PopUnsignedInt())
    , moving(sgd.PopBool())
{
}
Beispiel #22
0
nofTradeLeader::nofTradeLeader(SerializedGameData& sgd, const unsigned obj_id)
    : noFigure(sgd, obj_id),
      tr(sgd, gwg, player),
      successor(sgd.PopObject<nofTradeDonkey>(GOT_NOF_TRADEDONKEY)),
      start(sgd.PopMapPoint()),
      goal_(sgd.PopMapPoint()),
      fails(sgd.PopUnsignedChar())
{
}
void nofAggressiveDefender::Serialize_nofAggressiveDefender(SerializedGameData& sgd) const
{
    Serialize_nofActiveSoldier(sgd);

    if(state != STATE_WALKINGHOME && state != STATE_FIGUREWORK)
    {
        sgd.PushObject(attacker, true);
        sgd.PushObject(attacked_goal, false);
    }
}
Beispiel #24
0
noFighting::noFighting(SerializedGameData& sgd, const unsigned obj_id) : noBase(sgd, obj_id),
    turn(sgd.PopUnsignedChar()),
    defending_animation(sgd.PopUnsignedChar()),
    current_ev(sgd.PopEvent()),
    player_won(sgd.PopUnsignedChar())

{
    for(unsigned i = 0; i < 2; ++i)
        soldiers[i] = sgd.PopObject<nofActiveSoldier>(GOT_UNKNOWN);
}
Beispiel #25
0
nofBuilder::nofBuilder(SerializedGameData& sgd, const unsigned obj_id) : noFigure(sgd, obj_id),
    state(BuilderState(sgd.PopUnsignedChar())),
    building_site(sgd.PopObject<noBuildingSite>(GOT_BUILDINGSITE)),
    rel_x(sgd.PopSignedShort()),
    rel_y(sgd.PopSignedShort()),
    next_rel_x(sgd.PopSignedShort()),
    next_rel_y(sgd.PopSignedShort()),
    building_steps_available(sgd.PopUnsignedChar())
{
}
void BuildingRegister::Deserialize2(SerializedGameData& sgd)
{
    if(sgd.GetGameDataVersion() < 2)
    {
        for(unsigned i = 0; i < 30; ++i)
            sgd.PopObjectContainer(buildings[i], GOT_NOB_USUAL);
        sgd.PopObjectContainer(building_sites, GOT_BUILDINGSITE);
        sgd.PopObjectContainer(military_buildings, GOT_NOB_MILITARY);
    }
}
void nofAttacker::Serialize_nofAttacker(SerializedGameData& sgd) const
{
    Serialize_nofActiveSoldier(sgd);

    if(state != STATE_WALKINGHOME && state != STATE_FIGUREWORK)
    {
        sgd.PushObject(attacked_goal, false);
        sgd.PushBool(mayBeHunted);
        sgd.PushContainer(canPlayerSendAggDefender);
        sgd.PushObject(huntingDefender, true);
        sgd.PushUnsignedShort(radius);

        if(state == STATE_ATTACKING_WAITINGFORDEFENDER)
            sgd.PushEvent(blocking_event);

        sgd.PushMapPoint(harborPos);
        sgd.PushMapPoint(shipPos);
        sgd.PushUnsignedInt(ship_obj_id);
    } else
    {
        RTTR_Assert(!attacked_goal);
        RTTR_Assert(!huntingDefender);
        RTTR_Assert(!blocking_event);
    }
}
Beispiel #28
0
void noTree::Serialize_noTree(SerializedGameData& sgd) const
{
    Serialize_noCoordBase(sgd);

    sgd.PushUnsignedChar(type);
    sgd.PushUnsignedChar(size);
    sgd.PushUnsignedChar(static_cast<unsigned char>(state));
    sgd.PushObject(event, true);
    sgd.PushObject(produce_animal_event, true);
    sgd.PushBool(produce_animals);
}
Beispiel #29
0
CatapultStone::CatapultStone(SerializedGameData& sgd, const unsigned obj_id) : GameObject(sgd, obj_id),
    dest_building(sgd.PopMapPoint()),
    dest_map(sgd.PopMapPoint()),
    start_x(sgd.PopSignedInt()),
    start_y(sgd.PopSignedInt()),
    dest_x(sgd.PopSignedInt()),
    dest_y(sgd.PopSignedInt()),
    explode(sgd.PopBool()),
    event(sgd.PopObject<EventManager::Event>(GOT_EVENT))
{
}
Beispiel #30
0
void nofTradeLeader::Serialize(SerializedGameData& sgd) const
{
    Serialize_noFigure(sgd);

    tr.Serialize(sgd);

    sgd.PushObject(successor, true);
    sgd.PushMapPoint(start);
    sgd.PushMapPoint(goal_);
    sgd.PushUnsignedChar(fails);
}