deleteArea sometimes doesn't actually delete the area

Bug #782840 reported by Vadim Peretokin
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Mudlet
Fix Released
Low
Vadim Peretokin
2.0
Fix Released
Undecided
Vadim Peretokin

Bug Description

Not sure why, but sometimes it doesn't remove the area from the list. It does delete the area though as in you can't get a room list of it though.

lua getAreaTable()
table {
  'Lake Narcisse': 106
  'Cyrene, the City of (Brewery)': 67
}
lua deleteArea(106)

lua getAreaTable()
table {
  'Lake Narcisse': 106
  'Cyrene, the City of (Brewery)': 67
}

Sample script:
  for name, id in pairs(getAreaTable()) do
    deleteArea(tonumber(id))
  end
  dispaly(getAreaTable()

Should return {} at the end, but it doesn't.

Revision history for this message
drazik lokelinde (draziklokelinde) wrote :

5993h (100%), 7868m (100%), 26160e (100%), 31200w (100%) cdbk|ex (09:55:14.929)-goto sang
(mapper): Which area would you like to go to?
  1.) the Sangre Plains
  2.) Sangre Plains, the (Ivory Tower)
mstop
(mapper): Stopped walking.
area delete Sangre Plains, the (Ivory Tower)
(mapper): Deleted Sangre Plains, the (Ivory Tower) (182).
goto sang
(mapper): Which area would you like to go to?
  1.) the Sangre Plains
  2.) Sangre Plains, the (Ivory Tower)
Casting off her final fetters, the luminous lady awakens fully, shedding her joyful light from horizon to horizon.
5993h (100%), 7868m (100%), 26160e (100%), 31200w (100%) cdbk|ex (09:56:25.572)

Revision history for this message
Vadim Peretokin (vperetokin) wrote :
Changed in mudlet:
status: New → Confirmed
Heiko (koehnheiko)
Changed in mudlet:
importance: Undecided → High
Heiko (koehnheiko)
Changed in mudlet:
importance: High → Critical
Revision history for this message
Steven Rose (smr-d) wrote :

I just had a quick look.
It seems that there are two maps that store area data.

One map is called areaNamesMap and this relates areaID's to area names.
The other is called areas and this relates areaID's to TArea.

So what should happen is that both these maps should always have the same ID's in them (I assume).

But what is happening is that some IDs are in areaNamesMap that aren't in the area map. The cause of which I haven't narrowed down yet.

Revision history for this message
Steven Rose (smr-d) wrote :

Whoops - please ignore my last comment. I realized this bug has been fixed (just getting used to launchpad).

Note:

The code:

for name, id in pairs(getAreaTable()) do
    deleteArea(tonumber(id))
end

(Still) doesn't necessarily delete all areas. This is because getAreaTable returns a table of {[ area name, area id ]}. So if there are multiple areas with the same name, only one of those areas will be deleted because getAreaTable returns a table where the area name is unique.

Revision history for this message
Chris (chrismudlet) wrote :

An obvious fix for this is to add a getAreaTableSwap() routine. Though I'm not exactly sure why you have areas with the same name.

Heiko (koehnheiko)
Changed in mudlet:
importance: Critical → High
Revision history for this message
Heiko (koehnheiko) wrote :

what chris said, just add a reverse getAreaTableSwap() function for games that have duplicate area names. We can't just delete matching areas as this leads to unexpected intransparent results

Changed in mudlet:
importance: High → Low
Revision history for this message
Vadim Peretokin (vperetokin) wrote :

This patch adds this function for easy inclusion (also exists in chris' repo).

Changed in mudlet:
status: Confirmed → In Progress
assignee: nobody → Vadim Peretokin (vperetokin)
Heiko (koehnheiko)
Changed in mudlet:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.