Add make infrastructure and allowed buildings tools

Bug #536458 reported by Nasenbaer on 2007-02-23
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Won't Fix
Medium
Unassigned

Bug Description

When using the "create player-infrastructure" or "Enable/disable buildings"- tools and save the map afterwards, the map will crash.

One problem seems to be, that the Editor saves the headquarter at the startingposition and when the map is loaded, it can't create a headquarter at the starting-position, while there is allready one.

For example, I added two mapd (both in tar.bz2) Test1 is unchanged and will crash with an error-message like:

widelands: src/immovable.cc:75: void BaseImmovable::set_position(Editor_Game_Base*, Coords): Zusicherung other->get_size() == NONE nicht erfüllt.
Abgebrochen

Test2.wmf is modified manually, so that startingposition is on another place.
If you start it, there will be no crash, but two headquarters.

Revision history for this message
Nasenbaer (nasenbaer) wrote :

The file Test-maps.tar.bz2 was added: None

Revision history for this message
Nasenbaer (nasenbaer) wrote :

Logged In: YES
user_id=1392996
Originator: YES

to avoid misunderstandings: saving the map in the Editor works fine, but if you try to load and start the map (with selection of scenario mode), it crashes.

Revision history for this message
Sigra (sigra) wrote :

Logged In: YES
user_id=31104
Originator: NO

The following change should fix your problem, although there is still the problem that the editor does not set the nodes as seen when it creates the headquarter, so now Test1 loaded as scenario does not show anything. But i guess you already noticed this when looking at Test2, where it is apparent that only the area around the second headquarter (created when starting the game) is revealed.
--- src/player.cc (revision 2046)
+++ src/player.cc (arbetskopia)
@@ -85,14 +85,19 @@
        if (place_headquarters) {
                const Tribe_Descr & trdesc = m_tribe;
                const int plnum = m_plnum;
+ const Coords starting_pos = map.get_starting_pos(plnum);
+ Warehouse * const warehouse =
+ dynamic_cast<Warehouse * const>(map.get_immovable(starting_pos));
                //try {
                        trdesc.load_warehouse_with_start_wares
                                (egbase(),
- *dynamic_cast<Warehouse * const>
- (egbase().warp_building
- (map.get_starting_pos(plnum),
- plnum,
- trdesc.get_building_index("headquarters"))));
+ *(warehouse ?
+ warehouse :
+ dynamic_cast<Warehouse * const>
+ (egbase().warp_building
+ (starting_pos,
+ plnum,
+ trdesc.get_building_index("headquarters")))));
                //} catch (const Descr_Maintainer<Building_Descr>::Nonexistent) {
                        //throw wexception("Tribe %s lacks headquarters", tribe.get_name());
                //}

Revision history for this message
Nasenbaer (nasenbaer) wrote :

Logged In: YES
user_id=1392996
Originator: YES

You are right, it doesn't crash with this patch, but it is even more problematic than just no reveal of the map.
I tried to build a building after hitting F5, which reveals whole map, and nothing happend.
The ressources and workers were in headquarters, but no carrier went out to go on the street I created and no builder walked to the constructionside.. or is this a problem base upon the no revealing of the map?

Revision history for this message
Sigra (sigra) wrote :

Logged In: YES
user_id=31104
Originator: NO

The map is not revealed because Editor_Game_Base::do_conquer_area does not reveal it. In the game it is revealed because the overridden Game::do_conquer_area reveals it (see [http://widelands.svn.sourceforge.net/viewvc/widelands/trunk/src/game.cc?view=markup&pathrev=2018#l_355). This patch makes Editor_Game_Base::do_conquer_area do all that Game::do_conquer_area did. It causes a failed assertion when unloading the map in the editor. It seems like the wares do not leave the headquarter immediately, but after a while (timeout). Also note that roads created in the editor do not get a carrier (the editor must be fixed to place them together with the roads).
File Added: bug1667088-1.diff

Revision history for this message
Sigra (sigra) wrote :

The file bug1667088-1.diff was added: Patch.

Revision history for this message
Nasenbaer (nasenbaer) wrote :

Logged In: YES
user_id=1392996
Originator: YES

okay, I see...
The timeout is strange and shouldn't be existing (what is it for? - or is it just a bug?).. just think of a map with allready existing infrastructure... it is normal, that the player wants to start directly and doesn't want to wait for 20-30 seconds until he is able to do something

Revision history for this message
Nasenbaer (nasenbaer) wrote :

Logged In: YES
user_id=1392996
Originator: YES

okay and another bug... now that this partly works, I tried to place a bit bigger infrastructure (two lumberjacks, a forester and a sawmill).
While starting this map, widelands crashes withot error-mesage. Last output was that widelands tries to read warehouse_data.
Another try with a map with headquarters and a warehouse worked, so I fear, that widelands thinks every building at the start of a game is a warehouse (headquarters) and so wants to read its warehouse_data.

Revision history for this message
Nasenbaer (nasenbaer) wrote :

Logged In: YES
user_id=1392996
Originator: YES

okay.. the whole tool seems to be unfinnished. :-/
Just tried the following:
I placed a military building (tested sentry, barrier and fortress) and no area was conquered, so even if you CAN build a map with existing infrastructure, you can't have more space than that around the headquarters.

Revision history for this message
Nasenbaer (nasenbaer) wrote :

Logged In: YES
user_id=1392996
Originator: YES

Funny :-)
I found out another strange feature of maps created with those tools:
If you build up a building and it is completely constructed, the builder will stay there - showing his working-animationm, even if the worker of the building is allready working, the builder stays there...
Seems as if we found a feature, which needs some hard work. :-P - Or we must deactivate it in B10

Revision history for this message
Sigra (sigra) wrote :

Logged In: YES
user_id=31104
Originator: NO

I also noticed the problems with militarysites not conquering and builders staying. It is correct that the make infrastructure tool is unfinished. sirver threw in the towel and disabled it in revision 719 [http://widelands.svn.sourceforge.net/viewvc/widelands?view=rev&revision=719]. I enabled it again in revision 1794 [http://widelands.svn.sourceforge.net/viewvc/widelands?view=rev&revision=1794] without finishing it. I am afraid it is very complicated to fix.

The militarysite problem is probably fixable. It just has to be filled with with soldiers when created in the editor and then the conquer function must be called to gain the territory.

I have no idea why the builder stays.

Revision history for this message
Sigra (sigra) wrote :

Logged In: YES
user_id=31104
Originator: NO

The make infrastructure tool can not work as the editor is coded now. It adds buildings to the map (at the very least a headquarter) and buildings can only be saved from a game. Saving buildings requires writing a Game_Game_Class_Data_Packet (for m_conquer_info), but Game_Game_Class_Data_Packet::Write takes a Game * parameter, and there is no Game object in the editor. So we have to remove the make infrastructure buttons from the player dialog before the release.

Revision history for this message
Sigra (sigra) wrote :

Logged In: YES
user_id=31104
Originator: NO

The make infrastructure and allowed buildings tools have been disabled again in revision 2078. (While doing that I found a bunch of other bugs in the players dialog and fixed them in revision 2080.)

Revision history for this message
SirVer (sirver) wrote :

I guess this will need an overhoal. I link this bug to the new blueprint for player-infrastructure. I mark it as confirmed, though it is likely that the problems describe here are invalid with a new implementation.

Changed in widelands:
status: New → Confirmed
tags: added: editor playerinfrastructure
Revision history for this message
SirVer (sirver) wrote :

Setting to incomplete for bug sweeping.

Changed in widelands:
status: Confirmed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for widelands because there has been no activity for 60 days.]

Changed in widelands:
status: Incomplete → Expired
SirVer (sirver) on 2014-05-31
Changed in widelands:
status: Expired → Confirmed
Revision history for this message
SirVer (sirver) wrote :

Setting to incomplete for bug sweeping.

Changed in widelands:
status: Confirmed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for widelands because there has been no activity for 60 days.]

Changed in widelands:
status: Incomplete → Expired
SirVer (sirver) on 2015-01-12
Changed in widelands:
status: Expired → Confirmed
GunChleoc (gunchleoc) on 2016-10-10
tags: added: tribes
removed: playerinfrastructure
Revision history for this message
GunChleoc (gunchleoc) wrote :
Changed in widelands:
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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