widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #02765
[Merge] lp:~widelands-dev/widelands/bug-1343299 into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1343299 into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1343299 in widelands: "Remove camelCase or other standards for function names"
https://bugs.launchpad.net/widelands/+bug/1343299
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1343299/+merge/236329
Refactoring: removed CamelCase etc from function names.
--
The attached diff has been truncated due to its size.
https://code.launchpad.net/~widelands-dev/widelands/bug-1343299/+merge/236329
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1343299 into lp:widelands.
=== modified file 'src/ai/ai_help_structs.cc'
--- src/ai/ai_help_structs.cc 2014-07-20 07:47:15 +0000
+++ src/ai/ai_help_structs.cc 2014-09-29 13:33:11 +0000
@@ -60,7 +60,7 @@
return true;
}
-bool CheckStepRoadAI::reachabledest(Map& map, FCoords const dest) const {
+bool CheckStepRoadAI::reachable_dest(Map& map, FCoords const dest) const {
NodeCaps const caps = dest.field->nodecaps();
if (!(caps & movecaps_)) {
=== modified file 'src/ai/ai_help_structs.h'
--- src/ai/ai_help_structs.h 2014-09-10 08:55:04 +0000
+++ src/ai/ai_help_structs.h 2014-09-29 13:33:11 +0000
@@ -48,7 +48,7 @@
}
bool allowed(Map&, FCoords start, FCoords end, int32_t dir, CheckStep::StepId) const;
- bool reachabledest(Map&, FCoords dest) const;
+ bool reachable_dest(Map&, FCoords dest) const;
Player* player_;
uint8_t movecaps_;
=== modified file 'src/ai/computer_player.cc'
--- src/ai/computer_player.cc 2014-09-10 13:03:40 +0000
+++ src/ai/computer_player.cc 2014-09-29 13:33:11 +0000
@@ -50,7 +50,7 @@
EmptyAI::EmptyAIImpl EmptyAI::implementation;
const ComputerPlayer::ImplementationVector &
-ComputerPlayer::getImplementations()
+ComputerPlayer::get_implementations()
{
static std::vector<ComputerPlayer::Implementation const *> impls;
@@ -64,10 +64,10 @@
return impls;
}
-const ComputerPlayer::Implementation * ComputerPlayer::getImplementation
+const ComputerPlayer::Implementation * ComputerPlayer::get_implementation
(const std::string & name)
{
- const ImplementationVector & vec = getImplementations();
+ const ImplementationVector & vec = get_implementations();
for (const ComputerPlayer::Implementation* implementation : vec) {
if (implementation->name == name) {
=== modified file 'src/ai/computer_player.h'
--- src/ai/computer_player.h 2014-09-14 11:31:58 +0000
+++ src/ai/computer_player.h 2014-09-29 13:33:11 +0000
@@ -48,7 +48,7 @@
/**
* Interface to a concrete implementation, used to instantiate AIs.
*
- * \see getImplementations()
+ * \see get_implementations()
*/
struct Implementation {
std::string name;
@@ -61,12 +61,12 @@
/**
* Get a list of available AI implementations.
*/
- static const ImplementationVector & getImplementations();
+ static const ImplementationVector & get_implementations();
/**
* Get the best matching implementation for this name.
*/
- static const Implementation * getImplementation(const std::string & name);
+ static const Implementation * get_implementation(const std::string & name);
private:
Widelands::Game & m_game;
=== modified file 'src/ai/defaultai.cc'
--- src/ai/defaultai.cc 2014-09-14 11:31:58 +0000
+++ src/ai/defaultai.cc 2014-09-29 13:33:11 +0000
@@ -658,10 +658,10 @@
if (v > 0 && dist > 0) {
- field.military_capacity_ += militarysite->maxSoldierCapacity();
- field.military_presence_ += militarysite->stationedSoldiers().size();
+ field.military_capacity_ += militarysite->max_soldier_capacity();
+ field.military_presence_ += militarysite->stationed_soldiers().size();
- if (!militarysite->stationedSoldiers().empty()) {
+ if (!militarysite->stationed_soldiers().empty()) {
field.military_stationed_ += 1;
}
@@ -2216,7 +2216,7 @@
for (std::list<MilitarySiteObserver>::iterator it = militarysites.begin();
it != militarysites.end();
++it)
- if (it->site->stationedSoldiers().size() == 0)
+ if (it->site->stationed_soldiers().size() == 0)
unstationed_milit_buildings_ += 1;
// count militarysites in construction
@@ -2250,7 +2250,7 @@
// as long as it is > 1 - BUT take care that there is a warehouse in the
// same economy where the thrown out soldiers can go to.
if (ms->economy().warehouses().size()) {
- uint32_t const j = ms->soldierCapacity();
+ uint32_t const j = ms->soldier_capacity();
if (MilitarySite::kPrefersRookies != ms->get_soldier_preference()) {
game().send_player_militarysite_set_soldier_preference(
@@ -2283,8 +2283,8 @@
} else {
// If an enemy is in sight and the number of stationed soldier is not
// at maximum - set it to maximum.
- uint32_t const j = ms->maxSoldierCapacity();
- uint32_t const k = ms->soldierCapacity();
+ uint32_t const j = ms->max_soldier_capacity();
+ uint32_t const k = ms->soldier_capacity();
if (j > k)
// game().send_player_change_soldier_capacity(*ms, j - k);
@@ -2696,11 +2696,11 @@
continue;
}
- if (bld->canAttack()) {
+ if (bld->can_attack()) {
// any_attackable_building=true;
- int32_t ta = player_->findAttackSoldiers(bld->base_flag());
+ int32_t ta = player_->find_attack_soldiers(bld->base_flag());
if (type_ == NORMAL)
ta = ta * 2 / 3;
@@ -2708,24 +2708,24 @@
if (ta < 1)
continue;
- int32_t const tc = ta - bld->presentSoldiers().size();
+ int32_t const tc = ta - bld->present_soldiers().size();
- if (bld->presentSoldiers().size() > 1)
- defend_ready_enemies += bld->presentSoldiers().size() - 1;
+ if (bld->present_soldiers().size() > 1)
+ defend_ready_enemies += bld->present_soldiers().size() - 1;
if (tc > chance) {
target = bld;
chance = tc;
attackers = ta;
- defenders = bld->presentSoldiers().size();
+ defenders = bld->present_soldiers().size();
}
}
} else if (upcast(Warehouse, wh, immovables.at(j).object)) {
if (!player_->is_hostile(wh->owner()))
continue;
- if (wh->canAttack()) {
- int32_t ta = player_->findAttackSoldiers(wh->base_flag());
+ if (wh->can_attack()) {
+ int32_t ta = player_->find_attack_soldiers(wh->base_flag());
if (ta < 1)
continue;
=== modified file 'src/base/md5.h'
--- src/base/md5.h 2014-09-14 11:31:58 +0000
+++ src/base/md5.h 2014-09-29 13:33:11 +0000
@@ -65,8 +65,8 @@
/**
* This class is responsible for creating a streaming md5 checksum.
* You simply pass it the data using stream operations, and if you want
- * to read the checksum, first call FinishChecksum(), followed by
- * GetChecksum().
+ * to read the checksum, first call finish_checksum(), followed by
+ * get_checksum().
*
* Instances of this class can be copied.
*/
@@ -93,24 +93,24 @@
///
/// \param data data to compute chksum for
/// \param size size of data
- void Data(const void * const newdata, const size_t size) {
+ void data(const void * const newdata, const size_t size) {
assert(can_handle_data);
md5_process_bytes(newdata, size, &ctx);
}
/// This function finishes the checksum calculation.
/// After this, no more data may be written to the checksum.
- void FinishChecksum() {
+ void finish_checksum() {
assert(can_handle_data);
can_handle_data = 0;
md5_finish_ctx(&ctx, sum.data);
}
- /// Retrieve the checksum. Note that \ref FinishChecksum must be called
+ /// Retrieve the checksum. Note that \ref finish_checksum must be called
/// before this function.
///
/// \return a pointer to an array of 16 bytes containing the checksum.
- const Md5Checksum & GetChecksum() const {
+ const Md5Checksum & get_checksum() const {
assert(!can_handle_data);
return sum;
}
=== modified file 'src/chat/chat.h'
--- src/chat/chat.h 2014-07-16 07:44:33 +0000
+++ src/chat/chat.h 2014-09-29 13:33:11 +0000
@@ -62,14 +62,14 @@
virtual ~ChatProvider();
// Send the given chat message. The message may or may not
- // appear in subsequent calls to \ref getMessages.
+ // appear in subsequent calls to \ref get_messages.
virtual void send(const std::string &) = 0;
// \return a (chronological) list of received chat messages.
// This list need not be stable or monotonic. In other words,
// subsequent calls to this functions may return a smaller or
// greater number of chat messages.
- virtual const std::vector<ChatMessage>& getMessages() const = 0;
+ virtual const std::vector<ChatMessage>& get_messages() const = 0;
// reimplemented e.g. in internet_gaming to silence the chat if in game.
// TODO(sirver): this does not belong here. The receiver of the
=== modified file 'src/economy/cmd_call_economy_balance.cc'
--- src/economy/cmd_call_economy_balance.cc 2014-09-10 08:55:04 +0000
+++ src/economy/cmd_call_economy_balance.cc 2014-09-29 13:33:11 +0000
@@ -53,24 +53,24 @@
/**
* Read and write
*/
-void CmdCallEconomyBalance::Read
+void CmdCallEconomyBalance::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == CURRENT_CMD_CALL_ECONOMY_VERSION) {
- GameLogicCommand::Read(fr, egbase, mol);
- uint32_t serial = fr.Unsigned32();
+ GameLogicCommand::read(fr, egbase, mol);
+ uint32_t serial = fr.unsigned_32();
if (serial)
m_flag = &mol.get<Flag>(serial);
- m_timerid = fr.Unsigned32();
+ m_timerid = fr.unsigned_32();
} else if (packet_version == 1 || packet_version == 2) {
- GameLogicCommand::Read(fr, egbase, mol);
- uint8_t const player_number = fr.Unsigned8();
+ GameLogicCommand::read(fr, egbase, mol);
+ uint8_t const player_number = fr.unsigned_8();
if (Player * const player = egbase.get_player(player_number)) {
- if (!fr.Unsigned8())
+ if (!fr.unsigned_8())
throw wexception("0 is not allowed here");
- uint16_t const economy_number = fr.Unsigned16();
+ uint16_t const economy_number = fr.unsigned_16();
if (economy_number < player->get_nr_economies())
m_flag =
player->get_economy_by_number(economy_number)
@@ -80,7 +80,7 @@
} else
throw wexception("invalid player number %u", player_number);
if (packet_version >= 2)
- m_timerid = fr.Unsigned32();
+ m_timerid = fr.unsigned_32();
else
m_timerid = 0;
} else
@@ -90,18 +90,18 @@
throw wexception("call economy balance: %s", e.what());
}
}
-void CmdCallEconomyBalance::Write
+void CmdCallEconomyBalance::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
- fw.Unsigned16(CURRENT_CMD_CALL_ECONOMY_VERSION);
+ fw.unsigned_16(CURRENT_CMD_CALL_ECONOMY_VERSION);
// Write Base Commands
- GameLogicCommand::Write(fw, egbase, mos);
+ GameLogicCommand::write(fw, egbase, mos);
if (Flag * const flag = m_flag.get(egbase))
- fw.Unsigned32(mos.get_object_file_index(*flag));
+ fw.unsigned_32(mos.get_object_file_index(*flag));
else
- fw.Unsigned32(0);
- fw.Unsigned32(m_timerid);
+ fw.unsigned_32(0);
+ fw.unsigned_32(m_timerid);
}
}
=== modified file 'src/economy/cmd_call_economy_balance.h'
--- src/economy/cmd_call_economy_balance.h 2014-09-10 08:55:04 +0000
+++ src/economy/cmd_call_economy_balance.h 2014-09-29 13:33:11 +0000
@@ -39,8 +39,8 @@
uint8_t id() const override {return QUEUE_CMD_CALL_ECONOMY_BALANCE;}
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
private:
OPtr<Flag> m_flag;
=== modified file 'src/economy/economy.cc'
--- src/economy/economy.cc 2014-09-14 11:31:58 +0000
+++ src/economy/economy.cc 2014-09-29 13:33:11 +0000
@@ -718,9 +718,9 @@
// alerts, so add info to the sync stream here.
{
::StreamWrite & ss = game.syncstream();
- ss.Unsigned8 (req.get_type ());
- ss.Unsigned8 (req.get_index ());
- ss.Unsigned32(req.target ().serial());
+ ss.unsigned_8 (req.get_type ());
+ ss.unsigned_8 (req.get_index ());
+ ss.unsigned_32(req.target ().serial());
}
int32_t cost; // estimated time in milliseconds to fulfill Request
@@ -1017,12 +1017,12 @@
// to avoid potential future problems caused by the m_supplies changing
// under us in some way.
::StreamWrite & ss = game.syncstream();
- ss.Unsigned32(0x02decafa); // appears as facade02 in sync stream
- ss.Unsigned32(assignments.size());
+ ss.unsigned_32(0x02decafa); // appears as facade02 in sync stream
+ ss.unsigned_32(assignments.size());
for (const std::pair<Supply *, Warehouse *>& temp_assignment : assignments) {
- ss.Unsigned32(temp_assignment.first->get_position(game)->serial());
- ss.Unsigned32(temp_assignment.second->serial());
+ ss.unsigned_32(temp_assignment.first->get_position(game)->serial());
+ ss.unsigned_32(temp_assignment.second->serial());
temp_assignment.first->send_to_storage(game, temp_assignment.second);
}
=== modified file 'src/economy/economy_data_packet.cc'
--- src/economy/economy_data_packet.cc 2014-09-10 16:57:31 +0000
+++ src/economy/economy_data_packet.cc 2014-09-29 13:33:11 +0000
@@ -31,20 +31,20 @@
namespace Widelands {
-void EconomyDataPacket::Read(FileRead & fr)
+void EconomyDataPacket::read(FileRead & fr)
{
- uint16_t const version = fr.Unsigned16();
+ uint16_t const version = fr.unsigned_16();
try {
if (1 <= version && version <= CURRENT_ECONOMY_VERSION) {
if (2 <= version)
try {
const TribeDescr & tribe = m_eco->owner().tribe();
- while (Time const last_modified = fr.Unsigned32()) {
- char const * const type_name = fr.CString();
- uint32_t const permanent = fr.Unsigned32();
+ while (Time const last_modified = fr.unsigned_32()) {
+ char const * const type_name = fr.c_string();
+ uint32_t const permanent = fr.unsigned_32();
if (version <= 2)
- fr.Unsigned32();
+ fr.unsigned_32();
WareIndex i = tribe.ware_index(type_name);
if (i != INVALID_INDEX) {
if (tribe.get_ware_descr(i)->default_target_quantity() ==
@@ -91,7 +91,7 @@
} catch (const WException & e) {
throw GameDataError("target quantities: %s", e.what());
}
- m_eco->m_request_timerid = fr.Unsigned32();
+ m_eco->m_request_timerid = fr.unsigned_32();
} else {
throw GameDataError("unknown version %u", version);
}
@@ -100,18 +100,18 @@
}
}
-void EconomyDataPacket::Write(FileWrite & fw)
+void EconomyDataPacket::write(FileWrite & fw)
{
- fw.Unsigned16(CURRENT_ECONOMY_VERSION);
+ fw.unsigned_16(CURRENT_ECONOMY_VERSION);
const TribeDescr & tribe = m_eco->owner().tribe();
for (WareIndex i = tribe.get_nrwares(); i;) {
--i;
const Economy::TargetQuantity & tq =
m_eco->m_ware_target_quantities[i];
if (Time const last_modified = tq.last_modified) {
- fw.Unsigned32(last_modified);
- fw.CString(tribe.get_ware_descr(i)->name());
- fw.Unsigned32(tq.permanent);
+ fw.unsigned_32(last_modified);
+ fw.c_string(tribe.get_ware_descr(i)->name());
+ fw.unsigned_32(tq.permanent);
}
}
for (WareIndex i = tribe.get_nrworkers(); i;) {
@@ -119,13 +119,13 @@
const Economy::TargetQuantity & tq =
m_eco->m_worker_target_quantities[i];
if (Time const last_modified = tq.last_modified) {
- fw.Unsigned32(last_modified);
- fw.CString(tribe.get_worker_descr(i)->name());
- fw.Unsigned32(tq.permanent);
+ fw.unsigned_32(last_modified);
+ fw.c_string(tribe.get_worker_descr(i)->name());
+ fw.unsigned_32(tq.permanent);
}
}
- fw.Unsigned32(0); // terminator
- fw.Unsigned32(m_eco->m_request_timerid);
+ fw.unsigned_32(0); // terminator
+ fw.unsigned_32(m_eco->m_request_timerid);
}
}
=== modified file 'src/economy/economy_data_packet.h'
--- src/economy/economy_data_packet.h 2014-09-10 07:57:29 +0000
+++ src/economy/economy_data_packet.h 2014-09-29 13:33:11 +0000
@@ -33,8 +33,8 @@
public:
EconomyDataPacket(Economy * e) : m_eco(e) {}
- void Read(FileRead &);
- void Write(FileWrite &);
+ void read(FileRead &);
+ void write(FileWrite &);
private:
Economy * m_eco;
=== modified file 'src/economy/fleet.cc'
--- src/economy/fleet.cc 2014-09-10 08:55:04 +0000
+++ src/economy/fleet.cc 2014-09-29 13:33:11 +0000
@@ -692,22 +692,22 @@
Fleet & fleet = get<Fleet>();
- uint32_t nrships = fr.Unsigned32();
+ uint32_t nrships = fr.unsigned_32();
m_ships.resize(nrships);
for (uint32_t i = 0; i < nrships; ++i)
- m_ships[i] = fr.Unsigned32();
+ m_ships[i] = fr.unsigned_32();
- uint32_t nrports = fr.Unsigned32();
+ uint32_t nrports = fr.unsigned_32();
m_ports.resize(nrports);
for (uint32_t i = 0; i < nrports; ++i)
- m_ports[i] = fr.Unsigned32();
+ m_ports[i] = fr.unsigned_32();
if (version >= 2) {
- fleet.m_act_pending = fr.Unsigned8();
+ fleet.m_act_pending = fr.unsigned_8();
if (version < 3)
fleet.m_act_pending = false;
if (version < 4)
- fr.Unsigned32(); // m_roundrobin
+ fr.unsigned_32(); // m_roundrobin
}
}
@@ -756,9 +756,9 @@
try {
// The header has been peeled away by the caller
- uint8_t const version = fr.Unsigned8();
+ uint8_t const version = fr.unsigned_8();
if (1 <= version && version <= FLEET_SAVEGAME_VERSION) {
- PlayerNumber owner_number = fr.Unsigned8();
+ PlayerNumber owner_number = fr.unsigned_8();
if (!owner_number || owner_number > egbase.map().get_nrplayers())
throw GameDataError
("owner number is %u but there are only %u players",
@@ -781,23 +781,23 @@
void Fleet::save(EditorGameBase & egbase, MapObjectSaver & mos, FileWrite & fw)
{
- fw.Unsigned8(HeaderFleet);
- fw.Unsigned8(FLEET_SAVEGAME_VERSION);
+ fw.unsigned_8(HeaderFleet);
+ fw.unsigned_8(FLEET_SAVEGAME_VERSION);
- fw.Unsigned8(m_owner.player_number());
+ fw.unsigned_8(m_owner.player_number());
MapObject::save(egbase, mos, fw);
- fw.Unsigned32(m_ships.size());
+ fw.unsigned_32(m_ships.size());
for (const Ship * temp_ship : m_ships) {
- fw.Unsigned32(mos.get_object_file_index(*temp_ship));
+ fw.unsigned_32(mos.get_object_file_index(*temp_ship));
}
- fw.Unsigned32(m_ports.size());
+ fw.unsigned_32(m_ports.size());
for (const PortDock * temp_port : m_ports) {
- fw.Unsigned32(mos.get_object_file_index(*temp_port));
+ fw.unsigned_32(mos.get_object_file_index(*temp_port));
}
- fw.Unsigned8(m_act_pending);
+ fw.unsigned_8(m_act_pending);
}
} // namespace Widelands
=== modified file 'src/economy/portdock.cc'
--- src/economy/portdock.cc 2014-09-10 10:18:46 +0000
+++ src/economy/portdock.cc 2014-09-29 13:33:11 +0000
@@ -478,29 +478,29 @@
PortDock & pd = get<PortDock>();
- m_warehouse = fr.Unsigned32();
- uint16_t nrdockpoints = fr.Unsigned16();
+ m_warehouse = fr.unsigned_32();
+ uint16_t nrdockpoints = fr.unsigned_16();
pd.m_dockpoints.resize(nrdockpoints);
for (uint16_t i = 0; i < nrdockpoints; ++i) {
- pd.m_dockpoints[i] = ReadCoords32(&fr, egbase().map().extent());
+ pd.m_dockpoints[i] = read_coords_32(&fr, egbase().map().extent());
pd.set_position(egbase(), pd.m_dockpoints[i]);
}
if (version >= 2) {
- pd.m_need_ship = fr.Unsigned8();
+ pd.m_need_ship = fr.unsigned_8();
- m_waiting.resize(fr.Unsigned32());
+ m_waiting.resize(fr.unsigned_32());
for (ShippingItem::Loader& shipping_loader : m_waiting) {
shipping_loader.load(fr);
}
if (version >= 3) {
// All the other expedition specific stuff is saved in the warehouse.
- if (fr.Unsigned8()) { // Do we have an expedition?
+ if (fr.unsigned_8()) { // Do we have an expedition?
pd.m_expedition_bootstrap.reset(new ExpeditionBootstrap(&pd));
}
- pd.m_expedition_ready = (fr.Unsigned8() == 1) ? true : false;
+ pd.m_expedition_ready = (fr.unsigned_8() == 1) ? true : false;
} else {
pd.m_expedition_ready = false;
}
@@ -545,7 +545,7 @@
try {
// The header has been peeled away by the caller
- uint8_t const version = fr.Unsigned8();
+ uint8_t const version = fr.unsigned_8();
if (1 <= version && version <= PORTDOCK_SAVEGAME_VERSION) {
loader->init(egbase, mol, *new PortDock(nullptr));
loader->load(fr, version);
@@ -560,27 +560,27 @@
void PortDock::save(EditorGameBase & egbase, MapObjectSaver & mos, FileWrite & fw)
{
- fw.Unsigned8(HeaderPortDock);
- fw.Unsigned8(PORTDOCK_SAVEGAME_VERSION);
+ fw.unsigned_8(HeaderPortDock);
+ fw.unsigned_8(PORTDOCK_SAVEGAME_VERSION);
PlayerImmovable::save(egbase, mos, fw);
- fw.Unsigned32(mos.get_object_file_index(*m_warehouse));
- fw.Unsigned16(m_dockpoints.size());
+ fw.unsigned_32(mos.get_object_file_index(*m_warehouse));
+ fw.unsigned_16(m_dockpoints.size());
for (const Coords& coords: m_dockpoints) {
- WriteCoords32(&fw, coords);
+ write_coords_32(&fw, coords);
}
- fw.Unsigned8(m_need_ship);
+ fw.unsigned_8(m_need_ship);
- fw.Unsigned32(m_waiting.size());
+ fw.unsigned_32(m_waiting.size());
for (ShippingItem& shipping_item : m_waiting) {
shipping_item.save(egbase, mos, fw);
}
// Expedition specific stuff
- fw.Unsigned8(m_expedition_bootstrap.get() != nullptr ? 1 : 0);
- fw.Unsigned8(m_expedition_ready ? 1 : 0);
+ fw.unsigned_8(m_expedition_bootstrap.get() != nullptr ? 1 : 0);
+ fw.unsigned_8(m_expedition_ready ? 1 : 0);
}
} // namespace Widelands
=== modified file 'src/economy/request.cc'
--- src/economy/request.cc 2014-09-14 12:13:35 +0000
+++ src/economy/request.cc 2014-09-29 13:33:11 +0000
@@ -105,14 +105,14 @@
* might have been initialized. We have to kill them and replace
* them through the data in the file
*/
-void Request::Read
+void Request::read
(FileRead & fr, Game & game, MapObjectLoader & mol)
{
try {
- uint16_t const version = fr.Unsigned16();
+ uint16_t const version = fr.unsigned_16();
if (version == 6) {
const TribeDescr& tribe = m_target.owner().tribe();
- char const* const type_name = fr.CString();
+ char const* const type_name = fr.c_string();
WareIndex const wai = tribe.ware_index(type_name);
if (wai != INVALID_INDEX) {
m_type = wwWARE;
@@ -123,32 +123,32 @@
m_type = wwWORKER;
m_index = woi;
} else {
- throw wexception("Request::Read: unknown type '%s'.\n", type_name);
+ throw wexception("Request::read: unknown type '%s'.\n", type_name);
}
}
- m_count = fr.Unsigned32();
- m_required_time = fr.Unsigned32();
- m_required_interval = fr.Unsigned32();
+ m_count = fr.unsigned_32();
+ m_required_time = fr.unsigned_32();
+ m_required_interval = fr.unsigned_32();
- m_last_request_time = fr.Unsigned32();
+ m_last_request_time = fr.unsigned_32();
assert(m_transfers.empty());
- uint16_t const nr_transfers = fr.Unsigned16();
+ uint16_t const nr_transfers = fr.unsigned_16();
for (uint16_t i = 0; i < nr_transfers; ++i)
try {
- MapObject* obj = &mol.get<MapObject>(fr.Unsigned32());
+ MapObject* obj = &mol.get<MapObject>(fr.unsigned_32());
Transfer* transfer;
if (upcast(Worker, worker, obj)) {
transfer = worker->get_transfer();
if (m_type != wwWORKER || !worker->descr().can_act_as(m_index)) {
- throw wexception("Request::Read: incompatible transfer type");
+ throw wexception("Request::read: incompatible transfer type");
}
} else if (upcast(WareInstance, ware, obj)) {
transfer = ware->get_transfer();
if (m_type != wwWARE || ware->descr_index() != m_index) {
- throw wexception("Request::Read: incompatible transfer type");
+ throw wexception("Request::read: incompatible transfer type");
}
} else {
throw wexception("transfer target %u is neither ware nor worker", obj->serial());
@@ -164,7 +164,7 @@
} catch (const WException& e) {
throw wexception("transfer %u: %s", i, e.what());
}
- m_requirements.Read (fr, game, mol);
+ m_requirements.read (fr, game, mol);
if (!is_open() && m_economy)
m_economy->remove_request(*this);
} else
@@ -177,10 +177,10 @@
/**
* Write this request to a file
*/
-void Request::Write
+void Request::write
(FileWrite & fw, Game & game, MapObjectSaver & mos) const
{
- fw.Unsigned16(REQUEST_VERSION);
+ fw.unsigned_16(REQUEST_VERSION);
// Target and econmy should be set. Same is true for callback stuff.
@@ -188,30 +188,30 @@
const TribeDescr & tribe = m_target.owner().tribe();
assert(m_type != wwWARE || m_index < tribe.get_nrwares ());
assert(m_type != wwWORKER || m_index < tribe.get_nrworkers());
- fw.CString
+ fw.c_string
(m_type == wwWARE ?
tribe.get_ware_descr (m_index)->name() :
tribe.get_worker_descr(m_index)->name());
- fw.Unsigned32(m_count);
-
- fw.Unsigned32(m_required_time);
- fw.Unsigned32(m_required_interval);
-
- fw.Unsigned32(m_last_request_time);
-
- fw.Unsigned16(m_transfers.size()); // Write number of current transfers.
+ fw.unsigned_32(m_count);
+
+ fw.unsigned_32(m_required_time);
+ fw.unsigned_32(m_required_interval);
+
+ fw.unsigned_32(m_last_request_time);
+
+ fw.unsigned_16(m_transfers.size()); // Write number of current transfers.
for (uint32_t i = 0; i < m_transfers.size(); ++i) {
Transfer & trans = *m_transfers[i];
if (trans.m_ware) { // write ware/worker
assert(mos.is_object_known(*trans.m_ware));
- fw.Unsigned32(mos.get_object_file_index(*trans.m_ware));
+ fw.unsigned_32(mos.get_object_file_index(*trans.m_ware));
} else if (trans.m_worker) {
assert(mos.is_object_known(*trans.m_worker));
- fw.Unsigned32(mos.get_object_file_index(*trans.m_worker));
+ fw.unsigned_32(mos.get_object_file_index(*trans.m_worker));
}
}
- m_requirements.Write (fw, game, mos);
+ m_requirements.write (fw, game, mos);
}
/**
@@ -407,16 +407,16 @@
assert(is_open());
::StreamWrite & ss = game.syncstream();
- ss.Unsigned32(0x01decafa); // appears as facade01 in sync stream
- ss.Unsigned32(target().serial());
- ss.Unsigned32(supp.get_position(game)->serial());
+ ss.unsigned_32(0x01decafa); // appears as facade01 in sync stream
+ ss.unsigned_32(target().serial());
+ ss.unsigned_32(supp.get_position(game)->serial());
Transfer * t;
if (get_type() == wwWORKER) {
// Begin the transfer of a soldier or worker.
// launch_worker() creates or starts the worker
Worker & s = supp.launch_worker(game, *this);
- ss.Unsigned32(s.serial());
+ ss.unsigned_32(s.serial());
t = new Transfer(game, *this, s);
} else {
// Begin the transfer of an ware. The ware itself is passive.
@@ -424,7 +424,7 @@
// warehouse. Once it's on the flag, the flag code will decide what to
// do with it.
WareInstance & ware = supp.launch_ware(game, *this);
- ss.Unsigned32(ware.serial());
+ ss.unsigned_32(ware.serial());
t = new Transfer(game, *this, ware);
}
=== modified file 'src/economy/request.h'
--- src/economy/request.h 2014-09-14 12:13:35 +0000
+++ src/economy/request.h 2014-09-29 13:33:11 +0000
@@ -93,8 +93,8 @@
void start_transfer(Game &, Supply &);
- void Read (FileRead &, Game &, MapObjectLoader &);
- void Write(FileWrite &, Game &, MapObjectSaver &) const;
+ void read (FileRead &, Game &, MapObjectLoader &);
+ void write(FileWrite &, Game &, MapObjectSaver &) const;
Worker * get_transfer_worker();
// callbacks for WareInstance/Worker code
=== modified file 'src/economy/road.cc'
--- src/economy/road.cc 2014-09-10 13:03:40 +0000
+++ src/economy/road.cc 2014-09-29 13:33:11 +0000
@@ -41,7 +41,7 @@
return g_road_descr;
}
-bool Road::IsRoadDescr(MapObjectDescr const * const descr)
+bool Road::is_road_descr(MapObjectDescr const * const descr)
{
return descr == &g_road_descr;
}
@@ -480,7 +480,7 @@
assert(static_cast<uint32_t>(index) < path.get_nsteps() - 1);
path.truncate(index);
- secondpath.starttrim(index);
+ secondpath.trim_start(index);
molog("splitting road: first part:\n");
for (const Coords& coords : path.get_coords()) {
=== modified file 'src/economy/road.h'
--- src/economy/road.h 2014-09-14 11:31:58 +0000
+++ src/economy/road.h 2014-09-29 13:33:11 +0000
@@ -63,7 +63,7 @@
const RoadDescr& descr() const;
- static bool IsRoadDescr(MapObjectDescr const *);
+ static bool is_road_descr(MapObjectDescr const *);
enum FlagId {
FlagStart = 0,
=== modified file 'src/economy/route.cc'
--- src/economy/route.cc 2014-09-10 10:18:46 +0000
+++ src/economy/route.cc 2014-09-29 13:33:11 +0000
@@ -63,7 +63,7 @@
/**
* Remove the first count steps from the route.
*/
-void Route::starttrim(int32_t count)
+void Route::trim_start(int32_t count)
{
assert(count < static_cast<int32_t>(m_route.size()));
@@ -91,10 +91,10 @@
{
m_route.clear();
- m_totalcost = fr.Signed32();
- uint32_t nsteps = fr.Unsigned16();
+ m_totalcost = fr.signed_32();
+ uint32_t nsteps = fr.unsigned_16();
for (uint32_t step = 0; step < nsteps; ++step)
- data.flags.push_back(fr.Unsigned32());
+ data.flags.push_back(fr.unsigned_32());
}
@@ -120,8 +120,8 @@
void Route::save
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
- fw.Signed32(get_totalcost());
- fw.Unsigned16(m_route.size());
+ fw.signed_32(get_totalcost());
+ fw.unsigned_16(m_route.size());
for
(std::vector<ObjectPointer>::size_type idx = 0;
idx < m_route.size();
@@ -129,7 +129,7 @@
{
Flag & flag = get_flag(egbase, idx);
assert(mos.is_object_known(flag));
- fw.Unsigned32(mos.get_object_file_index(flag));
+ fw.unsigned_32(mos.get_object_file_index(flag));
}
}
=== modified file 'src/economy/route.h'
--- src/economy/route.h 2014-09-10 08:55:04 +0000
+++ src/economy/route.h 2014-09-29 13:33:11 +0000
@@ -50,7 +50,7 @@
int32_t get_nrsteps() const {return m_route.size() - 1;}
Flag & get_flag(EditorGameBase &, std::vector<Flag *>::size_type);
- void starttrim(int32_t count);
+ void trim_start(int32_t count);
void truncate(int32_t count);
struct LoadData {
=== modified file 'src/economy/shippingitem.cc'
--- src/economy/shippingitem.cc 2014-09-10 08:55:04 +0000
+++ src/economy/shippingitem.cc 2014-09-29 13:33:11 +0000
@@ -167,9 +167,9 @@
void ShippingItem::Loader::load(FileRead & fr)
{
- uint8_t version = fr.Unsigned8();
+ uint8_t version = fr.unsigned_8();
if (1 <= version && version <= SHIPPINGITEM_SAVEGAME_VERSION) {
- m_serial = fr.Unsigned32();
+ m_serial = fr.unsigned_32();
} else
throw GameDataError("unknown ShippingItem version %u", version);
}
@@ -184,8 +184,8 @@
void ShippingItem::save(EditorGameBase & egbase, MapObjectSaver & mos, FileWrite & fw)
{
- fw.Unsigned8(SHIPPINGITEM_SAVEGAME_VERSION);
- fw.Unsigned32(mos.get_object_file_index_or_zero(m_object.get(egbase)));
+ fw.unsigned_8(SHIPPINGITEM_SAVEGAME_VERSION);
+ fw.unsigned_32(mos.get_object_file_index_or_zero(m_object.get(egbase)));
}
} // namespace Widelands
=== modified file 'src/economy/transfer.cc'
--- src/economy/transfer.cc 2014-09-10 07:57:29 +0000
+++ src/economy/transfer.cc 2014-09-29 13:33:11 +0000
@@ -178,7 +178,7 @@
if (m_route.get_nrsteps() >= 1)
if (upcast(Road const, road, location))
if (&road->get_flag(Road::FlagEnd) == &m_route.get_flag(m_game, 1))
- m_route.starttrim(1);
+ m_route.trim_start(1);
if (m_route.get_nrsteps() >= 1)
if (upcast(Road const, road, destination))
@@ -316,11 +316,11 @@
void Transfer::read(FileRead & fr, Transfer::ReadData & rd)
{
- uint8_t version = fr.Unsigned8();
+ uint8_t version = fr.unsigned_8();
if (version != TRANSFER_SAVEGAME_VERSION)
throw wexception("unhandled/unknown transfer version %u", version);
- rd.destination = fr.Unsigned32();
+ rd.destination = fr.unsigned_32();
}
void Transfer::read_pointers
@@ -332,8 +332,8 @@
void Transfer::write(MapObjectSaver & mos, FileWrite & fw)
{
- fw.Unsigned8(TRANSFER_SAVEGAME_VERSION);
- fw.Unsigned32(mos.get_object_file_index_or_zero(m_destination.get(m_game)));
+ fw.unsigned_8(TRANSFER_SAVEGAME_VERSION);
+ fw.unsigned_32(mos.get_object_file_index_or_zero(m_destination.get(m_game)));
// not saving route right now, will be recaculated anyway
}
=== modified file 'src/economy/ware_instance.cc'
--- src/economy/ware_instance.cc 2014-09-10 10:18:46 +0000
+++ src/economy/ware_instance.cc 2014-09-29 13:33:11 +0000
@@ -557,9 +557,9 @@
MapObject::Loader::load(fr);
WareInstance & ware = get<WareInstance>();
- m_location = fr.Unsigned32();
- m_transfer_nextstep = fr.Unsigned32();
- if (fr.Unsigned8()) {
+ m_location = fr.unsigned_32();
+ m_transfer_nextstep = fr.unsigned_32();
+ if (fr.unsigned_8()) {
ware.m_transfer =
new Transfer(ref_cast<Game, EditorGameBase>(egbase()), ware);
ware.m_transfer->read(fr, m_transfer);
@@ -598,21 +598,21 @@
void WareInstance::save
(EditorGameBase & egbase, MapObjectSaver & mos, FileWrite & fw)
{
- fw.Unsigned8(HeaderWareInstance);
- fw.Unsigned8(WAREINSTANCE_SAVEGAME_VERSION);
- fw.CString(descr().tribe().name());
- fw.CString(descr().name());
+ fw.unsigned_8(HeaderWareInstance);
+ fw.unsigned_8(WAREINSTANCE_SAVEGAME_VERSION);
+ fw.c_string(descr().tribe().name());
+ fw.c_string(descr().name());
MapObject::save(egbase, mos, fw);
- fw.Unsigned32(mos.get_object_file_index_or_zero(m_location.get(egbase)));
- fw.Unsigned32
+ fw.unsigned_32(mos.get_object_file_index_or_zero(m_location.get(egbase)));
+ fw.unsigned_32
(mos.get_object_file_index_or_zero(m_transfer_nextstep.get(egbase)));
if (m_transfer) {
- fw.Unsigned8(1);
+ fw.unsigned_8(1);
m_transfer->write(mos, fw);
} else {
- fw.Unsigned8(0);
+ fw.unsigned_8(0);
}
}
@@ -620,13 +620,13 @@
(EditorGameBase & egbase, MapObjectLoader & mol, FileRead & fr)
{
try {
- uint8_t version = fr.Unsigned8();
+ uint8_t version = fr.unsigned_8();
if (version != WAREINSTANCE_SAVEGAME_VERSION)
throw wexception("unknown/unhandled version %i", version);
- const std::string tribename = fr.CString();
- const std::string warename = fr.CString();
+ const std::string tribename = fr.c_string();
+ const std::string warename = fr.c_string();
egbase.manually_load_tribe(tribename);
=== modified file 'src/economy/wares_queue.cc'
--- src/economy/wares_queue.cc 2014-09-14 12:13:35 +0000
+++ src/economy/wares_queue.cc 2014-09-29 13:33:11 +0000
@@ -235,47 +235,47 @@
* Read and write
*/
#define WARES_QUEUE_DATA_PACKET_VERSION 2
-void WaresQueue::Write(FileWrite & fw, Game & game, MapObjectSaver & mos)
+void WaresQueue::write(FileWrite & fw, Game & game, MapObjectSaver & mos)
{
- fw.Unsigned16(WARES_QUEUE_DATA_PACKET_VERSION);
+ fw.unsigned_16(WARES_QUEUE_DATA_PACKET_VERSION);
// Owner and callback is not saved, but this should be obvious on load.
- fw.CString
+ fw.c_string
(owner().tribe().get_ware_descr(m_ware)->name().c_str());
- fw.Signed32(m_max_size);
- fw.Signed32(m_max_fill);
- fw.Signed32(m_filled);
- fw.Signed32(m_consume_interval);
+ fw.signed_32(m_max_size);
+ fw.signed_32(m_max_fill);
+ fw.signed_32(m_filled);
+ fw.signed_32(m_consume_interval);
if (m_request) {
- fw.Unsigned8(1);
- m_request->Write(fw, game, mos);
+ fw.unsigned_8(1);
+ m_request->write(fw, game, mos);
} else
- fw.Unsigned8(0);
+ fw.unsigned_8(0);
}
-void WaresQueue::Read(FileRead & fr, Game & game, MapObjectLoader & mol)
+void WaresQueue::read(FileRead & fr, Game & game, MapObjectLoader & mol)
{
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
try {
if (packet_version == WARES_QUEUE_DATA_PACKET_VERSION || packet_version == 1) {
delete m_request;
- m_ware = owner().tribe().ware_index(fr.CString ());
- m_max_size = fr.Unsigned32();
+ m_ware = owner().tribe().ware_index(fr.c_string ());
+ m_max_size = fr.unsigned_32();
if (packet_version == 1)
m_max_fill = m_max_size;
else
- m_max_fill = fr.Signed32();
- m_filled = fr.Unsigned32();
- m_consume_interval = fr.Unsigned32();
- if (fr.Unsigned8 ()) {
- m_request = // TODO(unknown): Change Request::Read
+ m_max_fill = fr.signed_32();
+ m_filled = fr.unsigned_32();
+ m_consume_interval = fr.unsigned_32();
+ if (fr.unsigned_8 ()) {
+ m_request = // TODO(unknown): Change Request::read
new Request // to a constructor.
(m_owner,
0,
WaresQueue::request_callback,
wwWORKER);
- m_request->Read(fr, game, mol);
+ m_request->read(fr, game, mol);
} else
m_request = nullptr;
=== modified file 'src/economy/wares_queue.h'
--- src/economy/wares_queue.h 2014-09-14 12:13:35 +0000
+++ src/economy/wares_queue.h 2014-09-29 13:33:11 +0000
@@ -67,8 +67,8 @@
Player & owner() const {return m_owner.owner();}
- void Read (FileRead &, Game &, MapObjectLoader &);
- void Write(FileWrite &, Game &, MapObjectSaver &);
+ void read (FileRead &, Game &, MapObjectLoader &);
+ void write(FileWrite &, Game &, MapObjectSaver &);
private:
static void request_callback
=== modified file 'src/editor/editorinteractive.cc'
--- src/editor/editorinteractive.cc 2014-09-14 16:08:13 +0000
+++ src/editor/editorinteractive.cc 2014-09-29 13:33:11 +0000
@@ -244,7 +244,7 @@
m_realtime = WLApplication::get()->get_time();
frametime = m_realtime - lasttime;
- egbase().get_game_time_pointer() += frametime;
+ egbase().get_gametime_pointer() += frametime;
g_gr->animate_maptextures(egbase().get_gametime());
}
=== modified file 'src/editor/map_generator.cc'
--- src/editor/map_generator.cc 2014-09-14 11:31:58 +0000
+++ src/editor/map_generator.cc 2014-09-29 13:33:11 +0000
@@ -59,13 +59,13 @@
MapGenAreaInfo::MapGenTerrainType const terrType)
{
// Figure out which bob area is due here...
- size_t num = map_gen_info_->getNumLandResources();
+ size_t num = map_gen_info_->get_num_land_resources();
size_t found = num;
- uint32_t sum_weight = map_gen_info_->getSumLandResourceWeight();
+ uint32_t sum_weight = map_gen_info_->get_sum_land_resource_weight();
uint32_t max_val = 0;
for (size_t ix = 0; ix < num; ++ix) {
uint32_t val = random_bobs[ix][fc.x + map_info_.w * fc.y];
- val = (val / sum_weight) * map_gen_info_->getLandResource(ix).getWeight();
+ val = (val / sum_weight) * map_gen_info_->get_land_resource(ix).get_weight();
if (val >= max_val) {
found = ix;
max_val = val;
@@ -76,15 +76,15 @@
// Figure out if we really need to set a bob here...
- const MapGenLandResource & landResource = map_gen_info_->getLandResource(found);
+ const MapGenLandResource & landResource = map_gen_info_->get_land_resource(found);
- const MapGenBobCategory * bobCategory = landResource.getBobCategory(terrType);
+ const MapGenBobCategory * bobCategory = landResource.get_bob_category(terrType);
if (!bobCategory) // no bobs defined here...
return;
- uint32_t immovDens = landResource.getImmovableDensity();
- uint32_t movDens = landResource.getMoveableDensity();
+ uint32_t immovDens = landResource.get_immovable_density();
+ uint32_t movDens = landResource.get_moveable_density();
immovDens *= max_val / 100;
movDens *= max_val / 100;
@@ -136,7 +136,7 @@
uint8_t res_val = static_cast<uint8_t>(random_value / (kMaxElevation / max_amount));
res_val *= static_cast<uint8_t>(map_info_.resource_amount) + 1;
res_val /= 3;
- if (Editor_Change_Resource_Tool_Callback(fc, map_, world, res_idx)) {
+ if (editor_change_resource_tool_callback(fc, map_, world, res_idx)) {
fc.field->set_resources(res_idx, res_val);
fc.field->set_starting_res_amount(res_val);
}
@@ -205,9 +205,9 @@
(double const elevation,
Coords const c)
{
- int32_t const water_h = map_gen_info_->getWaterShallowHeight();
- int32_t const mount_h = map_gen_info_->getMountainFootHeight();
- int32_t const summit_h = map_gen_info_->getSummitHeight ();
+ int32_t const water_h = map_gen_info_->get_water_shallow_height();
+ int32_t const mount_h = map_gen_info_->get_mountain_foot_height();
+ int32_t const summit_h = map_gen_info_->get_summit_height ();
double const water_fac = map_info_.waterRatio;
double const land_fac = map_info_.landRatio;
@@ -452,9 +452,9 @@
MapGenAreaInfo::MapGenTerrainType & terrType)
{
uint32_t numLandAreas =
- map_gen_info_->getNumAreas(MapGenAreaInfo::atLand);
+ map_gen_info_->get_num_areas(MapGenAreaInfo::atLand);
uint32_t const numWasteLandAreas =
- map_gen_info_->getNumAreas(MapGenAreaInfo::atWasteland);
+ map_gen_info_->get_num_areas(MapGenAreaInfo::atWasteland);
bool isDesert = false;
bool isDesertOuter = false;
@@ -516,10 +516,10 @@
landAreaIndex = 0;
else if (numLandAreas == 2) {
uint32_t const weight1 =
- map_gen_info_->getArea(MapGenAreaInfo::atLand, 0).getWeight();
+ map_gen_info_->get_area(MapGenAreaInfo::atLand, 0).get_weight();
uint32_t const weight2 =
- map_gen_info_->getArea(MapGenAreaInfo::atLand, 1).getWeight();
- uint32_t const sum = map_gen_info_->getSumLandWeight();
+ map_gen_info_->get_area(MapGenAreaInfo::atLand, 1).get_weight();
+ uint32_t const sum = map_gen_info_->get_sum_land_weight();
if
(weight1 * (random2[c0.x + map_info_.w * c0.y] / sum)
>=
@@ -529,12 +529,12 @@
landAreaIndex = 1;
} else {
uint32_t const weight1 =
- map_gen_info_->getArea(MapGenAreaInfo::atLand, 0).getWeight();
+ map_gen_info_->get_area(MapGenAreaInfo::atLand, 0).get_weight();
uint32_t const weight2 =
- map_gen_info_->getArea(MapGenAreaInfo::atLand, 1).getWeight();
+ map_gen_info_->get_area(MapGenAreaInfo::atLand, 1).get_weight();
uint32_t const weight3 =
- map_gen_info_->getArea(MapGenAreaInfo::atLand, 2).getWeight();
- uint32_t const sum = map_gen_info_->getSumLandWeight();
+ map_gen_info_->get_area(MapGenAreaInfo::atLand, 2).get_weight();
+ uint32_t const sum = map_gen_info_->get_sum_land_weight();
uint32_t const randomX = (rand2 + rand3) / 2;
if
(weight1 * (rand2 / sum) > weight2 * (rand3 / sum) &&
@@ -557,14 +557,14 @@
// see whether it is water
- uint32_t const coast_h = map_gen_info_->getLandCoastHeight();
+ uint32_t const coast_h = map_gen_info_->get_land_coast_height();
if (h1 <= coast_h && h2 <= coast_h && h3 <= coast_h) { // water or coast...
atp = MapGenAreaInfo::atLand;
ttp = MapGenAreaInfo::ttLandCoast;
- uint32_t const ocean_h = map_gen_info_->getWaterOceanHeight();
- uint32_t const shelf_h = map_gen_info_->getWaterShelfHeight();
- uint32_t const shallow_h = map_gen_info_->getWaterShallowHeight();
+ uint32_t const ocean_h = map_gen_info_->get_water_ocean_height();
+ uint32_t const shelf_h = map_gen_info_->get_water_shelf_height();
+ uint32_t const shallow_h = map_gen_info_->get_water_shallow_height();
// TODO(unknown): The heights can not be lower than water-Shallow --
// there will never be an ocean yet
@@ -580,10 +580,10 @@
ttp = MapGenAreaInfo::ttWaterShallow;
}
} else { // it is not water
- uint32_t const upper_h = map_gen_info_->getLandUpperHeight ();
- uint32_t const foot_h = map_gen_info_->getMountainFootHeight();
- uint32_t const mount_h = map_gen_info_->getMountainHeight ();
- uint32_t const snow_h = map_gen_info_->getSnowHeight ();
+ uint32_t const upper_h = map_gen_info_->get_land_upper_height ();
+ uint32_t const foot_h = map_gen_info_->get_mountain_foot_height();
+ uint32_t const mount_h = map_gen_info_->get_mountain_height ();
+ uint32_t const snow_h = map_gen_info_->get_snow_height ();
if (h1 >= snow_h && h2 >= snow_h && h3 >= snow_h) {
atp = MapGenAreaInfo::atMountains;
ttp = MapGenAreaInfo::ttMountainsSnow;
@@ -616,11 +616,11 @@
// Figure out which terrain to use at this point in the map...
return
- map_gen_info_->getArea(atp, usedLandIndex).getTerrain
+ map_gen_info_->get_area(atp, usedLandIndex).get_terrain
(ttp,
rng.rand()
%
- map_gen_info_->getArea(atp, usedLandIndex).getNumTerrains(ttp));
+ map_gen_info_->get_area(atp, usedLandIndex).get_num_terrains(ttp));
}
@@ -663,9 +663,9 @@
// for bobs
std::unique_ptr<std::unique_ptr<uint32_t[]> []> random_bobs
- (new std::unique_ptr<uint32_t[]> [map_gen_info_->getNumLandResources()]);
+ (new std::unique_ptr<uint32_t[]> [map_gen_info_->get_num_land_resources()]);
- for (size_t ix = 0; ix < map_gen_info_->getNumLandResources(); ++ix)
+ for (size_t ix = 0; ix < map_gen_info_->get_num_land_resources(); ++ix)
random_bobs[ix].reset
(generate_random_value_map(map_info_.w, map_info_.h, rng));
@@ -871,7 +871,7 @@
===============
*/
-int UniqueRandomMapInfo::mapIdCharToNumber(char ch)
+int UniqueRandomMapInfo::map_id_char_to_number(char ch)
{
if ((ch == '0') || (ch == 'o') || (ch == 'O'))
return 22;
@@ -917,7 +917,7 @@
Return value: The converted value as a character
===============
*/
-char UniqueRandomMapInfo::mapIdNumberToChar(int32_t const num)
+char UniqueRandomMapInfo::map_id_number_to_char(int32_t const num)
{
if (num == 22)
return '0';
@@ -950,7 +950,7 @@
===============
*/
-bool UniqueRandomMapInfo::setFromIdString
+bool UniqueRandomMapInfo::set_from_id_string
(UniqueRandomMapInfo & mapInfo_out, const std::string & mapIdString)
{
// check string
@@ -967,7 +967,7 @@
int32_t nums[kMapIdDigits];
for (uint32_t ix = 0; ix < kMapIdDigits; ++ix) {
- int const num = mapIdCharToNumber(mapIdString[ix + (ix / 4)]);
+ int const num = map_id_char_to_number(mapIdString[ix + (ix / 4)]);
if (num < 0)
return false;
nums[ix] = num;
@@ -1050,7 +1050,7 @@
begin created (map specific info)
===============
*/
-void UniqueRandomMapInfo::generateIdString
+void UniqueRandomMapInfo::generate_id_string
(std::string & mapIdsString_out, const UniqueRandomMapInfo & mapInfo)
{
// Init
@@ -1070,7 +1070,7 @@
nums[ix] = 0;
// Generate world name hash
- uint16_t nameHash = generateWorldNameHash(mapInfo.world_name);
+ uint16_t nameHash = generate_world_name_hash(mapInfo.world_name);
// Convert map random number
nums [0] = mapInfo.mapNumber & 31;
@@ -1134,14 +1134,14 @@
// translate it to ASCII
for (uint32_t ix = 0; ix < kMapIdDigits; ++ix) {
- mapIdsString_out += mapIdNumberToChar(nums[ix]);
+ mapIdsString_out += map_id_number_to_char(nums[ix]);
if (ix % 4 == 3 && ix != kMapIdDigits - 1)
mapIdsString_out += "-";
}
}
-uint16_t Widelands::UniqueRandomMapInfo::generateWorldNameHash
+uint16_t Widelands::UniqueRandomMapInfo::generate_world_name_hash
(const std::string & name)
{
// This is only a simple digest algorithm. Thats enough for our purposes.
=== modified file 'src/editor/map_generator.h'
--- src/editor/map_generator.h 2014-09-10 10:18:46 +0000
+++ src/editor/map_generator.h 2014-09-29 13:33:11 +0000
@@ -63,15 +63,15 @@
bool islandMode; // whether the world will be an island
// other stuff
- static bool setFromIdString
+ static bool set_from_id_string
(UniqueRandomMapInfo & mapInfo_out, const std::string & mapIdString);
- static void generateIdString
+ static void generate_id_string
(std::string & mapIdsString_out, const UniqueRandomMapInfo & mapInfo);
private:
- static int mapIdCharToNumber(char);
- static char mapIdNumberToChar(int32_t);
- static uint16_t generateWorldNameHash(const std::string &);
+ static int map_id_char_to_number(char);
+ static char map_id_number_to_char(int32_t);
+ static uint16_t generate_world_name_hash(const std::string &);
};
=== modified file 'src/editor/tools/editor_decrease_resources_tool.cc'
--- src/editor/tools/editor_decrease_resources_tool.cc 2014-09-10 14:08:25 +0000
+++ src/editor/tools/editor_decrease_resources_tool.cc 2014-09-29 13:33:11 +0000
@@ -57,7 +57,7 @@
args.orgRes.push_back(mr.location().field->get_resources_amount());
if (res == args.cur_res &&
- Editor_Change_Resource_Tool_Callback(mr.location(), map, world, args.cur_res)) {
+ editor_change_resource_tool_callback(mr.location(), map, world, args.cur_res)) {
// Ok, we're doing something. First remove the current overlays.
std::string str =
world.get_resource(res)->get_editor_pic
=== modified file 'src/editor/tools/editor_increase_resources_tool.cc'
--- src/editor/tools/editor_increase_resources_tool.cc 2014-09-10 14:08:25 +0000
+++ src/editor/tools/editor_increase_resources_tool.cc 2014-09-29 13:33:11 +0000
@@ -46,7 +46,7 @@
} // namespace
-int32_t Editor_Change_Resource_Tool_Callback
+int32_t editor_change_resource_tool_callback
(const TCoords<Widelands::FCoords>& c, Widelands::Map& map,
const Widelands::World& world, int32_t const curres)
{
@@ -110,7 +110,7 @@
if
((res == args.cur_res || !mr.location().field->get_resources_amount())
&&
- Editor_Change_Resource_Tool_Callback(mr.location(), map, world, args.cur_res))
+ editor_change_resource_tool_callback(mr.location(), map, world, args.cur_res))
{
// Ok, we're doing something. First remove the current overlays.
const Image* pic =
=== modified file 'src/editor/tools/editor_increase_resources_tool.h'
--- src/editor/tools/editor_increase_resources_tool.h 2014-09-10 14:08:25 +0000
+++ src/editor/tools/editor_increase_resources_tool.h 2014-09-29 13:33:11 +0000
@@ -72,7 +72,7 @@
Widelands::ResourceIndex m_cur_res;
};
-int32_t Editor_Change_Resource_Tool_Callback
+int32_t editor_change_resource_tool_callback
(const Widelands::TCoords<Widelands::FCoords>& c, Widelands::Map& map,
const Widelands::World& world, int32_t const curres);
=== modified file 'src/editor/tools/editor_make_infrastructure_tool.cc'
--- src/editor/tools/editor_make_infrastructure_tool.cc 2014-09-10 14:08:25 +0000
+++ src/editor/tools/editor_make_infrastructure_tool.cc 2014-09-29 13:33:11 +0000
@@ -31,7 +31,7 @@
* Callback function to calculate correct overlays
*/
int32_t
-Editor_Make_Infrastructure_Tool_Callback
+editor_make_infrastructure_tool_callback
(const Widelands::TCoords<Widelands::FCoords>& c,
Widelands::EditorGameBase& egbase,
int32_t const player)
=== modified file 'src/editor/tools/editor_make_infrastructure_tool.h'
--- src/editor/tools/editor_make_infrastructure_tool.h 2014-09-10 14:08:25 +0000
+++ src/editor/tools/editor_make_infrastructure_tool.h 2014-09-29 13:33:11 +0000
@@ -53,7 +53,7 @@
UI::UniqueWindow::Registry m_registry;
};
-int32_t Editor_Make_Infrastructure_Tool_Callback
+int32_t editor_make_infrastructure_tool_callback
(const Widelands::TCoords<Widelands::FCoords>& c,
Widelands::EditorGameBase& egbase, int32_t const player);
=== modified file 'src/editor/tools/editor_set_port_space_tool.cc'
--- src/editor/tools/editor_set_port_space_tool.cc 2014-09-10 14:08:25 +0000
+++ src/editor/tools/editor_set_port_space_tool.cc 2014-09-29 13:33:11 +0000
@@ -30,7 +30,7 @@
using namespace Widelands;
/// static callback function for overlay calculation
-int32_t Editor_Tool_Set_Port_Space_Callback
+int32_t editor_Tool_set_port_space_callback
(const Widelands::TCoords<Widelands::FCoords>& c, Map& map)
{
NodeCaps const caps = c.field->nodecaps();
@@ -71,7 +71,7 @@
(map, Widelands::Area<Widelands::FCoords>(map.get_fcoords(center.node), args.sel_radius));
do {
// check if field is valid
- if (Editor_Tool_Set_Port_Space_Callback(mr.location(), map)) {
+ if (editor_Tool_set_port_space_callback(mr.location(), map)) {
map.set_port_space(mr.location(), true);
Area<FCoords> a(mr.location(), 0);
map.recalc_for_field_area(world, a);
@@ -106,7 +106,7 @@
(map, Widelands::Area<Widelands::FCoords>(map.get_fcoords(center.node), args.sel_radius));
do {
// check if field is valid
- if (Editor_Tool_Set_Port_Space_Callback(mr.location(), map)) {
+ if (editor_Tool_set_port_space_callback(mr.location(), map)) {
map.set_port_space(mr.location(), false);
Area<FCoords> a(mr.location(), 0);
map.recalc_for_field_area(world, a);
=== modified file 'src/editor/tools/editor_set_port_space_tool.h'
--- src/editor/tools/editor_set_port_space_tool.h 2014-09-10 14:08:25 +0000
+++ src/editor/tools/editor_set_port_space_tool.h 2014-09-29 13:33:11 +0000
@@ -67,7 +67,7 @@
char const * get_sel_impl() const override {return FSEL_ESPS_FILENAME;}
};
-int32_t Editor_Tool_Set_Port_Space_Callback
+int32_t editor_Tool_set_port_space_callback
(const Widelands::TCoords<Widelands::FCoords>& c, Widelands::Map& map);
#endif // end of include guard: WL_EDITOR_TOOLS_EDITOR_SET_PORT_SPACE_TOOL_H
=== modified file 'src/editor/tools/editor_set_resources_tool.cc'
--- src/editor/tools/editor_set_resources_tool.cc 2014-09-10 14:08:25 +0000
+++ src/editor/tools/editor_set_resources_tool.cc 2014-09-29 13:33:11 +0000
@@ -55,7 +55,7 @@
args.orgResT.push_back(res);
args.orgRes.push_back(mr.location().field->get_resources_amount());
- if (Editor_Change_Resource_Tool_Callback(mr.location(), map, world, args.cur_res)) {
+ if (editor_change_resource_tool_callback(mr.location(), map, world, args.cur_res)) {
// Ok, we're doing something. First remove the current overlays.
const Image* pic = g_gr->images().get
(world.get_resource(res)->get_editor_pic (mr.location().field->get_resources_amount()));
=== modified file 'src/editor/tools/editor_set_starting_pos_tool.cc'
--- src/editor/tools/editor_set_starting_pos_tool.cc 2014-09-10 14:08:25 +0000
+++ src/editor/tools/editor_set_starting_pos_tool.cc 2014-09-29 13:33:11 +0000
@@ -32,7 +32,7 @@
/*
* static callback function for overlay calculation
*/
-int32_t Editor_Tool_Set_Starting_Pos_Callback
+int32_t editor_tool_set_starting_pos_callback
(const Widelands::TCoords<Widelands::FCoords>& c, Widelands::Map& map)
{
// Area around already placed players
@@ -88,7 +88,7 @@
const Image* pic = g_gr->images().get(picname);
// check if field is valid
- if (Editor_Tool_Set_Starting_Pos_Callback(map.get_fcoords(center.node), map)) {
+ if (editor_tool_set_starting_pos_callback(map.get_fcoords(center.node), map)) {
OverlayManager & overlay_manager = map.overlay_manager();
// remove old overlay if any
overlay_manager.remove_overlay(old_sp, pic);
=== modified file 'src/editor/tools/editor_set_starting_pos_tool.h'
--- src/editor/tools/editor_set_starting_pos_tool.h 2014-09-10 14:08:25 +0000
+++ src/editor/tools/editor_set_starting_pos_tool.h 2014-09-29 13:33:11 +0000
@@ -51,7 +51,7 @@
char const * m_current_sel_pic;
};
-int32_t Editor_Tool_Set_Starting_Pos_Callback
+int32_t editor_tool_set_starting_pos_callback
(const Widelands::TCoords<Widelands::FCoords>& c, Widelands::Map& map);
#endif // end of include guard: WL_EDITOR_TOOLS_EDITOR_SET_STARTING_POS_TOOL_H
=== modified file 'src/editor/ui_menus/editor_main_menu_load_map.cc'
--- src/editor/ui_menus/editor_main_menu_load_map.cc 2014-09-23 09:26:48 +0000
+++ src/editor/ui_menus/editor_main_menu_load_map.cc 2014-09-29 13:33:11 +0000
@@ -138,7 +138,7 @@
void MainMenuLoadMap::clicked_ok() {
const char * const filename(m_ls->get_selected());
- if (g_fs->IsDirectory(filename) && !WidelandsMapLoader::is_widelands_map(filename)) {
+ if (g_fs->is_directory(filename) && !WidelandsMapLoader::is_widelands_map(filename)) {
m_curdir = filename;
m_ls->clear();
m_mapfiles.clear();
@@ -157,7 +157,7 @@
m_ok_btn->set_enabled(true);
- if (!g_fs->IsDirectory(name) || WidelandsMapLoader::is_widelands_map(name)) {
+ if (!g_fs->is_directory(name) || WidelandsMapLoader::is_widelands_map(name)) {
Widelands::Map map;
{
std::unique_ptr<Widelands::MapLoader> map_loader = map.get_correct_loader(name);
@@ -196,7 +196,7 @@
*/
void MainMenuLoadMap::fill_list() {
// Fill it with all files we find.
- m_mapfiles = g_fs->ListDirectory(m_curdir);
+ m_mapfiles = g_fs->list_directory(m_curdir);
// First, we add all directories. We manually add the parent directory.
if (m_curdir != m_basedir) {
@@ -222,13 +222,13 @@
{
const char * const name = pname->c_str();
if
- (strcmp(FileSystem::FS_Filename(name), ".") &&
- strcmp(FileSystem::FS_Filename(name), "..") &&
- g_fs->IsDirectory(name) &&
+ (strcmp(FileSystem::fs_filename(name), ".") &&
+ strcmp(FileSystem::fs_filename(name), "..") &&
+ g_fs->is_directory(name) &&
!WidelandsMapLoader::is_widelands_map(name))
m_ls->add
- (FileSystem::FS_Filename(name),
+ (FileSystem::fs_filename(name),
name,
g_gr->images().get("pics/ls_dir.png"));
}
@@ -246,7 +246,7 @@
try {
map_loader->preload_map(true);
m_ls->add
- (FileSystem::FS_Filename(name),
+ (FileSystem::fs_filename(name),
name,
g_gr->images().get
(dynamic_cast<WidelandsMapLoader*>(map_loader.get())
=== modified file 'src/editor/ui_menus/editor_main_menu_map_options.cc'
--- src/editor/ui_menus/editor_main_menu_map_options.cc 2014-09-10 14:48:40 +0000
+++ src/editor/ui_menus/editor_main_menu_map_options.cc 2014-09-29 13:33:11 +0000
@@ -116,8 +116,8 @@
char buf[200];
sprintf(buf, "%ix%i", map.get_width(), map.get_height());
m_size->set_text(buf);
- m_author->setText(map.get_author());
- m_name ->setText(map.get_name());
+ m_author->set_text(map.get_author());
+ m_name ->set_text(map.get_name());
sprintf(buf, "%i", map.get_nrplayers());
m_nrplayers->set_text(buf);
m_descr ->set_text(map.get_description());
=== modified file 'src/editor/ui_menus/editor_main_menu_random_map.cc'
--- src/editor/ui_menus/editor_main_menu_random_map.cc 2014-09-14 12:13:35 +0000
+++ src/editor/ui_menus/editor_main_menu_random_map.cc 2014-09-29 13:33:11 +0000
@@ -90,7 +90,7 @@
m_mapNumber = rng.rand();
snprintf
(buffer, sizeof(buffer), "%u", static_cast<unsigned int>(m_mapNumber));
- m_nrEditbox->setText(buffer);
+ m_nrEditbox->set_text(buffer);
posy += height + spacing + spacing + spacing;
@@ -297,7 +297,7 @@
posx, posy,
width, 20,
g_gr->images().get("pics/but1.png"));
- m_idEditbox->setText("abcd-efgh-ijkl-mnop");
+ m_idEditbox->set_text("abcd-efgh-ijkl-mnop");
m_idEditbox->changed.connect
(boost::bind(&MainMenuNewRandomMap::id_edit_box_changed, this));
posy += height + spacing + spacing + spacing;
@@ -499,12 +499,12 @@
std::string str = m_idEditbox->text();
- if (!UniqueRandomMapInfo::setFromIdString(mapInfo, str))
+ if (!UniqueRandomMapInfo::set_from_id_string(mapInfo, str))
m_goButton->set_enabled(false);
else {
std::stringstream sstrm;
sstrm << mapInfo.mapNumber;
- m_nrEditbox->setText(sstrm.str());
+ m_nrEditbox->set_text(sstrm.str());
m_h = 0;
for (uint32_t ix = 0; ix < NUMBER_OF_MAP_DIMENSIONS; ++ix)
@@ -545,9 +545,9 @@
set_map_info(mapInfo);
std::string idStr;
- Widelands::UniqueRandomMapInfo::generateIdString(idStr, mapInfo);
+ Widelands::UniqueRandomMapInfo::generate_id_string(idStr, mapInfo);
- m_idEditbox->setText(idStr);
+ m_idEditbox->set_text(idStr);
m_goButton->set_enabled(true);
} else
=== modified file 'src/editor/ui_menus/editor_main_menu_save_map.cc'
--- src/editor/ui_menus/editor_main_menu_save_map.cc 2014-09-23 09:26:48 +0000
+++ src/editor/ui_menus/editor_main_menu_save_map.cc 2014-09-29 13:33:11 +0000
@@ -73,7 +73,7 @@
posx, posy + get_inner_h() - spacing - offsy - 60 + 3,
get_inner_w() / 2 - spacing, 20,
g_gr->images().get("pics/but1.png"));
- m_editbox->setText(parent.egbase().map().get_name());
+ m_editbox->set_text(parent.egbase().map().get_name());
m_editbox->changed.connect(boost::bind(&MainMenuSaveMap::edit_box_changed, this));
posx = get_inner_w() / 2 + spacing;
@@ -164,11 +164,11 @@
filename = m_ls->get_selected();
if
- (g_fs->IsDirectory(filename.c_str())
+ (g_fs->is_directory(filename.c_str())
&&
!Widelands::WidelandsMapLoader::is_widelands_map(filename))
{
- m_curdir = g_fs->FS_CanonicalizeName(filename);
+ m_curdir = g_fs->canonicalize_name(filename);
m_ls->clear();
m_mapfiles.clear();
fill_list();
@@ -200,12 +200,12 @@
void MainMenuSaveMap::clicked_make_directory() {
MainMenuSaveMapMakeDirectory md(this, _("unnamed"));
if (md.run()) {
- g_fs->EnsureDirectoryExists(m_basedir);
+ g_fs->ensure_directory_exists(m_basedir);
// create directory
std::string fullname = m_curdir;
fullname += "/";
fullname += md.get_dirname();
- g_fs->MakeDirectory(fullname);
+ g_fs->make_directory(fullname);
m_ls->clear();
m_mapfiles.clear();
fill_list();
@@ -226,7 +226,7 @@
ml->preload_map(true); // This has worked before, no problem
}
- m_editbox->setText(FileSystem::FS_Filename(name));
+ m_editbox->set_text(FileSystem::fs_filename(name));
m_name ->set_text(map.get_name ());
m_author->set_text(map.get_author ());
@@ -239,11 +239,11 @@
sprintf(buf, "%ix%i", map.get_width(), map.get_height());
m_size->set_text(buf);
} else {
- m_name ->set_text(FileSystem::FS_Filename(name));
+ m_name ->set_text(FileSystem::fs_filename(name));
m_author ->set_text("");
m_nrplayers->set_text("");
m_size ->set_text("");
- if (g_fs->IsDirectory(name)) {
+ if (g_fs->is_directory(name)) {
std::string dir_string =
(boost::format("\\<%s\\>") % _("directory")).str();
m_descr ->set_text(dir_string);
@@ -263,7 +263,7 @@
void MainMenuSaveMap::double_clicked_item(uint32_t) {
const char * const name = m_ls->get_selected();
- if (g_fs->IsDirectory(name) && !Widelands::WidelandsMapLoader::is_widelands_map(name)) {
+ if (g_fs->is_directory(name) && !Widelands::WidelandsMapLoader::is_widelands_map(name)) {
m_curdir = name;
m_ls->clear();
m_mapfiles.clear();
@@ -277,7 +277,7 @@
*/
void MainMenuSaveMap::fill_list() {
// Fill it with all files we find.
- m_mapfiles = g_fs->ListDirectory(m_curdir);
+ m_mapfiles = g_fs->list_directory(m_curdir);
// First, we add all directories. We manually add the parent directory
if (m_curdir != m_basedir) {
@@ -303,13 +303,13 @@
{
const char * const name = pname->c_str();
if
- (strcmp(FileSystem::FS_Filename(name), ".") &&
- strcmp(FileSystem::FS_Filename(name), "..") &&
- g_fs->IsDirectory(name) &&
+ (strcmp(FileSystem::fs_filename(name), ".") &&
+ strcmp(FileSystem::fs_filename(name), "..") &&
+ g_fs->is_directory(name) &&
!Widelands::WidelandsMapLoader::is_widelands_map(name))
m_ls->add
- (FileSystem::FS_Filename(name),
+ (FileSystem::fs_filename(name),
name,
g_gr->images().get("pics/ls_dir.png"));
}
@@ -329,7 +329,7 @@
try {
wml->preload_map(true);
m_ls->add
- (FileSystem::FS_Filename(name),
+ (FileSystem::fs_filename(name),
name,
g_gr->images().get("pics/ls_wlmap.png"));
} catch (const WException &) {} // we simply skip illegal entries
@@ -355,7 +355,7 @@
*/
bool MainMenuSaveMap::save_map(std::string filename, bool binary) {
// Make sure that the base directory exists.
- g_fs->EnsureDirectoryExists(m_basedir);
+ g_fs->ensure_directory_exists(m_basedir);
// OK, first check if the extension matches (ignoring case).
bool assign_extension = true;
@@ -375,20 +375,20 @@
complete_filename += filename;
// Check if file exists. If so, show a warning.
- if (g_fs->FileExists(complete_filename)) {
+ if (g_fs->file_exists(complete_filename)) {
std::string s =
(boost::format(_("A file with the name ‘%s’ already exists. Overwrite?"))
- % FileSystem::FS_Filename(filename.c_str())).str();
+ % FileSystem::fs_filename(filename.c_str())).str();
UI::WLMessageBox mbox
(&eia(), _("Error Saving Map!"), s, UI::WLMessageBox::YESNO);
if (!mbox.run())
return false;
- g_fs->Unlink(complete_filename);
+ g_fs->fs_unlink(complete_filename);
}
std::unique_ptr<FileSystem> fs
- (g_fs->CreateSubFileSystem(complete_filename, binary ? FileSystem::ZIP : FileSystem::DIR));
+ (g_fs->create_sub_file_system(complete_filename, binary ? FileSystem::ZIP : FileSystem::DIR));
Widelands::MapSaver wms(*fs, eia().egbase());
try {
wms.save();
=== modified file 'src/editor/ui_menus/editor_main_menu_save_map_make_directory.cc'
--- src/editor/ui_menus/editor_main_menu_save_map_make_directory.cc 2014-09-10 14:08:25 +0000
+++ src/editor/ui_menus/editor_main_menu_save_map_make_directory.cc 2014-09-29 13:33:11 +0000
@@ -42,7 +42,7 @@
new UI::EditBox
(this, spacing, posy, get_inner_w() - 2 * spacing, 20,
g_gr->images().get("pics/but1.png"));
- m_edit->setText(dirname);
+ m_edit->set_text(dirname);
m_dirname = dirname;
m_edit->changed.connect(boost::bind(&MainMenuSaveMapMakeDirectory::edit_changed, this));
=== modified file 'src/editor/ui_menus/editor_player_menu.cc'
--- src/editor/ui_menus/editor_player_menu.cc 2014-09-10 14:08:25 +0000
+++ src/editor/ui_menus/editor_player_menu.cc 2014-09-29 13:33:11 +0000
@@ -147,7 +147,7 @@
m_plr_names[p - 1]->changed.connect
(boost::bind(&EditorPlayerMenu::name_changed, this, p - 1));
posx += 140 + spacing;
- m_plr_names[p - 1]->setText(map.get_scenario_player_name(p));
+ m_plr_names[p - 1]->set_text(map.get_scenario_player_name(p));
}
if (!m_plr_set_tribes_buts[p - 1]) {
@@ -356,7 +356,7 @@
// Register callback function to make sure that only valid locations are
// selected.
map.overlay_manager().register_overlay_callback_function(
- boost::bind(&Editor_Tool_Set_Starting_Pos_Callback, _1, boost::ref(map)));
+ boost::bind(&editor_tool_set_starting_pos_callback, _1, boost::ref(map)));
map.recalc_whole_map(menu.egbase().world());
update();
}
@@ -372,10 +372,10 @@
Widelands::Map & map = menu.egbase().map();
if (text == "") {
text = map.get_scenario_player_name(m + 1);
- m_plr_names[m]->setText(text);
+ m_plr_names[m]->set_text(text);
}
map.set_scenario_player_name(m + 1, text);
- m_plr_names[m]->setText(map.get_scenario_player_name(m + 1));
+ m_plr_names[m]->set_text(map.get_scenario_player_name(m + 1));
menu.set_need_save(true);
}
@@ -441,6 +441,6 @@
parent.select_tool(parent.tools.make_infrastructure, EditorTool::First);
parent.tools.make_infrastructure.set_player(n);
overlay_manager.register_overlay_callback_function(
- boost::bind(&Editor_Make_Infrastructure_Tool_Callback, _1, boost::ref(egbase), n));
+ boost::bind(&editor_make_infrastructure_tool_callback, _1, boost::ref(egbase), n));
map.recalc_whole_map(egbase.world());
}
=== modified file 'src/editor/ui_menus/editor_tool_change_resources_options_menu.cc'
--- src/editor/ui_menus/editor_tool_change_resources_options_menu.cc 2014-09-10 14:08:25 +0000
+++ src/editor/ui_menus/editor_tool_change_resources_options_menu.cc 2014-09-29 13:33:11 +0000
@@ -215,7 +215,7 @@
Widelands::EditorGameBase& egbase = ref_cast<EditorInteractive, UI::Panel>(*get_parent()).egbase();
Widelands::Map & map = egbase.map();
map.overlay_manager().register_overlay_callback_function(
- boost::bind(&Editor_Change_Resource_Tool_Callback, _1, boost::ref(map), boost::ref(egbase.world()), n));
+ boost::bind(&editor_change_resource_tool_callback, _1, boost::ref(map), boost::ref(egbase.world()), n));
map.recalc_whole_map(egbase.world());
select_correct_tool();
=== modified file 'src/editor/ui_menus/editor_tool_menu.cc'
--- src/editor/ui_menus/editor_tool_menu.cc 2014-09-10 14:08:25 +0000
+++ src/editor/ui_menus/editor_tool_menu.cc 2014-09-29 13:33:11 +0000
@@ -142,7 +142,7 @@
// Set correct overlay
Widelands::Map & map = parent.egbase().map();
map.overlay_manager().register_overlay_callback_function(
- boost::bind(&Editor_Tool_Set_Port_Space_Callback, _1, boost::ref(map)));
+ boost::bind(&editor_Tool_set_port_space_callback, _1, boost::ref(map)));
map.recalc_whole_map(parent.egbase().world());
update();
}
=== modified file 'src/game_io/game_class_packet.cc'
--- src/game_io/game_class_packet.cc 2014-09-10 08:55:04 +0000
+++ src/game_io/game_class_packet.cc 2014-09-29 13:33:11 +0000
@@ -29,16 +29,16 @@
#define CURRENT_PACKET_VERSION 2
-void GameClassPacket::Read
+void GameClassPacket::read
(FileSystem & fs, Game & game, MapObjectLoader *)
{
try {
FileRead fr;
- fr.Open(fs, "binary/game_class");
- uint16_t const packet_version = fr.Unsigned16();
+ fr.open(fs, "binary/game_class");
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version <= CURRENT_PACKET_VERSION) {
- fr.Signed16(); // This used to be game speed
- game.gametime_ = fr.Unsigned32();
+ fr.signed_16(); // This used to be game speed
+ game.gametime_ = fr.unsigned_32();
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -50,17 +50,17 @@
/*
* Write Function
*/
-void GameClassPacket::Write
+void GameClassPacket::write
(FileSystem & fs, Game & game, MapObjectSaver * const)
{
FileWrite fw;
// Packet version
- fw.Unsigned16(CURRENT_PACKET_VERSION);
+ fw.unsigned_16(CURRENT_PACKET_VERSION);
// State is running, we do not need to save this
// Save speed
- fw.Signed16(1000);
+ fw.signed_16(1000);
// From the interactive player, is saved somewhere else
// Computer players are saved somewhere else
@@ -70,7 +70,7 @@
// EDITOR GAME CLASS
// Write gametime
- fw.Unsigned32(game.gametime_);
+ fw.unsigned_32(game.gametime_);
// We do not care for players, since they were set
// on game initialization to match Map::scenario_player_[names|tribes]
@@ -85,7 +85,7 @@
// Track pointers are not saved in save games
- fw.Write(fs, "binary/game_class");
+ fw.write(fs, "binary/game_class");
}
}
=== modified file 'src/game_io/game_class_packet.h'
--- src/game_io/game_class_packet.h 2014-09-10 16:57:31 +0000
+++ src/game_io/game_class_packet.h 2014-09-29 13:33:11 +0000
@@ -29,8 +29,8 @@
* a game for a user (for example in a listbox)
*/
struct GameClassPacket : public GameDataPacket {
- void Read (FileSystem &, Game &, MapObjectLoader * = nullptr) override;
- void Write(FileSystem &, Game &, MapObjectSaver * = nullptr) override;
+ void read (FileSystem &, Game &, MapObjectLoader * = nullptr) override;
+ void write(FileSystem &, Game &, MapObjectSaver * = nullptr) override;
};
}
=== modified file 'src/game_io/game_cmd_queue_packet.cc'
--- src/game_io/game_cmd_queue_packet.cc 2014-09-14 16:08:13 +0000
+++ src/game_io/game_cmd_queue_packet.cc 2014-09-29 13:33:11 +0000
@@ -32,47 +32,47 @@
#define CURRENT_PACKET_VERSION 2
-void GameCmdQueuePacket::Read
+void GameCmdQueuePacket::read
(FileSystem & fs, Game & game, MapObjectLoader * const ol)
{
try {
FileRead fr;
- fr.Open(fs, "binary/cmd_queue");
- uint16_t const packet_version = fr.Unsigned16();
+ fr.open(fs, "binary/cmd_queue");
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == CURRENT_PACKET_VERSION) {
CmdQueue & cmdq = game.cmdqueue();
// nothing to be done for m_game
// Next serial
- cmdq.nextserial = fr.Unsigned32();
+ cmdq.nextserial = fr.unsigned_32();
// Erase all currently pending commands in the queue
cmdq.flush();
for (;;) {
- uint32_t const packet_id = fr.Unsigned16();
+ uint32_t const packet_id = fr.unsigned_16();
if (!packet_id)
break;
CmdQueue::CmdItem item;
- item.category = fr.Signed32();
- item.serial = fr.Unsigned32();
+ item.category = fr.signed_32();
+ item.serial = fr.unsigned_32();
if (packet_id == 129) {
// For backwards compatibility with savegames up to build15:
// Discard old CheckEventChain commands
- fr.Unsigned16(); // CheckEventChain version
- fr.Unsigned16(); // GameLogicCommand version
- fr.Unsigned32(); // GameLogicCommand duetime
- fr.Unsigned16(); // CheckEventChain ID
+ fr.unsigned_16(); // CheckEventChain version
+ fr.unsigned_16(); // GameLogicCommand version
+ fr.unsigned_32(); // GameLogicCommand duetime
+ fr.unsigned_16(); // CheckEventChain ID
continue;
}
GameLogicCommand & cmd =
QueueCmdFactory::create_correct_queue_command(packet_id);
- cmd.Read(fr, game, *ol);
+ cmd.read(fr, game, *ol);
item.cmd = &cmd;
@@ -88,20 +88,20 @@
}
-void GameCmdQueuePacket::Write
+void GameCmdQueuePacket::write
(FileSystem & fs, Game & game, MapObjectSaver * const os)
{
FileWrite fw;
// Now packet version
- fw.Unsigned16(CURRENT_PACKET_VERSION);
+ fw.unsigned_16(CURRENT_PACKET_VERSION);
const CmdQueue & cmdq = game.cmdqueue();
// nothing to be done for m_game
// Next serial
- fw.Unsigned32(cmdq.nextserial);
+ fw.unsigned_32(cmdq.nextserial);
// Write all commands
@@ -118,14 +118,14 @@
if (it.cmd->duetime() == time) {
if (upcast(GameLogicCommand, cmd, it.cmd)) {
// The id (aka command type)
- fw.Unsigned16(cmd->id());
+ fw.unsigned_16(cmd->id());
// Serial number
- fw.Signed32(it.category);
- fw.Unsigned32(it.serial);
+ fw.signed_32(it.category);
+ fw.unsigned_32(it.serial);
// Now the command itself
- cmd->Write(fw, game, *os);
+ cmd->write(fw, game, *os);
}
++ nhandled;
}
@@ -137,9 +137,9 @@
}
- fw.Unsigned16(0); // end of command queue
+ fw.unsigned_16(0); // end of command queue
- fw.Write(fs, "binary/cmd_queue");
+ fw.write(fs, "binary/cmd_queue");
}
}
=== modified file 'src/game_io/game_cmd_queue_packet.h'
--- src/game_io/game_cmd_queue_packet.h 2014-09-10 16:57:31 +0000
+++ src/game_io/game_cmd_queue_packet.h 2014-09-29 13:33:11 +0000
@@ -31,8 +31,8 @@
* a game for a user (for example in a listbox)
*/
struct GameCmdQueuePacket : public GameDataPacket {
- void Read (FileSystem &, Game &, MapObjectLoader * = nullptr) override;
- void Write(FileSystem &, Game &, MapObjectSaver * = nullptr) override;
+ void read (FileSystem &, Game &, MapObjectLoader * = nullptr) override;
+ void write(FileSystem &, Game &, MapObjectSaver * = nullptr) override;
};
}
=== modified file 'src/game_io/game_data_packet.h'
--- src/game_io/game_data_packet.h 2014-09-10 07:57:29 +0000
+++ src/game_io/game_data_packet.h 2014-09-29 13:33:11 +0000
@@ -40,8 +40,8 @@
*/
struct GameDataPacket {
virtual ~GameDataPacket() {}
- virtual void Read (FileSystem &, Game &, MapObjectLoader * = nullptr) = 0;
- virtual void Write(FileSystem &, Game &, MapObjectSaver * = nullptr) = 0;
+ virtual void read (FileSystem &, Game &, MapObjectLoader * = nullptr) = 0;
+ virtual void write(FileSystem &, Game &, MapObjectSaver * = nullptr) = 0;
};
}
=== modified file 'src/game_io/game_interactive_player_packet.cc'
--- src/game_io/game_interactive_player_packet.cc 2014-09-10 13:03:40 +0000
+++ src/game_io/game_interactive_player_packet.cc 2014-09-29 13:33:11 +0000
@@ -34,15 +34,15 @@
#define CURRENT_PACKET_VERSION 2
-void GameInteractivePlayerPacket::Read
+void GameInteractivePlayerPacket::read
(FileSystem & fs, Game & game, MapObjectLoader *)
{
try {
FileRead fr;
- fr.Open(fs, "binary/interactive_player");
- uint16_t const packet_version = fr.Unsigned16();
+ fr.open(fs, "binary/interactive_player");
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == CURRENT_PACKET_VERSION) {
- PlayerNumber player_number = fr.Unsigned8();
+ PlayerNumber player_number = fr.unsigned_8();
if (!(0 < player_number && player_number <= game.map().get_nrplayers())) {
throw GameDataError("Invalid player number: %i.", player_number);
}
@@ -59,9 +59,9 @@
if (player_number > max)
throw GameDataError("The game has no players!");
}
- int32_t const x = fr.Unsigned16();
- int32_t const y = fr.Unsigned16();
- uint32_t const display_flags = fr.Unsigned32();
+ int32_t const x = fr.unsigned_16();
+ int32_t const y = fr.unsigned_16();
+ uint32_t const display_flags = fr.unsigned_32();
if (InteractiveBase * const ibase = game.get_ibase()) {
ibase->set_viewpoint(Point(x, y), true);
@@ -88,32 +88,32 @@
/*
* Write Function
*/
-void GameInteractivePlayerPacket::Write
+void GameInteractivePlayerPacket::write
(FileSystem & fs, Game & game, MapObjectSaver * const)
{
FileWrite fw;
// Now packet version
- fw.Unsigned16(CURRENT_PACKET_VERSION);
+ fw.unsigned_16(CURRENT_PACKET_VERSION);
InteractiveBase * const ibase = game.get_ibase();
InteractivePlayer * const iplayer = game.get_ipl();
// Player number
- fw.Unsigned8(iplayer ? iplayer->player_number() : 1);
+ fw.unsigned_8(iplayer ? iplayer->player_number() : 1);
// Map Position
if (ibase) {
assert(0 <= ibase->get_viewpoint().x);
assert(0 <= ibase->get_viewpoint().y);
}
- fw.Unsigned16(ibase ? ibase->get_viewpoint().x : 0);
- fw.Unsigned16(ibase ? ibase->get_viewpoint().y : 0);
+ fw.unsigned_16(ibase ? ibase->get_viewpoint().x : 0);
+ fw.unsigned_16(ibase ? ibase->get_viewpoint().y : 0);
// Display flags
- fw.Unsigned32(ibase ? ibase->get_display_flags() : 0);
+ fw.unsigned_32(ibase ? ibase->get_display_flags() : 0);
- fw.Write(fs, "binary/interactive_player");
+ fw.write(fs, "binary/interactive_player");
}
}
=== modified file 'src/game_io/game_interactive_player_packet.h'
--- src/game_io/game_interactive_player_packet.h 2014-09-10 16:57:31 +0000
+++ src/game_io/game_interactive_player_packet.h 2014-09-29 13:33:11 +0000
@@ -29,8 +29,8 @@
* player number and so on
*/
struct GameInteractivePlayerPacket : public GameDataPacket {
- void Read (FileSystem &, Game &, MapObjectLoader * = nullptr) override;
- void Write(FileSystem &, Game &, MapObjectSaver * = nullptr) override;
+ void read (FileSystem &, Game &, MapObjectLoader * = nullptr) override;
+ void write(FileSystem &, Game &, MapObjectSaver * = nullptr) override;
};
}
=== modified file 'src/game_io/game_loader.cc'
--- src/game_io/game_loader.cc 2014-09-18 18:56:20 +0000
+++ src/game_io/game_loader.cc 2014-09-29 13:33:11 +0000
@@ -39,7 +39,7 @@
namespace Widelands {
GameLoader::GameLoader(const std::string & path, Game & game) :
- m_fs(*g_fs->MakeSubFileSystem(path)), m_game(game)
+ m_fs(*g_fs->make_sub_file_system(path)), m_game(game)
{}
@@ -52,7 +52,7 @@
*/
int32_t GameLoader::preload_game(GamePreloadPacket & mp) {
// Load elemental data block
- mp.Read(m_fs, m_game, nullptr);
+ mp.read(m_fs, m_game, nullptr);
return 0;
}
@@ -64,33 +64,33 @@
ScopedTimer timer("GameLoader::load() took %ums");
log("Game: Reading Preload Data ... ");
- {GamePreloadPacket p; p.Read(m_fs, m_game);}
+ {GamePreloadPacket p; p.read(m_fs, m_game);}
log("took %ums\n", timer.ms_since_last_query());
log("Game: Reading Game Class Data ... ");
- {GameClassPacket p; p.Read(m_fs, m_game);}
+ {GameClassPacket p; p.read(m_fs, m_game);}
log("took %ums\n", timer.ms_since_last_query());
log("Game: Reading Map Data ... ");
- GameMapPacket M; M.Read(m_fs, m_game);
+ GameMapPacket M; M.read(m_fs, m_game);
log("Game: Reading Map Data took %ums\n", timer.ms_since_last_query());
log("Game: Reading Player Info ... ");
- {GamePlayerInfoPacket p; p.Read(m_fs, m_game);}
+ {GamePlayerInfoPacket p; p.read(m_fs, m_game);}
log("Game: Reading Player Info took %ums\n", timer.ms_since_last_query());
- log("Game: Calling Read_Complete()\n");
- M.Read_Complete(m_game);
- log("Game: Read_Complete took: %ums\n", timer.ms_since_last_query());
+ log("Game: Calling read_complete()\n");
+ M.read_complete(m_game);
+ log("Game: read_complete took: %ums\n", timer.ms_since_last_query());
MapObjectLoader * const mol = M.get_map_object_loader();
log("Game: Reading Player Economies Info ... ");
- {GamePlayerEconomiesPacket p; p.Read(m_fs, m_game, mol);}
+ {GamePlayerEconomiesPacket p; p.read(m_fs, m_game, mol);}
log("took %ums\n", timer.ms_since_last_query());
log("Game: Reading Command Queue Data ... ");
- {GameCmdQueuePacket p; p.Read(m_fs, m_game, mol);}
+ {GameCmdQueuePacket p; p.read(m_fs, m_game, mol);}
log("took %ums\n", timer.ms_since_last_query());
// This must be after the command queue has been read.
@@ -120,7 +120,7 @@
// player.
if (!multiplayer) {
log("Game: Reading Interactive Player Data ... ");
- {GameInteractivePlayerPacket p; p.Read(m_fs, m_game, mol);}
+ {GameInteractivePlayerPacket p; p.read(m_fs, m_game, mol);}
log("took %ums\n", timer.ms_since_last_query());
}
=== modified file 'src/game_io/game_map_packet.cc'
--- src/game_io/game_map_packet.cc 2014-09-10 07:57:29 +0000
+++ src/game_io/game_map_packet.cc 2014-09-29 13:33:11 +0000
@@ -34,16 +34,16 @@
delete m_wml;
}
-void GameMapPacket::Read
+void GameMapPacket::read
(FileSystem & fs, Game & game, MapObjectLoader * const)
{
- if (!fs.FileExists("map") || !fs.IsDirectory("map"))
+ if (!fs.file_exists("map") || !fs.is_directory("map"))
throw GameDataError("no map");
// Now Load the map as it would be a normal map saving.
delete m_wml;
- m_wml = new WidelandsMapLoader(fs.MakeSubFileSystem("map"), &game.map());
+ m_wml = new WidelandsMapLoader(fs.make_sub_file_system("map"), &game.map());
m_wml->preload_map(true);
@@ -53,18 +53,18 @@
}
-void GameMapPacket::Read_Complete(Game & game) {
+void GameMapPacket::read_complete(Game & game) {
m_wml->load_map_complete(game, true);
m_mol = m_wml->get_map_object_loader();
}
-void GameMapPacket::Write
+void GameMapPacket::write
(FileSystem & fs, Game & game, MapObjectSaver * const)
{
std::unique_ptr<FileSystem> mapfs
- (fs.CreateSubFileSystem("map", FileSystem::DIR));
+ (fs.create_sub_file_system("map", FileSystem::DIR));
// Now Write the map as it would be a normal map saving.
delete m_wms;
=== modified file 'src/game_io/game_map_packet.h'
--- src/game_io/game_map_packet.h 2014-09-10 16:57:31 +0000
+++ src/game_io/game_map_packet.h 2014-09-29 13:33:11 +0000
@@ -36,11 +36,11 @@
/// Ensures that the world gets loaded but does not much more.
- void Read (FileSystem &, Game &, MapObjectLoader * = nullptr) override;
-
- void Read_Complete(Game &); /// Loads the rest of the map.
-
- void Write(FileSystem &, Game &, MapObjectSaver * = nullptr) override;
+ void read (FileSystem &, Game &, MapObjectLoader * = nullptr) override;
+
+ void read_complete(Game &); /// Loads the rest of the map.
+
+ void write(FileSystem &, Game &, MapObjectSaver * = nullptr) override;
MapObjectSaver * get_map_object_saver () {return m_mos;}
MapObjectLoader * get_map_object_loader() {return m_mol;}
=== modified file 'src/game_io/game_player_economies_packet.cc'
--- src/game_io/game_player_economies_packet.cc 2014-09-10 08:55:04 +0000
+++ src/game_io/game_player_economies_packet.cc 2014-09-29 13:33:11 +0000
@@ -35,7 +35,7 @@
#define CURRENT_PACKET_VERSION 3
-void GamePlayerEconomiesPacket::Read
+void GamePlayerEconomiesPacket::read
(FileSystem & fs, Game & game, MapObjectLoader *)
{
try {
@@ -44,30 +44,30 @@
PlayerNumber const nr_players = map.get_nrplayers();
FileRead fr;
- fr.Open(fs, "binary/player_economies");
- uint16_t const packet_version = fr.Unsigned16();
+ fr.open(fs, "binary/player_economies");
+ uint16_t const packet_version = fr.unsigned_16();
if (3 <= packet_version && packet_version <= CURRENT_PACKET_VERSION) {
iterate_players_existing(p, nr_players, game, player)
try {
Player::Economies & economies = player->m_economies;
for (uint32_t i = 0; i < economies.size(); ++i) {
- uint32_t value = fr.Unsigned32();
+ uint32_t value = fr.unsigned_32();
if (value < 0xffffffff) {
if (upcast(Flag const, flag, map[value].get_immovable())) {
EconomyDataPacket d(flag->get_economy());
- d.Read(fr);
+ d.read(fr);
} else {
throw GameDataError("there is no flag at the specified location");
}
} else {
bool read_this_economy = false;
- Bob* bob = map[ReadMap_Index32(&fr, max_index)].get_first_bob();
+ Bob* bob = map[read_map_index_32(&fr, max_index)].get_first_bob();
while (bob) {
if (upcast(Ship const, ship, bob)) {
assert(ship->get_economy());
EconomyDataPacket d(ship->get_economy());
- d.Read(fr);
+ d.read(fr);
read_this_economy = true;
}
bob = bob->get_next_bob();
@@ -91,12 +91,12 @@
/*
* Write Function
*/
-void GamePlayerEconomiesPacket::Write
+void GamePlayerEconomiesPacket::write
(FileSystem & fs, Game & game, MapObjectSaver * const)
{
FileWrite fw;
- fw.Unsigned16(CURRENT_PACKET_VERSION);
+ fw.unsigned_16(CURRENT_PACKET_VERSION);
const Map & map = game.map();
const Field & field_0 = map[0];
@@ -110,10 +110,10 @@
for (Field const * field = &field_0; field < &map[map.max_index()]; ++field) {
if (upcast(Flag const, flag, field->get_immovable())) {
if (flag->get_economy() == temp_economy) {
- fw.Unsigned32(field - &field_0);
+ fw.unsigned_32(field - &field_0);
EconomyDataPacket d(flag->get_economy());
- d.Write(fw);
+ d.write(fw);
wrote_this_economy = true;
break;
}
@@ -131,11 +131,11 @@
if (upcast(Ship const, ship, bob)) {
if (ship->get_economy() == temp_economy) {
// TODO(sirver): the 0xffffffff is ugly and fragile.
- fw.Unsigned32(0xffffffff); // Sentinel value.
- fw.Unsigned32(field - &field_0);
+ fw.unsigned_32(0xffffffff); // Sentinel value.
+ fw.unsigned_32(field - &field_0);
EconomyDataPacket d(ship->get_economy());
- d.Write(fw);
+ d.write(fw);
wrote_this_economy = true;
}
}
@@ -149,7 +149,7 @@
}
}
- fw.Write(fs, "binary/player_economies");
+ fw.write(fs, "binary/player_economies");
}
}
=== modified file 'src/game_io/game_player_economies_packet.h'
--- src/game_io/game_player_economies_packet.h 2014-09-10 16:57:31 +0000
+++ src/game_io/game_player_economies_packet.h 2014-09-29 13:33:11 +0000
@@ -28,8 +28,8 @@
* how many and which economies does a player have?
*/
struct GamePlayerEconomiesPacket : public GameDataPacket {
- void Read (FileSystem &, Game &, MapObjectLoader * = nullptr) override;
- void Write(FileSystem &, Game &, MapObjectSaver * = nullptr) override;
+ void read (FileSystem &, Game &, MapObjectLoader * = nullptr) override;
+ void write(FileSystem &, Game &, MapObjectSaver * = nullptr) override;
};
}
=== modified file 'src/game_io/game_player_info_packet.cc'
--- src/game_io/game_player_info_packet.cc 2014-09-10 08:55:04 +0000
+++ src/game_io/game_player_info_packet.cc 2014-09-29 13:33:11 +0000
@@ -33,61 +33,61 @@
#define CURRENT_PACKET_VERSION 15
-void GamePlayerInfoPacket::Read
+void GamePlayerInfoPacket::read
(FileSystem & fs, Game & game, MapObjectLoader *)
{
try {
FileRead fr;
- fr.Open(fs, "binary/player_info");
- uint16_t const packet_version = fr.Unsigned16();
+ fr.open(fs, "binary/player_info");
+ uint16_t const packet_version = fr.unsigned_16();
if (5 <= packet_version && packet_version <= CURRENT_PACKET_VERSION) {
- uint32_t const max_players = fr.Unsigned16();
+ uint32_t const max_players = fr.unsigned_16();
for (uint32_t i = 1; i < max_players + 1; ++i) {
game.remove_player(i);
- if (fr.Unsigned8()) {
- bool const see_all = fr.Unsigned8();
+ if (fr.unsigned_8()) {
+ bool const see_all = fr.unsigned_8();
- int32_t const plnum = fr.Unsigned8();
+ int32_t const plnum = fr.unsigned_8();
if (plnum < 1 || MAX_PLAYERS < plnum)
throw GameDataError
("player number (%i) is out of range (1 .. %u)",
plnum, MAX_PLAYERS);
Widelands::TeamNumber team = 0;
if (packet_version >= 9)
- team = fr.Unsigned8();
-
- char const * const tribe_name = fr.CString();
-
- std::string const name = fr.CString();
+ team = fr.unsigned_8();
+
+ char const * const tribe_name = fr.c_string();
+
+ std::string const name = fr.c_string();
game.add_player(plnum, 0, tribe_name, name, team);
Player & player = game.player(plnum);
player.set_see_all(see_all);
- player.setAI(fr.CString());
+ player.set_ai(fr.c_string());
if (packet_version >= 15)
- player.ReadStatistics(fr, 3);
+ player.read_statistics(fr, 3);
else if (packet_version >= 14)
- player.ReadStatistics(fr, 2);
+ player.read_statistics(fr, 2);
else if (packet_version >= 12)
- player.ReadStatistics(fr, 1);
+ player.read_statistics(fr, 1);
else
- player.ReadStatistics(fr, 0);
+ player.read_statistics(fr, 0);
- player.m_casualties = fr.Unsigned32();
- player.m_kills = fr.Unsigned32();
- player.m_msites_lost = fr.Unsigned32();
- player.m_msites_defeated = fr.Unsigned32();
- player.m_civil_blds_lost = fr.Unsigned32();
- player.m_civil_blds_defeated = fr.Unsigned32();
+ player.m_casualties = fr.unsigned_32();
+ player.m_kills = fr.unsigned_32();
+ player.m_msites_lost = fr.unsigned_32();
+ player.m_msites_defeated = fr.unsigned_32();
+ player.m_civil_blds_lost = fr.unsigned_32();
+ player.m_civil_blds_defeated = fr.unsigned_32();
}
}
if (packet_version <= 10)
- game.ReadStatistics(fr, 3);
+ game.read_statistics(fr, 3);
else
- game.ReadStatistics(fr, 4);
+ game.read_statistics(fr, 4);
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -97,48 +97,48 @@
}
-void GamePlayerInfoPacket::Write
+void GamePlayerInfoPacket::write
(FileSystem & fs, Game & game, MapObjectSaver *)
{
FileWrite fw;
// Now packet version
- fw.Unsigned16(CURRENT_PACKET_VERSION);
+ fw.unsigned_16(CURRENT_PACKET_VERSION);
// Number of (potential) players
PlayerNumber const nr_players = game.map().get_nrplayers();
- fw.Unsigned16(nr_players);
+ fw.unsigned_16(nr_players);
iterate_players_existing_const(p, nr_players, game, plr) {
- fw.Unsigned8(1); // Player is in game.
-
- fw.Unsigned8(plr->m_see_all);
-
- fw.Unsigned8(plr->m_plnum);
- fw.Unsigned8(plr->team_number());
-
- fw.CString(plr->tribe().name().c_str());
+ fw.unsigned_8(1); // Player is in game.
+
+ fw.unsigned_8(plr->m_see_all);
+
+ fw.unsigned_8(plr->m_plnum);
+ fw.unsigned_8(plr->team_number());
+
+ fw.c_string(plr->tribe().name().c_str());
// Seen fields is in a map packet
// Allowed buildings is in a map packet
// Economies are in a packet after map loading
- fw.CString(plr->m_name.c_str());
- fw.CString(plr->m_ai.c_str());
+ fw.c_string(plr->m_name.c_str());
+ fw.c_string(plr->m_ai.c_str());
- plr->WriteStatistics(fw);
- fw.Unsigned32(plr->casualties());
- fw.Unsigned32(plr->kills ());
- fw.Unsigned32(plr->msites_lost ());
- fw.Unsigned32(plr->msites_defeated ());
- fw.Unsigned32(plr->civil_blds_lost ());
- fw.Unsigned32(plr->civil_blds_defeated());
+ plr->write_statistics(fw);
+ fw.unsigned_32(plr->casualties());
+ fw.unsigned_32(plr->kills ());
+ fw.unsigned_32(plr->msites_lost ());
+ fw.unsigned_32(plr->msites_defeated ());
+ fw.unsigned_32(plr->civil_blds_lost ());
+ fw.unsigned_32(plr->civil_blds_defeated());
} else
- fw.Unsigned8(0); // Player is NOT in game.
-
- game.WriteStatistics(fw);
-
- fw.Write(fs, "binary/player_info");
+ fw.unsigned_8(0); // Player is NOT in game.
+
+ game.write_statistics(fw);
+
+ fw.write(fs, "binary/player_info");
}
}
=== modified file 'src/game_io/game_player_info_packet.h'
--- src/game_io/game_player_info_packet.h 2014-09-10 16:57:31 +0000
+++ src/game_io/game_player_info_packet.h 2014-09-29 13:33:11 +0000
@@ -29,8 +29,8 @@
* a game for a user (for example in a listbox)
*/
struct GamePlayerInfoPacket : public GameDataPacket {
- void Read (FileSystem &, Game &, MapObjectLoader * = nullptr) override;
- void Write(FileSystem &, Game &, MapObjectSaver * = nullptr) override;
+ void read (FileSystem &, Game &, MapObjectLoader * = nullptr) override;
+ void write(FileSystem &, Game &, MapObjectSaver * = nullptr) override;
};
}
=== modified file 'src/game_io/game_preload_packet.cc'
--- src/game_io/game_preload_packet.cc 2014-09-10 13:03:40 +0000
+++ src/game_io/game_preload_packet.cc 2014-09-29 13:33:11 +0000
@@ -45,7 +45,7 @@
#define MINIMAP_FILENAME "minimap.png"
-void GamePreloadPacket::Read
+void GamePreloadPacket::read
(FileSystem & fs, Game &, MapObjectLoader * const)
{
try {
@@ -62,7 +62,7 @@
m_player_nr = s.get_safe_int("player_nr");
m_win_condition = s.get_safe_string("win_condition");
m_number_of_players = s.get_safe_int(PLAYERS_AMOUNT_KEY_V4);
- if (fs.FileExists(MINIMAP_FILENAME)) {
+ if (fs.file_exists(MINIMAP_FILENAME)) {
m_minimap_path = MINIMAP_FILENAME;
}
} else {
@@ -75,7 +75,7 @@
}
-void GamePreloadPacket::Write
+void GamePreloadPacket::write
(FileSystem & fs, Game & game, MapObjectSaver * const)
{
@@ -116,10 +116,10 @@
if (ipl != nullptr) {
const MiniMapLayer flags = MiniMapLayer::Owner | MiniMapLayer::Building | MiniMapLayer::Terrain;
const Point& vp = ipl->get_viewpoint();
- std::unique_ptr< ::StreamWrite> sw(fs.OpenStreamWrite(MINIMAP_FILENAME));
+ std::unique_ptr< ::StreamWrite> sw(fs.open_stream_write(MINIMAP_FILENAME));
if (sw.get() != nullptr) {
write_minimap_image(game, &ipl->player(), vp, flags, sw.get());
- sw->Flush();
+ sw->flush();
}
}
}
=== modified file 'src/game_io/game_preload_packet.h'
--- src/game_io/game_preload_packet.h 2014-09-10 16:57:31 +0000
+++ src/game_io/game_preload_packet.h 2014-09-29 13:33:11 +0000
@@ -32,8 +32,8 @@
* a game for a user (for example in a listbox)
*/
struct GamePreloadPacket : public GameDataPacket {
- void Read (FileSystem &, Game &, MapObjectLoader * = nullptr) override;
- void Write(FileSystem &, Game &, MapObjectSaver * = nullptr) override;
+ void read (FileSystem &, Game &, MapObjectLoader * = nullptr) override;
+ void write(FileSystem &, Game &, MapObjectSaver * = nullptr) override;
char const * get_mapname() {return m_mapname.c_str();}
std::string get_background() {return m_background;}
=== modified file 'src/game_io/game_saver.cc'
--- src/game_io/game_saver.cc 2014-09-10 16:57:31 +0000
+++ src/game_io/game_saver.cc 2014-09-29 13:33:11 +0000
@@ -43,36 +43,36 @@
void GameSaver::save() {
ScopedTimer timer("GameSaver::save() took %ums");
- m_fs.EnsureDirectoryExists("binary");
+ m_fs.ensure_directory_exists("binary");
log("Game: Writing Preload Data ... ");
- {GamePreloadPacket p; p.Write(m_fs, m_game, nullptr);}
+ {GamePreloadPacket p; p.write(m_fs, m_game, nullptr);}
log("took %ums\n", timer.ms_since_last_query());
log("Game: Writing Game Class Data ... ");
- {GameClassPacket p; p.Write(m_fs, m_game, nullptr);}
+ {GameClassPacket p; p.write(m_fs, m_game, nullptr);}
log("took %ums\n", timer.ms_since_last_query());
log("Game: Writing Player Info ... ");
- {GamePlayerInfoPacket p; p.Write(m_fs, m_game, nullptr);}
+ {GamePlayerInfoPacket p; p.write(m_fs, m_game, nullptr);}
log("took %ums\n", timer.ms_since_last_query());
log("Game: Writing Map Data!\n");
- GameMapPacket M; M.Write(m_fs, m_game, nullptr);
+ GameMapPacket M; M.write(m_fs, m_game, nullptr);
log("Game: Writing Map Data took %ums\n", timer.ms_since_last_query());
MapObjectSaver * const mos = M.get_map_object_saver();
log("Game: Writing Player Economies Info ... ");
- {GamePlayerEconomiesPacket p; p.Write(m_fs, m_game, mos);}
+ {GamePlayerEconomiesPacket p; p.write(m_fs, m_game, mos);}
log("took %ums\n", timer.ms_since_last_query());
log("Game: Writing Command Queue Data ... ");
- {GameCmdQueuePacket p; p.Write(m_fs, m_game, mos);}
+ {GameCmdQueuePacket p; p.write(m_fs, m_game, mos);}
log("took %ums\n", timer.ms_since_last_query());
log("Game: Writing Interactive Player Data ... ");
- {GameInteractivePlayerPacket p; p.Write(m_fs, m_game, mos);}
+ {GameInteractivePlayerPacket p; p.write(m_fs, m_game, mos);}
log("took %ums\n", timer.ms_since_last_query());
}
=== modified file 'src/graphic/animation.cc'
--- src/graphic/animation.cc 2014-09-14 11:31:58 +0000
+++ src/graphic/animation.cc 2014-09-29 13:33:11 +0000
@@ -173,7 +173,7 @@
if (fps > 0)
frametime_ = 1000 / fps;
- hotspot_ = section.get_Point("hotspot");
+ hotspot_ = section.get_point("hotspot");
// In the filename template, the last sequence of '?' characters (if any)
// is replaced with a number, for example the template "idle_??" is
@@ -193,12 +193,12 @@
string filename_wo_ext;
while (glob.next(&filename_wo_ext)) {
const string filename = filename_wo_ext + ".png";
- if (!g_fs->FileExists(filename))
+ if (!g_fs->file_exists(filename))
break;
image_files_.push_back(filename);
const string pc_filename = filename_wo_ext + "_pc.png";
- if (g_fs->FileExists(pc_filename)) {
+ if (g_fs->file_exists(pc_filename)) {
hasplrclrs_ = true;
pc_mask_image_files_.push_back(pc_filename);
}
=== modified file 'src/graphic/diranimations.h'
--- src/graphic/diranimations.h 2014-07-28 14:08:41 +0000
+++ src/graphic/diranimations.h 2014-09-29 13:33:11 +0000
@@ -52,7 +52,7 @@
m_animations[dir - 1] = anim;
}
- static DirAnimations Null() {
+ static DirAnimations null() {
return DirAnimations(0); // Since real animation IDs are positive, this is safe
}
=== modified file 'src/graphic/font.cc'
--- src/graphic/font.cc 2014-09-14 11:31:58 +0000
+++ src/graphic/font.cc 2014-09-29 13:33:11 +0000
@@ -58,9 +58,9 @@
// We must keep this File Read open, otherwise the following calls are
// crashing. do not know why...
- m_fontfile.Open(*g_fs, filename);
+ m_fontfile.open(*g_fs, filename);
- SDL_RWops * const ops = SDL_RWFromMem(m_fontfile.Data(0), m_fontfile.GetSize());
+ SDL_RWops * const ops = SDL_RWFromMem(m_fontfile.data(0), m_fontfile.get_size());
if (!ops)
throw wexception("could not load font!: RWops Pointer invalid");
=== modified file 'src/graphic/graphic.cc'
--- src/graphic/graphic.cc 2014-07-25 13:45:18 +0000
+++ src/graphic/graphic.cc 2014-09-29 13:33:11 +0000
@@ -309,7 +309,7 @@
SDL_GL_SwapBuffers();
glEnable(GL_TEXTURE_2D);
- GLSurfaceTexture::Initialize(use_arb);
+ GLSurfaceTexture::initialize(use_arb);
}
if (g_opengl)
@@ -341,7 +341,7 @@
UI::g_fh->flush();
if (g_opengl)
- GLSurfaceTexture::Cleanup();
+ GLSurfaceTexture::cleanup();
}
Graphic::~Graphic()
@@ -487,7 +487,7 @@
void Graphic::screenshot(const string& fname) const
{
log("Save screenshot to %s\n", fname.c_str());
- StreamWrite * sw = g_fs->OpenStreamWrite(fname);
+ StreamWrite * sw = g_fs->open_stream_write(fname);
save_surface_to_png(screen_.get(), sw);
delete sw;
}
=== modified file 'src/graphic/image_io.cc'
--- src/graphic/image_io.cc 2014-07-14 10:45:44 +0000
+++ src/graphic/image_io.cc 2014-09-29 13:33:11 +0000
@@ -35,14 +35,14 @@
// A helper function for save_surface_to_png. Writes the compressed data to
// the StreamWrite.
-void png_write_function(png_structp png_ptr, png_bytep data, png_size_t length) {
- static_cast<StreamWrite*>(png_get_io_ptr(png_ptr))->Data(data, length);
+void png_write_function(png_structp png_ptr, png_bytep png_data, png_size_t length) {
+ static_cast<StreamWrite*>(png_get_io_ptr(png_ptr))->data(png_data, length);
}
// A helper function for save_surface_to_png.
// Flush function to avoid crashes with default libpng flush function
void png_flush_function(png_structp png_ptr) {
- static_cast<StreamWrite*>(png_get_io_ptr(png_ptr))->Flush();
+ static_cast<StreamWrite*>(png_get_io_ptr(png_ptr))->flush();
}
} // namespace
@@ -55,16 +55,16 @@
FileRead fr;
bool found;
if (fs) {
- found = fr.TryOpen(*fs, fname);
+ found = fr.try_open(*fs, fname);
} else {
- found = fr.TryOpen(*g_fs, fname);
+ found = fr.try_open(*g_fs, fname);
}
if (!found) {
throw ImageNotFound(fname);
}
- SDL_Surface* sdlsurf = IMG_Load_RW(SDL_RWFromMem(fr.Data(0), fr.GetSize()), 1);
+ SDL_Surface* sdlsurf = IMG_Load_RW(SDL_RWFromMem(fr.data(0), fr.get_size()), 1);
if (!sdlsurf) {
throw ImageLoadingError(fname.c_str(), IMG_GetError());
}
=== modified file 'src/graphic/render/gamerenderer_gl.cc'
--- src/graphic/render/gamerenderer_gl.cc 2014-09-14 16:08:13 +0000
+++ src/graphic/render/gamerenderer_gl.cc 2014-09-29 13:33:11 +0000
@@ -295,7 +295,7 @@
const Texture & texture =
*g_gr->get_maptexture_data
(world.terrain_descr(ter).get_texture());
- glBindTexture(GL_TEXTURE_2D, texture.getTexture());
+ glBindTexture(GL_TEXTURE_2D, texture.get_texture());
glDrawRangeElements
(GL_TRIANGLES,
0, m_patch_size.w * m_patch_size.h - 1,
@@ -472,7 +472,7 @@
const Texture & texture =
*g_gr->get_maptexture_data
(m_egbase->world().terrain_descr(ter).get_texture());
- glBindTexture(GL_TEXTURE_2D, texture.getTexture());
+ glBindTexture(GL_TEXTURE_2D, texture.get_texture());
glDrawArrays
(GL_TRIANGLES,
3 * m_terrain_edge_freq_cum[ter], 3 * m_terrain_edge_freq[ter]);
=== modified file 'src/graphic/render/gl_surface_texture.cc'
--- src/graphic/render/gl_surface_texture.cc 2014-07-20 07:44:53 +0000
+++ src/graphic/render/gl_surface_texture.cc 2014-09-29 13:33:11 +0000
@@ -32,7 +32,7 @@
/**
* Initial global resources needed for fast offscreen rendering.
*/
-void GLSurfaceTexture::Initialize(bool use_arb) {
+void GLSurfaceTexture::initialize(bool use_arb) {
use_arb_ = use_arb;
// Generate the framebuffer for Offscreen rendering.
@@ -48,7 +48,7 @@
/**
* Free global resources.
*/
-void GLSurfaceTexture::Cleanup() {
+void GLSurfaceTexture::cleanup() {
if (use_arb_)
glDeleteFramebuffers(1, &gl_framebuffer_id_);
else
=== modified file 'src/graphic/render/gl_surface_texture.h'
--- src/graphic/render/gl_surface_texture.h 2014-07-26 10:43:23 +0000
+++ src/graphic/render/gl_surface_texture.h 2014-09-29 13:33:11 +0000
@@ -25,10 +25,10 @@
class GLSurfaceTexture : public GLSurface {
public:
- // Call this once before using any instance of this class and Cleanup once
+ // Call this once before using any instance of this class and cleanup once
// before the program exits.
- static void Initialize(bool use_arb);
- static void Cleanup();
+ static void initialize(bool use_arb);
+ static void cleanup();
GLSurfaceTexture(SDL_Surface * surface, bool intensity = false);
GLSurfaceTexture(int w, int h);
=== modified file 'src/graphic/text/font_io.cc'
--- src/graphic/text/font_io.cc 2014-09-10 16:57:31 +0000
+++ src/graphic/text/font_io.cc 2014-09-29 13:33:11 +0000
@@ -41,8 +41,8 @@
std::unique_ptr<std::string> memory;
{
FileRead* fr = new FileRead();
- fr->Open(*g_fs, filename);
- memory.reset(new std::string(fr->Data(0), fr->GetSize()));
+ fr->open(*g_fs, filename);
+ memory.reset(new std::string(fr->data(0), fr->get_size()));
}
SDL_RWops* ops = SDL_RWFromConstMem(memory->data(), memory->size());
=== modified file 'src/graphic/text/test/render.cc'
--- src/graphic/text/test/render.cc 2014-07-14 10:45:44 +0000
+++ src/graphic/text/test/render.cc 2014-09-29 13:33:11 +0000
@@ -32,8 +32,8 @@
StandaloneRenderer::StandaloneRenderer() {
g_fs = new LayeredFileSystem();
- g_fs->AddFileSystem(&FileSystem::Create(WIDELANDS_DATA_DIR));
- g_fs->AddFileSystem(&FileSystem::Create(RICHTEXT_DATA_DIR));
+ g_fs->add_file_system(&FileSystem::create(WIDELANDS_DATA_DIR));
+ g_fs->add_file_system(&FileSystem::create(RICHTEXT_DATA_DIR));
surface_cache_.reset(create_surface_cache(500 << 20)); // 500 MB
image_cache_.reset(new ImageCache(surface_cache_.get()));
=== modified file 'src/graphic/text/test/render_richtext.cc'
--- src/graphic/text/test/render_richtext.cc 2014-07-20 07:44:53 +0000
+++ src/graphic/text/test/render_richtext.cc 2014-09-29 13:33:11 +0000
@@ -123,8 +123,8 @@
std::unique_ptr<SDLSurface> surf(
static_cast<SDLSurface*>(standalone_renderer.renderer()->render(txt, w, allowed_tags)));
- std::unique_ptr<FileSystem> fs(&FileSystem::Create("."));
- std::unique_ptr<StreamWrite> sw(fs->OpenStreamWrite(outname));
+ std::unique_ptr<FileSystem> fs(&FileSystem::create("."));
+ std::unique_ptr<StreamWrite> sw(fs->open_stream_write(outname));
if (!save_surface_to_png(surf.get(), sw.get())) {
std::cout << "Could not encode PNG." << std::endl;
}
=== modified file 'src/graphic/texture.cc'
--- src/graphic/texture.cc 2014-07-17 13:26:23 +0000
+++ src/graphic/texture.cc 2014-09-29 13:33:11 +0000
@@ -51,7 +51,7 @@
}
for (const std::string& fname : texture_files) {
- if (!g_fs->FileExists(fname)) {
+ if (!g_fs->file_exists(fname)) {
throw wexception("Could not find %s.", fname.c_str());
}
=== modified file 'src/graphic/texture.h'
--- src/graphic/texture.h 2014-07-12 12:35:05 +0000
+++ src/graphic/texture.h 2014-09-29 13:33:11 +0000
@@ -59,7 +59,7 @@
RGBColor get_minimap_color(int8_t shade);
void animate(uint32_t time);
- uint32_t getTexture() const
+ uint32_t get_texture() const
{return m_glFrames.at(m_frame_num)->get_gl_texture();}
private:
=== modified file 'src/io/dedicated_log.cc'
--- src/io/dedicated_log.cc 2014-06-08 21:47:45 +0000
+++ src/io/dedicated_log.cc 2014-09-29 13:33:11 +0000
@@ -97,18 +97,18 @@
temp += c.sender.empty() ? "SYSTEM" : c.sender;
temp += "</td><td class=\"recipient\"> ->" + c.recipient + "</td><td class=\"message\">";
temp += c.msg + "</td></tr>\n";
- m_chat.Printf("%s", temp.c_str());
- m_chat.WriteAppend(*root, m_chat_file_path.c_str());
+ m_chat.print_f("%s", temp.c_str());
+ m_chat.write_append(*root, m_chat_file_path.c_str());
}
/// Add's a spacer to the chat log
-void DedicatedLog::chatAddSpacer() {
+void DedicatedLog::chat_add_spacer() {
if (m_chat_file_path.empty())
return;
- m_chat.Printf("<tr><td class=\"space\"></td><td class=\"space\"></td>");
- m_chat.Printf("<td class=\"space\"></td><td class=\"space\"></td></tr>\n");
- m_chat.WriteAppend(*root, m_chat_file_path.c_str());
+ m_chat.print_f("<tr><td class=\"space\"></td><td class=\"space\"></td>");
+ m_chat.print_f("<td class=\"space\"></td><td class=\"space\"></td></tr>\n");
+ m_chat.write_append(*root, m_chat_file_path.c_str());
}
@@ -206,8 +206,8 @@
}
}
temp += "</table>\n";
- m_chat.Printf("%s", temp.c_str());
- m_chat.Write(*root, m_info_file_path.c_str());
+ m_chat.print_f("%s", temp.c_str());
+ m_chat.write(*root, m_info_file_path.c_str());
}
/// Appends the String \arg msg to the log file
@@ -224,8 +224,8 @@
temp += "</td><td class=\"log\">";
temp += msg;
temp += "</td></tr>\n";
- m_chat.Printf("%s", temp.c_str());
- m_chat.WriteAppend(*root, m_log_file_path.c_str());
+ m_chat.print_f("%s", temp.c_str());
+ m_chat.write_append(*root, m_log_file_path.c_str());
}
@@ -252,8 +252,8 @@
m_chat_file_path = path;
// Initialize the chat file
- m_chat.Printf("<tr><th>Time</th><th>Sender</th><th>Recipient</th><th>Message</th></tr>");
- m_chat.Write(*root, m_chat_file_path.c_str()); // Not WriteAppend, to make sure the file is cleared
+ m_chat.print_f("<tr><th>Time</th><th>Sender</th><th>Recipient</th><th>Message</th></tr>");
+ m_chat.write(*root, m_chat_file_path.c_str()); // Not write_append, to make sure the file is cleared
return true;
}
@@ -307,8 +307,8 @@
m_log_file_path = path;
// Initialize the log file
- m_chat.Printf("<tr><th></th><th>Widelands dedicated server log:</th></tr>\n");
- m_chat.Write(*root, m_log_file_path.c_str()); // Not WriteAppend, to make sure the file is cleared
+ m_chat.print_f("<tr><th></th><th>Widelands dedicated server log:</th></tr>\n");
+ m_chat.write(*root, m_log_file_path.c_str()); // Not write_append, to make sure the file is cleared
return true;
}
@@ -323,14 +323,14 @@
* written to does not exist, in all other cases true.
*/
bool DedicatedLog::check_file_writeable(std::string & path) {
- bool existing = root->FileExists(path);
- if (existing && root->IsDirectory(path))
+ bool existing = root->file_exists(path);
+ if (existing && root->is_directory(path))
return false;
- if (root->FileIsWriteable(path)) {
+ if (root->file_is_writeable(path)) {
if (existing) {
std::string rnpath(path + '~');
- if (root->FileIsWriteable(rnpath))
- root->Rename(path, rnpath);
+ if (root->file_is_writeable(rnpath))
+ root->fs_rename(path, rnpath);
else
log("Note: original file %s could not be backuped\n", path.c_str());
}
=== modified file 'src/io/dedicated_log.h'
--- src/io/dedicated_log.h 2014-07-13 18:20:03 +0000
+++ src/io/dedicated_log.h 2014-09-29 13:33:11 +0000
@@ -33,7 +33,7 @@
static DedicatedLog * get();
// chat logging functions
- void chatAddSpacer();
+ void chat_add_spacer();
void chat(ChatMessage & c);
// info logging functions
=== modified file 'src/io/fileread.cc'
--- src/io/fileread.cc 2014-09-09 17:15:20 +0000
+++ src/io/fileread.cc 2014-09-29 13:33:11 +0000
@@ -23,19 +23,19 @@
FileRead::~FileRead() {
if (data_) {
- Close();
+ close();
}
}
-void FileRead::Open(FileSystem& fs, const std::string& filename) {
+void FileRead::open(FileSystem& fs, const std::string& filename) {
assert(!data_);
- data_ = static_cast<char*>(fs.Load(filename, length_));
+ data_ = static_cast<char*>(fs.load(filename, length_));
filepos_ = 0;
}
-bool FileRead::TryOpen(FileSystem& fs, const std::string& filename) {
+bool FileRead::try_open(FileSystem& fs, const std::string& filename) {
try {
- Open(fs, filename);
+ open(fs, filename);
}
catch (const std::exception&) {
return false;
@@ -43,32 +43,32 @@
return true;
}
-void FileRead::Close() {
+void FileRead::close() {
assert(data_);
free(data_);
data_ = nullptr;
}
-size_t FileRead::GetSize() const {
+size_t FileRead::get_size() const {
return length_;
}
-bool FileRead::EndOfFile() const {
+bool FileRead::end_of_file() const {
return length_ <= filepos_;
}
-void FileRead::SetFilePos(Pos const pos) {
+void FileRead::set_file_pos(Pos const pos) {
assert(data_);
if (pos >= length_)
throw FileBoundaryExceeded();
filepos_ = pos;
}
-FileRead::Pos FileRead::GetPos() const {
+FileRead::Pos FileRead::get_pos() const {
return filepos_;
}
-size_t FileRead::Data(void* dst, size_t bufsize) {
+size_t FileRead::data(void* dst, size_t bufsize) {
assert(data_);
size_t read = 0;
for (; read < bufsize && filepos_ < length_; ++read, ++filepos_) {
@@ -77,10 +77,10 @@
return read;
}
-char* FileRead::Data(uint32_t const bytes, const Pos pos) {
+char* FileRead::data(uint32_t const bytes, const Pos pos) {
assert(data_);
Pos i = pos;
- if (pos.isNull()) {
+ if (pos.is_null()) {
i = filepos_;
filepos_ += bytes;
}
@@ -89,10 +89,10 @@
return data_ + i;
}
-char* FileRead::CString(Pos const pos) {
+char* FileRead::c_string(Pos const pos) {
assert(data_);
- Pos i = pos.isNull() ? filepos_ : pos;
+ Pos i = pos.is_null() ? filepos_ : pos;
if (i >= length_)
throw FileBoundaryExceeded();
char* const result = data_ + i;
@@ -101,17 +101,17 @@
++i; // beyond the null
if (i > (length_ + 1)) // allow EOF as end marker for string
throw FileBoundaryExceeded();
- if (pos.isNull())
+ if (pos.is_null())
filepos_ = i;
return result;
}
-char const* FileRead::CString() {
- return CString(Pos::Null());
+char const* FileRead::c_string() {
+ return c_string(Pos::null());
}
-char* FileRead::ReadLine() {
- if (EndOfFile())
+char* FileRead::read_line() {
+ if (end_of_file())
return nullptr;
char* result = data_ + filepos_;
for (; data_[filepos_] && data_[filepos_] != '\n'; ++filepos_)
=== modified file 'src/io/fileread.h'
--- src/io/fileread.h 2014-09-09 17:15:20 +0000
+++ src/io/fileread.h 2014-09-29 13:33:11 +0000
@@ -40,12 +40,12 @@
Pos(size_t const p = 0) : pos(p) {
}
/// Returns a special value indicating invalidity.
- static Pos Null() {
+ static Pos null() {
return std::numeric_limits<size_t>::max();
}
- bool isNull() const {
- return *this == Null();
+ bool is_null() const {
+ return *this == null();
}
operator size_t() const {
return pos;
@@ -72,45 +72,45 @@
~FileRead() override;
// See base class.
- size_t Data(void* dst, size_t bufsize) override;
- bool EndOfFile() const override;
- char const* CString() override;
+ size_t data(void* dst, size_t bufsize) override;
+ bool end_of_file() const override;
+ char const* c_string() override;
/// Loads a file into memory. Reserves one additional byte which is zeroed,
/// so that text files can be handled like a null-terminated string.
/// \throws an exception if the file couldn't be loaded for whatever reason.
// TODO(unknown): error handling
- void Open(FileSystem& fs, const std::string& filename);
+ void open(FileSystem& fs, const std::string& filename);
- /// Works just like Open, but returns false when the load fails.
- // TODO(sirver): This method can be expressed through Open() and should not
+ /// Works just like open, but returns false when the load fails.
+ // TODO(sirver): This method can be expressed through open() and should not
// be part of the public API, rather a stand alone function.
- bool TryOpen(FileSystem& fs, const std::string& filename);
+ bool try_open(FileSystem& fs, const std::string& filename);
/// Frees allocated memory.
- void Close();
+ void close();
// Returns the size of the file in bytes;
- size_t GetSize() const;
+ size_t get_size() const;
/// Set the file pointer to the given location.
/// \throws File_Boundary_Exceeded if the pointer is out of bound.
- void SetFilePos(Pos pos);
+ void set_file_pos(Pos pos);
/// Get the position that will be read from in the next read operation that
/// does not specify a position.
- Pos GetPos() const;
+ Pos get_pos() const;
// Returns the next 'bytes' starting at 'pos' in the file. Can throw
// File_Boundary_Exceeded.
- char* Data(uint32_t bytes, Pos pos = Pos::Null());
+ char* data(uint32_t bytes, Pos pos = Pos::null());
// Returns the whole file as a string starting from 'pos'.
- char* CString(Pos pos);
+ char* c_string(Pos pos);
// Returns the next line.
- char* ReadLine();
+ char* read_line();
private:
char* data_;
=== modified file 'src/io/filesystem/disk_filesystem.cc'
--- src/io/filesystem/disk_filesystem.cc 2014-09-14 11:31:58 +0000
+++ src/io/filesystem/disk_filesystem.cc 2014-09-29 13:33:11 +0000
@@ -71,22 +71,22 @@
: m_directory(Directory)
{
// TODO(unknown): check OS permissions on whether the directory is writable!
- m_root = FS_CanonicalizeName(Directory);
+ m_root = canonicalize_name(Directory);
}
/**
* SHOULD return true if this directory is writable.
*/
-bool RealFSImpl::IsWritable() const {
+bool RealFSImpl::is_writable() const {
// Should be checked here (ondisk state can change)
return true;
}
/// returns true, if the file is writeable
-bool RealFSImpl::FileIsWriteable(const std::string & path) {
+bool RealFSImpl::file_is_writeable(const std::string & path) {
std::string fullname;
- fullname = FS_CanonicalizeName(path);
+ fullname = canonicalize_name(path);
// we call fopen with "a" == append to be sure nothing gets overwritten
FILE * const f = fopen(fullname.c_str(), "a");
@@ -97,7 +97,7 @@
}
-std::set<std::string> RealFSImpl::ListDirectory(const std::string & path)
+std::set<std::string> RealFSImpl::list_directory(const std::string & path)
{
#ifdef _WIN32
std::string buf;
@@ -124,7 +124,7 @@
if ((strcmp(c_file.name, ".") == 0) || (strcmp(c_file.name, "..") == 0)) {
continue;
}
- const std::string filename = FS_CanonicalizeName(realpath + c_file.name);
+ const std::string filename = canonicalize_name(realpath + c_file.name);
const std::string result = filename.substr(m_root.size() + 1);
results.insert(result);
} while (_findnext(hFile, &c_file) == 0);
@@ -138,7 +138,7 @@
int32_t ofs;
if (path.size()) {
- if (pathIsAbsolute(path)) {
+ if (is_path_absolute(path)) {
buf = path + "/*";
ofs = 0;
} else {
@@ -155,7 +155,7 @@
return results;
for (size_t i = 0; i < gl.gl_pathc; ++i) {
- const std::string filename(FS_CanonicalizeName(&gl.gl_pathv[i][ofs]));
+ const std::string filename(canonicalize_name(&gl.gl_pathv[i][ofs]));
results.insert(filename.substr(m_root.size() + 1));
}
@@ -171,8 +171,8 @@
* \e can't exist then)
*/
// TODO(unknown): Can this be rewritten to just using exceptions? Should it?
-bool RealFSImpl::FileExists(const std::string & path) {
- return FileSystemPath(FS_CanonicalizeName(path)).m_exists;
+bool RealFSImpl::file_exists(const std::string & path) {
+ return FileSystemPath(canonicalize_name(path)).m_exists;
}
/**
@@ -180,15 +180,15 @@
* Also returns false if the pathname is invalid (obviously, because the file
* \e can't exist then)
*/
-bool RealFSImpl::IsDirectory(const std::string & path) {
- return FileSystemPath(FS_CanonicalizeName(path)).m_isDirectory;
+bool RealFSImpl::is_directory(const std::string & path) {
+ return FileSystemPath(canonicalize_name(path)).m_isDirectory;
}
/**
* Create a sub filesystem out of this filesystem
*/
-FileSystem * RealFSImpl::MakeSubFileSystem(const std::string & path) {
- FileSystemPath fspath(FS_CanonicalizeName(path));
+FileSystem * RealFSImpl::make_sub_file_system(const std::string & path) {
+ FileSystemPath fspath(canonicalize_name(path));
assert(fspath.m_exists); //TODO(unknown): throw an exception instead
if (fspath.m_isDirectory)
@@ -200,16 +200,16 @@
/**
* Create a sub filesystem out of this filesystem
*/
-FileSystem * RealFSImpl::CreateSubFileSystem(const std::string & path, Type const fs)
+FileSystem * RealFSImpl::create_sub_file_system(const std::string & path, Type const fs)
{
- FileSystemPath fspath(FS_CanonicalizeName(path));
+ FileSystemPath fspath(canonicalize_name(path));
if (fspath.m_exists)
throw wexception
("path %s already exists, can not create a filesystem from it",
path.c_str());
if (fs == FileSystem::DIR) {
- EnsureDirectoryExists(path);
+ ensure_directory_exists(path);
return new RealFSImpl(fspath);
} else
return new ZipFilesystem(fspath);
@@ -218,8 +218,8 @@
/**
* Remove a number of files
*/
-void RealFSImpl::Unlink(const std::string & file) {
- FileSystemPath fspath(FS_CanonicalizeName(file));
+void RealFSImpl::fs_unlink(const std::string & file) {
+ FileSystemPath fspath(canonicalize_name(file));
if (!fspath.m_exists)
return;
@@ -233,14 +233,14 @@
* Remove a single directory or file
*/
void RealFSImpl::m_unlink_file(const std::string & file) {
- FileSystemPath fspath(FS_CanonicalizeName(file));
+ FileSystemPath fspath(canonicalize_name(file));
assert(fspath.m_exists); //TODO(unknown): throw an exception instead
assert(!fspath.m_isDirectory); //TODO(unknown): throw an exception instead
#ifndef _WIN32
unlink(fspath.c_str());
#else
- DeleteFile(fspath.c_str());
+ delete_file(fspath.c_str());
#endif
}
@@ -248,23 +248,23 @@
* Recursively remove a directory
*/
void RealFSImpl::m_unlink_directory(const std::string & file) {
- FileSystemPath fspath(FS_CanonicalizeName(file));
+ FileSystemPath fspath(canonicalize_name(file));
assert(fspath.m_exists); //TODO(unknown): throw an exception instead
assert(fspath.m_isDirectory); //TODO(unknown): throw an exception instead
- FilenameSet files = ListDirectory(file);
+ FilenameSet files = list_directory(file);
for
(FilenameSet::iterator pname = files.begin();
pname != files.end();
++pname)
{
- std::string filename = FS_Filename(pname->c_str());
+ std::string filename = fs_filename(pname->c_str());
if (filename == "..")
continue;
if (filename == ".")
continue;
- if (IsDirectory(*pname))
+ if (is_directory(*pname))
m_unlink_directory(*pname);
else
m_unlink_file(*pname);
@@ -275,7 +275,7 @@
#ifndef _WIN32
rmdir(fspath.c_str());
#else
- RemoveDirectory(fspath.c_str());
+ remove_directory(fspath.c_str());
#endif
}
@@ -283,20 +283,20 @@
* Create this directory if it doesn't exist, throws an error
* if the dir can't be created or if a file with this name exists
*/
-void RealFSImpl::EnsureDirectoryExists(const std::string & dirname)
+void RealFSImpl::ensure_directory_exists(const std::string & dirname)
{
try {
std::string::size_type it = 0;
while (it < dirname.size()) {
it = dirname.find(m_filesep, it);
- FileSystemPath fspath(FS_CanonicalizeName(dirname.substr(0, it)));
+ FileSystemPath fspath(canonicalize_name(dirname.substr(0, it)));
if (fspath.m_exists && !fspath.m_isDirectory)
throw wexception
("%s exists and is not a directory",
dirname.substr(0, it).c_str());
if (!fspath.m_exists)
- MakeDirectory(dirname.substr(0, it));
+ make_directory(dirname.substr(0, it));
if (it == std::string::npos)
break;
@@ -304,7 +304,7 @@
}
} catch (const std::exception & e) {
throw wexception
- ("RealFSImpl::EnsureDirectoryExists(%s): %s",
+ ("RealFSImpl::ensure_directory_exists(%s): %s",
dirname.c_str(), e.what());
}
}
@@ -314,11 +314,11 @@
* if a file is in the way or if the creation fails.
*
* Pleas note, this function does not honor parents,
- * MakeDirectory("onedir/otherdir/onemoredir") will fail
+ * make_directory("onedir/otherdir/onemoredir") will fail
* if either onedir or otherdir is missing
*/
-void RealFSImpl::MakeDirectory(const std::string & dirname) {
- FileSystemPath fspath(FS_CanonicalizeName(dirname));
+void RealFSImpl::make_directory(const std::string & dirname) {
+ FileSystemPath fspath(canonicalize_name(dirname));
if (fspath.m_exists)
throw wexception
("a file with the name \"%s\" already exists", dirname.c_str());
@@ -333,19 +333,19 @@
==
-1)
throw DirectoryCannotCreateError
- ("RealFSImpl::MakeDirectory",
+ ("RealFSImpl::make_directory",
dirname,
strerror(errno));
}
/**
- * Read the given file into alloced memory; called by FileRead::Open.
+ * Read the given file into alloced memory; called by FileRead::open.
* Throws an exception if the file couldn't be opened.
*/
-void * RealFSImpl::Load(const std::string & fname, size_t & length) {
- const std::string fullname = FS_CanonicalizeName(fname);
- if (IsDirectory(fullname)) {
- throw FileError("RealFSImpl::Load", fullname.c_str());
+void * RealFSImpl::load(const std::string & fname, size_t & length) {
+ const std::string fullname = canonicalize_name(fname);
+ if (is_directory(fullname)) {
+ throw FileError("RealFSImpl::load", fullname.c_str());
}
FILE * file = nullptr;
@@ -354,7 +354,7 @@
try {
file = fopen(fullname.c_str(), "rb");
if (!file)
- throw FileError("RealFSImpl::Load", fullname.c_str());
+ throw FileError("RealFSImpl::load", fullname.c_str());
// determine the size of the file (rather quirky, but it doesn't require
// potentially unportable functions)
@@ -364,7 +364,7 @@
const int32_t ftell_pos = ftell(file);
if (ftell_pos < 0)
throw wexception
- ("RealFSImpl::Load: error when loading \"%s\" (\"%s\"): file "
+ ("RealFSImpl::load: error when loading \"%s\" (\"%s\"): file "
"size calculation yielded negative value %i",
fname.c_str(), fullname.c_str(), ftell_pos);
size = ftell_pos;
@@ -376,7 +376,7 @@
int result = fread(data, size, 1, file);
if (size && (result != 1)) {
throw wexception
- ("RealFSImpl::Load: read failed for %s (%s) with size %" PRIuS "",
+ ("RealFSImpl::load: read failed for %s (%s) with size %" PRIuS "",
fname.c_str(), fullname.c_str(), size);
}
static_cast<int8_t *>(data)[size] = 0;
@@ -402,11 +402,11 @@
* that file.
* Throws an exception if it fails.
*/
-void RealFSImpl::Write(const std::string & fname, void const * const data, int32_t const length, bool append)
+void RealFSImpl::write(const std::string & fname, void const * const data, int32_t const length, bool append)
{
std::string fullname;
- fullname = FS_CanonicalizeName(fname);
+ fullname = canonicalize_name(fname);
FILE * const f = fopen(fullname.c_str(), append ? "a" : "wb");
if (!f)
@@ -422,11 +422,11 @@
}
// rename a file or directory
-void RealFSImpl::Rename
+void RealFSImpl::fs_rename
(const std::string & old_name, const std::string & new_name)
{
- const std::string fullname1 = FS_CanonicalizeName(old_name);
- const std::string fullname2 = FS_CanonicalizeName(new_name);
+ const std::string fullname1 = canonicalize_name(old_name);
+ const std::string fullname2 = canonicalize_name(new_name);
rename(fullname1.c_str(), fullname2.c_str());
}
@@ -452,11 +452,11 @@
fclose(m_file);
}
- size_t Data(void * data, size_t const bufsize) override {
- return fread(data, 1, bufsize, m_file);
+ size_t data(void * read_data, size_t const bufsize) override {
+ return fread(read_data, 1, bufsize, m_file);
}
- bool EndOfFile() const override
+ bool end_of_file() const override
{
return feof(m_file);
}
@@ -467,8 +467,8 @@
}
-StreamRead * RealFSImpl::OpenStreamRead(const std::string & fname) {
- const std::string fullname = FS_CanonicalizeName(fname);
+StreamRead * RealFSImpl::open_stream_read(const std::string & fname) {
+ const std::string fullname = canonicalize_name(fname);
return new RealFSStreamRead(fullname);
}
@@ -493,15 +493,15 @@
~RealFSStreamWrite() {fclose(m_file);}
- void Data(const void * const data, const size_t size) override
+ void data(const void * const write_data, const size_t size) override
{
- size_t ret = fwrite(data, 1, size, m_file);
+ size_t ret = fwrite(write_data, 1, size, m_file);
if (ret != size)
throw wexception("Write to %s failed", m_filename.c_str());
}
- void Flush() override
+ void flush() override
{
fflush(m_file);
}
@@ -513,25 +513,25 @@
}
-StreamWrite * RealFSImpl::OpenStreamWrite(const std::string & fname) {
- const std::string fullname = FS_CanonicalizeName(fname);
+StreamWrite * RealFSImpl::open_stream_write(const std::string & fname) {
+ const std::string fullname = canonicalize_name(fname);
return new RealFSStreamWrite(fullname);
}
-unsigned long long RealFSImpl::DiskSpace() {
+unsigned long long RealFSImpl::disk_space() {
#ifdef _WIN32
ULARGE_INTEGER freeavailable;
return
GetDiskFreeSpaceEx
- (FS_CanonicalizeName(m_directory).c_str(), &freeavailable, 0, 0)
+ (canonicalize_name(m_directory).c_str(), &freeavailable, 0, 0)
?
//if more than 2G free space report that much
freeavailable.HighPart ? std::numeric_limits<unsigned long>::max() :
freeavailable.LowPart : 0;
#else
struct statvfs svfs;
- if (statvfs(FS_CanonicalizeName(m_directory).c_str(), &svfs) != -1) {
+ if (statvfs(canonicalize_name(m_directory).c_str(), &svfs) != -1) {
return static_cast<unsigned long long>(svfs.f_bsize) * svfs.f_bavail;
}
#endif
=== modified file 'src/io/filesystem/disk_filesystem.h'
--- src/io/filesystem/disk_filesystem.h 2014-07-26 10:43:23 +0000
+++ src/io/filesystem/disk_filesystem.h 2014-09-29 13:33:11 +0000
@@ -30,32 +30,32 @@
public:
RealFSImpl(const std::string & Directory);
- std::set<std::string> ListDirectory(const std::string& path) override;
-
- bool IsWritable() const override;
- bool FileIsWriteable(const std::string & path);
- bool FileExists (const std::string & path) override;
- bool IsDirectory(const std::string & path) override;
- void EnsureDirectoryExists(const std::string & dirname) override;
- void MakeDirectory (const std::string & dirname) override;
-
- void * Load(const std::string & fname, size_t & length) override;
-
-
- void Write(const std::string & fname, void const * data, int32_t length, bool append);
- void Write(const std::string & fname, void const * data, int32_t length) override
- {Write(fname, data, length, false);}
-
- StreamRead * OpenStreamRead (const std::string & fname) override;
- StreamWrite * OpenStreamWrite(const std::string & fname) override;
-
- FileSystem * MakeSubFileSystem(const std::string & dirname) override;
- FileSystem * CreateSubFileSystem(const std::string & dirname, Type) override;
- void Unlink(const std::string & file) override;
- void Rename(const std::string & old_name, const std::string & new_name) override;
-
- std::string getBasename() override {return m_directory;}
- unsigned long long DiskSpace() override;
+ std::set<std::string> list_directory(const std::string& path) override;
+
+ bool is_writable() const override;
+ bool file_is_writeable(const std::string & path);
+ bool file_exists (const std::string & path) override;
+ bool is_directory(const std::string & path) override;
+ void ensure_directory_exists(const std::string & fs_dirname) override;
+ void make_directory (const std::string & fs_dirname) override;
+
+ void * load(const std::string & fname, size_t & length) override;
+
+
+ void write(const std::string & fname, void const * data, int32_t length, bool append);
+ void write(const std::string & fname, void const * data, int32_t length) override
+ {write(fname, data, length, false);}
+
+ StreamRead * open_stream_read (const std::string & fname) override;
+ StreamWrite * open_stream_write(const std::string & fname) override;
+
+ FileSystem * make_sub_file_system(const std::string & fs_dirname) override;
+ FileSystem * create_sub_file_system(const std::string & fs_dirname, Type) override;
+ void fs_unlink(const std::string & file) override;
+ void fs_rename(const std::string & old_name, const std::string & new_name) override;
+
+ std::string get_basename() override {return m_directory;}
+ unsigned long long disk_space() override;
private:
void m_unlink_directory(const std::string & file);
=== modified file 'src/io/filesystem/filesystem.cc'
--- src/io/filesystem/filesystem.cc 2014-09-10 13:03:40 +0000
+++ src/io/filesystem/filesystem.cc 2014-09-29 13:33:11 +0000
@@ -75,7 +75,7 @@
* \param path A file or directory name
* \return True if ref path is absolute and within this FileSystem, false otherwise
*/
-bool FileSystem::pathIsAbsolute(const std::string & path) const {
+bool FileSystem::is_path_absolute(const std::string & path) const {
std::string::size_type const path_size = path .size();
std::string::size_type const root_size = m_root.size();
@@ -107,7 +107,7 @@
* This function is used to make sure that paths send via network are usable
* on locale OS.
*/
-std::string FileSystem::fixCrossFile(const std::string & path) const {
+std::string FileSystem::fix_cross_file(const std::string & path) const {
uint32_t path_size = path.size();
std::string fixedPath(path);
std::string temp;
@@ -141,18 +141,18 @@
/**
* \return The process' current working directory
*/
-std::string FileSystem::getWorkingDirectory() const {
+std::string FileSystem::get_working_directory() const {
char cwd[PATH_MAX + 1];
char * const result = getcwd(cwd, PATH_MAX);
if (! result)
- throw FileError("FileSystem::getWorkingDirectory()", "widelands", "can not run getcwd");
+ throw FileError("FileSystem::get_working_directory()", "widelands", "can not run getcwd");
return std::string(cwd);
}
// TODO(unknown): Write homedir detection for non-getenv-systems
-std::string FileSystem::GetHomedir()
+std::string FileSystem::get_homedir()
{
std::string homedir;
#ifdef _WIN32
@@ -199,7 +199,7 @@
* \param components The output iterator to place the path nodes into
*/
template<typename Inserter>
-static void FS_Tokenize
+static void fs_tokenize
(const std::string & path, char const filesep, Inserter components)
{
std::string::size_type pos; // start of token
@@ -234,7 +234,7 @@
* Transform any valid, unique pathname into a well-formed absolute path
*/
// TODO(unknown): Enable non-Unix paths
-std::string FileSystem::FS_CanonicalizeName(std::string path) const {
+std::string FileSystem::canonicalize_name(std::string path) const {
std::list<std::string> components;
std::list<std::string>::iterator i;
@@ -246,19 +246,19 @@
}
#endif
- FS_Tokenize(path, m_filesep, std::inserter(components, components.begin()));
+ fs_tokenize(path, m_filesep, std::inserter(components, components.begin()));
//tilde expansion
if (!components.empty() && *components.begin() == "~") {
components.erase(components.begin());
- FS_Tokenize
- (GetHomedir(),
+ fs_tokenize
+ (get_homedir(),
m_filesep,
std::inserter(components, components.begin()));
- } else if (!pathIsAbsolute(path))
+ } else if (!is_path_absolute(path))
// make relative paths absolute (so that "../../foo" can work)
- FS_Tokenize
- (m_root.empty() ? getWorkingDirectory() : m_root, m_filesep,
+ fs_tokenize
+ (m_root.empty() ? get_working_directory() : m_root, m_filesep,
std::inserter(components, components.begin()));
//clean up the path
@@ -316,7 +316,7 @@
* Returns the filename of this path, everything after the last
* / or \ (or the whole string)
*/
-const char * FileSystem::FS_Filename(const char * p) {
+const char * FileSystem::fs_filename(const char * p) {
const char * result = p;
while (*p != '\0') {
@@ -328,12 +328,12 @@
return result;
}
-std::string FileSystem::FS_Dirname(const std::string& full_path) {
- const std::string filename = FS_Filename(full_path.c_str());
+std::string FileSystem::fs_dirname(const std::string& full_path) {
+ const std::string filename = fs_filename(full_path.c_str());
return full_path.substr(0, full_path.size() - filename.size());
}
-std::string FileSystem::FS_FilenameExt(const std::string & f)
+std::string FileSystem::filename_ext(const std::string & f)
{
// Find last '.' - denotes start of extension
size_t ext_start = f.rfind('.');
@@ -344,10 +344,10 @@
return f.substr(ext_start);
}
-std::string FileSystem::FS_FilenameWoExt(const char * const p)
+std::string FileSystem::filename_without_ext(const char * const p)
{
- std::string fname(p ? FileSystem::FS_Filename(p) : "");
- std::string ext(FileSystem::FS_FilenameExt(fname));
+ std::string fname(p ? FileSystem::fs_filename(p) : "");
+ std::string ext(FileSystem::filename_ext(fname));
return fname.substr(0, fname.length() - ext.length());
}
@@ -361,7 +361,7 @@
// TODO(unknown): Catch FileNotFoundError in all users
// TODO(unknown): throw FileTypeError if root is not a zipfile (exception from
// ZipFilesystem)
-FileSystem & FileSystem::Create(const std::string & root)
+FileSystem & FileSystem::create(const std::string & root)
{
struct stat statinfo;
@@ -375,10 +375,10 @@
#endif
errno == ENAMETOOLONG)
{
- throw FileNotFoundError("FileSystem::Create", root);
+ throw FileNotFoundError("FileSystem::create", root);
}
if (errno == EACCES)
- throw FileAccessDeniedError("FileSystem::Create", root);
+ throw FileAccessDeniedError("FileSystem::create", root);
}
if (S_ISDIR(statinfo.st_mode)) {
@@ -389,7 +389,7 @@
}
throw FileTypeError
- ("FileSystem::Create", root,
+ ("FileSystem::create", root,
"cannot create virtual filesystem from file or directory");
}
@@ -400,12 +400,12 @@
{
RealFSImpl fs(path);
- if (fs.IsDirectory(".widelands"))
+ if (fs.is_directory(".widelands"))
return true;
try {
// throws an exception if not writable
- fs.EnsureDirectoryExists(".widelands");
- fs.Unlink(".widelands");
+ fs.ensure_directory_exists(".widelands");
+ fs.unlink(".widelands");
return true;
} catch (...) {
log("Directory %s is not writeable - next try\n", path);
=== modified file 'src/io/filesystem/filesystem.h'
--- src/io/filesystem/filesystem.h 2014-09-14 11:31:58 +0000
+++ src/io/filesystem/filesystem.h 2014-09-29 13:33:11 +0000
@@ -53,20 +53,20 @@
virtual ~FileSystem() {}
// Returns all files and directories (full path) in the given directory 'directory'.
- virtual std::set<std::string> ListDirectory(const std::string& directory) = 0;
-
- virtual bool IsWritable() const = 0;
- virtual bool IsDirectory(const std::string & path) = 0;
- virtual bool FileExists (const std::string & path) = 0;
-
- virtual void * Load(const std::string & fname, size_t & length) = 0;
-
- virtual void Write
+ virtual std::set<std::string> list_directory(const std::string& directory) = 0;
+
+ virtual bool is_writable() const = 0;
+ virtual bool is_directory(const std::string & path) = 0;
+ virtual bool file_exists (const std::string & path) = 0;
+
+ virtual void * load(const std::string & fname, size_t & length) = 0;
+
+ virtual void write
(const std::string & fname, void const * data, int32_t length)
= 0;
- virtual void EnsureDirectoryExists(const std::string & dirname) = 0;
- //TODO(unknown): use this only from inside EnsureDirectoryExists()
- virtual void MakeDirectory(const std::string & dirname) = 0;
+ virtual void ensure_directory_exists(const std::string & fs_dirname) = 0;
+ //TODO(unknown): use this only from inside ensure_directory_exists()
+ virtual void make_directory(const std::string & fs_dirname) = 0;
/**
* Opens the given file for reading as a stream.
@@ -75,7 +75,7 @@
* \return a \ref StreamRead object for the file. The caller must delete this
* object when done to close the file.
*/
- virtual StreamRead * OpenStreamRead(const std::string & fname) = 0;
+ virtual StreamRead * open_stream_read(const std::string & fname) = 0;
/**
* Opens the given file for writing as a stream.
@@ -87,47 +87,47 @@
* delete this object when done to close the file (which will implicitly
* flush unwritten data).
*/
- virtual StreamWrite * OpenStreamWrite(const std::string & fname) = 0;
+ virtual StreamWrite * open_stream_write(const std::string & fname) = 0;
/**
* Creates a subfilesystem from an existing file/directory.
* Passes ownership to caller.
*/
- virtual FileSystem * MakeSubFileSystem(const std::string & dirname) = 0;
+ virtual FileSystem * make_sub_file_system(const std::string & fs_dirname) = 0;
/**
* Creates a subfilesystem from a new file/directory.
* Passes ownership to caller.
*/
- virtual FileSystem * CreateSubFileSystem(const std::string & dirname, Type) = 0;
- virtual void Unlink(const std::string &) = 0;
- virtual void Rename(const std::string &, const std::string &) = 0;
+ virtual FileSystem * create_sub_file_system(const std::string & fs_dirname, Type) = 0;
+ virtual void fs_unlink(const std::string &) = 0;
+ virtual void fs_rename(const std::string &, const std::string &) = 0;
- static FileSystem & Create(const std::string & root)
+ static FileSystem & create(const std::string & root)
;
///Retrieve the filesystem root's name == the mountpoint inside a
///LayeredFileSystem
- virtual std::string getBasename() = 0;
+ virtual std::string get_basename() = 0;
// basic path/filename manipulation
- std::string fixCrossFile(const std::string &) const;
- char fileSeparator() {return m_filesep;}
- std::string getWorkingDirectory() const;
- std::string FS_CanonicalizeName(std::string path) const;
- bool pathIsAbsolute(const std::string & path) const;
+ std::string fix_cross_file(const std::string &) const;
+ char file_separator() {return m_filesep;}
+ std::string get_working_directory() const;
+ std::string canonicalize_name(std::string path) const;
+ bool is_path_absolute(const std::string & path) const;
///Given a filename, return the name with any path stripped off.
- static const char * FS_Filename(const char * n);
- static std::string FS_Dirname(const std::string& full_path);
+ static const char * fs_filename(const char * n);
+ static std::string fs_dirname(const std::string& full_path);
///Given a filename (without any path), return the extension, if any.
- static std::string FS_FilenameExt(const std::string & f);
+ static std::string filename_ext(const std::string & f);
///Given a filename, return the name with any path or extension stripped off.
- static std::string FS_FilenameWoExt(const char * n);
- static std::string GetHomedir();
+ static std::string filename_without_ext(const char * n);
+ static std::string get_homedir();
- virtual unsigned long long DiskSpace() = 0;
+ virtual unsigned long long disk_space() = 0;
protected:
///To get a filesystem, use the Create methods
=== modified file 'src/io/filesystem/layered_filesystem.cc'
--- src/io/filesystem/layered_filesystem.cc 2014-09-14 11:31:58 +0000
+++ src/io/filesystem/layered_filesystem.cc 2014-09-29 13:33:11 +0000
@@ -43,15 +43,15 @@
* Just assume that at least one of our child FSs is writable
*/
// TODO(unknown): Implement me
-bool LayeredFileSystem::IsWritable() const {
+bool LayeredFileSystem::is_writable() const {
return true;
}
-void LayeredFileSystem::AddFileSystem(FileSystem* fs) {
+void LayeredFileSystem::add_file_system(FileSystem* fs) {
m_filesystems.emplace_back(fs);
}
-void LayeredFileSystem::SetHomeFileSystem(FileSystem * fs)
+void LayeredFileSystem::set_home_file_system(FileSystem * fs)
{
m_home.reset(fs);
}
@@ -60,11 +60,11 @@
* Remove a filesystem from the stack
* \param fs The filesystem to be removed
*/
-void LayeredFileSystem::RemoveFileSystem(const FileSystem & fs)
+void LayeredFileSystem::remove_file_system(const FileSystem & fs)
{
if (m_filesystems.back().get() != &fs)
throw std::logic_error
- ("LayeredFileSystem::RemoveFileSystem: interspersed add/remove "
+ ("LayeredFileSystem::remove_file_system: interspersed add/remove "
"detected!");
m_filesystems.pop_back();
}
@@ -77,12 +77,12 @@
*
* Returns the number of files found.
*/
-std::set<std::string> LayeredFileSystem::ListDirectory(const std::string& path) {
+std::set<std::string> LayeredFileSystem::list_directory(const std::string& path) {
std::set<std::string> results;
FilenameSet files;
//check home system first
if (m_home) {
- files = m_home->ListDirectory(path);
+ files = m_home->list_directory(path);
for
(FilenameSet::iterator fnit = files.begin();
fnit != files.end();
@@ -91,7 +91,7 @@
}
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it) {
- files = (*it)->ListDirectory(path);
+ files = (*it)->list_directory(path);
for (FilenameSet::iterator fnit = files.begin(); fnit != files.end(); ++fnit)
results.insert(*fnit);
@@ -102,11 +102,11 @@
/**
* Returns true if the file can be found in at least one of the sub-filesystems
*/
-bool LayeredFileSystem::FileExists(const std::string & path) {
- if (m_home && m_home->FileExists(path))
+bool LayeredFileSystem::file_exists(const std::string & path) {
+ if (m_home && m_home->file_exists(path))
return true;
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
- if ((*it)->FileExists(path))
+ if ((*it)->file_exists(path))
return true;
return false;
@@ -116,32 +116,32 @@
* Returns true if path is a directory in at least one of the directories
*/
// TODO(unknown): What if it's a file in some and a dir in others?????
-bool LayeredFileSystem::IsDirectory(const std::string & path) {
- if (m_home && m_home->IsDirectory(path))
+bool LayeredFileSystem::is_directory(const std::string & path) {
+ if (m_home && m_home->is_directory(path))
return true;
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
- if ((*it)->IsDirectory(path))
+ if ((*it)->is_directory(path))
return true;
return false;
}
/**
- * Read the given file into alloced memory; called by FileRead::Open.
+ * Read the given file into alloced memory; called by FileRead::open.
* Throws an exception if the file couldn't be opened.
*
* Note: We first query the sub-filesystem whether the file exists. Otherwise,
* we'd have problems differentiating the errors returned by the sub-FS.
* Let's just avoid any possible hassles with that.
*/
-void * LayeredFileSystem::Load(const std::string & fname, size_t & length) {
- if (m_home && m_home->FileExists(fname))
- return m_home->Load(fname, length);
+void * LayeredFileSystem::load(const std::string & fname, size_t & length) {
+ if (m_home && m_home->file_exists(fname))
+ return m_home->load(fname, length);
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
- if ((*it)->FileExists(fname))
- return (*it)->Load(fname, length);
+ if ((*it)->file_exists(fname))
+ return (*it)->load(fname, length);
throw FileNotFoundError("Could not find file", fname);
}
@@ -150,15 +150,15 @@
* Write the given block of memory out as a file to the first writable sub-FS.
* Throws an exception if it fails.
*/
-void LayeredFileSystem::Write
+void LayeredFileSystem::write
(const std::string & fname, void const * const data, int32_t const length)
{
- if (m_home && m_home->IsWritable())
- return m_home->Write(fname, data, length);
+ if (m_home && m_home->is_writable())
+ return m_home->write(fname, data, length);
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
- if ((*it)->IsWritable())
- return (*it)->Write(fname, data, length);
+ if ((*it)->is_writable())
+ return (*it)->write(fname, data, length);
throw wexception("LayeredFileSystem: No writable filesystem!");
}
@@ -167,13 +167,13 @@
* Analogously to Read, open the file from the first sub-filesystem where
* it exists.
*/
-StreamRead * LayeredFileSystem::OpenStreamRead (const std::string & fname) {
- if (m_home && m_home->FileExists(fname))
- return m_home->OpenStreamRead(fname);
+StreamRead * LayeredFileSystem::open_stream_read (const std::string & fname) {
+ if (m_home && m_home->file_exists(fname))
+ return m_home->open_stream_read(fname);
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
- if ((*it)->FileExists(fname))
- return (*it)->OpenStreamRead(fname);
+ if ((*it)->file_exists(fname))
+ return (*it)->open_stream_read(fname);
throw FileNotFoundError("Could not find file", fname);
}
@@ -181,13 +181,13 @@
/**
* Analogously to Write, create the file in the first writable sub-FS.
*/
-StreamWrite * LayeredFileSystem::OpenStreamWrite(const std::string & fname) {
- if (m_home && m_home->IsWritable())
- return m_home->OpenStreamWrite(fname);
+StreamWrite * LayeredFileSystem::open_stream_write(const std::string & fname) {
+ if (m_home && m_home->is_writable())
+ return m_home->open_stream_write(fname);
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
- if ((*it)->IsWritable())
- return (*it)->OpenStreamWrite(fname);
+ if ((*it)->is_writable())
+ return (*it)->open_stream_write(fname);
throw wexception("LayeredFileSystem: No writable filesystem!");
}
@@ -195,27 +195,27 @@
/**
* MakeDir in first writable directory
*/
-void LayeredFileSystem::MakeDirectory(const std::string & dirname) {
- if (m_home && m_home->IsWritable())
- return m_home->MakeDirectory(dirname);
+void LayeredFileSystem::make_directory(const std::string & dirname) {
+ if (m_home && m_home->is_writable())
+ return m_home->make_directory(dirname);
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
- if ((*it)->IsWritable())
- return (*it)->MakeDirectory(dirname);
+ if ((*it)->is_writable())
+ return (*it)->make_directory(dirname);
throw wexception("LayeredFileSystem: No writable filesystem!");
}
/**
- * EnsureDirectoryExists in first writable directory
+ * ensure_directory_exists in first writable directory
*/
-void LayeredFileSystem::EnsureDirectoryExists(const std::string & dirname) {
- if (m_home && m_home->IsWritable())
- return m_home->EnsureDirectoryExists(dirname);
+void LayeredFileSystem::ensure_directory_exists(const std::string & dirname) {
+ if (m_home && m_home->is_writable())
+ return m_home->ensure_directory_exists(dirname);
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
- if ((*it)->IsWritable())
- return (*it)->EnsureDirectoryExists(dirname);
+ if ((*it)->is_writable())
+ return (*it)->ensure_directory_exists(dirname);
throw wexception("LayeredFileSystem: No writable filesystem!");
}
@@ -223,14 +223,14 @@
/**
* Create a subfilesystem from an existing file/directory
*/
-FileSystem * LayeredFileSystem::MakeSubFileSystem(const std::string & dirname)
+FileSystem * LayeredFileSystem::make_sub_file_system(const std::string & dirname)
{
- if (m_home && m_home->IsWritable() && m_home->FileExists(dirname))
- return m_home->MakeSubFileSystem(dirname);
+ if (m_home && m_home->is_writable() && m_home->file_exists(dirname))
+ return m_home->make_sub_file_system(dirname);
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
- if ((*it)->IsWritable() && (*it)->FileExists(dirname))
- return (*it)->MakeSubFileSystem(dirname);
+ if ((*it)->is_writable() && (*it)->file_exists(dirname))
+ return (*it)->make_sub_file_system(dirname);
throw wexception("LayeredFileSystem: unable to create sub filesystem");
}
@@ -238,14 +238,14 @@
/**
* Create a subfilesystem from a new file/directory
*/
-FileSystem * LayeredFileSystem::CreateSubFileSystem(const std::string & dirname, Type const type)
+FileSystem * LayeredFileSystem::create_sub_file_system(const std::string & dirname, Type const type)
{
- if (m_home && m_home->IsWritable() && !m_home->FileExists(dirname))
- return m_home->CreateSubFileSystem(dirname, type);
+ if (m_home && m_home->is_writable() && !m_home->file_exists(dirname))
+ return m_home->create_sub_file_system(dirname, type);
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
- if ((*it)->IsWritable() && !(*it)->FileExists(dirname))
- return (*it)->CreateSubFileSystem(dirname, type);
+ if ((*it)->is_writable() && !(*it)->file_exists(dirname))
+ return (*it)->create_sub_file_system(dirname, type);
throw wexception("LayeredFileSystem: unable to create sub filesystem");
}
@@ -253,33 +253,34 @@
/**
* Remove this file or directory. If it is a directory, remove it recursively
*/
-void LayeredFileSystem::Unlink(const std::string & file) {
- if (!FileExists(file))
+void LayeredFileSystem::fs_unlink(const std::string & file) {
+ if (!file_exists(file))
return;
- if (m_home && m_home->IsWritable() && m_home->FileExists(file)) {
- m_home->Unlink(file);
+ if (m_home && m_home->is_writable() && m_home->file_exists(file)) {
+ m_home->fs_unlink(file);
return;
}
+
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
- if ((*it)->IsWritable() && (*it)->FileExists(file)) {
- (*it)->Unlink(file);
+ if ((*it)->is_writable() && (*it)->file_exists(file)) {
+ (*it)->fs_unlink(file);
return;
}
}
-void LayeredFileSystem::Rename
+void LayeredFileSystem::fs_rename
(const std::string & old_name, const std::string & new_name)
{
- if (!FileExists(old_name))
+ if (!file_exists(old_name))
return;
- if (m_home && m_home->IsWritable() && m_home->FileExists(old_name)) {
- m_home->Rename(old_name, new_name);
+ if (m_home && m_home->is_writable() && m_home->file_exists(old_name)) {
+ m_home->fs_rename(old_name, new_name);
return;
}
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
- if ((*it)->IsWritable() && (*it)->FileExists(old_name)) {
- (*it)->Rename(old_name, new_name);
+ if ((*it)->is_writable() && (*it)->file_exists(old_name)) {
+ (*it)->fs_rename(old_name, new_name);
return;
}
}
@@ -288,12 +289,12 @@
// or the first directory on the stack we can find.
// This heuristic is justified by the fact that ths is
// where we will create new files.
-unsigned long long LayeredFileSystem::DiskSpace() {
+unsigned long long LayeredFileSystem::disk_space() {
if (m_home) {
- return m_home->DiskSpace();
+ return m_home->disk_space();
}
for (auto it = m_filesystems.rbegin(); it != m_filesystems.rend(); ++it)
if (*it)
- return (*it)->DiskSpace();
+ return (*it)->disk_space();
return 0;
}
=== modified file 'src/io/filesystem/layered_filesystem.h'
--- src/io/filesystem/layered_filesystem.h 2014-07-26 10:43:23 +0000
+++ src/io/filesystem/layered_filesystem.h 2014-09-29 13:33:11 +0000
@@ -50,37 +50,37 @@
// Add a new filesystem to the top of the stack. Take ownership of the given
// filesystem.
- void AddFileSystem(FileSystem*);
+ void add_file_system(FileSystem*);
// Set the home filesystem (which is the preferred filesystem for writing
// files). Take ownership of the given filesystem.
- void SetHomeFileSystem(FileSystem*);
-
- virtual void RemoveFileSystem(const FileSystem &);
-
- std::set<std::string> ListDirectory(const std::string& path) override;
-
- bool IsWritable() const override;
- bool FileExists(const std::string & path) override;
- bool IsDirectory (const std::string & path) override;
- void EnsureDirectoryExists(const std::string & dirname) override;
- void MakeDirectory (const std::string & dirname) override;
-
- void * Load(const std::string & fname, size_t & length) override;
- virtual void Write
+ void set_home_file_system(FileSystem*);
+
+ virtual void remove_file_system(const FileSystem &);
+
+ std::set<std::string> list_directory(const std::string& path) override;
+
+ bool is_writable () const override;
+ bool file_exists (const std::string & path) override;
+ bool is_directory (const std::string & path) override;
+ void ensure_directory_exists(const std::string & fs_dirname) override;
+ void make_directory (const std::string & fs_dirname) override;
+
+ void * load(const std::string & fname, size_t & length) override;
+ virtual void write
(const std::string & fname, void const * data, int32_t length) override;
- StreamRead * OpenStreamRead (const std::string & fname) override;
- StreamWrite * OpenStreamWrite(const std::string & fname) override;
-
- FileSystem * MakeSubFileSystem(const std::string & dirname) override;
- FileSystem * CreateSubFileSystem(const std::string & dirname, Type) override;
- void Unlink(const std::string & file) override;
- void Rename(const std::string &, const std::string &) override;
-
- std::string getBasename() override {return std::string();}
-
- unsigned long long DiskSpace() override;
+ StreamRead * open_stream_read (const std::string & fname) override;
+ StreamWrite * open_stream_write(const std::string & fname) override;
+
+ FileSystem * make_sub_file_system(const std::string & fs_dirname) override;
+ FileSystem * create_sub_file_system(const std::string & fs_dirname, Type) override;
+ void fs_unlink(const std::string & file) override;
+ void fs_rename(const std::string &, const std::string &) override;
+
+ std::string get_basename() override {return std::string();}
+
+ unsigned long long disk_space() override;
private:
std::vector<std::unique_ptr<FileSystem>> m_filesystems;
=== modified file 'src/io/filesystem/test/test_filesystem.cc'
--- src/io/filesystem/test/test_filesystem.cc 2014-07-14 10:45:44 +0000
+++ src/io/filesystem/test/test_filesystem.cc 2014-09-29 13:33:11 +0000
@@ -34,7 +34,7 @@
if (!s.empty() && s[0] == '\\')
{
// Insert drive letter part from current working directory
- std::string cwd = RealFSImpl("").getWorkingDirectory();
+ std::string cwd = RealFSImpl("").get_working_directory();
s.insert(0, cwd.substr(0, 2));
}
return s;
@@ -53,15 +53,15 @@
BOOST_AUTO_TEST_SUITE(FileSystemTests)
#ifndef _WIN32
#define TEST_CANONICALIZE_NAME(root, path, expected) \
- BOOST_CHECK_EQUAL(RealFSImpl(root).FS_CanonicalizeName(path), expected);
+ BOOST_CHECK_EQUAL(RealFSImpl(root).canonicalize_name(path), expected);
#else
#define TEST_CANONICALIZE_NAME(root, path, expected) \
- BOOST_CHECK_EQUAL(RealFSImpl(Win32Path(root)).FS_CanonicalizeName(path), Win32Path(expected));
+ BOOST_CHECK_EQUAL(RealFSImpl(Win32Path(root)).canonicalize_name(path), Win32Path(expected));
#endif
BOOST_AUTO_TEST_CASE(test_canonicalize_name) {
setenv("HOME", "/home/test", 1);
- std::string cwd = RealFSImpl("").getWorkingDirectory();
+ std::string cwd = RealFSImpl("").get_working_directory();
// RealFSImpl is constructed with a root directory...
@@ -128,8 +128,8 @@
#ifdef _WIN32
// Check drive letter handling.
- BOOST_CHECK_EQUAL(RealFSImpl("C:\\").FS_CanonicalizeName("C:\\"), "C:");
- BOOST_CHECK_EQUAL(RealFSImpl("C:\\").FS_CanonicalizeName("D:\\"), "C:\\D:");
+ BOOST_CHECK_EQUAL(RealFSImpl("C:\\").canonicalize_name("C:\\"), "C:");
+ BOOST_CHECK_EQUAL(RealFSImpl("C:\\").canonicalize_name("D:\\"), "C:\\D:");
#endif
}
@@ -138,7 +138,7 @@
// ~ gets expanded to $HOME
BOOST_AUTO_TEST_CASE(test_canonicalize_name_home_expansion) {
setenv("HOME", "/my/home", 1);
- std::string cwd = RealFSImpl("").getWorkingDirectory();
+ std::string cwd = RealFSImpl("").get_working_directory();
TEST_CANONICALIZE_NAME("~", "path", "/my/home/path");
TEST_CANONICALIZE_NAME("~/test", "path", "/my/home/test/path");
=== modified file 'src/io/filesystem/zip_exceptions.h'
--- src/io/filesystem/zip_exceptions.h 2014-09-10 13:03:40 +0000
+++ src/io/filesystem/zip_exceptions.h 2014-09-29 13:33:11 +0000
@@ -27,7 +27,7 @@
*
* Problems with the zipfile itself or normal file operations should throw
* FileError or one of it's descendants with an appropriate message. E.g.:
- * throw FileNotFoundError("ZipFilesystem::Load", fname,
+ * throw FileNotFoundError("ZipFilesystem::load", fname,
* "couldn't open file (from zipfile "+m_zipfilename+")");
*/
struct ZipOperationError : public std::logic_error {
=== modified file 'src/io/filesystem/zip_filesystem.cc'
--- src/io/filesystem/zip_filesystem.cc 2014-09-10 13:03:40 +0000
+++ src/io/filesystem/zip_filesystem.cc 2014-09-29 13:33:11 +0000
@@ -43,7 +43,7 @@
m_unzipfile (nullptr),
m_oldzip (false),
m_zipfilename(zipfile),
-m_basenamezip(FS_Filename(zipfile.c_str())),
+m_basenamezip(fs_filename(zipfile.c_str())),
m_basename ()
{
// TODO(unknown): check OS permissions on whether the file is writable
@@ -54,13 +54,13 @@
*/
ZipFilesystem::~ZipFilesystem()
{
- m_Close();
+ m_close();
}
/**
* Return true if this directory is writable.
*/
-bool ZipFilesystem::IsWritable() const {
+bool ZipFilesystem::is_writable() const {
return true; // should be checked in constructor
}
@@ -69,8 +69,8 @@
* pathname) in the results. There doesn't seem to be an even remotely
* cross-platform way of doing this
*/
-std::set<std::string> ZipFilesystem::ListDirectory(const std::string& path_in) {
- m_OpenUnzip();
+std::set<std::string> ZipFilesystem::list_directory(const std::string& path_in) {
+ m_open_unzip();
assert(path_in.size()); // prevent invalid read below
@@ -95,7 +95,7 @@
nullptr, 0, nullptr, 0);
std::string complete_filename = strip_basename(filename_inzip);
- std::string filename = FS_Filename(complete_filename.c_str());
+ std::string filename = fs_filename(complete_filename.c_str());
std::string filepath =
complete_filename.substr
(0, complete_filename.size() - filename.size());
@@ -118,9 +118,9 @@
* Returns true if the given file exists, and false if it doesn't.
* Also returns false if the pathname is invalid
*/
-bool ZipFilesystem::FileExists(const std::string & path) {
+bool ZipFilesystem::file_exists(const std::string & path) {
try {
- m_OpenUnzip(); // TODO(unknown): check return value
+ m_open_unzip(); // TODO(unknown): check return value
} catch (...) {
return false;
}
@@ -159,9 +159,9 @@
* Returns true if the given file is a directory, and false if it doesn't.
* Also returns false if the pathname is invalid
*/
-bool ZipFilesystem::IsDirectory(const std::string & path) {
+bool ZipFilesystem::is_directory(const std::string & path) {
- if (!FileExists(path))
+ if (!file_exists(path))
return false;
unz_file_info file_info;
@@ -177,13 +177,13 @@
/**
* Create a sub filesystem out of this filesystem
*/
-FileSystem * ZipFilesystem::MakeSubFileSystem(const std::string & path) {
- m_OpenUnzip();
-
- assert(FileExists(path));
- assert(IsDirectory(path));
-
- m_Close();
+FileSystem * ZipFilesystem::make_sub_file_system(const std::string & path) {
+ m_open_unzip();
+
+ assert(file_exists(path));
+ assert(is_directory(path));
+
+ m_close();
std::string localpath = path;
@@ -201,20 +201,20 @@
* \throw ZipOperationError
*/
// TODO(unknown): type should be recognized automatically,
-// see Filesystem::Create
-FileSystem * ZipFilesystem::CreateSubFileSystem(const std::string & path, Type const type)
+// see Filesystem::create
+FileSystem * ZipFilesystem::create_sub_file_system(const std::string & path, Type const type)
{
- assert(!FileExists(path));
+ assert(!file_exists(path));
if (type != FileSystem::DIR)
throw ZipOperationError
- ("ZipFilesystem::CreateSubFileSystem",
+ ("ZipFilesystem::create_sub_file_system",
path, m_zipfilename,
"can not create ZipFilesystem inside another ZipFilesystem");
- EnsureDirectoryExists(path);
+ ensure_directory_exists(path);
- m_Close();
+ m_close();
std::string localpath = path;
@@ -231,9 +231,9 @@
* Remove a number of files
* \throw ZipOperationError
*/
-void ZipFilesystem::Unlink(const std::string & filename) {
+void ZipFilesystem::fs_unlink(const std::string & filename) {
throw ZipOperationError
- ("ZipFilesystem::Unlink",
+ ("ZipFilesystem::unlink",
filename,
m_zipfilename,
"unlinking is not supported inside zipfiles");
@@ -243,11 +243,11 @@
* Create this directory if it doesn't exist, throws an error
* if the dir can't be created or if a file with this name exists
*/
-void ZipFilesystem::EnsureDirectoryExists(const std::string & dirname) {
- if (FileExists(dirname) && IsDirectory(dirname))
+void ZipFilesystem::ensure_directory_exists(const std::string & dirname) {
+ if (file_exists(dirname) && is_directory(dirname))
return;
- MakeDirectory(dirname);
+ make_directory(dirname);
}
/**
@@ -255,11 +255,11 @@
* if a file is in the way or if the creation fails.
*
* Pleas note, this function does not honor parents,
- * MakeDirectory("onedir/otherdir/onemoredir") will fail
+ * make_directory("onedir/otherdir/onemoredir") will fail
* if either ondir or otherdir is missing
*/
-void ZipFilesystem::MakeDirectory(const std::string & dirname) {
- m_OpenZip();
+void ZipFilesystem::make_directory(const std::string & dirname) {
+ m_open_zip();
zip_fileinfo zi;
@@ -296,23 +296,23 @@
break;
case ZIP_ERRNO:
throw FileError
- ("ZipFilesystem::MakeDirectory", complete_filename, strerror(errno));
+ ("ZipFilesystem::make_directory", complete_filename, strerror(errno));
default:
throw FileError
- ("ZipFilesystem::MakeDirectory", complete_filename);
+ ("ZipFilesystem::make_directory", complete_filename);
}
zipCloseFileInZip(m_zipfile);
}
/**
- * Read the given file into alloced memory; called by FileRead::Open.
+ * Read the given file into alloced memory; called by FileRead::open.
* \throw FileNotFoundError if the file couldn't be opened.
*/
-void * ZipFilesystem::Load(const std::string & fname, size_t & length) {
- if (!FileExists(fname.c_str()) || IsDirectory(fname.c_str()))
+void * ZipFilesystem::load(const std::string & fname, size_t & length) {
+ if (!file_exists(fname.c_str()) || is_directory(fname.c_str()))
throw ZipOperationError
- ("ZipFilesystem::Load",
+ ("ZipFilesystem::load",
fname,
m_zipfilename,
"could not open file from zipfile");
@@ -330,7 +330,7 @@
char buf[200];
snprintf(buf, sizeof(buf), "read error %i", len);
throw ZipOperationError
- ("ZipFilesystem::Load",
+ ("ZipFilesystem::load",
fname,
m_zipfilename,
buf);
@@ -357,13 +357,13 @@
* Write the given block of memory to the repository.
* Throws an exception if it fails.
*/
-void ZipFilesystem::Write
+void ZipFilesystem::write
(const std::string & fname, void const * const data, int32_t const length)
{
std::string filename = fname;
std::replace(filename.begin(), filename.end(), '\\', '/');
- m_OpenZip();
+ m_open_zip();
zip_fileinfo zi;
@@ -389,7 +389,7 @@
break;
default:
throw ZipOperationError
- ("ZipFilesystem::Write", complete_filename, m_zipfilename);
+ ("ZipFilesystem::write", complete_filename, m_zipfilename);
}
switch (zipWriteInFileInZip (m_zipfile, data, length)) {
@@ -397,10 +397,10 @@
break;
case ZIP_ERRNO:
throw FileError
- ("ZipFilesystem::Write", complete_filename, strerror(errno));
+ ("ZipFilesystem::write", complete_filename, strerror(errno));
default:
throw FileError
- ("ZipFilesystem::Write", complete_filename);
+ ("ZipFilesystem::write", complete_filename);
}
zipCloseFileInZip(m_zipfile);
@@ -413,12 +413,12 @@
ZipFilesystem::ZipStreamRead::ZipStreamRead(zipFile file, ZipFilesystem* zipfs)
: m_unzipfile(file), m_zipfs(zipfs) {}
ZipFilesystem::ZipStreamRead::~ZipStreamRead() {
- m_zipfs->m_Close();
+ m_zipfs->m_close();
}
-size_t ZipFilesystem::ZipStreamRead::Data(void* data, size_t bufsize)
+size_t ZipFilesystem::ZipStreamRead::data(void* read_data, size_t bufsize)
{
- int copied = unzReadCurrentFile(m_unzipfile, data, bufsize);
+ int copied = unzReadCurrentFile(m_unzipfile, read_data, bufsize);
if (copied < 0) {
throw new DataError("Failed to read from zip file");
}
@@ -427,21 +427,21 @@
}
return copied;
}
-bool ZipFilesystem::ZipStreamRead::EndOfFile() const
+bool ZipFilesystem::ZipStreamRead::end_of_file() const
{
return unzReadCurrentFile(m_unzipfile, nullptr, 1) == 0;
}
-StreamRead* ZipFilesystem::OpenStreamRead(const std::string& fname) {
- if (!FileExists(fname.c_str()) || IsDirectory(fname.c_str()))
+StreamRead* ZipFilesystem::open_stream_read(const std::string& fname) {
+ if (!file_exists(fname.c_str()) || is_directory(fname.c_str()))
throw ZipOperationError
- ("ZipFilesystem::Load",
+ ("ZipFilesystem::load",
fname,
m_zipfilename,
"could not open file from zipfile");
int32_t method;
- m_OpenUnzip();
+ m_open_unzip();
int result = unzOpenCurrentFile3(m_unzipfile, &method, nullptr, 1, nullptr);
switch (result) {
case ZIP_OK:
@@ -461,12 +461,12 @@
: m_zipfile(file), m_zipfs(zipfs) {}
ZipFilesystem::ZipStreamWrite::~ZipStreamWrite()
{
- m_zipfs->m_Close();
+ m_zipfs->m_close();
}
-void ZipFilesystem::ZipStreamWrite::Data(const void* const data, const size_t size)
+void ZipFilesystem::ZipStreamWrite::data(const void* const write_data, const size_t size)
{
- int result = zipWriteInFileInZip(m_zipfile, data, size);
+ int result = zipWriteInFileInZip(m_zipfile, write_data, size);
switch (result) {
case ZIP_OK:
break;
@@ -475,8 +475,8 @@
}
}
-StreamWrite * ZipFilesystem::OpenStreamWrite(const std::string & fname) {
- m_OpenZip();
+StreamWrite * ZipFilesystem::open_stream_write(const std::string & fname) {
+ m_open_zip();
zip_fileinfo zi;
@@ -510,7 +510,7 @@
/**
* Private Functions below
*/
-void ZipFilesystem::m_Close() {
+void ZipFilesystem::m_close() {
if (m_state == STATE_ZIPPING)
zipClose(m_zipfile, nullptr);
else if (m_state == STATE_UNZIPPPING)
@@ -522,11 +522,11 @@
/**
* Open a zipfile for compressing
*/
-void ZipFilesystem::m_OpenZip() {
+void ZipFilesystem::m_open_zip() {
if (m_state == STATE_ZIPPING)
return;
- m_Close();
+ m_close();
m_zipfile = zipOpen(m_zipfilename.c_str(), APPEND_STATUS_ADDINZIP);
if (!m_zipfile) {
@@ -541,25 +541,25 @@
* Open a zipfile for extraction
* \throw FileTypeError
*/
-void ZipFilesystem::m_OpenUnzip() {
+void ZipFilesystem::m_open_unzip() {
if (m_state == STATE_UNZIPPPING)
return;
- m_Close();
+ m_close();
m_unzipfile = unzOpen(m_zipfilename.c_str());
if (!m_unzipfile)
throw FileTypeError
- ("ZipFilesystem::m_OpenUnzip", m_zipfilename, "not a .zip file");
+ ("ZipFilesystem::m_open_unzip", m_zipfilename, "not a .zip file");
m_state = STATE_UNZIPPPING;
}
-void ZipFilesystem::Rename(const std::string &, const std::string &) {
+void ZipFilesystem::fs_rename(const std::string &, const std::string &) {
throw wexception("rename inside zip FS is not implemented yet");
}
-unsigned long long ZipFilesystem::DiskSpace() {
+unsigned long long ZipFilesystem::disk_space() {
return 0;
}
=== modified file 'src/io/filesystem/zip_filesystem.h'
--- src/io/filesystem/zip_filesystem.h 2014-07-26 10:43:23 +0000
+++ src/io/filesystem/zip_filesystem.h 2014-09-29 13:33:11 +0000
@@ -35,40 +35,40 @@
explicit ZipFilesystem(const std::string &);
virtual ~ZipFilesystem();
- bool IsWritable() const override;
-
- std::set<std::string> ListDirectory(const std::string& path) override;
-
- bool IsDirectory(const std::string & path) override;
- bool FileExists (const std::string & path) override;
-
- void * Load(const std::string & fname, size_t & length) override;
-
- virtual void Write
+ bool is_writable() const override;
+
+ std::set<std::string> list_directory(const std::string& path) override;
+
+ bool is_directory(const std::string & path) override;
+ bool file_exists (const std::string & path) override;
+
+ void * load(const std::string & fname, size_t & length) override;
+
+ virtual void write
(const std::string & fname, void const * data, int32_t length) override;
- void EnsureDirectoryExists(const std::string & dirname) override;
- void MakeDirectory (const std::string & dirname) override;
-
- virtual StreamRead * OpenStreamRead
- (const std::string & fname) override;
- virtual StreamWrite * OpenStreamWrite
- (const std::string & fname) override;
-
- FileSystem * MakeSubFileSystem(const std::string & dirname) override;
- FileSystem * CreateSubFileSystem(const std::string & dirname, Type) override;
- void Unlink(const std::string & filename) override;
- void Rename(const std::string &, const std::string &) override;
-
- unsigned long long DiskSpace() override;
-
- static FileSystem * CreateFromDirectory(const std::string & directory);
-
- std::string getBasename() override {return m_zipfilename;}
+ void ensure_directory_exists(const std::string & fs_dirname) override;
+ void make_directory (const std::string & fs_dirname) override;
+
+ virtual StreamRead * open_stream_read
+ (const std::string & fname) override;
+ virtual StreamWrite * open_stream_write
+ (const std::string & fname) override;
+
+ FileSystem * make_sub_file_system(const std::string & fs_dirname) override;
+ FileSystem * create_sub_file_system(const std::string & fs_dirname, Type) override;
+ void fs_unlink(const std::string & fs_filename) override;
+ void fs_rename(const std::string &, const std::string &) override;
+
+ unsigned long long disk_space() override;
+
+ static FileSystem * create_from_directory(const std::string & directory);
+
+ std::string get_basename() override {return m_zipfilename;}
protected:
- void m_OpenUnzip();
- void m_OpenZip();
- void m_Close();
+ void m_open_unzip();
+ void m_open_zip();
+ void m_close();
std::string strip_basename(std::string);
enum State {
@@ -90,8 +90,8 @@
struct ZipStreamRead : StreamRead {
explicit ZipStreamRead(zipFile file, ZipFilesystem* zipfs);
virtual ~ZipStreamRead();
- size_t Data(void* data, size_t bufsize) override;
- bool EndOfFile() const override;
+ size_t data(void* data, size_t bufsize) override;
+ bool end_of_file() const override;
private:
zipFile m_unzipfile;
ZipFilesystem* m_zipfs;
@@ -99,7 +99,7 @@
struct ZipStreamWrite : StreamWrite {
explicit ZipStreamWrite(zipFile file, ZipFilesystem* zipfs);
virtual ~ZipStreamWrite();
- void Data(const void* const data, size_t size) override;
+ void data(const void* const data, size_t size) override;
private:
zipFile m_zipfile;
ZipFilesystem* m_zipfs;
=== modified file 'src/io/filewrite.cc'
--- src/io/filewrite.cc 2014-07-20 07:44:22 +0000
+++ src/io/filewrite.cc 2014-09-29 13:33:11 +0000
@@ -26,39 +26,39 @@
}
FileWrite::~FileWrite() {
- Clear();
+ clear();
}
-void FileWrite::Clear() {
+void FileWrite::clear() {
free(data_);
data_ = nullptr;
length_ = max_size_ = 0;
filepos_ = 0;
}
-void FileWrite::Write(FileSystem& fs, char const* const filename) {
- fs.Write(filename, data_, length_);
- Clear();
-}
-
-void FileWrite::WriteAppend(RealFSImpl& fs, char const* const filename) {
- fs.Write(filename, data_, length_, true);
- Clear();
-}
-
-FileWrite::Pos FileWrite::GetPos() const {
+void FileWrite::write(FileSystem& fs, char const* const filename) {
+ fs.write(filename, data_, length_);
+ clear();
+}
+
+void FileWrite::write_append(RealFSImpl& fs, char const* const filename) {
+ fs.write(filename, data_, length_, true);
+ clear();
+}
+
+FileWrite::Pos FileWrite::get_pos() const {
return filepos_;
}
-void FileWrite::SetPos(const Pos pos) {
+void FileWrite::set_pos(const Pos pos) {
filepos_ = pos;
}
-void FileWrite::Data(const void* const src, const size_t size, Pos const pos = Pos::Null()) {
+void FileWrite::data(const void* const src, const size_t size, Pos const pos = Pos::null()) {
assert(data_ || !length_);
Pos i = pos;
- if (pos.isNull()) {
+ if (pos.is_null()) {
i = filepos_;
filepos_ += size;
}
@@ -76,10 +76,10 @@
memcpy(data_ + i, src, size);
}
-void FileWrite::Data(void const* const src, size_t const size) {
- Data(src, size, Pos::Null());
+void FileWrite::data(void const* const src, size_t const size) {
+ data(src, size, Pos::null());
}
-std::string FileWrite::GetData() const {
+std::string FileWrite::get_data() const {
return std::string(data_, length_);
}
=== modified file 'src/io/filewrite.h'
--- src/io/filewrite.h 2014-09-10 16:57:31 +0000
+++ src/io/filewrite.h 2014-09-29 13:33:11 +0000
@@ -32,7 +32,7 @@
class RealFSImpl;
/// Mirror of \ref FileRead : all writes are first stored in a block of memory
-/// and finally written out when Write() is called.
+/// and finally written out when write() is called.
class FileWrite : public StreamWrite {
public:
struct Pos {
@@ -40,12 +40,12 @@
}
/// Returns a special value indicating invalidity.
- static Pos Null() {
+ static Pos null() {
return std::numeric_limits<size_t>::max();
}
- bool isNull() const {
- return *this == Null();
+ bool is_null() const {
+ return *this == null();
}
operator size_t() const {
return pos;
@@ -71,33 +71,33 @@
~FileWrite() override;
/// Clears the object's buffer.
- void Clear();
+ void clear();
/// Write the file out to disk. If successful, this clears the buffers.
/// Otherwise, an exception is thrown but the buffer remains intact (don't
/// worry, it will be cleared by the destructor).
- void Write(FileSystem& fs, char const* const filename);
+ void write(FileSystem& fs, char const* const filename);
/// Same as above, just that the data is appended to the file
/// NOTE RealFSImpl is used by purpose - zip filesystems do not support appending
- void WriteAppend(RealFSImpl& fs, char const* const filename);
+ void write_append(RealFSImpl& fs, char const* const filename);
/// Get the position that will be written to in the next write operation that
/// does not specify a position.
- Pos GetPos() const;
+ Pos get_pos() const;
/// Set the file pointer to a new location. The position can be beyond the
/// current end of file.
- void SetPos(Pos pos);
+ void set_pos(Pos pos);
/// Write data at the given location.
- void Data(const void* src, size_t size, Pos pos);
+ void data(const void* src, size_t size, Pos pos);
/// Write data at the current file pointer and advance it.
- void Data(void const* src, size_t size) override;
+ void data(void const* src, size_t size) override;
/// Returns the current buffer. Use this for in_memory operations.
- std::string GetData() const;
+ std::string get_data() const;
private:
char* data_;
=== modified file 'src/io/machdep.h'
--- src/io/machdep.h 2014-07-26 16:37:37 +0000
+++ src/io/machdep.h 2014-09-29 13:33:11 +0000
@@ -32,16 +32,16 @@
CLANG_DIAG_OFF("-Wself-assign")
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
-#define Little16(x) (x)
-#define Little32(x) (x)
-#define LittleFloat(x) (x)
+#define little_16(x) (x)
+#define little_32(x) (x)
+#define little_float(x) (x)
#else
-#define Little16(x) Swap16(x)
-#define Little32(x) Swap32(x)
-#define LittleFloat(x) SwapFloat(x)
+#define little_16(x) swap_16(x)
+#define little_32(x) swap_32(x)
+#define little_float(x) swap_float(x)
#endif
-inline uint16_t Swap16(const uint16_t x) {
+inline uint16_t swap_16(const uint16_t x) {
uint16_t s;
reinterpret_cast<uint8_t *>(&s)[0] =
reinterpret_cast<const uint8_t *>(&x)[1];
@@ -50,7 +50,7 @@
return s;
}
-inline uint32_t Swap32(const uint32_t x) {
+inline uint32_t swap_32(const uint32_t x) {
uint32_t s;
reinterpret_cast<uint8_t *>(&s)[0] =
reinterpret_cast<const uint8_t *>(&x)[3];
@@ -63,7 +63,7 @@
return s;
}
-inline float SwapFloat(const float x)
+inline float swap_float(const float x)
{
float s;
reinterpret_cast<uint8_t *>(&s)[0] =
@@ -77,23 +77,23 @@
return s;
}
-inline uint8_t Deref8(void const * const ptr) {
+inline uint8_t deref_8(void const * const ptr) {
return *reinterpret_cast<uint8_t const *>(ptr);
}
-inline uint16_t Deref16(const void * const ptr) {
+inline uint16_t deref_16(const void * const ptr) {
uint16_t r;
memcpy(&r, ptr, sizeof(r));
return r;
}
-inline uint32_t Deref32(const void * const ptr) {
+inline uint32_t deref_32(const void * const ptr) {
uint32_t r;
memcpy(&r, ptr, sizeof(r));
return r;
}
-inline float DerefFloat(const void * const ptr) {
+inline float deref_float(const void * const ptr) {
float r;
memcpy(&r, ptr, sizeof(r));
return r;
=== modified file 'src/io/streamread.cc'
--- src/io/streamread.cc 2014-09-09 17:15:20 +0000
+++ src/io/streamread.cc 2014-09-29 13:33:11 +0000
@@ -44,9 +44,9 @@
* If the requested number of bytes couldn't be read, this function
* fails by throwing an exception.
*/
-void StreamRead::DataComplete(void * const data, const size_t size)
+void StreamRead::data_complete(void * const read_data, const size_t size)
{
- size_t read = Data(data, size);
+ size_t read = data(read_data, size);
if (read != size)
throw data_error
@@ -55,49 +55,49 @@
static_cast<long unsigned int>(size));
}
-int8_t StreamRead::Signed8() {
+int8_t StreamRead::signed_8() {
int8_t x;
- DataComplete(&x, 1);
+ data_complete(&x, 1);
return x;
}
-uint8_t StreamRead::Unsigned8() {
+uint8_t StreamRead::unsigned_8() {
uint8_t x;
- DataComplete(&x, 1);
+ data_complete(&x, 1);
return x;
}
-int16_t StreamRead::Signed16() {
+int16_t StreamRead::signed_16() {
int16_t x;
- DataComplete(&x, 2);
- return Little16(x);
+ data_complete(&x, 2);
+ return little_16(x);
}
-uint16_t StreamRead::Unsigned16() {
+uint16_t StreamRead::unsigned_16() {
uint16_t x;
- DataComplete(&x, 2);
- return Little16(x);
+ data_complete(&x, 2);
+ return little_16(x);
}
-int32_t StreamRead::Signed32() {
+int32_t StreamRead::signed_32() {
int32_t x;
- DataComplete(&x, 4);
- return Little32(x);
+ data_complete(&x, 4);
+ return little_32(x);
}
-uint32_t StreamRead::Unsigned32() {
+uint32_t StreamRead::unsigned_32() {
uint32_t x;
- DataComplete(&x, 4);
- return Little32(x);
+ data_complete(&x, 4);
+ return little_32(x);
}
-std::string StreamRead::String()
+std::string StreamRead::string()
{
std::string x;
char ch;
for (;;) {
- DataComplete(&ch, 1);
+ data_complete(&ch, 1);
if (ch == 0)
break;
=== modified file 'src/io/streamread.h'
--- src/io/streamread.h 2014-09-09 17:15:20 +0000
+++ src/io/streamread.h 2014-09-29 13:33:11 +0000
@@ -34,10 +34,10 @@
* data from disk.
*
* This is not intended for pipes or pipe-like operations, and all reads
- * are "blocking". Once \ref Data returns 0, or any number less than the
+ * are "blocking". Once \ref data returns 0, or any number less than the
* requested number of bytes, the stream is at its end.
*
- * All implementations need to implement \ref Data and \ref EndOfFile .
+ * All implementations need to implement \ref data and \ref end_of_file .
*
* Convenience functions are provided for many data types.
*/
@@ -52,23 +52,23 @@
* \return the number of bytes that were actually read. Will return 0 at
* end of stream.
*/
- virtual size_t Data(void * data, size_t bufsize) = 0;
+ virtual size_t data(void * read_data, size_t bufsize) = 0;
/**
* \return \c true if the end of file / end of stream has been reached.
*/
- virtual bool EndOfFile() const = 0;
-
- void DataComplete(void * data, size_t size);
-
- int8_t Signed8();
- uint8_t Unsigned8();
- int16_t Signed16();
- uint16_t Unsigned16();
- int32_t Signed32();
- uint32_t Unsigned32();
- std::string String();
- virtual char const * CString() {throw;}
+ virtual bool end_of_file() const = 0;
+
+ void data_complete(void * data, size_t size);
+
+ int8_t signed_8();
+ uint8_t unsigned_8();
+ int16_t signed_16();
+ uint16_t unsigned_16();
+ int32_t signed_32();
+ uint32_t unsigned_32();
+ std::string string();
+ virtual char const * c_string() {throw;}
/// Base of all exceptions that are caused by errors in the data that is
/// read.
=== modified file 'src/io/streamwrite.cc'
--- src/io/streamwrite.cc 2014-06-01 18:00:48 +0000
+++ src/io/streamwrite.cc 2014-09-29 13:33:11 +0000
@@ -25,12 +25,12 @@
StreamWrite::~StreamWrite() {}
-void StreamWrite::Flush()
+void StreamWrite::flush()
{
// no-op as default implementation
}
-void StreamWrite::Printf(char const * const fmt, ...)
+void StreamWrite::print_f(char const * const fmt, ...)
{
// Try to do formatting on the stack first, but fallback to heap
// allocations to accommodate strings of arbitrary length.
@@ -42,7 +42,7 @@
va_end(va);
if (static_cast<uint32_t>(i) < sizeof(buffer)) {
- Data(buffer, i);
+ data(buffer, i);
} else {
uint32_t size = sizeof(buffer);
char * heapbuf = nullptr;
@@ -61,7 +61,7 @@
va_end(va);
} while (static_cast<uint32_t>(i) >= size);
- Data(heapbuf, i);
+ data(heapbuf, i);
delete[] heapbuf;
}
=== modified file 'src/io/streamwrite.h'
--- src/io/streamwrite.h 2014-07-26 16:16:21 +0000
+++ src/io/streamwrite.h 2014-09-29 13:33:11 +0000
@@ -33,8 +33,8 @@
* It is intended for serializing network packets and for writing log-type
* data to disk.
*
- * All implementations need to implement \ref Data . Some implementations
- * may need to implement \ref Flush .
+ * All implementations need to implement \ref data . Some implementations
+ * may need to implement \ref flush .
*
* Convenience functions are provided for many data types.
*/
@@ -46,7 +46,7 @@
/**
* Write a number of bytes to the stream.
*/
- virtual void Data(const void * const data, const size_t size) = 0;
+ virtual void data(const void * const write_data, const size_t size) = 0;
/**
* Make sure all data submitted so far is written to disk.
@@ -54,40 +54,40 @@
* The default implementation is a no-op. Implementations may want
* to override this if they're buffered internally.
*/
- virtual void Flush();
+ virtual void flush();
//TODO(unknown): implement an overloaded method that accepts fmt as std::string
- void Printf(char const *, ...) __attribute__((format(printf, 2, 3)));
+ void print_f(char const *, ...) __attribute__((format(printf, 2, 3)));
- void Signed8 (int8_t const x) {Data(&x, 1);}
- void Unsigned8 (uint8_t const x) {Data(&x, 1);}
- void Signed16(int16_t const x) {
- int16_t const y = Little16(x);
- Data(&y, 2);
- }
- void Unsigned16(uint16_t const x) {
- uint16_t const y = Little16(x);
- Data(&y, 2);
- }
- void Signed32(int32_t const x) {
- uint32_t const y = Little32(x);
- Data(&y, 4);
- }
- void Unsigned32(uint32_t const x) {
- uint32_t const y = Little32(x);
- Data(&y, 4);
- }
- void String(const std::string & str) {
- Data(str.c_str(), str.size() + 1);
+ void signed_8 (int8_t const x) {data(&x, 1);}
+ void unsigned_8(uint8_t const x) {data(&x, 1);}
+ void signed_16 (int16_t const x) {
+ int16_t const y = little_16(x);
+ data(&y, 2);
+ }
+ void unsigned_16(uint16_t const x) {
+ uint16_t const y = little_16(x);
+ data(&y, 2);
+ }
+ void signed_32(int32_t const x) {
+ uint32_t const y = little_32(x);
+ data(&y, 4);
+ }
+ void unsigned_32(uint32_t const x) {
+ uint32_t const y = little_32(x);
+ data(&y, 4);
+ }
+ void string(const std::string & str) {
+ data(str.c_str(), str.size() + 1);
}
// Write strings with null terminator.
- void CString(char const * const x) {Data(x, strlen(x) + 1);}
- void CString(const std::string & x) {Data(x.c_str(), x.size() + 1);}
+ void c_string(char const * const x) {data(x, strlen(x) + 1);}
+ void c_string(const std::string & x) {data(x.c_str(), x.size() + 1);}
// Write strings without null terminator.
- void Text (char const * const x) {Data(x, strlen(x));}
- void Text (const std::string & x) {Data(x.c_str(), x.size());}
+ void text (char const * const x) {data(x, strlen(x));}
+ void text (const std::string & x) {data(x.c_str(), x.size());}
private:
DISALLOW_COPY_AND_ASSIGN(StreamWrite);
=== modified file 'src/logic/attackable.h'
--- src/logic/attackable.h 2014-07-05 16:41:51 +0000
+++ src/logic/attackable.h 2014-09-29 13:33:11 +0000
@@ -50,7 +50,7 @@
* This should only return false for military sites that have not
* been occupied yet.
*/
- virtual bool canAttack() = 0;
+ virtual bool can_attack() = 0;
/**
* Called by an enemy soldier that enters a node with distance
=== modified file 'src/logic/battle.cc'
--- src/logic/battle.cc 2014-09-10 08:55:04 +0000
+++ src/logic/battle.cc 2014-09-29 13:33:11 +0000
@@ -65,9 +65,9 @@
assert(First.get_owner() != Second.get_owner());
{
StreamWrite & ss = game.syncstream();
- ss.Unsigned32(0x00e111ba); // appears as ba111e00 in a hexdump
- ss.Unsigned32(First .serial());
- ss.Unsigned32(Second.serial());
+ ss.unsigned_32(0x00e111ba); // appears as ba111e00 in a hexdump
+ ss.unsigned_32(First .serial());
+ ss.unsigned_32(Second.serial());
}
// Ensures only live soldiers eganges in a battle
@@ -83,23 +83,23 @@
m_creationtime = egbase.get_gametime();
- if (Battle* battle = m_first ->getBattle())
+ if (Battle* battle = m_first ->get_battle())
battle->cancel(ref_cast<Game, EditorGameBase>(egbase), *m_first);
- m_first->setBattle(ref_cast<Game, EditorGameBase>(egbase), this);
- if (Battle* battle = m_second->getBattle())
+ m_first->set_battle(ref_cast<Game, EditorGameBase>(egbase), this);
+ if (Battle* battle = m_second->get_battle())
battle->cancel(ref_cast<Game, EditorGameBase>(egbase), *m_second);
- m_second->setBattle(ref_cast<Game, EditorGameBase>(egbase), this);
+ m_second->set_battle(ref_cast<Game, EditorGameBase>(egbase), this);
}
void Battle::cleanup (EditorGameBase & egbase)
{
if (m_first) {
- m_first ->setBattle(ref_cast<Game, EditorGameBase>(egbase), nullptr);
+ m_first ->set_battle(ref_cast<Game, EditorGameBase>(egbase), nullptr);
m_first = nullptr;
}
if (m_second) {
- m_second->setBattle(ref_cast<Game, EditorGameBase>(egbase), nullptr);
+ m_second->set_battle(ref_cast<Game, EditorGameBase>(egbase), nullptr);
m_second = nullptr;
}
@@ -114,10 +114,10 @@
{
if (&soldier == m_first) {
m_first = nullptr;
- soldier.setBattle(game, nullptr);
+ soldier.set_battle(game, nullptr);
} else if (&soldier == m_second) {
m_second = nullptr;
- soldier.setBattle(game, nullptr);
+ soldier.set_battle(game, nullptr);
} else
return;
@@ -146,12 +146,12 @@
// Could be, but we need to be able change the animations of the soldiers
// easily without unneeded hacks, and this code is not so difficult, only it
// had some translations errors
-void Battle::getBattleWork(Game & game, Soldier & soldier)
+void Battle::get_battle_work(Game & game, Soldier & soldier)
{
// Identify what soldier is calling the routine
uint8_t const this_soldier_is = &soldier == m_first ? 1 : 2;
- assert(m_first->getBattle() == this || m_second->getBattle() == this);
+ assert(m_first->get_battle() == this || m_second->get_battle() == this);
// Created this three 'states' of the battle:
// *First time entered, one enters :
@@ -217,7 +217,7 @@
if (bothReadyToFight) {
// Our opponent is waiting for us to fight.
// Time for one of us to hurt the other. Which one is on turn is decided
- // by calculateRound.
+ // by calculate_round.
assert
((m_readyflags == 1 && this_soldier_is == 2) ||
(m_readyflags == 2 && this_soldier_is == 1));
@@ -227,7 +227,7 @@
assert(m_readyflags == 3);
// Resolve combat turn
- calculateRound(game);
+ calculate_round(game);
// Wake up opponent, so he could update his animation
opponent(soldier)->send_signal(game, "wakeup");
@@ -239,7 +239,7 @@
m_readyflags = 0;
}
- // The function calculateRound inverts value of m_first_strikes, so
+ // The function calculate_round inverts value of m_first_strikes, so
// attacker will be the m_first when m_first_strikes = false and
// attacker will be m_second when m_first_strikes = true
molog
@@ -293,7 +293,7 @@
(game, soldier.descr().get_rand_anim(game, what_anim.c_str()), 1000);
}
-void Battle::calculateRound(Game & game)
+void Battle::calculate_round(Game & game)
{
assert(!m_damage);
@@ -346,15 +346,15 @@
Battle & battle = get<Battle>();
- battle.m_creationtime = fr.Signed32();
- battle.m_readyflags = fr.Unsigned8();
- battle.m_first_strikes = fr.Unsigned8();
+ battle.m_creationtime = fr.signed_32();
+ battle.m_readyflags = fr.unsigned_8();
+ battle.m_first_strikes = fr.unsigned_8();
if (version == BATTLE_SAVEGAME_VERSION)
- battle.m_damage = fr.Unsigned32();
+ battle.m_damage = fr.unsigned_32();
- m_first = fr.Unsigned32();
- m_second = fr.Unsigned32();
+ m_first = fr.unsigned_32();
+ m_second = fr.unsigned_32();
}
void Battle::Loader::load_pointers()
@@ -382,19 +382,19 @@
void Battle::save
(EditorGameBase & egbase, MapObjectSaver & mos, FileWrite & fw)
{
- fw.Unsigned8(HeaderBattle);
- fw.Unsigned8(BATTLE_SAVEGAME_VERSION);
+ fw.unsigned_8(HeaderBattle);
+ fw.unsigned_8(BATTLE_SAVEGAME_VERSION);
MapObject::save(egbase, mos, fw);
- fw.Signed32(m_creationtime);
- fw.Unsigned8(m_readyflags);
- fw.Unsigned8(m_first_strikes);
- fw.Unsigned32(m_damage);
+ fw.signed_32(m_creationtime);
+ fw.unsigned_8(m_readyflags);
+ fw.unsigned_8(m_first_strikes);
+ fw.unsigned_32(m_damage);
// And now, the serials of the soldiers !
- fw.Unsigned32(m_first ? mos.get_object_file_index(*m_first) : 0);
- fw.Unsigned32(m_second ? mos.get_object_file_index(*m_second) : 0);
+ fw.unsigned_32(m_first ? mos.get_object_file_index(*m_first) : 0);
+ fw.unsigned_32(m_second ? mos.get_object_file_index(*m_second) : 0);
}
@@ -406,7 +406,7 @@
try {
// Header has been peeled away by caller
- uint8_t const version = fr.Unsigned8();
+ uint8_t const version = fr.unsigned_8();
if (version <= BATTLE_SAVEGAME_VERSION) {
loader->init(egbase, mol, *new Battle);
loader->load(fr, version);
=== modified file 'src/logic/battle.h'
--- src/logic/battle.h 2014-09-10 08:55:04 +0000
+++ src/logic/battle.h 2014-09-29 13:33:11 +0000
@@ -76,7 +76,7 @@
// Called by the battling soldiers once they've met on a common node and are
// idle.
- void getBattleWork(Game &, Soldier &);
+ void get_battle_work(Game &, Soldier &);
private:
struct Loader : public MapObject::Loader {
@@ -87,7 +87,7 @@
Serial m_second;
};
- void calculateRound(Game &);
+ void calculate_round(Game &);
Soldier * m_first;
Soldier * m_second;
=== modified file 'src/logic/bob.cc'
--- src/logic/bob.cc 2014-09-14 11:31:58 +0000
+++ src/logic/bob.cc 2014-09-29 13:33:11 +0000
@@ -50,11 +50,11 @@
namespace Widelands {
-BobDescr::BobDescr(MapObjectType type, const std::string& init_name,
+BobDescr::BobDescr(MapObjectType object_type, const std::string& init_name,
const std::string& init_descname,
TribeDescr const* tribe)
:
- MapObjectDescr(type, init_name, init_descname),
+ MapObjectDescr(object_type, init_name, init_descname),
owner_tribe_ (tribe)
{
}
@@ -510,7 +510,7 @@
}
}
- bool isBlocked(const FCoords & field) {
+ bool is_blocked(const FCoords & field) {
if (disabled)
return false;
@@ -522,7 +522,7 @@
if (it != nodes.end())
return it->second;
- bool const blocked = m_bob.checkNodeBlocked(m_game, field, false);
+ bool const blocked = m_bob.check_node_blocked(m_game, field, false);
nodes.insert(std::make_pair(cd, blocked));
if (blocked)
++nrblocked;
@@ -546,9 +546,9 @@
if (end == m_tracker.m_finaldest)
return true;
- return !m_tracker.isBlocked(end);
+ return !m_tracker.is_blocked(end);
}
- bool reachabledest(Map &, FCoords) const {return true;}
+ bool reachable_dest(Map &, FCoords) const {return true;}
BlockedTracker & m_tracker;
};
@@ -665,10 +665,10 @@
if (curidx != index) {
if (curidx < index) {
path.truncate(index);
- path.starttrim(curidx);
+ path.trim_start(curidx);
} else {
path.truncate(curidx);
- path.starttrim(index);
+ path.trim_start(index);
path.reverse();
}
start_task_movepath(game, path, anims, forceonlast, only_step);
@@ -893,9 +893,9 @@
return -1;
}
- // Always call checkNodeBlocked, because it might communicate with other
+ // Always call check_node_blocked, because it might communicate with other
// bobs (as is the case for soldiers on the battlefield).
- if (checkNodeBlocked(game, newnode, true) && !force)
+ if (check_node_blocked(game, newnode, true) && !force)
return -2;
// Move is go
@@ -913,7 +913,7 @@
}
-bool Bob::checkNodeBlocked(Game & game, const FCoords & field, bool)
+bool Bob::check_node_blocked(Game & game, const FCoords & field, bool)
{
// Battles always block movement!
std::vector<Bob *> soldiers;
@@ -923,7 +923,7 @@
if (!soldiers.empty()) {
for (Bob * temp_bob : soldiers) {
upcast(Soldier, soldier, temp_bob);
- if (soldier->getBattle())
+ if (soldier->get_battle())
return true;
}
}
@@ -989,9 +989,9 @@
// randomly generated movements.
if (upcast(Game, game, &egbase)) {
StreamWrite & ss = game->syncstream();
- ss.Unsigned32(serial());
- ss.Signed16(coords.x);
- ss.Signed16(coords.y);
+ ss.unsigned_32(serial());
+ ss.signed_16(coords.x);
+ ss.signed_16(coords.y);
}
}
@@ -1075,13 +1075,13 @@
{
MapObject::Loader::load(fr);
- uint8_t version = fr.Unsigned8();
+ uint8_t version = fr.unsigned_8();
if (version != BOB_SAVEGAME_VERSION)
throw GameDataError("unknown/unhandled version: %u", version);
Bob & bob = get<Bob>();
- if (PlayerNumber owner_number = fr.Unsigned8()) {
+ if (PlayerNumber owner_number = fr.unsigned_8()) {
if (owner_number > egbase().map().get_nrplayers())
throw GameDataError
("owner number is %u but there are only %u players",
@@ -1094,53 +1094,53 @@
bob.set_owner(owner);
}
- bob.set_position(egbase(), ReadCoords32(&fr));
+ bob.set_position(egbase(), read_coords_32(&fr));
- std::string animname = fr.CString();
+ std::string animname = fr.c_string();
bob.m_anim = animname.size() ? bob.descr().get_animation(animname) : 0;
- bob.m_animstart = fr.Signed32();
- bob.m_walking = static_cast<WalkingDir>(ReadDirection8_allow_null(&fr));
+ bob.m_animstart = fr.signed_32();
+ bob.m_walking = static_cast<WalkingDir>(read_direction_8_allow_null(&fr));
if (bob.m_walking) {
- bob.m_walkstart = fr.Signed32();
- bob.m_walkend = fr.Signed32();
+ bob.m_walkstart = fr.signed_32();
+ bob.m_walkend = fr.signed_32();
}
- bob.m_actid = fr.Unsigned32();
- bob.m_signal = fr.CString();
+ bob.m_actid = fr.unsigned_32();
+ bob.m_signal = fr.c_string();
- uint32_t stacksize = fr.Unsigned32();
+ uint32_t stacksize = fr.unsigned_32();
bob.m_stack.resize(stacksize);
states.resize(stacksize);
for (uint32_t i = 0; i < stacksize; ++i) {
State & state = bob.m_stack[i];
LoadState & loadstate = states[i];
- state.task = get_task(fr.CString());
- state.ivar1 = fr.Signed32();
- state.ivar2 = fr.Signed32();
- state.ivar3 = fr.Signed32();
- loadstate.objvar1 = fr.Unsigned32();
- state.svar1 = fr.CString();
- state.coords = ReadCoords32_allow_null(&fr, egbase().map().extent());
+ state.task = get_task(fr.c_string());
+ state.ivar1 = fr.signed_32();
+ state.ivar2 = fr.signed_32();
+ state.ivar3 = fr.signed_32();
+ loadstate.objvar1 = fr.unsigned_32();
+ state.svar1 = fr.c_string();
+ state.coords = read_coords_32_allow_null(&fr, egbase().map().extent());
- if (fr.Unsigned8()) {
+ if (fr.unsigned_8()) {
uint32_t anims[6];
for (int j = 0; j < 6; ++j)
- anims[j] = bob.descr().get_animation(fr.CString());
+ anims[j] = bob.descr().get_animation(fr.c_string());
state.diranims = DirAnimations(anims[0], anims[1], anims[2], anims[3], anims[4], anims[5]);
}
- if (fr.Unsigned8()) {
+ if (fr.unsigned_8()) {
state.path = new Path;
state.path->load(fr, egbase().map());
}
- if (fr.Unsigned8()) {
+ if (fr.unsigned_8()) {
state.route = new Route;
state.route->load(loadstate.route, fr);
}
- std::string programname = fr.CString();
+ std::string programname = fr.c_string();
if (programname.size())
state.program = get_program(programname);
}
@@ -1198,66 +1198,66 @@
{
MapObject::save(eg, mos, fw);
- fw.Unsigned8(BOB_SAVEGAME_VERSION);
+ fw.unsigned_8(BOB_SAVEGAME_VERSION);
- fw.Unsigned8(m_owner ? m_owner->player_number() : 0);
- WriteCoords32(&fw, m_position);
+ fw.unsigned_8(m_owner ? m_owner->player_number() : 0);
+ write_coords_32(&fw, m_position);
// m_linkpprev and m_linknext are recreated automatically
- fw.CString(m_anim ? descr().get_animation_name(m_anim) : "");
- fw.Signed32(m_animstart);
- WriteDirection8_allow_null(&fw, m_walking);
+ fw.c_string(m_anim ? descr().get_animation_name(m_anim) : "");
+ fw.signed_32(m_animstart);
+ write_direction_8_allow_null(&fw, m_walking);
if (m_walking) {
- fw.Signed32(m_walkstart);
- fw.Signed32(m_walkend);
+ fw.signed_32(m_walkstart);
+ fw.signed_32(m_walkend);
}
- fw.Unsigned32(m_actid);
- fw.CString(m_signal);
+ fw.unsigned_32(m_actid);
+ fw.c_string(m_signal);
- fw.Unsigned32(m_stack.size());
+ fw.unsigned_32(m_stack.size());
for (unsigned int i = 0; i < m_stack.size(); ++i) {
const State & state = m_stack[i];
- fw.CString(state.task->name);
- fw.Signed32(state.ivar1);
- fw.Signed32(state.ivar2);
- fw.Signed32(state.ivar3);
+ fw.c_string(state.task->name);
+ fw.signed_32(state.ivar1);
+ fw.signed_32(state.ivar2);
+ fw.signed_32(state.ivar3);
if (const MapObject * obj = state.objvar1.get(eg)) {
- fw.Unsigned32(mos.get_object_file_index(*obj));
+ fw.unsigned_32(mos.get_object_file_index(*obj));
} else {
- fw.Unsigned32(0);
+ fw.unsigned_32(0);
}
- fw.CString(state.svar1);
+ fw.c_string(state.svar1);
- WriteCoords32(&fw, state.coords);
+ write_coords_32(&fw, state.coords);
if (state.diranims) {
- fw.Unsigned8(1);
+ fw.unsigned_8(1);
for (int dir = 1; dir <= 6; ++dir)
- fw.CString
+ fw.c_string
(descr().get_animation_name
(state.diranims.get_animation(dir)).c_str());
} else {
- fw.Unsigned8(0);
+ fw.unsigned_8(0);
}
if (state.path) {
- fw.Unsigned8(1);
+ fw.unsigned_8(1);
state.path->save(fw);
} else {
- fw.Unsigned8(0);
+ fw.unsigned_8(0);
}
if (state.route) {
- fw.Unsigned8(1);
+ fw.unsigned_8(1);
state.route->save(fw, eg, mos);
} else {
- fw.Unsigned8(0);
+ fw.unsigned_8(0);
}
- fw.CString(state.program ? state.program->get_name() : "");
+ fw.c_string(state.program ? state.program->get_name() : "");
}
}
=== modified file 'src/logic/bob.h'
--- src/logic/bob.h 2014-09-14 14:36:56 +0000
+++ src/logic/bob.h 2014-09-29 13:33:11 +0000
@@ -202,7 +202,7 @@
ivar1 (0),
ivar2 (0),
ivar3 (0),
- coords (Coords::Null()),
+ coords (Coords::null()),
path (nullptr),
route (nullptr),
program (nullptr)
@@ -245,7 +245,7 @@
/// \param commit indicates whether this function is called from the
/// \ref start_walk function, i.e. whether the bob will actually move
/// onto the \p to node if this function allows it to.
- virtual bool checkNodeBlocked(Game &, const FCoords &, bool commit);
+ virtual bool check_node_blocked(Game &, const FCoords &, bool commit);
virtual void draw
(const EditorGameBase &, RenderTarget &, const Point&) const;
=== modified file 'src/logic/buildcost.cc'
--- src/logic/buildcost.cc 2014-09-10 10:18:46 +0000
+++ src/logic/buildcost.cc 2014-09-29 13:33:11 +0000
@@ -64,26 +64,26 @@
void Buildcost::save(FileWrite& fw, const Widelands::TribeDescr& tribe) const {
for (const_iterator it = begin(); it != end(); ++it) {
- fw.CString(tribe.get_ware_descr(it->first)->name());
- fw.Unsigned8(it->second);
+ fw.c_string(tribe.get_ware_descr(it->first)->name());
+ fw.unsigned_8(it->second);
}
- fw.CString("");
+ fw.c_string("");
}
void Buildcost::load(FileRead& fr, const Widelands::TribeDescr& tribe) {
clear();
for (;;) {
- std::string name = fr.CString();
+ std::string name = fr.c_string();
if (name.empty())
break;
WareIndex index = tribe.ware_index(name);
if (index == INVALID_INDEX) {
log("buildcost: tribe %s does not define ware %s", tribe.name().c_str(), name.c_str());
- fr.Unsigned8();
+ fr.unsigned_8();
} else {
- (*this)[index] = fr.Unsigned8();
+ (*this)[index] = fr.unsigned_8();
}
}
}
=== modified file 'src/logic/building.cc'
--- src/logic/building.cc 2014-09-18 18:56:20 +0000
+++ src/logic/building.cc 2014-09-29 13:33:11 +0000
@@ -90,7 +90,7 @@
}
m_helptext_script = directory + "/help.lua";
- if (!g_fs->FileExists(m_helptext_script))
+ if (!g_fs->file_exists(m_helptext_script))
m_helptext_script = "";
// Parse build options
=== modified file 'src/logic/campaign_visibility.cc'
--- src/logic/campaign_visibility.cc 2014-09-10 13:03:40 +0000
+++ src/logic/campaign_visibility.cc 2014-09-29 13:33:11 +0000
@@ -34,11 +34,11 @@
std::string CampaignVisibilitySave::get_path()
{
std::string savepath = "save";
- g_fs->EnsureDirectoryExists(savepath); // Make sure save directory exists
+ g_fs->ensure_directory_exists(savepath); // Make sure save directory exists
savepath += "/campvis"; // add the name of save-file
// check if campaigns visibility-save is available
- if (!(g_fs->FileExists(savepath)))
+ if (!(g_fs->file_exists(savepath)))
make_campvis(savepath);
// check if campaigns visibility-save is up to date
=== modified file 'src/logic/carrier.cc'
--- src/logic/carrier.cc 2014-09-10 08:55:04 +0000
+++ src/logic/carrier.cc 2014-09-29 13:33:11 +0000
@@ -532,7 +532,7 @@
startpath.truncate(curidx);
startpath.reverse();
- endpath.starttrim(curidx);
+ endpath.trim_start(curidx);
map.calc_cost(startpath, &startcost, nullptr);
map.calc_cost(endpath, &endcost, nullptr);
@@ -596,12 +596,12 @@
{
Worker::Loader::load(fr);
- uint8_t version = fr.Unsigned8();
+ uint8_t version = fr.unsigned_8();
if (version != CARRIER_SAVEGAME_VERSION)
throw GameDataError("unknown/unhandled version %u", version);
Carrier & carrier = get<Carrier>();
- carrier.m_promised_pickup_to = fr.Signed32();
+ carrier.m_promised_pickup_to = fr.signed_32();
}
const Bob::Task * Carrier::Loader::get_task(const std::string & name)
@@ -621,8 +621,8 @@
{
Worker::do_save(egbase, mos, fw);
- fw.Unsigned8(CARRIER_SAVEGAME_VERSION);
- fw.Signed32(m_promised_pickup_to);
+ fw.unsigned_8(CARRIER_SAVEGAME_VERSION);
+ fw.signed_32(m_promised_pickup_to);
}
/**
=== modified file 'src/logic/checkstep.cc'
--- src/logic/checkstep.cc 2014-07-25 20:40:51 +0000
+++ src/logic/checkstep.cc 2014-09-29 13:33:11 +0000
@@ -32,7 +32,7 @@
* on all checks.
*/
CheckStep::CheckStep()
- : capsule(alwaysfalse().capsule)
+ : capsule(always_false().capsule)
{
}
@@ -43,10 +43,10 @@
{
return false;
}
- bool reachabledest(Map &, const FCoords &) const {return false;}
+ bool reachable_dest(Map &, const FCoords &) const {return false;}
};
-const CheckStep & CheckStep::alwaysfalse()
+const CheckStep & CheckStep::always_false()
{
static const CheckStep cstep = CheckStep(CheckStepAlwaysFalse());
return cstep;
@@ -71,10 +71,10 @@
return true;
}
-bool CheckStepAnd::reachabledest(Map & map, FCoords const dest) const
+bool CheckStepAnd::reachable_dest(Map & map, FCoords const dest) const
{
for (const CheckStep& checkstep : subs) {
- if (!checkstep.reachabledest(map, dest)) {
+ if (!checkstep.reachable_dest(map, dest)) {
return false;
}
}
@@ -103,7 +103,7 @@
return false;
}
-bool CheckStepDefault::reachabledest(Map & map, FCoords const dest) const
+bool CheckStepDefault::reachable_dest(Map & map, FCoords const dest) const
{
NodeCaps const caps = dest.field->nodecaps();
@@ -155,7 +155,7 @@
return false;
}
-bool CheckStepWalkOn::reachabledest(Map &, FCoords) const {
+bool CheckStepWalkOn::reachable_dest(Map &, FCoords) const {
// Don't bother solving this.
return true;
}
@@ -193,7 +193,7 @@
return true;
}
-bool CheckStepRoad::reachabledest(Map & map, FCoords const dest) const
+bool CheckStepRoad::reachable_dest(Map & map, FCoords const dest) const
{
NodeCaps const caps = dest.field->nodecaps();
@@ -215,7 +215,7 @@
return m_allowed_locations.find(end) != m_allowed_locations.end();
}
-bool CheckStepLimited::reachabledest(Map &, FCoords) const {
+bool CheckStepLimited::reachable_dest(Map &, FCoords) const {
return true;
}
=== modified file 'src/logic/checkstep.h'
--- src/logic/checkstep.h 2014-09-10 08:55:04 +0000
+++ src/logic/checkstep.h 2014-09-29 13:33:11 +0000
@@ -48,7 +48,7 @@
StepId id)
const
= 0;
- virtual bool reachabledest(Map &, const FCoords & dest) const = 0;
+ virtual bool reachable_dest(Map &, const FCoords & dest) const = 0;
};
template<typename T>
struct Capsule : public BaseCapsule {
@@ -62,8 +62,8 @@
{
return op.allowed(map, start, end, dir, id);
}
- bool reachabledest(Map & map, const FCoords & dest) const override {
- return op.reachabledest(map, dest);
+ bool reachable_dest(Map & map, const FCoords & dest) const override {
+ return op.reachable_dest(map, dest);
}
const T op;
@@ -71,7 +71,7 @@
boost::shared_ptr<BaseCapsule> capsule;
- static const CheckStep & alwaysfalse();
+ static const CheckStep & always_false();
public:
CheckStep();
@@ -96,8 +96,8 @@
* \return \c true if the destination field can be reached at all
* (e.g. return false for land-based bobs when dest is in water).
*/
- bool reachabledest(Map & map, const FCoords & dest) const {
- return capsule->reachabledest(map, dest);
+ bool reachable_dest(Map & map, const FCoords & dest) const {
+ return capsule->reachable_dest(map, dest);
}
};
@@ -114,7 +114,7 @@
int32_t dir,
CheckStep::StepId id)
const;
- bool reachabledest(Map &, FCoords dest) const;
+ bool reachable_dest(Map &, FCoords dest) const;
private:
std::vector<CheckStep> subs;
@@ -133,7 +133,7 @@
bool allowed
(Map &, FCoords start, FCoords end, int32_t dir, CheckStep::StepId)
const;
- bool reachabledest(Map &, FCoords dest) const;
+ bool reachable_dest(Map &, FCoords dest) const;
private:
uint8_t m_movecaps;
@@ -152,7 +152,7 @@
bool allowed
(Map &, FCoords start, FCoords end, int32_t dir, CheckStep::StepId)
const;
- bool reachabledest(Map &, FCoords dest) const;
+ bool reachable_dest(Map &, FCoords dest) const;
private:
uint8_t m_movecaps;
@@ -175,7 +175,7 @@
bool allowed
(Map &, FCoords start, FCoords end, int32_t dir, CheckStep::StepId)
const;
- bool reachabledest(Map &, FCoords dest) const;
+ bool reachable_dest(Map &, FCoords dest) const;
private:
const Player & m_player;
@@ -191,7 +191,7 @@
bool allowed
(Map &, FCoords start, FCoords end, int32_t dir, CheckStep::StepId)
const;
- bool reachabledest(Map &, FCoords dest) const;
+ bool reachable_dest(Map &, FCoords dest) const;
private:
// It is OK to use Coords::OrderingFunctor because the ordering of the set
=== modified file 'src/logic/cmd_calculate_statistics.cc'
--- src/logic/cmd_calculate_statistics.cc 2014-09-10 08:55:04 +0000
+++ src/logic/cmd_calculate_statistics.cc 2014-09-29 13:33:11 +0000
@@ -35,13 +35,13 @@
}
#define CMD_CALCULATE_STATISTICS_VERSION 1
-void CmdCalculateStatistics::Read
+void CmdCalculateStatistics::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == CMD_CALCULATE_STATISTICS_VERSION) {
- GameLogicCommand::Read(fr, egbase, mol);
+ GameLogicCommand::read(fr, egbase, mol);
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -49,11 +49,11 @@
throw GameDataError("calculate statistics function: %s", e.what());
}
}
-void CmdCalculateStatistics::Write
+void CmdCalculateStatistics::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
- fw.Unsigned16(CMD_CALCULATE_STATISTICS_VERSION);
- GameLogicCommand::Write(fw, egbase, mos);
+ fw.unsigned_16(CMD_CALCULATE_STATISTICS_VERSION);
+ GameLogicCommand::write(fw, egbase, mos);
}
=== modified file 'src/logic/cmd_calculate_statistics.h'
--- src/logic/cmd_calculate_statistics.h 2014-09-10 08:55:04 +0000
+++ src/logic/cmd_calculate_statistics.h 2014-09-29 13:33:11 +0000
@@ -33,8 +33,8 @@
GameLogicCommand(_duetime) {}
// Write these commands to a file (for savegames)
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_CALCULATE_STATISTICS;}
void execute(Game &) override;
=== modified file 'src/logic/cmd_incorporate.cc'
--- src/logic/cmd_incorporate.cc 2014-09-10 08:55:04 +0000
+++ src/logic/cmd_incorporate.cc 2014-09-29 13:33:11 +0000
@@ -28,14 +28,14 @@
namespace Widelands {
-void CmdIncorporate::Read
+void CmdIncorporate::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == CMD_INCORPORATE_VERSION) {
- GameLogicCommand::Read(fr, egbase, mol);
- uint32_t const worker_serial = fr.Unsigned32();
+ GameLogicCommand::read(fr, egbase, mol);
+ uint32_t const worker_serial = fr.unsigned_32();
try {
worker = &mol.get<Worker>(worker_serial);
} catch (const WException & e) {
@@ -50,18 +50,18 @@
}
-void CmdIncorporate::Write
+void CmdIncorporate::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(CMD_INCORPORATE_VERSION);
+ fw.unsigned_16(CMD_INCORPORATE_VERSION);
// Write base classes
- GameLogicCommand::Write(fw, egbase, mos);
+ GameLogicCommand::write(fw, egbase, mos);
// Now serial
assert(mos.is_object_known(*worker));
- fw.Unsigned32(mos.get_object_file_index(*worker));
+ fw.unsigned_32(mos.get_object_file_index(*worker));
}
}
=== modified file 'src/logic/cmd_incorporate.h'
--- src/logic/cmd_incorporate.h 2014-09-10 08:55:04 +0000
+++ src/logic/cmd_incorporate.h 2014-09-29 13:33:11 +0000
@@ -35,8 +35,8 @@
void execute (Game & game) override {worker->incorporate(game);}
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_INCORPORATE;}
=== modified file 'src/logic/cmd_luacoroutine.cc'
--- src/logic/cmd_luacoroutine.cc 2014-09-18 18:56:20 +0000
+++ src/logic/cmd_luacoroutine.cc 2014-09-29 13:33:11 +0000
@@ -53,16 +53,16 @@
("Game Logic", game.get_gametime(), "Lua Coroutine Failed", e.what());
game.player(i).add_message(game, msg, true);
}
- game.gameController()->setDesiredSpeed(0);
+ game.game_controller()->set_desired_speed(0);
}
}
#define CMD_LUACOROUTINE_VERSION 3
-void CmdLuaCoroutine::Read(FileRead& fr, EditorGameBase& egbase, MapObjectLoader& mol) {
+void CmdLuaCoroutine::read(FileRead& fr, EditorGameBase& egbase, MapObjectLoader& mol) {
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == CMD_LUACOROUTINE_VERSION) {
- GameLogicCommand::Read(fr, egbase, mol);
+ GameLogicCommand::read(fr, egbase, mol);
// This function is only called when saving/loading savegames. So save
// to cast here
@@ -77,11 +77,11 @@
throw GameDataError("lua function: %s", e.what());
}
}
-void CmdLuaCoroutine::Write
+void CmdLuaCoroutine::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
- fw.Unsigned16(CMD_LUACOROUTINE_VERSION);
- GameLogicCommand::Write(fw, egbase, mos);
+ fw.unsigned_16(CMD_LUACOROUTINE_VERSION);
+ GameLogicCommand::write(fw, egbase, mos);
// This function is only called when saving/loading savegames. So save to
// cast here
=== modified file 'src/logic/cmd_luacoroutine.h'
--- src/logic/cmd_luacoroutine.h 2014-09-10 08:55:04 +0000
+++ src/logic/cmd_luacoroutine.h 2014-09-29 13:33:11 +0000
@@ -38,8 +38,8 @@
}
// Write these commands to a file (for savegames)
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_LUACOROUTINE;}
=== modified file 'src/logic/cmd_luascript.cc'
--- src/logic/cmd_luascript.cc 2014-09-10 08:55:04 +0000
+++ src/logic/cmd_luascript.cc 2014-09-29 13:33:11 +0000
@@ -45,14 +45,14 @@
}
#define CMD_LUASCRIPT_VERSION 1
-void CmdLuaScript::Read
+void CmdLuaScript::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == CMD_LUASCRIPT_VERSION) {
- GameLogicCommand::Read(fr, egbase, mol);
- script_ = fr.String();
+ GameLogicCommand::read(fr, egbase, mol);
+ script_ = fr.string();
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -60,13 +60,13 @@
throw GameDataError("lua: %s", e.what());
}
}
-void CmdLuaScript::Write
+void CmdLuaScript::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
- fw.Unsigned16(CMD_LUASCRIPT_VERSION);
- GameLogicCommand::Write(fw, egbase, mos);
+ fw.unsigned_16(CMD_LUASCRIPT_VERSION);
+ GameLogicCommand::write(fw, egbase, mos);
- fw.String(script_);
+ fw.string(script_);
}
}
=== modified file 'src/logic/cmd_luascript.h'
--- src/logic/cmd_luascript.h 2014-09-10 08:55:04 +0000
+++ src/logic/cmd_luascript.h 2014-09-29 13:33:11 +0000
@@ -33,8 +33,8 @@
GameLogicCommand(_duetime), script_(script) {}
// Write these commands to a file (for savegames)
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_LUASCRIPT;}
=== modified file 'src/logic/cmd_queue.cc'
--- src/logic/cmd_queue.cc 2014-09-14 16:08:13 +0000
+++ src/logic/cmd_queue.cc 2014-09-29 13:33:11 +0000
@@ -117,9 +117,9 @@
if (dynamic_cast<GameLogicCommand *>(&c)) {
StreamWrite & ss = m_game.syncstream();
static uint8_t const tag[] = {0xde, 0xad, 0x00};
- ss.Data(tag, 3); // provide an easy-to-find pattern as debugging aid
- ss.Unsigned32(c.duetime());
- ss.Unsigned32(c.id());
+ ss.data(tag, 3); // provide an easy-to-find pattern as debugging aid
+ ss.unsigned_32(c.duetime());
+ ss.unsigned_32(c.id());
}
c.execute (m_game);
@@ -146,7 +146,7 @@
*
* \note This function must be called by deriving objects that override it.
*/
-void GameLogicCommand::Write
+void GameLogicCommand::write
(FileWrite & fw,
#ifndef NDEBUG
EditorGameBase & egbase,
@@ -156,11 +156,11 @@
MapObjectSaver &)
{
// First version
- fw.Unsigned16(BASE_CMD_VERSION);
+ fw.unsigned_16(BASE_CMD_VERSION);
// Write duetime
assert(egbase.get_gametime() <= duetime());
- fw.Unsigned32(duetime());
+ fw.unsigned_32(duetime());
}
/**
@@ -168,13 +168,13 @@
*
* \note This function must be called by deriving objects that override it.
*/
-void GameLogicCommand::Read
+void GameLogicCommand::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader &)
{
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == BASE_CMD_VERSION) {
- set_duetime(fr.Unsigned32());
+ set_duetime(fr.unsigned_32());
int32_t const gametime = egbase.get_gametime();
if (duetime() < gametime)
throw GameDataError
=== modified file 'src/logic/cmd_queue.h'
--- src/logic/cmd_queue.h 2014-09-14 16:08:13 +0000
+++ src/logic/cmd_queue.h 2014-09-29 13:33:11 +0000
@@ -110,9 +110,9 @@
GameLogicCommand (int32_t const _duetime) : Command(_duetime) {}
// Write these commands to a file (for savegames)
- virtual void Write
+ virtual void write
(FileWrite &, EditorGameBase &, MapObjectSaver &);
- virtual void Read
+ virtual void read
(FileRead &, EditorGameBase &, MapObjectLoader &);
};
=== modified file 'src/logic/critter.cc'
--- src/logic/critter.cc 2014-09-10 08:55:04 +0000
+++ src/logic/critter.cc 2014-09-29 13:33:11 +0000
@@ -408,10 +408,10 @@
try {
// The header has been peeled away by the caller
- uint8_t const version = fr.Unsigned8();
+ uint8_t const version = fr.unsigned_8();
if (1 <= version && version <= CRITTER_SAVEGAME_VERSION) {
- const std::string owner = fr.CString();
- std::string critter_name = fr.CString();
+ const std::string owner = fr.c_string();
+ std::string critter_name = fr.c_string();
const CritterDescr * descr = nullptr;
if (owner == "world") {
@@ -444,13 +444,13 @@
void Critter::save
(EditorGameBase & egbase, MapObjectSaver & mos, FileWrite & fw)
{
- fw.Unsigned8(HeaderCritter);
- fw.Unsigned8(CRITTER_SAVEGAME_VERSION);
+ fw.unsigned_8(HeaderCritter);
+ fw.unsigned_8(CRITTER_SAVEGAME_VERSION);
std::string owner =
descr().get_owner_tribe() ? descr().get_owner_tribe()->name() : "world";
- fw.CString(owner);
- fw.CString(descr().name());
+ fw.c_string(owner);
+ fw.c_string(descr().name());
Bob::save(egbase, mos, fw);
}
=== modified file 'src/logic/editor_game_base.cc'
--- src/logic/editor_game_base.cc 2014-09-10 10:18:46 +0000
+++ src/logic/editor_game_base.cc 2014-09-29 13:33:11 +0000
@@ -200,7 +200,7 @@
void EditorGameBase::inform_players_about_immovable
(MapIndex const i, MapObjectDescr const * const descr)
{
- if (!Road::IsRoadDescr(descr))
+ if (!Road::is_road_descr(descr))
iterate_players_existing_const(plnum, MAX_PLAYERS, *this, p) {
Player::Field & player_field = p->m_fields[i];
if (1 < player_field.vision) {
=== modified file 'src/logic/editor_game_base.h'
--- src/logic/editor_game_base.h 2014-09-14 11:31:58 +0000
+++ src/logic/editor_game_base.h 2014-09-29 13:33:11 +0000
@@ -182,7 +182,7 @@
// next function is used to update the current gametime,
// for queue runs e.g.
- int32_t& get_game_time_pointer() {
+ int32_t& get_gametime_pointer() {
return gametime_;
}
void set_ibase(InteractiveBase* const b) {
=== modified file 'src/logic/expedition_bootstrap.cc'
--- src/logic/expedition_bootstrap.cc 2014-09-10 10:18:46 +0000
+++ src/logic/expedition_bootstrap.cc 2014-09-29 13:33:11 +0000
@@ -242,21 +242,21 @@
void ExpeditionBootstrap::save(FileWrite& fw, Game& game, MapObjectSaver& mos) {
// Expedition workers
- fw.Unsigned8(workers_.size());
+ fw.unsigned_8(workers_.size());
for (std::unique_ptr<ExpeditionWorker>& ew : workers_) {
- fw.Unsigned8(ew->request.get() != nullptr);
+ fw.unsigned_8(ew->request.get() != nullptr);
if (ew->request.get() != nullptr) {
- ew->request->Write(fw, game, mos);
+ ew->request->write(fw, game, mos);
} else {
assert(mos.is_object_known(*ew->worker));
- fw.Unsigned32(mos.get_object_file_index(*ew->worker));
+ fw.unsigned_32(mos.get_object_file_index(*ew->worker));
}
}
// Expedition WaresQueues
- fw.Unsigned8(wares_.size());
+ fw.unsigned_8(wares_.size());
for (std::unique_ptr<WaresQueue>& wq : wares_) {
- wq->Write(fw, game, mos);
+ wq->write(fw, game, mos);
}
}
@@ -267,26 +267,26 @@
assert(warehouse_packet_version >= 6);
// Expedition workers
- const uint8_t num_workers = fr.Unsigned8();
+ const uint8_t num_workers = fr.unsigned_8();
for (uint8_t i = 0; i < num_workers; ++i) {
workers_.emplace_back(new ExpeditionWorker(nullptr));
- if (fr.Unsigned8() == 1) {
+ if (fr.unsigned_8() == 1) {
Request* worker_request = new Request
(warehouse, 0, ExpeditionBootstrap::worker_callback, wwWORKER);
workers_.back()->request.reset(worker_request);
- worker_request->Read(fr, game, mol);
+ worker_request->read(fr, game, mol);
workers_.back()->worker = nullptr;
} else {
- workers_.back()->worker = &mol.get<Worker>(fr.Unsigned32());
+ workers_.back()->worker = &mol.get<Worker>(fr.unsigned_32());
}
}
// Expedition WaresQueues
assert(wares_.empty());
- const uint8_t num_wares = fr.Unsigned8();
+ const uint8_t num_wares = fr.unsigned_8();
for (uint8_t i = 0; i < num_wares; ++i) {
WaresQueue * wq = new WaresQueue(warehouse, INVALID_INDEX, 0);
- wq->Read(fr, game, mol);
+ wq->read(fr, game, mol);
wq->set_callback(ware_callback, this);
if (wq->get_ware() == INVALID_INDEX) {
=== modified file 'src/logic/findbob.cc'
--- src/logic/findbob.cc 2014-07-28 14:08:41 +0000
+++ src/logic/findbob.cc 2014-09-29 13:33:11 +0000
@@ -34,7 +34,7 @@
{
if (upcast(Soldier, soldier, imm))
if
- (soldier->isOnBattlefield() &&
+ (soldier->is_on_battlefield() &&
(!player || soldier->owner().is_hostile(*player)) &&
soldier->get_current_hitpoints())
return true;
=== modified file 'src/logic/findimmovable.cc'
--- src/logic/findimmovable.cc 2014-07-23 14:58:01 +0000
+++ src/logic/findimmovable.cc 2014-09-29 13:33:11 +0000
@@ -31,7 +31,7 @@
bool accept(const BaseImmovable &) const {return true;}
};
-const FindImmovable & FindImmovableAlwaysTrue()
+const FindImmovable & find_immovable_always_true()
{
static FindImmovable alwaystrue = FindImmovableAlwaysTrueImpl();
return alwaystrue;
=== modified file 'src/logic/game.cc'
--- src/logic/game.cc 2014-09-14 16:08:13 +0000
+++ src/logic/game.cc 2014-09-29 13:33:11 +0000
@@ -79,23 +79,23 @@
m_dump = nullptr;
if (!m_syncstreamsave)
- g_fs->Unlink(m_dumpfname);
+ g_fs->fs_unlink(m_dumpfname);
}
}
-void Game::SyncWrapper::StartDump(const std::string & fname) {
+void Game::SyncWrapper::start_dump(const std::string & fname) {
m_dumpfname = fname + ".wss";
- m_dump = g_fs->OpenStreamWrite(m_dumpfname);
+ m_dump = g_fs->open_stream_write(m_dumpfname);
}
static const unsigned long long MINIMUM_DISK_SPACE = 256 * 1024 * 1024;
-void Game::SyncWrapper::Data(void const * const data, size_t const size) {
+void Game::SyncWrapper::data(void const * const sync_data, size_t const size) {
#ifdef SYNC_DEBUG
uint32_t time = m_game.get_gametime();
log("[sync:%08u t=%6u]", m_counter, time);
for (size_t i = 0; i < size; ++i)
- log(" %02x", (static_cast<uint8_t const *>(data))[i]);
+ log(" %02x", (static_cast<uint8_t const *>(sync_data))[i]);
log("\n");
#endif
@@ -105,7 +105,7 @@
{
m_next_diskspacecheck = m_counter + 16 * 1024 * 1024;
- if (g_fs->DiskSpace() < MINIMUM_DISK_SPACE) {
+ if (g_fs->disk_space() < MINIMUM_DISK_SPACE) {
log("Stop writing to syncstream file: disk is getting full.\n");
delete m_dump;
m_dump = nullptr;
@@ -114,7 +114,7 @@
if (m_dump) {
try {
- m_dump->Data(data, size);
+ m_dump->data(sync_data, size);
} catch (const WException &) {
log
("Writing to syncstream file %s failed. Stop synctream dump.\n",
@@ -125,7 +125,7 @@
}
}
- m_target.Data(data, size);
+ m_target.data(sync_data, size);
m_counter += size;
}
@@ -149,7 +149,7 @@
}
-void Game::SyncReset() {
+void Game::sync_reset() {
m_syncwrapper.m_counter = 0;
m_synchash.Reset();
@@ -181,7 +181,7 @@
m_ctrl = ctrl;
}
-GameController * Game::gameController()
+GameController * Game::game_controller()
{
return m_ctrl;
}
@@ -241,7 +241,7 @@
0,
map().get_scenario_player_tribe(p),
map().get_scenario_player_name (p));
- get_player(p)->setAI(map().get_scenario_player_ai(p));
+ get_player(p)->set_ai(map().get_scenario_player_ai(p));
}
m_win_condition_displayname = _("Scenario");
@@ -313,7 +313,7 @@
playersettings.tribe,
playersettings.name,
playersettings.team);
- get_player(i + 1)->setAI(playersettings.ai);
+ get_player(i + 1)->set_ai(playersettings.ai);
}
// Add shared in starting positions
@@ -504,7 +504,7 @@
const std::string no_name;
const std::string & player_tribe = plr ? plr->tribe().name() : no_name;
const std::string & player_name = plr ? plr-> get_name() : no_name;
- const std::string & player_ai = plr ? plr-> getAI() : no_name;
+ const std::string & player_ai = plr ? plr-> get_ai() : no_name;
map().set_scenario_player_tribe (p, player_tribe);
map().set_scenario_player_name (p, player_name);
map().set_scenario_player_ai (p, player_ai);
@@ -533,7 +533,7 @@
fname += timestring();
if (m_ctrl) {
fname += ' ';
- fname += m_ctrl->getGameDescription();
+ fname += m_ctrl->get_game_description();
}
fname += REPLAY_SUFFIX;
@@ -547,10 +547,10 @@
}
if (m_writesyncstream)
- m_syncwrapper.StartDump(fname);
+ m_syncwrapper.start_dump(fname);
}
- SyncReset();
+ sync_reset();
if (loader_ui) {
load_graphics(*loader_ui);
@@ -614,7 +614,7 @@
// computer and the fps if and when the game is saved - this is very bad
// for scenarios and even worse for the regression suite (which relies on
// the timings of savings.
- cmdqueue().run_queue(m_ctrl->getFrametime(), get_game_time_pointer());
+ cmdqueue().run_queue(m_ctrl->get_frametime(), get_gametime_pointer());
if (g_gr) // not in dedicated server mode
g_gr->animate_maptextures(get_gametime());
@@ -681,8 +681,8 @@
{
MD5Checksum<StreamWrite> copy(m_synchash);
- copy.FinishChecksum();
- return copy.GetChecksum();
+ copy.finish_checksum();
+ return copy.get_checksum();
}
@@ -695,7 +695,7 @@
uint32_t Game::logic_rand()
{
uint32_t const result = rng().rand();
- syncstream().Unsigned32(result);
+ syncstream().unsigned_32(result);
return result;
}
@@ -707,7 +707,7 @@
*/
void Game::send_player_command (PlayerCommand & pc)
{
- m_ctrl->sendPlayerCommand(pc);
+ m_ctrl->send_player_command(pc);
}
@@ -723,7 +723,7 @@
{
if (m_writereplay && m_replaywriter) {
if (upcast(PlayerCommand, plcmd, cmd)) {
- m_replaywriter->SendPlayerCommand(plcmd);
+ m_replaywriter->send_player_command(plcmd);
}
}
cmdqueue().enqueue(cmd);
@@ -1070,13 +1070,13 @@
* is 4, support for older versions (used in widelands build <= 12) was
* dropped after the release of build 15
*/
-void Game::ReadStatistics(FileRead & fr, uint32_t const version)
+void Game::read_statistics(FileRead & fr, uint32_t const version)
{
if (version >= 3) {
- fr.Unsigned32(); // used to be last stats update time
+ fr.unsigned_32(); // used to be last stats update time
// Read general statistics
- uint32_t entries = fr.Unsigned16();
+ uint32_t entries = fr.unsigned_16();
const PlayerNumber nr_players = map().get_nrplayers();
m_general_stats.resize(nr_players);
@@ -1099,20 +1099,20 @@
iterate_players_existing_novar(p, nr_players, *this)
for (uint32_t j = 0; j < m_general_stats[p - 1].land_size.size(); ++j)
{
- m_general_stats[p - 1].land_size [j] = fr.Unsigned32();
- m_general_stats[p - 1].nr_workers [j] = fr.Unsigned32();
- m_general_stats[p - 1].nr_buildings [j] = fr.Unsigned32();
- m_general_stats[p - 1].nr_wares [j] = fr.Unsigned32();
- m_general_stats[p - 1].productivity [j] = fr.Unsigned32();
- m_general_stats[p - 1].nr_casualties [j] = fr.Unsigned32();
- m_general_stats[p - 1].nr_kills [j] = fr.Unsigned32();
- m_general_stats[p - 1].nr_msites_lost [j] = fr.Unsigned32();
- m_general_stats[p - 1].nr_msites_defeated [j] = fr.Unsigned32();
- m_general_stats[p - 1].nr_civil_blds_lost [j] = fr.Unsigned32();
- m_general_stats[p - 1].nr_civil_blds_defeated[j] = fr.Unsigned32();
- m_general_stats[p - 1].miltary_strength[j] = fr.Unsigned32();
+ m_general_stats[p - 1].land_size [j] = fr.unsigned_32();
+ m_general_stats[p - 1].nr_workers [j] = fr.unsigned_32();
+ m_general_stats[p - 1].nr_buildings [j] = fr.unsigned_32();
+ m_general_stats[p - 1].nr_wares [j] = fr.unsigned_32();
+ m_general_stats[p - 1].productivity [j] = fr.unsigned_32();
+ m_general_stats[p - 1].nr_casualties [j] = fr.unsigned_32();
+ m_general_stats[p - 1].nr_kills [j] = fr.unsigned_32();
+ m_general_stats[p - 1].nr_msites_lost [j] = fr.unsigned_32();
+ m_general_stats[p - 1].nr_msites_defeated [j] = fr.unsigned_32();
+ m_general_stats[p - 1].nr_civil_blds_lost [j] = fr.unsigned_32();
+ m_general_stats[p - 1].nr_civil_blds_defeated[j] = fr.unsigned_32();
+ m_general_stats[p - 1].miltary_strength[j] = fr.unsigned_32();
if (version == 4)
- m_general_stats[p - 1].custom_statistic[j] = fr.Unsigned32();
+ m_general_stats[p - 1].custom_statistic[j] = fr.unsigned_32();
}
} else
throw wexception("Unsupported version %i", version);
@@ -1122,9 +1122,9 @@
/**
* Write general statistics to the given file.
*/
-void Game::WriteStatistics(FileWrite & fw)
+void Game::write_statistics(FileWrite & fw)
{
- fw.Unsigned32(0); // Used to be last stats update time. No longer needed
+ fw.unsigned_32(0); // Used to be last stats update time. No longer needed
// General statistics
// First, we write the size of the statistics arrays
@@ -1137,23 +1137,23 @@
break;
}
- fw.Unsigned16(entries);
+ fw.unsigned_16(entries);
iterate_players_existing_novar(p, nr_players, *this)
for (uint32_t j = 0; j < entries; ++j) {
- fw.Unsigned32(m_general_stats[p - 1].land_size [j]);
- fw.Unsigned32(m_general_stats[p - 1].nr_workers [j]);
- fw.Unsigned32(m_general_stats[p - 1].nr_buildings [j]);
- fw.Unsigned32(m_general_stats[p - 1].nr_wares [j]);
- fw.Unsigned32(m_general_stats[p - 1].productivity [j]);
- fw.Unsigned32(m_general_stats[p - 1].nr_casualties [j]);
- fw.Unsigned32(m_general_stats[p - 1].nr_kills [j]);
- fw.Unsigned32(m_general_stats[p - 1].nr_msites_lost [j]);
- fw.Unsigned32(m_general_stats[p - 1].nr_msites_defeated [j]);
- fw.Unsigned32(m_general_stats[p - 1].nr_civil_blds_lost [j]);
- fw.Unsigned32(m_general_stats[p - 1].nr_civil_blds_defeated[j]);
- fw.Unsigned32(m_general_stats[p - 1].miltary_strength[j]);
- fw.Unsigned32(m_general_stats[p - 1].custom_statistic[j]);
+ fw.unsigned_32(m_general_stats[p - 1].land_size [j]);
+ fw.unsigned_32(m_general_stats[p - 1].nr_workers [j]);
+ fw.unsigned_32(m_general_stats[p - 1].nr_buildings [j]);
+ fw.unsigned_32(m_general_stats[p - 1].nr_wares [j]);
+ fw.unsigned_32(m_general_stats[p - 1].productivity [j]);
+ fw.unsigned_32(m_general_stats[p - 1].nr_casualties [j]);
+ fw.unsigned_32(m_general_stats[p - 1].nr_kills [j]);
+ fw.unsigned_32(m_general_stats[p - 1].nr_msites_lost [j]);
+ fw.unsigned_32(m_general_stats[p - 1].nr_msites_defeated [j]);
+ fw.unsigned_32(m_general_stats[p - 1].nr_civil_blds_lost [j]);
+ fw.unsigned_32(m_general_stats[p - 1].nr_civil_blds_defeated[j]);
+ fw.unsigned_32(m_general_stats[p - 1].miltary_strength[j]);
+ fw.unsigned_32(m_general_stats[p - 1].custom_statistic[j]);
}
}
=== modified file 'src/logic/game.h'
--- src/logic/game.h 2014-09-14 11:31:58 +0000
+++ src/logic/game.h 2014-09-29 13:33:11 +0000
@@ -98,7 +98,7 @@
// life cycle
void set_game_controller(GameController *);
- GameController * gameController();
+ GameController * game_controller();
void set_write_replay(bool wr);
void set_write_syncstream(bool wr);
void save_syncstream(bool save);
@@ -191,8 +191,8 @@
return m_general_stats;
}
- void ReadStatistics(FileRead &, uint32_t version);
- void WriteStatistics(FileWrite &);
+ void read_statistics(FileRead &, uint32_t version);
+ void write_statistics(FileWrite &);
void sample_statistics();
@@ -201,7 +201,7 @@
bool is_replay() const {return m_replay;}
private:
- void SyncReset();
+ void sync_reset();
MD5Checksum<StreamWrite> m_synchash;
@@ -221,11 +221,11 @@
///
/// Note that this file is deleted at the end of the game, unless
/// \ref m_syncstreamsave has been set.
- void StartDump(const std::string & fname);
-
- void Data(void const * data, size_t size) override;
-
- void Flush() override {m_target.Flush();}
+ void start_dump(const std::string & fname);
+
+ void data(void const * data, size_t size) override;
+
+ void flush() override {m_target.flush();}
public:
Game & m_game;
=== modified file 'src/logic/game_controller.h'
--- src/logic/game_controller.h 2014-07-20 07:45:17 +0000
+++ src/logic/game_controller.h 2014-09-29 13:33:11 +0000
@@ -45,42 +45,42 @@
virtual ~GameController() {}
virtual void think() = 0;
- virtual void sendPlayerCommand(Widelands::PlayerCommand &) = 0;
- virtual int32_t getFrametime() = 0;
- virtual std::string getGameDescription() = 0;
+ virtual void send_player_command(Widelands::PlayerCommand &) = 0;
+ virtual int32_t get_frametime() = 0;
+ virtual std::string get_game_description() = 0;
/**
* \return the effective speed, in milliseconds per second,
* that the game is running at.
*/
- virtual uint32_t realSpeed() = 0;
+ virtual uint32_t real_speed() = 0;
/**
* \return the speed that the local player wants the game to run at.
*/
- virtual uint32_t desiredSpeed() = 0;
+ virtual uint32_t desired_speed() = 0;
/**
* Indicate to the game controller the speed (in milliseconds per second)
* that the local player wants the game to run at.
*/
- virtual void setDesiredSpeed(uint32_t speed) = 0;
+ virtual void set_desired_speed(uint32_t speed) = 0;
/**
* Whether the game is paused.
*/
- virtual bool isPaused() = 0;
+ virtual bool is_paused() = 0;
/**
* Sets whether the game is paused.
*/
- virtual void setPaused(const bool paused) = 0;
+ virtual void set_paused(const bool paused) = 0;
/**
* Toggle pause state (convenience function)
*/
- void togglePaused() {
- setPaused(!isPaused());
+ void toggle_paused() {
+ set_paused(!is_paused());
}
/**
=== modified file 'src/logic/game_settings.h'
--- src/logic/game_settings.h 2014-09-10 16:57:31 +0000
+++ src/logic/game_settings.h 2014-09-29 13:33:11 +0000
@@ -53,8 +53,8 @@
struct UserSettings {
static uint8_t none() {return std::numeric_limits<uint8_t>::max();}
- static uint8_t notConnected() {return none() - 1;}
- static uint8_t highestPlayernum() {return notConnected() - 1;}
+ static uint8_t not_connected() {return none() - 1;}
+ static uint8_t highest_playernum() {return not_connected() - 1;}
uint8_t position;
std::string name;
@@ -134,39 +134,39 @@
virtual const GameSettings & settings() = 0;
- virtual void setScenario(bool set) = 0;
- virtual bool canChangeMap() = 0;
- virtual bool canChangePlayerState(uint8_t number) = 0;
- virtual bool canChangePlayerTribe(uint8_t number) = 0;
- virtual bool canChangePlayerInit (uint8_t number) = 0;
- virtual bool canChangePlayerTeam (uint8_t number) = 0;
-
- virtual bool canLaunch() = 0;
-
- virtual void setMap
+ virtual void set_scenario(bool set) = 0;
+ virtual bool can_change_map() = 0;
+ virtual bool can_change_player_state(uint8_t number) = 0;
+ virtual bool can_change_player_tribe(uint8_t number) = 0;
+ virtual bool can_change_player_init (uint8_t number) = 0;
+ virtual bool can_change_player_team (uint8_t number) = 0;
+
+ virtual bool can_launch() = 0;
+
+ virtual void set_map
(const std::string & mapname,
const std::string & mapfilename,
uint32_t maxplayers,
- bool savegame = false)
+ bool savegame = false)
= 0;
- virtual void setPlayerState (uint8_t number, PlayerSettings::State) = 0;
- virtual void setPlayerAI (uint8_t number, const std::string &, bool const random_ai = false) = 0;
- virtual void nextPlayerState (uint8_t number) = 0;
- virtual void setPlayerTribe (uint8_t number, const std::string &, bool const random_tribe = false) = 0;
- virtual void setPlayerInit (uint8_t number, uint8_t index) = 0;
- virtual void setPlayerName (uint8_t number, const std::string &) = 0;
- virtual void setPlayer (uint8_t number, PlayerSettings) = 0;
- virtual void setPlayerNumber (uint8_t number) = 0;
- virtual void setPlayerTeam (uint8_t number, Widelands::TeamNumber team) = 0;
- virtual void setPlayerCloseable(uint8_t number, bool closeable) = 0;
- virtual void setPlayerShared (uint8_t number, uint8_t shared) = 0;
- virtual void setWinConditionScript (std::string wc) = 0;
- virtual void nextWinCondition () = 0;
- virtual std::string getWinConditionScript() = 0;
+ virtual void set_player_state (uint8_t number, PlayerSettings::State) = 0;
+ virtual void set_player_ai (uint8_t number, const std::string &, bool const random_ai = false) = 0;
+ virtual void next_player_state (uint8_t number) = 0;
+ virtual void set_player_tribe (uint8_t number, const std::string &, bool const random_tribe = false) = 0;
+ virtual void set_player_init (uint8_t number, uint8_t index) = 0;
+ virtual void set_player_name (uint8_t number, const std::string &) = 0;
+ virtual void set_player (uint8_t number, PlayerSettings) = 0;
+ virtual void set_player_number (uint8_t number) = 0;
+ virtual void set_player_team (uint8_t number, Widelands::TeamNumber team) = 0;
+ virtual void set_player_closeable(uint8_t number, bool closeable) = 0;
+ virtual void set_player_shared (uint8_t number, uint8_t shared) = 0;
+ virtual void set_win_condition_script(std::string wc) = 0;
+ virtual void next_win_condition () = 0;
+ virtual std::string get_win_condition_script() = 0;
struct NoTribe {};
- const std::string & getPlayersTribe() {
- if (UserSettings::highestPlayernum() < settings().playernum)
+ const std::string & get_players_tribe() {
+ if (UserSettings::highest_playernum() < settings().playernum)
throw NoTribe();
return settings().players[settings().playernum].tribe;
}
=== modified file 'src/logic/immovable.cc'
--- src/logic/immovable.cc 2014-09-10 17:52:49 +0000
+++ src/logic/immovable.cc 2014-09-29 13:33:11 +0000
@@ -619,7 +619,7 @@
Immovable & imm = ref_cast<Immovable, MapObject>(*get_object());
if (version >= 5) {
- PlayerNumber pn = fr.Unsigned8();
+ PlayerNumber pn = fr.unsigned_8();
if (pn && pn <= MAX_PLAYERS) {
Player * plr = egbase().get_player(pn);
if (!plr)
@@ -629,11 +629,11 @@
}
// Position
- imm.m_position = ReadCoords32(&fr, egbase().map().extent());
+ imm.m_position = read_coords_32(&fr, egbase().map().extent());
imm.set_position(egbase(), imm.m_position);
// Animation
- char const * const animname = fr.CString();
+ char const * const animname = fr.c_string();
try {
imm.m_anim = imm.descr().get_animation(animname);
} catch (const MapObjectDescr::AnimationNonexistent &) {
@@ -642,28 +642,28 @@
("Warning: (%s) Animation \"%s\" not found, using animation %s).\n",
imm.descr().name().c_str(), animname, imm.descr().get_animation_name(imm.m_anim).c_str());
}
- imm.m_animstart = fr.Signed32();
+ imm.m_animstart = fr.signed_32();
if (version >= 4) {
- imm.m_anim_construction_total = fr.Unsigned32();
+ imm.m_anim_construction_total = fr.unsigned_32();
if (imm.m_anim_construction_total)
- imm.m_anim_construction_done = fr.Unsigned32();
+ imm.m_anim_construction_done = fr.unsigned_32();
}
{ // program
std::string program_name;
if (1 == version) {
- program_name = fr.Unsigned8() ? fr.CString() : "program";
+ program_name = fr.unsigned_8() ? fr.c_string() : "program";
std::transform
(program_name.begin(), program_name.end(), program_name.begin(),
tolower);
} else {
- program_name = fr.CString();
+ program_name = fr.c_string();
if (program_name.empty())
program_name = "program";
}
imm.m_program = imm.descr().get_program(program_name);
}
- imm.m_program_ptr = fr.Unsigned32();
+ imm.m_program_ptr = fr.unsigned_32();
if (!imm.m_program) {
imm.m_program_ptr = 0;
@@ -681,13 +681,13 @@
}
}
- imm.m_program_step = fr.Signed32();
+ imm.m_program_step = fr.signed_32();
if (version >= 3)
- imm.m_reserved_by_worker = fr.Unsigned8();
+ imm.m_reserved_by_worker = fr.unsigned_8();
if (version >= 4) {
- std::string dataname = fr.CString();
+ std::string dataname = fr.c_string();
if (!dataname.empty()) {
imm.set_action_data(ImmovableActionData::load(fr, imm, dataname));
}
@@ -717,42 +717,42 @@
{
// This is in front because it is required to obtain the description
// necessary to create the Immovable
- fw.Unsigned8(HeaderImmovable);
- fw.Unsigned8(IMMOVABLE_SAVEGAME_VERSION);
+ fw.unsigned_8(HeaderImmovable);
+ fw.unsigned_8(IMMOVABLE_SAVEGAME_VERSION);
if (const TribeDescr * const tribe = descr().get_owner_tribe())
- fw.String(tribe->name());
+ fw.string(tribe->name());
else
- fw.CString("world");
+ fw.c_string("world");
- fw.String(descr().name());
+ fw.string(descr().name());
// The main loading data follows
BaseImmovable::save(egbase, mos, fw);
- fw.Unsigned8(get_owner() ? get_owner()->player_number() : 0);
- WriteCoords32(&fw, m_position);
+ fw.unsigned_8(get_owner() ? get_owner()->player_number() : 0);
+ write_coords_32(&fw, m_position);
// Animations
- fw.String(descr().get_animation_name(m_anim));
- fw.Signed32(m_animstart);
- fw.Unsigned32(m_anim_construction_total);
+ fw.string(descr().get_animation_name(m_anim));
+ fw.signed_32(m_animstart);
+ fw.unsigned_32(m_anim_construction_total);
if (m_anim_construction_total)
- fw.Unsigned32(m_anim_construction_done);
+ fw.unsigned_32(m_anim_construction_done);
// Program Stuff
- fw.String(m_program ? m_program->name() : "");
-
- fw.Unsigned32(m_program_ptr);
- fw.Signed32(m_program_step);
-
- fw.Unsigned8(m_reserved_by_worker);
+ fw.string(m_program ? m_program->name() : "");
+
+ fw.unsigned_32(m_program_ptr);
+ fw.signed_32(m_program_step);
+
+ fw.unsigned_8(m_reserved_by_worker);
if (m_action_data) {
- fw.CString(m_action_data->name());
+ fw.c_string(m_action_data->name());
m_action_data->save(fw, *this);
} else {
- fw.CString("");
+ fw.c_string("");
}
}
@@ -764,11 +764,11 @@
try {
// The header has been peeled away by the caller
- uint8_t const version = fr.Unsigned8();
+ uint8_t const version = fr.unsigned_8();
if (1 <= version && version <= IMMOVABLE_SAVEGAME_VERSION) {
- const std::string owner_name = fr.CString();
- const std::string old_name = fr.CString();
+ const std::string owner_name = fr.c_string();
+ const std::string old_name = fr.c_string();
Immovable * imm = nullptr;
if (owner_name != "world") { // It is a tribe immovable.
@@ -1166,7 +1166,7 @@
struct ActConstructionData : ImmovableActionData {
const char * name() const override {return "construction";}
void save(FileWrite & fw, Immovable & imm) override {
- fw.Unsigned8(CONSTRUCTION_DATA_VERSION);
+ fw.unsigned_8(CONSTRUCTION_DATA_VERSION);
delivered.save(fw, *imm.descr().get_owner_tribe());
}
@@ -1174,7 +1174,7 @@
ActConstructionData * d = new ActConstructionData;
try {
- uint8_t version = fr.Unsigned8();
+ uint8_t version = fr.unsigned_8();
if (version == CONSTRUCTION_DATA_VERSION) {
d->delivered.load(fr, *imm.descr().get_owner_tribe());
} else
@@ -1462,10 +1462,10 @@
PlayerImmovable & imm = get<PlayerImmovable>();
try {
- uint8_t version = fr.Unsigned8();
+ uint8_t version = fr.unsigned_8();
if (1 <= version && version <= PLAYERIMMOVABLE_SAVEGAME_VERSION) {
- PlayerNumber owner_number = fr.Unsigned8();
+ PlayerNumber owner_number = fr.unsigned_8();
if (!owner_number || owner_number > egbase().map().get_nrplayers())
throw GameDataError
@@ -1488,8 +1488,8 @@
{
BaseImmovable::save(egbase, mos, fw);
- fw.Unsigned8(PLAYERIMMOVABLE_SAVEGAME_VERSION);
- fw.Unsigned8(owner().player_number());
+ fw.unsigned_8(PLAYERIMMOVABLE_SAVEGAME_VERSION);
+ fw.unsigned_8(owner().player_number());
}
}
=== modified file 'src/logic/instances.cc'
--- src/logic/instances.cc 2014-09-14 11:31:58 +0000
+++ src/logic/instances.cc 2014-09-29 13:33:11 +0000
@@ -44,21 +44,21 @@
void CmdDestroyMapObject::execute(Game & game)
{
- game.syncstream().Unsigned32(obj_serial);
+ game.syncstream().unsigned_32(obj_serial);
if (MapObject * obj = game.objects().get_object(obj_serial))
obj->destroy (game);
}
#define CMD_DESTROY_MAP_OBJECT_VERSION 1
-void CmdDestroyMapObject::Read
+void CmdDestroyMapObject::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == CMD_DESTROY_MAP_OBJECT_VERSION) {
- GameLogicCommand::Read(fr, egbase, mol);
- if (Serial const serial = fr.Unsigned32())
+ GameLogicCommand::read(fr, egbase, mol);
+ if (Serial const serial = fr.unsigned_32())
try {
obj_serial = mol.get<MapObject>(serial).serial();
} catch (const WException & e) {
@@ -73,17 +73,17 @@
throw GameDataError("destroy map object: %s", e.what());
}
}
-void CmdDestroyMapObject::Write
+void CmdDestroyMapObject::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(CMD_DESTROY_MAP_OBJECT_VERSION);
+ fw.unsigned_16(CMD_DESTROY_MAP_OBJECT_VERSION);
// Write base classes
- GameLogicCommand::Write(fw, egbase, mos);
+ GameLogicCommand::write(fw, egbase, mos);
// Now serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(obj_serial)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(obj_serial)));
}
CmdAct::CmdAct(int32_t const t, MapObject & o, int32_t const a) :
@@ -93,7 +93,7 @@
void CmdAct::execute(Game & game)
{
- game.syncstream().Unsigned32(obj_serial);
+ game.syncstream().unsigned_32(obj_serial);
if (MapObject * const obj = game.objects().get_object(obj_serial))
obj->act(game, arg);
@@ -101,14 +101,14 @@
}
#define CMD_ACT_VERSION 1
-void CmdAct::Read
+void CmdAct::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == CMD_ACT_VERSION) {
- GameLogicCommand::Read(fr, egbase, mol);
- if (Serial const object_serial = fr.Unsigned32())
+ GameLogicCommand::read(fr, egbase, mol);
+ if (Serial const object_serial = fr.unsigned_32())
try {
obj_serial = mol.get<MapObject>(object_serial).serial();
} catch (const WException & e) {
@@ -117,7 +117,7 @@
}
else
obj_serial = 0;
- arg = fr.Unsigned32();
+ arg = fr.unsigned_32();
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -125,20 +125,20 @@
throw wexception("act: %s", e.what());
}
}
-void CmdAct::Write
+void CmdAct::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(CMD_ACT_VERSION);
+ fw.unsigned_16(CMD_ACT_VERSION);
// Write base classes
- GameLogicCommand::Write(fw, egbase, mos);
+ GameLogicCommand::write(fw, egbase, mos);
// Now serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(obj_serial)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(obj_serial)));
// And arg
- fw.Unsigned32(arg);
+ fw.unsigned_32(arg);
}
@@ -431,14 +431,14 @@
uint32_t MapObject::schedule_act
(Game & game, uint32_t const tdelta, uint32_t const data)
{
- if (tdelta < Forever()) {
+ if (tdelta < endless()) {
uint32_t const time = game.get_gametime() + tdelta;
game.cmdqueue().enqueue (new CmdAct(time, *this, data));
return time;
} else
- return Never();
+ return never();
}
@@ -495,16 +495,16 @@
void MapObject::Loader::load(FileRead & fr)
{
try {
- uint8_t const header = fr.Unsigned8();
+ uint8_t const header = fr.unsigned_8();
if (header != HeaderMapObject)
throw wexception
("header is %u, expected %u", header, HeaderMapObject);
- uint8_t const version = fr.Unsigned8();
+ uint8_t const version = fr.unsigned_8();
if (version != CURRENT_SAVEGAME_VERSION)
throw GameDataError("unknown/unhandled version %u", version);
- Serial const serial = fr.Unsigned32();
+ Serial const serial = fr.unsigned_32();
try {
mol().register_object<MapObject>(serial, *get_object());
} catch (const WException & e) {
@@ -547,10 +547,10 @@
void MapObject::save
(EditorGameBase &, MapObjectSaver & mos, FileWrite & fw)
{
- fw.Unsigned8(HeaderMapObject);
- fw.Unsigned8(CURRENT_SAVEGAME_VERSION);
+ fw.unsigned_8(HeaderMapObject);
+ fw.unsigned_8(CURRENT_SAVEGAME_VERSION);
- fw.Unsigned32(mos.get_object_file_index(*this));
+ fw.unsigned_32(mos.get_object_file_index(*this));
}
std::string to_string(const MapObjectType type) {
=== modified file 'src/logic/instances.h'
--- src/logic/instances.h 2014-09-14 11:31:58 +0000
+++ src/logic/instances.h 2014-09-29 13:33:11 +0000
@@ -468,8 +468,8 @@
CmdDestroyMapObject (int32_t t, MapObject &);
void execute (Game &) override;
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_DESTROY_MAPOBJECT;}
@@ -483,8 +483,8 @@
void execute (Game &) override;
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_ACT;}
=== modified file 'src/logic/map.cc'
--- src/logic/map.cc 2014-09-14 11:31:58 +0000
+++ src/logic/map.cc 2014-09-29 13:33:11 +0000
@@ -433,7 +433,7 @@
m_fields.reset(new Field[w * h]);
memset(m_fields.get(), 0, sizeof(Field) * w * h);
- m_pathfieldmgr->setSize(w * h);
+ m_pathfieldmgr->set_size(w * h);
m_overlay_manager.reset(new OverlayManager());
}
@@ -843,7 +843,7 @@
const FindImmovable & functor)
{
std::vector<ImmovableFound> duplist;
- FindImmovablesCallback cb(&duplist, FindImmovableAlwaysTrue());
+ FindImmovablesCallback cb(&duplist, find_immovable_always_true());
find_reachable(area, checkstep, cb);
@@ -1639,7 +1639,7 @@
if (boost::algorithm::ends_with(lower_filename, WLMF_SUFFIX)) {
try {
- result.reset(new WidelandsMapLoader(g_fs->MakeSubFileSystem(filename), this));
+ result.reset(new WidelandsMapLoader(g_fs->make_sub_file_system(filename), this));
} catch (...) {
// If this fails, it is an illegal file.
// TODO(unknown): catchall hides real errors! Replace with more specific code
@@ -1704,7 +1704,7 @@
return 0; // duh...
}
- if (!checkstep.reachabledest(*this, end))
+ if (!checkstep.reachable_dest(*this, end))
return -1;
if (!persist)
=== modified file 'src/logic/map.h'
--- src/logic/map.h 2014-09-14 11:31:58 +0000
+++ src/logic/map.h 2014-09-29 13:33:11 +0000
@@ -95,7 +95,7 @@
Predicates used in path finding and find functions.
*/
struct FindImmovable;
-const FindImmovable & FindImmovableAlwaysTrue();
+const FindImmovable & find_immovable_always_true();
struct FindBob {
// Return true if this bob should be returned by find_bobs.
@@ -247,17 +247,17 @@
uint32_t find_immovables
(const Area<FCoords>,
std::vector<ImmovableFound> * list,
- const FindImmovable & = FindImmovableAlwaysTrue());
+ const FindImmovable & = find_immovable_always_true());
uint32_t find_reachable_immovables
(const Area<FCoords>,
std::vector<ImmovableFound> * list,
const CheckStep &,
- const FindImmovable & = FindImmovableAlwaysTrue());
+ const FindImmovable & = find_immovable_always_true());
uint32_t find_reachable_immovables_unique
(const Area<FCoords>,
std::vector<BaseImmovable *> & list,
const CheckStep &,
- const FindImmovable & = FindImmovableAlwaysTrue());
+ const FindImmovable & = find_immovable_always_true());
uint32_t find_fields
(const Area<FCoords>,
std::vector<Coords> * list,
=== modified file 'src/logic/map_info.cc'
--- src/logic/map_info.cc 2014-09-10 16:57:31 +0000
+++ src/logic/map_info.cc 2014-09-29 13:33:11 +0000
@@ -47,7 +47,7 @@
SDL_Init(SDL_INIT_VIDEO);
g_fs = new LayeredFileSystem();
- g_fs->AddFileSystem(&FileSystem::Create(INSTALL_PREFIX + std::string("/") + INSTALL_DATADIR));
+ g_fs->add_file_system(&FileSystem::create(INSTALL_PREFIX + std::string("/") + INSTALL_DATADIR));
#ifdef HAS_GETENV
char dummy_video_env[] = "SDL_VIDEODRIVER=dummy";
@@ -71,13 +71,13 @@
try {
initialize();
- std::string map_dir = FileSystem::FS_Dirname(map_path);
+ std::string map_dir = FileSystem::fs_dirname(map_path);
if (map_dir.empty()) {
map_dir = ".";
}
- const std::string map_file = FileSystem::FS_Filename(map_path.c_str());
- FileSystem* in_out_filesystem = &FileSystem::Create(map_dir);
- g_fs->AddFileSystem(in_out_filesystem);
+ const std::string map_file = FileSystem::fs_filename(map_path.c_str());
+ FileSystem* in_out_filesystem = &FileSystem::create(map_dir);
+ g_fs->add_file_system(in_out_filesystem);
Map* map = new Map();
EditorGameBase egbase(nullptr);
@@ -98,7 +98,7 @@
{
FileWrite fw;
save_surface_to_png(minimap.get(), &fw);
- fw.Write(*in_out_filesystem, (map_file + ".png").c_str());
+ fw.write(*in_out_filesystem, (map_file + ".png").c_str());
}
// Write JSON.
@@ -106,7 +106,7 @@
FileWrite fw;
const auto write_string = [&fw] (const std::string& s) {
- fw.Data(s.c_str(), s.size());
+ fw.data(s.c_str(), s.size());
};
const auto write_key_value =
[&write_string](const std::string& key, const std::string& quoted_value) {
@@ -143,7 +143,7 @@
write_string("\n");
write_string("}\n");
- fw.Write(*in_out_filesystem, (map_file + ".json").c_str());
+ fw.write(*in_out_filesystem, (map_file + ".json").c_str());
}
}
catch (std::exception& e) {
=== modified file 'src/logic/message.h'
--- src/logic/message.h 2014-09-15 10:17:53 +0000
+++ src/logic/message.h 2014-09-29 13:33:11 +0000
@@ -37,7 +37,7 @@
* \param t The message title
* \param b The message body
* \param c The message coords. The player will be able to taken there.
- * Defaults to Coords::Null()
+ * Defaults to Coords::null()
* \param ser A MapObject serial. If non null, the message will be deleted once
* the object is removed from the game. Defaults to 0
* \param s The message status. Defaults to Status::New
@@ -47,7 +47,7 @@
uint32_t sent_time,
const std::string & t,
const std::string & b,
- Widelands::Coords const c = Coords::Null(),
+ Widelands::Coords const c = Coords::null(),
Widelands::Serial ser = 0,
Status s = New)
:
=== modified file 'src/logic/message_id.h'
--- src/logic/message_id.h 2014-09-10 13:03:40 +0000
+++ src/logic/message_id.h 2014-09-29 13:33:11 +0000
@@ -41,12 +41,12 @@
explicit MessageId(uint32_t const _id) : id(_id) {}
/// Constant value for no message.
- static MessageId Null() {MessageId result; result.id = 0; return result;}
+ static MessageId null() {MessageId result; result.id = 0; return result;}
bool operator== (const MessageId& other) const {return id == other.id;}
bool operator!= (const MessageId& other) const {return id != other.id;}
bool operator< (const MessageId& other) const {return id < other.id;}
- operator bool () const {return *this != Null();}
+ operator bool () const {return *this != null();}
uint32_t value() const {return id;}
private:
=== modified file 'src/logic/message_queue.h'
--- src/logic/message_queue.h 2014-09-18 18:56:20 +0000
+++ src/logic/message_queue.h 2014-09-29 13:33:11 +0000
@@ -142,7 +142,7 @@
/// it.
void clear() {
assert_counts();
- m_current_message_id = MessageId::Null();
+ m_current_message_id = MessageId::null();
m_counts[Message::New] = 0;
m_counts[Message::Read] = 0;
m_counts[Message::Archived] = 0;
=== modified file 'src/logic/militarysite.cc'
--- src/logic/militarysite.cc 2014-09-10 10:18:46 +0000
+++ src/logic/militarysite.cc 2014-09-29 13:33:11 +0000
@@ -115,8 +115,8 @@
void MilitarySite::update_statistics_string(std::string* s)
{
s->clear();
- uint32_t present = presentSoldiers().size();
- uint32_t stationed = stationedSoldiers().size();
+ uint32_t present = present_soldiers().size();
+ uint32_t stationed = stationed_soldiers().size();
if (present == stationed) {
if (m_capacity > stationed) {
@@ -219,7 +219,7 @@
returns 0 on succes, -1 if there was no room for this soldier
===============
*/
-int MilitarySite::incorporateSoldier(EditorGameBase & egbase, Soldier & s)
+int MilitarySite::incorporate_soldier(EditorGameBase & egbase, Soldier & s)
{
if (s.get_location(egbase) != this)
@@ -235,9 +235,9 @@
// should either drop one of the existing soldiers or reject the new guy, to
// avoid overstocking this site.
- if (stationedSoldiers().size() > descr().get_max_number_of_soldiers())
+ if (stationed_soldiers().size() > descr().get_max_number_of_soldiers())
{
- return incorporateUpgradedSoldier(egbase, s) ? 0 : -1;
+ return incorporate_upgraded_soldier(egbase, s) ? 0 : -1;
}
if (!m_didconquer) {
@@ -276,7 +276,7 @@
Soldier *
MilitarySite::find_least_suited_soldier()
{
- const std::vector<Soldier *> present = presentSoldiers();
+ const std::vector<Soldier *> present = present_soldiers();
const int32_t multiplier = kPrefersHeroes == m_soldier_preference ? -1:1;
int worst_soldier_level = INT_MIN;
Soldier * worst_soldier = nullptr;
@@ -309,7 +309,7 @@
bool
MilitarySite::drop_least_suited_soldier(bool new_soldier_has_arrived, Soldier * newguy)
{
- const std::vector<Soldier *> present = presentSoldiers();
+ const std::vector<Soldier *> present = present_soldiers();
// If I have only one soldier, and the new guy is not here yet, I can't release.
if (new_soldier_has_arrived || 1 < present.size())
@@ -350,10 +350,10 @@
* Returns false if the soldier was not incorporated.
*/
bool
-MilitarySite::incorporateUpgradedSoldier(EditorGameBase & egbase, Soldier & s)
+MilitarySite::incorporate_upgraded_soldier(EditorGameBase & egbase, Soldier & s)
{
// Call to drop_least routine has side effects: it tries to drop a soldier. Order is important!
- if (stationedSoldiers().size() < m_capacity || drop_least_suited_soldier(true, &s))
+ if (stationed_soldiers().size() < m_capacity || drop_least_suited_soldier(true, &s))
{
Game & game = ref_cast<Game, EditorGameBase>(egbase);
s.set_location(this);
@@ -379,7 +379,7 @@
MilitarySite & msite = ref_cast<MilitarySite, PlayerImmovable>(target);
Soldier & s = ref_cast<Soldier, Worker> (*w);
- msite.incorporateSoldier(game, s);
+ msite.incorporate_soldier(game, s);
}
@@ -389,8 +389,8 @@
*/
void MilitarySite::update_normal_soldier_request()
{
- std::vector<Soldier *> present = presentSoldiers();
- uint32_t const stationed = stationedSoldiers().size();
+ std::vector<Soldier *> present = present_soldiers();
+ uint32_t const stationed = stationed_soldiers().size();
if (stationed < m_capacity) {
if (!m_normal_soldier_request) {
@@ -478,8 +478,8 @@
void MilitarySite::update_soldier_request(bool incd)
{
- const uint32_t capacity = soldierCapacity();
- const uint32_t stationed = stationedSoldiers().size();
+ const uint32_t capacity = soldier_capacity();
+ const uint32_t stationed = stationed_soldiers().size();
if (m_doing_upgrade_request)
{
@@ -535,7 +535,7 @@
if ((capacity == stationed) && (! m_normal_soldier_request))
{
- if (presentSoldiers().size() == capacity)
+ if (present_soldiers().size() == capacity)
{
m_doing_upgrade_request = true;
update_upgrade_soldier_request();
@@ -581,7 +581,7 @@
if (m_nexthealtime <= game.get_gametime()) {
uint32_t total_heal = descr().get_heal_per_second();
- std::vector<Soldier *> soldiers = presentSoldiers();
+ std::vector<Soldier *> soldiers = present_soldiers();
for (uint32_t i = 0; i < soldiers.size(); ++i) {
Soldier & s = *soldiers[i];
@@ -610,7 +610,7 @@
ProductionSite::remove_worker(w);
if (upcast(Soldier, soldier, &w))
- popSoldierJob(soldier, nullptr);
+ pop_soldier_job(soldier, nullptr);
update_soldier_request();
}
@@ -623,7 +623,7 @@
{
if (upcast(Soldier, soldier, &worker)) {
// Evict soldiers that have returned home if the capacity is too low
- if (m_capacity < presentSoldiers().size()) {
+ if (m_capacity < present_soldiers().size()) {
worker.reset_tasks(game);
worker.start_task_leavebuilding(game, true);
return true;
@@ -633,14 +633,14 @@
if
(MapObject * const enemy
=
- popSoldierJob(soldier, &stayhome))
+ pop_soldier_job(soldier, &stayhome))
{
if (upcast(Building, building, enemy)) {
soldier->start_task_attack
(game, *building);
return true;
} else if (upcast(Soldier, opponent, enemy)) {
- if (!opponent->getBattle()) {
+ if (!opponent->get_battle()) {
soldier->start_task_defense
(game, stayhome);
if (stayhome)
@@ -659,7 +659,7 @@
/**
* \return \c true if the soldier is currently present and idle in the building.
*/
-bool MilitarySite::isPresent(Soldier & soldier) const
+bool MilitarySite::is_present(Soldier & soldier) const
{
return
soldier.get_location(owner().egbase()) == this &&
@@ -668,13 +668,13 @@
}
// TODO(sirver): This method should probably return a const reference.
-std::vector<Soldier *> MilitarySite::presentSoldiers() const
+std::vector<Soldier *> MilitarySite::present_soldiers() const
{
std::vector<Soldier *> soldiers;
for (Worker * worker : get_workers()) {
if (upcast(Soldier, soldier, worker)) {
- if (isPresent(*soldier)) {
+ if (is_present(*soldier)) {
soldiers.push_back(soldier);
}
}
@@ -683,7 +683,7 @@
}
// TODO(sirver): This method should probably return a const reference.
-std::vector<Soldier *> MilitarySite::stationedSoldiers() const
+std::vector<Soldier *> MilitarySite::stationed_soldiers() const
{
std::vector<Soldier *> soldiers;
@@ -695,36 +695,36 @@
return soldiers;
}
-uint32_t MilitarySite::minSoldierCapacity() const {
+uint32_t MilitarySite::min_soldier_capacity() const {
return 1;
}
-uint32_t MilitarySite::maxSoldierCapacity() const {
+uint32_t MilitarySite::max_soldier_capacity() const {
return descr().get_max_number_of_soldiers();
}
-uint32_t MilitarySite::soldierCapacity() const
+uint32_t MilitarySite::soldier_capacity() const
{
return m_capacity;
}
-void MilitarySite::setSoldierCapacity(uint32_t const capacity) {
- assert(minSoldierCapacity() <= capacity);
- assert (capacity <= maxSoldierCapacity());
+void MilitarySite::set_soldier_capacity(uint32_t const capacity) {
+ assert(min_soldier_capacity() <= capacity);
+ assert (capacity <= max_soldier_capacity());
assert(m_capacity != capacity);
m_capacity = capacity;
update_soldier_request();
}
-void MilitarySite::dropSoldier(Soldier & soldier)
+void MilitarySite::drop_soldier(Soldier & soldier)
{
Game & game = ref_cast<Game, EditorGameBase>(owner().egbase());
- if (!isPresent(soldier)) {
+ if (!is_present(soldier)) {
// This can happen when the "drop soldier" player command is delayed
// by network delay or a client has bugs.
- molog("MilitarySite::dropSoldier(%u): not present\n", soldier.serial());
+ molog("MilitarySite::drop_soldier(%u): not present\n", soldier.serial());
return;
}
- if (presentSoldiers().size() <= minSoldierCapacity()) {
+ if (present_soldiers().size() <= min_soldier_capacity()) {
molog("cannot drop last soldier(s)\n");
return;
}
@@ -747,7 +747,7 @@
}
-bool MilitarySite::canAttack()
+bool MilitarySite::can_attack()
{
return m_didconquer;
}
@@ -758,7 +758,7 @@
Map & map = game.map();
if
(enemy.get_owner() == &owner() ||
- enemy.getBattle() ||
+ enemy.get_battle() ||
descr().get_conquers()
<=
map.calc_distance(enemy.get_position(), get_position()))
@@ -774,11 +774,11 @@
// We're dealing with a soldier that we might want to keep busy
// Now would be the time to implement some player-definable
// policy as to how many soldiers are allowed to leave as defenders
- std::vector<Soldier *> present = presentSoldiers();
+ std::vector<Soldier *> present = present_soldiers();
if (1 < present.size()) {
for (Soldier * temp_soldier : present) {
- if (!haveSoldierJob(*temp_soldier)) {
+ if (!has_soldier_job(*temp_soldier)) {
SoldierJob sj;
sj.soldier = temp_soldier;
sj.enemy = &enemy;
@@ -799,7 +799,7 @@
{
Game & game = ref_cast<Game, EditorGameBase>(owner().egbase());
- std::vector<Soldier *> present = presentSoldiers();
+ std::vector<Soldier *> present = present_soldiers();
Soldier * defender = nullptr;
if (!present.empty()) {
@@ -814,7 +814,7 @@
} else {
// If one of our stationed soldiers is currently walking into the
// building, give us another chance.
- std::vector<Soldier *> stationed = stationedSoldiers();
+ std::vector<Soldier *> stationed = stationed_soldiers();
for (Soldier * temp_soldier : stationed) {
if (temp_soldier->get_position() == get_position()) {
defender = temp_soldier;
@@ -824,7 +824,7 @@
}
if (defender) {
- popSoldierJob(defender); // defense overrides all other jobs
+ pop_soldier_job(defender); // defense overrides all other jobs
SoldierJob sj;
sj.soldier = defender;
@@ -977,12 +977,12 @@
m_soldier_requirements = Requirements();
}
-void MilitarySite::sendAttacker
+void MilitarySite::send_attacker
(Soldier & soldier, Building & target)
{
- assert(isPresent(soldier));
+ assert(is_present(soldier));
- if (haveSoldierJob(soldier))
+ if (has_soldier_job(soldier))
return;
SoldierJob sj;
@@ -996,7 +996,7 @@
}
-bool MilitarySite::haveSoldierJob(Soldier & soldier)
+bool MilitarySite::has_soldier_job(Soldier & soldier)
{
for (const SoldierJob& temp_job : m_soldierjobs) {
if (temp_job.soldier == &soldier) {
@@ -1011,7 +1011,7 @@
* \return the enemy, if any, that the given soldier was scheduled
* to attack, and remove the job.
*/
-MapObject * MilitarySite::popSoldierJob
+MapObject * MilitarySite::pop_soldier_job
(Soldier * const soldier, bool * const stayhome)
{
for (std::vector<SoldierJob>::iterator job_iter = m_soldierjobs.begin();
@@ -1040,8 +1040,8 @@
bool
MilitarySite::update_upgrade_requirements()
{
- int32_t soldier_upgrade_required_min = m_soldier_upgrade_requirements.getMin();
- int32_t soldier_upgrade_required_max = m_soldier_upgrade_requirements.getMax();
+ int32_t soldier_upgrade_required_min = m_soldier_upgrade_requirements.get_min();
+ int32_t soldier_upgrade_required_max = m_soldier_upgrade_requirements.get_max();
if (kPrefersHeroes != m_soldier_preference && kPrefersRookies != m_soldier_preference)
{
=== modified file 'src/logic/militarysite.h'
--- src/logic/militarysite.h 2014-09-10 10:18:46 +0000
+++ src/logic/militarysite.h 2014-09-29 13:33:11 +0000
@@ -91,25 +91,25 @@
bool get_building_work(Game &, Worker &, bool success) override;
// Begin implementation of SoldierControl
- std::vector<Soldier *> presentSoldiers() const override;
- std::vector<Soldier *> stationedSoldiers() const override;
- uint32_t minSoldierCapacity() const override;
- uint32_t maxSoldierCapacity() const override;
- uint32_t soldierCapacity() const override;
- void setSoldierCapacity(uint32_t capacity) override;
- void dropSoldier(Soldier &) override;
- int incorporateSoldier(EditorGameBase & game, Soldier & s) override;
+ std::vector<Soldier *> present_soldiers() const override;
+ std::vector<Soldier *> stationed_soldiers() const override;
+ uint32_t min_soldier_capacity() const override;
+ uint32_t max_soldier_capacity() const override;
+ uint32_t soldier_capacity() const override;
+ void set_soldier_capacity(uint32_t capacity) override;
+ void drop_soldier(Soldier &) override;
+ int incorporate_soldier(EditorGameBase & game, Soldier & s) override;
// Begin implementation of Attackable
Player & owner() const override {return Building::owner();}
- bool canAttack() override;
+ bool can_attack() override;
void aggressor(Soldier &) override;
bool attack (Soldier &) override;
// End implementation of Attackable
/// Launch the given soldier on an attack towards the given
/// target building.
- void sendAttacker(Soldier &, Building &);
+ void send_attacker(Soldier &, Building &);
/// This methods are helper for use at configure this site.
void set_requirements (const Requirements &);
@@ -136,19 +136,19 @@
private:
void update_statistics_string(std::string*) override;
- bool isPresent(Soldier &) const;
+ bool is_present(Soldier &) const;
static void request_soldier_callback
(Game &, Request &, WareIndex, Worker *, PlayerImmovable &);
- MapObject * popSoldierJob
+ MapObject * pop_soldier_job
(Soldier *, bool * stayhome = nullptr);
- bool haveSoldierJob(Soldier &);
+ bool has_soldier_job(Soldier &);
bool military_presence_kept(Game &);
void notify_player(Game &, bool discovered = false);
bool update_upgrade_requirements();
void update_normal_soldier_request();
void update_upgrade_soldier_request();
- bool incorporateUpgradedSoldier(EditorGameBase & game, Soldier & s);
+ bool incorporate_upgraded_soldier(EditorGameBase & game, Soldier & s);
Soldier * find_least_suited_soldier();
bool drop_least_suited_soldier(bool new_has_arrived, Soldier * s);
=== modified file 'src/logic/path.cc'
--- src/logic/path.cc 2014-09-10 13:03:40 +0000
+++ src/logic/path.cc 2014-09-29 13:33:11 +0000
@@ -65,14 +65,14 @@
*/
void Path::save(FileWrite & fw) const
{
- fw.Unsigned8(1); // version number
- WriteCoords32(&fw, m_start);
+ fw.unsigned_8(1); // version number
+ write_coords_32(&fw, m_start);
// Careful: steps are stored in the reverse order in m_path
// However, we save them in the forward order, to make loading easier
- fw.Unsigned32(m_path.size());
+ fw.unsigned_32(m_path.size());
for (uint32_t i = m_path.size(); i > 0; --i)
- WriteDirection8(&fw, m_path[i - 1]);
+ write_direction_8(&fw, m_path[i - 1]);
}
/**
@@ -83,15 +83,15 @@
*/
void Path::load(FileRead & fr, const Map & map)
{
- uint8_t version = fr.Unsigned8();
+ uint8_t version = fr.unsigned_8();
if (version != 1)
throw GameDataError("path: unknown version %u", version);
- m_start = m_end = ReadCoords32(&fr, map.extent());
+ m_start = m_end = read_coords_32(&fr, map.extent());
m_path.clear();
- uint32_t steps = fr.Unsigned32();
+ uint32_t steps = fr.unsigned_32();
while (steps--)
- append(map, ReadDirection8(&fr));
+ append(map, read_direction_8(&fr));
}
/*
@@ -162,7 +162,7 @@
Opposite of truncate: remove the first n steps of the path.
===============
*/
-void CoordPath::starttrim(const std::vector<char>::size_type before) {
+void CoordPath::trim_start(const std::vector<char>::size_type before) {
assert(before <= m_path.size());
m_path.erase(m_path.begin(), m_path.begin() + before);
=== modified file 'src/logic/path.h'
--- src/logic/path.h 2014-09-14 11:31:58 +0000
+++ src/logic/path.h 2014-09-29 13:33:11 +0000
@@ -95,7 +95,7 @@
void reverse();
void truncate (const std::vector<char>::size_type after);
- void starttrim(const std::vector<char>::size_type before);
+ void trim_start(const std::vector<char>::size_type before);
void append(const Map & map, const Path & tail);
void append(const CoordPath & tail);
=== modified file 'src/logic/pathfield.cc'
--- src/logic/pathfield.cc 2014-07-25 18:24:48 +0000
+++ src/logic/pathfield.cc 2014-09-29 13:33:11 +0000
@@ -32,7 +32,7 @@
PathfieldManager::PathfieldManager() : m_nrfields(0) {}
-void PathfieldManager::setSize(uint32_t const nrfields)
+void PathfieldManager::set_size(uint32_t const nrfields)
{
if (m_nrfields != nrfields)
m_list.clear();
=== modified file 'src/logic/pathfield.h'
--- src/logic/pathfield.h 2014-09-14 14:36:56 +0000
+++ src/logic/pathfield.h 2014-09-29 13:33:11 +0000
@@ -74,7 +74,7 @@
struct PathfieldManager {
PathfieldManager();
- void setSize(uint32_t nrfields);
+ void set_size(uint32_t nrfields);
boost::shared_ptr<Pathfields> allocate();
private:
=== modified file 'src/logic/player.cc'
--- src/logic/player.cc 2014-09-18 18:56:20 +0000
+++ src/logic/player.cc 2014-09-29 13:33:11 +0000
@@ -344,7 +344,7 @@
map.calc_distance(tmp_message.second->position(), position) <= radius)
{
delete &m;
- return MessageId::Null();
+ return MessageId::null();
}
}
return add_message(game, m);
@@ -869,7 +869,7 @@
if (soldier.descr().type() != MapObjectType::SOLDIER)
return;
if (upcast(SoldierControl, ctrl, &imm))
- ctrl->dropSoldier(soldier);
+ ctrl->drop_soldier(soldier);
}
/*
@@ -878,14 +878,14 @@
*/
/**
- * Get a list of soldiers that this player can be used to attack the
+ * Get a list of soldiers that this player can use to attack the
* building at the given flag.
*
* The default attack should just take the first N soldiers of the
* returned array.
*/
// TODO(unknown): Perform a meaningful sort on the soldiers array.
-uint32_t Player::findAttackSoldiers
+uint32_t Player::find_attack_soldiers
(Flag & flag, std::vector<Soldier *> * soldiers, uint32_t nr_wanted)
{
uint32_t count = 0;
@@ -908,8 +908,8 @@
for (BaseImmovable * temp_flag : flags) {
upcast(Flag, attackerflag, temp_flag);
upcast(MilitarySite, ms, attackerflag->get_building());
- std::vector<Soldier *> const present = ms->presentSoldiers();
- uint32_t const nr_staying = ms->minSoldierCapacity();
+ std::vector<Soldier *> const present = ms->present_soldiers();
+ uint32_t const nr_staying = ms->min_soldier_capacity();
uint32_t const nr_present = present.size();
if (nr_staying < nr_present) {
uint32_t const nr_taken =
@@ -943,14 +943,14 @@
else if (is_hostile(flag.owner())) {
if (Building * const building = flag.get_building()) {
if (upcast(Attackable, attackable, building)) {
- if (attackable->canAttack()) {
+ if (attackable->can_attack()) {
std::vector<Soldier *> attackers;
- findAttackSoldiers(flag, &attackers, count);
+ find_attack_soldiers(flag, &attackers, count);
assert(attackers.size() <= count);
for (Soldier * temp_attacker : attackers) {
upcast(MilitarySite, ms, temp_attacker->get_location(egbase()));
- ms->sendAttacker(*temp_attacker, *building);
+ ms->send_attacker(*temp_attacker, *building);
}
}
}
@@ -1032,7 +1032,7 @@
if (const BaseImmovable * base_immovable = f.field->get_immovable()) {
map_object_descr = &base_immovable->descr();
- if (Road::IsRoadDescr(map_object_descr))
+ if (Road::is_road_descr(map_object_descr))
map_object_descr = nullptr;
else if (upcast(Building const, building, base_immovable)) {
if (building->get_position() != f)
@@ -1280,12 +1280,12 @@
}
}
-void Player::setAI(const std::string & ai)
+void Player::set_ai(const std::string & ai)
{
m_ai = ai;
}
-const std::string & Player::getAI() const
+const std::string & Player::get_ai() const
{
return m_ai;
}
@@ -1300,19 +1300,19 @@
* 2 - with consumption statistics
* 3 - with stock statistics
*/
-void Player::ReadStatistics(FileRead & fr, uint32_t const version)
+void Player::read_statistics(FileRead & fr, uint32_t const version)
{
//version 1, 2 and 3 only differs in an additional statistic.
//Use version 1 code for all of them
if ((version == 2) || (version == 1) || (version == 3)) {
- uint16_t nr_wares = fr.Unsigned16();
- uint16_t nr_entries = fr.Unsigned16();
+ uint16_t nr_wares = fr.unsigned_16();
+ uint16_t nr_entries = fr.unsigned_16();
for (uint32_t i = 0; i < m_current_produced_statistics.size(); ++i)
m_ware_productions[i].resize(nr_entries);
for (uint16_t i = 0; i < nr_wares; ++i) {
- std::string name = fr.CString();
+ std::string name = fr.c_string();
WareIndex idx = tribe().ware_index(name);
if (idx == INVALID_INDEX) {
log
@@ -1321,22 +1321,22 @@
continue;
}
- m_current_produced_statistics[idx] = fr.Unsigned32();
+ m_current_produced_statistics[idx] = fr.unsigned_32();
for (uint32_t j = 0; j < nr_entries; ++j)
- m_ware_productions[idx][j] = fr.Unsigned32();
+ m_ware_productions[idx][j] = fr.unsigned_32();
}
//read consumption statistics if it exists
if ((version == 2) || (version == 3)) {
- nr_wares = fr.Unsigned16();
- nr_entries = fr.Unsigned16();
+ nr_wares = fr.unsigned_16();
+ nr_entries = fr.unsigned_16();
for (uint32_t i = 0; i < m_current_consumed_statistics.size(); ++i)
m_ware_consumptions[i].resize(nr_entries);
for (uint16_t i = 0; i < nr_wares; ++i) {
- std::string name = fr.CString();
+ std::string name = fr.c_string();
WareIndex idx = tribe().ware_index(name);
if (idx == INVALID_INDEX) {
log
@@ -1345,22 +1345,22 @@
continue;
}
- m_current_consumed_statistics[idx] = fr.Unsigned32();
+ m_current_consumed_statistics[idx] = fr.unsigned_32();
for (uint32_t j = 0; j < nr_entries; ++j)
- m_ware_consumptions[idx][j] = fr.Unsigned32();
+ m_ware_consumptions[idx][j] = fr.unsigned_32();
}
//read stock statistics if it exists
if (version == 3) {
- nr_wares = fr.Unsigned16();
- nr_entries = fr.Unsigned16();
+ nr_wares = fr.unsigned_16();
+ nr_entries = fr.unsigned_16();
for (uint32_t i = 0; i < m_ware_stocks.size(); ++i)
m_ware_stocks[i].resize(nr_entries);
for (uint16_t i = 0; i < nr_wares; ++i) {
- std::string name = fr.CString();
+ std::string name = fr.c_string();
WareIndex idx = tribe().ware_index(name);
if (idx == INVALID_INDEX) {
log
@@ -1370,13 +1370,13 @@
}
for (uint32_t j = 0; j < nr_entries; ++j)
- m_ware_stocks[idx][j] = fr.Unsigned32();
+ m_ware_stocks[idx][j] = fr.unsigned_32();
}
}
}
} else if (version == 0) {
- uint16_t nr_wares = fr.Unsigned16();
- uint16_t nr_entries = fr.Unsigned16();
+ uint16_t nr_wares = fr.unsigned_16();
+ uint16_t nr_entries = fr.unsigned_16();
if (nr_wares > 0) {
if (nr_wares == tribe().get_nrwares()) {
@@ -1384,11 +1384,11 @@
assert(m_current_produced_statistics.size() == nr_wares);
for (uint32_t i = 0; i < m_current_produced_statistics.size(); ++i) {
- m_current_produced_statistics[i] = fr.Unsigned32();
+ m_current_produced_statistics[i] = fr.unsigned_32();
m_ware_productions[i].resize(nr_entries);
for (uint32_t j = 0; j < m_ware_productions[i].size(); ++j)
- m_ware_productions[i][j] = fr.Unsigned32();
+ m_ware_productions[i][j] = fr.unsigned_32();
}
} else {
log
@@ -1399,10 +1399,10 @@
// Eat and discard all data
for (uint32_t i = 0; i < nr_wares; ++i) {
- fr.Unsigned32();
+ fr.unsigned_32();
for (uint32_t j = 0; j < nr_entries; ++j)
- fr.Unsigned32();
+ fr.unsigned_32();
}
}
}
@@ -1446,39 +1446,39 @@
/**
* Write statistics data to the give file
*/
-void Player::WriteStatistics(FileWrite & fw) const {
+void Player::write_statistics(FileWrite & fw) const {
//write produce statistics
- fw.Unsigned16(m_current_produced_statistics.size());
- fw.Unsigned16(m_ware_productions[0].size());
+ fw.unsigned_16(m_current_produced_statistics.size());
+ fw.unsigned_16(m_ware_productions[0].size());
for (uint8_t i = 0; i < m_current_produced_statistics.size(); ++i) {
- fw.CString
+ fw.c_string
(tribe().get_ware_descr(i)->name());
- fw.Unsigned32(m_current_produced_statistics[i]);
+ fw.unsigned_32(m_current_produced_statistics[i]);
for (uint32_t j = 0; j < m_ware_productions[i].size(); ++j)
- fw.Unsigned32(m_ware_productions[i][j]);
+ fw.unsigned_32(m_ware_productions[i][j]);
}
//write consume statistics
- fw.Unsigned16(m_current_consumed_statistics.size());
- fw.Unsigned16(m_ware_consumptions[0].size());
+ fw.unsigned_16(m_current_consumed_statistics.size());
+ fw.unsigned_16(m_ware_consumptions[0].size());
for (uint8_t i = 0; i < m_current_consumed_statistics.size(); ++i) {
- fw.CString
+ fw.c_string
(tribe().get_ware_descr(i)->name());
- fw.Unsigned32(m_current_consumed_statistics[i]);
+ fw.unsigned_32(m_current_consumed_statistics[i]);
for (uint32_t j = 0; j < m_ware_consumptions[i].size(); ++j)
- fw.Unsigned32(m_ware_consumptions[i][j]);
+ fw.unsigned_32(m_ware_consumptions[i][j]);
}
//write stock statistics
- fw.Unsigned16(m_ware_stocks.size());
- fw.Unsigned16(m_ware_stocks[0].size());
+ fw.unsigned_16(m_ware_stocks.size());
+ fw.unsigned_16(m_ware_stocks[0].size());
for (uint8_t i = 0; i < m_ware_stocks.size(); ++i) {
- fw.CString(tribe().get_ware_descr(i)->name());
+ fw.c_string(tribe().get_ware_descr(i)->name());
for (uint32_t j = 0; j < m_ware_stocks[i].size(); ++j)
- fw.Unsigned32(m_ware_stocks[i][j]);
+ fw.unsigned_32(m_ware_stocks[i][j]);
}
}
=== modified file 'src/logic/player.h'
--- src/logic/player.h 2014-09-18 18:56:20 +0000
+++ src/logic/player.h 2014-09-29 13:33:11 +0000
@@ -155,8 +155,8 @@
// darkening that actually hides the ground from the user).
terrains.d = terrains.r = 0;
- time_triangle_last_surveyed[0] = Never();
- time_triangle_last_surveyed[1] = Never();
+ time_triangle_last_surveyed[0] = never();
+ time_triangle_last_surveyed[1] = never();
// Initialized for debug purposes only.
map_object_descr[0] = map_object_descr[1] = map_object_descr[2] = nullptr;
@@ -468,7 +468,7 @@
void drop_soldier(PlayerImmovable &, Soldier &);
void change_training_options(TrainingSite &, int32_t atr, int32_t val);
- uint32_t findAttackSoldiers
+ uint32_t find_attack_soldiers
(Flag &,
std::vector<Soldier *> * soldiers = nullptr,
uint32_t max = std::numeric_limits<uint32_t>::max());
@@ -504,16 +504,16 @@
std::vector<uint32_t> const * get_ware_stock_statistics
(WareIndex const) const;
- void ReadStatistics(FileRead &, uint32_t version);
- void WriteStatistics(FileWrite &) const;
+ void read_statistics(FileRead &, uint32_t version);
+ void write_statistics(FileWrite &) const;
void sample_statistics();
void ware_produced(WareIndex);
void ware_consumed(WareIndex, uint8_t);
void next_ware_production_period();
- void setAI(const std::string &);
- const std::string & getAI() const;
+ void set_ai(const std::string &);
+ const std::string & get_ai() const;
// used in shared kingdom mode
void add_further_starting_position(uint8_t plr, uint8_t init) {
=== modified file 'src/logic/playercommand.cc'
--- src/logic/playercommand.cc 2014-09-10 13:03:40 +0000
+++ src/logic/playercommand.cc 2014-09-29 13:33:11 +0000
@@ -99,7 +99,7 @@
PlayerCommand * PlayerCommand::deserialize (StreamRead & des)
{
- switch (des.Unsigned8()) {
+ switch (des.unsigned_8()) {
case PLCMD_BULLDOZE: return new CmdBulldoze (des);
case PLCMD_BUILD: return new CmdBuild (des);
case PLCMD_BUILDFLAG: return new CmdBuildFlag (des);
@@ -139,29 +139,29 @@
* Write this player command to a file. Call this from base classes
*/
#define PLAYER_COMMAND_VERSION 2
-void PlayerCommand::Write
+void PlayerCommand::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_COMMAND_VERSION);
+ fw.unsigned_16(PLAYER_COMMAND_VERSION);
- GameLogicCommand::Write(fw, egbase, mos);
+ GameLogicCommand::write(fw, egbase, mos);
// Now sender
- fw.Unsigned8 (sender ());
- fw.Unsigned32 (cmdserial());
+ fw.unsigned_8 (sender ());
+ fw.unsigned_32 (cmdserial());
}
-void PlayerCommand::Read
+void PlayerCommand::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (2 <= packet_version && packet_version <= PLAYER_COMMAND_VERSION) {
- GameLogicCommand::Read(fr, egbase, mol);
- m_sender = fr.Unsigned8 ();
+ GameLogicCommand::read(fr, egbase, mol);
+ m_sender = fr.unsigned_8 ();
if (!egbase.get_player(m_sender))
throw GameDataError("player %u does not exist", m_sender);
- m_cmdserial = fr.Unsigned32();
+ m_cmdserial = fr.unsigned_32();
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -173,9 +173,9 @@
/*** class Cmd_Bulldoze ***/
CmdBulldoze::CmdBulldoze (StreamRead & des) :
- PlayerCommand (0, des.Unsigned8()),
- serial (des.Unsigned32()),
- recurse (des.Unsigned8())
+ PlayerCommand (0, des.unsigned_8()),
+ serial (des.unsigned_32()),
+ recurse (des.unsigned_8())
{}
void CmdBulldoze::execute (Game & game)
@@ -186,24 +186,24 @@
void CmdBulldoze::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_BULLDOZE);
- ser.Unsigned8 (sender());
- ser.Unsigned32(serial);
- ser.Unsigned8 (recurse);
+ ser.unsigned_8 (PLCMD_BULLDOZE);
+ ser.unsigned_8 (sender());
+ ser.unsigned_32(serial);
+ ser.unsigned_8 (recurse);
}
#define PLAYER_CMD_BULLDOZE_VERSION 2
-void CmdBulldoze::Read
+void CmdBulldoze::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if
(1 <= packet_version &&
packet_version <= PLAYER_CMD_BULLDOZE_VERSION)
{
- PlayerCommand::Read(fr, egbase, mol);
- serial = get_object_serial_or_zero<PlayerImmovable>(fr.Unsigned32(), mol);
- recurse = 2 <= packet_version ? fr.Unsigned8() : false;
+ PlayerCommand::read(fr, egbase, mol);
+ serial = get_object_serial_or_zero<PlayerImmovable>(fr.unsigned_32(), mol);
+ recurse = 2 <= packet_version ? fr.unsigned_8() : false;
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -211,25 +211,25 @@
throw GameDataError("bulldoze: %s", e.what());
}
}
-void CmdBulldoze::Write
+void CmdBulldoze::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_BULLDOZE_VERSION);
+ fw.unsigned_16(PLAYER_CMD_BULLDOZE_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
+ PlayerCommand::write(fw, egbase, mos);
// Now serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
- fw.Unsigned8(recurse);
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
+ fw.unsigned_8(recurse);
}
/*** class Cmd_Build ***/
CmdBuild::CmdBuild (StreamRead & des) :
-PlayerCommand (0, des.Unsigned8())
+PlayerCommand (0, des.unsigned_8())
{
- bi = des.Signed16();
- coords = ReadCoords32(&des);
+ bi = des.signed_16();
+ coords = read_coords_32(&des);
}
void CmdBuild::execute (Game & game)
@@ -240,21 +240,21 @@
}
void CmdBuild::serialize (StreamWrite & ser) {
- ser.Unsigned8 (PLCMD_BUILD);
- ser.Unsigned8 (sender());
- ser.Signed16 (bi);
- WriteCoords32 (&ser, coords);
+ ser.unsigned_8 (PLCMD_BUILD);
+ ser.unsigned_8 (sender());
+ ser.signed_16 (bi);
+ write_coords_32 (&ser, coords);
}
#define PLAYER_CMD_BUILD_VERSION 1
-void CmdBuild::Read
+void CmdBuild::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_BUILD_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- bi = fr.Unsigned16();
- coords = ReadCoords32(&fr, egbase.map().extent());
+ PlayerCommand::read(fr, egbase, mol);
+ bi = fr.unsigned_16();
+ coords = read_coords_32(&fr, egbase.map().extent());
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -263,24 +263,24 @@
}
}
-void CmdBuild::Write
+void CmdBuild::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_BUILD_VERSION);
+ fw.unsigned_16(PLAYER_CMD_BUILD_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
- fw.Unsigned16(bi);
- WriteCoords32 (&fw, coords);
+ PlayerCommand::write(fw, egbase, mos);
+ fw.unsigned_16(bi);
+ write_coords_32 (&fw, coords);
}
/*** class Cmd_BuildFlag ***/
CmdBuildFlag::CmdBuildFlag (StreamRead & des) :
-PlayerCommand (0, des.Unsigned8())
+PlayerCommand (0, des.unsigned_8())
{
- coords = ReadCoords32(&des);
+ coords = read_coords_32(&des);
}
void CmdBuildFlag::execute (Game & game)
@@ -290,19 +290,19 @@
void CmdBuildFlag::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_BUILDFLAG);
- ser.Unsigned8 (sender());
- WriteCoords32 (&ser, coords);
+ ser.unsigned_8 (PLCMD_BUILDFLAG);
+ ser.unsigned_8 (sender());
+ write_coords_32 (&ser, coords);
}
#define PLAYER_CMD_BUILDFLAG_VERSION 1
-void CmdBuildFlag::Read
+void CmdBuildFlag::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_BUILDFLAG_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- coords = ReadCoords32(&fr, egbase.map().extent());
+ PlayerCommand::read(fr, egbase, mol);
+ coords = read_coords_32(&fr, egbase.map().extent());
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -310,14 +310,14 @@
throw GameDataError("build flag: %s", e.what());
}
}
-void CmdBuildFlag::Write
+void CmdBuildFlag::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_BUILDFLAG_VERSION);
+ fw.unsigned_16(PLAYER_CMD_BUILDFLAG_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
- WriteCoords32 (&fw, coords);
+ PlayerCommand::write(fw, egbase, mos);
+ write_coords_32 (&fw, coords);
}
/*** class Cmd_BuildRoad ***/
@@ -331,17 +331,17 @@
{}
CmdBuildRoad::CmdBuildRoad (StreamRead & des) :
-PlayerCommand (0, des.Unsigned8())
+PlayerCommand (0, des.unsigned_8())
{
- start = ReadCoords32(&des);
- nsteps = des.Unsigned16();
+ start = read_coords_32(&des);
+ nsteps = des.unsigned_16();
// we cannot completely deserialize the path here because we don't have a Map
path = nullptr;
steps = new char[nsteps];
for (Path::StepVector::size_type i = 0; i < nsteps; ++i)
- steps[i] = des.Unsigned8();
+ steps[i] = des.unsigned_8();
}
CmdBuildRoad::~CmdBuildRoad ()
@@ -366,30 +366,30 @@
void CmdBuildRoad::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_BUILDROAD);
- ser.Unsigned8 (sender());
- WriteCoords32 (&ser, start);
- ser.Unsigned16(nsteps);
+ ser.unsigned_8 (PLCMD_BUILDROAD);
+ ser.unsigned_8 (sender());
+ write_coords_32 (&ser, start);
+ ser.unsigned_16(nsteps);
assert (path || steps);
for (Path::StepVector::size_type i = 0; i < nsteps; ++i)
- ser.Unsigned8(path ? (*path)[i] : steps[i]);
+ ser.unsigned_8(path ? (*path)[i] : steps[i]);
}
#define PLAYER_CMD_BUILDROAD_VERSION 1
-void CmdBuildRoad::Read
+void CmdBuildRoad::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_BUILDROAD_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- start = ReadCoords32(&fr, egbase.map().extent());
- nsteps = fr.Unsigned16();
+ PlayerCommand::read(fr, egbase, mol);
+ start = read_coords_32(&fr, egbase.map().extent());
+ nsteps = fr.unsigned_16();
path = nullptr;
steps = new char[nsteps];
for (Path::StepVector::size_type i = 0; i < nsteps; ++i)
- steps[i] = fr.Unsigned8();
+ steps[i] = fr.unsigned_8();
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -397,26 +397,26 @@
throw GameDataError("build road: %s", e.what());
}
}
-void CmdBuildRoad::Write
+void CmdBuildRoad::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_BUILDROAD_VERSION);
+ fw.unsigned_16(PLAYER_CMD_BUILDROAD_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
- WriteCoords32 (&fw, start);
- fw.Unsigned16(nsteps);
+ PlayerCommand::write(fw, egbase, mos);
+ write_coords_32 (&fw, start);
+ fw.unsigned_16(nsteps);
for (Path::StepVector::size_type i = 0; i < nsteps; ++i)
- fw.Unsigned8(path ? (*path)[i] : steps[i]);
+ fw.unsigned_8(path ? (*path)[i] : steps[i]);
}
/*** Cmd_FlagAction ***/
CmdFlagAction::CmdFlagAction (StreamRead & des) :
-PlayerCommand (0, des.Unsigned8())
+PlayerCommand (0, des.unsigned_8())
{
- des .Unsigned8 ();
- serial = des.Unsigned32();
+ des .unsigned_8 ();
+ serial = des.unsigned_32();
}
void CmdFlagAction::execute (Game & game)
@@ -429,22 +429,22 @@
void CmdFlagAction::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_FLAGACTION);
- ser.Unsigned8 (sender());
- ser.Unsigned8 (0);
- ser.Unsigned32(serial);
+ ser.unsigned_8 (PLCMD_FLAGACTION);
+ ser.unsigned_8 (sender());
+ ser.unsigned_8 (0);
+ ser.unsigned_32(serial);
}
#define PLAYER_CMD_FLAGACTION_VERSION 1
-void CmdFlagAction::Read
+void CmdFlagAction::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_FLAGACTION_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- fr .Unsigned8 ();
- serial = get_object_serial_or_zero<Flag>(fr.Unsigned32(), mol);
+ PlayerCommand::read(fr, egbase, mol);
+ fr .unsigned_8 ();
+ serial = get_object_serial_or_zero<Flag>(fr.unsigned_32(), mol);
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -452,26 +452,26 @@
throw GameDataError("flag action: %s", e.what());
}
}
-void CmdFlagAction::Write
+void CmdFlagAction::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_FLAGACTION_VERSION);
+ fw.unsigned_16(PLAYER_CMD_FLAGACTION_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
+ PlayerCommand::write(fw, egbase, mos);
// Now action
- fw.Unsigned8 (0);
+ fw.unsigned_8 (0);
// Now serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
}
/*** Cmd_StartStopBuilding ***/
CmdStartStopBuilding::CmdStartStopBuilding (StreamRead & des) :
-PlayerCommand (0, des.Unsigned8())
+PlayerCommand (0, des.unsigned_8())
{
- serial = des.Unsigned32();
+ serial = des.unsigned_32();
}
void CmdStartStopBuilding::execute (Game & game)
@@ -482,19 +482,19 @@
void CmdStartStopBuilding::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_STARTSTOPBUILDING);
- ser.Unsigned8 (sender());
- ser.Unsigned32(serial);
+ ser.unsigned_8 (PLCMD_STARTSTOPBUILDING);
+ ser.unsigned_8 (sender());
+ ser.unsigned_32(serial);
}
#define PLAYER_CMD_STOPBUILDING_VERSION 1
-void CmdStartStopBuilding::Read
+void CmdStartStopBuilding::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_STOPBUILDING_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- serial = get_object_serial_or_zero<Building>(fr.Unsigned32(), mol);
+ PlayerCommand::read(fr, egbase, mol);
+ serial = get_object_serial_or_zero<Building>(fr.unsigned_32(), mol);
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -502,32 +502,32 @@
throw GameDataError("start/stop building: %s", e.what());
}
}
-void CmdStartStopBuilding::Write
+void CmdStartStopBuilding::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_STOPBUILDING_VERSION);
+ fw.unsigned_16(PLAYER_CMD_STOPBUILDING_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
+ PlayerCommand::write(fw, egbase, mos);
// Now serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
}
CmdMilitarySiteSetSoldierPreference::CmdMilitarySiteSetSoldierPreference (StreamRead & des) :
-PlayerCommand (0, des.Unsigned8())
+PlayerCommand (0, des.unsigned_8())
{
- serial = des.Unsigned32();
- preference = des.Unsigned8();
+ serial = des.unsigned_32();
+ preference = des.unsigned_8();
}
void CmdMilitarySiteSetSoldierPreference::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_MILITARYSITESETSOLDIERPREFERENCE);
- ser.Unsigned8 (sender());
- ser.Unsigned32(serial);
- ser.Unsigned8 (preference);
+ ser.unsigned_8 (PLCMD_MILITARYSITESETSOLDIERPREFERENCE);
+ ser.unsigned_8 (sender());
+ ser.unsigned_32(serial);
+ ser.unsigned_8 (preference);
}
void CmdMilitarySiteSetSoldierPreference::execute (Game & game)
@@ -538,30 +538,30 @@
}
#define PLAYER_CMD_SOLDIERPREFERENCE_VERSION 1
-void CmdMilitarySiteSetSoldierPreference::Write
+void CmdMilitarySiteSetSoldierPreference::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_SOLDIERPREFERENCE_VERSION);
+ fw.unsigned_16(PLAYER_CMD_SOLDIERPREFERENCE_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
+ PlayerCommand::write(fw, egbase, mos);
- fw.Unsigned8(preference);
+ fw.unsigned_8(preference);
// Now serial.
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
}
-void CmdMilitarySiteSetSoldierPreference::Read
+void CmdMilitarySiteSetSoldierPreference::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try
{
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_SOLDIERPREFERENCE_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- preference = fr.Unsigned8();
- serial = get_object_serial_or_zero<MilitarySite>(fr.Unsigned32(), mol);
+ PlayerCommand::read(fr, egbase, mol);
+ preference = fr.unsigned_8();
+ serial = get_object_serial_or_zero<MilitarySite>(fr.unsigned_32(), mol);
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -574,9 +574,9 @@
/*** Cmd_StartOrCancelExpedition ***/
CmdStartOrCancelExpedition::CmdStartOrCancelExpedition (StreamRead & des) :
-PlayerCommand (0, des.Unsigned8())
+PlayerCommand (0, des.unsigned_8())
{
- serial = des.Unsigned32();
+ serial = des.unsigned_32();
}
void CmdStartOrCancelExpedition::execute (Game & game)
@@ -587,19 +587,19 @@
void CmdStartOrCancelExpedition::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_SHIP_EXPEDITION);
- ser.Unsigned8 (sender());
- ser.Unsigned32(serial);
+ ser.unsigned_8 (PLCMD_SHIP_EXPEDITION);
+ ser.unsigned_8 (sender());
+ ser.unsigned_32(serial);
}
#define PLAYER_CMD_EXPEDITION_VERSION 1
-void CmdStartOrCancelExpedition::Read
+void CmdStartOrCancelExpedition::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_EXPEDITION_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- serial = get_object_serial_or_zero<Warehouse>(fr.Unsigned32(), mol);
+ PlayerCommand::read(fr, egbase, mol);
+ serial = get_object_serial_or_zero<Warehouse>(fr.unsigned_32(), mol);
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -607,26 +607,26 @@
throw GameDataError("start/stop building: %s", e.what());
}
}
-void CmdStartOrCancelExpedition::Write
+void CmdStartOrCancelExpedition::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_EXPEDITION_VERSION);
+ fw.unsigned_16(PLAYER_CMD_EXPEDITION_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
+ PlayerCommand::write(fw, egbase, mos);
// Now serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
}
/*** Cmd_EnhanceBuilding ***/
CmdEnhanceBuilding::CmdEnhanceBuilding (StreamRead & des) :
-PlayerCommand (0, des.Unsigned8())
+PlayerCommand (0, des.unsigned_8())
{
- serial = des.Unsigned32();
- bi = des.Unsigned16();
+ serial = des.unsigned_32();
+ bi = des.unsigned_16();
}
void CmdEnhanceBuilding::execute (Game & game)
@@ -637,21 +637,21 @@
void CmdEnhanceBuilding::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_ENHANCEBUILDING);
- ser.Unsigned8 (sender());
- ser.Unsigned32(serial);
- ser.Unsigned16(bi);
+ ser.unsigned_8 (PLCMD_ENHANCEBUILDING);
+ ser.unsigned_8 (sender());
+ ser.unsigned_32(serial);
+ ser.unsigned_16(bi);
}
#define PLAYER_CMD_ENHANCEBUILDING_VERSION 1
-void CmdEnhanceBuilding::Read
+void CmdEnhanceBuilding::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_ENHANCEBUILDING_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- serial = get_object_serial_or_zero<Building>(fr.Unsigned32(), mol);
- bi = fr.Unsigned16();
+ PlayerCommand::read(fr, egbase, mol);
+ serial = get_object_serial_or_zero<Building>(fr.unsigned_32(), mol);
+ bi = fr.unsigned_16();
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -659,27 +659,27 @@
throw GameDataError("enhance building: %s", e.what());
}
}
-void CmdEnhanceBuilding::Write
+void CmdEnhanceBuilding::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_ENHANCEBUILDING_VERSION);
+ fw.unsigned_16(PLAYER_CMD_ENHANCEBUILDING_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
+ PlayerCommand::write(fw, egbase, mos);
// Now serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
// Now id
- fw.Unsigned16(bi);
+ fw.unsigned_16(bi);
}
/*** Cmd_DismantleBuilding ***/
CmdDismantleBuilding::CmdDismantleBuilding (StreamRead & des) :
- PlayerCommand (0, des.Unsigned8())
+ PlayerCommand (0, des.unsigned_8())
{
- serial = des.Unsigned32();
+ serial = des.unsigned_32();
}
void CmdDismantleBuilding::execute (Game & game)
@@ -690,19 +690,19 @@
void CmdDismantleBuilding::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_DISMANTLEBUILDING);
- ser.Unsigned8 (sender());
- ser.Unsigned32(serial);
+ ser.unsigned_8 (PLCMD_DISMANTLEBUILDING);
+ ser.unsigned_8 (sender());
+ ser.unsigned_32(serial);
}
#define PLAYER_CMD_DISMANTLEBUILDING_VERSION 1
-void CmdDismantleBuilding::Read
+void CmdDismantleBuilding::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_DISMANTLEBUILDING_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- serial = get_object_serial_or_zero<Building>(fr.Unsigned32(), mol);
+ PlayerCommand::read(fr, egbase, mol);
+ serial = get_object_serial_or_zero<Building>(fr.unsigned_32(), mol);
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -710,23 +710,23 @@
throw GameDataError("dismantle building: %s", e.what());
}
}
-void CmdDismantleBuilding::Write
+void CmdDismantleBuilding::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_DISMANTLEBUILDING_VERSION);
+ fw.unsigned_16(PLAYER_CMD_DISMANTLEBUILDING_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
+ PlayerCommand::write(fw, egbase, mos);
// Now serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
}
/*** Cmd_EvictWorker ***/
CmdEvictWorker::CmdEvictWorker (StreamRead& des) :
- PlayerCommand (0, des.Unsigned8())
+ PlayerCommand (0, des.unsigned_8())
{
- serial = des.Unsigned32();
+ serial = des.unsigned_32();
}
void CmdEvictWorker::execute (Game & game)
@@ -739,19 +739,19 @@
void CmdEvictWorker::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_EVICTWORKER);
- ser.Unsigned8 (sender());
- ser.Unsigned32(serial);
+ ser.unsigned_8 (PLCMD_EVICTWORKER);
+ ser.unsigned_8 (sender());
+ ser.unsigned_32(serial);
}
#define PLAYER_CMD_EVICTWORKER_VERSION 1
-void CmdEvictWorker::Read
+void CmdEvictWorker::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_EVICTWORKER_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- serial = get_object_serial_or_zero<Worker>(fr.Unsigned32(), mol);
+ PlayerCommand::read(fr, egbase, mol);
+ serial = get_object_serial_or_zero<Worker>(fr.unsigned_32(), mol);
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -759,25 +759,25 @@
throw GameDataError("evict worker: %s", e.what());
}
}
-void CmdEvictWorker::Write
+void CmdEvictWorker::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_EVICTWORKER_VERSION);
+ fw.unsigned_16(PLAYER_CMD_EVICTWORKER_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
+ PlayerCommand::write(fw, egbase, mos);
// Now serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
}
/*** Cmd_ShipScoutDirection ***/
CmdShipScoutDirection::CmdShipScoutDirection (StreamRead& des) :
- PlayerCommand (0, des.Unsigned8())
+ PlayerCommand (0, des.unsigned_8())
{
- serial = des.Unsigned32();
- dir = des.Unsigned8();
+ serial = des.unsigned_32();
+ dir = des.unsigned_8();
}
void CmdShipScoutDirection::execute (Game & game)
@@ -790,51 +790,51 @@
void CmdShipScoutDirection::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_SHIP_SCOUT);
- ser.Unsigned8 (sender());
- ser.Unsigned32(serial);
- ser.Unsigned8 (dir);
+ ser.unsigned_8 (PLCMD_SHIP_SCOUT);
+ ser.unsigned_8 (sender());
+ ser.unsigned_32(serial);
+ ser.unsigned_8 (dir);
}
#define PLAYER_CMD_SHIP_SCOUT_DIRECTION_VERSION 1
-void CmdShipScoutDirection::Read
+void CmdShipScoutDirection::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_SHIP_SCOUT_DIRECTION_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- serial = get_object_serial_or_zero<Ship>(fr.Unsigned32(), mol);
+ PlayerCommand::read(fr, egbase, mol);
+ serial = get_object_serial_or_zero<Ship>(fr.unsigned_32(), mol);
// direction
- dir = fr.Unsigned8();
+ dir = fr.unsigned_8();
} else
throw GameDataError("unknown/unhandled version %u", packet_version);
} catch (const WException & e) {
throw GameDataError("Ship scout: %s", e.what());
}
}
-void CmdShipScoutDirection::Write
+void CmdShipScoutDirection::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_SHIP_SCOUT_DIRECTION_VERSION);
+ fw.unsigned_16(PLAYER_CMD_SHIP_SCOUT_DIRECTION_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
+ PlayerCommand::write(fw, egbase, mos);
// Now serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
// direction
- fw.Unsigned8(dir);
+ fw.unsigned_8(dir);
}
/*** Cmd_ShipConstructPort ***/
CmdShipConstructPort::CmdShipConstructPort (StreamRead& des) :
- PlayerCommand (0, des.Unsigned8())
+ PlayerCommand (0, des.unsigned_8())
{
- serial = des.Unsigned32();
- coords = ReadCoords32(&des);
+ serial = des.unsigned_32();
+ coords = read_coords_32(&des);
}
void CmdShipConstructPort::execute (Game & game)
@@ -847,51 +847,51 @@
void CmdShipConstructPort::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_SHIP_CONSTRUCT);
- ser.Unsigned8 (sender());
- ser.Unsigned32(serial);
- WriteCoords32 (&ser, coords);
+ ser.unsigned_8 (PLCMD_SHIP_CONSTRUCT);
+ ser.unsigned_8 (sender());
+ ser.unsigned_32(serial);
+ write_coords_32 (&ser, coords);
}
#define PLAYER_CMD_SHIP_CONSTRUCT_PORT_VERSION 1
-void CmdShipConstructPort::Read
+void CmdShipConstructPort::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_SHIP_CONSTRUCT_PORT_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- serial = get_object_serial_or_zero<Ship>(fr.Unsigned32(), mol);
+ PlayerCommand::read(fr, egbase, mol);
+ serial = get_object_serial_or_zero<Ship>(fr.unsigned_32(), mol);
// Coords
- coords = ReadCoords32(&fr);
+ coords = read_coords_32(&fr);
} else
throw GameDataError("unknown/unhandled version %u", packet_version);
} catch (const WException & e) {
throw GameDataError("Ship construct port: %s", e.what());
}
}
-void CmdShipConstructPort::Write
+void CmdShipConstructPort::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_SHIP_CONSTRUCT_PORT_VERSION);
+ fw.unsigned_16(PLAYER_CMD_SHIP_CONSTRUCT_PORT_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
+ PlayerCommand::write(fw, egbase, mos);
// Now serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
// Coords
- WriteCoords32(&fw, coords);
+ write_coords_32(&fw, coords);
}
/*** Cmd_ShipExploreIsland ***/
CmdShipExploreIsland::CmdShipExploreIsland (StreamRead& des) :
- PlayerCommand (0, des.Unsigned8())
+ PlayerCommand (0, des.unsigned_8())
{
- serial = des.Unsigned32();
- clockwise = des.Unsigned8() == 1;
+ serial = des.unsigned_32();
+ clockwise = des.unsigned_8() == 1;
}
void CmdShipExploreIsland::execute (Game & game)
@@ -904,49 +904,49 @@
void CmdShipExploreIsland::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_SHIP_EXPLORE);
- ser.Unsigned8 (sender());
- ser.Unsigned32(serial);
- ser.Unsigned8 (clockwise ? 1 : 0);
+ ser.unsigned_8 (PLCMD_SHIP_EXPLORE);
+ ser.unsigned_8 (sender());
+ ser.unsigned_32(serial);
+ ser.unsigned_8 (clockwise ? 1 : 0);
}
#define PLAYER_CMD_SHIP_EXPLORE_ISLAND_VERSION 1
-void CmdShipExploreIsland::Read
+void CmdShipExploreIsland::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_SHIP_EXPLORE_ISLAND_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- serial = get_object_serial_or_zero<Ship>(fr.Unsigned32(), mol);
- clockwise = fr.Unsigned8() == 1;
+ PlayerCommand::read(fr, egbase, mol);
+ serial = get_object_serial_or_zero<Ship>(fr.unsigned_32(), mol);
+ clockwise = fr.unsigned_8() == 1;
} else
throw GameDataError("unknown/unhandled version %u", packet_version);
} catch (const WException & e) {
throw GameDataError("Ship explore: %s", e.what());
}
}
-void CmdShipExploreIsland::Write
+void CmdShipExploreIsland::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_SHIP_EXPLORE_ISLAND_VERSION);
+ fw.unsigned_16(PLAYER_CMD_SHIP_EXPLORE_ISLAND_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
+ PlayerCommand::write(fw, egbase, mos);
// Now serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
// Direction of exploration
- fw.Unsigned8 (clockwise ? 1 : 0);
+ fw.unsigned_8 (clockwise ? 1 : 0);
}
/*** Cmd_ShipSink ***/
CmdShipSink::CmdShipSink (StreamRead& des) :
- PlayerCommand (0, des.Unsigned8())
+ PlayerCommand (0, des.unsigned_8())
{
- serial = des.Unsigned32();
+ serial = des.unsigned_32();
}
void CmdShipSink::execute (Game & game)
@@ -959,44 +959,44 @@
void CmdShipSink::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_SHIP_SINK);
- ser.Unsigned8 (sender());
- ser.Unsigned32(serial);
+ ser.unsigned_8 (PLCMD_SHIP_SINK);
+ ser.unsigned_8 (sender());
+ ser.unsigned_32(serial);
}
#define PLAYER_CMD_SHIP_SINK_VERSION 1
-void CmdShipSink::Read
+void CmdShipSink::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_SHIP_SINK_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- serial = get_object_serial_or_zero<Ship>(fr.Unsigned32(), mol);
+ PlayerCommand::read(fr, egbase, mol);
+ serial = get_object_serial_or_zero<Ship>(fr.unsigned_32(), mol);
} else
throw GameDataError("unknown/unhandled version %u", packet_version);
} catch (const WException & e) {
throw GameDataError("Ship explore: %s", e.what());
}
}
-void CmdShipSink::Write
+void CmdShipSink::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_SHIP_SINK_VERSION);
+ fw.unsigned_16(PLAYER_CMD_SHIP_SINK_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
+ PlayerCommand::write(fw, egbase, mos);
// Now serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
}
/*** Cmd_ShipCancelExpedition ***/
CmdShipCancelExpedition::CmdShipCancelExpedition (StreamRead& des) :
- PlayerCommand (0, des.Unsigned8())
+ PlayerCommand (0, des.unsigned_8())
{
- serial = des.Unsigned32();
+ serial = des.unsigned_32();
}
void CmdShipCancelExpedition::execute (Game & game)
@@ -1009,36 +1009,36 @@
void CmdShipCancelExpedition::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_SHIP_CANCELEXPEDITION);
- ser.Unsigned8 (sender());
- ser.Unsigned32(serial);
+ ser.unsigned_8 (PLCMD_SHIP_CANCELEXPEDITION);
+ ser.unsigned_8 (sender());
+ ser.unsigned_32(serial);
}
#define PLAYER_CMD_SHIP_CANCELEXPEDITION_VERSION 1
-void CmdShipCancelExpedition::Read
+void CmdShipCancelExpedition::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_SHIP_CANCELEXPEDITION_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- serial = get_object_serial_or_zero<Ship>(fr.Unsigned32(), mol);
+ PlayerCommand::read(fr, egbase, mol);
+ serial = get_object_serial_or_zero<Ship>(fr.unsigned_32(), mol);
} else
throw GameDataError("unknown/unhandled version %u", packet_version);
} catch (const WException & e) {
throw GameDataError("Ship explore: %s", e.what());
}
}
-void CmdShipCancelExpedition::Write
+void CmdShipCancelExpedition::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_SHIP_CANCELEXPEDITION_VERSION);
+ fw.unsigned_16(PLAYER_CMD_SHIP_CANCELEXPEDITION_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
+ PlayerCommand::write(fw, egbase, mos);
// Now serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
}
@@ -1069,30 +1069,30 @@
#define PLAYER_CMD_SETWAREPRIORITY_VERSION 1
-void CmdSetWarePriority::Write
+void CmdSetWarePriority::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
- fw.Unsigned16(PLAYER_CMD_SETWAREPRIORITY_VERSION);
-
- PlayerCommand::Write(fw, egbase, mos);
-
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(m_serial)));
- fw.Unsigned8(m_type);
- fw.Signed32(m_index);
- fw.Signed32(m_priority);
+ fw.unsigned_16(PLAYER_CMD_SETWAREPRIORITY_VERSION);
+
+ PlayerCommand::write(fw, egbase, mos);
+
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(m_serial)));
+ fw.unsigned_8(m_type);
+ fw.signed_32(m_index);
+ fw.signed_32(m_priority);
}
-void CmdSetWarePriority::Read
+void CmdSetWarePriority::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_SETWAREPRIORITY_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- m_serial = get_object_serial_or_zero<Building>(fr.Unsigned32(), mol);
- m_type = fr.Unsigned8();
- m_index = fr.Signed32();
- m_priority = fr.Signed32();
+ PlayerCommand::read(fr, egbase, mol);
+ m_serial = get_object_serial_or_zero<Building>(fr.unsigned_32(), mol);
+ m_type = fr.unsigned_8();
+ m_index = fr.signed_32();
+ m_priority = fr.signed_32();
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -1102,21 +1102,21 @@
}
CmdSetWarePriority::CmdSetWarePriority(StreamRead & des) :
- PlayerCommand(0, des.Unsigned8()),
- m_serial (des.Unsigned32()),
- m_type (des.Unsigned8()),
- m_index (des.Signed32()),
- m_priority (des.Signed32())
+ PlayerCommand(0, des.unsigned_8()),
+ m_serial (des.unsigned_32()),
+ m_type (des.unsigned_8()),
+ m_index (des.signed_32()),
+ m_priority (des.signed_32())
{}
void CmdSetWarePriority::serialize(StreamWrite & ser)
{
- ser.Unsigned8(PLCMD_SETWAREPRIORITY);
- ser.Unsigned8(sender());
- ser.Unsigned32(m_serial);
- ser.Unsigned8(m_type);
- ser.Signed32(m_index);
- ser.Signed32(m_priority);
+ ser.unsigned_8(PLCMD_SETWAREPRIORITY);
+ ser.unsigned_8(sender());
+ ser.unsigned_32(m_serial);
+ ser.unsigned_8(m_type);
+ ser.signed_32(m_index);
+ ser.signed_32(m_priority);
}
/*** class Cmd_SetWareMaxFill ***/
@@ -1145,28 +1145,28 @@
#define PLAYER_CMD_SETWAREMAXFILL_SIZE_VERSION 1
-void CmdSetWareMaxFill::Write
+void CmdSetWareMaxFill::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
- fw.Unsigned16(PLAYER_CMD_SETWAREMAXFILL_SIZE_VERSION);
-
- PlayerCommand::Write(fw, egbase, mos);
-
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(m_serial)));
- fw.Signed32(m_index);
- fw.Unsigned32(m_max_fill);
+ fw.unsigned_16(PLAYER_CMD_SETWAREMAXFILL_SIZE_VERSION);
+
+ PlayerCommand::write(fw, egbase, mos);
+
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(m_serial)));
+ fw.signed_32(m_index);
+ fw.unsigned_32(m_max_fill);
}
-void CmdSetWareMaxFill::Read
+void CmdSetWareMaxFill::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_SETWAREMAXFILL_SIZE_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- m_serial = get_object_serial_or_zero<Building>(fr.Unsigned32(), mol);
- m_index = fr.Signed32();
- m_max_fill = fr.Unsigned32();
+ PlayerCommand::read(fr, egbase, mol);
+ m_serial = get_object_serial_or_zero<Building>(fr.unsigned_32(), mol);
+ m_index = fr.signed_32();
+ m_max_fill = fr.unsigned_32();
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -1176,19 +1176,19 @@
}
CmdSetWareMaxFill::CmdSetWareMaxFill(StreamRead & des) :
- PlayerCommand(0, des.Unsigned8()),
- m_serial (des.Unsigned32()),
- m_index (des.Signed32()),
- m_max_fill(des.Unsigned32())
+ PlayerCommand(0, des.unsigned_8()),
+ m_serial (des.unsigned_32()),
+ m_index (des.signed_32()),
+ m_max_fill(des.unsigned_32())
{}
void CmdSetWareMaxFill::serialize(StreamWrite & ser)
{
- ser.Unsigned8(PLCMD_SETWAREMAXFILL);
- ser.Unsigned8(sender());
- ser.Unsigned32(m_serial);
- ser.Signed32(m_index);
- ser.Unsigned32(m_max_fill);
+ ser.unsigned_8(PLCMD_SETWAREMAXFILL);
+ ser.unsigned_8(sender());
+ ser.unsigned_32(m_serial);
+ ser.signed_32(m_index);
+ ser.unsigned_32(m_max_fill);
}
@@ -1200,23 +1200,23 @@
m_economy (_economy), m_ware_type(_ware_type)
{}
-void CmdChangeTargetQuantity::Write
+void CmdChangeTargetQuantity::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
- PlayerCommand::Write(fw, egbase, mos);
- fw.Unsigned32(economy());
- fw.CString
+ PlayerCommand::write(fw, egbase, mos);
+ fw.unsigned_32(economy());
+ fw.c_string
(egbase.player(sender()).tribe().get_ware_descr(ware_type())->name());
}
-void CmdChangeTargetQuantity::Read
+void CmdChangeTargetQuantity::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- PlayerCommand::Read(fr, egbase, mol);
- m_economy = fr.Unsigned32();
+ PlayerCommand::read(fr, egbase, mol);
+ m_economy = fr.unsigned_32();
m_ware_type =
- egbase.player(sender()).tribe().ware_index(fr.CString());
+ egbase.player(sender()).tribe().ware_index(fr.c_string());
} catch (const WException & e) {
throw GameDataError("change target quantity: %s", e.what());
}
@@ -1224,16 +1224,16 @@
CmdChangeTargetQuantity::CmdChangeTargetQuantity(StreamRead & des)
:
- PlayerCommand(0, des.Unsigned8()),
- m_economy (des.Unsigned32()),
- m_ware_type (des.Unsigned8())
+ PlayerCommand(0, des.unsigned_8()),
+ m_economy (des.unsigned_32()),
+ m_ware_type (des.unsigned_8())
{}
void CmdChangeTargetQuantity::serialize(StreamWrite & ser)
{
- ser.Unsigned8 (sender());
- ser.Unsigned32(economy());
- ser.Unsigned8 (ware_type());
+ ser.unsigned_8 (sender());
+ ser.unsigned_32(economy());
+ ser.unsigned_8 (ware_type());
}
@@ -1259,24 +1259,24 @@
#define PLAYER_CMD_SETWARETARGETQUANTITY_VERSION 2
-void CmdSetWareTargetQuantity::Write
+void CmdSetWareTargetQuantity::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
- fw.Unsigned16(PLAYER_CMD_SETWARETARGETQUANTITY_VERSION);
- CmdChangeTargetQuantity::Write(fw, egbase, mos);
- fw.Unsigned32(m_permanent);
+ fw.unsigned_16(PLAYER_CMD_SETWARETARGETQUANTITY_VERSION);
+ CmdChangeTargetQuantity::write(fw, egbase, mos);
+ fw.unsigned_32(m_permanent);
}
-void CmdSetWareTargetQuantity::Read
+void CmdSetWareTargetQuantity::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version <= PLAYER_CMD_SETWARETARGETQUANTITY_VERSION) {
- CmdChangeTargetQuantity::Read(fr, egbase, mol);
- m_permanent = fr.Unsigned32();
+ CmdChangeTargetQuantity::read(fr, egbase, mol);
+ m_permanent = fr.unsigned_32();
if (packet_version == 1)
- fr.Unsigned32();
+ fr.unsigned_32();
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -1288,16 +1288,16 @@
CmdSetWareTargetQuantity::CmdSetWareTargetQuantity(StreamRead & des)
:
CmdChangeTargetQuantity(des),
- m_permanent (des.Unsigned32())
+ m_permanent (des.unsigned_32())
{
- if (cmdserial() == 1) des.Unsigned32();
+ if (cmdserial() == 1) des.unsigned_32();
}
void CmdSetWareTargetQuantity::serialize(StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_SETWARETARGETQUANTITY);
+ ser.unsigned_8 (PLCMD_SETWARETARGETQUANTITY);
CmdChangeTargetQuantity::serialize(ser);
- ser.Unsigned32(m_permanent);
+ ser.unsigned_32(m_permanent);
}
@@ -1326,20 +1326,20 @@
#define PLAYER_CMD_RESETWARETARGETQUANTITY_VERSION 1
-void CmdResetWareTargetQuantity::Write
+void CmdResetWareTargetQuantity::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
- fw.Unsigned16(PLAYER_CMD_RESETWARETARGETQUANTITY_VERSION);
- CmdChangeTargetQuantity::Write(fw, egbase, mos);
+ fw.unsigned_16(PLAYER_CMD_RESETWARETARGETQUANTITY_VERSION);
+ CmdChangeTargetQuantity::write(fw, egbase, mos);
}
-void CmdResetWareTargetQuantity::Read
+void CmdResetWareTargetQuantity::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_RESETWARETARGETQUANTITY_VERSION)
- CmdChangeTargetQuantity::Read(fr, egbase, mol);
+ CmdChangeTargetQuantity::read(fr, egbase, mol);
else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -1354,7 +1354,7 @@
void CmdResetWareTargetQuantity::serialize(StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_RESETWARETARGETQUANTITY);
+ ser.unsigned_8 (PLCMD_RESETWARETARGETQUANTITY);
CmdChangeTargetQuantity::serialize(ser);
}
@@ -1381,24 +1381,24 @@
#define PLAYER_CMD_SETWORKERTARGETQUANTITY_VERSION 2
-void CmdSetWorkerTargetQuantity::Write
+void CmdSetWorkerTargetQuantity::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
- fw.Unsigned16(PLAYER_CMD_SETWORKERTARGETQUANTITY_VERSION);
- CmdChangeTargetQuantity::Write(fw, egbase, mos);
- fw.Unsigned32(m_permanent);
+ fw.unsigned_16(PLAYER_CMD_SETWORKERTARGETQUANTITY_VERSION);
+ CmdChangeTargetQuantity::write(fw, egbase, mos);
+ fw.unsigned_32(m_permanent);
}
-void CmdSetWorkerTargetQuantity::Read
+void CmdSetWorkerTargetQuantity::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version <= PLAYER_CMD_SETWORKERTARGETQUANTITY_VERSION) {
- CmdChangeTargetQuantity::Read(fr, egbase, mol);
- m_permanent = fr.Unsigned32();
+ CmdChangeTargetQuantity::read(fr, egbase, mol);
+ m_permanent = fr.unsigned_32();
if (packet_version == 1)
- fr.Unsigned32();
+ fr.unsigned_32();
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -1410,16 +1410,16 @@
CmdSetWorkerTargetQuantity::CmdSetWorkerTargetQuantity(StreamRead & des)
:
CmdChangeTargetQuantity(des),
- m_permanent (des.Unsigned32())
+ m_permanent (des.unsigned_32())
{
- if (cmdserial() == 1) des.Unsigned32();
+ if (cmdserial() == 1) des.unsigned_32();
}
void CmdSetWorkerTargetQuantity::serialize(StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_SETWORKERTARGETQUANTITY);
+ ser.unsigned_8 (PLCMD_SETWORKERTARGETQUANTITY);
CmdChangeTargetQuantity::serialize(ser);
- ser.Unsigned32(m_permanent);
+ ser.unsigned_32(m_permanent);
}
@@ -1448,20 +1448,20 @@
#define PLAYER_CMD_RESETWORKERTARGETQUANTITY_VERSION 1
-void CmdResetWorkerTargetQuantity::Write
+void CmdResetWorkerTargetQuantity::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
- fw.Unsigned16(PLAYER_CMD_RESETWORKERTARGETQUANTITY_VERSION);
- CmdChangeTargetQuantity::Write(fw, egbase, mos);
+ fw.unsigned_16(PLAYER_CMD_RESETWORKERTARGETQUANTITY_VERSION);
+ CmdChangeTargetQuantity::write(fw, egbase, mos);
}
-void CmdResetWorkerTargetQuantity::Read
+void CmdResetWorkerTargetQuantity::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_RESETWORKERTARGETQUANTITY_VERSION) {
- CmdChangeTargetQuantity::Read(fr, egbase, mol);
+ CmdChangeTargetQuantity::read(fr, egbase, mol);
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -1476,7 +1476,7 @@
void CmdResetWorkerTargetQuantity::serialize(StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_RESETWORKERTARGETQUANTITY);
+ ser.unsigned_8 (PLCMD_RESETWORKERTARGETQUANTITY);
CmdChangeTargetQuantity::serialize(ser);
}
@@ -1484,11 +1484,11 @@
/*** class Cmd_ChangeTrainingOptions ***/
CmdChangeTrainingOptions::CmdChangeTrainingOptions(StreamRead & des)
:
-PlayerCommand (0, des.Unsigned8())
+PlayerCommand (0, des.unsigned_8())
{
- serial = des.Unsigned32(); // Serial of the building
- attribute = des.Unsigned16(); // Attribute to modify
- value = des.Unsigned16(); // New vale
+ serial = des.unsigned_32(); // Serial of the building
+ attribute = des.unsigned_16(); // Attribute to modify
+ value = des.unsigned_16(); // New vale
}
void CmdChangeTrainingOptions::execute (Game & game)
@@ -1499,25 +1499,25 @@
}
void CmdChangeTrainingOptions::serialize (StreamWrite & ser) {
- ser.Unsigned8 (PLCMD_CHANGETRAININGOPTIONS);
- ser.Unsigned8 (sender());
- ser.Unsigned32(serial);
- ser.Unsigned16(attribute);
- ser.Unsigned16(value);
+ ser.unsigned_8 (PLCMD_CHANGETRAININGOPTIONS);
+ ser.unsigned_8 (sender());
+ ser.unsigned_32(serial);
+ ser.unsigned_16(attribute);
+ ser.unsigned_16(value);
}
#define PLAYER_CMD_CHANGETRAININGOPTIONS_VERSION 1
-void CmdChangeTrainingOptions::Read
+void CmdChangeTrainingOptions::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_CHANGETRAININGOPTIONS_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- serial = get_object_serial_or_zero<TrainingSite>(fr.Unsigned32(), mol);
- attribute = fr.Unsigned16();
- value = fr.Unsigned16();
+ PlayerCommand::read(fr, egbase, mol);
+ serial = get_object_serial_or_zero<TrainingSite>(fr.unsigned_32(), mol);
+ attribute = fr.unsigned_16();
+ value = fr.unsigned_16();
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -1526,28 +1526,28 @@
}
}
-void CmdChangeTrainingOptions::Write
+void CmdChangeTrainingOptions::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_CHANGETRAININGOPTIONS_VERSION);
+ fw.unsigned_16(PLAYER_CMD_CHANGETRAININGOPTIONS_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
+ PlayerCommand::write(fw, egbase, mos);
// Now serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
- fw.Unsigned16(attribute);
- fw.Unsigned16(value);
+ fw.unsigned_16(attribute);
+ fw.unsigned_16(value);
}
/*** class Cmd_DropSoldier ***/
CmdDropSoldier::CmdDropSoldier(StreamRead & des) :
-PlayerCommand (0, des.Unsigned8())
+PlayerCommand (0, des.unsigned_8())
{
- serial = des.Unsigned32(); // Serial of the building
- soldier = des.Unsigned32(); // Serial of soldier
+ serial = des.unsigned_32(); // Serial of the building
+ soldier = des.unsigned_32(); // Serial of soldier
}
void CmdDropSoldier::execute (Game & game)
@@ -1559,22 +1559,22 @@
void CmdDropSoldier::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_DROPSOLDIER);
- ser.Unsigned8 (sender());
- ser.Unsigned32(serial);
- ser.Unsigned32(soldier);
+ ser.unsigned_8 (PLCMD_DROPSOLDIER);
+ ser.unsigned_8 (sender());
+ ser.unsigned_32(serial);
+ ser.unsigned_32(soldier);
}
#define PLAYER_CMD_DROPSOLDIER_VERSION 1
-void CmdDropSoldier::Read
+void CmdDropSoldier::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_DROPSOLDIER_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- serial = get_object_serial_or_zero<PlayerImmovable>(fr.Unsigned32(), mol);
- soldier = get_object_serial_or_zero<Soldier>(fr.Unsigned32(), mol);
+ PlayerCommand::read(fr, egbase, mol);
+ serial = get_object_serial_or_zero<PlayerImmovable>(fr.unsigned_32(), mol);
+ soldier = get_object_serial_or_zero<Soldier>(fr.unsigned_32(), mol);
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -1583,29 +1583,29 @@
}
}
-void CmdDropSoldier::Write
+void CmdDropSoldier::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_DROPSOLDIER_VERSION);
+ fw.unsigned_16(PLAYER_CMD_DROPSOLDIER_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
+ PlayerCommand::write(fw, egbase, mos);
// site serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
// soldier serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(soldier)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(soldier)));
}
/*** Cmd_ChangeSoldierCapacity ***/
CmdChangeSoldierCapacity::CmdChangeSoldierCapacity(StreamRead & des)
:
-PlayerCommand (0, des.Unsigned8())
+PlayerCommand (0, des.unsigned_8())
{
- serial = des.Unsigned32();
- val = des.Signed16();
+ serial = des.unsigned_32();
+ val = des.signed_16();
}
void CmdChangeSoldierCapacity::execute (Game & game)
@@ -1618,22 +1618,22 @@
void CmdChangeSoldierCapacity::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_CHANGESOLDIERCAPACITY);
- ser.Unsigned8 (sender());
- ser.Unsigned32(serial);
- ser.Signed16(val);
+ ser.unsigned_8 (PLCMD_CHANGESOLDIERCAPACITY);
+ ser.unsigned_8 (sender());
+ ser.unsigned_32(serial);
+ ser.signed_16(val);
}
#define PLAYER_CMD_CHANGESOLDIERCAPACITY_VERSION 1
-void CmdChangeSoldierCapacity::Read
+void CmdChangeSoldierCapacity::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_CHANGESOLDIERCAPACITY_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- serial = get_object_serial_or_zero<Building>(fr.Unsigned32(), mol);
- val = fr.Signed16();
+ PlayerCommand::read(fr, egbase, mol);
+ serial = get_object_serial_or_zero<Building>(fr.unsigned_32(), mol);
+ val = fr.signed_16();
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -1642,31 +1642,31 @@
}
}
-void CmdChangeSoldierCapacity::Write
+void CmdChangeSoldierCapacity::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_CHANGESOLDIERCAPACITY_VERSION);
+ fw.unsigned_16(PLAYER_CMD_CHANGESOLDIERCAPACITY_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
+ PlayerCommand::write(fw, egbase, mos);
// Now serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
// Now capacity
- fw.Signed16(val);
+ fw.signed_16(val);
}
/*** Cmd_EnemyFlagAction ***/
CmdEnemyFlagAction::CmdEnemyFlagAction (StreamRead & des) :
-PlayerCommand (0, des.Unsigned8())
+PlayerCommand (0, des.unsigned_8())
{
- des.Unsigned8();
- serial = des.Unsigned32();
- des.Unsigned8();
- number = des.Unsigned8();
+ des.unsigned_8();
+ serial = des.unsigned_32();
+ des.unsigned_8();
+ number = des.unsigned_8();
}
void CmdEnemyFlagAction::execute (Game & game)
@@ -1698,26 +1698,26 @@
}
void CmdEnemyFlagAction::serialize (StreamWrite & ser) {
- ser.Unsigned8 (PLCMD_ENEMYFLAGACTION);
- ser.Unsigned8 (sender());
- ser.Unsigned8 (1);
- ser.Unsigned32(serial);
- ser.Unsigned8 (sender());
- ser.Unsigned8 (number);
+ ser.unsigned_8 (PLCMD_ENEMYFLAGACTION);
+ ser.unsigned_8 (sender());
+ ser.unsigned_8 (1);
+ ser.unsigned_32(serial);
+ ser.unsigned_8 (sender());
+ ser.unsigned_8 (number);
}
#define PLAYER_CMD_ENEMYFLAGACTION_VERSION 3
-void CmdEnemyFlagAction::Read
+void CmdEnemyFlagAction::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_CMD_ENEMYFLAGACTION_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- fr .Unsigned8 ();
- serial = get_object_serial_or_zero<Flag>(fr.Unsigned32(), mol);
- fr .Unsigned8 ();
- number = fr.Unsigned8 ();
+ PlayerCommand::read(fr, egbase, mol);
+ fr .unsigned_8 ();
+ serial = get_object_serial_or_zero<Flag>(fr.unsigned_32(), mol);
+ fr .unsigned_8 ();
+ number = fr.unsigned_8 ();
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -1726,39 +1726,39 @@
}
}
-void CmdEnemyFlagAction::Write
+void CmdEnemyFlagAction::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
// First, write version
- fw.Unsigned16(PLAYER_CMD_ENEMYFLAGACTION_VERSION);
+ fw.unsigned_16(PLAYER_CMD_ENEMYFLAGACTION_VERSION);
// Write base classes
- PlayerCommand::Write(fw, egbase, mos);
+ PlayerCommand::write(fw, egbase, mos);
// Now action
- fw.Unsigned8 (0);
+ fw.unsigned_8 (0);
// Now serial
- fw.Unsigned32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(egbase.objects().get_object(serial)));
// Now param
- fw.Unsigned8 (sender());
- fw.Unsigned8 (number);
+ fw.unsigned_8 (sender());
+ fw.unsigned_8 (number);
}
/*** struct PlayerMessageCommand ***/
PlayerMessageCommand::PlayerMessageCommand(StreamRead & des) :
-PlayerCommand (0, des.Unsigned8()), m_message_id(des.Unsigned32())
+PlayerCommand (0, des.unsigned_8()), m_message_id(des.unsigned_32())
{}
#define PLAYER_MESSAGE_CMD_VERSION 1
-void PlayerMessageCommand::Read
+void PlayerMessageCommand::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- const uint16_t packet_version = fr.Unsigned16();
+ const uint16_t packet_version = fr.unsigned_16();
if (packet_version == PLAYER_MESSAGE_CMD_VERSION) {
- PlayerCommand::Read(fr, egbase, mol);
- m_message_id = MessageId(fr.Unsigned32());
+ PlayerCommand::read(fr, egbase, mol);
+ m_message_id = MessageId(fr.unsigned_32());
if (!m_message_id)
throw GameDataError
("(player %u): message id is null", sender());
@@ -1770,12 +1770,12 @@
}
}
-void PlayerMessageCommand::Write
+void PlayerMessageCommand::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
- fw.Unsigned16(PLAYER_MESSAGE_CMD_VERSION);
- PlayerCommand::Write(fw, egbase, mos);
- fw.Unsigned32(mos.message_savers[sender() - 1][message_id()].value());
+ fw.unsigned_16(PLAYER_MESSAGE_CMD_VERSION);
+ PlayerCommand::write(fw, egbase, mos);
+ fw.unsigned_32(mos.message_savers[sender() - 1][message_id()].value());
}
@@ -1789,9 +1789,9 @@
void CmdMessageSetStatusRead::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_MESSAGESETSTATUSREAD);
- ser.Unsigned8 (sender());
- ser.Unsigned32(message_id().value());
+ ser.unsigned_8 (PLCMD_MESSAGESETSTATUSREAD);
+ ser.unsigned_8 (sender());
+ ser.unsigned_32(message_id().value());
}
@@ -1805,9 +1805,9 @@
void CmdMessageSetStatusArchived::serialize (StreamWrite & ser)
{
- ser.Unsigned8 (PLCMD_MESSAGESETSTATUSARCHIVED);
- ser.Unsigned8 (sender());
- ser.Unsigned32(message_id().value());
+ ser.unsigned_8 (PLCMD_MESSAGESETSTATUSARCHIVED);
+ ser.unsigned_8 (sender());
+ ser.unsigned_32(message_id().value());
}
/*** struct Cmd_SetStockPolicy ***/
@@ -1882,51 +1882,51 @@
}
CmdSetStockPolicy::CmdSetStockPolicy(StreamRead & des)
- : PlayerCommand(0, des.Unsigned8())
+ : PlayerCommand(0, des.unsigned_8())
{
- m_warehouse = des.Unsigned32();
- m_isworker = des.Unsigned8();
- m_ware = WareIndex(des.Unsigned8());
- m_policy = static_cast<Warehouse::StockPolicy>(des.Unsigned8());
+ m_warehouse = des.unsigned_32();
+ m_isworker = des.unsigned_8();
+ m_ware = WareIndex(des.unsigned_8());
+ m_policy = static_cast<Warehouse::StockPolicy>(des.unsigned_8());
}
void CmdSetStockPolicy::serialize(StreamWrite & ser)
{
- ser.Unsigned8(PLCMD_SETSTOCKPOLICY);
- ser.Unsigned8(sender());
- ser.Unsigned32(m_warehouse);
- ser.Unsigned8(m_isworker);
- ser.Unsigned8(m_ware);
- ser.Unsigned8(m_policy);
+ ser.unsigned_8(PLCMD_SETSTOCKPOLICY);
+ ser.unsigned_8(sender());
+ ser.unsigned_32(m_warehouse);
+ ser.unsigned_8(m_isworker);
+ ser.unsigned_8(m_ware);
+ ser.unsigned_8(m_policy);
}
#define PLAYER_CMD_SETSTOCKPOLICY_VERSION 1
-void CmdSetStockPolicy::Read
+void CmdSetStockPolicy::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- uint8_t version = fr.Unsigned8();
+ uint8_t version = fr.unsigned_8();
if (version != PLAYER_CMD_SETSTOCKPOLICY_VERSION)
throw GameDataError("unknown/unhandled version %u", version);
- PlayerCommand::Read(fr, egbase, mol);
- m_warehouse = fr.Unsigned32();
- m_isworker = fr.Unsigned8();
- m_ware = WareIndex(fr.Unsigned8());
- m_policy = static_cast<Warehouse::StockPolicy>(fr.Unsigned8());
+ PlayerCommand::read(fr, egbase, mol);
+ m_warehouse = fr.unsigned_32();
+ m_isworker = fr.unsigned_8();
+ m_ware = WareIndex(fr.unsigned_8());
+ m_policy = static_cast<Warehouse::StockPolicy>(fr.unsigned_8());
} catch (const std::exception & e) {
throw GameDataError("Cmd_SetStockPolicy: %s", e.what());
}
}
-void CmdSetStockPolicy::Write
+void CmdSetStockPolicy::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
{
- fw.Unsigned8(PLAYER_CMD_SETSTOCKPOLICY_VERSION);
- PlayerCommand::Write(fw, egbase, mos);
- fw.Unsigned32(m_warehouse);
- fw.Unsigned8(m_isworker);
- fw.Unsigned8(m_ware);
- fw.Unsigned8(m_policy);
+ fw.unsigned_8(PLAYER_CMD_SETSTOCKPOLICY_VERSION);
+ PlayerCommand::write(fw, egbase, mos);
+ fw.unsigned_32(m_warehouse);
+ fw.unsigned_8(m_isworker);
+ fw.unsigned_8(m_ware);
+ fw.unsigned_8(m_policy);
}
}
=== modified file 'src/logic/playercommand.h'
--- src/logic/playercommand.h 2014-09-10 13:03:40 +0000
+++ src/logic/playercommand.h 2014-09-29 13:33:11 +0000
@@ -56,8 +56,8 @@
static Widelands::PlayerCommand * deserialize (StreamRead &);
// Call these from child classes
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
private:
PlayerNumber m_sender;
@@ -75,8 +75,8 @@
CmdBulldoze (StreamRead &);
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_BULLDOZE;}
@@ -100,8 +100,8 @@
CmdBuild (StreamRead &);
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_BUILD;}
@@ -121,8 +121,8 @@
CmdBuildFlag (StreamRead &);
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_FLAG;}
@@ -141,8 +141,8 @@
virtual ~CmdBuildRoad ();
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_BUILDROAD;}
@@ -162,8 +162,8 @@
PlayerCommand(t, p), serial(f.serial())
{}
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_FLAGACTION;}
@@ -183,8 +183,8 @@
: PlayerCommand(t, p), serial(b.serial())
{}
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_STOPBUILDING;}
@@ -203,8 +203,8 @@
: PlayerCommand(t, p), serial(b.serial()), preference(prefs)
{}
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_MILITARYSITESETSOLDIERPREFERENCE;}
@@ -223,8 +223,8 @@
: PlayerCommand(t, p), serial(b.serial())
{}
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_PORT_START_EXPEDITION;}
@@ -248,8 +248,8 @@
{}
// Write these commands to a file (for savegames)
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_ENHANCEBUILDING;}
@@ -272,8 +272,8 @@
{}
// Write these commands to a file (for savegames)
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_DISMANTLEBUILDING;}
@@ -295,8 +295,8 @@
{}
// Write these commands to a file (for savegames)
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_EVICTWORKER;}
@@ -316,8 +316,8 @@
: PlayerCommand(t, p), serial(s), dir(direction)
{}
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_SHIP_SCOUT;}
@@ -338,8 +338,8 @@
: PlayerCommand(t, p), serial(s), coords(c)
{}
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_SHIP_CONSTRUCT_PORT;}
@@ -360,8 +360,8 @@
: PlayerCommand(t, p), serial(s), clockwise(cw)
{}
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_SHIP_EXPLORE;}
@@ -382,8 +382,8 @@
: PlayerCommand(t, p), serial(s)
{}
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_SHIP_SINK;}
@@ -403,8 +403,8 @@
: PlayerCommand(t, p), serial(s)
{}
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_SHIP_CANCELEXPEDITION;}
@@ -432,8 +432,8 @@
int32_t type, WareIndex index, int32_t priority);
// Write these commands to a file (for savegames)
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_SETWAREPRIORITY;}
@@ -457,8 +457,8 @@
WareIndex, uint32_t maxfill);
// Write these commands to a file (for savegames)
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_SETWAREMAXFILL;}
@@ -480,8 +480,8 @@
uint32_t economy, WareIndex index);
// Write/Read these commands to/from a file (for savegames).
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
CmdChangeTargetQuantity(StreamRead &);
@@ -505,8 +505,8 @@
uint32_t permanent);
// Write/Read these commands to/from a file (for savegames).
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_SETWARETARGETQUANTITY;}
@@ -526,8 +526,8 @@
uint32_t economy, WareIndex index);
// Write/Read these commands to/from a file (for savegames).
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_RESETWARETARGETQUANTITY;}
@@ -545,8 +545,8 @@
uint32_t permanent);
// Write/Read these commands to/from a file (for savegames).
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_SETWORKERTARGETQUANTITY;}
@@ -566,8 +566,8 @@
uint32_t economy, WareIndex index);
// Write/Read these commands to/from a file (for savegames).
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_RESETWORKERTARGETQUANTITY;}
@@ -589,8 +589,8 @@
{}
// Write these commands to a file (for savegames)
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_CHANGETRAININGOPTIONS;}
@@ -616,8 +616,8 @@
{}
// Write these commands to a file (for savegames)
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_DROPSOLDIER;}
@@ -639,8 +639,8 @@
{}
// Write these commands to a file (for savegames)
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_CHANGESOLDIERCAPACITY;}
@@ -662,8 +662,8 @@
}
// Write these commands to a file (for savegames)
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
uint8_t id() const override {return QUEUE_CMD_ENEMYFLAGACTION;}
@@ -685,8 +685,8 @@
: PlayerCommand(t, p), m_message_id(i)
{}
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
PlayerMessageCommand(StreamRead &);
@@ -746,8 +746,8 @@
// Savegame functions
CmdSetStockPolicy();
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) override;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &) override;
private:
Serial m_warehouse;
=== modified file 'src/logic/playersmanager.cc'
--- src/logic/playersmanager.cc 2014-09-10 08:55:04 +0000
+++ src/logic/playersmanager.cc 2014-09-29 13:33:11 +0000
@@ -62,7 +62,7 @@
if (p) {
delete p;
p = nullptr;
- if (plnum <= UserSettings::highestPlayernum()) {
+ if (plnum <= UserSettings::highest_playernum()) {
m_number_of_players--;
}
}
@@ -81,7 +81,7 @@
Player * & p = m_players[player_number - 1];
if (p) {
delete p;
- if (player_number <= UserSettings::highestPlayernum()) {
+ if (player_number <= UserSettings::highest_playernum()) {
m_number_of_players--;
}
}
@@ -92,7 +92,7 @@
m_egbase.manually_load_tribe(tribe),
name);
p->set_team_number(team);
- if (player_number <= UserSettings::highestPlayernum()) {
+ if (player_number <= UserSettings::highest_playernum()) {
m_number_of_players++;
}
return p;
=== modified file 'src/logic/production_program.cc'
--- src/logic/production_program.cc 2014-09-29 07:22:27 +0000
+++ src/logic/production_program.cc 2014-09-29 13:33:11 +0000
@@ -1385,7 +1385,7 @@
(Game & game, ProductionSite & ps) const
{
SoldierControl & ctrl = dynamic_cast<SoldierControl &>(ps);
- const std::vector<Soldier *> soldiers = ctrl.presentSoldiers();
+ const std::vector<Soldier *> soldiers = ctrl.present_soldiers();
if (soldiers.empty()) {
ps.set_production_result(_("No soldier to train!"));
return ps.program_end(game, Skipped);
@@ -1415,7 +1415,7 @@
ps.molog(" okay\n"); // okay, do nothing
upcast(TrainingSite, ts, &ps);
- ts->trainingAttempted(attribute, level);
+ ts->training_attempted(attribute, level);
ps.molog(" Check done!\n");
@@ -1469,7 +1469,7 @@
(Game & game, ProductionSite & ps) const
{
SoldierControl & ctrl = dynamic_cast<SoldierControl &>(ps);
- const std::vector<Soldier *> soldiers = ctrl.presentSoldiers();
+ const std::vector<Soldier *> soldiers = ctrl.present_soldiers();
const std::vector<Soldier *>::const_iterator soldiers_end =
soldiers.end();
std::vector<Soldier *>::const_iterator it = soldiers.begin();
@@ -1516,7 +1516,7 @@
ps.molog(" Training done!\n");
upcast(TrainingSite, ts, &ps);
- ts->trainingSuccessful(attribute, level);
+ ts->training_successful(attribute, level);
return ps.program_step(game);
=== modified file 'src/logic/productionsite.h'
--- src/logic/productionsite.h 2014-09-14 11:31:58 +0000
+++ src/logic/productionsite.h 2014-09-29 13:33:11 +0000
@@ -216,7 +216,7 @@
ip(0),
phase(0),
flags(0),
- coord(Coords::Null()) {}
+ coord(Coords::null()) {}
};
Request & request_worker(WareIndex);
=== modified file 'src/logic/replay.cc'
--- src/logic/replay.cc 2014-09-10 16:57:31 +0000
+++ src/logic/replay.cc 2014-09-29 13:33:11 +0000
@@ -71,7 +71,7 @@
game.save_syncstream(true);
// There has to be a better way to do this.
- game.gameController()->setDesiredSpeed(0);
+ game.game_controller()->set_desired_speed(0);
}
}
@@ -92,10 +92,10 @@
gl.load_game();
}
- m_cmdlog = g_fs->OpenStreamRead(filename);
+ m_cmdlog = g_fs->open_stream_read(filename);
try {
- const uint32_t magic = m_cmdlog->Unsigned32();
+ const uint32_t magic = m_cmdlog->unsigned_32();
if (magic == 0x2E21A100)
// Note: This was never released as part of a build
throw wexception
@@ -106,14 +106,14 @@
throw wexception
("%s apparently not a valid replay file", filename.c_str());
- const uint8_t version = m_cmdlog->Unsigned8();
+ const uint8_t version = m_cmdlog->unsigned_8();
if (version < REPLAY_VERSION)
throw wexception
("Replay of version %u is known to have desync problems", version);
if (version != REPLAY_VERSION)
throw GameDataError("unknown/unhandled version %u", version);
- game.rng().ReadState(*m_cmdlog);
+ game.rng().read_state(*m_cmdlog);
}
catch (...) {
delete m_cmdlog;
@@ -138,7 +138,7 @@
* \return a \ref Command that should be enqueued in the command queue
* or 0 if there are no remaining commands before the given time.
*/
-Command * ReplayReader::GetNextCommand(const uint32_t time)
+Command * ReplayReader::get_next_command(const uint32_t time)
{
if (!m_cmdlog)
return nullptr;
@@ -147,14 +147,14 @@
return nullptr;
try {
- uint8_t pkt = m_cmdlog->Unsigned8();
+ uint8_t pkt = m_cmdlog->unsigned_8();
switch (pkt) {
case pkt_playercommand: {
- m_replaytime = m_cmdlog->Unsigned32();
+ m_replaytime = m_cmdlog->unsigned_32();
- uint32_t duetime = m_cmdlog->Unsigned32();
- uint32_t cmdserial = m_cmdlog->Unsigned32();
+ uint32_t duetime = m_cmdlog->unsigned_32();
+ uint32_t cmdserial = m_cmdlog->unsigned_32();
PlayerCommand & cmd = *PlayerCommand::deserialize(*m_cmdlog);
cmd.set_duetime (duetime);
cmd.set_cmdserial(cmdserial);
@@ -163,15 +163,15 @@
}
case pkt_syncreport: {
- uint32_t duetime = m_cmdlog->Unsigned32();
+ uint32_t duetime = m_cmdlog->unsigned_32();
Md5Checksum hash;
- m_cmdlog->Data(hash.data, sizeof(hash.data));
+ m_cmdlog->data(hash.data, sizeof(hash.data));
return new CmdReplaySyncRead(duetime, hash);
}
case pkt_end: {
- uint32_t endtime = m_cmdlog->Unsigned32();
+ uint32_t endtime = m_cmdlog->unsigned_32();
log("REPLAY: End of replay (gametime: %u)\n", endtime);
delete m_cmdlog;
m_cmdlog = nullptr;
@@ -194,7 +194,7 @@
/**
* \return \c true if the end of the replay was reached
*/
-bool ReplayReader::EndOfReplay()
+bool ReplayReader::end_of_replay()
{
return m_cmdlog == nullptr;
}
@@ -212,7 +212,7 @@
void execute(Game & game) override {
if (ReplayWriter * const rw = game.get_replaywriter()) {
- rw->SendSync (game.get_sync_hash());
+ rw->send_sync (game.get_sync_hash());
game.enqueue_command
(new CmdReplaySyncWrite(duetime() + SYNC_INTERVAL));
@@ -230,7 +230,7 @@
ReplayWriter::ReplayWriter(Game & game, const std::string & filename)
: m_game(game), m_filename(filename)
{
- g_fs->EnsureDirectoryExists(REPLAY_DIR);
+ g_fs->ensure_directory_exists(REPLAY_DIR);
SaveHandler & save_handler = m_game.save_handler();
@@ -250,11 +250,11 @@
game.enqueue_command
(new CmdReplaySyncWrite(game.get_gametime() + SYNC_INTERVAL));
- m_cmdlog = g_fs->OpenStreamWrite(filename);
- m_cmdlog->Unsigned32(REPLAY_MAGIC);
- m_cmdlog->Unsigned8(REPLAY_VERSION);
+ m_cmdlog = g_fs->open_stream_write(filename);
+ m_cmdlog->unsigned_32(REPLAY_MAGIC);
+ m_cmdlog->unsigned_8(REPLAY_VERSION);
- game.rng().WriteState(*m_cmdlog);
+ game.rng().write_state(*m_cmdlog);
}
@@ -263,8 +263,8 @@
*/
ReplayWriter::~ReplayWriter()
{
- m_cmdlog->Unsigned8(pkt_end);
- m_cmdlog->Unsigned32(m_game.get_gametime());
+ m_cmdlog->unsigned_8(pkt_end);
+ m_cmdlog->unsigned_32(m_game.get_gametime());
delete m_cmdlog;
}
@@ -273,30 +273,30 @@
/**
* Call this whenever a new player command has entered the command queue.
*/
-void ReplayWriter::SendPlayerCommand(PlayerCommand * cmd)
+void ReplayWriter::send_player_command(PlayerCommand * cmd)
{
- m_cmdlog->Unsigned8(pkt_playercommand);
+ m_cmdlog->unsigned_8(pkt_playercommand);
// The semantics of the timestamp is
// "There will be no more player commands that are due *before* the
// given time".
- m_cmdlog->Unsigned32(m_game.get_gametime());
- m_cmdlog->Unsigned32(cmd->duetime());
- m_cmdlog->Unsigned32(cmd->cmdserial());
+ m_cmdlog->unsigned_32(m_game.get_gametime());
+ m_cmdlog->unsigned_32(cmd->duetime());
+ m_cmdlog->unsigned_32(cmd->cmdserial());
cmd->serialize(*m_cmdlog);
- m_cmdlog->Flush();
+ m_cmdlog->flush();
}
/**
* Store a synchronization hash for the current game time in the replay.
*/
-void ReplayWriter::SendSync(const Md5Checksum & hash)
+void ReplayWriter::send_sync(const Md5Checksum & hash)
{
- m_cmdlog->Unsigned8(pkt_syncreport);
- m_cmdlog->Unsigned32(m_game.get_gametime());
- m_cmdlog->Data(hash.data, sizeof(hash.data));
- m_cmdlog->Flush();
+ m_cmdlog->unsigned_8(pkt_syncreport);
+ m_cmdlog->unsigned_32(m_game.get_gametime());
+ m_cmdlog->data(hash.data, sizeof(hash.data));
+ m_cmdlog->flush();
}
}
=== modified file 'src/logic/replay.h'
--- src/logic/replay.h 2014-09-10 16:57:31 +0000
+++ src/logic/replay.h 2014-09-29 13:33:11 +0000
@@ -54,8 +54,8 @@
ReplayReader(Game & game, const std::string & filename);
~ReplayReader();
- Command * GetNextCommand(uint32_t time);
- bool EndOfReplay();
+ Command * get_next_command(uint32_t time);
+ bool end_of_replay();
private:
StreamRead * m_cmdlog;
@@ -71,8 +71,8 @@
ReplayWriter(Game &, const std::string & filename);
~ReplayWriter();
- void SendPlayerCommand(PlayerCommand *);
- void SendSync(const Md5Checksum &);
+ void send_player_command(PlayerCommand *);
+ void send_sync(const Md5Checksum &);
private:
Game & m_game;
=== modified file 'src/logic/replay_game_controller.cc'
--- src/logic/replay_game_controller.cc 2014-09-10 16:57:31 +0000
+++ src/logic/replay_game_controller.cc 2014-09-29 13:33:11 +0000
@@ -51,17 +51,17 @@
else if (frametime > 1000)
frametime = 1000;
- frametime = frametime * realSpeed() / 1000;
+ frametime = frametime * real_speed() / 1000;
m_time = m_game.get_gametime() + frametime;
if (m_replayreader) {
while
(Widelands::Command * const cmd =
- m_replayreader->GetNextCommand(m_time))
+ m_replayreader->get_next_command(m_time))
m_game.enqueue_command(cmd);
- if (m_replayreader->EndOfReplay()) {
+ if (m_replayreader->end_of_replay()) {
m_replayreader.reset(nullptr);
m_game.enqueue_command
(new CmdReplayEnd(m_time = m_game.get_gametime()));
@@ -69,40 +69,40 @@
}
}
-void ReplayGameController::sendPlayerCommand(Widelands::PlayerCommand &) {
+void ReplayGameController::send_player_command(Widelands::PlayerCommand &) {
throw wexception("Trying to send a player command during replay");
}
-int32_t ReplayGameController::getFrametime() {
+int32_t ReplayGameController::get_frametime() {
return m_time - m_game.get_gametime();
}
-std::string ReplayGameController::getGameDescription() {
+std::string ReplayGameController::get_game_description() {
return "replay";
}
-uint32_t ReplayGameController::realSpeed() {
+uint32_t ReplayGameController::real_speed() {
return m_paused ? 0 : m_speed;
}
-uint32_t ReplayGameController::desiredSpeed() {
+uint32_t ReplayGameController::desired_speed() {
return m_speed;
}
-void ReplayGameController::setDesiredSpeed(uint32_t const speed) {
+void ReplayGameController::set_desired_speed(uint32_t const speed) {
m_speed = speed;
}
-bool ReplayGameController::isPaused() {
+bool ReplayGameController::is_paused() {
return m_paused;
}
-void ReplayGameController::setPaused(bool const paused) {
+void ReplayGameController::set_paused(bool const paused) {
m_paused = paused;
}
void ReplayGameController::CmdReplayEnd::execute (Widelands::Game & game) {
- game.gameController()->setDesiredSpeed(0);
+ game.game_controller()->set_desired_speed(0);
UI::WLMessageBox mmb
(game.get_ibase(),
_("End of replay"),
=== modified file 'src/logic/replay_game_controller.h'
--- src/logic/replay_game_controller.h 2014-09-10 16:57:31 +0000
+++ src/logic/replay_game_controller.h 2014-09-29 13:33:11 +0000
@@ -35,14 +35,14 @@
void think() override;
- void sendPlayerCommand(Widelands::PlayerCommand &) override;
- int32_t getFrametime() override;
- std::string getGameDescription() override;
- uint32_t realSpeed() override;
- uint32_t desiredSpeed() override;
- void setDesiredSpeed(uint32_t const speed) override;
- bool isPaused() override;
- void setPaused(bool const paused) override;
+ void send_player_command(Widelands::PlayerCommand &) override;
+ int32_t get_frametime() override;
+ std::string get_game_description() override;
+ uint32_t real_speed() override;
+ uint32_t desired_speed() override;
+ void set_desired_speed(uint32_t const speed) override;
+ bool is_paused() override;
+ void set_paused(bool const paused) override;
private:
struct CmdReplayEnd : public Widelands::Command {
=== modified file 'src/logic/requirements.cc'
--- src/logic/requirements.cc 2014-09-10 10:18:46 +0000
+++ src/logic/requirements.cc 2014-09-29 13:33:11 +0000
@@ -38,11 +38,11 @@
/**
* Read this requirement from a file
*/
-void Requirements::Read
+void Requirements::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == REQUIREMENTS_VERSION) {
*this = RequirementsStorage::read(fr, egbase, mol);
} else
@@ -53,16 +53,16 @@
}
}
-void Requirements::Write
+void Requirements::write
(FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos)
const
{
- fw.Unsigned16(REQUIREMENTS_VERSION);
+ fw.unsigned_16(REQUIREMENTS_VERSION);
if (!m) {
- fw.Unsigned16(0);
+ fw.unsigned_16(0);
} else {
- fw.Unsigned16(m->storage().id());
+ fw.unsigned_16(m->storage().id());
m->write(fw, egbase, mos);
}
}
@@ -88,7 +88,7 @@
Requirements RequirementsStorage::read
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
- uint32_t const id = fr.Unsigned16();
+ uint32_t const id = fr.unsigned_16();
if (id == 0)
return Requirements();
@@ -130,29 +130,29 @@
const
{
assert(m.size() == static_cast<uint16_t>(m.size()));
- fw.Unsigned16(m.size());
+ fw.unsigned_16(m.size());
for (const Requirements& req : m) {
- req.Write(fw, egbase, mos);
+ req.write(fw, egbase, mos);
}
}
-static Requirements readOr
+static Requirements read_or
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
- uint32_t const count = fr.Unsigned16();
+ uint32_t const count = fr.unsigned_16();
RequireOr req;
for (uint32_t i = 0; i < count; ++i) {
Requirements sub;
- sub.Read(fr, egbase, mol);
+ sub.read(fr, egbase, mol);
req.add(sub);
}
return req;
}
-const RequirementsStorage RequireOr::storage(requirementIdOr, readOr);
+const RequirementsStorage RequireOr::storage(requirementIdOr, read_or);
void RequireAnd::add(const Requirements & req)
@@ -175,29 +175,29 @@
const
{
assert(m.size() == static_cast<uint16_t>(m.size()));
- fw.Unsigned16(m.size());
+ fw.unsigned_16(m.size());
for (const Requirements& req : m) {
- req.Write(fw, egbase, mos);
+ req.write(fw, egbase, mos);
}
}
-static Requirements readAnd
+static Requirements read_and
(FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol)
{
- uint32_t const count = fr.Unsigned16();
+ uint32_t const count = fr.unsigned_16();
RequireAnd req;
for (uint32_t i = 0; i < count; ++i) {
Requirements sub;
- sub.Read(fr, egbase, mol);
+ sub.read(fr, egbase, mol);
req.add(sub);
}
return req;
}
-const RequirementsStorage RequireAnd::storage(requirementIdAnd, readAnd);
+const RequirementsStorage RequireAnd::storage(requirementIdAnd, read_and);
bool RequireAttribute::check(const MapObject & obj) const
@@ -222,15 +222,15 @@
void RequireAttribute::write
(FileWrite & fw, EditorGameBase &, MapObjectSaver &) const
{
- fw.Unsigned32(at);
- fw.Signed32(min);
- fw.Signed32(max);
+ fw.unsigned_32(at);
+ fw.signed_32(min);
+ fw.signed_32(max);
}
-static Requirements readAttribute
+static Requirements read_attribute
(FileRead & fr, EditorGameBase &, MapObjectLoader &)
{
- TrainingAttribute const at = static_cast<TrainingAttribute>(fr.Unsigned32());
+ TrainingAttribute const at = static_cast<TrainingAttribute>(fr.unsigned_32());
if
(at != atrHP && at != atrAttack && at != atrDefense && at != atrEvade
&&
@@ -240,12 +240,12 @@
"expected atrHP (%u), atrAttack (%u), atrDefense (%u), atrEvade "
"(%u) or atrTotal (%u) but found unknown attribute value (%u)",
atrHP, atrAttack, atrDefense, atrEvade, atrTotal, at);
- int32_t const min = fr.Signed32();
- int32_t const max = fr.Signed32();
+ int32_t const min = fr.signed_32();
+ int32_t const max = fr.signed_32();
return RequireAttribute(at, min, max);
}
const RequirementsStorage RequireAttribute::
- storage(requirementIdAttribute, readAttribute);
+ storage(requirementIdAttribute, read_attribute);
}
=== modified file 'src/logic/requirements.h'
--- src/logic/requirements.h 2014-09-14 12:13:35 +0000
+++ src/logic/requirements.h 2014-09-29 13:33:11 +0000
@@ -89,8 +89,8 @@
bool check(const MapObject &) const;
// For Save/Load Games
- void Read (FileRead &, EditorGameBase &, MapObjectLoader &);
- void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) const;
+ void read (FileRead &, EditorGameBase &, MapObjectLoader &);
+ void write(FileWrite &, EditorGameBase &, MapObjectSaver &) const;
private:
boost::shared_ptr<BaseCapsule> m;
@@ -183,8 +183,8 @@
static const RequirementsStorage storage;
- int32_t getMin() const {return min; }
- int32_t getMax() const {return max; }
+ int32_t get_min() const {return min; }
+ int32_t get_max() const {return max; }
private:
TrainingAttribute at;
=== modified file 'src/logic/save_handler.cc'
--- src/logic/save_handler.cc 2014-09-10 07:57:29 +0000
+++ src/logic/save_handler.cc 2014-09-29 13:33:11 +0000
@@ -81,13 +81,13 @@
std::string backup_filename;
// always overwrite a file
- if (g_fs->FileExists(complete_filename)) {
+ if (g_fs->file_exists(complete_filename)) {
filename += "2";
backup_filename = create_file_name (get_base_dir(), filename);
- if (g_fs->FileExists(backup_filename)) {
- g_fs->Unlink(backup_filename);
+ if (g_fs->file_exists(backup_filename)) {
+ g_fs->fs_unlink(backup_filename);
}
- g_fs->Rename(complete_filename, backup_filename);
+ g_fs->fs_rename(complete_filename, backup_filename);
}
std::string error;
@@ -97,18 +97,18 @@
// if backup file was created, move it back
if (backup_filename.length() > 0) {
- if (g_fs->FileExists(complete_filename)) {
- g_fs->Unlink(complete_filename);
+ if (g_fs->file_exists(complete_filename)) {
+ g_fs->fs_unlink(complete_filename);
}
- g_fs->Rename(backup_filename, complete_filename);
+ g_fs->fs_rename(backup_filename, complete_filename);
}
// Wait 30 seconds until next save try
m_last_saved_time = m_last_saved_time + 30000;
return;
} else {
// if backup file was created, time to remove it
- if (backup_filename.length() > 0 && g_fs->FileExists(backup_filename))
- g_fs->Unlink(backup_filename);
+ if (backup_filename.length() > 0 && g_fs->file_exists(backup_filename))
+ g_fs->fs_unlink(backup_filename);
}
log("Autosave: save took %d ms\n", m_last_saved_time - realtime);
@@ -167,14 +167,14 @@
bool const binary =
!g_options.pull_section("global").get_bool("nozip", false);
// Make sure that the base directory exists
- g_fs->EnsureDirectoryExists(get_base_dir());
+ g_fs->ensure_directory_exists(get_base_dir());
// Make a filesystem out of this
std::unique_ptr<FileSystem> fs;
if (!binary) {
- fs.reset(g_fs->CreateSubFileSystem(complete_filename, FileSystem::DIR));
+ fs.reset(g_fs->create_sub_file_system(complete_filename, FileSystem::DIR));
} else {
- fs.reset(g_fs->CreateSubFileSystem(complete_filename, FileSystem::ZIP));
+ fs.reset(g_fs->create_sub_file_system(complete_filename, FileSystem::ZIP));
}
bool result = true;
=== modified file 'src/logic/ship.cc'
--- src/logic/ship.cc 2014-09-18 18:56:20 +0000
+++ src/logic/ship.cc 2014-09-29 13:33:11 +0000
@@ -285,7 +285,7 @@
if (m_fleet->get_path(*lastdock, *dst, path)) {
uint32_t closest_idx = std::numeric_limits<uint32_t>::max();
uint32_t closest_dist = std::numeric_limits<uint32_t>::max();
- Coords closest_target(Coords::Null());
+ Coords closest_target(Coords::null());
Coords cur(path.get_start());
for (uint32_t idx = 0; idx <= path.get_nsteps(); ++idx) {
@@ -374,7 +374,7 @@
FCoords coord = fc;
bool invalid = false;
for (uint8_t step = 0; !invalid && step < 5; ++step) {
- if (coord.field->get_owned_by() != Neutral() && coord.field->get_owned_by() != pn) {
+ if (coord.field->get_owned_by() != neutral() && coord.field->get_owned_by() != pn) {
invalid = true;
continue;
}
@@ -949,7 +949,7 @@
if (version >= 2) {
// The state the ship is in
if (version >= 3) {
- m_ship_state = fr.Unsigned8();
+ m_ship_state = fr.unsigned_8();
// Expedition specific data
if
@@ -964,28 +964,28 @@
m_expedition.reset(new Expedition());
// Currently seen port build spaces
m_expedition->seen_port_buildspaces.reset(new std::list<Coords>());
- uint8_t numofports = fr.Unsigned8();
+ uint8_t numofports = fr.unsigned_8();
for (uint8_t i = 0; i < numofports; ++i)
- m_expedition->seen_port_buildspaces->push_back(ReadCoords32(&fr));
+ m_expedition->seen_port_buildspaces->push_back(read_coords_32(&fr));
// Swimability of the directions
for (uint8_t i = 0; i < LAST_DIRECTION; ++i)
- m_expedition->swimable[i] = (fr.Unsigned8() == 1);
+ m_expedition->swimable[i] = (fr.unsigned_8() == 1);
// whether scouting or exploring
- m_expedition->island_exploration = fr.Unsigned8() == 1;
+ m_expedition->island_exploration = fr.unsigned_8() == 1;
// current direction
- m_expedition->direction = fr.Unsigned8();
+ m_expedition->direction = fr.unsigned_8();
// Start coordinates of an island exploration
- m_expedition->exploration_start = ReadCoords32(&fr);
+ m_expedition->exploration_start = read_coords_32(&fr);
// Whether the exploration is done clockwise or counter clockwise
- m_expedition->clockwise = fr.Unsigned8() == 1;
+ m_expedition->clockwise = fr.unsigned_8() == 1;
}
} else
m_ship_state = TRANSPORT;
- m_lastdock = fr.Unsigned32();
- m_destination = fr.Unsigned32();
+ m_lastdock = fr.unsigned_32();
+ m_destination = fr.unsigned_32();
- m_items.resize(fr.Unsigned32());
+ m_items.resize(fr.unsigned_32());
for (ShippingItem::Loader& item_loader : m_items) {
item_loader.load(fr);
}
@@ -1043,10 +1043,10 @@
try {
// The header has been peeled away by the caller
- uint8_t const version = fr.Unsigned8();
+ uint8_t const version = fr.unsigned_8();
if (1 <= version && version <= SHIP_SAVEGAME_VERSION) {
- std::string owner = fr.CString();
- std::string name = fr.CString();
+ std::string owner = fr.c_string();
+ std::string name = fr.c_string();
const ShipDescr * descr = nullptr;
egbase.manually_load_tribe(owner);
@@ -1073,46 +1073,46 @@
void Ship::save
(EditorGameBase & egbase, MapObjectSaver & mos, FileWrite & fw)
{
- fw.Unsigned8(HeaderShip);
- fw.Unsigned8(SHIP_SAVEGAME_VERSION);
+ fw.unsigned_8(HeaderShip);
+ fw.unsigned_8(SHIP_SAVEGAME_VERSION);
- fw.CString(descr().get_owner_tribe()->name());
- fw.CString(descr().name());
+ fw.c_string(descr().get_owner_tribe()->name());
+ fw.c_string(descr().name());
Bob::save(egbase, mos, fw);
// state the ship is in
- fw.Unsigned8(m_ship_state);
+ fw.unsigned_8(m_ship_state);
// expedition specific data
if (state_is_expedition()) {
// currently seen port buildspaces
assert(m_expedition->seen_port_buildspaces);
- fw.Unsigned8(m_expedition->seen_port_buildspaces->size());
+ fw.unsigned_8(m_expedition->seen_port_buildspaces->size());
for
(std::list<Coords>::const_iterator it = m_expedition->seen_port_buildspaces->begin();
it != m_expedition->seen_port_buildspaces->end();
++it)
{
- WriteCoords32(&fw, *it);
+ write_coords_32(&fw, *it);
}
// swimability of the directions
for (uint8_t i = 0; i < LAST_DIRECTION; ++i)
- fw.Unsigned8(m_expedition->swimable[i] ? 1 : 0);
+ fw.unsigned_8(m_expedition->swimable[i] ? 1 : 0);
// whether scouting or exploring
- fw.Unsigned8(m_expedition->island_exploration ? 1 : 0);
+ fw.unsigned_8(m_expedition->island_exploration ? 1 : 0);
// current direction
- fw.Unsigned8(m_expedition->direction);
+ fw.unsigned_8(m_expedition->direction);
// Start coordinates of an island exploration
- WriteCoords32(&fw, m_expedition->exploration_start);
+ write_coords_32(&fw, m_expedition->exploration_start);
// Whether the exploration is done clockwise or counter clockwise
- fw.Unsigned8(m_expedition->clockwise ? 1 : 0);
+ fw.unsigned_8(m_expedition->clockwise ? 1 : 0);
}
- fw.Unsigned32(mos.get_object_file_index_or_zero(m_lastdock.get(egbase)));
- fw.Unsigned32(mos.get_object_file_index_or_zero(m_destination.get(egbase)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(m_lastdock.get(egbase)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(m_destination.get(egbase)));
- fw.Unsigned32(m_items.size());
+ fw.unsigned_32(m_items.size());
for (ShippingItem& shipping_item : m_items) {
shipping_item.save(egbase, mos, fw);
}
=== modified file 'src/logic/single_player_game_controller.cc'
--- src/logic/single_player_game_controller.cc 2014-09-10 13:03:40 +0000
+++ src/logic/single_player_game_controller.cc 2014-09-29 13:33:11 +0000
@@ -64,7 +64,7 @@
else if (frametime > 1000)
frametime = 1000;
- frametime = frametime * realSpeed() / 1000;
+ frametime = frametime * real_speed() / 1000;
m_time = m_game.get_gametime() + frametime;
@@ -77,31 +77,31 @@
m_computerplayers.resize(p);
if (!m_computerplayers[p - 1])
m_computerplayers[p - 1] =
- ComputerPlayer::getImplementation
- (plr->getAI())->instantiate(m_game, p);
+ ComputerPlayer::get_implementation
+ (plr->get_ai())->instantiate(m_game, p);
m_computerplayers[p - 1]->think();
}
}
}
-void SinglePlayerGameController::sendPlayerCommand
+void SinglePlayerGameController::send_player_command
(Widelands::PlayerCommand & pc)
{
pc.set_cmdserial(++m_player_cmdserial);
m_game.enqueue_command (&pc);
}
-int32_t SinglePlayerGameController::getFrametime()
+int32_t SinglePlayerGameController::get_frametime()
{
return m_time - m_game.get_gametime();
}
-std::string SinglePlayerGameController::getGameDescription()
+std::string SinglePlayerGameController::get_game_description()
{
return "singleplayer";
}
-uint32_t SinglePlayerGameController::realSpeed()
+uint32_t SinglePlayerGameController::real_speed()
{
if (m_paused)
return 0;
@@ -109,22 +109,22 @@
return m_speed;
}
-uint32_t SinglePlayerGameController::desiredSpeed()
+uint32_t SinglePlayerGameController::desired_speed()
{
return m_speed;
}
-void SinglePlayerGameController::setDesiredSpeed(uint32_t const speed)
+void SinglePlayerGameController::set_desired_speed(uint32_t const speed)
{
m_speed = speed;
}
-bool SinglePlayerGameController::isPaused()
+bool SinglePlayerGameController::is_paused()
{
return m_paused;
}
-void SinglePlayerGameController::setPaused(bool paused)
+void SinglePlayerGameController::set_paused(bool paused)
{
m_paused = paused;
}
=== modified file 'src/logic/single_player_game_controller.h'
--- src/logic/single_player_game_controller.h 2014-09-10 13:03:40 +0000
+++ src/logic/single_player_game_controller.h 2014-09-29 13:33:11 +0000
@@ -31,15 +31,15 @@
~SinglePlayerGameController();
void think() override;
- void sendPlayerCommand(Widelands::PlayerCommand &) override;
- int32_t getFrametime() override;
- std::string getGameDescription() override;
+ void send_player_command(Widelands::PlayerCommand &) override;
+ int32_t get_frametime() override;
+ std::string get_game_description() override;
- uint32_t realSpeed() override;
- uint32_t desiredSpeed() override;
- void setDesiredSpeed(uint32_t speed) override;
- bool isPaused() override;
- void setPaused(bool paused) override;
+ uint32_t real_speed() override;
+ uint32_t desired_speed() override;
+ void set_desired_speed(uint32_t speed) override;
+ bool is_paused() override;
+ void set_paused(bool paused) override;
void report_result(uint8_t player, Widelands::PlayerEndResult result, const std::string & info) override;
private:
=== modified file 'src/logic/single_player_game_settings_provider.cc'
--- src/logic/single_player_game_settings_provider.cc 2014-09-10 13:03:40 +0000
+++ src/logic/single_player_game_settings_provider.cc 2014-09-29 13:33:11 +0000
@@ -30,7 +30,7 @@
s.playernum = 0;
}
-void SinglePlayerGameSettingsProvider::setScenario(bool const set) {
+void SinglePlayerGameSettingsProvider::set_scenario(bool const set) {
s.scenario = set;
}
@@ -38,35 +38,35 @@
return s;
}
-bool SinglePlayerGameSettingsProvider::canChangeMap() {
+bool SinglePlayerGameSettingsProvider::can_change_map() {
return true;
}
-bool SinglePlayerGameSettingsProvider::canChangePlayerState(uint8_t number) {
+bool SinglePlayerGameSettingsProvider::can_change_player_state(uint8_t number) {
return (!s.scenario & (number != s.playernum));
}
-bool SinglePlayerGameSettingsProvider::canChangePlayerTribe(uint8_t) {
- return !s.scenario;
-}
-
-bool SinglePlayerGameSettingsProvider::canChangePlayerInit (uint8_t) {
- return !s.scenario;
-}
-
-bool SinglePlayerGameSettingsProvider::canChangePlayerTeam(uint8_t) {
- return !s.scenario;
-}
-
-bool SinglePlayerGameSettingsProvider::canLaunch() {
+bool SinglePlayerGameSettingsProvider::can_change_player_tribe(uint8_t) {
+ return !s.scenario;
+}
+
+bool SinglePlayerGameSettingsProvider::can_change_player_init (uint8_t) {
+ return !s.scenario;
+}
+
+bool SinglePlayerGameSettingsProvider::can_change_player_team(uint8_t) {
+ return !s.scenario;
+}
+
+bool SinglePlayerGameSettingsProvider::can_launch() {
return s.mapname.size() != 0 && s.players.size() >= 1;
}
-std::string SinglePlayerGameSettingsProvider::getMap() {
+std::string SinglePlayerGameSettingsProvider::get_map() {
return s.mapfilename;
}
-void SinglePlayerGameSettingsProvider::setMap (const std::string & mapname, const std::string & mapfilename,
+void SinglePlayerGameSettingsProvider::set_map (const std::string & mapname, const std::string & mapfilename,
uint32_t const maxplayers, bool const savegame) {
s.mapname = mapname;
s.mapfilename = mapfilename;
@@ -89,20 +89,20 @@
// Set default computerplayer ai type
if (player.state == PlayerSettings::stateComputer) {
const ComputerPlayer::ImplementationVector & impls =
- ComputerPlayer::getImplementations();
+ ComputerPlayer::get_implementations();
if (impls.size() > 1) {
player.ai = impls.at(0)->name;
player.random_ai = false;
}
//If AI player then set tribe to random
if (!s.scenario)
- setPlayerTribe(oldplayers, "", true);
+ set_player_tribe(oldplayers, "", true);
}
++oldplayers;
}
}
-void SinglePlayerGameSettingsProvider::setPlayerState (uint8_t const number, PlayerSettings::State state) {
+void SinglePlayerGameSettingsProvider::set_player_state (uint8_t const number, PlayerSettings::State state) {
if (number == s.playernum || number >= s.players.size())
return;
@@ -112,7 +112,7 @@
s.players[number].state = state;
}
-void SinglePlayerGameSettingsProvider::setPlayerAI(uint8_t const number, const std::string & ai,
+void SinglePlayerGameSettingsProvider::set_player_ai(uint8_t const number, const std::string & ai,
bool const random_ai) {
if (number < s.players.size()) {
s.players[number].ai = ai;
@@ -120,12 +120,12 @@
}
}
-void SinglePlayerGameSettingsProvider::nextPlayerState(uint8_t const number) {
+void SinglePlayerGameSettingsProvider::next_player_state(uint8_t const number) {
if (number == s.playernum || number >= s.players.size())
return;
const ComputerPlayer::ImplementationVector & impls =
- ComputerPlayer::getImplementations();
+ ComputerPlayer::get_implementations();
if (impls.size() > 1) {
ComputerPlayer::ImplementationVector::const_iterator it =
impls.begin();
@@ -150,7 +150,7 @@
s.players[number].state = PlayerSettings::stateComputer;
}
-void SinglePlayerGameSettingsProvider::setPlayerTribe(uint8_t const number, const std::string & tribe,
+void SinglePlayerGameSettingsProvider::set_player_tribe(uint8_t const number, const std::string & tribe,
bool random_tribe) {
if (number >= s.players.size())
return;
@@ -176,7 +176,7 @@
}
}
-void SinglePlayerGameSettingsProvider::setPlayerInit(uint8_t const number, uint8_t const index) {
+void SinglePlayerGameSettingsProvider::set_player_init(uint8_t const number, uint8_t const index) {
if (number >= s.players.size())
return;
@@ -191,30 +191,30 @@
assert(false);
}
-void SinglePlayerGameSettingsProvider::setPlayerTeam(uint8_t number, Widelands::TeamNumber team) {
+void SinglePlayerGameSettingsProvider::set_player_team(uint8_t number, Widelands::TeamNumber team) {
if (number < s.players.size())
s.players[number].team = team;
}
-void SinglePlayerGameSettingsProvider::setPlayerCloseable(uint8_t, bool) {
- // nothing to do
-}
-
-void SinglePlayerGameSettingsProvider::setPlayerShared(uint8_t, uint8_t) {
- // nothing to do
-}
-
-void SinglePlayerGameSettingsProvider::setPlayerName(uint8_t const number, const std::string & name) {
+void SinglePlayerGameSettingsProvider::set_player_closeable(uint8_t, bool) {
+ // nothing to do
+}
+
+void SinglePlayerGameSettingsProvider::set_player_shared(uint8_t, uint8_t) {
+ // nothing to do
+}
+
+void SinglePlayerGameSettingsProvider::set_player_name(uint8_t const number, const std::string & name) {
if (number < s.players.size())
s.players[number].name = name;
}
-void SinglePlayerGameSettingsProvider::setPlayer(uint8_t const number, PlayerSettings const ps) {
+void SinglePlayerGameSettingsProvider::set_player(uint8_t const number, PlayerSettings const ps) {
if (number < s.players.size())
s.players[number] = ps;
}
-void SinglePlayerGameSettingsProvider::setPlayerNumber(uint8_t const number) {
+void SinglePlayerGameSettingsProvider::set_player_number(uint8_t const number) {
if (number >= s.players.size())
return;
PlayerSettings const position = settings().players.at(number);
@@ -224,21 +224,21 @@
(position.state == PlayerSettings::stateOpen ||
position.state == PlayerSettings::stateComputer))
{
- setPlayer(number, player);
- setPlayer(settings().playernum, position);
+ set_player(number, player);
+ set_player(settings().playernum, position);
s.playernum = number;
}
}
-std::string SinglePlayerGameSettingsProvider::getWinConditionScript() {
+std::string SinglePlayerGameSettingsProvider::get_win_condition_script() {
return s.win_condition_script;
}
-void SinglePlayerGameSettingsProvider::setWinConditionScript(std::string wc) {
+void SinglePlayerGameSettingsProvider::set_win_condition_script(std::string wc) {
s.win_condition_script = wc;
}
-void SinglePlayerGameSettingsProvider::nextWinCondition() {
+void SinglePlayerGameSettingsProvider::next_win_condition() {
// not implemented - feel free to do so, if you need it.
assert(false);
}
=== modified file 'src/logic/single_player_game_settings_provider.h'
--- src/logic/single_player_game_settings_provider.h 2014-07-26 10:43:23 +0000
+++ src/logic/single_player_game_settings_provider.h 2014-09-29 13:33:11 +0000
@@ -29,36 +29,36 @@
struct SinglePlayerGameSettingsProvider : public GameSettingsProvider {
SinglePlayerGameSettingsProvider();
- void setScenario(bool const set) override;
+ void set_scenario(bool const set) override;
const GameSettings & settings() override;
- bool canChangeMap() override;
- bool canChangePlayerState(uint8_t number) override;
- bool canChangePlayerTribe(uint8_t) override;
- bool canChangePlayerInit (uint8_t) override;
- bool canChangePlayerTeam(uint8_t) override;
- bool canLaunch() override;
+ bool can_change_map() override;
+ bool can_change_player_state(uint8_t number) override;
+ bool can_change_player_tribe(uint8_t) override;
+ bool can_change_player_init (uint8_t) override;
+ bool can_change_player_team(uint8_t) override;
+ bool can_launch() override;
- virtual std::string getMap();
- virtual void setMap(const std::string & mapname, const std::string & mapfilename,
+ virtual std::string get_map();
+ virtual void set_map(const std::string & mapname, const std::string & mapfilename,
uint32_t const maxplayers, bool const savegame) override;
- void setPlayerState(uint8_t const number, PlayerSettings::State state) override;
- void setPlayerAI(uint8_t const number, const std::string & ai, bool const random_ai) override;
- void nextPlayerState(uint8_t const number) override;
- void setPlayerTribe(uint8_t const number, const std::string & tribe, bool random_tribe) override;
- void setPlayerInit(uint8_t const number, uint8_t const index) override;
- void setPlayerTeam(uint8_t number, Widelands::TeamNumber team) override;
- void setPlayerCloseable(uint8_t, bool) override;
- void setPlayerShared(uint8_t, uint8_t) override;
- void setPlayerName(uint8_t const number, const std::string & name) override;
- void setPlayer(uint8_t const number, PlayerSettings const ps) override;
- void setPlayerNumber(uint8_t const number) override;
+ void set_player_state(uint8_t const number, PlayerSettings::State state) override;
+ void set_player_ai(uint8_t const number, const std::string & ai, bool const random_ai) override;
+ void next_player_state(uint8_t const number) override;
+ void set_player_tribe(uint8_t const number, const std::string & tribe, bool random_tribe) override;
+ void set_player_init(uint8_t const number, uint8_t const index) override;
+ void set_player_team(uint8_t number, Widelands::TeamNumber team) override;
+ void set_player_closeable(uint8_t, bool) override;
+ void set_player_shared(uint8_t, uint8_t) override;
+ void set_player_name(uint8_t const number, const std::string & name) override;
+ void set_player(uint8_t const number, PlayerSettings const ps) override;
+ void set_player_number(uint8_t const number) override;
- std::string getWinConditionScript() override;
- void setWinConditionScript(std::string wc) override;
- void nextWinCondition() override;
+ std::string get_win_condition_script() override;
+ void set_win_condition_script(std::string wc) override;
+ void next_win_condition() override;
private:
GameSettings s;
=== modified file 'src/logic/soldier.cc'
--- src/logic/soldier.cc 2014-09-18 18:56:20 +0000
+++ src/logic/soldier.cc 2014-09-29 13:33:11 +0000
@@ -370,7 +370,7 @@
bool Soldier::is_evict_allowed()
{
- return !isOnBattlefield();
+ return !is_on_battlefield();
}
/*
@@ -709,7 +709,7 @@
/**
* \return \c true if this soldier is considered to be on the battlefield
*/
-bool Soldier::isOnBattlefield()
+bool Soldier::is_on_battlefield()
{
return get_state(taskAttack) || get_state(taskDefense);
}
@@ -730,7 +730,7 @@
}
-Battle * Soldier::getBattle()
+Battle * Soldier::get_battle()
{
return m_battle;
}
@@ -743,11 +743,11 @@
* walking towards, to avoid lockups when the combatants cannot reach
* each other.
*/
-bool Soldier::canBeChallenged()
+bool Soldier::can_be_challenged()
{
if (m_hp_current < 1) //< Soldier is dead!
return false;
- if (!isOnBattlefield())
+ if (!is_on_battlefield())
return false;
if (!m_battle)
return true;
@@ -760,7 +760,7 @@
*
* \note must only be called by the \ref Battle object
*/
-void Soldier::setBattle(Game & game, Battle * const battle)
+void Soldier::set_battle(Game & game, Battle * const battle)
{
if (m_battle != battle) {
m_battle = battle;
@@ -964,7 +964,7 @@
if (signal == "blocked") {
// Wait before we try again. Note that this must come *after*
// we check for a battle
- // Note that we *should* be woken via sendSpaceSignals,
+ // Note that we *should* be woken via send_space_signals,
// so the timeout is just an additional safety net.
return start_task_idle(game, descr().get_animation("idle"), 5000);
}
@@ -972,7 +972,7 @@
// Count remaining defenders
if (enemy) {
if (upcast(MilitarySite, ms, enemy)) {
- defenders = ms->presentSoldiers().size();
+ defenders = ms->present_soldiers().size();
}
if (upcast(Warehouse, wh, enemy)) {
Requirements noreq;
@@ -997,7 +997,7 @@
{
// Injured soldiers will try to return to safe site at home.
if (state.ui32var3 > get_current_hitpoints() && defenders) {
- state.coords = Coords::Null();
+ state.coords = Coords::null();
state.objvar1 = nullptr;
}
// The old militarysite gets replaced by a new one, so if "enemy" is not
@@ -1011,7 +1011,7 @@
state.objvar1 = nullptr;
// We may also have our location destroyed in between
if
- (ctrl->stationedSoldiers().size() < ctrl->soldierCapacity() &&
+ (ctrl->stationed_soldiers().size() < ctrl->soldier_capacity() &&
(!location || location->base_flag().get_position()
!=
newsite ->base_flag().get_position()))
@@ -1044,7 +1044,7 @@
molog
("[attack] failed to move towards building flag, cancel attack "
"and return home!\n");
- state.coords = Coords::Null();
+ state.coords = Coords::null();
state.objvar1 = nullptr;
state.ivar2 = 1;
return schedule_act(game, 10);
@@ -1182,7 +1182,7 @@
if (signal == "blocked")
// Wait before we try again. Note that this must come *after*
// we check for a battle
- // Note that we *should* be woken via sendSpaceSignals,
+ // Note that we *should* be woken via send_space_signals,
// so the timeout is just an additional safety net.
return start_task_idle(game, descr().get_animation("idle"), 5000);
@@ -1209,7 +1209,7 @@
for (Bob * temp_bob : soldiers) {
if (upcast(Soldier, temp_soldier, temp_bob)) {
- if (temp_soldier->canBeChallenged()) {
+ if (temp_soldier->can_be_challenged()) {
new Battle(game, *this, *temp_soldier);
return start_task_battle(game);
}
@@ -1292,7 +1292,7 @@
// Check soldier, be sure that we can fight against soldier.
// Soldiers can not go over enemy land when defending.
if
- ((soldier->canBeChallenged()) &&
+ ((soldier->can_be_challenged()) &&
(f.get_owned_by() == get_owner()->player_number()))
{
uint32_t thisDist = game.map().calc_distance
@@ -1418,7 +1418,7 @@
* \return \c true if the defending soldier should not stray from
* his home flag.
*/
-bool Soldier::stayHome()
+bool Soldier::stay_home()
{
if (State const * const state = get_state(taskDefense))
return state->ivar1 & CF_DEFEND_STAYHOME;
@@ -1477,7 +1477,7 @@
}
assert(m_combat_walking == CD_NONE);
molog("[battle] is over\n");
- sendSpaceSignals(game);
+ send_space_signals(game);
return pop_task(game);
}
@@ -1500,11 +1500,11 @@
}
}
- if (stayHome()) {
+ if (stay_home()) {
if (this == m_battle->first()) {
- molog("[battle] stayHome, so reverse roles\n");
+ molog("[battle] stay_home, so reverse roles\n");
new Battle(game, *m_battle->second(), *m_battle->first());
- return skip_act(); // we will get a signal via setBattle()
+ return skip_act(); // we will get a signal via set_battle()
} else {
if (m_combat_walking != CD_COMBAT_E) {
opponent.send_signal(game, "wakeup");
@@ -1512,7 +1512,7 @@
}
}
} else {
- if (opponent.stayHome() && (this == m_battle->second())) {
+ if (opponent.stay_home() && (this == m_battle->second())) {
// Wait until correct roles are assigned
new Battle(game, *m_battle->second(), *m_battle->first());
return schedule_act(game, 10);
@@ -1585,13 +1585,13 @@
buffer,
opponent.get_position(),
m_serial));
- game.gameController()->setDesiredSpeed(0);
+ game.game_controller()->set_desired_speed(0);
return pop_task(game);
}
}
} else {
assert(opponent.get_position() == get_position());
- assert(m_battle == opponent.getBattle());
+ assert(m_battle == opponent.get_battle());
if (opponent.is_walking()) {
molog
@@ -1617,7 +1617,7 @@
}
}
- m_battle->getBattleWork(game, *this);
+ m_battle->get_battle_work(game, *this);
}
void Soldier::battle_pop(Game & game, State &)
@@ -1684,18 +1684,18 @@
{
if (upcast(Soldier, soldier, bob))
return
- soldier->isOnBattlefield() &&
+ soldier->is_on_battlefield() &&
soldier->get_current_hitpoints();
return false;
}
};
/**
- * Override \ref Bob::checkNodeBlocked.
+ * Override \ref Bob::check_node_blocked.
*
* As long as we're on the battlefield, check for other soldiers.
*/
-bool Soldier::checkNodeBlocked
+bool Soldier::check_node_blocked
(Game & game, const FCoords & field, bool const commit)
{
State * attackdefense = get_state(taskAttack);
@@ -1709,7 +1709,7 @@
attackdefense->ui32var3 > get_current_hitpoints()))
{
// Retreating or non-combatant soldiers act like normal bobs
- return Bob::checkNodeBlocked(game, field, commit);
+ return Bob::check_node_blocked(game, field, commit);
}
if
@@ -1717,7 +1717,7 @@
field.field->get_immovable() == get_location(game))
{
if (commit)
- sendSpaceSignals(game);
+ send_space_signals(game);
return false; // we can always walk home
}
@@ -1731,7 +1731,7 @@
bob; bob = bob->get_next_on_field())
{
if (upcast(Soldier, soldier, bob)) {
- if (!soldier->isOnBattlefield() || !soldier->get_current_hitpoints())
+ if (!soldier->is_on_battlefield() || !soldier->get_current_hitpoints())
continue;
if (!foundsoldier) {
@@ -1740,7 +1740,7 @@
multiplesoldiers = true;
}
- if (soldier->getBattle()) {
+ if (soldier->get_battle()) {
foundbattle = true;
if (m_battle && m_battle->opponent(*this) == soldier)
@@ -1753,10 +1753,10 @@
if (commit && !foundbattle && !multiplesoldiers) {
if
(foundsoldier->owner().is_hostile(*get_owner()) &&
- foundsoldier->canBeChallenged())
+ foundsoldier->can_be_challenged())
{
molog
- ("[checkNodeBlocked] attacking a soldier (%u)\n",
+ ("[check_node_blocked] attacking a soldier (%u)\n",
foundsoldier->serial());
new Battle(game, *this, *foundsoldier);
}
@@ -1765,7 +1765,7 @@
return true;
} else {
if (commit)
- sendSpaceSignals(game);
+ send_space_signals(game);
return false;
}
}
@@ -1775,7 +1775,7 @@
* Send a "wakeup" signal to all surrounding soldiers that are out in the open,
* so that they may repeat pathfinding.
*/
-void Soldier::sendSpaceSignals(Game & game)
+void Soldier::send_space_signals(Game & game)
{
std::vector<Bob *> soldiers;
@@ -1854,34 +1854,34 @@
{
Worker::Loader::load(fr);
- uint8_t version = fr.Unsigned8();
+ uint8_t version = fr.unsigned_8();
if (version > SOLDIER_SAVEGAME_VERSION)
throw GameDataError("unknown/unhandled version %u", version);
Soldier & soldier = get<Soldier>();
- soldier.m_hp_current = fr.Unsigned32();
+ soldier.m_hp_current = fr.unsigned_32();
if (SOLDIER_SAVEGAME_VERSION < 2) // Hitpoints multiplied to make balance easier
soldier.m_hp_current *= 100;
soldier.m_hp_level =
- std::min(fr.Unsigned32(), soldier.descr().get_max_hp_level());
+ std::min(fr.unsigned_32(), soldier.descr().get_max_hp_level());
soldier.m_attack_level =
- std::min(fr.Unsigned32(), soldier.descr().get_max_attack_level());
+ std::min(fr.unsigned_32(), soldier.descr().get_max_attack_level());
soldier.m_defense_level =
- std::min(fr.Unsigned32(), soldier.descr().get_max_defense_level());
+ std::min(fr.unsigned_32(), soldier.descr().get_max_defense_level());
soldier.m_evade_level =
- std::min(fr.Unsigned32(), soldier.descr().get_max_evade_level());
+ std::min(fr.unsigned_32(), soldier.descr().get_max_evade_level());
if (soldier.m_hp_current > soldier.get_max_hitpoints())
soldier.m_hp_current = soldier.get_max_hitpoints();
- soldier.m_combat_walking = static_cast<CombatWalkingDir>(fr.Unsigned8());
+ soldier.m_combat_walking = static_cast<CombatWalkingDir>(fr.unsigned_8());
if (soldier.m_combat_walking != CD_NONE) {
- soldier.m_combat_walkstart = fr.Signed32();
- soldier.m_combat_walkend = fr.Signed32();
+ soldier.m_combat_walkstart = fr.signed_32();
+ soldier.m_combat_walkend = fr.signed_32();
}
- m_battle = fr.Unsigned32();
+ m_battle = fr.unsigned_32();
}
void Soldier::Loader::load_pointers()
@@ -1914,20 +1914,20 @@
{
Worker::do_save(egbase, mos, fw);
- fw.Unsigned8(SOLDIER_SAVEGAME_VERSION);
- fw.Unsigned32(m_hp_current);
- fw.Unsigned32(m_hp_level);
- fw.Unsigned32(m_attack_level);
- fw.Unsigned32(m_defense_level);
- fw.Unsigned32(m_evade_level);
+ fw.unsigned_8(SOLDIER_SAVEGAME_VERSION);
+ fw.unsigned_32(m_hp_current);
+ fw.unsigned_32(m_hp_level);
+ fw.unsigned_32(m_attack_level);
+ fw.unsigned_32(m_defense_level);
+ fw.unsigned_32(m_evade_level);
- fw.Unsigned8(m_combat_walking);
+ fw.unsigned_8(m_combat_walking);
if (m_combat_walking != CD_NONE) {
- fw.Signed32(m_combat_walkstart);
- fw.Signed32(m_combat_walkend);
+ fw.signed_32(m_combat_walkstart);
+ fw.signed_32(m_combat_walkend);
}
- fw.Unsigned32(mos.get_object_file_index_or_zero(m_battle));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(m_battle));
}
}
=== modified file 'src/logic/soldier.h'
--- src/logic/soldier.h 2014-09-10 10:18:46 +0000
+++ src/logic/soldier.h 2014-09-29 13:33:11 +0000
@@ -223,13 +223,13 @@
void log_general_info(const EditorGameBase &) override;
- bool isOnBattlefield();
+ bool is_on_battlefield();
bool is_attacking_player(Game &, Player &);
- Battle * getBattle();
- bool canBeChallenged();
- bool checkNodeBlocked(Game &, const FCoords &, bool commit) override;
+ Battle * get_battle();
+ bool can_be_challenged();
+ bool check_node_blocked(Game &, const FCoords &, bool commit) override;
- void setBattle(Game &, Battle *);
+ void set_battle(Game &, Battle *);
void start_task_attack(Game & game, Building &);
void start_task_defense(Game & game, bool stayhome);
@@ -248,8 +248,8 @@
void die_update(Game &, State &);
void die_pop(Game &, State &);
- void sendSpaceSignals(Game &);
- bool stayHome();
+ void send_space_signals(Game &);
+ bool stay_home();
// Pop the current task or, if challenged, start the fighting task.
void pop_task_or_fight(Game &);
=== modified file 'src/logic/soldiercontrol.h'
--- src/logic/soldiercontrol.h 2014-09-10 08:55:04 +0000
+++ src/logic/soldiercontrol.h 2014-09-29 13:33:11 +0000
@@ -42,30 +42,30 @@
/**
* \return a list of soldiers that are currently present in the building.
*/
- virtual std::vector<Soldier *> presentSoldiers() const = 0;
+ virtual std::vector<Soldier *> present_soldiers() const = 0;
/**
* \return a list of soldiers that are currently stationed in the building.
*/
- virtual std::vector<Soldier *> stationedSoldiers() const = 0;
+ virtual std::vector<Soldier *> stationed_soldiers() const = 0;
/**
* \return the minimum number of soldiers that this building can be
* configured to hold.
*/
- virtual uint32_t minSoldierCapacity() const = 0;
+ virtual uint32_t min_soldier_capacity() const = 0;
/**
* \return the maximum number of soldiers that this building can be
* configured to hold.
*/
- virtual uint32_t maxSoldierCapacity() const = 0;
+ virtual uint32_t max_soldier_capacity() const = 0;
/**
* \return the number of soldiers this building is configured to hold
* right now.
*/
- virtual uint32_t soldierCapacity() const = 0;
+ virtual uint32_t soldier_capacity() const = 0;
/**
* Sets the capacity for soldiers of this building.
@@ -73,19 +73,19 @@
* New soldiers will be requested and old soldiers will be evicted
* as necessary.
*/
- virtual void setSoldierCapacity(uint32_t capacity) = 0;
+ virtual void set_soldier_capacity(uint32_t capacity) = 0;
void changeSoldierCapacity(int32_t const difference) {
- uint32_t const old_capacity = soldierCapacity();
+ uint32_t const old_capacity = soldier_capacity();
uint32_t const new_capacity =
std::min
(static_cast<uint32_t>
(std::max
(static_cast<int32_t>(old_capacity) + difference,
- static_cast<int32_t>(minSoldierCapacity()))),
- maxSoldierCapacity());
+ static_cast<int32_t>(min_soldier_capacity()))),
+ max_soldier_capacity());
if (old_capacity != new_capacity)
- setSoldierCapacity(new_capacity);
+ set_soldier_capacity(new_capacity);
}
/**
@@ -95,20 +95,20 @@
* \note This has no effect if the soldier is currently involved in a battle
* or otherwise blocked from leaving the building.
*/
- virtual void dropSoldier(Soldier &) = 0;
+ virtual void drop_soldier(Soldier &) = 0;
/**
* Add a new soldier into this site. Returns -1 if there is no space
* for him, 0 on success
*/
- virtual int incorporateSoldier(EditorGameBase &, Soldier &) = 0;
+ virtual int incorporate_soldier(EditorGameBase &, Soldier &) = 0;
/**
* Remove a soldier from the internal list. Most SoldierControls will be
* informed by the soldier when it is removed, but WareHouses for example
* will not.
*/
- virtual int outcorporateSoldier(EditorGameBase &, Soldier &) {return 0;}
+ virtual int outcorporate_soldier(EditorGameBase &, Soldier &) {return 0;}
protected:
virtual ~SoldierControl() {}
=== modified file 'src/logic/trainingsite.cc'
--- src/logic/trainingsite.cc 2014-09-14 11:31:58 +0000
+++ src/logic/trainingsite.cc 2014-09-29 13:33:11 +0000
@@ -181,7 +181,7 @@
{
// Now with kick-out state saving implemented, initializing is an overkill
for (int t = d.get_min_level(art); t <= d.get_max_level(art); t++)
- trainingAttempted(art, t);
+ training_attempted(art, t);
}
@@ -319,7 +319,7 @@
m_soldier_request = nullptr;
while (m_soldiers.size() > m_capacity)
- dropSoldier(**m_soldiers.rbegin());
+ drop_soldier(**m_soldiers.rbegin());
}
}
@@ -345,7 +345,7 @@
assert(s.get_location(game) == &tsite);
assert(tsite.m_soldier_request == &rq);
- tsite.incorporateSoldier(game, s);
+ tsite.incorporate_soldier(game, s);
}
/*
@@ -355,9 +355,9 @@
returns 0 on succes, -1 if there was no room for this soldier
===============
*/
-int TrainingSite::incorporateSoldier(EditorGameBase & egbase, Soldier & s) {
+int TrainingSite::incorporate_soldier(EditorGameBase & egbase, Soldier & s) {
if (s.get_location(egbase) != this) {
- if (stationedSoldiers().size() + 1 > descr().get_max_number_of_soldiers())
+ if (stationed_soldiers().size() + 1 > descr().get_max_number_of_soldiers())
return -1;
s.set_location(this);
@@ -374,30 +374,30 @@
}
-std::vector<Soldier *> TrainingSite::presentSoldiers() const
-{
- return m_soldiers;
-}
-
-std::vector<Soldier *> TrainingSite::stationedSoldiers() const
-{
- return m_soldiers;
-}
-
-uint32_t TrainingSite::minSoldierCapacity() const {
+std::vector<Soldier *> TrainingSite::present_soldiers() const
+{
+ return m_soldiers;
+}
+
+std::vector<Soldier *> TrainingSite::stationed_soldiers() const
+{
+ return m_soldiers;
+}
+
+uint32_t TrainingSite::min_soldier_capacity() const {
return 0;
}
-uint32_t TrainingSite::maxSoldierCapacity() const {
+uint32_t TrainingSite::max_soldier_capacity() const {
return descr().get_max_number_of_soldiers();
}
-uint32_t TrainingSite::soldierCapacity() const
+uint32_t TrainingSite::soldier_capacity() const
{
return m_capacity;
}
-void TrainingSite::setSoldierCapacity(uint32_t const capacity) {
- assert(minSoldierCapacity() <= capacity);
- assert (capacity <= maxSoldierCapacity());
+void TrainingSite::set_soldier_capacity(uint32_t const capacity) {
+ assert(min_soldier_capacity() <= capacity);
+ assert (capacity <= max_soldier_capacity());
assert(m_capacity != capacity);
m_capacity = capacity;
update_soldier_request();
@@ -412,14 +412,14 @@
* \note This is called from player commands, so we need to verify that the
* soldier is actually stationed here, without breaking anything if he isn't.
*/
-void TrainingSite::dropSoldier(Soldier & soldier)
+void TrainingSite::drop_soldier(Soldier & soldier)
{
Game & game = ref_cast<Game, EditorGameBase>(owner().egbase());
std::vector<Soldier *>::iterator it =
std::find(m_soldiers.begin(), m_soldiers.end(), &soldier);
if (it == m_soldiers.end()) {
- molog("TrainingSite::dropSoldier: soldier not in training site");
+ molog("TrainingSite::drop_soldier: soldier not in training site");
return;
}
@@ -455,7 +455,7 @@
// Drop soldiers only now, so that changes in the soldiers array don't
// mess things up
for (Soldier * soldier : droplist) {
- dropSoldier(*soldier);
+ drop_soldier(*soldier);
}
}
@@ -528,7 +528,7 @@
if (nullptr != soldier_to_drop)
{
log("TrainingSite::drop_stalled_soldiers: Kicking somebody out.\n");
- dropSoldier (*soldier_to_drop);
+ drop_soldier (*soldier_to_drop);
}
}
@@ -563,7 +563,7 @@
}
m_current_upgrade = nullptr;
}
- trainingDone();
+ training_done();
}
@@ -739,7 +739,7 @@
void
-TrainingSite::trainingAttempted(uint32_t type, uint32_t level)
+TrainingSite::training_attempted(uint32_t type, uint32_t level)
{
TypeAndLevel key(type, level);
if (training_failure_count.find(key) == training_failure_count.end())
@@ -753,7 +753,7 @@
*/
void
-TrainingSite::trainingSuccessful(uint32_t type, uint32_t level)
+TrainingSite::training_successful(uint32_t type, uint32_t level)
{
TypeAndLevel key(type, level);
// Here I assume that key exists: training has been attempted before it can succeed.
@@ -761,7 +761,7 @@
}
void
-TrainingSite::trainingDone()
+TrainingSite::training_done()
{
TrainFailCount::iterator it;
for (it = training_failure_count.begin(); it != training_failure_count.end(); it++)
=== modified file 'src/logic/trainingsite.h'
--- src/logic/trainingsite.h 2014-09-14 11:31:58 +0000
+++ src/logic/trainingsite.h 2014-09-29 13:33:11 +0000
@@ -143,23 +143,23 @@
void set_economy(Economy * e) override;
// Begin implementation of SoldierControl
- std::vector<Soldier *> presentSoldiers() const override;
- std::vector<Soldier *> stationedSoldiers() const override;
- uint32_t minSoldierCapacity() const override;
- uint32_t maxSoldierCapacity() const override;
- uint32_t soldierCapacity() const override;
- void setSoldierCapacity(uint32_t capacity) override;
- void dropSoldier(Soldier &) override;
- int incorporateSoldier(EditorGameBase &, Soldier &) override;
+ std::vector<Soldier *> present_soldiers() const override;
+ std::vector<Soldier *> stationed_soldiers() const override;
+ uint32_t min_soldier_capacity() const override;
+ uint32_t max_soldier_capacity() const override;
+ uint32_t soldier_capacity() const override;
+ void set_soldier_capacity(uint32_t capacity) override;
+ void drop_soldier(Soldier &) override;
+ int incorporate_soldier(EditorGameBase &, Soldier &) override;
// End implementation of SoldierControl
int32_t get_pri(enum TrainingAttribute atr);
void set_pri(enum TrainingAttribute atr, int32_t prio);
// These are for premature soldier kick-out
- void trainingAttempted(uint32_t type, uint32_t level);
- void trainingSuccessful(uint32_t type, uint32_t level);
- void trainingDone();
+ void training_attempted(uint32_t type, uint32_t level);
+ void training_successful(uint32_t type, uint32_t level);
+ void training_done();
protected:
=== modified file 'src/logic/tribe.cc'
--- src/logic/tribe.cc 2014-09-14 11:31:58 +0000
+++ src/logic/tribe.cc 2014-09-29 13:33:11 +0000
@@ -241,7 +241,7 @@
{
// Read initializations -- all scripts are initializations currently
for (const std::string& script :
- filter(g_fs->ListDirectory(path + "scripting"),
+ filter(g_fs->list_directory(path + "scripting"),
[](const string& fn) {return boost::ends_with(fn, ".lua");})) {
std::unique_ptr<LuaTable> t = egbase.lua().run_script(script);
t->do_not_warn_about_unaccessed_keys();
@@ -303,7 +303,7 @@
LuaInterface lua;
FileRead f;
- if (f.TryOpen(*g_fs, buf)) {
+ if (f.try_open(*g_fs, buf)) {
if (info)
try {
Profile prof(buf.c_str());
@@ -313,7 +313,7 @@
std::string path = "tribes/" + name + "/scripting";
for (const std::string& script :
- filter(g_fs->ListDirectory(path),
+ filter(g_fs->list_directory(path),
[](const string& fn) {return boost::ends_with(fn, ".lua");})) {
std::unique_ptr<LuaTable> t = lua.run_script(script);
t->do_not_warn_about_unaccessed_keys();
@@ -344,7 +344,7 @@
// get all tribes
std::vector<TribeBasicInfo> tribes;
- FilenameSet m_tribes = g_fs->ListDirectory("tribes");
+ FilenameSet m_tribes = g_fs->list_directory("tribes");
for
(FilenameSet::iterator pname = m_tribes.begin();
pname != m_tribes.end();
@@ -367,7 +367,7 @@
std::vector<TribeBasicInfo> tribes;
// get all tribes
- FilenameSet m_tribes = g_fs->ListDirectory("tribes");
+ FilenameSet m_tribes = g_fs->list_directory("tribes");
for
(FilenameSet::iterator pname = m_tribes.begin();
pname != m_tribes.end();
=== modified file 'src/logic/warehouse.cc'
--- src/logic/warehouse.cc 2014-09-10 10:18:46 +0000
+++ src/logic/warehouse.cc 2014-09-29 13:33:11 +0000
@@ -281,7 +281,7 @@
m_next_worker_without_cost_spawn =
new uint32_t[nr_worker_types_without_cost];
for (int i = 0; i < nr_worker_types_without_cost; ++i) {
- m_next_worker_without_cost_spawn[i] = Never();
+ m_next_worker_without_cost_spawn[i] = never();
}
m_next_stock_remove_act = 0;
}
@@ -366,16 +366,16 @@
void Warehouse::load_finish(EditorGameBase & egbase) {
Building::load_finish(egbase);
- uint32_t next_spawn = Never();
+ uint32_t next_spawn = never();
const std::vector<WareIndex> & worker_types_without_cost =
descr().tribe().worker_types_without_cost();
for (uint8_t i = worker_types_without_cost.size(); i;) {
WareIndex const worker_index = worker_types_without_cost.at(--i);
if
(owner().is_worker_type_allowed(worker_index) &&
- m_next_worker_without_cost_spawn[i] == static_cast<uint32_t>(Never()))
+ m_next_worker_without_cost_spawn[i] == static_cast<uint32_t>(never()))
{
- if (next_spawn == static_cast<uint32_t>(Never()))
+ if (next_spawn == static_cast<uint32_t>(never()))
next_spawn =
schedule_act
(ref_cast<Game, EditorGameBase>(egbase),
@@ -586,7 +586,7 @@
m_next_worker_without_cost_spawn[i] =
schedule_act(game, tdelta);
} else
- m_next_worker_without_cost_spawn[i] = Never();
+ m_next_worker_without_cost_spawn[i] = never();
}
}
@@ -1176,7 +1176,7 @@
assert
(m_next_worker_without_cost_spawn[worker_types_without_cost_index]
==
- static_cast<uint32_t>(Never()));
+ static_cast<uint32_t>(never()));
m_next_worker_without_cost_spawn[worker_types_without_cost_index] =
schedule_act(game, WORKER_WITHOUT_COST_SPAWN_INTERVAL);
}
@@ -1185,12 +1185,12 @@
assert
(m_next_worker_without_cost_spawn[worker_types_without_cost_index]
!=
- static_cast<uint32_t>(Never()));
- m_next_worker_without_cost_spawn[worker_types_without_cost_index] = Never();
+ static_cast<uint32_t>(never()));
+ m_next_worker_without_cost_spawn[worker_types_without_cost_index] = never();
}
-bool Warehouse::canAttack()
+bool Warehouse::can_attack()
{
return descr().get_conquers() > 0;
}
@@ -1204,7 +1204,7 @@
Map & map = game.map();
if
(enemy.get_owner() == &owner() ||
- enemy.getBattle() ||
+ enemy.get_battle() ||
descr().get_conquers()
<=
map.calc_distance(enemy.get_position(), get_position()))
@@ -1326,7 +1326,7 @@
/*
* SoldierControl implementations
*/
-std::vector<Soldier *> Warehouse::presentSoldiers() const
+std::vector<Soldier *> Warehouse::present_soldiers() const
{
std::vector<Soldier *> rv;
@@ -1343,12 +1343,12 @@
return rv;
}
-int Warehouse::incorporateSoldier(EditorGameBase & egbase, Soldier & soldier) {
+int Warehouse::incorporate_soldier(EditorGameBase & egbase, Soldier & soldier) {
incorporate_worker(egbase, &soldier);
return 0;
}
-int Warehouse::outcorporateSoldier(EditorGameBase & /* egbase */, Soldier & soldier) {
+int Warehouse::outcorporate_soldier(EditorGameBase & /* egbase */, Soldier & soldier) {
WareIndex const ware = descr().tribe().safe_worker_index("soldier");
if (m_incorporated_workers.count(ware)) {
@@ -1362,7 +1362,7 @@
}
#ifndef NDEBUG
else
- throw wexception("outcorporateSoldier: soldier not in this warehouse!");
+ throw wexception("outcorporate_soldier: soldier not in this warehouse!");
#endif
return 0;
=== modified file 'src/logic/warehouse.h'
--- src/logic/warehouse.h 2014-09-14 11:31:58 +0000
+++ src/logic/warehouse.h 2014-09-29 13:33:11 +0000
@@ -155,21 +155,21 @@
void remove_workers(WareIndex, uint32_t count);
/* SoldierControl implementation */
- std::vector<Soldier *> presentSoldiers() const override;
- std::vector<Soldier *> stationedSoldiers() const override {
- return presentSoldiers();
- }
- uint32_t minSoldierCapacity() const override {return 0;}
- uint32_t maxSoldierCapacity() const override {return 4294967295U;}
- uint32_t soldierCapacity() const override {return maxSoldierCapacity();}
- void setSoldierCapacity(uint32_t /* capacity */) override {
- throw wexception("Not implemented for a Warehouse!");
- }
- void dropSoldier(Soldier &) override {
- throw wexception("Not implemented for a Warehouse!");
- }
- int outcorporateSoldier(EditorGameBase &, Soldier &) override;
- int incorporateSoldier(EditorGameBase &, Soldier& soldier) override;
+ std::vector<Soldier *> present_soldiers() const override;
+ std::vector<Soldier *> stationed_soldiers() const override {
+ return present_soldiers();
+ }
+ uint32_t min_soldier_capacity() const override {return 0;}
+ uint32_t max_soldier_capacity() const override {return 4294967295U;}
+ uint32_t soldier_capacity() const override {return max_soldier_capacity();}
+ void set_soldier_capacity(uint32_t /* capacity */) override {
+ throw wexception("Not implemented for a Warehouse!");
+ }
+ void drop_soldier(Soldier &) override {
+ throw wexception("Not implemented for a Warehouse!");
+ }
+ int outcorporate_soldier(EditorGameBase &, Soldier &) override;
+ int incorporate_soldier(EditorGameBase &, Soldier& soldier) override;
bool fetch_from_flag(Game &) override;
@@ -199,7 +199,7 @@
// Begin Attackable implementation
Player & owner() const override {return Building::owner();}
- bool canAttack() override;
+ bool can_attack() override;
void aggressor(Soldier &) override;
bool attack (Soldier &) override;
// End Attackable implementation
=== modified file 'src/logic/widelands.h'
--- src/logic/widelands.h 2014-09-14 11:31:58 +0000
+++ src/logic/widelands.h 2014-09-29 13:33:11 +0000
@@ -36,7 +36,7 @@
using MilitaryInfluence = uint16_t;
using PlayerNumber = uint8_t; /// 5 bits used, so 0 .. 31
-inline PlayerNumber Neutral() {return 0;}
+inline PlayerNumber neutral() {return 0;}
#define iterate_player_numbers(p, nr_players) \
for (Widelands::PlayerNumber p = 1; p < nr_players + 1; ++p)
@@ -55,10 +55,10 @@
using Vision = uint16_t;
using Time = int32_t; // TODO(unknown): should be unsigned
-inline Time Never() {return 0xffffffff;}
+inline Time never() {return 0xffffffff;}
using Duration = uint32_t;
-inline Duration Forever() {return 0xffffffff;}
+inline Duration endless() {return 0xffffffff;}
using Serial = uint32_t; /// Serial number for MapObject.
=== modified file 'src/logic/widelands_geometry.cc'
--- src/logic/widelands_geometry.cc 2014-09-14 11:31:58 +0000
+++ src/logic/widelands_geometry.cc 2014-09-29 13:33:11 +0000
@@ -36,7 +36,7 @@
}
Coords::operator bool() const {
- return *this != Null();
+ return *this != null();
}
void Coords::reorigin(Coords new_origin, const Extent& extent) {
@@ -53,7 +53,7 @@
}
// static
-Coords Coords::Null() {
+Coords Coords::null() {
return Coords(-1, -1);
}
=== modified file 'src/logic/widelands_geometry.h'
--- src/logic/widelands_geometry.h 2014-09-14 11:31:58 +0000
+++ src/logic/widelands_geometry.h 2014-09-29 13:33:11 +0000
@@ -42,7 +42,7 @@
Coords(int16_t nx, int16_t ny);
/// Returns a special value indicating invalidity.
- static Coords Null();
+ static Coords null();
bool operator== (const Coords& other) const;
bool operator!= (const Coords & other) const;
=== modified file 'src/logic/widelands_geometry_io.cc'
--- src/logic/widelands_geometry_io.cc 2014-09-10 08:55:04 +0000
+++ src/logic/widelands_geometry_io.cc 2014-09-29 13:33:11 +0000
@@ -24,8 +24,8 @@
namespace Widelands {
-Direction ReadDirection8(StreamRead* fr) {
- uint8_t const d = fr->Unsigned8();
+Direction read_direction_8(StreamRead* fr) {
+ uint8_t const d = fr->unsigned_8();
if (d == 0)
throw DirectionIsNull();
if (6 < d)
@@ -33,29 +33,29 @@
return d;
}
-Direction ReadDirection8_allow_null(StreamRead* fr) {
- uint8_t const d = fr->Unsigned8();
+Direction read_direction_8_allow_null(StreamRead* fr) {
+ uint8_t const d = fr->unsigned_8();
if (6 < d)
throw DirectionInvalid(d);
return d;
}
-MapIndex ReadMap_Index32(StreamRead* fr, const MapIndex max) {
- uint32_t const i = fr->Unsigned32();
+MapIndex read_map_index_32(StreamRead* fr, const MapIndex max) {
+ uint32_t const i = fr->unsigned_32();
if (max <= i)
throw ExceededMaxIndex(max, i);
return i;
}
-Coords ReadCoords32(StreamRead* stream_read) {
- uint16_t const x = stream_read->Unsigned16();
- uint16_t const y = stream_read->Unsigned16();
+Coords read_coords_32(StreamRead* stream_read) {
+ uint16_t const x = stream_read->unsigned_16();
+ uint16_t const y = stream_read->unsigned_16();
return Coords(x, y);
}
-Coords ReadCoords32(StreamRead* stream_read, const Extent& extent) {
- uint16_t const x = stream_read->Unsigned16();
- uint16_t const y = stream_read->Unsigned16();
+Coords read_coords_32(StreamRead* stream_read, const Extent& extent) {
+ uint16_t const x = stream_read->unsigned_16();
+ uint16_t const y = stream_read->unsigned_16();
if (extent.w <= x)
throw ExceededWidth(extent.w, x);
if (extent.h <= y)
@@ -63,9 +63,9 @@
return Coords(x, y);
}
-Coords ReadCoords32_allow_null(StreamRead* fr, const Extent& extent) {
- uint16_t const x = fr->Unsigned16();
- uint16_t const y = fr->Unsigned16();
+Coords read_coords_32_allow_null(StreamRead* fr, const Extent& extent) {
+ uint16_t const x = fr->unsigned_16();
+ uint16_t const y = fr->unsigned_16();
const Coords result(x, y);
if (result) {
if (extent.w <= x)
@@ -76,33 +76,33 @@
return result;
}
-Area<Coords, uint16_t> ReadArea48(StreamRead* fr, const Extent& extent) {
- Coords const c = ReadCoords32(fr, extent);
- uint16_t const r = fr->Unsigned16();
+Area<Coords, uint16_t> read_area_48(StreamRead* fr, const Extent& extent) {
+ Coords const c = read_coords_32(fr, extent);
+ uint16_t const r = fr->unsigned_16();
return Area<Coords, uint16_t>(c, r);
}
-void WriteDirection8(StreamWrite* wr, Direction const d) {
+void write_direction_8(StreamWrite* wr, Direction const d) {
assert(0 < d);
assert(d <= 6);
- wr->Data(&d, 1);
+ wr->data(&d, 1);
}
-void WriteDirection8_allow_null(StreamWrite* wr, Direction const d) {
+void write_direction_8_allow_null(StreamWrite* wr, Direction const d) {
assert(d <= 6);
- wr->Data(&d, 1);
+ wr->data(&d, 1);
}
-void WriteCoords32(StreamWrite* wr, const Coords& c) {
+void write_coords_32(StreamWrite* wr, const Coords& c) {
assert(static_cast<uint16_t>(c.x) < 0x8000 || c.x == -1);
assert(static_cast<uint16_t>(c.y) < 0x8000 || c.y == -1);
- wr->Unsigned16(c.x);
- wr->Unsigned16(c.y);
+ wr->unsigned_16(c.x);
+ wr->unsigned_16(c.y);
}
-void WriteArea48(StreamWrite* wr, Area<Coords, uint16_t> const area) {
- WriteCoords32(wr, area);
- wr->Unsigned16(area.radius);
+void write_area_48(StreamWrite* wr, Area<Coords, uint16_t> const area) {
+ write_coords_32(wr, area);
+ wr->unsigned_16(area.radius);
}
} // namespace Widelands
=== modified file 'src/logic/widelands_geometry_io.h'
--- src/logic/widelands_geometry_io.h 2014-09-14 11:31:58 +0000
+++ src/logic/widelands_geometry_io.h 2014-09-29 13:33:11 +0000
@@ -68,15 +68,15 @@
///
/// \throws direction_is_null if the direction is 0.
/// \throws direction_invalid if direction is > 6.
-Direction ReadDirection8(StreamRead* fr);
+Direction read_direction_8(StreamRead* fr);
/// Read a Direction from the file. Use this when the result can only be a
/// direction or 0 (none).
///
/// \throws direction_invalid if direction is > 6.
-Direction ReadDirection8_allow_null(StreamRead* fr);
+Direction read_direction_8_allow_null(StreamRead* fr);
-MapIndex ReadMap_Index32(StreamRead* fr, MapIndex max);
+MapIndex read_map_index_32(StreamRead* fr, MapIndex max);
/// Read a Coords from the file. Use this when the result can only be a
/// coordinate pair referring to a node.
@@ -86,27 +86,27 @@
/// Both coordinates are read from the file before checking and possibly
/// throwing, so in case such an exception is thrown, it is guaranteed that
/// the whole coordinate pair has been read.
-Coords ReadCoords32(StreamRead* stream_read);
+Coords read_coords_32(StreamRead* stream_read);
-Coords ReadCoords32(StreamRead* stream_read, const Extent& extent);
+Coords read_coords_32(StreamRead* stream_read, const Extent& extent);
/// Like Coords32 but the result can have the special value indicating
-/// invalidity, as defined by Coords::Null.
-Coords ReadCoords32_allow_null(StreamRead* fr, const Extent& extent);
+/// invalidity, as defined by Coords::null.
+Coords read_coords_32_allow_null(StreamRead* fr, const Extent& extent);
-Area<Coords, uint16_t> ReadArea48(StreamRead* fr, const Extent& extent);
+Area<Coords, uint16_t> read_area_48(StreamRead* fr, const Extent& extent);
// Writes 'd' to 'wr'.
-void WriteDirection8(StreamWrite* wr, Direction d);
+void write_direction_8(StreamWrite* wr, Direction d);
// Writes 'd' into 'wr'.
-void WriteDirection8_allow_null(StreamWrite* wr, Direction d);
+void write_direction_8_allow_null(StreamWrite* wr, Direction d);
// Writes 'c' to 'wr'.
-void WriteCoords32(StreamWrite* wr, const Coords& c);
+void write_coords_32(StreamWrite* wr, const Coords& c);
// Writes 'area' to 'wr'.
-void WriteArea48(StreamWrite* wr, Area<Coords, uint16_t> const area);
+void write_area_48(StreamWrite* wr, Area<Coords, uint16_t> const area);
} // namespace Widelands
=== modified file 'src/logic/worker.cc'
--- src/logic/worker.cc 2014-09-18 18:56:20 +0000
+++ src/logic/worker.cc 2014-09-29 13:33:11 +0000
@@ -611,7 +611,7 @@
bool Worker::run_walk(Game & game, State & state, const Action & action)
{
BaseImmovable const * const imm = game.map()[get_position()].get_immovable();
- Coords dest(Coords::Null());
+ Coords dest(Coords::null());
bool forceonlast = false;
int32_t max_steps = -1;
@@ -975,7 +975,7 @@
* Demand from the g_sound_handler to play a certain sound effect.
* Whether the effect actually gets played is decided only by the sound server.
*/
-bool Worker::run_playFX(Game & game, State & state, const Action & action)
+bool Worker::run_playfx(Game & game, State & state, const Action & action)
{
g_sound_handler.play_fx(action.sparam1, get_position(), action.iparam1);
@@ -2945,17 +2945,17 @@
{
Bob::Loader::load(fr);
- uint8_t version = fr.Unsigned8();
+ uint8_t version = fr.unsigned_8();
if (!(1 <= version && version <= WORKER_SAVEGAME_VERSION))
throw GameDataError("unknown/unhandled version %u", version);
Worker & worker = get<Worker>();
- m_location = fr.Unsigned32();
- m_carried_ware = fr.Unsigned32();
- worker.m_current_exp = fr.Signed32();
+ m_location = fr.unsigned_32();
+ m_carried_ware = fr.unsigned_32();
+ worker.m_current_exp = fr.signed_32();
if (version >= 2) {
- if (fr.Unsigned8()) {
+ if (fr.unsigned_8()) {
worker.m_transfer =
new Transfer(ref_cast<Game, EditorGameBase>(egbase()), worker);
worker.m_transfer->read(fr, m_transfer);
@@ -3035,8 +3035,8 @@
{
try {
// header has already been read by caller
- std::string tribename = fr.CString();
- std::string name = fr.CString();
+ std::string tribename = fr.c_string();
+ std::string name = fr.c_string();
egbase.manually_load_tribe(tribename);
@@ -3065,9 +3065,9 @@
void Worker::save
(EditorGameBase & egbase, MapObjectSaver & mos, FileWrite & fw)
{
- fw.Unsigned8(HeaderWorker);
- fw.CString(descr().tribe().name());
- fw.CString(descr().name());
+ fw.unsigned_8(HeaderWorker);
+ fw.c_string(descr().tribe().name());
+ fw.c_string(descr().name());
do_save(egbase, mos, fw);
}
@@ -3084,16 +3084,16 @@
{
Bob::save(egbase, mos, fw);
- fw.Unsigned8(WORKER_SAVEGAME_VERSION);
- fw.Unsigned32(mos.get_object_file_index_or_zero(m_location.get(egbase)));
- fw.Unsigned32(mos.get_object_file_index_or_zero(m_carried_ware.get(egbase)));
- fw.Signed32(m_current_exp);
+ fw.unsigned_8(WORKER_SAVEGAME_VERSION);
+ fw.unsigned_32(mos.get_object_file_index_or_zero(m_location.get(egbase)));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(m_carried_ware.get(egbase)));
+ fw.signed_32(m_current_exp);
if (m_transfer) {
- fw.Unsigned8(1);
+ fw.unsigned_8(1);
m_transfer->write(mos, fw);
} else {
- fw.Unsigned8(0);
+ fw.unsigned_8(0);
}
}
=== modified file 'src/logic/worker.h'
--- src/logic/worker.h 2014-09-14 14:36:56 +0000
+++ src/logic/worker.h 2014-09-29 13:33:11 +0000
@@ -239,7 +239,7 @@
bool run_geologist (Game &, State &, const Action &);
bool run_geologist_find (Game &, State &, const Action &);
bool run_scout (Game &, State &, const Action &);
- bool run_playFX (Game &, State &, const Action &);
+ bool run_playfx (Game &, State &, const Action &);
bool run_construct (Game &, State &, const Action &);
OPtr<PlayerImmovable> m_location; ///< meta location of the worker
=== modified file 'src/logic/worker_descr.cc'
--- src/logic/worker_descr.cc 2014-09-10 10:18:46 +0000
+++ src/logic/worker_descr.cc 2014-09-29 13:33:11 +0000
@@ -36,13 +36,13 @@
namespace Widelands {
WorkerDescr::WorkerDescr
- (const MapObjectType type, char const * const _name, char const * const _descname,
+ (const MapObjectType object_type, char const * const _name, char const * const _descname,
const std::string & directory, Profile & prof, Section & global_s,
const TribeDescr & _tribe)
:
- BobDescr(type, _name, _descname, &_tribe),
+ BobDescr(object_type, _name, _descname, &_tribe),
m_helptext (global_s.get_string("help", "")),
- m_ware_hotspot (global_s.get_Point("ware_hotspot", Point(0, 15))),
+ m_ware_hotspot (global_s.get_point("ware_hotspot", Point(0, 15))),
m_icon_fname (directory + "/menu.png"),
m_icon (nullptr),
m_buildable (false),
=== modified file 'src/logic/worker_descr.h'
--- src/logic/worker_descr.h 2014-09-14 11:31:58 +0000
+++ src/logic/worker_descr.h 2014-09-29 13:33:11 +0000
@@ -125,7 +125,7 @@
int32_t m_needed_experience;
/**
- * Type that this worker can become, i.e. level up to (or Null).
+ * Type that this worker can become, i.e. level up to (or null).
*/
WareIndex m_becomes;
Programs m_programs;
=== modified file 'src/logic/worker_program.cc'
--- src/logic/worker_program.cc 2014-09-09 17:15:20 +0000
+++ src/logic/worker_program.cc 2014-09-29 13:33:11 +0000
@@ -47,7 +47,7 @@
{"geologist", &WorkerProgram::parse_geologist},
{"geologist-find", &WorkerProgram::parse_geologist_find},
{"scout", &WorkerProgram::parse_scout},
- {"playFX", &WorkerProgram::parse_playFX},
+ {"playFX", &WorkerProgram::parse_play_fx},
{"construct", &WorkerProgram::parse_construct},
{nullptr, nullptr}
@@ -636,7 +636,7 @@
act->function = &Worker::run_scout;
}
-void WorkerProgram::parse_playFX
+void WorkerProgram::parse_play_fx
(WorkerDescr *,
Worker::Action * act,
Parser * parser,
@@ -649,7 +649,7 @@
g_sound_handler.load_fx_if_needed(parser->directory, cmd[1], act->sparam1);
- act->function = &Worker::run_playFX;
+ act->function = &Worker::run_playfx;
act->iparam1 =
cmd.size() == 2 ?
64 : // 50% chance to play, only one instance at a time
=== modified file 'src/logic/worker_program.h'
--- src/logic/worker_program.h 2014-09-14 14:36:56 +0000
+++ src/logic/worker_program.h 2014-09-29 13:33:11 +0000
@@ -151,7 +151,7 @@
Worker::Action *,
Parser *,
const std::vector<std::string> & cmd);
- void parse_playFX
+ void parse_play_fx
(WorkerDescr *,
Worker::Action *,
Parser *,
=== modified file 'src/logic/world/editor_category.cc'
--- src/logic/world/editor_category.cc 2014-09-09 17:15:20 +0000
+++ src/logic/world/editor_category.cc 2014-09-29 13:33:11 +0000
@@ -30,7 +30,7 @@
: name_(table.get_string("name")),
descname_(table.get_string("descname")),
image_file_(table.get_string("picture")) {
- if (!g_fs->FileExists(image_file_)) {
+ if (!g_fs->file_exists(image_file_)) {
throw GameDataError("EditorCategory %s has non-existing \"picture\".", name_.c_str());
}
}
=== modified file 'src/logic/world/map_gen.cc'
--- src/logic/world/map_gen.cc 2014-09-10 10:18:46 +0000
+++ src/logic/world/map_gen.cc 2014-09-29 13:33:11 +0000
@@ -36,7 +36,7 @@
}
const MapGenBobCategory*
-MapGenLandResource::getBobCategory(MapGenAreaInfo::MapGenTerrainType terrType) const {
+MapGenLandResource::get_bob_category(MapGenAreaInfo::MapGenTerrainType terrType) const {
switch (terrType) {
case MapGenAreaInfo::ttLandCoast:
return land_coast_bob_category_;
@@ -66,7 +66,7 @@
*our_pointer = nullptr;
return;
}
- *our_pointer = mapGenInfo.getBobCategory(value);
+ *our_pointer = mapGenInfo.get_bob_category(value);
};
do_assign("land_coast_bobs", &land_coast_bob_category_);
@@ -116,7 +116,7 @@
}
}
-size_t MapGenAreaInfo::getNumTerrains(MapGenTerrainType const terrType) const {
+size_t MapGenAreaInfo::get_num_terrains(MapGenTerrainType const terrType) const {
switch (terrType) {
case ttWaterOcean:
return terrains1_.size();
@@ -149,7 +149,7 @@
}
}
-TerrainIndex MapGenAreaInfo::getTerrain(MapGenTerrainType const terrType,
+TerrainIndex MapGenAreaInfo::get_terrain(MapGenTerrainType const terrType,
uint32_t const index) const {
switch (terrType) {
case ttWaterOcean:
@@ -183,41 +183,41 @@
}
}
-uint32_t MapGenInfo::getSumLandWeight() const {
+uint32_t MapGenInfo::get_sum_land_weight() const {
if (land_weight_valid_)
return land_weight_;
uint32_t sum = 0;
- for (uint32_t ix = 0; ix < getNumAreas(MapGenAreaInfo::atLand); ++ix)
- sum += getArea(MapGenAreaInfo::atLand, ix).getWeight();
+ for (uint32_t ix = 0; ix < get_num_areas(MapGenAreaInfo::atLand); ++ix)
+ sum += get_area(MapGenAreaInfo::atLand, ix).get_weight();
land_weight_ = sum;
land_weight_valid_ = true;
return land_weight_;
}
-const MapGenLandResource& MapGenInfo::getLandResource(size_t index) const {
+const MapGenLandResource& MapGenInfo::get_land_resource(size_t index) const {
return land_resources_[index];
}
-size_t MapGenInfo::getNumLandResources() const {
+size_t MapGenInfo::get_num_land_resources() const {
return land_resources_.size();
}
-uint32_t MapGenInfo::getSumLandResourceWeight() const {
+uint32_t MapGenInfo::get_sum_land_resource_weight() const {
if (sum_bob_area_weights_valid_)
return sum_bob_area_weights_;
uint32_t sum = 0;
for (uint32_t ix = 0; ix < land_resources_.size(); ++ix)
- sum += land_resources_[ix].getWeight();
+ sum += land_resources_[ix].get_weight();
sum_bob_area_weights_ = sum;
sum_bob_area_weights_valid_ = true;
return sum_bob_area_weights_;
}
-size_t MapGenInfo::getNumAreas(MapGenAreaInfo::MapGenAreaType const areaType) const {
+size_t MapGenInfo::get_num_areas(MapGenAreaInfo::MapGenAreaType const areaType) const {
switch (areaType) {
case MapGenAreaInfo::atWater:
return water_areas_.size();
@@ -232,7 +232,7 @@
}
}
-const MapGenAreaInfo& MapGenInfo::getArea(MapGenAreaInfo::MapGenAreaType const areaType,
+const MapGenAreaInfo& MapGenInfo::get_area(MapGenAreaInfo::MapGenAreaType const areaType,
uint32_t const index) const {
switch (areaType) {
case MapGenAreaInfo::atWater:
@@ -248,7 +248,7 @@
}
}
-const MapGenBobCategory* MapGenInfo::getBobCategory(const std::string& bobCategory) const {
+const MapGenBobCategory* MapGenInfo::get_bob_category(const std::string& bobCategory) const {
if (bob_categories_.find(bobCategory) == bob_categories_.end())
throw wexception("invalid MapGenBobCategory %s", bobCategory.c_str());
// Ugly workaround because at is not defined for some systems
@@ -327,59 +327,59 @@
}
}
- if (getNumAreas(MapGenAreaInfo::atWater) < 1)
+ if (get_num_areas(MapGenAreaInfo::atWater) < 1)
throw GameDataError("missing a water area");
- if (getNumAreas(MapGenAreaInfo::atWater) > 3)
+ if (get_num_areas(MapGenAreaInfo::atWater) > 3)
throw GameDataError("too many water areas (>3)");
- if (getNumAreas(MapGenAreaInfo::atLand) < 1)
+ if (get_num_areas(MapGenAreaInfo::atLand) < 1)
throw GameDataError("missing a land area");
- if (getNumAreas(MapGenAreaInfo::atLand) > 3)
+ if (get_num_areas(MapGenAreaInfo::atLand) > 3)
throw GameDataError("too many land areas (>3)");
- if (getNumAreas(MapGenAreaInfo::atWasteland) < 1)
+ if (get_num_areas(MapGenAreaInfo::atWasteland) < 1)
throw GameDataError("missing a wasteland area");
- if (getNumAreas(MapGenAreaInfo::atWasteland) > 2)
+ if (get_num_areas(MapGenAreaInfo::atWasteland) > 2)
throw GameDataError("too many wasteland areas (>2)");
- if (getNumAreas(MapGenAreaInfo::atMountains) < 1)
+ if (get_num_areas(MapGenAreaInfo::atMountains) < 1)
throw GameDataError("missing a mountain area");
- if (getNumAreas(MapGenAreaInfo::atMountains) > 1)
+ if (get_num_areas(MapGenAreaInfo::atMountains) > 1)
throw GameDataError("too many mountain areas (>1)");
- if (getArea(MapGenAreaInfo::atWater, 0).getNumTerrains(MapGenAreaInfo::ttWaterOcean) < 1)
+ if (get_area(MapGenAreaInfo::atWater, 0).get_num_terrains(MapGenAreaInfo::ttWaterOcean) < 1)
throw GameDataError("missing a water/ocean terrain type");
- if (getArea(MapGenAreaInfo::atWater, 0).getNumTerrains(MapGenAreaInfo::ttWaterShelf) < 1)
+ if (get_area(MapGenAreaInfo::atWater, 0).get_num_terrains(MapGenAreaInfo::ttWaterShelf) < 1)
throw GameDataError("missing a water/shelf terrain type");
- if (getArea(MapGenAreaInfo::atWater, 0).getNumTerrains(MapGenAreaInfo::ttWaterShallow) < 1)
+ if (get_area(MapGenAreaInfo::atWater, 0).get_num_terrains(MapGenAreaInfo::ttWaterShallow) < 1)
throw GameDataError("is missing a water/shallow terrain type");
- if (getArea(MapGenAreaInfo::atLand, 0).getNumTerrains(MapGenAreaInfo::ttLandCoast) < 1)
+ if (get_area(MapGenAreaInfo::atLand, 0).get_num_terrains(MapGenAreaInfo::ttLandCoast) < 1)
throw GameDataError("missing a land/coast terrain type");
- if (getArea(MapGenAreaInfo::atLand, 0).getNumTerrains(MapGenAreaInfo::ttLandLand) < 1)
+ if (get_area(MapGenAreaInfo::atLand, 0).get_num_terrains(MapGenAreaInfo::ttLandLand) < 1)
throw GameDataError("missing a land/land terrain type");
- if (getArea(MapGenAreaInfo::atMountains, 0).getNumTerrains(MapGenAreaInfo::ttMountainsFoot) < 1)
+ if (get_area(MapGenAreaInfo::atMountains, 0).get_num_terrains(MapGenAreaInfo::ttMountainsFoot) < 1)
throw GameDataError("missing a mountain/foot terrain type");
- if (getArea(MapGenAreaInfo::atMountains, 0).getNumTerrains(MapGenAreaInfo::ttMountainsMountain) <
+ if (get_area(MapGenAreaInfo::atMountains, 0).get_num_terrains(MapGenAreaInfo::ttMountainsMountain) <
1)
throw GameDataError("missing a monutain/mountain terrain type");
- if (getArea(MapGenAreaInfo::atMountains, 0).getNumTerrains(MapGenAreaInfo::ttMountainsSnow) < 1)
+ if (get_area(MapGenAreaInfo::atMountains, 0).get_num_terrains(MapGenAreaInfo::ttMountainsSnow) < 1)
throw GameDataError("missing a mountain/snow terrain type");
- if (getArea(MapGenAreaInfo::atWasteland, 0).getNumTerrains(MapGenAreaInfo::ttWastelandInner) < 1)
+ if (get_area(MapGenAreaInfo::atWasteland, 0).get_num_terrains(MapGenAreaInfo::ttWastelandInner) < 1)
throw GameDataError("missing a land/coast terrain type");
- if (getArea(MapGenAreaInfo::atWasteland, 0).getNumTerrains(MapGenAreaInfo::ttWastelandOuter) < 1)
+ if (get_area(MapGenAreaInfo::atWasteland, 0).get_num_terrains(MapGenAreaInfo::ttWastelandOuter) < 1)
throw GameDataError("missing a land/land terrain type");
}
=== modified file 'src/logic/world/map_gen.h'
--- src/logic/world/map_gen.h 2014-09-10 10:18:46 +0000
+++ src/logic/world/map_gen.h 2014-09-29 13:33:11 +0000
@@ -62,9 +62,9 @@
MapGenAreaInfo(const LuaTable& table, const World& world, MapGenAreaType areaType);
- size_t getNumTerrains(MapGenTerrainType) const;
- TerrainIndex getTerrain(MapGenTerrainType terrType, uint32_t index) const;
- uint32_t getWeight() const {return weight_;}
+ size_t get_num_terrains(MapGenTerrainType) const;
+ TerrainIndex get_terrain(MapGenTerrainType terrType, uint32_t index) const;
+ uint32_t get_weight() const {return weight_;}
private:
std::vector<TerrainIndex> terrains1_; // ocean, coast, inner or foot
@@ -96,12 +96,12 @@
struct MapGenLandResource {
MapGenLandResource(const LuaTable& table, MapGenInfo& mapGenInfo);
- uint32_t getWeight() const {return weight_;}
- const MapGenBobCategory * getBobCategory
+ uint32_t get_weight() const {return weight_;}
+ const MapGenBobCategory * get_bob_category
(MapGenAreaInfo::MapGenTerrainType terrType) const;
- uint8_t getImmovableDensity() const {return immovable_density_;}
- uint8_t getMoveableDensity() const {return critter_density_;}
+ uint8_t get_immovable_density() const {return immovable_density_;}
+ uint8_t get_moveable_density() const {return critter_density_;}
private:
uint32_t weight_;
@@ -122,27 +122,27 @@
struct MapGenInfo {
MapGenInfo(const LuaTable& table, const World& world);
- size_t getNumAreas(MapGenAreaInfo::MapGenAreaType areaType) const;
- const MapGenAreaInfo & getArea
+ size_t get_num_areas(MapGenAreaInfo::MapGenAreaType areaType) const;
+ const MapGenAreaInfo & get_area
(MapGenAreaInfo::MapGenAreaType const areaType, uint32_t const index)
const;
- const MapGenBobCategory * getBobCategory(const std::string & bobCategory) const;
-
- uint8_t getWaterOceanHeight () const {return ocean_height_;}
- uint8_t getWaterShelfHeight () const {return shelf_height_;}
- uint8_t getWaterShallowHeight() const {return shallow_height_;}
- uint8_t getLandCoastHeight () const {return coast_height_;}
- uint8_t getLandUpperHeight () const {return upperland_height_;}
- uint8_t getMountainFootHeight() const {return mountainfoot_height_;}
- uint8_t getMountainHeight () const {return mountain_height_;}
- uint8_t getSnowHeight () const {return snow_height_;}
- uint8_t getSummitHeight () const {return summit_height_;}
-
- uint32_t getSumLandWeight() const;
-
- size_t getNumLandResources() const;
- const MapGenLandResource & getLandResource(size_t index) const;
- uint32_t getSumLandResourceWeight() const;
+ const MapGenBobCategory * get_bob_category(const std::string & bobCategory) const;
+
+ uint8_t get_water_ocean_height () const {return ocean_height_;}
+ uint8_t get_water_shelf_height () const {return shelf_height_;}
+ uint8_t get_water_shallow_height() const {return shallow_height_;}
+ uint8_t get_land_coast_height () const {return coast_height_;}
+ uint8_t get_land_upper_height () const {return upperland_height_;}
+ uint8_t get_mountain_foot_height() const {return mountainfoot_height_;}
+ uint8_t get_mountain_height () const {return mountain_height_;}
+ uint8_t get_snow_height () const {return snow_height_;}
+ uint8_t get_summit_height () const {return summit_height_;}
+
+ uint32_t get_sum_land_weight() const;
+
+ size_t get_num_land_resources() const;
+ const MapGenLandResource & get_land_resource(size_t index) const;
+ uint32_t get_sum_land_resource_weight() const;
private:
std::vector<MapGenAreaInfo> water_areas_;
=== modified file 'src/logic/world/terrain_description.cc'
--- src/logic/world/terrain_description.cc 2014-09-10 10:18:46 +0000
+++ src/logic/world/terrain_description.cc 2014-09-29 13:33:11 +0000
@@ -33,7 +33,7 @@
namespace {
// Parse a terrain type from the giving string.
-TerrainDescription::Type TerrainTypeFromString(const std::string& type) {
+TerrainDescription::Type terrain_type_from_string(const std::string& type) {
if (type == "green") {
return TerrainDescription::GREEN;
}
@@ -68,7 +68,7 @@
TerrainDescription::TerrainDescription(const LuaTable& table, const Widelands::World& world)
: name_(table.get_string("name")),
descname_(table.get_string("descname")),
- is_(TerrainTypeFromString(table.get_string("is"))),
+ is_(terrain_type_from_string(table.get_string("is"))),
default_resource_index_(world.get_resource(table.get_string("default_resource").c_str())),
default_resource_amount_(table.get_int("default_resource_amount")),
dither_layer_(table.get_int("dither_layer")),
=== modified file 'src/map_io/map_allowed_building_types_packet.cc'
--- src/map_io/map_allowed_building_types_packet.cc 2014-09-10 08:55:04 +0000
+++ src/map_io/map_allowed_building_types_packet.cc 2014-09-29 13:33:11 +0000
@@ -30,7 +30,7 @@
#define CURRENT_PACKET_VERSION 1
-void MapAllowedBuildingTypesPacket::Read
+void MapAllowedBuildingTypesPacket::read
(FileSystem & fs,
EditorGameBase & egbase,
bool const skip,
@@ -97,7 +97,7 @@
}
-void MapAllowedBuildingTypesPacket::Write
+void MapAllowedBuildingTypesPacket::write
(FileSystem & fs, EditorGameBase & egbase, MapObjectSaver &)
{
Profile prof;
=== modified file 'src/map_io/map_allowed_worker_types_packet.cc'
--- src/map_io/map_allowed_worker_types_packet.cc 2014-09-10 10:18:46 +0000
+++ src/map_io/map_allowed_worker_types_packet.cc 2014-09-29 13:33:11 +0000
@@ -30,7 +30,7 @@
#define CURRENT_PACKET_VERSION 1
-void MapAllowedWorkerTypesPacket::Read
+void MapAllowedWorkerTypesPacket::read
(FileSystem & fs,
EditorGameBase & egbase,
bool skip,
@@ -82,7 +82,7 @@
}
-void MapAllowedWorkerTypesPacket::Write
+void MapAllowedWorkerTypesPacket::write
(FileSystem & fs, EditorGameBase & egbase, MapObjectSaver &)
{
Profile prof;
=== modified file 'src/map_io/map_bob_packet.cc'
--- src/map_io/map_bob_packet.cc 2014-09-10 16:57:31 +0000
+++ src/map_io/map_bob_packet.cc 2014-09-29 13:33:11 +0000
@@ -31,16 +31,16 @@
#define CURRENT_PACKET_VERSION 1
-void MapBobPacket::ReadBob(FileRead& fr,
+void MapBobPacket::read_bob(FileRead& fr,
EditorGameBase& egbase,
MapObjectLoader&,
Coords const coords,
const OneWorldLegacyLookupTable& lookup_table) {
- const std::string owner = fr.CString();
- char const* const read_name = fr.CString();
- uint8_t subtype = fr.Unsigned8();
+ const std::string owner = fr.c_string();
+ char const* const read_name = fr.c_string();
+ uint8_t subtype = fr.unsigned_8();
constexpr uint8_t kLegacyCritterType = 0;
- Serial const serial = fr.Unsigned32();
+ Serial const serial = fr.unsigned_32();
if (subtype != kLegacyCritterType || owner != "world") {
throw GameDataError("unknown legacy bob %s/%s", owner.c_str(), read_name);
@@ -67,23 +67,23 @@
}
}
-void MapBobPacket::Read(FileSystem& fs,
+void MapBobPacket::read(FileSystem& fs,
EditorGameBase& egbase,
MapObjectLoader& mol,
const OneWorldLegacyLookupTable& lookup_table) {
FileRead fr;
- fr.Open(fs, "binary/bob");
+ fr.open(fs, "binary/bob");
Map& map = egbase.map();
map.recalc_whole_map(egbase.world()); // for movecaps checks in ReadBob
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == CURRENT_PACKET_VERSION)
for (uint16_t y = 0; y < map.get_height(); ++y) {
for (uint16_t x = 0; x < map.get_width(); ++x) {
- uint32_t const nr_bobs = fr.Unsigned32();
+ uint32_t const nr_bobs = fr.unsigned_32();
for (uint32_t i = 0; i < nr_bobs; ++i)
- ReadBob(fr, egbase, mol, Coords(x, y), lookup_table);
+ read_bob(fr, egbase, mol, Coords(x, y), lookup_table);
}
}
else
=== modified file 'src/map_io/map_bob_packet.h'
--- src/map_io/map_bob_packet.h 2014-09-10 16:57:31 +0000
+++ src/map_io/map_bob_packet.h 2014-09-29 13:33:11 +0000
@@ -34,13 +34,13 @@
// This data packet contains critters on old maps. These days, the bobs are saved in the map_objects
// packet.
struct MapBobPacket {
- void Read(FileSystem&,
+ void read(FileSystem&,
EditorGameBase&,
MapObjectLoader&,
const OneWorldLegacyLookupTable& lookup_table);
private:
- void ReadBob(FileRead&,
+ void read_bob(FileRead&,
EditorGameBase&,
MapObjectLoader&,
Coords,
=== modified file 'src/map_io/map_building_packet.cc'
--- src/map_io/map_building_packet.cc 2014-09-14 11:31:58 +0000
+++ src/map_io/map_building_packet.cc 2014-09-29 13:33:11 +0000
@@ -42,7 +42,7 @@
#define CURRENT_PACKET_VERSION 3
-void MapBuildingPacket::Read
+void MapBuildingPacket::read
(FileSystem & fs,
EditorGameBase & egbase,
bool const skip,
@@ -51,10 +51,10 @@
if (skip)
return;
FileRead fr;
- try {fr.Open(fs, "binary/building");} catch (...) {return;}
+ try {fr.open(fs, "binary/building");} catch (...) {return;}
InteractiveBase & ibase = *egbase.get_ibase();
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version >= LOWEST_SUPPORTED_VERSION) {
Map & map = egbase.map();
uint16_t const width = map.get_width ();
@@ -62,11 +62,11 @@
FCoords c;
for (c.y = 0; c.y < height; ++c.y) {
for (c.x = 0; c.x < width; ++c.x) {
- if (fr.Unsigned8()) {
- PlayerNumber const p = fr.Unsigned8 ();
- Serial const serial = fr.Unsigned32();
- char const * const name = fr.CString ();
- uint8_t const special_type = fr.Unsigned8 ();
+ if (fr.unsigned_8()) {
+ PlayerNumber const p = fr.unsigned_8 ();
+ Serial const serial = fr.unsigned_32();
+ char const * const name = fr.c_string ();
+ uint8_t const special_type = fr.unsigned_8 ();
// No building lives on more than one main place.
@@ -117,13 +117,13 @@
/*
* Write Function
*/
-void MapBuildingPacket::Write
+void MapBuildingPacket::write
(FileSystem & fs, EditorGameBase & egbase, MapObjectSaver & mos)
{
FileWrite fw;
// now packet version
- fw.Unsigned16(CURRENT_PACKET_VERSION);
+ fw.unsigned_16(CURRENT_PACKET_VERSION);
// Write buildings and owner, register this with the map_object_saver so that
// it's data can be saved later.
@@ -136,30 +136,30 @@
// Buildings can life on only one main position.
assert(!mos.is_object_known(*building));
- fw.Unsigned8(1);
- fw.Unsigned8(building->owner().player_number());
- fw.Unsigned32(mos.register_object(*building));
+ fw.unsigned_8(1);
+ fw.unsigned_8(building->owner().player_number());
+ fw.unsigned_32(mos.register_object(*building));
upcast(PartiallyFinishedBuilding const, pfb, building);
- fw.CString
+ fw.c_string
((pfb ? *pfb->m_building : building->descr())
.name().c_str());
if (!pfb)
- fw.Unsigned8(0);
+ fw.unsigned_8(0);
else {
if (is_a(ConstructionSite, pfb))
- fw.Unsigned8(1);
+ fw.unsigned_8(1);
else // DismantleSite
- fw.Unsigned8(2);
+ fw.unsigned_8(2);
}
write_priorities(*building, fw);
} else
- fw.Unsigned8(0);
+ fw.unsigned_8(0);
}
- fw.Write(fs, "binary/building");
+ fw.write(fs, "binary/building");
// DONE
}
@@ -168,7 +168,7 @@
(const Building & building, FileWrite & fw)
{
// Used to be base_priority which is no longer used. Remove after b20.
- fw.Unsigned32(0);
+ fw.unsigned_32(0);
std::map<int32_t, std::map<WareIndex, int32_t> > type_to_priorities;
std::map<int32_t, std::map<WareIndex, int32_t> >::iterator it;
@@ -182,8 +182,8 @@
// write ware type and priority count
const int32_t ware_type = it->first;
- fw.Unsigned8(ware_type);
- fw.Unsigned8(it->second.size());
+ fw.unsigned_8(ware_type);
+ fw.unsigned_8(it->second.size());
std::map<WareIndex, int32_t>::iterator it2;
for (it2 = it->second.begin(); it2 != it->second.end(); ++it2)
@@ -199,38 +199,38 @@
("unrecognized ware type %d while writing priorities",
ware_type);
- fw.CString(name.c_str());
- fw.Unsigned32(it2->second);
+ fw.c_string(name.c_str());
+ fw.unsigned_32(it2->second);
}
}
// write 0xff so the end can be easily identified
- fw.Unsigned8(0xff);
+ fw.unsigned_8(0xff);
}
void MapBuildingPacket::read_priorities
(Building & building, FileRead & fr)
{
- fr.Unsigned32(); // unused, was base_priority which is unused. Remove after b20.
+ fr.unsigned_32(); // unused, was base_priority which is unused. Remove after b20.
const TribeDescr & tribe = building.descr().tribe();
int32_t ware_type = -1;
// read ware type
- while (0xff != (ware_type = fr.Unsigned8())) {
+ while (0xff != (ware_type = fr.unsigned_8())) {
// read count of priorities assigned for this ware type
- const uint8_t count = fr.Unsigned8();
+ const uint8_t count = fr.unsigned_8();
for (uint8_t i = 0; i < count; ++i) {
WareIndex idx;
if (wwWARE == ware_type)
- idx = tribe.safe_ware_index(fr.CString());
+ idx = tribe.safe_ware_index(fr.c_string());
else if (wwWORKER == ware_type)
- idx = tribe.safe_worker_index(fr.CString());
+ idx = tribe.safe_worker_index(fr.c_string());
else
throw GameDataError
("unrecognized ware type %d while reading priorities",
ware_type);
- building.set_priority(ware_type, idx, fr.Unsigned32());
+ building.set_priority(ware_type, idx, fr.unsigned_32());
}
}
}
=== modified file 'src/map_io/map_building_packet.h'
--- src/map_io/map_building_packet.h 2014-09-10 16:57:31 +0000
+++ src/map_io/map_building_packet.h 2014-09-29 13:33:11 +0000
@@ -34,8 +34,8 @@
* on the map, the data is parsed somewhere else
*/
struct MapBuildingPacket {
- void Read(FileSystem&, EditorGameBase&, bool, MapObjectLoader&);
- void Write(FileSystem&, EditorGameBase&, MapObjectSaver&);
+ void read(FileSystem&, EditorGameBase&, bool, MapObjectLoader&);
+ void write(FileSystem&, EditorGameBase&, MapObjectSaver&);
protected:
void read_priorities (Building &, FileRead &);
=== modified file 'src/map_io/map_buildingdata_packet.cc'
--- src/map_io/map_buildingdata_packet.cc 2014-09-14 11:31:58 +0000
+++ src/map_io/map_buildingdata_packet.cc 2014-09-29 13:33:11 +0000
@@ -66,7 +66,7 @@
#define CURRENT_TRAININGSITE_PACKET_VERSION 4
-void MapBuildingdataPacket::Read
+void MapBuildingdataPacket::read
(FileSystem & fs,
EditorGameBase & egbase,
bool const skip,
@@ -76,17 +76,17 @@
return;
FileRead fr;
- try {fr.Open(fs, "binary/building_data");} catch (...) {return;}
+ try {fr.open(fs, "binary/building_data");} catch (...) {return;}
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (1 <= packet_version && packet_version <= CURRENT_PACKET_VERSION) {
for (;;) {
- if (2 <= packet_version && fr.EndOfFile())
+ if (2 <= packet_version && fr.end_of_file())
break;
- Serial const serial = fr.Unsigned32();
+ Serial const serial = fr.unsigned_32();
if (packet_version < 2 && serial == 0xffffffff) {
- if (!fr.EndOfFile())
+ if (!fr.end_of_file())
throw GameDataError
("expected end of file after serial 0xffffffff");
break;
@@ -94,8 +94,8 @@
try {
Building & building = mol.get<Building>(serial);
- if (fr.Unsigned8()) {
- char const * const animation_name = fr.CString();
+ if (fr.unsigned_8()) {
+ char const * const animation_name = fr.c_string();
try {
building.m_anim =
building.descr().get_animation(animation_name);
@@ -110,17 +110,17 @@
}
} else
building.m_anim = 0;
- building.m_animstart = fr.Unsigned32();
+ building.m_animstart = fr.unsigned_32();
{
Building::LeaveQueue & leave_queue = building.m_leave_queue;
- leave_queue.resize(fr.Unsigned16());
+ leave_queue.resize(fr.unsigned_16());
for (Building::LeaveQueue::iterator queue_iter = leave_queue.begin();
queue_iter != leave_queue.end();
++queue_iter) {
- if (uint32_t const leaver_serial = fr.Unsigned32())
+ if (uint32_t const leaver_serial = fr.unsigned_32())
try {
// The check that this worker actually has a
// leavebuilding task for this building is in
@@ -140,9 +140,9 @@
}
}
- building.m_leave_time = fr.Unsigned32();
+ building.m_leave_time = fr.unsigned_32();
- if (uint32_t const leaver_serial = fr.Unsigned32())
+ if (uint32_t const leaver_serial = fr.unsigned_32())
try {
building.m_leave_allow =
&mol.get<MapObject>(leaver_serial);
@@ -157,8 +157,8 @@
// For former versions, the former buildings vector
// will be built after other data are loaded, see below.
// read_formerbuildings_v2()
- while (fr.Unsigned8()) {
- BuildingIndex oldidx = building.descr().tribe().safe_building_index(fr.CString());
+ while (fr.unsigned_8()) {
+ BuildingIndex oldidx = building.descr().tribe().safe_building_index(fr.c_string());
building.m_old_buildings.push_back(oldidx);
}
// Only construction sites may have an empty list
@@ -168,7 +168,7 @@
"Your savegame is corrupted", building.descr().descname().c_str(), building.serial());
}
}
- if (fr.Unsigned8()) {
+ if (fr.unsigned_8()) {
if (upcast(ProductionSite, productionsite, &building))
if (dynamic_cast<MilitarySite const *>(productionsite)) {
log
@@ -302,25 +302,25 @@
MapObjectLoader & mol)
{
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == CURRENT_PARTIALLYFB_PACKET_VERSION) {
const TribeDescr & tribe = pfb.descr().tribe();
pfb.m_building =
- tribe.get_building_descr(tribe.safe_building_index(fr.CString()));
+ tribe.get_building_descr(tribe.safe_building_index(fr.c_string()));
delete pfb.m_builder_request;
- if (fr.Unsigned8()) {
+ if (fr.unsigned_8()) {
pfb.m_builder_request =
new Request
(pfb,
0,
PartiallyFinishedBuilding::request_builder_callback,
wwWORKER);
- pfb.m_builder_request->Read(fr, game, mol);
+ pfb.m_builder_request->read(fr, game, mol);
} else
pfb.m_builder_request = nullptr;
- if (uint32_t const builder_serial = fr.Unsigned32()) {
+ if (uint32_t const builder_serial = fr.unsigned_32()) {
try {
pfb.m_builder = &mol.get<Worker>(builder_serial);
} catch (const WException & e) {
@@ -331,23 +331,23 @@
pfb.m_builder = nullptr;
try {
- uint16_t const size = fr.Unsigned16();
+ uint16_t const size = fr.unsigned_16();
pfb.m_wares.resize(size);
for (uint16_t i = 0; i < pfb.m_wares.size(); ++i)
{
pfb.m_wares[i] =
new WaresQueue
(pfb, INVALID_INDEX, 0);
- pfb.m_wares[i]->Read(fr, game, mol);
+ pfb.m_wares[i]->read(fr, game, mol);
}
} catch (const WException & e) {
throw GameDataError("wares: %s", e.what());
}
- pfb.m_working = fr.Unsigned8 ();
- pfb.m_work_steptime = fr.Unsigned32();
- pfb.m_work_completed = fr.Unsigned32();
- pfb.m_work_steps = fr.Unsigned32();
+ pfb.m_working = fr.unsigned_8 ();
+ pfb.m_work_steptime = fr.unsigned_32();
+ pfb.m_work_completed = fr.unsigned_32();
+ pfb.m_work_steps = fr.unsigned_32();
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -363,7 +363,7 @@
MapObjectLoader & mol)
{
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == 1)
return read_constructionsite_v1(constructionsite, fr, game, mol);
@@ -381,13 +381,13 @@
}
if (packet_version <= 2) {
- if (fr.Unsigned8()) {
- BuildingIndex idx = tribe.safe_building_index(fr.CString());
+ if (fr.unsigned_8()) {
+ BuildingIndex idx = tribe.safe_building_index(fr.c_string());
constructionsite.m_old_buildings.push_back(idx);
}
}
- constructionsite.m_fetchfromflag = fr. Signed32();
+ constructionsite.m_fetchfromflag = fr. signed_32();
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -404,25 +404,25 @@
{
const TribeDescr & tribe = constructionsite.descr().tribe();
constructionsite.m_building =
- tribe.get_building_descr(tribe.safe_building_index(fr.CString()));
- if (fr.Unsigned8()) {
- BuildingIndex bidx = tribe.safe_building_index(fr.CString());
+ tribe.get_building_descr(tribe.safe_building_index(fr.c_string()));
+ if (fr.unsigned_8()) {
+ BuildingIndex bidx = tribe.safe_building_index(fr.c_string());
constructionsite.m_old_buildings.push_back(bidx);
}
delete constructionsite.m_builder_request;
- if (fr.Unsigned8()) {
+ if (fr.unsigned_8()) {
constructionsite.m_builder_request =
new Request
(constructionsite,
0,
ConstructionSite::request_builder_callback,
wwWORKER);
- constructionsite.m_builder_request->Read(fr, game, mol);
+ constructionsite.m_builder_request->read(fr, game, mol);
} else
constructionsite.m_builder_request = nullptr;
- if (uint32_t const builder_serial = fr.Unsigned32()) {
+ if (uint32_t const builder_serial = fr.unsigned_32()) {
try {
constructionsite.m_builder = &mol.get<Worker>(builder_serial);
} catch (const WException & e) {
@@ -433,7 +433,7 @@
constructionsite.m_builder = nullptr;
try {
- uint16_t const size = fr.Unsigned16();
+ uint16_t const size = fr.unsigned_16();
constructionsite.m_wares.resize(size);
for (uint16_t i = 0; i < constructionsite.m_wares.size(); ++i)
{
@@ -442,18 +442,18 @@
(constructionsite, INVALID_INDEX, 0);
constructionsite.m_wares[i]->set_callback
(ConstructionSite::wares_queue_callback, &constructionsite);
- constructionsite.m_wares[i]->Read(fr, game, mol);
+ constructionsite.m_wares[i]->read(fr, game, mol);
}
} catch (const WException & e) {
throw GameDataError("wares: %s", e.what());
}
- constructionsite.m_fetchfromflag = fr. Signed32();
+ constructionsite.m_fetchfromflag = fr. signed_32();
- constructionsite.m_working = fr.Unsigned8 ();
- constructionsite.m_work_steptime = fr.Unsigned32();
- constructionsite.m_work_completed = fr.Unsigned32();
- constructionsite.m_work_steps = fr.Unsigned32();
+ constructionsite.m_working = fr.unsigned_8 ();
+ constructionsite.m_work_steptime = fr.unsigned_32();
+ constructionsite.m_work_completed = fr.unsigned_32();
+ constructionsite.m_work_steps = fr.unsigned_32();
}
void MapBuildingdataPacket::read_dismantlesite
@@ -463,7 +463,7 @@
MapObjectLoader & mol)
{
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == CURRENT_DISMANTLESITE_PACKET_VERSION) {
read_partially_finished_building(dms, fr, game, mol);
@@ -484,7 +484,7 @@
MapObjectLoader & mol)
{
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if
(1 <= packet_version &&
packet_version <= CURRENT_WAREHOUSE_PACKET_VERSION)
@@ -499,37 +499,37 @@
//log("Reading warehouse stuff for %p\n", &warehouse);
// supply
const TribeDescr & tribe = warehouse.descr().tribe();
- while (fr.Unsigned8()) {
- WareIndex const id = tribe.ware_index(fr.CString());
+ while (fr.unsigned_8()) {
+ WareIndex const id = tribe.ware_index(fr.c_string());
if (packet_version >= 5) {
- uint32_t amount = fr.Unsigned32();
+ uint32_t amount = fr.unsigned_32();
Warehouse::StockPolicy policy =
- static_cast<Warehouse::StockPolicy>(fr.Unsigned8());
+ static_cast<Warehouse::StockPolicy>(fr.unsigned_8());
if (id != INVALID_INDEX) {
warehouse.insert_wares(id, amount);
warehouse.set_ware_policy(id, policy);
}
} else {
- uint16_t amount = fr.Unsigned16();
+ uint16_t amount = fr.unsigned_16();
if (id != INVALID_INDEX)
warehouse.insert_wares(id, amount);
}
}
- while (fr.Unsigned8()) {
- WareIndex const id = tribe.worker_index(fr.CString());
+ while (fr.unsigned_8()) {
+ WareIndex const id = tribe.worker_index(fr.c_string());
if (packet_version >= 5) {
- uint32_t amount = fr.Unsigned32();
+ uint32_t amount = fr.unsigned_32();
Warehouse::StockPolicy policy =
- static_cast<Warehouse::StockPolicy>(fr.Unsigned8());
+ static_cast<Warehouse::StockPolicy>(fr.unsigned_8());
if (id != INVALID_INDEX) {
warehouse.insert_workers(id, amount);
warehouse.set_worker_policy(id, policy);
}
} else {
- uint16_t amount = fr.Unsigned16();
+ uint16_t amount = fr.unsigned_16();
if (id != INVALID_INDEX)
warehouse.insert_workers(id, amount);
@@ -538,7 +538,7 @@
if (packet_version <= 3) {
// eat the obsolete idle request structures
- uint32_t nrrequests = fr.Unsigned16();
+ uint32_t nrrequests = fr.unsigned_16();
while (nrrequests--) {
std::unique_ptr<Request> req
(new Request
@@ -546,20 +546,20 @@
0,
&Warehouse::request_cb,
wwWORKER));
- req->Read(fr, game, mol);
+ req->read(fr, game, mol);
}
}
assert(warehouse.m_incorporated_workers.empty());
{
- uint16_t const nr_workers = fr.Unsigned16();
+ uint16_t const nr_workers = fr.unsigned_16();
for (uint16_t i = 0; i < nr_workers; ++i) {
- uint32_t const worker_serial = fr.Unsigned32();
+ uint32_t const worker_serial = fr.unsigned_32();
try {
Worker & worker = mol.get<Worker>(worker_serial);
if (1 == packet_version) {
- char const * const name = fr.CString();
+ char const * const name = fr.c_string();
if (name != worker.descr().name())
throw GameDataError
("expected %s but found \"%s\"",
@@ -581,7 +581,7 @@
tribe.worker_types_without_cost();
if (1 == packet_version) { // a single next_spawn time for "carrier"
- uint32_t const next_spawn = fr.Unsigned32();
+ uint32_t const next_spawn = fr.unsigned_32();
WareIndex const worker_index =
tribe.safe_worker_index("carrier");
if (worker_index == INVALID_INDEX) {
@@ -606,7 +606,7 @@
if
(warehouse.m_next_worker_without_cost_spawn[i]
!=
- static_cast<uint32_t>(Never()))
+ static_cast<uint32_t>(never()))
{
warehouse.molog
("read_warehouse: "
@@ -616,7 +616,7 @@
assert
(warehouse.m_next_worker_without_cost_spawn[i]
==
- static_cast<uint32_t>(Never()));
+ static_cast<uint32_t>(never()));
warehouse.m_next_worker_without_cost_spawn[i] =
next_spawn;
break;
@@ -624,10 +624,10 @@
}
} else
for (;;) {
- char const * const worker_typename = fr.CString ();
+ char const * const worker_typename = fr.c_string ();
if (!*worker_typename) // encountered the terminator ("")
break;
- uint32_t const next_spawn = fr.Unsigned32();
+ uint32_t const next_spawn = fr.unsigned_32();
WareIndex const worker_index =
tribe.safe_worker_index(worker_typename);
if (worker_index == INVALID_INDEX) {
@@ -653,7 +653,7 @@
if
(warehouse.m_next_worker_without_cost_spawn[i]
!=
- static_cast<uint32_t>(Never()))
+ static_cast<uint32_t>(never()))
throw GameDataError
(
"%s %u has a next_spawn time for worker type "
@@ -675,16 +675,16 @@
if (packet_version >= 3) {
// Read planned worker data
// Consistency checks are in Warehouse::load_finish
- uint32_t nr_planned_workers = fr.Unsigned32();
+ uint32_t nr_planned_workers = fr.unsigned_32();
while (nr_planned_workers--) {
warehouse.m_planned_workers.push_back
(Warehouse::PlannedWorkers());
Warehouse::PlannedWorkers & pw =
warehouse.m_planned_workers.back();
- pw.index = tribe.worker_index(fr.CString());
- pw.amount = fr.Unsigned32();
+ pw.index = tribe.worker_index(fr.c_string());
+ pw.amount = fr.unsigned_32();
- uint32_t nr_requests = fr.Unsigned32();
+ uint32_t nr_requests = fr.unsigned_32();
while (nr_requests--) {
pw.requests.push_back
(new Request
@@ -692,17 +692,17 @@
0,
&Warehouse::request_cb,
wwWORKER));
- pw.requests.back()->Read(fr, game, mol);
+ pw.requests.back()->read(fr, game, mol);
}
}
}
if (packet_version >= 5)
- warehouse.m_next_stock_remove_act = fr.Unsigned32();
+ warehouse.m_next_stock_remove_act = fr.unsigned_32();
if (packet_version >= 6) {
if (warehouse.descr().get_isport()) {
- if (Serial portdock = fr.Unsigned32()) {
+ if (Serial portdock = fr.unsigned_32()) {
warehouse.m_portdock = &mol.get<PortDock>(portdock);
warehouse.m_portdock->set_economy(warehouse.get_economy());
// Expedition specific stuff. This is done in this packet
@@ -753,26 +753,26 @@
MapObjectLoader & mol)
{
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == CURRENT_MILITARYSITE_PACKET_VERSION)
{
read_productionsite(militarysite, fr, game, mol);
militarysite.m_normal_soldier_request.reset();
- if (fr.Unsigned8()) {
+ if (fr.unsigned_8()) {
militarysite.m_normal_soldier_request.reset
(new Request
(militarysite,
0,
MilitarySite::request_soldier_callback,
wwWORKER));
- militarysite.m_normal_soldier_request->Read(fr, game, mol);
+ militarysite.m_normal_soldier_request->read(fr, game, mol);
}
else
militarysite.m_normal_soldier_request.reset();
- if (fr.Unsigned8())
+ if (fr.unsigned_8())
{
militarysite.m_upgrade_soldier_request.reset
(new Request
@@ -781,13 +781,13 @@
: militarysite.descr().tribe().safe_worker_index("soldier"),
MilitarySite::request_soldier_callback,
wwWORKER));
- militarysite.m_upgrade_soldier_request->Read(fr, game, mol);
+ militarysite.m_upgrade_soldier_request->read(fr, game, mol);
}
else
militarysite.m_upgrade_soldier_request.reset();
- if ((militarysite.m_didconquer = fr.Unsigned8())) {
+ if ((militarysite.m_didconquer = fr.unsigned_8())) {
// Add to map of military influence.
const Map & map = game.map();
Area<FCoords> a
@@ -805,16 +805,16 @@
}
// capacity (modified by user)
- militarysite.m_capacity = fr.Unsigned8();
- militarysite.m_nexthealtime = fr.Signed32();
+ militarysite.m_capacity = fr.unsigned_8();
+ militarysite.m_nexthealtime = fr.signed_32();
- uint16_t reqmin = fr.Unsigned16();
- uint16_t reqmax = fr.Unsigned16();
+ uint16_t reqmin = fr.unsigned_16();
+ uint16_t reqmax = fr.unsigned_16();
militarysite.m_soldier_upgrade_requirements = RequireAttribute(atrTotal, reqmin, reqmax);
- militarysite.m_soldier_preference = static_cast<MilitarySite::SoldierPreference>(fr.Unsigned8());
- militarysite.m_next_swap_soldiers_time = fr.Signed32();
- militarysite.m_soldier_upgrade_try = 0 != fr.Unsigned8() ? true : false;
- militarysite.m_doing_upgrade_request = 0 != fr.Unsigned8() ? true : false;
+ militarysite.m_soldier_preference = static_cast<MilitarySite::SoldierPreference>(fr.unsigned_8());
+ militarysite.m_next_swap_soldiers_time = fr.signed_32();
+ militarysite.m_soldier_upgrade_try = 0 != fr.unsigned_8() ? true : false;
+ militarysite.m_doing_upgrade_request = 0 != fr.unsigned_8() ? true : false;
} else
throw GameDataError
@@ -829,22 +829,22 @@
// Cmd_ChangeSoldierCapacity to the beginning of the game's command
// queue. But that would not work because the command queue is not read
// yet and will be cleared before it is read.
- if (militarysite.m_capacity < militarysite.minSoldierCapacity()) {
+ if (militarysite.m_capacity < militarysite.min_soldier_capacity()) {
log
("WARNING: militarysite %u of player %u at (%i, %i) has capacity "
"set to %u but it must be at least %u. Changing to that value.\n",
militarysite.serial(), militarysite.owner().player_number(),
militarysite.get_position().x, militarysite.get_position().y,
- militarysite.m_capacity, militarysite.minSoldierCapacity());
- militarysite.m_capacity = militarysite.minSoldierCapacity();
- } else if (militarysite.maxSoldierCapacity() < militarysite.m_capacity) {
+ militarysite.m_capacity, militarysite.min_soldier_capacity());
+ militarysite.m_capacity = militarysite.min_soldier_capacity();
+ } else if (militarysite.max_soldier_capacity() < militarysite.m_capacity) {
log
("WARNING: militarysite %u of player %u at (%i, %i) has capacity "
"set to %u but it can be at most %u. Changing to that value.\n",
militarysite.serial(), militarysite.owner().player_number(),
militarysite.get_position().x, militarysite.get_position().y,
- militarysite.m_capacity, militarysite.maxSoldierCapacity());
- militarysite.m_capacity = militarysite.maxSoldierCapacity();
+ militarysite.m_capacity, militarysite.max_soldier_capacity());
+ militarysite.m_capacity = militarysite.max_soldier_capacity();
}
} catch (const WException & e) {
throw GameDataError("militarysite: %s", e.what());
@@ -858,7 +858,7 @@
MapObjectLoader & mol)
{
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if
(1 <= packet_version &&
packet_version <= CURRENT_PRODUCTIONSITE_PACKET_VERSION)
@@ -868,7 +868,7 @@
const ProductionSiteDescr & pr_descr = productionsite.descr();
const BillOfMaterials & working_positions = pr_descr.working_positions();
- uint16_t nr_worker_requests = fr.Unsigned16();
+ uint16_t nr_worker_requests = fr.unsigned_16();
for (uint16_t i = nr_worker_requests; i; --i) {
Request & req =
*new Request
@@ -876,7 +876,7 @@
0,
ProductionSite::request_worker_callback,
wwWORKER);
- req.Read(fr, game, mol);
+ req.read(fr, game, mol);
WareIndex const worker_index = req.get_index();
// Find a working position that matches this request.
@@ -913,9 +913,9 @@
wp->worker_request = &req;
}
- uint16_t nr_workers = fr.Unsigned16();
+ uint16_t nr_workers = fr.unsigned_16();
for (uint16_t i = nr_workers; i; --i) {
- Worker * worker = &mol.get<Worker>(fr.Unsigned32());
+ Worker * worker = &mol.get<Worker>(fr.unsigned_32());
// Find a working position that matches this worker.
const WorkerDescr & worker_descr = worker->descr();
@@ -952,14 +952,14 @@
"number of working positions");
// items from flags
- productionsite.m_fetchfromflag = fr.Signed32();
+ productionsite.m_fetchfromflag = fr.signed_32();
// skipped programs
uint32_t const gametime = game.get_gametime();
- for (uint8_t i = 3 <= packet_version ? fr.Unsigned8() : 0; i; --i) {
- char const * const program_name = fr.CString();
+ for (uint8_t i = 3 <= packet_version ? fr.unsigned_8() : 0; i; --i) {
+ char const * const program_name = fr.c_string();
if (pr_descr.programs().count(program_name)) {
- uint32_t const skip_time = fr.Unsigned32();
+ uint32_t const skip_time = fr.unsigned_32();
if (gametime < skip_time)
throw GameDataError
(
@@ -968,7 +968,7 @@
program_name, skip_time, gametime);
productionsite.m_skipped_programs[program_name] = skip_time;
} else {
- fr.Unsigned32(); // eat skip time
+ fr.unsigned_32(); // eat skip time
log
("WARNING: productionsite has skipped program \"%s\", which "
"does not exist\n",
@@ -977,35 +977,35 @@
}
// state
- uint16_t const nr_progs = fr.Unsigned16();
+ uint16_t const nr_progs = fr.unsigned_16();
productionsite.m_stack.resize(nr_progs);
for (uint16_t i = 0; i < nr_progs; ++i) {
- std::string program_name = fr.CString();
+ std::string program_name = fr.c_string();
std::transform
(program_name.begin(), program_name.end(), program_name.begin(),
tolower);
productionsite.m_stack[i].program =
productionsite.descr().get_program(program_name);
- productionsite.m_stack[i].ip = fr. Signed32();
- productionsite.m_stack[i].phase = fr. Signed32();
- productionsite.m_stack[i].flags = fr.Unsigned32();
+ productionsite.m_stack[i].ip = fr. signed_32();
+ productionsite.m_stack[i].phase = fr. signed_32();
+ productionsite.m_stack[i].flags = fr.unsigned_32();
if (packet_version >= 5) {
- uint32_t serial = fr.Unsigned32();
+ uint32_t serial = fr.unsigned_32();
if (serial)
productionsite.m_stack[i].objvar = &mol.get<MapObject>(serial);
- productionsite.m_stack[i].coord = ReadCoords32_allow_null(&fr, game.map().extent());
+ productionsite.m_stack[i].coord = read_coords_32_allow_null(&fr, game.map().extent());
}
}
- productionsite.m_program_timer = fr.Unsigned8();
- productionsite.m_program_time = fr.Signed32();
+ productionsite.m_program_timer = fr.unsigned_8();
+ productionsite.m_program_time = fr.signed_32();
- uint16_t nr_queues = fr.Unsigned16();
+ uint16_t nr_queues = fr.unsigned_16();
assert(!productionsite.m_input_queues.size());
for (uint16_t i = 0; i < nr_queues; ++i) {
WaresQueue * wq = new WaresQueue(productionsite, INVALID_INDEX, 0);
- wq->Read(fr, game, mol);
+ wq->read(fr, game, mol);
if (wq->get_ware() == INVALID_INDEX) {
delete wq;
@@ -1014,12 +1014,12 @@
}
}
- uint16_t const stats_size = fr.Unsigned16();
+ uint16_t const stats_size = fr.unsigned_16();
productionsite.m_statistics.resize(stats_size);
for (uint32_t i = 0; i < productionsite.m_statistics.size(); ++i)
- productionsite.m_statistics[i] = fr.Unsigned8();
- productionsite.m_statistics_string_on_changed_statistics = fr.CString();
- productionsite.m_production_result = fr.CString();
+ productionsite.m_statistics[i] = fr.unsigned_8();
+ productionsite.m_statistics_string_on_changed_statistics = fr.c_string();
+ productionsite.m_production_result = fr.c_string();
} else
throw GameDataError
("unknown/unhandled version %u", packet_version);
@@ -1038,7 +1038,7 @@
MapObjectLoader & mol)
{
try {
- uint16_t const trainingsite_packet_version = fr.Unsigned16();
+ uint16_t const trainingsite_packet_version = fr.unsigned_16();
if (trainingsite_packet_version == CURRENT_TRAININGSITE_PACKET_VERSION)
{
@@ -1046,45 +1046,45 @@
delete trainingsite.m_soldier_request;
trainingsite.m_soldier_request = nullptr;
- if (fr.Unsigned8()) {
+ if (fr.unsigned_8()) {
trainingsite.m_soldier_request =
new Request
(trainingsite,
0,
TrainingSite::request_soldier_callback,
wwWORKER);
- trainingsite.m_soldier_request->Read(fr, game, mol);
+ trainingsite.m_soldier_request->read(fr, game, mol);
}
- trainingsite.m_capacity = fr.Unsigned8();
- trainingsite.m_build_heroes = fr.Unsigned8();
+ trainingsite.m_capacity = fr.unsigned_8();
+ trainingsite.m_build_heroes = fr.unsigned_8();
- uint8_t const nr_upgrades = fr.Unsigned8();
+ uint8_t const nr_upgrades = fr.unsigned_8();
for (uint8_t i = 0; i < nr_upgrades; ++i) {
- TrainingAttribute attribute = static_cast<TrainingAttribute>(fr.Unsigned8());
+ TrainingAttribute attribute = static_cast<TrainingAttribute>(fr.unsigned_8());
if
(TrainingSite::Upgrade * const upgrade =
trainingsite.get_upgrade(attribute))
{
- upgrade->prio = fr.Unsigned8();
- upgrade->credit = fr.Unsigned8();
- upgrade->lastattempt = fr.Signed32();
- upgrade->lastsuccess = fr.Unsigned8();
+ upgrade->prio = fr.unsigned_8();
+ upgrade->credit = fr.unsigned_8();
+ upgrade->lastattempt = fr.signed_32();
+ upgrade->lastsuccess = fr.unsigned_8();
} else {
- fr.Unsigned8();
- fr.Unsigned8();
- fr.Signed32();
- fr.Signed32();
+ fr.unsigned_8();
+ fr.unsigned_8();
+ fr.signed_32();
+ fr.signed_32();
}
}
- uint16_t mapsize = fr.Unsigned16(); // map of training levels (not _the_ map)
+ uint16_t mapsize = fr.unsigned_16(); // map of training levels (not _the_ map)
while (mapsize)
{
- uint16_t traintype = fr.Unsigned16();
- uint16_t trainlevel = fr.Unsigned16();
- uint16_t trainstall = fr.Unsigned16();
- uint16_t spresence = fr.Unsigned8();
+ uint16_t traintype = fr.unsigned_16();
+ uint16_t trainlevel = fr.unsigned_16();
+ uint16_t trainstall = fr.unsigned_16();
+ uint16_t spresence = fr.unsigned_8();
mapsize--;
std::pair<uint16_t, uint8_t> t = std::make_pair(trainstall, spresence);
trainingsite.training_failure_count[std::make_pair(traintype, trainlevel)] = t;
@@ -1102,22 +1102,22 @@
// Cmd_ChangeSoldierCapacity to the beginning of the game's command
// queue. But that would not work because the command queue is not read
// yet and will be cleared before it is read.
- if (trainingsite.m_capacity < trainingsite.minSoldierCapacity()) {
+ if (trainingsite.m_capacity < trainingsite.min_soldier_capacity()) {
log
("WARNING: trainingsite %u of player %u at (%i, %i) has capacity "
"set to %u but it must be at least %u. Changing to that value.\n",
trainingsite.serial(), trainingsite.owner().player_number(),
trainingsite.get_position().x, trainingsite.get_position().y,
- trainingsite.m_capacity, trainingsite.minSoldierCapacity());
- trainingsite.m_capacity = trainingsite.minSoldierCapacity();
- } else if (trainingsite.maxSoldierCapacity() < trainingsite.m_capacity) {
+ trainingsite.m_capacity, trainingsite.min_soldier_capacity());
+ trainingsite.m_capacity = trainingsite.min_soldier_capacity();
+ } else if (trainingsite.max_soldier_capacity() < trainingsite.m_capacity) {
log
("WARNING: trainingsite %u of player %u at (%i, %i) has capacity "
"set to %u but it can be at most %u. Changing to that value.\n",
trainingsite.serial(), trainingsite.owner().player_number(),
trainingsite.get_position().x, trainingsite.get_position().y,
- trainingsite.m_capacity, trainingsite.maxSoldierCapacity());
- trainingsite.m_capacity = trainingsite.maxSoldierCapacity();
+ trainingsite.m_capacity, trainingsite.max_soldier_capacity());
+ trainingsite.m_capacity = trainingsite.max_soldier_capacity();
}
} catch (const WException & e) {
throw GameDataError("trainingsite: %s", e.what());
@@ -1125,13 +1125,13 @@
}
-void MapBuildingdataPacket::Write
+void MapBuildingdataPacket::write
(FileSystem & fs, EditorGameBase & egbase, MapObjectSaver & mos)
{
FileWrite fw;
// now packet version
- fw.Unsigned16(CURRENT_PACKET_VERSION);
+ fw.unsigned_16(CURRENT_PACKET_VERSION);
// Walk the map again
Map & map = egbase.map();
@@ -1144,50 +1144,50 @@
if (Map::get_index(building->get_position(), mapwidth) != i)
continue; // This is not this buildings main position.
- fw.Unsigned32(mos.get_object_file_index(*building));
+ fw.unsigned_32(mos.get_object_file_index(*building));
// player immovable owner is already in existence packet
// write the general stuff
if (building->m_anim) {
- fw.Unsigned8(1);
- fw.String(building->descr().get_animation_name(building->m_anim));
+ fw.unsigned_8(1);
+ fw.string(building->descr().get_animation_name(building->m_anim));
} else
- fw.Unsigned8(0);
+ fw.unsigned_8(0);
- fw.Unsigned32(building->m_animstart);
+ fw.unsigned_32(building->m_animstart);
{
const Building::LeaveQueue & leave_queue = building->m_leave_queue;
- fw.Unsigned16(leave_queue.size());
+ fw.unsigned_16(leave_queue.size());
for (const OPtr<Worker >& temp_queue: leave_queue) {
assert(mos.is_object_known(*temp_queue.get(egbase)));
- fw.Unsigned32
+ fw.unsigned_32
(mos.get_object_file_index(*temp_queue.get(egbase)));
}
}
- fw.Unsigned32(building->m_leave_time);
+ fw.unsigned_32(building->m_leave_time);
if (MapObject const * const o = building->m_leave_allow.get(egbase))
{
assert(mos.is_object_known(*o));
- fw.Unsigned32(mos.get_object_file_index(*o));
+ fw.unsigned_32(mos.get_object_file_index(*o));
} else {
- fw.Unsigned32(0);
+ fw.unsigned_32(0);
}
{
const TribeDescr& td = building->descr().tribe();
for (BuildingIndex b_idx : building->m_old_buildings) {
const BuildingDescr* b_descr = td.get_building_descr(b_idx);
- fw.Unsigned8(1);
- fw.String(b_descr->name());
+ fw.unsigned_8(1);
+ fw.string(b_descr->name());
}
- fw.Unsigned8(0);
+ fw.unsigned_8(0);
}
{
bool is_stopped = false;
if (upcast(ProductionSite const, productionsite, building))
is_stopped = productionsite->is_stopped();
- fw.Unsigned8(is_stopped);
+ fw.unsigned_8(is_stopped);
}
if (upcast(ConstructionSite const, constructionsite, building))
@@ -1236,7 +1236,7 @@
mos.mark_object_as_saved(*building);
}
- fw.Write(fs, "binary/building_data");
+ fw.write(fs, "binary/building_data");
}
void MapBuildingdataPacket::write_partially_finished_building
@@ -1245,34 +1245,34 @@
Game & game,
MapObjectSaver & mos)
{
- fw.Unsigned16(CURRENT_PARTIALLYFB_PACKET_VERSION);
+ fw.unsigned_16(CURRENT_PARTIALLYFB_PACKET_VERSION);
// descriptions
- fw.String(pfb.m_building->name());
+ fw.string(pfb.m_building->name());
// builder request
if (pfb.m_builder_request) {
- fw.Unsigned8(1);
- pfb.m_builder_request->Write(fw, game, mos);
+ fw.unsigned_8(1);
+ pfb.m_builder_request->write(fw, game, mos);
} else
- fw.Unsigned8(0);
+ fw.unsigned_8(0);
// builder
if (Worker const * builder = pfb.m_builder.get(game)) {
assert(mos.is_object_known(*builder));
- fw.Unsigned32(mos.get_object_file_index(*builder));
+ fw.unsigned_32(mos.get_object_file_index(*builder));
} else
- fw.Unsigned32(0);
+ fw.unsigned_32(0);
const uint16_t wares_size = pfb.m_wares.size();
- fw.Unsigned16(wares_size);
+ fw.unsigned_16(wares_size);
for (uint16_t i = 0; i < wares_size; ++i)
- pfb.m_wares[i]->Write(fw, game, mos);
+ pfb.m_wares[i]->write(fw, game, mos);
- fw.Unsigned8 (pfb.m_working);
- fw.Unsigned32(pfb.m_work_steptime);
- fw.Unsigned32(pfb.m_work_completed);
- fw.Unsigned32(pfb.m_work_steps);
+ fw.unsigned_8 (pfb.m_working);
+ fw.unsigned_32(pfb.m_work_steptime);
+ fw.unsigned_32(pfb.m_work_completed);
+ fw.unsigned_32(pfb.m_work_steps);
}
void MapBuildingdataPacket::write_constructionsite
@@ -1282,11 +1282,11 @@
MapObjectSaver & mos)
{
- fw.Unsigned16(CURRENT_CONSTRUCTIONSITE_PACKET_VERSION);
+ fw.unsigned_16(CURRENT_CONSTRUCTIONSITE_PACKET_VERSION);
write_partially_finished_building(constructionsite, fw, game, mos);
- fw.Signed32(constructionsite.m_fetchfromflag);
+ fw.signed_32(constructionsite.m_fetchfromflag);
}
void MapBuildingdataPacket::write_dismantlesite
@@ -1296,7 +1296,7 @@
MapObjectSaver & mos)
{
- fw.Unsigned16(CURRENT_DISMANTLESITE_PACKET_VERSION);
+ fw.unsigned_16(CURRENT_DISMANTLESITE_PACKET_VERSION);
write_partially_finished_building(dms, fw, game, mos);
@@ -1310,26 +1310,26 @@
Game & game,
MapObjectSaver & mos)
{
- fw.Unsigned16(CURRENT_WAREHOUSE_PACKET_VERSION);
+ fw.unsigned_16(CURRENT_WAREHOUSE_PACKET_VERSION);
// supply
const TribeDescr & tribe = warehouse.descr().tribe();
const WareList & wares = warehouse.m_supply->get_wares();
for (WareIndex i = 0; i < wares.get_nrwareids (); ++i) {
- fw.Unsigned8(1);
- fw.String(tribe.get_ware_descr(i)->name());
- fw.Unsigned32(wares.stock(i));
- fw.Unsigned8(warehouse.get_ware_policy(i));
+ fw.unsigned_8(1);
+ fw.string(tribe.get_ware_descr(i)->name());
+ fw.unsigned_32(wares.stock(i));
+ fw.unsigned_8(warehouse.get_ware_policy(i));
}
- fw.Unsigned8(0);
+ fw.unsigned_8(0);
const WareList & workers = warehouse.m_supply->get_workers();
for (WareIndex i = 0; i < workers.get_nrwareids(); ++i) {
- fw.Unsigned8(1);
- fw.String(tribe.get_worker_descr(i)->name());
- fw.Unsigned32(workers.stock(i));
- fw.Unsigned8(warehouse.get_worker_policy(i));
+ fw.unsigned_8(1);
+ fw.string(tribe.get_worker_descr(i)->name());
+ fw.unsigned_32(workers.stock(i));
+ fw.unsigned_8(warehouse.get_worker_policy(i));
}
- fw.Unsigned8(0);
+ fw.unsigned_8(0);
// Incorporated workers, write sorted after file-serial.
uint32_t nworkers = 0;
@@ -1337,7 +1337,7 @@
nworkers += cwt.second.size();
}
- fw.Unsigned16(nworkers);
+ fw.unsigned_16(nworkers);
using TWorkerMap = std::map<uint32_t, const Worker *>;
TWorkerMap workermap;
for (const std::pair<WareIndex, Warehouse::WorkerList>& cwt : warehouse.m_incorporated_workers) {
@@ -1353,7 +1353,7 @@
for (const std::pair<uint32_t, const Worker *>& temp_worker : workermap) {
const Worker & obj = *temp_worker.second;
assert(mos.is_object_known(obj));
- fw.Unsigned32(mos.get_object_file_index(obj));
+ fw.unsigned_32(mos.get_object_file_index(obj));
}
{
@@ -1362,32 +1362,32 @@
for (uint8_t i = worker_types_without_cost.size(); i;) {
uint32_t const next_spawn =
warehouse.m_next_worker_without_cost_spawn[--i];
- if (next_spawn != static_cast<uint32_t>(Never())) {
- fw.String
+ if (next_spawn != static_cast<uint32_t>(never())) {
+ fw.string
(tribe.get_worker_descr(tribe.worker_types_without_cost().at(i))
->name());
- fw.Unsigned32(next_spawn);
+ fw.unsigned_32(next_spawn);
}
}
}
- fw.Unsigned8(0); // terminator for spawn times
+ fw.unsigned_8(0); // terminator for spawn times
- fw.Unsigned32(warehouse.m_planned_workers.size());
+ fw.unsigned_32(warehouse.m_planned_workers.size());
for (const Warehouse::PlannedWorkers& temp_worker : warehouse.m_planned_workers) {
- fw.CString(tribe.get_worker_descr(temp_worker.index)->name());
- fw.Unsigned32(temp_worker.amount);
+ fw.c_string(tribe.get_worker_descr(temp_worker.index)->name());
+ fw.unsigned_32(temp_worker.amount);
- fw.Unsigned32(temp_worker.requests.size());
+ fw.unsigned_32(temp_worker.requests.size());
for (Request * temp_request : temp_worker.requests) {
- temp_request->Write(fw, game, mos);
+ temp_request->write(fw, game, mos);
}
}
- fw.Unsigned32(warehouse.m_next_stock_remove_act);
+ fw.unsigned_32(warehouse.m_next_stock_remove_act);
if (warehouse.descr().get_isport()) {
- fw.Unsigned32(mos.get_object_file_index_or_zero(warehouse.m_portdock));
+ fw.unsigned_32(mos.get_object_file_index_or_zero(warehouse.m_portdock));
// Expedition specific stuff. See comment in loader.
if (warehouse.m_portdock->expedition_started()) {
@@ -1403,28 +1403,28 @@
Game & game,
MapObjectSaver & mos)
{
- fw.Unsigned16(CURRENT_MILITARYSITE_PACKET_VERSION);
+ fw.unsigned_16(CURRENT_MILITARYSITE_PACKET_VERSION);
write_productionsite(militarysite, fw, game, mos);
if (militarysite.m_normal_soldier_request) {
- fw.Unsigned8(1);
- militarysite.m_normal_soldier_request->Write(fw, game, mos);
+ fw.unsigned_8(1);
+ militarysite.m_normal_soldier_request->write(fw, game, mos);
} else {
- fw.Unsigned8(0);
+ fw.unsigned_8(0);
}
if (militarysite.m_upgrade_soldier_request)
{
- fw.Unsigned8(1);
- militarysite.m_upgrade_soldier_request->Write(fw, game, mos);
+ fw.unsigned_8(1);
+ militarysite.m_upgrade_soldier_request->write(fw, game, mos);
}
else
- fw.Unsigned8(0);
-
-
- fw.Unsigned8(militarysite.m_didconquer);
- fw.Unsigned8(militarysite.m_capacity);
- fw.Signed32(militarysite.m_nexthealtime);
+ fw.unsigned_8(0);
+
+
+ fw.unsigned_8(militarysite.m_didconquer);
+ fw.unsigned_8(militarysite.m_capacity);
+ fw.signed_32(militarysite.m_nexthealtime);
if (militarysite.m_normal_soldier_request)
{
@@ -1434,12 +1434,12 @@
("Internal error in a MilitarySite -- cannot continue. Use previous autosave.");
}
}
- fw.Unsigned16(militarysite.m_soldier_upgrade_requirements.getMin());
- fw.Unsigned16(militarysite.m_soldier_upgrade_requirements.getMax());
- fw.Unsigned8(militarysite.m_soldier_preference);
- fw.Signed32(militarysite.m_next_swap_soldiers_time);
- fw.Unsigned8(militarysite.m_soldier_upgrade_try ? 1 : 0);
- fw.Unsigned8(militarysite.m_doing_upgrade_request ? 1 : 0);
+ fw.unsigned_16(militarysite.m_soldier_upgrade_requirements.get_min());
+ fw.unsigned_16(militarysite.m_soldier_upgrade_requirements.get_max());
+ fw.unsigned_8(militarysite.m_soldier_preference);
+ fw.signed_32(militarysite.m_next_swap_soldiers_time);
+ fw.unsigned_8(militarysite.m_soldier_upgrade_try ? 1 : 0);
+ fw.unsigned_8(militarysite.m_doing_upgrade_request ? 1 : 0);
}
@@ -1450,7 +1450,7 @@
Game & game,
MapObjectSaver & mos)
{
- fw.Unsigned16(CURRENT_PRODUCTIONSITE_PACKET_VERSION);
+ fw.unsigned_16(CURRENT_PRODUCTIONSITE_PACKET_VERSION);
uint32_t const nr_working_positions =
productionsite.descr().nr_working_positions();
@@ -1463,59 +1463,59 @@
nr_workers += i->worker ? 1 : 0;
// worker requests
- fw.Unsigned16(nr_working_positions - nr_workers);
+ fw.unsigned_16(nr_working_positions - nr_workers);
for (ProductionSite::WorkingPosition const * i = &begin; i < &end; ++i)
if (Request const * const r = i->worker_request)
- r->Write(fw, game, mos);
+ r->write(fw, game, mos);
// workers
- fw.Unsigned16(nr_workers);
+ fw.unsigned_16(nr_workers);
for (ProductionSite::WorkingPosition const * i = &begin; i < &end; ++i)
if (Worker const * const w = i->worker) {
assert(!i->worker_request);
assert(mos.is_object_known(*w));
- fw.Unsigned32(mos.get_object_file_index(*w));
+ fw.unsigned_32(mos.get_object_file_index(*w));
}
- fw.Signed32(productionsite.m_fetchfromflag);
+ fw.signed_32(productionsite.m_fetchfromflag);
// skipped programs
assert
(productionsite.m_skipped_programs.size()
<=
std::numeric_limits<uint8_t>::max());
- fw.Unsigned8(productionsite.m_skipped_programs.size());
+ fw.unsigned_8(productionsite.m_skipped_programs.size());
for (const std::pair<std::string, Time>& temp_program : productionsite.m_skipped_programs) {
- fw.String (temp_program.first);
- fw.Unsigned32(temp_program.second);
+ fw.string (temp_program.first);
+ fw.unsigned_32(temp_program.second);
}
// state
uint16_t const program_size = productionsite.m_stack.size();
- fw.Unsigned16(program_size);
+ fw.unsigned_16(program_size);
for (uint16_t i = 0; i < program_size; ++i) {
- fw.String (productionsite.m_stack[i].program->name());
- fw. Signed32(productionsite.m_stack[i].ip);
- fw. Signed32(productionsite.m_stack[i].phase);
- fw.Unsigned32(productionsite.m_stack[i].flags);
- fw.Unsigned32(mos.get_object_file_index_or_zero(productionsite.m_stack[i].objvar.get(game)));
- WriteCoords32(&fw, productionsite.m_stack[i].coord);
+ fw.string (productionsite.m_stack[i].program->name());
+ fw. signed_32(productionsite.m_stack[i].ip);
+ fw. signed_32(productionsite.m_stack[i].phase);
+ fw.unsigned_32(productionsite.m_stack[i].flags);
+ fw.unsigned_32(mos.get_object_file_index_or_zero(productionsite.m_stack[i].objvar.get(game)));
+ write_coords_32(&fw, productionsite.m_stack[i].coord);
}
- fw.Unsigned8(productionsite.m_program_timer);
- fw. Signed32(productionsite.m_program_time);
+ fw.unsigned_8(productionsite.m_program_timer);
+ fw. signed_32(productionsite.m_program_time);
const uint16_t input_queues_size = productionsite.m_input_queues.size();
- fw.Unsigned16(input_queues_size);
+ fw.unsigned_16(input_queues_size);
for (uint16_t i = 0; i < input_queues_size; ++i)
- productionsite.m_input_queues[i]->Write(fw, game, mos);
+ productionsite.m_input_queues[i]->write(fw, game, mos);
const uint16_t statistics_size = productionsite.m_statistics.size();
- fw.Unsigned16(statistics_size);
+ fw.unsigned_16(statistics_size);
for (uint32_t i = 0; i < statistics_size; ++i)
- fw.Unsigned8(productionsite.m_statistics[i]);
- fw.String(productionsite.m_statistics_string_on_changed_statistics);
- fw.String(productionsite.production_result());
+ fw.unsigned_8(productionsite.m_statistics[i]);
+ fw.string(productionsite.m_statistics_string_on_changed_statistics);
+ fw.string(productionsite.production_result());
}
/*
@@ -1527,45 +1527,45 @@
Game & game,
MapObjectSaver & mos)
{
- fw.Unsigned16(CURRENT_TRAININGSITE_PACKET_VERSION);
+ fw.unsigned_16(CURRENT_TRAININGSITE_PACKET_VERSION);
write_productionsite(trainingsite, fw, game, mos);
// requests
if (trainingsite.m_soldier_request) {
- fw.Unsigned8(1);
- trainingsite.m_soldier_request->Write(fw, game, mos);
+ fw.unsigned_8(1);
+ trainingsite.m_soldier_request->write(fw, game, mos);
} else {
- fw.Unsigned8(0);
+ fw.unsigned_8(0);
}
- fw.Unsigned8(trainingsite.m_capacity);
- fw.Unsigned8(trainingsite.m_build_heroes);
+ fw.unsigned_8(trainingsite.m_capacity);
+ fw.unsigned_8(trainingsite.m_build_heroes);
// upgrades
- fw.Unsigned8(trainingsite.m_upgrades.size());
+ fw.unsigned_8(trainingsite.m_upgrades.size());
for (uint8_t i = 0; i < trainingsite.m_upgrades.size(); ++i) {
const TrainingSite::Upgrade & upgrade = trainingsite.m_upgrades[i];
- fw.Unsigned8(upgrade.attribute);
- fw.Unsigned8(upgrade.prio);
- fw.Unsigned8(upgrade.credit);
- fw.Signed32(upgrade.lastattempt);
- fw.Signed8(upgrade.lastsuccess);
+ fw.unsigned_8(upgrade.attribute);
+ fw.unsigned_8(upgrade.prio);
+ fw.unsigned_8(upgrade.credit);
+ fw.signed_32(upgrade.lastattempt);
+ fw.signed_8(upgrade.lastsuccess);
}
if (255 < trainingsite.training_failure_count.size())
log
("Save TrainingSite: Failure counter has ridiculously many entries! (%u)\n",
static_cast<uint16_t>(trainingsite.training_failure_count.size()));
- fw.Unsigned16(static_cast<uint16_t> (trainingsite.training_failure_count.size()));
+ fw.unsigned_16(static_cast<uint16_t> (trainingsite.training_failure_count.size()));
for
(TrainingSite::TrainFailCount::const_iterator i = trainingsite.training_failure_count.begin();
i != trainingsite.training_failure_count.end(); i++)
{
- fw.Unsigned16(i->first.first);
- fw.Unsigned16(i->first.second);
- fw.Unsigned16(i->second.first);
- fw.Unsigned8(i->second.second);
+ fw.unsigned_16(i->first.first);
+ fw.unsigned_16(i->first.second);
+ fw.unsigned_16(i->second.first);
+ fw.unsigned_8(i->second.second);
}
// DONE
=== modified file 'src/map_io/map_buildingdata_packet.h'
--- src/map_io/map_buildingdata_packet.h 2014-09-10 16:57:31 +0000
+++ src/map_io/map_buildingdata_packet.h 2014-09-29 13:33:11 +0000
@@ -42,8 +42,8 @@
*/
class MapBuildingdataPacket {
public:
- void Read(FileSystem&, EditorGameBase&, bool, MapObjectLoader&);
- void Write(FileSystem&, EditorGameBase&, MapObjectSaver&);
+ void read(FileSystem&, EditorGameBase&, bool, MapObjectLoader&);
+ void write(FileSystem&, EditorGameBase&, MapObjectSaver&);
private:
void read_constructionsite
=== modified file 'src/map_io/map_data_packet.h'
--- src/map_io/map_data_packet.h 2014-09-14 16:08:13 +0000
+++ src/map_io/map_data_packet.h 2014-09-29 13:33:11 +0000
@@ -34,8 +34,8 @@
namespace Widelands { \
class Name { \
public: \
- void Read(FileSystem&, EditorGameBase&, bool, MapObjectLoader&); \
- void Write(FileSystem&, EditorGameBase&, MapObjectSaver&); \
+ void read(FileSystem&, EditorGameBase&, bool, MapObjectLoader&); \
+ void write(FileSystem&, EditorGameBase&, MapObjectSaver&); \
}; \
}
=== modified file 'src/map_io/map_elemental_packet.cc'
--- src/map_io/map_elemental_packet.cc 2014-09-10 08:55:04 +0000
+++ src/map_io/map_elemental_packet.cc 2014-09-29 13:33:11 +0000
@@ -31,7 +31,7 @@
#define CURRENT_PACKET_VERSION 1
-void MapElementalPacket::Pre_Read(FileSystem & fs, Map * map)
+void MapElementalPacket::pre_read(FileSystem & fs, Map * map)
{
Profile prof;
prof.read("elemental", nullptr, fs);
@@ -70,14 +70,14 @@
}
-void MapElementalPacket::Read
+void MapElementalPacket::read
(FileSystem & fs, EditorGameBase & egbase, bool, MapObjectLoader &)
{
- Pre_Read(fs, &egbase.map());
+ pre_read(fs, &egbase.map());
}
-void MapElementalPacket::Write
+void MapElementalPacket::write
(FileSystem & fs, EditorGameBase & egbase, MapObjectSaver &)
{
=== modified file 'src/map_io/map_elemental_packet.h'
--- src/map_io/map_elemental_packet.h 2014-09-10 16:57:31 +0000
+++ src/map_io/map_elemental_packet.h 2014-09-29 13:33:11 +0000
@@ -35,12 +35,12 @@
* like number of players, map size, world name, magic bytes and so on
*/
struct MapElementalPacket {
- void Read(FileSystem&, EditorGameBase&, bool, MapObjectLoader&);
- void Write(FileSystem&, EditorGameBase&, MapObjectSaver&);
+ void read(FileSystem&, EditorGameBase&, bool, MapObjectLoader&);
+ void write(FileSystem&, EditorGameBase&, MapObjectSaver&);
/// The following function prereads a given map without the need of a
/// properly configured EditorGameBase object.
- void Pre_Read(FileSystem &, Map *);
+ void pre_read(FileSystem &, Map *);
uint32_t get_version() {return m_version;}
=== modified file 'src/map_io/map_exploration_packet.cc'
--- src/map_io/map_exploration_packet.cc 2014-09-10 08:55:04 +0000
+++ src/map_io/map_exploration_packet.cc 2014-09-29 13:33:11 +0000
@@ -33,7 +33,7 @@
#define CURRENT_PACKET_VERSION 2
-void MapExplorationPacket::Read
+void MapExplorationPacket::read
(FileSystem & fs,
EditorGameBase & egbase,
bool const skip,
@@ -44,10 +44,10 @@
FileRead fr;
try {
- fr.Open(fs, "binary/exploration");
+ fr.open(fs, "binary/exploration");
} catch (...) {
try {
- fr.Open(fs, "binary/seen_fields");
+ fr.open(fs, "binary/seen_fields");
} catch (...) {
return;
}
@@ -58,31 +58,31 @@
PlayerNumber const nr_players = map.get_nrplayers();
MapIndex const max_index = map.max_index();
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == 1)
for (MapIndex i = 0; i < max_index; ++i) {
- uint32_t const data = fr.Unsigned16();
+ uint32_t const data = fr.unsigned_16();
for (uint8_t j = 0; j < nr_players; ++j) {
bool const see = data & (1 << j);
if (Player * const player = egbase.get_player(j + 1))
player->m_fields[i].vision = see ? 1 : 0;
else if (see)
log
- ("MapExplorationPacket::Read: WARNING: Player %u, "
+ ("MapExplorationPacket::read: WARNING: Player %u, "
"which does not exist, sees field %u.\n",
j + 1, i);
}
}
else if (packet_version == CURRENT_PACKET_VERSION)
for (MapIndex i = 0; i < max_index; ++i) {
- uint32_t const data = fr.Unsigned32();
+ uint32_t const data = fr.unsigned_32();
for (uint8_t j = 0; j < nr_players; ++j) {
bool see = data & (1 << j);
if (Player * const player = egbase.get_player(j + 1))
player->m_fields[i].vision = see ? 1 : 0;
else if (see)
log
- ("MapExplorationPacket::Read: WARNING: Player %u, "
+ ("MapExplorationPacket::read: WARNING: Player %u, "
"which does not exist, sees field %u.\n",
j + 1, i);
}
@@ -96,12 +96,12 @@
}
-void MapExplorationPacket::Write
+void MapExplorationPacket::write
(FileSystem & fs, EditorGameBase & egbase, MapObjectSaver &)
{
FileWrite fw;
- fw.Unsigned16(CURRENT_PACKET_VERSION);
+ fw.unsigned_16(CURRENT_PACKET_VERSION);
static_assert(MAX_PLAYERS < 32, "assert(MAX_PLAYERS < 32) failed.");
Map & map = egbase.map();
@@ -114,10 +114,10 @@
if (Player const * const player = egbase.get_player(player_index))
data |= ((0 < player->vision(i)) << j);
}
- fw.Unsigned32(data);
+ fw.unsigned_32(data);
}
- fw.Write(fs, "binary/exploration");
+ fw.write(fs, "binary/exploration");
}
}
=== modified file 'src/map_io/map_extradata_packet.cc'
--- src/map_io/map_extradata_packet.cc 2014-09-14 11:31:58 +0000
+++ src/map_io/map_extradata_packet.cc 2014-09-29 13:33:11 +0000
@@ -35,7 +35,7 @@
#define CURRENT_PACKET_VERSION 1
-void MapExtradataPacket::Read(FileSystem& fs, bool const skip) {
+void MapExtradataPacket::read(FileSystem& fs, bool const skip) {
if (skip)
return;
@@ -47,24 +47,24 @@
prof.get_safe_section("global").get_safe_int("packet_version");
if (packet_version == CURRENT_PACKET_VERSION) {
// Read all pics.
- if (fs.FileExists("pics") && fs.IsDirectory("pics")) {
- FilenameSet pictures = fs.ListDirectory("pics");
+ if (fs.file_exists("pics") && fs.is_directory("pics")) {
+ FilenameSet pictures = fs.list_directory("pics");
for
(FilenameSet::iterator pname = pictures.begin();
pname != pictures.end();
++pname)
{
- if (fs.IsDirectory(pname->c_str())) // Might be a dir, maybe CVS
+ if (fs.is_directory(pname->c_str())) // Might be a dir, maybe CVS
continue;
- const std::string hash = std::string("map:") + FileSystem::FS_Filename(pname->c_str());
+ const std::string hash = std::string("map:") + FileSystem::fs_filename(pname->c_str());
const Image* image = nullptr;
if (!g_gr->images().has(hash)) {
FileRead fr;
- fr.Open(fs, *pname);
+ fr.open(fs, *pname);
SDL_Surface * const surf =
- IMG_Load_RW(SDL_RWFromMem(fr.Data(0), fr.GetSize()), 1);
+ IMG_Load_RW(SDL_RWFromMem(fr.data(0), fr.get_size()), 1);
if (!surf)
continue; // Illegal pic. Skip it.
image = g_gr->images().insert(new_in_memory_image(hash, Surface::create(surf)));
@@ -83,7 +83,7 @@
}
-void MapExtradataPacket::Write
+void MapExtradataPacket::write
(FileSystem & fs, EditorGameBase & egbase)
{
Profile prof;
@@ -92,12 +92,12 @@
// Copy all files from pics/ from the old map to the new.
FileSystem* map_fs = egbase.map().filesystem();
- if (map_fs && map_fs->FileExists("pics") && map_fs->IsDirectory("pics")) {
- fs.EnsureDirectoryExists("pics");
- for (const std::string& picture : map_fs->ListDirectory("pics")) {
+ if (map_fs && map_fs->file_exists("pics") && map_fs->is_directory("pics")) {
+ fs.ensure_directory_exists("pics");
+ for (const std::string& picture : map_fs->list_directory("pics")) {
size_t length;
- void* input_data = map_fs->Load(picture, length);
- fs.Write(picture, input_data, length);
+ void* input_data = map_fs->load(picture, length);
+ fs.write(picture, input_data, length);
free(input_data);
}
}
=== modified file 'src/map_io/map_extradata_packet.h'
--- src/map_io/map_extradata_packet.h 2014-09-10 16:57:31 +0000
+++ src/map_io/map_extradata_packet.h 2014-09-29 13:33:11 +0000
@@ -31,8 +31,8 @@
*/
class MapExtradataPacket {
public:
- void Read(FileSystem&, bool);
- void Write(FileSystem&, EditorGameBase&);
+ void read(FileSystem&, bool);
+ void write(FileSystem&, EditorGameBase&);
};
} // namespace Widelands
=== modified file 'src/map_io/map_flag_packet.cc'
--- src/map_io/map_flag_packet.cc 2014-09-10 08:55:04 +0000
+++ src/map_io/map_flag_packet.cc 2014-09-29 13:33:11 +0000
@@ -38,7 +38,7 @@
#define CURRENT_PACKET_VERSION 1
-void MapFlagPacket::Read
+void MapFlagPacket::read
(FileSystem & fs,
EditorGameBase & egbase,
bool const skip,
@@ -48,22 +48,22 @@
return;
FileRead fr;
- try {fr.Open(fs, "binary/flag");} catch (...) {return;}
+ try {fr.open(fs, "binary/flag");} catch (...) {return;}
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (packet_version == CURRENT_PACKET_VERSION) {
const Map & map = egbase.map();
PlayerNumber const nr_players = map.get_nrplayers();
Widelands::Extent const extent = map.extent();
iterate_Map_FCoords(map, extent, fc)
- if (fr.Unsigned8()) {
- PlayerNumber const owner = fr.Unsigned8();
+ if (fr.unsigned_8()) {
+ PlayerNumber const owner = fr.unsigned_8();
if (!(0 < owner && owner <= nr_players)) {
throw GameDataError("Invalid player number: %i.", owner);
}
- Serial const serial = fr.Unsigned32();
+ Serial const serial = fr.unsigned_32();
try {
if (fc.field->get_owned_by() != owner)
@@ -127,12 +127,12 @@
}
-void MapFlagPacket::Write
+void MapFlagPacket::write
(FileSystem & fs, EditorGameBase & egbase, MapObjectSaver & mos)
{
FileWrite fw;
- fw.Unsigned16(CURRENT_PACKET_VERSION);
+ fw.unsigned_16(CURRENT_PACKET_VERSION);
// Write flags and owner, register this with the map_object_saver so that
// it's data can be saved later.
@@ -146,13 +146,13 @@
assert(!mos.is_object_known(*flag));
assert(field->get_owned_by() == flag->owner().player_number());
- fw.Unsigned8(1);
- fw.Unsigned8(flag->owner().player_number());
- fw.Unsigned32(mos.register_object(*flag));
+ fw.unsigned_8(1);
+ fw.unsigned_8(flag->owner().player_number());
+ fw.unsigned_32(mos.register_object(*flag));
} else // no existence, no owner
- fw.Unsigned8(0);
+ fw.unsigned_8(0);
- fw.Write(fs, "binary/flag");
+ fw.write(fs, "binary/flag");
}
}
=== modified file 'src/map_io/map_flagdata_packet.cc'
--- src/map_io/map_flagdata_packet.cc 2014-09-10 08:55:04 +0000
+++ src/map_io/map_flagdata_packet.cc 2014-09-29 13:33:11 +0000
@@ -40,7 +40,7 @@
#define CURRENT_PACKET_VERSION 4
-void MapFlagdataPacket::Read
+void MapFlagdataPacket::read
(FileSystem & fs,
EditorGameBase & egbase,
bool const skip,
@@ -50,19 +50,19 @@
return;
FileRead fr;
- try {fr.Open(fs, "binary/flag_data");} catch (...) {return;}
+ try {fr.open(fs, "binary/flag_data");} catch (...) {return;}
try {
- uint16_t const packet_version = fr.Unsigned16();
+ uint16_t const packet_version = fr.unsigned_16();
if (1 <= packet_version && packet_version <= CURRENT_PACKET_VERSION) {
const Map & map = egbase.map();
Extent const extent = map.extent();
for (;;) {
- if (2 <= packet_version && fr.EndOfFile())
+ if (2 <= packet_version && fr.end_of_file())
break;
- Serial const serial = fr.Unsigned32();
+ Serial const serial = fr.unsigned_32();
if (packet_version < 2 && serial == 0xffffffff) {
- if (!fr.EndOfFile())
+ if (!fr.end_of_file())
throw GameDataError
("expected end of file after serial 0xffffffff");
break;
@@ -77,7 +77,7 @@
(upcast
(Flag const,
mf,
- map[flag.m_position = ReadCoords32(&fr, extent)]
+ map[flag.m_position = read_coords_32(&fr, extent)]
.get_immovable()))
{
if (mf != &flag)
@@ -90,7 +90,7 @@
("no flag at given position (%i, %i)",
flag.m_position.x, flag.m_position.y);
}
- flag.m_animstart = fr.Unsigned16();
+ flag.m_animstart = fr.unsigned_16();
{
FCoords building_position = map.get_fcoords(flag.m_position);
@@ -100,7 +100,7 @@
(building_position.field->get_immovable());
}
if (packet_version < 3) {
- if (uint32_t const building_serial = fr.Unsigned32())
+ if (uint32_t const building_serial = fr.unsigned_32())
try {
const Building & building =
mol.get<Building>(building_serial);
@@ -125,25 +125,25 @@
// Compatibility stuff: Read 6 bytes of attic stuff
// that is no longer used (was m_wares_pending)
for (uint32_t i = 0; i < 6; ++i)
- fr.Unsigned32();
+ fr.unsigned_32();
- flag.m_ware_capacity = fr.Unsigned32();
+ flag.m_ware_capacity = fr.unsigned_32();
{
- uint32_t const wares_filled = fr.Unsigned32();
+ uint32_t const wares_filled = fr.unsigned_32();
flag.m_ware_filled = wares_filled;
for (uint32_t i = 0; i < wares_filled; ++i) {
- flag.m_wares[i].pending = fr.Unsigned8();
+ flag.m_wares[i].pending = fr.unsigned_8();
if (packet_version < 4)
flag.m_wares[i].priority = 0;
else
- flag.m_wares[i].priority = fr.Signed32();
- uint32_t const ware_serial = fr.Unsigned32();
+ flag.m_wares[i].priority = fr.signed_32();
+ uint32_t const ware_serial = fr.unsigned_32();
try {
flag.m_wares[i].ware =
&mol.get<WareInstance>(ware_serial);
- if (uint32_t const nextstep_serial = fr.Unsigned32()) {
+ if (uint32_t const nextstep_serial = fr.unsigned_32()) {
try {
flag.m_wares[i].nextstep =
&mol.get<PlayerImmovable>(nextstep_serial);
@@ -160,7 +160,7 @@
}
}
- if (uint32_t const always_call_serial = fr.Unsigned32())
+ if (uint32_t const always_call_serial = fr.unsigned_32())
try {
flag.m_always_call_for_flag =
&mol.get<Flag>(always_call_serial);
@@ -173,9 +173,9 @@
flag.m_always_call_for_flag = nullptr;
// workers waiting
- uint16_t const nr_workers = fr.Unsigned16();
+ uint16_t const nr_workers = fr.unsigned_16();
for (uint32_t i = 0; i < nr_workers; ++i) {
- uint32_t const worker_serial = fr.Unsigned32();
+ uint32_t const worker_serial = fr.unsigned_32();
try {
// The check that this worker actually has a
// waitforcapacity task for this flag is in
@@ -190,23 +190,23 @@
}
// flag jobs
- uint16_t const nr_jobs = fr.Unsigned16();
+ uint16_t const nr_jobs = fr.unsigned_16();
assert(flag.m_flag_jobs.empty());
for (uint16_t i = 0; i < nr_jobs; ++i) {
Flag::FlagJob f;
- if (fr.Unsigned8()) {
+ if (fr.unsigned_8()) {
f.request =
new Request
(flag,
0,
Flag::flag_job_request_callback,
wwWORKER);
- f.request->Read
+ f.request->read
(fr, ref_cast<Game, EditorGameBase>(egbase), mol);
} else {
f.request = nullptr;
}
- f.program = fr.CString();
+ f.program = fr.c_string();
flag.m_flag_jobs.push_back(f);
}
@@ -225,13 +225,13 @@
}
-void MapFlagdataPacket::Write
+void MapFlagdataPacket::write
(FileSystem & fs, EditorGameBase & egbase, MapObjectSaver & mos)
{
FileWrite fw;
- fw.Unsigned16(CURRENT_PACKET_VERSION);
+ fw.unsigned_16(CURRENT_PACKET_VERSION);
const Map & map = egbase.map();
const Field & fields_end = map[map.max_index()];
@@ -240,48 +240,48 @@
assert(mos.is_object_known(*flag));
assert(!mos.is_object_saved(*flag));
- fw.Unsigned32(mos.get_object_file_index(*flag));
+ fw.unsigned_32(mos.get_object_file_index(*flag));
// Owner is already written in the existanz packet.
// Animation is set by creator.
- fw.Unsigned16(flag->m_animstart);
+ fw.unsigned_16(flag->m_animstart);
// Roads are n
Follow ups