Blizzard / Blizzard/s2client-api

Inconsistency in the unit data interface

Open
#176 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.7k
Forks
280
PR merge metrics
No merged PRs in 30d

Description

There is a little inconsistency in the unit data interface.

Currently we have:
```c++
//! Data about a unit type. This data is derived from the catalog (xml) data of the game and upgrades.
struct UnitTypeData {
...
//! Cost in minerals to build this unit type.
int mineral_cost;
//! Cost in vespene to build this unit type.
int vespene_cost;
...
```

But
```c++
//! Upgrade data.
struct UpgradeData {
...
//! Mineral cost of researching the upgrade.
uint32_t mineral_cost;
//! Vespene cost of researching the upgrade.
uint32_t vespene_cost;
```

Shouldn't the cost be unit32_t in UnitTypeData too?

Up:
This is more important if we try to compare the cost with the current count of minerals/vespene which is signed int. I believe that should be the same type everywhere.
```c++
//! The mineral count of the player.
//!< \return The mineral count.
virtual int32_t GetMinerals() const = 0;

//! The vespene count of the player.
//!< \return The vespene count.
virtual int32_t GetVespene() const = 0;
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.