(svn r23193) -Codechange: don't cast away const unneededly

This commit is contained in:
rubidium
2011-11-12 08:10:22 +00:00
parent a8d33a4d89
commit bd64bf6372
6 changed files with 29 additions and 29 deletions

View File

@@ -189,7 +189,7 @@ public:
* @param grfid Parameter for the PSA. Only required for items with parameters.
* @return Pointer to the first position of the storage array or NULL if not present.
*/
virtual int32 *GetPSAFirstPosition(uint index, uint32 grfid) const
virtual const int32 *GetPSAFirstPosition(uint index, uint32 grfid) const
{
return NULL;
}
@@ -398,7 +398,7 @@ struct NewGRFInspectWindow : Window {
}
uint psa_size = nih->GetPSASize(index, this->caller_grfid);
int32 *psa = nih->GetPSAFirstPosition(index, this->caller_grfid);
const int32 *psa = nih->GetPSAFirstPosition(index, this->caller_grfid);
if (psa_size != 0 && psa != NULL) {
if (nih->PSAWithParameter()) {
this->DrawString(r, i++, "Persistent storage [%08X]:", BSWAP32(this->caller_grfid));
@@ -414,12 +414,12 @@ struct NewGRFInspectWindow : Window {
if (nif->properties != NULL) {
this->DrawString(r, i++, "Properties:");
for (const NIProperty *nip = nif->properties; nip->name != NULL; nip++) {
void *ptr = (byte*)base + nip->offset;
const void *ptr = (const byte *)base + nip->offset;
uint value;
switch (nip->read_size) {
case 1: value = *(uint8 *)ptr; break;
case 2: value = *(uint16 *)ptr; break;
case 4: value = *(uint32 *)ptr; break;
case 1: value = *(const uint8 *)ptr; break;
case 2: value = *(const uint16 *)ptr; break;
case 4: value = *(const uint32 *)ptr; break;
default: NOT_REACHED();
}
@@ -448,12 +448,12 @@ struct NewGRFInspectWindow : Window {
this->DrawString(r, i++, "Callbacks:");
for (const NICallback *nic = nif->callbacks; nic->name != NULL; nic++) {
if (nic->cb_bit != CBM_NO_BIT) {
void *ptr = (byte*)base_spec + nic->offset;
const void *ptr = (const byte *)base_spec + nic->offset;
uint value;
switch (nic->read_size) {
case 1: value = *(uint8 *)ptr; break;
case 2: value = *(uint16 *)ptr; break;
case 4: value = *(uint32 *)ptr; break;
case 1: value = *(const uint8 *)ptr; break;
case 2: value = *(const uint16 *)ptr; break;
case 4: value = *(const uint32 *)ptr; break;
default: NOT_REACHED();
}