widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #02517
[Merge] lp:~widelands-dev/widelands/bug-1347648 into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1347648 into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1347648 in widelands: "Add Map_Object:descr to Lua interface"
https://bugs.launchpad.net/widelands/+bug/1347648
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1347648/+merge/228469
This should be done now. We already had a descr, so I only removed L_MapObject.name
There is a crash in Island Hopping, but that's already there in trunk and I don't know what's causing it. I have reported a new bug for it https://bugs.launchpad.net/widelands/+bug/1349378
--
https://code.launchpad.net/~widelands-dev/widelands/bug-1347648/+merge/228469
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1347648 into lp:widelands.
=== modified file 'campaigns/atl01.wmf/scripting/init.lua'
--- campaigns/atl01.wmf/scripting/init.lua 2014-07-22 13:37:11 +0000
+++ campaigns/atl01.wmf/scripting/init.lua 2014-07-28 11:30:21 +0000
@@ -74,7 +74,7 @@
function send_building_lost_message(f)
-- TODO: replace menu.png with representative_image as soon as this has been wrapped
p1:send_message(_"Building lost!",
- rt("image=tribes/atlanteans/".. f.immovable.name .."/menu.png",
+ rt("image=tribes/atlanteans/".. f.immovable.descr.name .."/menu.png",
p(_"We lost a building to the ocean!")
), { field = f, popup = true }
)
@@ -283,7 +283,7 @@
local bobs = f.bobs
if #bobs then
for idx, b in ipairs(bobs) do
- if b.name == "ship" then
+ if b.descr.type_name == "ship" then
nships = nships + 1
end
end
=== modified file 'campaigns/tutorial01.wmf/scripting/init.lua'
--- campaigns/tutorial01.wmf/scripting/init.lua 2014-07-22 13:37:11 +0000
+++ campaigns/tutorial01.wmf/scripting/init.lua 2014-07-28 11:30:21 +0000
@@ -280,7 +280,7 @@
local remove_field = true
if f.immovable then
- local n = f.immovable.name:match("greenland_stones(%d*)")
+ local n = f.immovable.descr.name:match("greenland_stones(%d*)")
if n then
n = tonumber(n)
f.immovable:remove()
@@ -442,7 +442,7 @@
blocker:lift_blocks()
-- Wait for flag
- while not (f.immovable and f.immovable.name == "flag") do sleep(300) end
+ while not (f.immovable and f.immovable.descr.type_name == "flag") do sleep(300) end
o.done = true
sleep(300)
@@ -671,7 +671,7 @@
local function _find_nearby_flag()
for i=2,8 do
for idx, f in ipairs(conquer_field:region(i)) do
- if f.immovable and f.immovable.name == "flag" then
+ if f.immovable and f.immovable.descr.type_name == "flag" then
return f
end
end
@@ -701,7 +701,7 @@
while 1 do
local cnt = 0
for idx, f in ipairs(dest:region(6)) do
- if f.immovable and f.immovable.name:sub(1,4) == "resi" then
+ if f.immovable and f.immovable.descr.name:sub(1,4) == "resi" then
cnt = cnt + 1
if cnt >= wanted then return end
end
@@ -736,7 +736,7 @@
local o = msg_box(enhance_fortress)
while not (citadel_field.immovable and
- citadel_field.immovable.name == "citadel") do sleep(800) end
+ citadel_field.immovable.descr.name == "citadel") do sleep(800) end
o.done = true
-- Wait for soldiers to move in
=== modified file 'maps/MP Scenarios/Island Hopping.wmf/scripting/first_island.lua'
--- maps/MP Scenarios/Island Hopping.wmf/scripting/first_island.lua 2014-02-19 17:02:45 +0000
+++ maps/MP Scenarios/Island Hopping.wmf/scripting/first_island.lua 2014-07-28 11:30:21 +0000
@@ -45,7 +45,7 @@
while castle_field == nil do
sleep(7477)
for idx, f in pairs(hill) do
- if f.immovable and f.immovable.name == "castle"
+ if f.immovable and f.immovable.descr.name == "castle"
then
castle_field = f
started_claiming = game.time
@@ -60,7 +60,7 @@
while true do
sleep(1049)
local imm = castle_field.immovable
- if not imm or imm.name ~= "castle" or imm.owner ~= claiming_player then
+ if not imm or imm.descr.name ~= "castle" or imm.owner ~= claiming_player then
send_to_all(lost_control:format(claiming_player.name))
break
end
=== modified file 'maps/MP Scenarios/Smugglers.wmf/scripting/smuggling.lua'
--- maps/MP Scenarios/Smugglers.wmf/scripting/smuggling.lua 2014-02-15 17:15:56 +0000
+++ maps/MP Scenarios/Smugglers.wmf/scripting/smuggling.lua 2014-07-28 11:30:21 +0000
@@ -8,7 +8,7 @@
-- Find a warehouse for in the given area
function find_warehouse(region)
for idx,f in ipairs(region) do
- if f.immovable and f.immovable.name == "warehouse" then
+ if f.immovable and f.immovable.descr.type_name == "warehouse" then
return f.immovable
end
end
@@ -44,9 +44,9 @@
break
end
- if not send_whf.immovable or send_whf.immovable.name ~= "warehouse" or
+ if not send_whf.immovable or send_whf.immovable.descr.type_name ~= "warehouse" or
send_whf.immovable.owner ~= send_plr or
- not recv_whf.immovable or recv_whf.immovable.name ~= "warehouse" or
+ not recv_whf.immovable or recv_whf.immovable.descr.type_name ~= "warehouse" or
recv_whf.immovable.owner ~= recv_plr
then
send_to_all(smuggling_route_broken:bformat(
=== modified file 'scripting/objective_utils.lua'
--- scripting/objective_utils.lua 2010-09-22 06:45:27 +0000
+++ scripting/objective_utils.lua 2014-07-28 11:30:21 +0000
@@ -2,20 +2,20 @@
-- objective_utils.lua
-- ---------------------
--
--- This script contains utility functions for typical tasks that need to
+-- This script contains utility functions for typical tasks that need to
-- be checked for objectives.
-- =======================================================================
--- PRIVATE FUNCTIONS
+-- PRIVATE FUNCTIONS
-- =======================================================================
function _check_for_region(plr, which, region)
local carr = {}
for idx,f in ipairs(region) do
if f.immovable and f.immovable.owner == plr then
- if carr[f.immovable.name] == nil then
- carr[f.immovable.name] = 1
+ if carr[f.immovable.descr.name] == nil then
+ carr[f.immovable.descr.name] = 1
else
- carr[f.immovable.name] = carr[f.immovable.name] + 1
+ carr[f.immovable.descr.name] = carr[f.immovable.descr.name] + 1
end
end
end
=== modified file 'src/scripting/lua_map.cc'
--- src/scripting/lua_map.cc 2014-07-26 10:43:23 +0000
+++ src/scripting/lua_map.cc 2014-07-28 11:30:21 +0000
@@ -2003,7 +2003,6 @@
const PropertyType<L_MapObject> L_MapObject::Properties[] = {
PROP_RO(L_MapObject, __hash),
PROP_RO(L_MapObject, descr),
- PROP_RO(L_MapObject, name),
PROP_RO(L_MapObject, serial),
{nullptr, nullptr, nullptr},
};
@@ -2054,17 +2053,6 @@
}
-/* RST
- .. attribute:: name
-
- (RO) The internal name of this immovable. This is the same as the
- directory name of this immovable in the tribe or world directory.
-*/
-int L_MapObject::get_name(lua_State * L) {
- lua_pushstring(L, get(L, get_egbase(L))->descr().name().c_str());
- return 1;
-}
-
// use the dynamic type of BuildingDescription
#define CAST_TO_LUA(klass, lua_klass) to_lua<lua_klass> \
(L, new lua_klass(static_cast<const klass *>(desc)))
@@ -2214,7 +2202,6 @@
};
const PropertyType<L_BaseImmovable> L_BaseImmovable::Properties[] = {
PROP_RO(L_BaseImmovable, size),
- PROP_RO(L_BaseImmovable, name),
PROP_RO(L_BaseImmovable, fields),
{nullptr, nullptr, nullptr},
};
=== modified file 'src/scripting/lua_map.h'
--- src/scripting/lua_map.h 2014-07-26 10:43:23 +0000
+++ src/scripting/lua_map.h 2014-07-28 11:30:21 +0000
@@ -464,7 +464,6 @@
*/
int get___hash(lua_State *);
int get_descr(lua_State *);
- int get_name(lua_State *);
int get_serial(lua_State *);
/*
=== modified file 'tribes/scripting/format_help.lua'
--- tribes/scripting/format_help.lua 2014-07-26 10:45:22 +0000
+++ tribes/scripting/format_help.lua 2014-07-28 11:30:21 +0000
@@ -251,7 +251,7 @@
-- TODO(GunChleoc) "carrier" for headquarters, "ship" for ports, "scout" for scouts_hut, "shipwright" for shipyard?
-- TODO(GunChleoc) use aihints for gamekeeper, forester?
local representative_resource = nil
- if(building_description.type == "productionsite") then
+ if(building_description.type_name == "productionsite") then
representative_resource = building_description.output_ware_types[1]
if(not representative_resource) then
representative_resource = building_description.output_worker_types[1]
@@ -260,9 +260,10 @@
-- TODO(GunChleoc) create descr objects for flag, portdock, ...
elseif(building_description.is_port or building_description.name == "shipyard") then
representative_resource = nil
- elseif(building_description.type == "warehouse") then
+ elseif(building_description.type_name == "warehouse") then
representative_resource = wl.Game():get_ware_description(tribename, "log")
- elseif(building_description.type == "militarysite" or building_description.type == "trainingsite") then
+ elseif(building_description.type_name == "militarysite" or
+ building_description.type_name == "trainingsite") then
representative_resource = wl.Game():get_worker_description(tribename, "soldier")
end
Follow ups