PDA

View Full Version : FRE: SpawnpointList map linkup



curio
09-10-2003, 02:18 PM
I have a feature request that I've been working on, but not making alot of progress.

I'd like the "Spawn Point List" window to support a left-click that identifies the location of the spawn point on the map. Oddly enough, this currently works in reverse. Clickin on a spawn point (w/o a mob) will highlight the entry in the Spawn Point List window.
Where I can see if this is indeed the spot where I last saw mob XXX spawn. I'd like to be able to click in the spawn point list window and have the map show me where spawn PH / Boss xx is about due to appear..

curio
09-10-2003, 02:30 PM
here's what I found when i was trying to get this to work for myself.

I needed to
1) capture the left click, and then
2) notify (someone) that I have selected a spawn, and
3) maybe trigger a line-draw event.

1) For the mouse event, i looked at spawnlist and spawnlist2, both of which support the sort of LeftClick I was looking for.

spawnlist.cpp and spawnlist2.cpp use mouseButtonPressed() or doubleClicked() slot/signals to capture the mouse press. They each do it a bit differently, tho both seem to work. I was able to add a signal/slot to spawnpointlist.cpp catpure the mouse event and get that working. ie: "debug(LEFT CLICK in SPL.cpp detected)" msgs in stderr.


2-3) The spawn select and proper emit() elude me. spawnlist.cpp simply sets a property, setSelected(x,TRUE). there seems to be a signal/slot set up to watch for this, upon which there's an "emit spawnSelected()". The problem for spawnPOINTlist.cpp seems to be that spawnlist and spawnpointlist dont share the same base object type (and are completely seperate objects?) so calling the same sort of routine didnt seem to do much.

Mainly, the conflict between spawnlist's litem->item() method and SPL.cpp's litem->spawnPoint(). sending a spawnpoint instead of a item as the argument to spawnSelected() didnt work. I wasnt able to determine if there's a way to derive an item() object from a spawnpoint (it might not have one, as that doesnt make alot of sense).

It occurred to me that i might want to create a fake item()using the location coords found in the spawnPoint() and then trigger the same spawnSelected() code that handles the drawing in spawnlist.cpp. But that approach didnt seem right.

So maybe add a handler to the map to deal with spawnPoints? Well couldnt find the handler in the map for dealing with spawnPoints() to examine how that happened, so ran into a wall there.

--

Maybe that "analysis" will help / encourage someone to take a stab at this feature request.

Zaphod
09-10-2003, 04:51 PM
Originally posted by curio
I have a feature request that I've been working on, but not making alot of progress.

I'd like the "Spawn Point List" window to support a left-click that identifies the location of the spawn point on the map. Oddly enough, this currently works in reverse. Clickin on a spawn point (w/o a mob) will highlight the entry in the Spawn Point List window.
Where I can see if this is indeed the spot where I last saw mob XXX spawn. I'd like to be able to click in the spawn point list window and have the map show me where spawn PH / Boss xx is about due to appear..

Ummmm, actually if you select a spawn point in the spawn point list window the map does indicate where it is (with a flashing blue box around the spawn point [if you have Show Spawn Points enabled for the map]). The currently selected spawn point state is currently maintained in the SpawnMonitor and both the Spawn Point List and the Map classes all use that. The code that handles the display of spawn points on the map is Map::paintSpawnPoints, and the flashing blue square around the selected spawn point can be found from map.cpp line 3994 to line 4011.

If you wish the behavior to be different (line drawn to the spawn point) and/or have the selection be indicated when spawn points aren't shown that is a seperate issue.

Enjoy,
Zaphod (dohpaZ)

curio
09-29-2003, 02:37 AM
Thanks for putting this into the 4.3.13 I like the line. Much easier to see than the blue box. :)

One pfiffling complaint: when you zone, your selection doesnt clear, so you get a spawnpoint selected line going off into nowhere. Just needed to clear the selected spawnpoint when you zone.


in spawnmonitor.cpp find


void SpawnMonitor::clear(void)
{
emit clearSpawnPoints();
m_spawns.clear();
m_points.clear();
}


and add one line,
to


void SpawnMonitor::clear(void)
{
emit clearSpawnPoints();
m_spawns.clear();
m_points.clear();
m_selected = NULL;
}


Also attached in .diff format

Zaphod
09-29-2003, 09:19 PM
curio,
I'm going to integrate your patch into my next release, but in the future could you use the SEQ Patches (http://sourceforge.net/tracker/?atid=310131&group_id=10131&func=browse&s=&menu=4) to post the actual patch. It makes it much easier for me to keep track of them so that they don't unintentionally fall through the cracks.

Thanks and Enjoy,
Zaphod (dohpaZ)