You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constchar* toStringBuildTypeSpecificType(const eBuildType &buildType, constint &specificTypeId) {
std::cout << "ID " << specificTypeId << std::endl;
switch (buildType) {
case eBuildType::SPECIAL:
std::cout << "SPECIAL" << std::endl;
returnsSpecialInfo[specificTypeId].description;
case eBuildType::UNIT:
returnsUnitInfo[specificTypeId].name;
case eBuildType::STRUCTURE:
returnsStructureInfo[specificTypeId].name;
case eBuildType::BULLET:
returnsBulletInfo[specificTypeId].description;
case eBuildType::UPGRADE:
returnsUpgradeInfo[specificTypeId].description;
case eBuildType::UNKNOWN:
returnstd::string("Unknown");
default:
assert(false && "Undefined buildType?");
break;
}
return"";
}
You shall not have specificTypeId=-1 and eBuildType::SPECIAL because you read after sSpecialInfo[specificTypeId].description sSpecialInfo is a tab so -1 is an unauthorised index
but the program do it without crash !!!
I read the debug log: 4409|WARN|NONE|cGameEvent [type=GAME_EVENT_SPICE_BLOOM_SPAWNED], [entityType=SPECIAL], [entityId=-1], [entitySpecificType=-1 =], [isReinforce=false], [atCell=2891], [buildingListItem=nullptr] [originId=-1]|(logbook)
I see [entitySpecificType=-1 =] and the description is passed on trap !
I should read [entitySpecificType=-1 =DESCRIPTION_HERE]
description is a char[64]
On another branch, i changed description to be a std::string and no char[64] and it is a drama:
When specificTypeId=-1 and eBuildType::SPECIAL the program cannot read sSpecialInfo[specificTypeId].description
because -1 is an unauthorised index and the program crash.
It's logical.
Why on master branch, the program doesn't crash when I call a tab with index -1 ?
Who can help me to patch his insoluble problem for me ?
(where is the link about GAME_EVENT_SPICE_BLOOM_SPAWNED and entityType=SPECIAL not Unknown ?
The text was updated successfully, but these errors were encountered:
in this function:
You shall not have
specificTypeId=-1
andeBuildType::SPECIAL
because you read aftersSpecialInfo[specificTypeId].description
sSpecialInfo
is a tab so -1 is an unauthorised indexbut the program do it without crash !!!
I read the debug log:
4409|WARN|NONE|cGameEvent [type=GAME_EVENT_SPICE_BLOOM_SPAWNED], [entityType=SPECIAL], [entityId=-1], [entitySpecificType=-1 =], [isReinforce=false], [atCell=2891], [buildingListItem=nullptr] [originId=-1]|(logbook)
I see
[entitySpecificType=-1 =]
and the description is passed on trap !I should read
[entitySpecificType=-1 =DESCRIPTION_HERE]
description is a
char[64]
On another branch, i changed description to be a
std::string
and nochar[64]
and it is a drama:When
specificTypeId=-1
andeBuildType::SPECIAL
the program cannot readsSpecialInfo[specificTypeId].description
because -1 is an unauthorised index and the program crash.
It's logical.
Why on master branch, the program doesn't crash when I call a tab with index -1 ?
Who can help me to patch his insoluble problem for me ?
(where is the link about
GAME_EVENT_SPICE_BLOOM_SPAWNED
and entityType=SPECIAL
notUnknown
?The text was updated successfully, but these errors were encountered: