MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002389VCMIGUI - Otherpublic2016-01-19 07:142016-01-19 10:06
Reportervmarkovtsev 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
PlatformDarwinOSMacOSXOS Version10.11.2
Product Version0.98f 
Target VersionFixed in Version 
Summary0002389: CComponent::getSubtitleInternal segfaults on unknown town buildings
Descriptionstd::string CComponent::getSubtitleInternal() at client/widgets/CComponent.cpp near line 177

case building: return CGI->townh->factions[subtype]->town->buildings[BuildingID(val)]->Name()

If val is not contained in the mapping, nullptr is returned and std::string segfaults later on.
Steps To ReproduceUse map "The Lord of War", load the attached save. End turn. In this particular case, Barbarian town has the following structures:

0: Гильдия Магов 1 уровня
1: Гильдия Магов 2 уровня
2: Гильдия Магов 3 уровня
5: Таверна
7: Форт
8: Цитадель
9: Замок
10: Сельская управа
11: Префектура
12: Муниципалитет
13: Капитолий
14: Рынок
15: Хранилище ресурсов
16: Кузница
17: Чёрный ход
18: Столовая
19: Столовая
21: Гильдия наёмников
22: Двор баллист
23: Храм валгаллы
26: Памятник богам войны

But 27 is requested.
TagsNo tags attached.
Attached Files? file icon The Lord of War.h3m [^] (152,581 bytes) 2016-01-19 07:14
zip file icon save.zip [^] (2,390,088 bytes) 2016-01-19 07:15

- Relationships

-  Notes
(0006310)
vmarkovtsev (developer)
2016-01-19 07:39

https://github.com/vcmi/vcmi/pull/158 [^]
(0006311)
AVS (administrator)
2016-01-19 08:20

The question is why 27 is requested? May be the bug is in other place.
(0006312)
AVS (administrator)
2016-01-19 08:28

Looks like Barbarian town has missing entries:

"extraTownHall": { "id" : 27, "requires" : [ "townHall" ], "mode" : "auto" },
"extraCityHall": { "id" : 28, "requires" : [ "cityHall" ], "mode" : "auto" },
"extraCapitol": { "id" : 29, "requires" : [ "capitol" ], "mode" : "auto" }

Need to check all other towns too.
(0006313)
Warmonger (administrator)
2016-01-19 09:45

"Auto" buildings are just decorative and have no own function. There is also no reason to display them in a message.
(0006314)
AVS (administrator)
2016-01-19 10:06

Now I found a bug.

The problem is that when map is loading, "extra" buildings are added even if the town have no "extra" buildings.

CMapLoaderH3M::convertBuildings

...

    if(ret.find(BuildingID::CITY_HALL) != ret.end())
    {
        ret.insert(BuildingID::EXTRA_CITY_HALL);
    }
    if(ret.find(BuildingID::TOWN_HALL) != ret.end())
    {
        ret.insert(BuildingID::EXTRA_TOWN_HALL);
    }
    if(ret.find(BuildingID::CAPITOL) != ret.end())
    {
        ret.insert(BuildingID::EXTRA_CAPITOL);
    }

- Issue History
Date Modified Username Field Change
2016-01-19 07:14 vmarkovtsev New Issue
2016-01-19 07:14 vmarkovtsev File Added: The Lord of War.h3m
2016-01-19 07:15 vmarkovtsev File Added: save.zip
2016-01-19 07:39 vmarkovtsev Note Added: 0006310
2016-01-19 08:20 AVS Note Added: 0006311
2016-01-19 08:28 AVS Note Added: 0006312
2016-01-19 09:45 Warmonger Note Added: 0006313
2016-01-19 10:06 AVS Note Added: 0006314

Site | Forums | Wiki | Slack | GitHub


Copyright © 2000 - 2024 MantisBT Team
Hosting provided by DigitalOcean